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

Daniel Dunbar daniel at zuster.org
Tue May 12 10:00:34 PDT 2009


Author: ddunbar
Date: Tue May 12 12:00:20 2009
New Revision: 71559

URL: http://llvm.org/viewvc/llvm-project?rev=71559&view=rev
Log:
Darwin x86-32 ABI: Now that structure passing is farther along, we
don't need special treatment for unions.

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

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue May 12 12:00:20 2009
@@ -446,18 +446,11 @@
       }
     }
 
-    uint64_t Size = Context.getTypeSize(RetTy);
-    if (isRegisterSize(Size)) {
-      // Always return in register for unions for now.
-      // FIXME: This is wrong, but better than treating as a
-      // structure.
-      if (RetTy->isUnionType())
-        return ABIArgInfo::getCoerce(llvm::IntegerType::get(Size));
-
-      // Small structures which are register sized are generally returned
-      // in a register.
-      if (X86_32ABIInfo::shouldReturnTypeInRegister(RetTy, Context))
-        return ABIArgInfo::getCoerce(llvm::IntegerType::get(Size));
+    // Small structures which are register sized are generally returned
+    // in a register.
+    if (X86_32ABIInfo::shouldReturnTypeInRegister(RetTy, Context)) {
+      uint64_t Size = Context.getTypeSize(RetTy);
+      return ABIArgInfo::getCoerce(llvm::IntegerType::get(Size));
     }
 
     return ABIArgInfo::getIndirect(0);

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

==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-arguments.c (original)
+++ cfe/trunk/test/CodeGen/x86_32-arguments.c Tue May 12 12:00:20 2009
@@ -151,4 +151,7 @@
 // RUN: grep 'define float @f37()' %t &&
 struct s37 { float c[1][1]; } f37(void) {}
 
+// RUN: grep 'define void @f38(.struct.s38. noalias sret .agg.result)' %t &&
+struct s38 { char a[3]; short b; } f38(void) {}
+
 // RUN: true





More information about the cfe-commits mailing list