summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_visualizer.h
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2021-02-25 23:29:21 -0800
committerLinux Build Service Account <lnxbuild@localhost>2021-02-25 23:29:21 -0800
commit2cb76e08b236e51e6ecc2a70b76cb1ca28ea90cd (patch)
treee88119c8bebd70e06df7eeebe62e81760848d224 /compiler/optimizing/graph_visualizer.h
parent84ba5b80c5e712b47f9415ec4633c85d6b67a7fd (diff)
parentb944d4abd5852df000a22a8a57aa5637eb4441c2 (diff)
Merge b944d4abd5852df000a22a8a57aa5637eb4441c2 on remote branch
Change-Id: I68b3e7ac3f31cf9bd436648e247d24d3ebc32ca3
Diffstat (limited to 'compiler/optimizing/graph_visualizer.h')
-rw-r--r--compiler/optimizing/graph_visualizer.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/compiler/optimizing/graph_visualizer.h b/compiler/optimizing/graph_visualizer.h
index e01d03c19c..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
@@ -112,10 +116,24 @@ class HGraphVisualizer : public ValueObject {
// method attributes is used. Such empty blocks don't break the c1visualizer parser.
static std::string InsertMetaDataAsCompilationBlock(const std::string& meta_data);
+ 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_;
+ const CodeGenerator* codegen_;
+ OptionalDefaultNamer namer_;
DISALLOW_COPY_AND_ASSIGN(HGraphVisualizer);
};