diff options
Diffstat (limited to 'compiler/optimizing/locations.cc')
-rw-r--r-- | compiler/optimizing/locations.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/optimizing/locations.cc b/compiler/optimizing/locations.cc index 595064f8e5..f40b7f4f0c 100644 --- a/compiler/optimizing/locations.cc +++ b/compiler/optimizing/locations.cc @@ -57,7 +57,7 @@ LocationSummary::LocationSummary(HInstruction* instruction, Location Location::RegisterOrConstant(HInstruction* instruction) { return instruction->IsConstant() - ? Location::ConstantLocation(instruction->AsConstant()) + ? Location::ConstantLocation(instruction) : Location::RequiresRegister(); } @@ -85,16 +85,23 @@ Location Location::FpuRegisterOrInt32Constant(HInstruction* instruction) { Location Location::ByteRegisterOrConstant(int reg, HInstruction* instruction) { return instruction->IsConstant() - ? Location::ConstantLocation(instruction->AsConstant()) + ? Location::ConstantLocation(instruction) : Location::RegisterLocation(reg); } Location Location::FpuRegisterOrConstant(HInstruction* instruction) { return instruction->IsConstant() - ? Location::ConstantLocation(instruction->AsConstant()) + ? Location::ConstantLocation(instruction) : Location::RequiresFpuRegister(); } +void Location::DCheckInstructionIsConstant(HInstruction* instruction) { + DCHECK(instruction != nullptr); + DCHECK(instruction->IsConstant()); + DCHECK_EQ(reinterpret_cast<uintptr_t>(instruction), + reinterpret_cast<uintptr_t>(instruction->AsConstant())); +} + std::ostream& operator<<(std::ostream& os, const Location& location) { os << location.DebugString(); if (location.IsRegister() || location.IsFpuRegister()) { |