summaryrefslogtreecommitdiff
path: root/compiler/optimizing/graph_visualizer.cc
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2015-06-26 10:33:45 +0000
committerDavid Brazdil <dbrazdil@google.com>2015-06-26 13:49:50 +0100
commitfc6a86ab2b70781e72b807c1798b83829ca7f931 (patch)
tree90201491e811cf7be0e0469d7a06a828f4384cad /compiler/optimizing/graph_visualizer.cc
parentd3eaade87ac079accca30473ef0a3b38ab600828 (diff)
Revert "Revert "ART: Implement try/catch blocks in Builder""
This patch enables the GraphBuilder to generate blocks and edges which represent the exceptional control flow when try/catch blocks are present in the code. Actual compilation is still delegated to Quick and Baseline ignores the additional code. To represent the relationship between try and catch blocks, Builder splits the edges which enter/exit a try block and links the newly created blocks to the corresponding exception handlers. This layout will later enable the SsaBuilder to correctly infer the dominators of the catch blocks and to produce the appropriate reverse post ordering. It will not, however, allow for building the complete SSA form of the catch blocks and consequently optimizing such blocks. To this end, a new TryBoundary control-flow instruction is introduced. Codegen treats it the same as a Goto but it allows for additional successors (the handlers). This reverts commit 3e18738bd338e9f8363b26bc895f38c0ec682824. Change-Id: I4f5ea961848a0b83d8db3673763861633e9bfcfb
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
-rw-r--r--compiler/optimizing/graph_visualizer.cc37
1 files changed, 33 insertions, 4 deletions
diff --git a/compiler/optimizing/graph_visualizer.cc b/compiler/optimizing/graph_visualizer.cc
index 7d723ef13d..30d61ef040 100644
--- a/compiler/optimizing/graph_visualizer.cc
+++ b/compiler/optimizing/graph_visualizer.cc
@@ -252,8 +252,22 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
AddIndent();
output_ << "successors";
for (size_t i = 0, e = block->GetSuccessors().Size(); i < e; ++i) {
- HBasicBlock* successor = block->GetSuccessors().Get(i);
- output_ << " \"B" << successor->GetBlockId() << "\" ";
+ if (!block->IsExceptionalSuccessor(i)) {
+ HBasicBlock* successor = block->GetSuccessors().Get(i);
+ output_ << " \"B" << successor->GetBlockId() << "\" ";
+ }
+ }
+ output_<< std::endl;
+ }
+
+ void PrintExceptionHandlers(HBasicBlock* block) {
+ AddIndent();
+ output_ << "xhandlers";
+ for (size_t i = 0, e = block->GetSuccessors().Size(); i < e; ++i) {
+ if (block->IsExceptionalSuccessor(i)) {
+ HBasicBlock* handler = block->GetSuccessors().Get(i);
+ output_ << " \"B" << handler->GetBlockId() << "\" ";
+ }
}
if (block->IsExitBlock() &&
(disasm_info_ != nullptr) &&
@@ -365,6 +379,15 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
<< std::noboolalpha;
}
+ void VisitTryBoundary(HTryBoundary* try_boundary) OVERRIDE {
+ StartAttributeStream("is_entry") << std::boolalpha
+ << try_boundary->IsTryEntry()
+ << std::noboolalpha;
+ StartAttributeStream("is_exit") << std::boolalpha
+ << try_boundary->IsTryExit()
+ << std::noboolalpha;
+ }
+
bool IsPass(const char* name) {
return strcmp(pass_name_, name) == 0;
}
@@ -579,8 +602,14 @@ class HGraphVisualizerPrinter : public HGraphVisitor {
}
PrintPredecessors(block);
PrintSuccessors(block);
- PrintEmptyProperty("xhandlers");
- PrintEmptyProperty("flags");
+ PrintExceptionHandlers(block);
+
+ if (block->IsCatchBlock()) {
+ PrintProperty("flags", "catch_block");
+ } else {
+ PrintEmptyProperty("flags");
+ }
+
if (block->GetDominator() != nullptr) {
PrintProperty("dominator", "B", block->GetDominator()->GetBlockId());
}