diff options
Diffstat (limited to 'llvm/lib/Target/MSP430/MSP430FrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/MSP430/MSP430FrameLowering.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp b/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp index de60ad9bd7e6f..4be8d0760e689 100644 --- a/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp +++ b/llvm/lib/Target/MSP430/MSP430FrameLowering.cpp @@ -64,16 +64,16 @@ void MSP430FrameLowering::emitPrologue(MachineFunction &MF, // Save FP into the appropriate stack slot... BuildMI(MBB, MBBI, DL, TII.get(MSP430::PUSH16r)) - .addReg(MSP430::FP, RegState::Kill); + .addReg(MSP430::R4, RegState::Kill); // Update FP with the new base value... - BuildMI(MBB, MBBI, DL, TII.get(MSP430::MOV16rr), MSP430::FP) + BuildMI(MBB, MBBI, DL, TII.get(MSP430::MOV16rr), MSP430::R4) .addReg(MSP430::SP); // Mark the FramePtr as live-in in every block except the entry. for (MachineFunction::iterator I = std::next(MF.begin()), E = MF.end(); I != E; ++I) - I->addLiveIn(MSP430::FP); + I->addLiveIn(MSP430::R4); } else NumBytes = StackSize - MSP430FI->getCalleeSavedFrameSize(); @@ -132,7 +132,7 @@ void MSP430FrameLowering::emitEpilogue(MachineFunction &MF, NumBytes = FrameSize - CSSize; // pop FP. - BuildMI(MBB, MBBI, DL, TII.get(MSP430::POP16r), MSP430::FP); + BuildMI(MBB, MBBI, DL, TII.get(MSP430::POP16r), MSP430::R4); } else NumBytes = StackSize - CSSize; @@ -154,7 +154,7 @@ void MSP430FrameLowering::emitEpilogue(MachineFunction &MF, if (MFI.hasVarSizedObjects()) { BuildMI(MBB, MBBI, DL, - TII.get(MSP430::MOV16rr), MSP430::SP).addReg(MSP430::FP); + TII.get(MSP430::MOV16rr), MSP430::SP).addReg(MSP430::R4); if (CSSize) { MachineInstr *MI = BuildMI(MBB, MBBI, DL, @@ -176,11 +176,9 @@ void MSP430FrameLowering::emitEpilogue(MachineFunction &MF, } // FIXME: Can we eleminate these in favour of generic code? -bool -MSP430FrameLowering::spillCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, - const std::vector<CalleeSavedInfo> &CSI, - const TargetRegisterInfo *TRI) const { +bool MSP430FrameLowering::spillCalleeSavedRegisters( + MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, + ArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const { if (CSI.empty()) return false; @@ -202,11 +200,9 @@ MSP430FrameLowering::spillCalleeSavedRegisters(MachineBasicBlock &MBB, return true; } -bool -MSP430FrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MI, - std::vector<CalleeSavedInfo> &CSI, - const TargetRegisterInfo *TRI) const { +bool MSP430FrameLowering::restoreCalleeSavedRegisters( + MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, + MutableArrayRef<CalleeSavedInfo> CSI, const TargetRegisterInfo *TRI) const { if (CSI.empty()) return false; @@ -227,8 +223,6 @@ MachineBasicBlock::iterator MSP430FrameLowering::eliminateCallFramePseudoInstr( MachineBasicBlock::iterator I) const { const MSP430InstrInfo &TII = *static_cast<const MSP430InstrInfo *>(MF.getSubtarget().getInstrInfo()); - unsigned StackAlign = getStackAlignment(); - if (!hasReservedCallFrame(MF)) { // If the stack pointer can be changed after prologue, turn the // adjcallstackup instruction into a 'sub SP, <amt>' and the @@ -240,7 +234,7 @@ MachineBasicBlock::iterator MSP430FrameLowering::eliminateCallFramePseudoInstr( // We need to keep the stack aligned properly. To do this, we round the // amount of space needed for the outgoing arguments up to the next // alignment boundary. - Amount = (Amount+StackAlign-1)/StackAlign*StackAlign; + Amount = alignTo(Amount, getStackAlign()); MachineInstr *New = nullptr; if (Old.getOpcode() == TII.getCallFrameSetupOpcode()) { |