]> granicus.if.org Git - clang/commitdiff
Darwin x86-32 ABI: Now that structure passing is farther along, we
authorDaniel Dunbar <daniel@zuster.org>
Tue, 12 May 2009 17:00:20 +0000 (17:00 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 12 May 2009 17:00:20 +0000 (17:00 +0000)
don't need special treatment for unions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71559 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCall.cpp
test/CodeGen/x86_32-arguments.c

index a142729343977d69e9d1db5a2723e2a7caeca76c..1df9b0be635da7f66b72d732dc12981dd10ffe6f 100644 (file)
@@ -446,18 +446,11 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy,
       }
     }
 
-    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);
index e31a09cbc739b85cf25d6815cc9788adf8df5212..fae49cbdd8755946af303e325704c24c8c9c72b3 100644 (file)
@@ -151,4 +151,7 @@ struct s36 { struct { int : 0 } a[2][10]; char b; char c; } f36(void) {}
 // 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