return;
}
- if (instruction->AsIntConstant() != nullptr) {
+ if (instruction->IsIntConstant()) {
int32_t value = instruction->AsIntConstant()->GetValue();
if (location.IsRegister()) {
__ LoadImmediate(location.As<Register>(), value);
__ LoadImmediate(IP, value);
__ str(IP, Address(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));
__ LoadImmediate(IP, High32Bits(value));
__ str(IP, Address(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:
}
} 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);
}
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)));
__ 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:
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));
__ 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:
// 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);
}
// 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);
}
}
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);
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);
DCHECK(IsValidDestination(destination));
if (source.Equals(destination)) return;
- if (instruction->AsPhi() != nullptr) {
+ if (instruction->IsPhi()) {
InsertParallelMoveAtEntryOf(instruction->GetBlock(), instruction, source, destination);
return;
}
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());
!it.Done();
it.Advance()) {
HInstruction* current = it.Current();
- if (current->AsLocal() != nullptr) {
+ if (current->IsLocal()) {
current->GetBlock()->RemoveInstruction(current);
}
}