[llvm-commits] [llvm] r124949 - in /llvm/trunk: lib/Target/X86/X86FrameLowering.cpp lib/Target/X86/X86FrameLowering.h lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll test/CodeGen/X86/win64_params.ll test/CodeGen/X86/win64_vararg.ll
NAKAMURA Takumi
geek4civic at gmail.com
Sat Feb 5 07:11:32 PST 2011
Author: chapuni
Date: Sat Feb 5 09:11:32 2011
New Revision: 124949
URL: http://llvm.org/viewvc/llvm-project?rev=124949&view=rev
Log:
Target/X86: Tweak allocating shadow area (aka home) on Win64. It must be enough for caller to allocate one.
Modified:
llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
llvm/trunk/lib/Target/X86/X86FrameLowering.h
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll
llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll
llvm/trunk/test/CodeGen/X86/win64_params.ll
llvm/trunk/test/CodeGen/X86/win64_vararg.ll
Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.cpp?rev=124949&r1=124948&r2=124949&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.cpp Sat Feb 5 09:11:32 2011
@@ -397,11 +397,6 @@
if (HasFP) MinSize += SlotSize;
StackSize = std::max(MinSize, StackSize > 128 ? StackSize - 128 : 0);
MFI->setStackSize(StackSize);
- } else if (IsWin64) {
- // 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
Modified: llvm/trunk/lib/Target/X86/X86FrameLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FrameLowering.h?rev=124949&r1=124948&r2=124949&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FrameLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86FrameLowering.h Sat Feb 5 09:11:32 2011
@@ -28,8 +28,7 @@
explicit X86FrameLowering(const X86TargetMachine &tm, const X86Subtarget &sti)
: TargetFrameLowering(StackGrowsDown,
sti.getStackAlignment(),
- (sti.isTargetWin64() ? -40 :
- (sti.is64Bit() ? -8 : -4))),
+ (sti.is64Bit() ? -8 : -4)),
TM(tm), STI(sti) {
}
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=124949&r1=124948&r2=124949&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Feb 5 09:11:32 2011
@@ -1544,6 +1544,12 @@
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, CC_X86);
unsigned LastVal = ~0U;
@@ -1778,8 +1784,7 @@
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())
@@ -1864,6 +1869,12 @@
SmallVector<CCValAssign, 16> ArgLocs;
CCState CCInfo(CallConv, isVarArg, getTargetMachine(),
ArgLocs, *DAG.getContext());
+
+ // Allocate shadow area for Win64
+ if (IsWin64) {
+ CCInfo.AllocateStack(32, 8);
+ }
+
CCInfo.AnalyzeCallOperands(Outs, CC_X86);
// Get a count of how many bytes are to be pushed on the stack.
@@ -2447,6 +2458,12 @@
SmallVector<CCValAssign, 16> ArgLocs;
CCState CCInfo(CalleeCC, isVarArg, getTargetMachine(),
ArgLocs, *DAG.getContext());
+
+ // Allocate shadow area for Win64
+ if (Subtarget->isTargetWin64()) {
+ CCInfo.AllocateStack(32, 8);
+ }
+
CCInfo.AnalyzeCallOperands(Outs, CC_X86);
if (CCInfo.getNextStackOffset()) {
MachineFunction &MF = DAG.getMachineFunction();
Modified: llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll?rev=124949&r1=124948&r2=124949&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2009-06-03-Win64DisableRedZone.ll Sat Feb 5 09:11:32 2011
@@ -1,9 +1,8 @@
-; RUN: llc < %s | grep "subq.*\\\$40, \\\%rsp"
-target triple = "x86_64-pc-mingw64"
+; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s
+; CHECK-NOT: -{{[1-9][0-9]*}}(%rsp)
define x86_fp80 @a(i64 %x) nounwind readnone {
entry:
- %conv = sitofp i64 %x to x86_fp80 ; <x86_fp80> [#uses=1]
- ret x86_fp80 %conv
+ %conv = sitofp i64 %x to x86_fp80 ; <x86_fp80> [#uses=1]
+ ret x86_fp80 %conv
}
-
Modified: llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll?rev=124949&r1=124948&r2=124949&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll Sat Feb 5 09:11:32 2011
@@ -1,12 +1,10 @@
-; RUN: llc < %s -o %t1
-; RUN: grep "subq.*\\\$72, \\\%rsp" %t1
-; RUN: grep "movaps \\\%xmm8, 32\\\(\\\%rsp\\\)" %t1
-; RUN: grep "movaps \\\%xmm7, 48\\\(\\\%rsp\\\)" %t1
-target triple = "x86_64-pc-mingw64"
+; RUN: llc -mtriple=x86_64-pc-mingw64 < %s | FileCheck %s
+; CHECK: subq $40, %rsp
+; CHECK: movaps %xmm8, (%rsp)
+; CHECK: movaps %xmm7, 16(%rsp)
define i32 @a() nounwind {
entry:
- tail call void asm sideeffect "", "~{xmm7},~{xmm8},~{dirflag},~{fpsr},~{flags}"() nounwind
- ret i32 undef
+ tail call void asm sideeffect "", "~{xmm7},~{xmm8},~{dirflag},~{fpsr},~{flags}"() nounwind
+ ret i32 undef
}
-
Modified: llvm/trunk/test/CodeGen/X86/win64_params.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win64_params.ll?rev=124949&r1=124948&r2=124949&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/win64_params.ll (original)
+++ llvm/trunk/test/CodeGen/X86/win64_params.ll Sat Feb 5 09:11:32 2011
@@ -4,8 +4,8 @@
; on the stack.
define i32 @f6(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6) nounwind readnone optsize {
entry:
-; CHECK: movl 80(%rsp), %eax
-; CHECK: addl 72(%rsp), %eax
+; CHECK: movl 48(%rsp), %eax
+; CHECK: addl 40(%rsp), %eax
%add = add nsw i32 %p6, %p5
ret i32 %add
}
Modified: llvm/trunk/test/CodeGen/X86/win64_vararg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win64_vararg.ll?rev=124949&r1=124948&r2=124949&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/win64_vararg.ll (original)
+++ llvm/trunk/test/CodeGen/X86/win64_vararg.ll Sat Feb 5 09:11:32 2011
@@ -5,11 +5,11 @@
; calculated.
define void @average_va(i32 %count, ...) nounwind {
entry:
-; CHECK: subq $40, %rsp
-; CHECK: movq %r9, 72(%rsp)
-; CHECK: movq %r8, 64(%rsp)
-; CHECK: movq %rdx, 56(%rsp)
-; CHECK: leaq 56(%rsp), %rax
+; CHECK: pushq
+; CHECK: movq %r9, 40(%rsp)
+; CHECK: movq %r8, 32(%rsp)
+; CHECK: movq %rdx, 24(%rsp)
+; CHECK: leaq 24(%rsp), %rax
%ap = alloca i8*, align 8 ; <i8**> [#uses=1]
%ap1 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
More information about the llvm-commits
mailing list