diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-16 09:28:54 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-19 10:17:11 +0100 |
commit | ddb311fdeca82ca628fed694c4702f463b5c4927 (patch) | |
tree | 24acde84ed7d0229c36d9bbca2a421acdff9d7a1 /compiler/optimizing/graph_visualizer.cc | |
parent | 27710fa87cc7fc0f205a6b5a46f418a0cf9a5171 (diff) | |
download | art-ddb311fdeca82ca628fed694c4702f463b5c4927.zip art-ddb311fdeca82ca628fed694c4702f463b5c4927.tar.gz art-ddb311fdeca82ca628fed694c4702f463b5c4927.tar.bz2 |
Build live ranges in preparation for register allocation.
Change-Id: I7ae24afaa4e49276136bf34f4ba7d62db7f28c01
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
-rw-r--r-- | compiler/optimizing/graph_visualizer.cc | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc index b9c1164..52e3e37 100644 --- a/compiler/optimizing/graph_visualizer.cc +++ b/compiler/optimizing/graph_visualizer.cc @@ -18,6 +18,7 @@ #include "driver/dex_compilation_unit.h" #include "nodes.h" +#include "ssa_liveness_analysis.h" namespace art { @@ -102,6 +103,24 @@ class HGraphVisualizerPrinter : public HGraphVisitor { } output_ << "]"; } + if (instruction->GetLifetimePosition() != kNoLifetime) { + output_ << " (liveness: " << instruction->GetLifetimePosition(); + if (instruction->HasLiveInterval()) { + output_ << " "; + const GrowableArray<LiveRange>& ranges = instruction->GetLiveInterval()->GetRanges(); + size_t i = ranges.Size() - 1; + do { + output_ << "[" << ranges.Get(i).GetStart() << "," << ranges.Get(i).GetEnd() << "["; + if (i == 0) { + break; + } else { + --i; + output_ << ","; + } + } while (true); + } + output_ << ")"; + } } void PrintInstructions(const HInstructionList& list) { @@ -126,8 +145,14 @@ class HGraphVisualizerPrinter : public HGraphVisitor { void VisitBasicBlock(HBasicBlock* block) { StartTag("block"); PrintProperty("name", "B", block->GetBlockId()); - PrintInt("from_bci", -1); - PrintInt("to_bci", -1); + if (block->GetLifetimeStart() != kNoLifetime) { + // Piggy back on these fields to show the lifetime of the block. + PrintInt("from_bci", block->GetLifetimeStart()); + PrintInt("to_bci", block->GetLifetimeEnd()); + } else { + PrintInt("from_bci", -1); + PrintInt("to_bci", -1); + } PrintPredecessors(block); PrintSuccessors(block); PrintEmptyProperty("xhandlers"); |