Index: llvm/trunk/lib/Target/Mips/Mips16FrameLowering.h =================================================================== --- llvm/trunk/lib/Target/Mips/Mips16FrameLowering.h +++ llvm/trunk/lib/Target/Mips/Mips16FrameLowering.h @@ -26,10 +26,6 @@ void emitPrologue(MachineFunction &MF) const override; void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; - void eliminateCallFramePseudoInstr(MachineFunction &MF, - MachineBasicBlock &MBB, - MachineBasicBlock::iterator I) const override; - bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector &CSI, Index: llvm/trunk/lib/Target/Mips/Mips16FrameLowering.cpp =================================================================== --- llvm/trunk/lib/Target/Mips/Mips16FrameLowering.cpp +++ llvm/trunk/lib/Target/Mips/Mips16FrameLowering.cpp @@ -143,22 +143,6 @@ return true; } -// Eliminate ADJCALLSTACKDOWN, ADJCALLSTACKUP pseudo instructions -void Mips16FrameLowering:: -eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, - MachineBasicBlock::iterator I) const { - if (!hasReservedCallFrame(MF)) { - int64_t Amount = I->getOperand(0).getImm(); - - if (I->getOpcode() == Mips::ADJCALLSTACKDOWN) - Amount = -Amount; - - STI.getInstrInfo()->adjustStackPtr(Mips::SP, Amount, MBB, I); - } - - MBB.erase(I); -} - bool Mips16FrameLowering::hasReservedCallFrame(const MachineFunction &MF) const { const MachineFrameInfo *MFI = MF.getFrameInfo(); Index: llvm/trunk/lib/Target/Mips/MipsFrameLowering.h =================================================================== --- llvm/trunk/lib/Target/Mips/MipsFrameLowering.h +++ llvm/trunk/lib/Target/Mips/MipsFrameLowering.h @@ -32,6 +32,11 @@ bool hasFP(const MachineFunction &MF) const override; + void + eliminateCallFramePseudoInstr(MachineFunction &MF, + MachineBasicBlock &MBB, + MachineBasicBlock::iterator I) const override; + protected: uint64_t estimateStackSize(const MachineFunction &MF) const; }; Index: llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp =================================================================== --- llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp +++ llvm/trunk/lib/Target/Mips/MipsFrameLowering.cpp @@ -131,3 +131,20 @@ return RoundUpToAlignment(Offset, getStackAlignment()); } + +// Eliminate ADJCALLSTACKDOWN, ADJCALLSTACKUP pseudo instructions +void MipsFrameLowering:: +eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, + MachineBasicBlock::iterator I) const { + unsigned SP = STI.getABI().IsN64() ? Mips::SP_64 : Mips::SP; + + if (!hasReservedCallFrame(MF)) { + int64_t Amount = I->getOperand(0).getImm(); + if (I->getOpcode() == Mips::ADJCALLSTACKDOWN) + Amount = -Amount; + + STI.getInstrInfo()->adjustStackPtr(SP, Amount, MBB, I); + } + + MBB.erase(I); +} Index: llvm/trunk/lib/Target/Mips/MipsSEFrameLowering.h =================================================================== --- llvm/trunk/lib/Target/Mips/MipsSEFrameLowering.h +++ llvm/trunk/lib/Target/Mips/MipsSEFrameLowering.h @@ -27,10 +27,6 @@ void emitPrologue(MachineFunction &MF) const override; void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; - void eliminateCallFramePseudoInstr(MachineFunction &MF, - MachineBasicBlock &MBB, - MachineBasicBlock::iterator I) const override; - bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const std::vector &CSI, Index: llvm/trunk/lib/Target/Mips/MipsSEFrameLowering.cpp =================================================================== --- llvm/trunk/lib/Target/Mips/MipsSEFrameLowering.cpp +++ llvm/trunk/lib/Target/Mips/MipsSEFrameLowering.cpp @@ -607,23 +607,6 @@ !MFI->hasVarSizedObjects(); } -// Eliminate ADJCALLSTACKDOWN, ADJCALLSTACKUP pseudo instructions -void MipsSEFrameLowering:: -eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, - MachineBasicBlock::iterator I) const { - if (!hasReservedCallFrame(MF)) { - int64_t Amount = I->getOperand(0).getImm(); - - if (I->getOpcode() == Mips::ADJCALLSTACKDOWN) - Amount = -Amount; - - unsigned SP = STI.isABI_N64() ? Mips::SP_64 : Mips::SP; - STI.getInstrInfo()->adjustStackPtr(SP, Amount, MBB, I); - } - - MBB.erase(I); -} - void MipsSEFrameLowering:: processFunctionBeforeCalleeSavedScan(MachineFunction &MF, RegScavenger *RS) const {