mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-10 14:12:11 +00:00
If stack realignment is used - incoming args will use EBP as base register and locals - ESP
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50162 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b51dce3013
commit
8e91ec5e29
@ -281,16 +281,28 @@ bool X86RegisterInfo::hasReservedCallFrame(MachineFunction &MF) const {
|
||||
int
|
||||
X86RegisterInfo::getFrameIndexOffset(MachineFunction &MF, int FI) const {
|
||||
int Offset = MF.getFrameInfo()->getObjectOffset(FI) + SlotSize;
|
||||
if (!hasFP(MF))
|
||||
return Offset + MF.getFrameInfo()->getStackSize();
|
||||
|
||||
// Skip the saved EBP
|
||||
Offset += SlotSize;
|
||||
if (needsStackRealignment(MF)) {
|
||||
if (FI < 0)
|
||||
// Skip the saved EBP
|
||||
Offset += SlotSize;
|
||||
else
|
||||
return Offset + MF.getFrameInfo()->getStackSize();
|
||||
|
||||
// FIXME: Support tail calls
|
||||
} else {
|
||||
if (!hasFP(MF))
|
||||
return Offset + MF.getFrameInfo()->getStackSize();
|
||||
|
||||
// Skip the saved EBP
|
||||
Offset += SlotSize;
|
||||
|
||||
// Skip the RETADDR move area
|
||||
X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
|
||||
int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta();
|
||||
if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta;
|
||||
}
|
||||
|
||||
// Skip the RETADDR move area
|
||||
X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
|
||||
int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta();
|
||||
if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta;
|
||||
return Offset;
|
||||
}
|
||||
|
||||
@ -360,9 +372,16 @@ void X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
}
|
||||
|
||||
int FrameIndex = MI.getOperand(i).getIndex();
|
||||
|
||||
unsigned BasePtr;
|
||||
if (needsStackRealignment(MF))
|
||||
BasePtr = (FrameIndex < 0 ? FramePtr : StackPtr);
|
||||
else
|
||||
BasePtr = (hasFP(MF) ? FramePtr : StackPtr);
|
||||
|
||||
// This must be part of a four operand memory reference. Replace the
|
||||
// FrameIndex with base register with EBP. Add an offset to the offset.
|
||||
MI.getOperand(i).ChangeToRegister(hasFP(MF) ? FramePtr : StackPtr, false);
|
||||
MI.getOperand(i).ChangeToRegister(BasePtr, false);
|
||||
|
||||
// Now add the frame object offset to the offset from EBP.
|
||||
int64_t Offset = getFrameIndexOffset(MF, FrameIndex) +
|
||||
|
Loading…
Reference in New Issue
Block a user