summaryrefslogtreecommitdiff
path: root/compiler/optimizing/ssa_builder.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2015-09-02 17:03:22 +0100
committer Vladimir Marko <vmarko@google.com> 2015-09-03 13:09:37 +0100
commit91e11c0c840193c6822e66846020b6647de243d5 (patch)
tree0c5398ef59c464c1848afd0113c74b6aeb75cf42 /compiler/optimizing/ssa_builder.cc
parentf9f6441c665b5ff9004d3ed55014f46d416fb1bb (diff)
Optimizing: Tag basic block allocations with their source.
Replace GrowableArray with ArenaVector in HBasicBlock and, to track the source of allocations, assign one new and two Quick's arena allocation types to these vectors. Rename kArenaAllocSuccessor to kArenaAllocSuccessors. Bug: 23736311 Change-Id: I984aef6e615ae2380a532f5c6726af21015f43f5
Diffstat (limited to 'compiler/optimizing/ssa_builder.cc')
-rw-r--r--compiler/optimizing/ssa_builder.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc
index 561c3b4964..e6209b9583 100644
--- a/compiler/optimizing/ssa_builder.cc
+++ b/compiler/optimizing/ssa_builder.cc
@@ -241,8 +241,8 @@ void SsaBuilder::BuildSsa() {
HBasicBlock* block = loop_headers_.Get(i);
for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) {
HPhi* phi = it.Current()->AsPhi();
- for (size_t pred = 0; pred < block->GetPredecessors().Size(); pred++) {
- HInstruction* input = ValueOfLocal(block->GetPredecessors().Get(pred), phi->GetRegNumber());
+ for (HBasicBlock* predecessor : block->GetPredecessors()) {
+ HInstruction* input = ValueOfLocal(predecessor, phi->GetRegNumber());
phi->AddInput(input);
}
}
@@ -369,16 +369,16 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) {
// Save the loop header so that the last phase of the analysis knows which
// blocks need to be updated.
loop_headers_.Add(block);
- } else if (block->GetPredecessors().Size() > 0) {
+ } else if (block->GetPredecessors().size() > 0) {
// All predecessors have already been visited because we are visiting in reverse post order.
// We merge the values of all locals, creating phis if those values differ.
for (size_t local = 0; local < current_locals_->Size(); local++) {
bool one_predecessor_has_no_value = false;
bool is_different = false;
- HInstruction* value = ValueOfLocal(block->GetPredecessors().Get(0), local);
+ HInstruction* value = ValueOfLocal(block->GetPredecessor(0), local);
- for (size_t i = 0, e = block->GetPredecessors().Size(); i < e; ++i) {
- HInstruction* current = ValueOfLocal(block->GetPredecessors().Get(i), local);
+ for (HBasicBlock* predecessor : block->GetPredecessors()) {
+ HInstruction* current = ValueOfLocal(predecessor, local);
if (current == nullptr) {
one_predecessor_has_no_value = true;
break;
@@ -395,9 +395,9 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) {
if (is_different) {
HPhi* phi = new (GetGraph()->GetArena()) HPhi(
- GetGraph()->GetArena(), local, block->GetPredecessors().Size(), Primitive::kPrimVoid);
- for (size_t i = 0; i < block->GetPredecessors().Size(); i++) {
- HInstruction* pred_value = ValueOfLocal(block->GetPredecessors().Get(i), local);
+ GetGraph()->GetArena(), local, block->GetPredecessors().size(), Primitive::kPrimVoid);
+ for (size_t i = 0; i < block->GetPredecessors().size(); i++) {
+ HInstruction* pred_value = ValueOfLocal(block->GetPredecessor(i), local);
phi->SetRawInputAt(i, pred_value);
}
block->AddPhi(phi);