Revert win64 changes. They seem to be incomplete
authorAnton Korobeynikov <asl@math.spbu.ru>
Thu, 2 Sep 2010 22:31:32 +0000 (22:31 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Thu, 2 Sep 2010 22:31:32 +0000 (22:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112885 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86RegisterInfo.cpp

index b3a5cffe152d0a9b86d2454b3ca7db0088af1644..e7a8d0666ecc36f6baec3499d2cb66beee14b475 100644 (file)
@@ -1616,11 +1616,6 @@ 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;
@@ -1847,7 +1842,8 @@ X86TargetLowering::LowerMemOpCallTo(SDValue Chain,
                                     DebugLoc dl, SelectionDAG &DAG,
                                     const CCValAssign &VA,
                                     ISD::ArgFlagsTy Flags) const {
-  unsigned LocMemOffset = VA.getLocMemOffset();
+  const unsigned FirstStackArgOffset = (Subtarget->isTargetWin64() ? 32 : 0);
+  unsigned LocMemOffset = FirstStackArgOffset + VA.getLocMemOffset();
   SDValue PtrOff = DAG.getIntPtrConstant(LocMemOffset);
   PtrOff = DAG.getNode(ISD::ADD, dl, getPointerTy(), StackPtr, PtrOff);
   if (Flags.isByVal()) {
@@ -1930,11 +1926,6 @@ 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.
index ae9a39a0f8ff83ff7a8fa8b2fdd64eb43e249bbe..03c7ffc2bc2de1cc38aaf0d6a609ba2b5d041ef1 100644 (file)
@@ -945,6 +945,11 @@ 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