From 6e5eb04f8d90eab3bfc32323cc277d42fb070e38 Mon Sep 17 00:00:00 2001 From: Oleg Ranevskyy Date: Fri, 13 May 2016 14:45:57 +0000 Subject: [PATCH] [CodeGen] Clang does not choose aapcs-vfp calling convention for ARM bare metal target with hard float (EABIHF) Summary: Clang does not detect `aapcs-vfp` for the EABIHF environment. The reason is that only GNUEABIHF is considered while choosing calling convention, EABIHF is ignored. This causes clang to use `aapcs` for EABIHF and add the `arm_aapcscc` specifier to functions in generated IR. The modified `arm-cc.c` test checks that no calling convention specifier is added to functions for EABIHF, which means the default one is used (`CallingConv::ARM_AAPCS_VFP`). Reviewers: rengolin, compnerd, t.p.northover Subscribers: aemerson, rengolin, asl, cfe-commits Differential Revision: http://reviews.llvm.org/D20219 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269419 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetInfo.cpp | 3 ++- test/CodeGen/arm-cc.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 4ee8573049..6016d28095 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -7878,7 +7878,8 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() { Kind = ARMABIInfo::AAPCS16_VFP; else if (CodeGenOpts.FloatABI == "hard" || (CodeGenOpts.FloatABI != "soft" && - Triple.getEnvironment() == llvm::Triple::GNUEABIHF)) + (Triple.getEnvironment() == llvm::Triple::GNUEABIHF || + Triple.getEnvironment() == llvm::Triple::EABIHF))) Kind = ARMABIInfo::AAPCS_VFP; return SetCGInfo(new ARMTargetCodeGenInfo(Types, Kind)); diff --git a/test/CodeGen/arm-cc.c b/test/CodeGen/arm-cc.c index 8e6aae78b6..0bae333ecf 100644 --- a/test/CodeGen/arm-cc.c +++ b/test/CodeGen/arm-cc.c @@ -3,6 +3,7 @@ // RUN: %clang_cc1 -triple armv7-apple-darwin9 -target-abi aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=DARWIN-AAPCS %s // RUN: %clang_cc1 -triple arm-none-linux-gnueabi -target-abi apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=LINUX-APCS %s // RUN: %clang_cc1 -triple arm-none-linux-gnueabi -target-abi aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=LINUX-AAPCS %s +// RUN: %clang_cc1 -triple armv7-none-eabihf -target-abi aapcs-vfp -emit-llvm -w -o - %s | FileCheck -check-prefix=BAREMETAL-AAPCS_VFP %s // DARWIN-APCS-LABEL: define void @f() @@ -13,6 +14,9 @@ // LINUX-APCS: call arm_apcscc void @g // LINUX-AAPCS-LABEL: define void @f() // LINUX-AAPCS: call void @g +// BAREMETAL-AAPCS_VFP-LABEL: define void @f() +// BAREMETAL-AAPCS_VFP: call void @g +// BAREMETAL-AAPCS_VFP: declare void @g() void g(void); void f(void) { g(); -- 2.40.0