From: Eric Christopher Date: Fri, 5 Dec 2014 01:06:59 +0000 (+0000) Subject: Have the driver and the target code agree on what the default ABI X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e2618857c81ab37cdfacdc407620449a17f12ef;p=platform%2Fupstream%2Fllvm.git Have the driver and the target code agree on what the default ABI is for each machine. Fix up darwin tests that were testing for aapcs on armv7-ios when the actual ABI is apcs. Should be no user visible change without -cc1. llvm-svn: 223429 --- diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index b28808b..1dfddb5 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -3838,7 +3838,42 @@ public: // FIXME: Should we just treat this as a feature? IsThumb = getTriple().getArchName().startswith("thumb"); - setABI("aapcs-linux"); + // FIXME: This duplicates code from the driver that sets the -target-abi + // option - this code is used if -target-abi isn't passed and should + // be unified in some way. + if (Triple.isOSBinFormatMachO()) { + // The backend is hardwired to assume AAPCS for M-class processors, ensure + // the frontend matches that. + if (Triple.getEnvironment() == llvm::Triple::EABI || + Triple.getOS() == llvm::Triple::UnknownOS || + StringRef(CPU).startswith("cortex-m")) { + setABI("aapcs"); + } else { + setABI("apcs-gnu"); + } + } else if (Triple.isOSWindows()) { + // FIXME: this is invalid for WindowsCE + setABI("aapcs"); + } else { + // Select the default based on the platform. + switch (Triple.getEnvironment()) { + case llvm::Triple::Android: + case llvm::Triple::GNUEABI: + case llvm::Triple::GNUEABIHF: + setABI("aapcs-linux"); + break; + case llvm::Triple::EABIHF: + case llvm::Triple::EABI: + setABI("aapcs"); + break; + default: + if (Triple.getOS() == llvm::Triple::NetBSD) + setABI("apcs-gnu"); + else + setABI("aapcs"); + break; + } + } // ARM targets default to using the ARM C++ ABI. TheCXXABI.set(TargetCXXABI::GenericARM); diff --git a/clang/test/CodeGen/c11atomics-ios.c b/clang/test/CodeGen/c11atomics-ios.c index ad004fa..ad57550 100644 --- a/clang/test/CodeGen/c11atomics-ios.c +++ b/clang/test/CodeGen/c11atomics-ios.c @@ -6,7 +6,7 @@ // This work was done in pursuit of . -// CHECK-LABEL: define arm_aapcscc void @testFloat(float* +// CHECK-LABEL: define void @testFloat(float* void testFloat(_Atomic(float) *fp) { // CHECK: [[FP:%.*]] = alloca float* // CHECK-NEXT: [[X:%.*]] = alloca float @@ -37,7 +37,7 @@ void testFloat(_Atomic(float) *fp) { // CHECK-NEXT: ret void } -// CHECK: define arm_aapcscc void @testComplexFloat([[CF:{ float, float }]]* +// CHECK: define void @testComplexFloat([[CF:{ float, float }]]* void testComplexFloat(_Atomic(_Complex float) *fp) { // CHECK: [[FP:%.*]] = alloca [[CF]]*, align 4 // CHECK-NEXT: [[X:%.*]] = alloca [[CF]], align 8 @@ -93,7 +93,7 @@ void testComplexFloat(_Atomic(_Complex float) *fp) { } typedef struct { short x, y, z, w; } S; -// CHECK: define arm_aapcscc void @testStruct([[S:.*]]* +// CHECK: define void @testStruct([[S:.*]]* void testStruct(_Atomic(S) *fp) { // CHECK: [[FP:%.*]] = alloca [[S]]*, align 4 // CHECK-NEXT: [[X:%.*]] = alloca [[S]], align 8 @@ -143,7 +143,7 @@ void testStruct(_Atomic(S) *fp) { } typedef struct { short x, y, z; } PS; -// CHECK: define arm_aapcscc void @testPromotedStruct([[APS:.*]]* +// CHECK: define void @testPromotedStruct([[APS:.*]]* void testPromotedStruct(_Atomic(PS) *fp) { // CHECK: [[FP:%.*]] = alloca [[APS]]*, align 4 // CHECK-NEXT: [[X:%.*]] = alloca [[APS]], align 8 diff --git a/clang/test/CodeGen/pr5406.c b/clang/test/CodeGen/pr5406.c index 2d19822..0f04a8e 100644 --- a/clang/test/CodeGen/pr5406.c +++ b/clang/test/CodeGen/pr5406.c @@ -6,7 +6,7 @@ typedef struct { char x[3]; } A0; void foo (int i, ...); -// CHECK: call arm_aapcscc void (i32, ...)* @foo(i32 1, [1 x i32] {{.*}}) +// CHECK: call void (i32, ...)* @foo(i32 1, [1 x i32] {{.*}}) int main (void) { A0 a3; diff --git a/clang/test/CodeGenCXX/runtimecc.cpp b/clang/test/CodeGenCXX/runtimecc.cpp index 2044883..ad6dc85 100644 --- a/clang/test/CodeGenCXX/runtimecc.cpp +++ b/clang/test/CodeGenCXX/runtimecc.cpp @@ -20,33 +20,33 @@ namespace test0 { }; A global; -// CHECK-LABEL: define internal arm_aapcscc void @__cxx_global_var_init() -// CHECK: call arm_aapcscc [[A]]* @_ZN5test01AC1Ev([[A]]* @_ZN5test06globalE) -// CHECK-NEXT: call arm_aapcscc i32 @__cxa_atexit(void (i8*)* bitcast ([[A]]* ([[A]]*)* @_ZN5test01AD1Ev to void (i8*)*), i8* bitcast ([[A]]* @_ZN5test06globalE to i8*), i8* @__dso_handle) [[NOUNWIND:#[0-9]+]] +// CHECK-LABEL: define internal void @__cxx_global_var_init() +// CHECK: call [[A]]* @_ZN5test01AC1Ev([[A]]* @_ZN5test06globalE) +// CHECK-NEXT: call i32 @__cxa_atexit(void (i8*)* bitcast ([[A]]* ([[A]]*)* @_ZN5test01AD1Ev to void (i8*)*), i8* bitcast ([[A]]* @_ZN5test06globalE to i8*), i8* @__dso_handle) [[NOUNWIND:#[0-9]+]] // CHECK-NEXT: ret void } -// CHECK: declare arm_aapcscc i32 @__cxa_atexit(void (i8*)*, i8*, i8*) [[NOUNWIND]] +// CHECK: declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) [[NOUNWIND]] namespace test1 { void test() { throw 0; } -// CHECK-LABEL: define arm_aapcscc void @_ZN5test14testEv() -// CHECK: [[T0:%.*]] = call arm_aapcscc i8* @__cxa_allocate_exception(i32 4) [[NOUNWIND]] +// CHECK-LABEL: define void @_ZN5test14testEv() +// CHECK: [[T0:%.*]] = call i8* @__cxa_allocate_exception(i32 4) [[NOUNWIND]] // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to i32* // CHECK-NEXT: store i32 0, i32* [[T1]] -// CHECK-NEXT: call arm_aapcscc void @__cxa_throw(i8* [[T0]], i8* bitcast (i8** @_ZTIi to i8*), i8* null) [[NORETURN:#[0-9]+]] +// CHECK-NEXT: call void @__cxa_throw(i8* [[T0]], i8* bitcast (i8** @_ZTIi to i8*), i8* null) [[NORETURN:#[0-9]+]] // CHECK-NEXT: unreachable } -// CHECK: declare arm_aapcscc i8* @__cxa_allocate_exception(i32) +// CHECK: declare i8* @__cxa_allocate_exception(i32) -// CHECK: declare arm_aapcscc void @__cxa_throw(i8*, i8*, i8*) +// CHECK: declare void @__cxa_throw(i8*, i8*, i8*) -// CHECK-LABEL: define internal arm_aapcscc void @_GLOBAL__sub_I_runtimecc.cpp() -// CHECK: call arm_aapcscc void @__cxx_global_var_init() +// CHECK-LABEL: define internal void @_GLOBAL__sub_I_runtimecc.cpp() +// CHECK: call void @__cxx_global_var_init() // CHECK: attributes [[NOUNWIND]] = { nounwind } diff --git a/clang/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m b/clang/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m index 535cbbb..6eb5890 100644 --- a/clang/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m +++ b/clang/test/CodeGenObjC/arm-atomic-scalar-setter-getter.m @@ -8,6 +8,6 @@ @implementation I @synthesize LONG_PROP; @end -// CHECK-ARM: call arm_aapcscc void @objc_copyStruct(i8* %{{.*}}, i8* %{{.*}}, i32 8, i1 zeroext true, i1 zeroext false) -// CHECK-ARM: call arm_aapcscc void @objc_copyStruct(i8* %{{.*}}, i8* %{{.*}}, i32 8, i1 zeroext true, i1 zeroext false) +// CHECK-ARM: call void @objc_copyStruct(i8* %{{.*}}, i8* %{{.*}}, i32 8, i1 zeroext true, i1 zeroext false) +// CHECK-ARM: call void @objc_copyStruct(i8* %{{.*}}, i8* %{{.*}}, i32 8, i1 zeroext true, i1 zeroext false) diff --git a/clang/test/CodeGenObjC/optimized-setter-ios-device.m b/clang/test/CodeGenObjC/optimized-setter-ios-device.m index 6fa322a..ae8f34c 100644 --- a/clang/test/CodeGenObjC/optimized-setter-ios-device.m +++ b/clang/test/CodeGenObjC/optimized-setter-ios-device.m @@ -26,8 +26,8 @@ @synthesize atomicPropertyCopy; @end -// CHECK: call arm_aapcscc void @objc_setProperty_nonatomic -// CHECK: call arm_aapcscc void @objc_setProperty_nonatomic_copy -// CHECK: call arm_aapcscc void @objc_setProperty_atomic -// CHECK: call arm_aapcscc void @objc_setProperty_atomic_copy +// CHECK: call void @objc_setProperty_nonatomic +// CHECK: call void @objc_setProperty_nonatomic_copy +// CHECK: call void @objc_setProperty_atomic +// CHECK: call void @objc_setProperty_atomic_copy diff --git a/clang/test/CodeGenObjCXX/arc-cxx11-init-list.mm b/clang/test/CodeGenObjCXX/arc-cxx11-init-list.mm index ee5e0be..da214dc 100644 --- a/clang/test/CodeGenObjCXX/arc-cxx11-init-list.mm +++ b/clang/test/CodeGenObjCXX/arc-cxx11-init-list.mm @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -triple armv7-ios5.0 -std=c++11 -fobjc-arc -Os -emit-llvm -o - %s \ -// RUN: | FileCheck %s +// RUN: %clang_cc1 -triple armv7-ios5.0 -std=c++11 -fobjc-arc -Os -emit-llvm -o - %s | FileCheck %s typedef __SIZE_TYPE__ size_t; @@ -21,17 +20,17 @@ void function(std::initializer_list); extern "C" void single() { function({ [I new] }); } -// CHECK: [[INSTANCE:%.*]] = {{.*}} call {{.*}} i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}}) +// CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}}) // CHECK-NEXT: [[CAST:%.*]] = bitcast [{{[0-9]+}} x %0*]* %{{.*}} to i8** // CHECK-NEXT: store i8* [[INSTANCE]], i8** [[CAST]], -// CHECK: call {{.*}} void @objc_release(i8* {{.*}}) +// CHECK: call void @objc_release(i8* {{.*}}) extern "C" void multiple() { function({ [I new], [I new] }); } -// CHECK: [[INSTANCE:%.*]] = {{.*}} call {{.*}} i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}}) +// CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}}) // CHECK-NEXT: [[CAST:%.*]] = bitcast [{{[0-9]+}} x %0*]* %{{.*}} to i8** // CHECK-NEXT: store i8* [[INSTANCE]], i8** [[CAST]], -// CHECK: call {{.*}} void @objc_release(i8* {{.*}}) +// CHECK: call void @objc_release(i8* {{.*}}) // CHECK-NEXT: icmp eq void external(); @@ -41,16 +40,16 @@ extern "C" void extended() { external(); } -// CHECK: [[INSTANCE:%.*]] = {{.*}} call {{.*}} i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}}) +// CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}}) // CHECK-NEXT: [[CAST:%.*]] = bitcast [1 x %0*]* %{{.*}} to i8** // CHECK-NEXT: store i8* [[INSTANCE]], i8** [[CAST]], -// CHECK: {{.*}} call {{.*}} void @_Z8externalv() -// CHECK: {{.*}} call {{.*}} void @objc_release(i8* {{.*}}) +// CHECK: {{.*}} call void @_Z8externalv() +// CHECK: {{.*}} call void @objc_release(i8* {{.*}}) std::initializer_list il = { [I new] }; -// CHECK: [[POOL:%.*]] = {{.*}} call {{.*}} i8* @objc_autoreleasePoolPush() -// CHECK: [[INSTANCE:%.*]] = {{.*}} call {{.*}} i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}}) +// CHECK: [[POOL:%.*]] = {{.*}} call i8* @objc_autoreleasePoolPush() +// CHECK: [[INSTANCE:%.*]] = {{.*}} call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* {{.*}}, i8* {{.*}}) // CHECK-NEXT: store i8* [[INSTANCE]], i8** bitcast ([1 x %0*]* @_ZGR2il_ to i8**) -// CHECK: {{.*}} call {{.*}} void @objc_autoreleasePoolPop(i8* [[POOL]]) +// CHECK: {{.*}} call void @objc_autoreleasePoolPop(i8* [[POOL]])