[llvm-branch-commits] [llvm-branch] r128044 - in /llvm/branches/release_29: ./ lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/win64_vararg.ll

Bill Wendling isanbard at gmail.com
Mon Mar 21 17:19:46 PDT 2011


Author: void
Date: Mon Mar 21 19:19:46 2011
New Revision: 128044

URL: http://llvm.org/viewvc/llvm-project?rev=128044&view=rev
Log:
Fix Win64 va_arg.
--- Merging r127328 into '.':
U    test/CodeGen/X86/win64_vararg.ll
U    lib/Target/X86/X86ISelLowering.cpp


Modified:
    llvm/branches/release_29/   (props changed)
    llvm/branches/release_29/lib/Target/X86/X86ISelLowering.cpp
    llvm/branches/release_29/test/CodeGen/X86/win64_vararg.ll

Propchange: llvm/branches/release_29/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar 21 19:19:46 2011
@@ -1,2 +1,2 @@
 /llvm/branches/Apple/Pertwee:110850,110961
-/llvm/trunk:127241,127263-127264,127298,127325,127350-127351,127441,127464,127780,128041
+/llvm/trunk:127241,127263-127264,127298,127325,127328,127350-127351,127441,127464,127780,128041

Modified: llvm/branches/release_29/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_29/lib/Target/X86/X86ISelLowering.cpp?rev=128044&r1=128043&r2=128044&view=diff
==============================================================================
--- llvm/branches/release_29/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/release_29/lib/Target/X86/X86ISelLowering.cpp Mon Mar 21 19:19:46 2011
@@ -1750,8 +1750,8 @@
   // If the function takes variable number of arguments, make a frame index for
   // the start of the first vararg value... for expansion of llvm.va_start.
   if (isVarArg) {
-    if (!IsWin64 && (Is64Bit || (CallConv != CallingConv::X86_FastCall &&
-                    CallConv != CallingConv::X86_ThisCall))) {
+    if (Is64Bit || (CallConv != CallingConv::X86_FastCall &&
+                    CallConv != CallingConv::X86_ThisCall)) {
       FuncInfo->setVarArgsFrameIndex(MFI->CreateFixedObject(1, StackSize,true));
     }
     if (Is64Bit) {
@@ -1803,7 +1803,9 @@
         int HomeOffset = TFI.getOffsetOfLocalArea() + 8;
         FuncInfo->setRegSaveFrameIndex(
           MFI->CreateFixedObject(1, NumIntRegs * 8 + HomeOffset, false));
-        FuncInfo->setVarArgsFrameIndex(FuncInfo->getRegSaveFrameIndex());
+        // Fixup to set vararg frame on shadow area (4 x i64).
+        if (NumIntRegs < 4)
+          FuncInfo->setVarArgsFrameIndex(FuncInfo->getRegSaveFrameIndex());
       } else {
         // For X86-64, if there are vararg parameters that are passed via
         // registers, then we must store them to their spots on the stack so they

Modified: llvm/branches/release_29/test/CodeGen/X86/win64_vararg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_29/test/CodeGen/X86/win64_vararg.ll?rev=128044&r1=128043&r2=128044&view=diff
==============================================================================
--- llvm/branches/release_29/test/CodeGen/X86/win64_vararg.ll (original)
+++ llvm/branches/release_29/test/CodeGen/X86/win64_vararg.ll Mon Mar 21 19:19:46 2011
@@ -18,3 +18,36 @@
 }
 
 declare void @llvm.va_start(i8*) nounwind
+
+; CHECK: f5:
+; CHECK: pushq
+; CHECK: leaq 56(%rsp),
+define i8* @f5(i64 %a0, i64 %a1, i64 %a2, i64 %a3, i64 %a4, ...) nounwind {
+entry:
+  %ap = alloca i8*, align 8
+  %ap1 = bitcast i8** %ap to i8*
+  call void @llvm.va_start(i8* %ap1)
+  ret i8* %ap1
+}
+
+; CHECK: f4:
+; CHECK: pushq
+; CHECK: leaq 48(%rsp),
+define i8* @f4(i64 %a0, i64 %a1, i64 %a2, i64 %a3, ...) nounwind {
+entry:
+  %ap = alloca i8*, align 8
+  %ap1 = bitcast i8** %ap to i8*
+  call void @llvm.va_start(i8* %ap1)
+  ret i8* %ap1
+}
+
+; CHECK: f3:
+; CHECK: pushq
+; CHECK: leaq 40(%rsp),
+define i8* @f3(i64 %a0, i64 %a1, i64 %a2, ...) nounwind {
+entry:
+  %ap = alloca i8*, align 8
+  %ap1 = bitcast i8** %ap to i8*
+  call void @llvm.va_start(i8* %ap1)
+  ret i8* %ap1
+}





More information about the llvm-branch-commits mailing list