diff options
author | Reed Kotler <rkotler@mips.com> | 2012-10-31 05:21:10 +0000 |
---|---|---|
committer | Reed Kotler <rkotler@mips.com> | 2012-10-31 05:21:10 +0000 |
commit | 9441125d636dee246acf9cb6c8f264edda92c335 (patch) | |
tree | 004c196c6fdd4ed683e045962ae7a82d8cf2776e /lib/Target/Mips/Mips16RegisterInfo.cpp | |
parent | b5bc8d00096e794c52dc82fefb31a07ae5a263be (diff) | |
download | external_llvm-9441125d636dee246acf9cb6c8f264edda92c335.zip external_llvm-9441125d636dee246acf9cb6c8f264edda92c335.tar.gz external_llvm-9441125d636dee246acf9cb6c8f264edda92c335.tar.bz2 |
Implement ADJCALLSTACKUP and ADJCALLSTACKDOWN
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/Mips16RegisterInfo.cpp')
-rw-r--r-- | lib/Target/Mips/Mips16RegisterInfo.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Target/Mips/Mips16RegisterInfo.cpp b/lib/Target/Mips/Mips16RegisterInfo.cpp index 47a41d6..d7397a3 100644 --- a/lib/Target/Mips/Mips16RegisterInfo.cpp +++ b/lib/Target/Mips/Mips16RegisterInfo.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "Mips16RegisterInfo.h" +#include "Mips16InstrInfo.h" #include "Mips.h" #include "MipsAnalyzeImmediate.h" #include "MipsInstrInfo.h" @@ -38,15 +39,28 @@ using namespace llvm; -Mips16RegisterInfo::Mips16RegisterInfo(const MipsSubtarget &ST) - : MipsRegisterInfo(ST) {} +Mips16RegisterInfo::Mips16RegisterInfo(const MipsSubtarget &ST, + const Mips16InstrInfo &I) + : MipsRegisterInfo(ST), TII(I) {} // This function eliminate ADJCALLSTACKDOWN, // ADJCALLSTACKUP pseudo instructions void Mips16RegisterInfo:: eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { - // Simply discard ADJCALLSTACKDOWN, ADJCALLSTACKUP instructions. + const TargetFrameLowering *TFI = MF.getTarget().getFrameLowering(); + + if (!TFI->hasReservedCallFrame(MF)) { + int64_t Amount = I->getOperand(0).getImm(); + + if (I->getOpcode() == Mips::ADJCALLSTACKDOWN) + Amount = -Amount; + + const Mips16InstrInfo *II = static_cast<const Mips16InstrInfo*>(&TII); + + II->adjustStackPtr(Mips::SP, Amount, MBB, I); + } + MBB.erase(I); } |