[cfe-commits] r81737 - in /cfe/trunk: lib/CodeGen/TargetABIInfo.cpp test/CodeGen/arm-apcs-arguments.c test/CodeGen/arm-arguments.c

Daniel Dunbar daniel at zuster.org
Sun Sep 13 17:56:56 PDT 2009


Author: ddunbar
Date: Sun Sep 13 19:56:55 2009
New Revision: 81737

URL: http://llvm.org/viewvc/llvm-project?rev=81737&view=rev
Log:
Some minor clang/ARM/AAPCS tweaks.

Added:
    cfe/trunk/test/CodeGen/arm-arguments.c
Removed:
    cfe/trunk/test/CodeGen/arm-apcs-arguments.c
Modified:
    cfe/trunk/lib/CodeGen/TargetABIInfo.cpp

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

==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Sun Sep 13 19:56:55 2009
@@ -1527,11 +1527,21 @@
 
   // Otherwise this is an AAPCS variant.
 
+  if (isEmptyRecord(Context, RetTy, true))
+    return ABIArgInfo::getIgnore();
+
   // Aggregates <= 4 bytes are returned in r0; other aggregates
   // are returned indirectly.
   uint64_t Size = Context.getTypeSize(RetTy);
-  if (Size <= 32)
+  if (Size <= 32) {
+    // Return in the smallest viable integer type.
+    if (Size <= 8)
+      return ABIArgInfo::getCoerce(llvm::Type::getInt8Ty(VMContext));
+    if (Size <= 16)
+      return ABIArgInfo::getCoerce(llvm::Type::getInt16Ty(VMContext));
     return ABIArgInfo::getCoerce(llvm::Type::getInt32Ty(VMContext));
+  }
+
   return ABIArgInfo::getIndirect(0);
 }
 

Removed: cfe/trunk/test/CodeGen/arm-apcs-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-apcs-arguments.c?rev=81736&view=auto

==============================================================================
--- cfe/trunk/test/CodeGen/arm-apcs-arguments.c (original)
+++ cfe/trunk/test/CodeGen/arm-apcs-arguments.c (removed)
@@ -1,59 +0,0 @@
-// RUX: iphone-llvm-gcc -arch armv7 -flto -S -o - %s | FileCheck %s
-// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi=apcs-gnu -emit-llvm -w -o - %s | FileCheck %s
-
-// CHECK: define arm_apcscc signext i8 @f0()
-char f0(void) {
-  return 0;
-}
-
-// CHECK: define arm_apcscc i8 @f1()
-struct s1 { char f0; };
-struct s1 f1(void) {}
-
-// CHECK: define arm_apcscc i16 @f2()
-struct s2 { short f0; };
-struct s2 f2(void) {}
-
-// CHECK: define arm_apcscc i32 @f3()
-struct s3 { int f0; };
-struct s3 f3(void) {}
-
-// CHECK: define arm_apcscc i32 @f4()
-struct s4 { struct s4_0 { int f0; } f0; };
-struct s4 f4(void) {}
-
-// CHECK: define arm_apcscc void @f5(
-// CHECK: struct.s5* noalias sret
-struct s5 { struct { } f0; int f1; };
-struct s5 f5(void) {}
-
-// CHECK: define arm_apcscc void @f6(
-// CHECK: struct.s6* noalias sret
-struct s6 { int f0[1]; };
-struct s6 f6(void) {}
-
-// CHECK: define arm_apcscc void @f7()
-struct s7 { struct { int : 0; } f0; };
-struct s7 f7(void) {}
-
-// CHECK: define arm_apcscc void @f8(
-// CHECK: struct.s8* noalias sret
-struct s8 { struct { int : 0; } f0[1]; };
-struct s8 f8(void) {}
-
-// CHECK: define arm_apcscc i32 @f9()
-struct s9 { int f0; int : 0; };
-struct s9 f9(void) {}
-
-// CHECK: define arm_apcscc i32 @f10()
-struct s10 { int f0; int : 0; int : 0; };
-struct s10 f10(void) {}
-
-// CHECK: define arm_apcscc void @f11(
-// CHECK: struct.s10* noalias sret
-struct s11 { int : 0; int f0; };
-struct s11 f11(void) {}
-
-// CHECK: define arm_apcscc i32 @f12()
-union u12 { char f0; short f1; int f2; };
-union u12 f12(void) {}

