summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_visualizer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
-rw-r--r--compiler/optimizing/graph_visualizer.cc29
1 files changed, 20 insertions, 9 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index 22a3d124f1..835bca688f 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -194,7 +194,22 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
}
output_ << "]";
}
- if (pass_name_ == kLivenessPassName && instruction->GetLifetimePosition() != kNoLifetime) {
+ if (instruction->HasEnvironment()) {
+ HEnvironment* env = instruction->GetEnvironment();
+ output_ << " (env: [ ";
+ for (size_t i = 0, e = env->Size(); i < e; ++i) {
+ HInstruction* insn = env->GetInstructionAt(i);
+ if (insn != nullptr) {
+ output_ << GetTypeId(insn->GetType()) << insn->GetId() << " ";
+ } else {
+ output_ << " _ ";
+ }
+ }
+ output_ << "])";
+ }
+ if (pass_name_ == kLivenessPassName
+ && is_after_pass_
+ && instruction->GetLifetimePosition() != kNoLifetime) {
output_ << " (liveness: " << instruction->GetLifetimePosition();
if (instruction->HasLiveInterval()) {
output_ << " ";
@@ -202,7 +217,7 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
interval.Dump(output_);
}
output_ << ")";
- } else if (pass_name_ == kRegisterAllocatorPassName) {
+ } else if (pass_name_ == kRegisterAllocatorPassName && is_after_pass_) {
LocationSummary* locations = instruction->GetLocations();
if (locations != nullptr) {
output_ << " ( ";
@@ -310,18 +325,13 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
HGraphVisualizer::HGraphVisualizer(std::ostream* output,
HGraph* graph,
- const char* string_filter,
const CodeGenerator& codegen,
const char* method_name)
- : output_(output), graph_(graph), codegen_(codegen), is_enabled_(false) {
+ : output_(output), graph_(graph), codegen_(codegen) {
if (output == nullptr) {
return;
}
- if (strstr(method_name, string_filter) == nullptr) {
- return;
- }
- is_enabled_ = true;
HGraphVisualizerPrinter printer(graph_, *output_, "", true, codegen_);
printer.StartTag("compilation");
printer.PrintProperty("name", method_name);
@@ -331,7 +341,8 @@ HGraphVisualizer::HGraphVisualizer(std::ostream* output,
}
void HGraphVisualizer::DumpGraph(const char* pass_name, bool is_after_pass) const {
- if (is_enabled_) {
+ DCHECK(output_ != nullptr);
+ if (!graph_->GetBlocks().IsEmpty()) {
HGraphVisualizerPrinter printer(graph_, *output_, pass_name, is_after_pass, codegen_);
printer.Run();
}