mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Round number of bytes allocated on the stack up to a multiple of 4 so that the
stack remains aligned llvm-svn: 5095
This commit is contained in:
parent
305d72e965
commit
dbca3de031
@ -113,10 +113,13 @@ const unsigned* X86RegisterInfo::getCallerSaveRegs() const {
|
||||
}
|
||||
|
||||
void X86RegisterInfo::emitPrologue(MachineFunction &MF,
|
||||
unsigned numBytes) const {
|
||||
unsigned NumBytes) const {
|
||||
MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
|
||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||
|
||||
// Round stack allocation up to a nice alignment to keep the stack aligned
|
||||
NumBytes = (NumBytes + 3) & ~3;
|
||||
|
||||
// PUSH ebp
|
||||
MachineInstr *MI = BuildMI(X86::PUSHr32, 1).addReg(X86::EBP);
|
||||
MBBI = ++MBB.insert(MBBI, MI);
|
||||
@ -126,7 +129,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF,
|
||||
MBBI = ++MBB.insert(MBBI, MI);
|
||||
|
||||
// adjust stack pointer: ESP -= numbytes
|
||||
MI = BuildMI(X86::SUBri32, 2, X86::ESP).addReg(X86::ESP).addZImm(numBytes);
|
||||
MI = BuildMI(X86::SUBri32, 2, X86::ESP).addReg(X86::ESP).addZImm(NumBytes);
|
||||
MBBI = ++MBB.insert(MBBI, MI);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user