diff options
author | Roland Levillain <rpl@google.com> | 2014-10-13 11:36:10 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-10-13 11:36:11 +0000 |
commit | f8e28f575b1382e984edb2e8c9846a27a1bdea10 (patch) | |
tree | 12506af9dc858d842061843570a939e74822b517 /compiler/optimizing | |
parent | f659bec20db45c809a891ff528fb6aecf2c76149 (diff) | |
parent | 476df557fed5f0b3f32f8d11a654674bb403a8f8 (diff) | |
download | art-f8e28f575b1382e984edb2e8c9846a27a1bdea10.zip art-f8e28f575b1382e984edb2e8c9846a27a1bdea10.tar.gz art-f8e28f575b1382e984edb2e8c9846a27a1bdea10.tar.bz2 |
Merge "Use Is*() helpers to shorten code in the optimizing compiler."
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86_64.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/live_ranges_test.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/nodes.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/register_allocator.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/ssa_builder.cc | 2 |
7 files changed, 19 insertions, 19 deletions
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 2be5c90..9be7802 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -527,7 +527,7 @@ void CodeGeneratorARM::Move(HInstruction* instruction, Location location, HInstr return; } - if (instruction->AsIntConstant() != nullptr) { + if (instruction->IsIntConstant()) { int32_t value = instruction->AsIntConstant()->GetValue(); if (location.IsRegister()) { __ LoadImmediate(location.As<Register>(), value); @@ -536,7 +536,7 @@ void CodeGeneratorARM::Move(HInstruction* instruction, Location location, HInstr __ LoadImmediate(IP, value); __ StoreToOffset(kStoreWord, IP, SP, location.GetStackIndex()); } - } else if (instruction->AsLongConstant() != nullptr) { + } else if (instruction->IsLongConstant()) { int64_t value = instruction->AsLongConstant()->GetValue(); if (location.IsRegisterPair()) { __ LoadImmediate(location.AsRegisterPairLow<Register>(), Low32Bits(value)); @@ -548,7 +548,7 @@ void CodeGeneratorARM::Move(HInstruction* instruction, Location location, HInstr __ LoadImmediate(IP, High32Bits(value)); __ StoreToOffset(kStoreWord, IP, SP, location.GetHighStackIndex(kArmWordSize)); } - } else if (instruction->AsLoadLocal() != nullptr) { + } else if (instruction->IsLoadLocal()) { uint32_t stack_slot = GetStackSlot(instruction->AsLoadLocal()->GetLocal()); switch (instruction->GetType()) { case Primitive::kPrimBoolean: @@ -1693,7 +1693,7 @@ void ParallelMoveResolverARM::EmitMove(size_t index) { } } else { DCHECK(source.IsConstant()); - DCHECK(source.GetConstant()->AsIntConstant() != nullptr); + DCHECK(source.GetConstant()->IsIntConstant()); int32_t value = source.GetConstant()->AsIntConstant()->GetValue(); if (destination.IsRegister()) { __ LoadImmediate(destination.As<Register>(), value); diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 73143d6..34fa46e 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -468,14 +468,14 @@ void CodeGeneratorX86::Move64(Location destination, Location source) { } void CodeGeneratorX86::Move(HInstruction* instruction, Location location, HInstruction* move_for) { - if (instruction->AsIntConstant() != nullptr) { + if (instruction->IsIntConstant()) { Immediate imm(instruction->AsIntConstant()->GetValue()); if (location.IsRegister()) { __ movl(location.As<Register>(), imm); } else { __ movl(Address(ESP, location.GetStackIndex()), imm); } - } else if (instruction->AsLongConstant() != nullptr) { + } else if (instruction->IsLongConstant()) { int64_t value = instruction->AsLongConstant()->GetValue(); if (location.IsRegister()) { __ movl(location.AsRegisterPairLow<Register>(), Immediate(Low32Bits(value))); @@ -484,7 +484,7 @@ void CodeGeneratorX86::Move(HInstruction* instruction, Location location, HInstr __ movl(Address(ESP, location.GetStackIndex()), Immediate(Low32Bits(value))); __ movl(Address(ESP, location.GetHighStackIndex(kX86WordSize)), Immediate(High32Bits(value))); } - } else if (instruction->AsLoadLocal() != nullptr) { + } else if (instruction->IsLoadLocal()) { int slot = GetStackSlot(instruction->AsLoadLocal()->GetLocal()); switch (instruction->GetType()) { case Primitive::kPrimBoolean: diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 21b21f3..059140d 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -375,14 +375,14 @@ void CodeGeneratorX86_64::Move(Location destination, Location source) { void CodeGeneratorX86_64::Move(HInstruction* instruction, Location location, HInstruction* move_for) { - if (instruction->AsIntConstant() != nullptr) { + if (instruction->IsIntConstant()) { Immediate imm(instruction->AsIntConstant()->GetValue()); if (location.IsRegister()) { __ movl(location.As<CpuRegister>(), imm); } else { __ movl(Address(CpuRegister(RSP), location.GetStackIndex()), imm); } - } else if (instruction->AsLongConstant() != nullptr) { + } else if (instruction->IsLongConstant()) { int64_t value = instruction->AsLongConstant()->GetValue(); if (location.IsRegister()) { __ movq(location.As<CpuRegister>(), Immediate(value)); @@ -390,7 +390,7 @@ void CodeGeneratorX86_64::Move(HInstruction* instruction, __ movq(CpuRegister(TMP), Immediate(value)); __ movq(Address(CpuRegister(RSP), location.GetStackIndex()), CpuRegister(TMP)); } - } else if (instruction->AsLoadLocal() != nullptr) { + } else if (instruction->IsLoadLocal()) { switch (instruction->GetType()) { case Primitive::kPrimBoolean: case Primitive::kPrimByte: diff --git a/compiler/optimizing/live_ranges_test.cc b/compiler/optimizing/live_ranges_test.cc index eafc3e1..d5f4f90 100644 --- a/compiler/optimizing/live_ranges_test.cc +++ b/compiler/optimizing/live_ranges_test.cc @@ -75,7 +75,7 @@ TEST(LiveRangesTest, CFG1) { // Last use is the return instruction. ASSERT_EQ(9u, range->GetEnd()); HBasicBlock* block = graph->GetBlocks().Get(1); - ASSERT_TRUE(block->GetLastInstruction()->AsReturn() != nullptr); + ASSERT_TRUE(block->GetLastInstruction()->IsReturn()); ASSERT_EQ(8u, block->GetLastInstruction()->GetLifetimePosition()); ASSERT_TRUE(range->GetNext() == nullptr); } @@ -121,7 +121,7 @@ TEST(LiveRangesTest, CFG2) { // Last use is the return instruction. ASSERT_EQ(23u, range->GetEnd()); HBasicBlock* block = graph->GetBlocks().Get(3); - ASSERT_TRUE(block->GetLastInstruction()->AsReturn() != nullptr); + ASSERT_TRUE(block->GetLastInstruction()->IsReturn()); ASSERT_EQ(22u, block->GetLastInstruction()->GetLifetimePosition()); ASSERT_TRUE(range->GetNext() == nullptr); } diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 3a0b40c..a058dea 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -317,8 +317,8 @@ static void UpdateInputsUsers(HInstruction* instruction) { } void HBasicBlock::InsertInstructionBefore(HInstruction* instruction, HInstruction* cursor) { - DCHECK(cursor->AsPhi() == nullptr); - DCHECK(instruction->AsPhi() == nullptr); + DCHECK(!cursor->IsPhi()); + DCHECK(!instruction->IsPhi()); DCHECK_EQ(instruction->GetId(), -1); DCHECK_NE(cursor->GetId(), -1); DCHECK_EQ(cursor->GetBlock(), this); diff --git a/compiler/optimizing/register_allocator.cc b/compiler/optimizing/register_allocator.cc index 8b32262..5055a76 100644 --- a/compiler/optimizing/register_allocator.cc +++ b/compiler/optimizing/register_allocator.cc @@ -742,12 +742,12 @@ void RegisterAllocator::AddInputMoveFor(HInstruction* user, DCHECK(IsValidDestination(destination)); if (source.Equals(destination)) return; - DCHECK(user->AsPhi() == nullptr); + DCHECK(!user->IsPhi()); HInstruction* previous = user->GetPrevious(); HParallelMove* move = nullptr; if (previous == nullptr - || previous->AsParallelMove() == nullptr + || !previous->IsParallelMove() || !IsInputMove(previous)) { move = new (allocator_) HParallelMove(allocator_); move->SetLifetimePosition(kInputMoveLifetimePosition); @@ -866,7 +866,7 @@ void RegisterAllocator::InsertMoveAfter(HInstruction* instruction, DCHECK(IsValidDestination(destination)); if (source.Equals(destination)) return; - if (instruction->AsPhi() != nullptr) { + if (instruction->IsPhi()) { InsertParallelMoveAtEntryOf(instruction->GetBlock(), instruction, source, destination); return; } @@ -1036,7 +1036,7 @@ void RegisterAllocator::Resolve() { LiveInterval* current = instruction->GetLiveInterval(); LocationSummary* locations = instruction->GetLocations(); Location location = locations->Out(); - if (instruction->AsParameterValue() != nullptr) { + if (instruction->IsParameterValue()) { // Now that we know the frame size, adjust the parameter's location. if (location.IsStackSlot()) { location = Location::StackSlot(location.GetStackIndex() + codegen_->GetFrameSize()); diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index 471307e..be2c039 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -51,7 +51,7 @@ void SsaBuilder::BuildSsa() { !it.Done(); it.Advance()) { HInstruction* current = it.Current(); - if (current->AsLocal() != nullptr) { + if (current->IsLocal()) { current->GetBlock()->RemoveInstruction(current); } } |