Added: cfe/trunk/test/CodeGen/arm-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-arguments.c?rev=81737&view=auto

==============================================================================
--- cfe/trunk/test/CodeGen/arm-arguments.c (added)
+++ cfe/trunk/test/CodeGen/arm-arguments.c Sun Sep 13 19:56:55 2009
@@ -0,0 +1,72 @@
+// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi=apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s &&
+// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi=aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s
+
+// APCS-GNU: define arm_apcscc signext i8 @f0()
+// AAPCS: define arm_aapcscc signext i8 @f0()
+char f0(void) {
+  return 0;
+}
+
+// APCS-GNU: define arm_apcscc i8 @f1()
+// AAPCS: define arm_aapcscc i8 @f1()
+struct s1 { char f0; };
+struct s1 f1(void) {}
+
+// APCS-GNU: define arm_apcscc i16 @f2()
+// AAPCS: define arm_aapcscc i16 @f2()
+struct s2 { short f0; };
+struct s2 f2(void) {}
+
+// APCS-GNU: define arm_apcscc i32 @f3()
+// AAPCS: define arm_aapcscc i32 @f3()
+struct s3 { int f0; };
+struct s3 f3(void) {}
+
+// APCS-GNU: define arm_apcscc i32 @f4()
+// AAPCS: define arm_aapcscc i32 @f4()
+struct s4 { struct s4_0 { int f0; } f0; };
+struct s4 f4(void) {}
+
+// APCS-GNU: define arm_apcscc void @f5(
+// APCS-GNU: struct.s5* noalias sret
+// AAPCS: define arm_aapcscc i32 @f5()
+struct s5 { struct { } f0; int f1; };
+struct s5 f5(void) {}
+
+// APCS-GNU: define arm_apcscc void @f6(
+// APCS-GNU: struct.s6* noalias sret
+// AAPCS: define arm_aapcscc i32 @f6()
+struct s6 { int f0[1]; };
+struct s6 f6(void) {}
+
+// APCS-GNU: define arm_apcscc void @f7()
+// AAPCS: define arm_aapcscc void @f7()
+struct s7 { struct { int : 0; } f0; };
+struct s7 f7(void) {}
+
+// APCS-GNU: define arm_apcscc void @f8(
+// APCS-GNU: struct.s8* noalias sret
+// AAPCS: define arm_aapcscc void @f8()
+struct s8 { struct { int : 0; } f0[1]; };
+struct s8 f8(void) {}
+
+// APCS-GNU: define arm_apcscc i32 @f9()
+// AAPCS: define arm_aapcscc i32 @f9()
+struct s9 { int f0; int : 0; };
+struct s9 f9(void) {}
+
+// APCS-GNU: define arm_apcscc i32 @f10()
+// AAPCS: define arm_aapcscc i32 @f10()
+struct s10 { int f0; int : 0; int : 0; };
+struct s10 f10(void) {}
+
+// APCS-GNU: define arm_apcscc void @f11(
+// APCS-GNU: struct.s10* noalias sret
+// AAPCS: define arm_aapcscc i32 @f11()
+struct s11 { int : 0; int f0; };
+struct s11 f11(void) {}
+
+// APCS-GNU: define arm_apcscc i32 @f12()
+// AAPCS: define arm_aapcscc i32 @f12()
+union u12 { char f0; short f1; int f2; };
+union u12 f12(void) {}





More information about the cfe-commits mailing list