diff options
author | David Brazdil <dbrazdil@google.com> | 2015-05-15 16:44:05 +0100 |
---|---|---|
committer | David Brazdil <dbrazdil@google.com> | 2015-05-18 15:12:23 +0100 |
commit | c7a24854a09bf2b2f6678f111baea2ecc3641980 (patch) | |
tree | 4b62f3425e909c789319080bd7b47afcef2918ad /compiler/optimizing/graph_visualizer.cc | |
parent | 4b49a861e69580206988024e6987029340667628 (diff) |
ART: Revert change to LiveRange::Dump
Changes back the LiveRange printing format to "[start,end)" for better
clarity. However, it removes the space after comma due to b/1189305
and prints the "ranges" attribute with curly brackets to improve
readability.
This is a resubmission of CL Ic83025fa78d6f1edb5e0e39d66160182b0198ab8
which fixes a compilation issue on target.
Bug: 21189305
Change-Id: Ic232c02ba19a710ead67793a039f99c0345353c7
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
-rw-r--r-- | compiler/optimizing/graph_visualizer.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc index 7ea1240c5e..640d74321f 100644 --- a/compiler/optimizing/graph_visualizer.cc +++ b/compiler/optimizing/graph_visualizer.cc @@ -42,13 +42,18 @@ static bool HasWhitespace(const char* str) { class StringList { public: + enum Format { + kArrayBrackets, + kSetBrackets, + }; + // Create an empty list - StringList() : is_empty_(true) {} + StringList(Format format = kArrayBrackets) : format_(format), is_empty_(true) {} // Construct StringList from a linked list. List element class T // must provide methods `GetNext` and `Dump`. template<class T> - explicit StringList(T* first_entry) : StringList() { + explicit StringList(T* first_entry, Format format = kArrayBrackets) : StringList(format) { for (T* current = first_entry; current != nullptr; current = current->GetNext()) { current->Dump(NewEntryStream()); } @@ -64,6 +69,7 @@ class StringList { } private: + Format format_; bool is_empty_; std::ostringstream sstream_; @@ -71,7 +77,13 @@ class StringList { }; std::ostream& operator<<(std::ostream& os, const StringList& list) { - return os << "[" << list.sstream_.str() << "]"; + switch (list.format_) { + case StringList::kArrayBrackets: return os << "[" << list.sstream_.str() << "]"; + case StringList::kSetBrackets: return os << "{" << list.sstream_.str() << "}"; + default: + LOG(FATAL) << "Invalid StringList format"; + UNREACHABLE(); + } } /** @@ -291,7 +303,8 @@ class HGraphVisualizerPrinter : public HGraphVisitor { StartAttributeStream("liveness") << instruction->GetLifetimePosition(); if (instruction->HasLiveInterval()) { LiveInterval* interval = instruction->GetLiveInterval(); - StartAttributeStream("ranges") << StringList(interval->GetFirstRange()); + StartAttributeStream("ranges") + << StringList(interval->GetFirstRange(), StringList::kSetBrackets); StartAttributeStream("uses") << StringList(interval->GetFirstUse()); StartAttributeStream("env_uses") << StringList(interval->GetFirstEnvironmentUse()); StartAttributeStream("is_fixed") << interval->IsFixed(); |