summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/graph_visualizer.cc
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2015-01-23 14:39:08 +0000
committerDavid Brazdil <dbrazdil@google.com>2015-02-04 13:47:49 +0000
commit5e8b137d28c840b128e2488f954cccee3e86db14 (patch)
treec56e4c709ce07d605ab4b754e89f7739264feb73 /compiler/optimizing/graph_visualizer.cc
parentf9af19413333c271192c3b11425f865bd8054c0c (diff)
downloadandroid_art-5e8b137d28c840b128e2488f954cccee3e86db14.tar.gz
android_art-5e8b137d28c840b128e2488f954cccee3e86db14.tar.bz2
android_art-5e8b137d28c840b128e2488f954cccee3e86db14.zip
Create HGraph outside Builder, print timings
This patch refactors the way HGraph objects are created, moving the instantiation out of the Builder class and creating the CodeGenerator earlier. The patch uses this to build a single interface for printing timings info and dumping the CFG. Change-Id: I2eb63eabf28e2d0f5cdc7affaa690c3a4b1bdd21
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
-rw-r--r--compiler/optimizing/graph_visualizer.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index 22a3d124f1..9383d31e8f 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -194,7 +194,9 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
}
output_ << "]";
}
- if (pass_name_ == kLivenessPassName && instruction->GetLifetimePosition() != kNoLifetime) {
+ if (pass_name_ == kLivenessPassName
+ && is_after_pass_
+ && instruction->GetLifetimePosition() != kNoLifetime) {
output_ << " (liveness: " << instruction->GetLifetimePosition();
if (instruction->HasLiveInterval()) {
output_ << " ";
@@ -202,7 +204,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 +312,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 +328,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();
}