diff options
author | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-14 09:43:38 +0100 |
---|---|---|
committer | Nicolas Geoffray <ngeoffray@google.com> | 2014-05-16 09:07:31 +0100 |
commit | 0d3f578909d0d1ea072ca68d78301b6fb7a44451 (patch) | |
tree | 5a90ec26839afa06294a46e67a4c4481982c47bf /compiler/optimizing/pretty_printer.h | |
parent | c2ffcecb61e474f29f3c6a8721dfd00e0252b1f8 (diff) | |
download | art-0d3f578909d0d1ea072ca68d78301b6fb7a44451.zip art-0d3f578909d0d1ea072ca68d78301b6fb7a44451.tar.gz art-0d3f578909d0d1ea072ca68d78301b6fb7a44451.tar.bz2 |
Linearize the graph before creating live ranges.
Change-Id: I02eb5671e3304ab062286131745c1366448aff58
Diffstat (limited to 'compiler/optimizing/pretty_printer.h')
-rw-r--r-- | compiler/optimizing/pretty_printer.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/compiler/optimizing/pretty_printer.h b/compiler/optimizing/pretty_printer.h index dfeafe7..a7727c0 100644 --- a/compiler/optimizing/pretty_printer.h +++ b/compiler/optimizing/pretty_printer.h @@ -100,6 +100,47 @@ class HPrettyPrinter : public HGraphVisitor { DISALLOW_COPY_AND_ASSIGN(HPrettyPrinter); }; +class StringPrettyPrinter : public HPrettyPrinter { + public: + explicit StringPrettyPrinter(HGraph* graph) + : HPrettyPrinter(graph), str_(""), current_block_(nullptr) { } + + virtual void PrintInt(int value) { + str_ += StringPrintf("%d", value); + } + + virtual void PrintString(const char* value) { + str_ += value; + } + + virtual void PrintNewLine() { + str_ += '\n'; + } + + void Clear() { str_.clear(); } + + std::string str() const { return str_; } + + virtual void VisitBasicBlock(HBasicBlock* block) { + current_block_ = block; + HPrettyPrinter::VisitBasicBlock(block); + } + + virtual void VisitGoto(HGoto* gota) { + PrintString(" "); + PrintInt(gota->GetId()); + PrintString(": Goto "); + PrintInt(current_block_->GetSuccessors().Get(0)->GetBlockId()); + PrintNewLine(); + } + + private: + std::string str_; + HBasicBlock* current_block_; + + DISALLOW_COPY_AND_ASSIGN(StringPrettyPrinter); +}; + } // namespace art #endif // ART_COMPILER_OPTIMIZING_PRETTY_PRINTER_H_ |