mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-13 14:46:53 +00:00
Last check-in was bogus. There is no need to align the stack if the function is a leaf function (and without alloca).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33399 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
597a3bde35
commit
5ad334fbda
@ -991,6 +991,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||||
unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
|
unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
|
||||||
|
unsigned AlignMask = Align - 1;
|
||||||
const Function* Fn = MF.getFunction();
|
const Function* Fn = MF.getFunction();
|
||||||
const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget<X86Subtarget>();
|
const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget<X86Subtarget>();
|
||||||
MachineInstr *MI;
|
MachineInstr *MI;
|
||||||
@ -1004,9 +1005,11 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
//
|
//
|
||||||
NumBytes += MFI->getMaxCallFrameSize();
|
NumBytes += MFI->getMaxCallFrameSize();
|
||||||
|
|
||||||
// Round the size to a multiple of the alignment (don't forget the 4/8 byte
|
// Round the size to a multiple of the alignment (don't forget the 4/8 byte
|
||||||
// offset though).
|
// offset pushed by the caller though). No need to align the stack if this
|
||||||
NumBytes = ((NumBytes+SlotSize)+Align-1)/Align*Align - SlotSize;
|
// is a leaf function.
|
||||||
|
NumBytes = (((NumBytes+SlotSize) + AlignMask) & ~AlignMask) - SlotSize;
|
||||||
|
}
|
||||||
|
|
||||||
// Update frame info to pretend that this is part of the stack...
|
// Update frame info to pretend that this is part of the stack...
|
||||||
MFI->setStackSize(NumBytes);
|
MFI->setStackSize(NumBytes);
|
||||||
|
Loading…
Reference in New Issue
Block a user