diff options
author | 2015-09-17 17:03:26 +0100 | |
---|---|---|
committer | 2015-09-25 12:18:02 +0100 | |
commit | 2aaa4b5532d30c4e65d8892b556400bb61f9dc8c (patch) | |
tree | f4259c33171ec8efd945aeedab1e57feb7970f42 /compiler/optimizing/ssa_phi_elimination.cc | |
parent | 3f4b39dec9ec6b8948ed18b9d65ba49db2465004 (diff) |
Optimizing: Tag more arena allocations.
Replace GrowableArray with ArenaVector and tag arena
allocations with new allocation types.
As part of this, make the register allocator a bit more
efficient, doing bulk insert/erase. Some loops are now
O(n) instead of O(n^2).
Change-Id: Ifac0871ffb34b121cc0447801a2d07eefd308c14
Diffstat (limited to 'compiler/optimizing/ssa_phi_elimination.cc')
-rw-r--r-- | compiler/optimizing/ssa_phi_elimination.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc index a9f04cd201..72f9ddd506 100644 --- a/compiler/optimizing/ssa_phi_elimination.cc +++ b/compiler/optimizing/ssa_phi_elimination.cc @@ -35,7 +35,7 @@ void SsaDeadPhiElimination::MarkDeadPhis() { HUseListNode<HInstruction*>* current = use_it.Current(); HInstruction* user = current->GetUser(); if (!user->IsPhi()) { - worklist_.Add(phi); + worklist_.push_back(phi); phi->SetLive(); break; } @@ -44,12 +44,13 @@ void SsaDeadPhiElimination::MarkDeadPhis() { } // Process the worklist by propagating liveness to phi inputs. - while (!worklist_.IsEmpty()) { - HPhi* phi = worklist_.Pop(); + while (!worklist_.empty()) { + HPhi* phi = worklist_.back(); + worklist_.pop_back(); for (HInputIterator it(phi); !it.Done(); it.Advance()) { HInstruction* input = it.Current(); if (input->IsPhi() && input->AsPhi()->IsDead()) { - worklist_.Add(input->AsPhi()); + worklist_.push_back(input->AsPhi()); input->AsPhi()->SetLive(); } } @@ -103,12 +104,13 @@ void SsaRedundantPhiElimination::Run() { for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { - worklist_.Add(inst_it.Current()->AsPhi()); + worklist_.push_back(inst_it.Current()->AsPhi()); } } - while (!worklist_.IsEmpty()) { - HPhi* phi = worklist_.Pop(); + while (!worklist_.empty()) { + HPhi* phi = worklist_.back(); + worklist_.pop_back(); // If the phi has already been processed, continue. if (!phi->IsInBlock()) { @@ -155,7 +157,7 @@ void SsaRedundantPhiElimination::Run() { HUseListNode<HInstruction*>* current = it.Current(); HInstruction* user = current->GetUser(); if (user->IsPhi()) { - worklist_.Add(user->AsPhi()); + worklist_.push_back(user->AsPhi()); } } |