diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 1 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 1 | ||||
-rw-r--r-- | compiler/optimizing/codegen_test.cc | 18 | ||||
-rw-r--r-- | compiler/optimizing/constant_folding.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/gvn.cc | 5 | ||||
-rw-r--r-- | compiler/optimizing/parallel_move_resolver.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/prepare_for_register_allocation.cc | 5 | ||||
-rw-r--r-- | compiler/optimizing/register_allocator.cc | 13 | ||||
-rw-r--r-- | compiler/optimizing/ssa_builder.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/ssa_liveness_analysis.cc | 22 | ||||
-rw-r--r-- | compiler/optimizing/ssa_phi_elimination.cc | 22 | ||||
-rw-r--r-- | compiler/optimizing/stack_map_stream.h | 28 |
13 files changed, 72 insertions, 67 deletions
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 0cec4b404a..5513c62d17 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -1561,7 +1561,6 @@ void LocationsBuilderARM::VisitCompare(HCompare* compare) { } void InstructionCodeGeneratorARM::VisitCompare(HCompare* compare) { - Label greater, done; LocationSummary* locations = compare->GetLocations(); switch (compare->InputAt(0)->GetType()) { case Primitive::kPrimLong: { diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 6ac7a31d3f..90d7c35975 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -760,16 +760,16 @@ void InstructionCodeGeneratorARM64::VisitIf(HIf* if_instr) { // the comparison and its condition as the branch condition. Register lhs = InputRegisterAt(condition, 0); Operand rhs = InputOperandAt(condition, 1); - Condition cond = ARM64Condition(condition->GetCondition()); - if ((cond == eq || cond == ne) && rhs.IsImmediate() && (rhs.immediate() == 0)) { - if (cond == eq) { + Condition arm64_cond = ARM64Condition(condition->GetCondition()); + if ((arm64_cond == eq || arm64_cond == ne) && rhs.IsImmediate() && (rhs.immediate() == 0)) { + if (arm64_cond == eq) { __ Cbz(lhs, true_target); } else { __ Cbnz(lhs, true_target); } } else { __ Cmp(lhs, rhs); - __ B(cond, true_target); + __ B(arm64_cond, true_target); } } diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index ac328c319c..ff852512c5 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -1507,7 +1507,6 @@ void LocationsBuilderX86::VisitCompare(HCompare* compare) { } void InstructionCodeGeneratorX86::VisitCompare(HCompare* compare) { - Label greater, done; LocationSummary* locations = compare->GetLocations(); switch (compare->InputAt(0)->GetType()) { case Primitive::kPrimLong: { diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc index 803a09b733..68fcb25036 100644 --- a/compiler/optimizing/codegen_test.cc +++ b/compiler/optimizing/codegen_test.cc @@ -373,9 +373,9 @@ TEST(CodegenTest, NonMaterializedCondition) { PrepareForRegisterAllocation(graph).Run(); ASSERT_FALSE(equal->NeedsMaterialization()); - auto hook_before_codegen = [](HGraph* graph) { - HBasicBlock* block = graph->GetEntryBlock()->GetSuccessors().Get(0); - HParallelMove* move = new (graph->GetArena()) HParallelMove(graph->GetArena()); + auto hook_before_codegen = [](HGraph* graph_in) { + HBasicBlock* block = graph_in->GetEntryBlock()->GetSuccessors().Get(0); + HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); block->InsertInstructionBefore(move, block->GetLastInstruction()); }; @@ -463,9 +463,9 @@ TEST(CodegenTest, MaterializedCondition1) { HReturn ret(&cmp_lt); code_block->AddInstruction(&ret); - auto hook_before_codegen = [](HGraph* graph) { - HBasicBlock* block = graph->GetEntryBlock()->GetSuccessors().Get(0); - HParallelMove* move = new (graph->GetArena()) HParallelMove(graph->GetArena()); + auto hook_before_codegen = [](HGraph* graph_in) { + HBasicBlock* block = graph_in->GetEntryBlock()->GetSuccessors().Get(0); + HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); block->InsertInstructionBefore(move, block->GetLastInstruction()); }; @@ -533,9 +533,9 @@ TEST(CodegenTest, MaterializedCondition2) { HReturn ret_ge(&cst_ge); if_false_block->AddInstruction(&ret_ge); - auto hook_before_codegen = [](HGraph* graph) { - HBasicBlock* block = graph->GetEntryBlock()->GetSuccessors().Get(0); - HParallelMove* move = new (graph->GetArena()) HParallelMove(graph->GetArena()); + auto hook_before_codegen = [](HGraph* graph_in) { + HBasicBlock* block = graph_in->GetEntryBlock()->GetSuccessors().Get(0); + HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); block->InsertInstructionBefore(move, block->GetLastInstruction()); }; diff --git a/compiler/optimizing/constant_folding.cc b/compiler/optimizing/constant_folding.cc index 10a7e46299..fca9933872 100644 --- a/compiler/optimizing/constant_folding.cc +++ b/compiler/optimizing/constant_folding.cc @@ -28,9 +28,9 @@ void HConstantFolding::Run() { // Traverse this block's instructions in (forward) order and // replace the ones that can be statically evaluated by a // compile-time counterpart. - for (HInstructionIterator it(block->GetInstructions()); - !it.Done(); it.Advance()) { - HInstruction* inst = it.Current(); + for (HInstructionIterator inst_it(block->GetInstructions()); + !inst_it.Done(); inst_it.Advance()) { + HInstruction* inst = inst_it.Current(); if (inst->IsBinaryOperation()) { // Constant folding: replace `op(a, b)' with a constant at // compile time if `a' and `b' are both constants. diff --git a/compiler/optimizing/gvn.cc b/compiler/optimizing/gvn.cc index 027b3d4ff3..25168b5b0c 100644 --- a/compiler/optimizing/gvn.cc +++ b/compiler/optimizing/gvn.cc @@ -54,8 +54,9 @@ void GlobalValueNumberer::ComputeSideEffects() { SideEffects effects = SideEffects::None(); // Update `effects` with the side effects of all instructions in this block. - for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - HInstruction* instruction = it.Current(); + for (HInstructionIterator inst_it(block->GetInstructions()); !inst_it.Done(); + inst_it.Advance()) { + HInstruction* instruction = inst_it.Current(); effects = effects.Union(instruction->GetSideEffects()); if (effects.HasAllSideEffects()) { break; diff --git a/compiler/optimizing/parallel_move_resolver.cc b/compiler/optimizing/parallel_move_resolver.cc index c71d93ebe5..1e93ece2ef 100644 --- a/compiler/optimizing/parallel_move_resolver.cc +++ b/compiler/optimizing/parallel_move_resolver.cc @@ -130,13 +130,13 @@ void ParallelMoveResolver::PerformMove(size_t index) { // this move's source or destination needs to have their source // changed to reflect the state of affairs after the swap. Location source = move->GetSource(); - Location destination = move->GetDestination(); + Location swap_destination = move->GetDestination(); move->Eliminate(); for (size_t i = 0; i < moves_.Size(); ++i) { const MoveOperands& other_move = *moves_.Get(i); if (other_move.Blocks(source)) { - moves_.Get(i)->SetSource(destination); - } else if (other_move.Blocks(destination)) { + moves_.Get(i)->SetSource(swap_destination); + } else if (other_move.Blocks(swap_destination)) { moves_.Get(i)->SetSource(source); } } diff --git a/compiler/optimizing/prepare_for_register_allocation.cc b/compiler/optimizing/prepare_for_register_allocation.cc index 2387141a39..35d56f3ccb 100644 --- a/compiler/optimizing/prepare_for_register_allocation.cc +++ b/compiler/optimizing/prepare_for_register_allocation.cc @@ -23,8 +23,9 @@ void PrepareForRegisterAllocation::Run() { for (HReversePostOrderIterator it(*GetGraph()); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); // No need to visit the phis. - for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - it.Current()->Accept(this); + for (HInstructionIterator inst_it(block->GetInstructions()); !inst_it.Done(); + inst_it.Advance()) { + inst_it.Current()->Accept(this); } } } diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc index c98b82a6ed..2a9c88506d 100644 --- a/compiler/optimizing/register_allocator.cc +++ b/compiler/optimizing/register_allocator.cc @@ -126,11 +126,12 @@ void RegisterAllocator::AllocateRegistersInternal() { // is the one with the lowest start position. for (HLinearPostOrderIterator it(liveness_); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); - for (HBackwardInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - ProcessInstruction(it.Current()); + for (HBackwardInstructionIterator back_it(block->GetInstructions()); !back_it.Done(); + back_it.Advance()) { + ProcessInstruction(back_it.Current()); } - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - ProcessInstruction(it.Current()); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + ProcessInstruction(inst_it.Current()); } } @@ -1201,8 +1202,8 @@ void RegisterAllocator::Resolve() { // Resolve phi inputs. Order does not matter. for (HLinearOrderIterator it(liveness_); !it.Done(); it.Advance()) { HBasicBlock* current = it.Current(); - for (HInstructionIterator it(current->GetPhis()); !it.Done(); it.Advance()) { - HInstruction* phi = it.Current(); + for (HInstructionIterator inst_it(current->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HInstruction* phi = inst_it.Current(); for (size_t i = 0, e = current->GetPredecessors().Size(); i < e; ++i) { HBasicBlock* predecessor = current->GetPredecessors().Get(i); DCHECK_EQ(predecessor->GetSuccessors().Size(), 1u); diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index a0cc8a94ee..e83c528fab 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -109,8 +109,8 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) { 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* value = ValueOfLocal(block->GetPredecessors().Get(i), local); - phi->SetRawInputAt(i, value); + HInstruction* pred_value = ValueOfLocal(block->GetPredecessors().Get(i), local); + phi->SetRawInputAt(i, pred_value); } block->AddPhi(phi); value = phi; diff --git a/compiler/optimizing/ssa_liveness_analysis.cc b/compiler/optimizing/ssa_liveness_analysis.cc index 97bc7f3dfd..0085b27c58 100644 --- a/compiler/optimizing/ssa_liveness_analysis.cc +++ b/compiler/optimizing/ssa_liveness_analysis.cc @@ -107,8 +107,8 @@ void SsaLivenessAnalysis::NumberInstructions() { HBasicBlock* block = it.Current(); block->SetLifetimeStart(lifetime_position); - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - HInstruction* current = it.Current(); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HInstruction* current = inst_it.Current(); current->Accept(location_builder); LocationSummary* locations = current->GetLocations(); if (locations != nullptr && locations->Out().IsValid()) { @@ -124,8 +124,9 @@ void SsaLivenessAnalysis::NumberInstructions() { // Add a null marker to notify we are starting a block. instructions_from_lifetime_position_.Add(nullptr); - for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - HInstruction* current = it.Current(); + for (HInstructionIterator inst_it(block->GetInstructions()); !inst_it.Done(); + inst_it.Advance()) { + HInstruction* current = inst_it.Current(); current->Accept(codegen_->GetLocationBuilder()); LocationSummary* locations = current->GetLocations(); if (locations != nullptr && locations->Out().IsValid()) { @@ -178,8 +179,8 @@ void SsaLivenessAnalysis::ComputeLiveRanges() { HBasicBlock* successor = block->GetSuccessors().Get(i); live_in->Union(GetLiveInSet(*successor)); size_t phi_input_index = successor->GetPredecessorIndexOf(block); - for (HInstructionIterator it(successor->GetPhis()); !it.Done(); it.Advance()) { - HInstruction* phi = it.Current(); + for (HInstructionIterator inst_it(successor->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HInstruction* phi = inst_it.Current(); HInstruction* input = phi->InputAt(phi_input_index); input->GetLiveInterval()->AddPhiUse(phi, phi_input_index, block); // A phi input whose last user is the phi dies at the end of the predecessor block, @@ -195,8 +196,9 @@ void SsaLivenessAnalysis::ComputeLiveRanges() { current->GetLiveInterval()->AddRange(block->GetLifetimeStart(), block->GetLifetimeEnd()); } - for (HBackwardInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { - HInstruction* current = it.Current(); + for (HBackwardInstructionIterator back_it(block->GetInstructions()); !back_it.Done(); + back_it.Advance()) { + HInstruction* current = back_it.Current(); if (current->HasSsaIndex()) { // Kill the instruction and shorten its interval. kill->SetBit(current->GetSsaIndex()); @@ -230,8 +232,8 @@ void SsaLivenessAnalysis::ComputeLiveRanges() { } // Kill phis defined in this block. - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - HInstruction* current = it.Current(); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HInstruction* current = inst_it.Current(); if (current->HasSsaIndex()) { kill->SetBit(current->GetSsaIndex()); live_in->ClearBit(current->GetSsaIndex()); diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc index 4eda0f3757..56979e1c6a 100644 --- a/compiler/optimizing/ssa_phi_elimination.cc +++ b/compiler/optimizing/ssa_phi_elimination.cc @@ -22,10 +22,10 @@ void SsaDeadPhiElimination::Run() { // Add to the worklist phis referenced by non-phi instructions. for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - HPhi* phi = it.Current()->AsPhi(); - for (HUseIterator<HInstruction> it(phi->GetUses()); !it.Done(); it.Advance()) { - HUseListNode<HInstruction>* current = it.Current(); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + HPhi* phi = inst_it.Current()->AsPhi(); + for (HUseIterator<HInstruction> use_it(phi->GetUses()); !use_it.Done(); use_it.Advance()) { + HUseListNode<HInstruction>* current = use_it.Current(); HInstruction* user = current->GetUser(); if (!user->IsPhi()) { worklist_.Add(phi); @@ -61,8 +61,9 @@ void SsaDeadPhiElimination::Run() { next = current->GetNext(); if (current->AsPhi()->IsDead()) { if (current->HasUses()) { - for (HUseIterator<HInstruction> it(current->GetUses()); !it.Done(); it.Advance()) { - HUseListNode<HInstruction>* user_node = it.Current(); + for (HUseIterator<HInstruction> use_it(current->GetUses()); !use_it.Done(); + use_it.Advance()) { + HUseListNode<HInstruction>* user_node = use_it.Current(); HInstruction* user = user_node->GetUser(); DCHECK(user->IsLoopHeaderPhi()); DCHECK(user->AsPhi()->IsDead()); @@ -72,8 +73,9 @@ void SsaDeadPhiElimination::Run() { } } if (current->HasEnvironmentUses()) { - for (HUseIterator<HEnvironment> it(current->GetEnvUses()); !it.Done(); it.Advance()) { - HUseListNode<HEnvironment>* user_node = it.Current(); + for (HUseIterator<HEnvironment> use_it(current->GetEnvUses()); !use_it.Done(); + use_it.Advance()) { + HUseListNode<HEnvironment>* user_node = use_it.Current(); HEnvironment* user = user_node->GetUser(); user->SetRawEnvAt(user_node->GetIndex(), nullptr); current->RemoveEnvironmentUser(user, user_node->GetIndex()); @@ -90,8 +92,8 @@ void SsaRedundantPhiElimination::Run() { // Add all phis in the worklist. for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) { HBasicBlock* block = it.Current(); - for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { - worklist_.Add(it.Current()->AsPhi()); + for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) { + worklist_.Add(inst_it.Current()->AsPhi()); } } diff --git a/compiler/optimizing/stack_map_stream.h b/compiler/optimizing/stack_map_stream.h index 5f74c33643..9cfa71c13f 100644 --- a/compiler/optimizing/stack_map_stream.h +++ b/compiler/optimizing/stack_map_stream.h @@ -167,33 +167,33 @@ class StackMapStream : public ValueObject { } // Set the register map. - MemoryRegion region = dex_register_maps_region.Subregion( + MemoryRegion register_region = dex_register_maps_region.Subregion( next_dex_register_map_offset, DexRegisterMap::kFixedSize + entry.num_dex_registers * DexRegisterMap::SingleEntrySize()); - next_dex_register_map_offset += region.size(); - DexRegisterMap dex_register_map(region); - stack_map.SetDexRegisterMapOffset(region.start() - memory_start); + next_dex_register_map_offset += register_region.size(); + DexRegisterMap dex_register_map(register_region); + stack_map.SetDexRegisterMapOffset(register_region.start() - memory_start); - for (size_t i = 0; i < entry.num_dex_registers; ++i) { + for (size_t j = 0; j < entry.num_dex_registers; ++j) { DexRegisterEntry register_entry = - dex_register_maps_.Get(i + entry.dex_register_maps_start_index); - dex_register_map.SetRegisterInfo(i, register_entry.kind, register_entry.value); + dex_register_maps_.Get(j + entry.dex_register_maps_start_index); + dex_register_map.SetRegisterInfo(j, register_entry.kind, register_entry.value); } // Set the inlining info. if (entry.inlining_depth != 0) { - MemoryRegion region = inline_infos_region.Subregion( + MemoryRegion inline_region = inline_infos_region.Subregion( next_inline_info_offset, InlineInfo::kFixedSize + entry.inlining_depth * InlineInfo::SingleEntrySize()); - next_inline_info_offset += region.size(); - InlineInfo inline_info(region); + next_inline_info_offset += inline_region.size(); + InlineInfo inline_info(inline_region); - stack_map.SetInlineDescriptorOffset(region.start() - memory_start); + stack_map.SetInlineDescriptorOffset(inline_region.start() - memory_start); inline_info.SetDepth(entry.inlining_depth); - for (size_t i = 0; i < entry.inlining_depth; ++i) { - InlineInfoEntry inline_entry = inline_infos_.Get(i + entry.inline_infos_start_index); - inline_info.SetMethodReferenceIndexAtDepth(i, inline_entry.method_index); + for (size_t j = 0; j < entry.inlining_depth; ++j) { + InlineInfoEntry inline_entry = inline_infos_.Get(j + entry.inline_infos_start_index); + inline_info.SetMethodReferenceIndexAtDepth(j, inline_entry.method_index); } } else { stack_map.SetInlineDescriptorOffset(InlineInfo::kNoInlineInfo); |