forked from OSchip/llvm-project
Fix bug in computation of stack size in MipsFrameLowering.cpp.
llvm-svn: 159240
This commit is contained in:
parent
3b70d784a2
commit
62871a3460
|
@ -112,9 +112,12 @@ void MipsFrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||||
|
|
||||||
// First, compute final stack size.
|
// First, compute final stack size.
|
||||||
unsigned StackAlign = getStackAlignment();
|
unsigned StackAlign = getStackAlignment();
|
||||||
uint64_t StackSize = STI.inMips16Mode()? 0:
|
uint64_t StackSize = RoundUpToAlignment(MFI->getStackSize(), StackAlign);
|
||||||
MFI->getObjectOffset(MipsFI->getGlobalRegFI()) +
|
|
||||||
StackAlign + RoundUpToAlignment(MFI->getStackSize(), StackAlign);
|
if (MipsFI->globalBaseRegSet())
|
||||||
|
StackSize += MFI->getObjectOffset(MipsFI->getGlobalRegFI()) + StackAlign;
|
||||||
|
else
|
||||||
|
StackSize += RoundUpToAlignment(MipsFI->getMaxCallFrameSize(), StackAlign);
|
||||||
|
|
||||||
// Update stack size
|
// Update stack size
|
||||||
MFI->setStackSize(StackSize);
|
MFI->setStackSize(StackSize);
|
||||||
|
|
|
@ -117,6 +117,10 @@ private:
|
||||||
void MipsDAGToDAGISel::InitGlobalBaseReg(MachineFunction &MF) {
|
void MipsDAGToDAGISel::InitGlobalBaseReg(MachineFunction &MF) {
|
||||||
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
|
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
|
||||||
|
|
||||||
|
if (((MF.getTarget().getRelocationModel() == Reloc::Static) ||
|
||||||
|
Subtarget.inMips16Mode()) && !MipsFI->globalBaseRegSet())
|
||||||
|
return;
|
||||||
|
|
||||||
MachineBasicBlock &MBB = MF.front();
|
MachineBasicBlock &MBB = MF.front();
|
||||||
MachineBasicBlock::iterator I = MBB.begin();
|
MachineBasicBlock::iterator I = MBB.begin();
|
||||||
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
||||||
|
|
Loading…
Reference in New Issue