diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-02-07 21:19:58 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-02-07 21:19:58 +0000 |
commit | ec4c67f0a77e92080743281fc24767bf5a0db08c (patch) | |
tree | ee1e57aae22e7929a3ceb1f930d6bac614139f4e | |
parent | 62aef236de342ed80eb37e92c81db6931793ed78 (diff) | |
download | bcm5719-llvm-ec4c67f0a77e92080743281fc24767bf5a0db08c.tar.gz bcm5719-llvm-ec4c67f0a77e92080743281fc24767bf5a0db08c.zip |
If sp offset will be materialized in a register. Clear the offset field of str / ldr.
llvm-svn: 34010
-rw-r--r-- | llvm/lib/Target/ARM/ARMRegisterInfo.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/Target/ARM/ARMRegisterInfo.cpp b/llvm/lib/Target/ARM/ARMRegisterInfo.cpp index 7fe2332fbfd..b8f3a0f1aea 100644 --- a/llvm/lib/Target/ARM/ARMRegisterInfo.cpp +++ b/llvm/lib/Target/ARM/ARMRegisterInfo.cpp @@ -762,16 +762,18 @@ void ARMRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II) const{ return; } + bool isThumSpillRestore = Opcode == ARM::tRestore || Opcode == ARM::tSpill; + if (AddrMode == ARMII::AddrModeTs) { + // Thumb tLDRspi, tSTRspi. These will change to instructions that use + // a different base register. + NumBits = 5; + Mask = (1 << NumBits) - 1; + } // If this is a thumb spill / restore, we will be using a constpool load to // materialize the offset. - bool isThumSpillRestore = Opcode == ARM::tRestore || Opcode == ARM::tSpill; - if (AddrMode == ARMII::AddrModeTs && !isThumSpillRestore) { - if (AddrMode == ARMII::AddrModeTs) { - // Thumb tLDRspi, tSTRspi. These will change to instructions that use - // a different base register. - NumBits = 5; - Mask = (1 << NumBits) - 1; - } + if (AddrMode == ARMII::AddrModeTs && isThumSpillRestore) + ImmOp.ChangeToImmediate(0); + else { // Otherwise, it didn't fit. Pull in what we can to simplify the immed. ImmedOffset = ImmedOffset & Mask; if (isSub) |