diff options
author | Roland Levillain <rpl@google.com> | 2015-01-21 17:26:11 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-21 17:26:12 +0000 |
commit | 73d8fe409fbf2cb9665779690660ccc852d60431 (patch) | |
tree | 820f35d44a41fb0ff76f7d185f300862ce7a6f86 /compiler/optimizing | |
parent | 36e8a91d975b4096b40c2b4bb6c6cd663cc5166d (diff) | |
parent | 53d9da8507a1b68f036ce8669ad3f2ae9fc3d225 (diff) | |
download | art-73d8fe409fbf2cb9665779690660ccc852d60431.tar.gz art-73d8fe409fbf2cb9665779690660ccc852d60431.tar.bz2 art-73d8fe409fbf2cb9665779690660ccc852d60431.zip |
Merge "ART: Create a RemoveBlock method"
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/nodes.cc | 23 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 1 |
2 files changed, 14 insertions, 10 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index db89e68e06..2c84df4d7f 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -61,19 +61,22 @@ void HGraph::RemoveInstructionsAsUsersFromDeadBlocks(const ArenaBitVector& visit } } +void HGraph::RemoveBlock(HBasicBlock* block) const { + for (size_t j = 0; j < block->GetSuccessors().Size(); ++j) { + block->GetSuccessors().Get(j)->RemovePredecessor(block); + } + for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { + block->RemovePhi(it.Current()->AsPhi()); + } + for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { + block->RemoveInstruction(it.Current()); + } +} + void HGraph::RemoveDeadBlocks(const ArenaBitVector& visited) const { for (size_t i = 0; i < blocks_.Size(); ++i) { if (!visited.IsBitSet(i)) { - HBasicBlock* block = blocks_.Get(i); - for (size_t j = 0; j < block->GetSuccessors().Size(); ++j) { - block->GetSuccessors().Get(j)->RemovePredecessor(block); - } - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - block->RemovePhi(it.Current()->AsPhi()); - } - for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - block->RemoveInstruction(it.Current()); - } + RemoveBlock(blocks_.Get(i)); } } } diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 926420d264..e19bfce9de 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -195,6 +195,7 @@ class HGraph : public ArenaObject<kArenaAllocMisc> { ArenaBitVector* visiting); void RemoveInstructionsAsUsersFromDeadBlocks(const ArenaBitVector& visited) const; void RemoveDeadBlocks(const ArenaBitVector& visited) const; + void RemoveBlock(HBasicBlock* block) const; ArenaAllocator* const arena_; |