mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-02 08:46:23 +00:00
Properly allocate win64 shadow reg area.
Patch by Jan Sjodin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112875 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
df782a789d
commit
2f4fad99ea
@ -1616,6 +1616,11 @@ X86TargetLowering::LowerFormalArguments(SDValue Chain,
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
CCState CCInfo(CallConv, isVarArg, getTargetMachine(),
|
||||
ArgLocs, *DAG.getContext());
|
||||
|
||||
// Allocate shadow area for Win64
|
||||
if (IsWin64)
|
||||
CCInfo.AllocateStack(32, 8);
|
||||
|
||||
CCInfo.AnalyzeFormalArguments(Ins, CCAssignFnForNode(CallConv));
|
||||
|
||||
unsigned LastVal = ~0U;
|
||||
@ -1842,8 +1847,7 @@ X86TargetLowering::LowerMemOpCallTo(SDValue Chain,
|
||||
DebugLoc dl, SelectionDAG &DAG,
|
||||
const CCValAssign &VA,
|
||||
ISD::ArgFlagsTy Flags) const {
|
||||
const unsigned FirstStackArgOffset = (Subtarget->isTargetWin64() ? 32 : 0);
|
||||
unsigned LocMemOffset = FirstStackArgOffset + VA.getLocMemOffset();
|
||||
unsigned LocMemOffset = VA.getLocMemOffset();
|
||||
SDValue PtrOff = DAG.getIntPtrConstant(LocMemOffset);
|
||||
PtrOff = DAG.getNode(ISD::ADD, dl, getPointerTy(), StackPtr, PtrOff);
|
||||
if (Flags.isByVal()) {
|
||||
@ -1926,6 +1930,11 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee,
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
CCState CCInfo(CallConv, isVarArg, getTargetMachine(),
|
||||
ArgLocs, *DAG.getContext());
|
||||
|
||||
// Allocate shadow area for Win64
|
||||
if (Subtarget->isTargetWin64())
|
||||
CCInfo.AllocateStack(32, 8);
|
||||
|
||||
CCInfo.AnalyzeCallOperands(Outs, CCAssignFnForNode(CallConv));
|
||||
|
||||
// Get a count of how many bytes are to be pushed on the stack.
|
||||
|
@ -945,11 +945,6 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
if (HasFP) MinSize += SlotSize;
|
||||
StackSize = std::max(MinSize, StackSize > 128 ? StackSize - 128 : 0);
|
||||
MFI->setStackSize(StackSize);
|
||||
} else if (Subtarget->isTargetWin64()) {
|
||||
// We need to always allocate 32 bytes as register spill area.
|
||||
// FIXME: We might reuse these 32 bytes for leaf functions.
|
||||
StackSize += 32;
|
||||
MFI->setStackSize(StackSize);
|
||||
}
|
||||
|
||||
// Insert stack pointer adjustment for later moving of return addr. Only
|
||||
|
Loading…
Reference in New Issue
Block a user