diff options
author | Calin Juravle <calin@google.com> | 2014-11-13 16:28:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-11-13 16:28:17 +0000 |
commit | dc87c1dd1d7a7192b03e87ffd07eec80e8c2ae24 (patch) | |
tree | d5c9209dfb635aeb99346d91d87f3b930fe01bee /compiler/optimizing/code_generator_arm.cc | |
parent | 172808c14506f4b46ebf0765e066306b7301760f (diff) | |
parent | a21f598fd4dfdb95dc8597d3156120cc20d94c02 (diff) | |
download | art-dc87c1dd1d7a7192b03e87ffd07eec80e8c2ae24.tar.gz art-dc87c1dd1d7a7192b03e87ffd07eec80e8c2ae24.tar.bz2 art-dc87c1dd1d7a7192b03e87ffd07eec80e8c2ae24.zip |
Merge "[optimizing compiler] Fix Move for instruction with constant output"
Diffstat (limited to 'compiler/optimizing/code_generator_arm.cc')
-rw-r--r-- | compiler/optimizing/code_generator_arm.cc | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index be326dcece..56cd75f821 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -670,13 +670,13 @@ void CodeGeneratorARM::Move32(Location destination, Location source) { __ LoadSFromOffset(destination.As<SRegister>(), SP, source.GetStackIndex()); } } else { - DCHECK(destination.IsStackSlot()); + DCHECK(destination.IsStackSlot()) << destination; if (source.IsRegister()) { __ StoreToOffset(kStoreWord, source.As<Register>(), SP, destination.GetStackIndex()); } else if (source.IsFpuRegister()) { __ StoreSToOffset(source.As<SRegister>(), SP, destination.GetStackIndex()); } else { - DCHECK(source.IsStackSlot()); + DCHECK(source.IsStackSlot()) << source; __ LoadFromOffset(kLoadWord, IP, SP, source.GetStackIndex()); __ StoreToOffset(kStoreWord, IP, SP, destination.GetStackIndex()); } @@ -778,26 +778,29 @@ void CodeGeneratorARM::Move(HInstruction* instruction, Location location, HInstr return; } - if (instruction->IsIntConstant()) { - int32_t value = instruction->AsIntConstant()->GetValue(); - if (location.IsRegister()) { - __ LoadImmediate(location.As<Register>(), value); - } else { - DCHECK(location.IsStackSlot()); - __ LoadImmediate(IP, value); - __ StoreToOffset(kStoreWord, IP, SP, location.GetStackIndex()); - } - } else if (instruction->IsLongConstant()) { - int64_t value = instruction->AsLongConstant()->GetValue(); - if (location.IsRegisterPair()) { - __ LoadImmediate(location.AsRegisterPairLow<Register>(), Low32Bits(value)); - __ LoadImmediate(location.AsRegisterPairHigh<Register>(), High32Bits(value)); - } else { - DCHECK(location.IsDoubleStackSlot()); - __ LoadImmediate(IP, Low32Bits(value)); - __ StoreToOffset(kStoreWord, IP, SP, location.GetStackIndex()); - __ LoadImmediate(IP, High32Bits(value)); - __ StoreToOffset(kStoreWord, IP, SP, location.GetHighStackIndex(kArmWordSize)); + if (locations != nullptr && locations->Out().IsConstant()) { + HConstant* const_to_move = locations->Out().GetConstant(); + if (const_to_move->IsIntConstant()) { + int32_t value = const_to_move->AsIntConstant()->GetValue(); + if (location.IsRegister()) { + __ LoadImmediate(location.As<Register>(), value); + } else { + DCHECK(location.IsStackSlot()); + __ LoadImmediate(IP, value); + __ StoreToOffset(kStoreWord, IP, SP, location.GetStackIndex()); + } + } else if (const_to_move->IsLongConstant()) { + int64_t value = const_to_move->AsLongConstant()->GetValue(); + if (location.IsRegisterPair()) { + __ LoadImmediate(location.AsRegisterPairLow<Register>(), Low32Bits(value)); + __ LoadImmediate(location.AsRegisterPairHigh<Register>(), High32Bits(value)); + } else { + DCHECK(location.IsDoubleStackSlot()); + __ LoadImmediate(IP, Low32Bits(value)); + __ StoreToOffset(kStoreWord, IP, SP, location.GetStackIndex()); + __ LoadImmediate(IP, High32Bits(value)); + __ StoreToOffset(kStoreWord, IP, SP, location.GetHighStackIndex(kArmWordSize)); + } } } else if (instruction->IsLoadLocal()) { uint32_t stack_slot = GetStackSlot(instruction->AsLoadLocal()->GetLocal()); |