[cfe-commits] r72268 - in /cfe/trunk: lib/CodeGen/CGCall.cpp test/CodeGen/x86_64-arguments.c

Daniel Dunbar daniel at zuster.org
Fri May 22 10:33:46 PDT 2009


Author: ddunbar
Date: Fri May 22 12:33:44 2009
New Revision: 72268

URL: http://llvm.org/viewvc/llvm-project?rev=72268&view=rev
Log:
x86_64 ABI: Account for sret parameters consuming an integer register.
 - PR4242.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/test/CodeGen/x86_64-arguments.c

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=72268&r1=72267&r2=72268&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri May 22 12:33:44 2009
@@ -1055,6 +1055,11 @@
 
   // Keep track of the number of assigned registers.
   unsigned freeIntRegs = 6, freeSSERegs = 8;
+  
+  // If the return value is indirect, then the hidden argument is consuming one
+  // integer register.
+  if (FI.getReturnInfo().isIndirect())
+    --freeIntRegs;
 
   // AMD64-ABI 3.2.3p3: Once arguments are classified, the registers
   // get assigned (in left-to-right order) for passing as follows...

Modified: cfe/trunk/test/CodeGen/x86_64-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_64-arguments.c?rev=72268&r1=72267&r2=72268&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/x86_64-arguments.c (original)
+++ cfe/trunk/test/CodeGen/x86_64-arguments.c Fri May 22 12:33:44 2009
@@ -61,4 +61,12 @@
 struct s12 f12_0(void) {}
 void f12_1(struct s12 a0) {}
 
+// Check that sret parameter is accounted for when checking available integer
+// registers.
+// RUN: grep 'define void @f13(.struct.s13_0. noalias sret .agg.result, i32 .a, i32 .b, i32 .c, i32 .d, .struct.s13_1. byval .e, i32 .f)' %t &&
+
+struct s13_0 { long long f0[3]; };
+struct s13_0 f13(int a, int b, int c, int d, 
+                 struct s13_1 { long long f0[2]; } e, int f) {}
+
 // RUN: true





More information about the cfe-commits mailing list