summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2013-11-04 23:04:15 +0000
committerTim Northover <tnorthover@apple.com>2013-11-04 23:04:15 +0000
commitc9432eb9e5e5b8e6bb7b2eefe0c31a627993c88a (patch)
treee287f17094da7d76488e9406dc356f0a58085f3f /llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
parentace0bd4d33677e69e79473ee23aa9c904b84a746 (diff)
downloadbcm5719-llvm-c9432eb9e5e5b8e6bb7b2eefe0c31a627993c88a.tar.gz
bcm5719-llvm-c9432eb9e5e5b8e6bb7b2eefe0c31a627993c88a.zip
ARM: remove unnecessary state-tracking during frame lowering.
ResolveFrameIndex had what appeared to be a very nasty hack for when the frame-index referred to a callee-saved register. In this case it "adjusted" the offset so that the address was correct if (and only if) the MachineInstr immediately followed the respective push. This "worked" for all forms of GPR & DPR but was only ever used to set the frame pointer itself, and once this was put in a more sensible location the entire state-tracking machinery it relied on became redundant. So I stripped it. The only wrinkle is that "add r7, sp, #0" might theoretically be slower (need an actual ALU slot) compared to "mov r7, sp" so I added a micro-optimisation that also makes emitARMRegUpdate and emitT2RegUpdate also work when NumBytes == 0. No test changes since there shouldn't be any functionality change. llvm-svn: 194025
Diffstat (limited to 'llvm/lib/Target/ARM/Thumb2InstrInfo.cpp')
-rw-r--r--llvm/lib/Target/ARM/Thumb2InstrInfo.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
index 4e82e778272..91788ac4f89 100644
--- a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
+++ b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
@@ -215,6 +215,13 @@ void llvm::emitT2RegPlusImmediate(MachineBasicBlock &MBB,
unsigned DestReg, unsigned BaseReg, int NumBytes,
ARMCC::CondCodes Pred, unsigned PredReg,
const ARMBaseInstrInfo &TII, unsigned MIFlags) {
+ if (NumBytes == 0 && DestReg != BaseReg) {
+ BuildMI(MBB, MBBI, dl, TII.get(ARM::tMOVr), DestReg)
+ .addReg(BaseReg, RegState::Kill)
+ .addImm((unsigned)Pred).addReg(PredReg).setMIFlags(MIFlags);
+ return;
+ }
+
bool isSub = NumBytes < 0;
if (isSub) NumBytes = -NumBytes;
OpenPOWER on IntegriCloud