summaryrefslogtreecommitdiff
path: root/compiler/optimizing/nodes.h
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2015-09-22 13:04:14 +0100
committer David Brazdil <dbrazdil@google.com> 2015-09-25 10:40:08 +0100
commitd7558daaa86decf5a38f4f9bcd82267ab6e3e17f (patch)
treeabfbc97a44e301f850b775eaa1d63aaa5efd1a0e /compiler/optimizing/nodes.h
parentc7e0da5292e841f6a864dd010bd6e0b06e0ece73 (diff)
ART: Preserve loop headers with try/catch
Algorithm for inserting HTryBoundary instructions would generate a non-natural loop when a loop header block was covered by a TryItem. This patch changes the approach to fix the issue. Bug: 23895756 Change-Id: I0e1ee6cf135cea326a96c97954907d202c9793cc
Diffstat (limited to 'compiler/optimizing/nodes.h')
-rw-r--r--compiler/optimizing/nodes.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 7498f44726..d79852c17b 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -819,11 +819,17 @@ class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> {
return EndsWithTryBoundary() ? 1 : GetSuccessors().size();
}
+ // Create a new block between this block and its predecessors. The new block
+ // is added to the graph, all predecessor edges are relinked to it and an edge
+ // is created to `this`. Returns the new empty block. Reverse post order or
+ // loop and try/catch information are not updated.
+ HBasicBlock* CreateImmediateDominator();
+
// Split the block into two blocks just before `cursor`. Returns the newly
// created, latter block. Note that this method will add the block to the
// graph, create a Goto at the end of the former block and will create an edge
// between the blocks. It will not, however, update the reverse post order or
- // loop information.
+ // loop and try/catch information.
HBasicBlock* SplitBefore(HInstruction* cursor);
// Split the block into two blocks just after `cursor`. Returns the newly
@@ -934,6 +940,8 @@ class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> {
// the appropriate try entry will be returned.
const HTryBoundary* ComputeTryEntryOfSuccessors() const;
+ bool HasThrowingInstructions() const;
+
// Returns whether this block dominates the blocked passed as parameter.
bool Dominates(HBasicBlock* block) const;
@@ -943,7 +951,6 @@ class HBasicBlock : public ArenaObject<kArenaAllocBasicBlock> {
void SetLifetimeStart(size_t start) { lifetime_start_ = start; }
void SetLifetimeEnd(size_t end) { lifetime_end_ = end; }
-
bool EndsWithControlFlowInstruction() const;
bool EndsWithIf() const;
bool EndsWithTryBoundary() const;