diff options
author | Alex Light <allight@google.com> | 2021-01-09 00:01:28 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-01-09 00:01:28 +0000 |
commit | a44cfb644d67dc8789cee49359f439c92c68b0e2 (patch) | |
tree | 9ec4efccfaafb17a54e6ff64d5cceffeeffa12a3 /compiler/optimizing/graph_visualizer.h | |
parent | e4aa70eb006e01b99fd665710a759c4ca87dce88 (diff) | |
parent | eab2f1dd6a9296503666b2df2d018eeedba5d916 (diff) |
Add operator<< for HGraph and HInstructions. am: dc281e776c am: 32929007fa am: eab2f1dd6a
Original change: https://android-review.googlesource.com/c/platform/art/+/1521034
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: I5beeb4c5c5238fe0749993526d6f260d0cfb0322
Diffstat (limited to 'compiler/optimizing/graph_visualizer.h')
-rw-r--r-- | compiler/optimizing/graph_visualizer.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/compiler/optimizing/graph_visualizer.h b/compiler/optimizing/graph_visualizer.h index b83e88740c..3429c11cbd 100644 --- a/compiler/optimizing/graph_visualizer.h +++ b/compiler/optimizing/graph_visualizer.h @@ -17,11 +17,13 @@ #ifndef ART_COMPILER_OPTIMIZING_GRAPH_VISUALIZER_H_ #define ART_COMPILER_OPTIMIZING_GRAPH_VISUALIZER_H_ +#include <functional> #include <ostream> #include "arch/instruction_set.h" #include "base/arena_containers.h" #include "base/value_object.h" +#include "block_namer.h" namespace art { @@ -101,10 +103,12 @@ class HGraphVisualizer : public ValueObject { public: HGraphVisualizer(std::ostream* output, HGraph* graph, - const CodeGenerator* codegen); + const CodeGenerator* codegen, + std::optional<std::reference_wrapper<const BlockNamer>> namer = std::nullopt); void PrintHeader(const char* method_name) const; void DumpGraph(const char* pass_name, bool is_after_pass, bool graph_in_bad_state) const; + void DumpGraphDebug() const; void DumpGraphWithDisassembly() const; // C1visualizer file format does not support inserting arbitrary metadata into a cfg @@ -115,9 +119,21 @@ class HGraphVisualizer : public ValueObject { static void DumpInstruction(std::ostream* output, HGraph* graph, HInstruction* instruction); private: + class OptionalDefaultNamer final : public BlockNamer { + public: + explicit OptionalDefaultNamer(std::optional<std::reference_wrapper<const BlockNamer>> inner) + : namer_(inner) {} + + std::ostream& PrintName(std::ostream& os, HBasicBlock* blk) const override; + + private: + std::optional<std::reference_wrapper<const BlockNamer>> namer_; + }; + std::ostream* const output_; HGraph* const graph_; const CodeGenerator* codegen_; + OptionalDefaultNamer namer_; DISALLOW_COPY_AND_ASSIGN(HGraphVisualizer); }; |