diff options
author | Quentin Colombet <qcolombet@apple.com> | 2015-11-30 20:37:58 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2015-11-30 20:37:58 +0000 |
commit | cdad10f333cf1bf81868b07f4f37d1d45418b103 (patch) | |
tree | 9fd49363461d7061f4225583c4f14f06e8716994 /llvm/lib/Target/ARM/Thumb1FrameLowering.cpp | |
parent | 8a71273d89f94dc3f609ba254e6690960411a5fd (diff) | |
download | llvm-cdad10f333cf1bf81868b07f4f37d1d45418b103.zip llvm-cdad10f333cf1bf81868b07f4f37d1d45418b103.tar.gz llvm-cdad10f333cf1bf81868b07f4f37d1d45418b103.tar.bz2 |
[ARM] For old thumb ISA like v4t, we cannot use PC directly in pop.
Fix the epilogue emission to account for that.
llvm-svn: 254325
Diffstat (limited to 'llvm/lib/Target/ARM/Thumb1FrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/Thumb1FrameLowering.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp b/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp index f5d4cb8..064cff6 100644 --- a/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp +++ b/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp @@ -422,25 +422,12 @@ bool Thumb1FrameLowering::emitPopSpecialFixUp(MachineBasicBlock &MBB, const ThumbRegisterInfo *RegInfo = static_cast<const ThumbRegisterInfo *>(STI.getRegisterInfo()); - // If MBBI is a return instruction, we may be able to directly restore - // LR in the PC. - // This is possible if we do not need to emit any SP update. - // Otherwise, we need a temporary register to pop the value - // and copy that value into LR. + // When we need a special fix up for POP, this means that + // we either cannot use PC in POP or we have to update + // SP after poping the return address. + // In other words, we cannot use a pop {pc} like construction + // here, no matter what. auto MBBI = MBB.getFirstTerminator(); - if (!ArgRegsSaveSize && MBBI != MBB.end() && - MBBI->getOpcode() == ARM::tBX_RET) { - if (!DoIt) - return true; - MachineInstrBuilder MIB = - AddDefaultPred( - BuildMI(MBB, MBBI, MBBI->getDebugLoc(), TII.get(ARM::tPOP_RET))) - .addReg(ARM::PC, RegState::Define); - MIB.copyImplicitOps(&*MBBI); - // erase the old tBX_RET instruction - MBB.erase(MBBI); - return true; - } // Look for a temporary register to use. // First, compute the liveness information. |