[cfe-commits] r81735 - in /cfe/trunk: include/clang/Basic/TargetInfo.h lib/Basic/Targets.cpp lib/CodeGen/TargetABIInfo.cpp test/CodeGen/arm-apcs-arguments.c
Daniel Dunbar
daniel at zuster.org
Sun Sep 13 17:35:04 PDT 2009
Author: ddunbar
Date: Sun Sep 13 19:35:03 2009
New Revision: 81735
URL: http://llvm.org/viewvc/llvm-project?rev=81735&view=rev
Log:
Add TargetInfo::getABI(), and base ARM APCS vs AAPCS choice on that.
Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
cfe/trunk/test/CodeGen/arm-apcs-arguments.c
Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=81735&r1=81734&r2=81735&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Sun Sep 13 19:35:03 2009
@@ -352,6 +352,11 @@
llvm::StringMap<bool> &Features) const {
}
+ /// getABI - Get the ABI in use.
+ virtual const char *getABI() const {
+ return "";
+ }
+
/// setABI - Use the specific ABI.
///
/// \return - False on error (invalid ABI name).
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=81735&r1=81734&r2=81735&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sun Sep 13 19:35:03 2009
@@ -991,8 +991,13 @@
Armv7a,
XScale
} ArmArch;
+
+ std::string ABI;
+
public:
- ARMTargetInfo(const std::string& triple) : TargetInfo(triple) {
+ ARMTargetInfo(const std::string& triple)
+ : TargetInfo(triple), ABI("aapcs-linux")
+ {
// FIXME: Are the defaults correct for ARM?
DescriptionString = ("e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-"
"i64:32:32-f32:32:32-f64:32:32-"
@@ -1016,7 +1021,10 @@
ArmArch = Armv6;
}
}
+ virtual const char *getABI() const { return ABI.c_str(); }
virtual bool setABI(const std::string &Name) {
+ ABI = Name;
+
// The defaults (above) are for AAPCS, check if we need to change them.
//
// FIXME: We need support for -meabi... we could just mangle it into the
Modified: cfe/trunk/lib/CodeGen/TargetABIInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetABIInfo.cpp?rev=81735&r1=81734&r2=81735&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetABIInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetABIInfo.cpp Sun Sep 13 19:35:03 2009
@@ -1682,11 +1682,8 @@
case llvm::Triple::arm:
case llvm::Triple::thumb:
- // FIXME: We should get this from the target, we also need a -target-abi
- // because the user should have some control over this.
- //
// FIXME: We want to know the float calling convention as well.
- if (Triple.getOS() == llvm::Triple::Darwin)
+ if (strcmp(getContext().Target.getABI(), "apcs-gnu") == 0)
return *(TheABIInfo = new ARMABIInfo(ARMABIInfo::APCS));
return *(TheABIInfo = new ARMABIInfo(ARMABIInfo::AAPCS));
Modified: cfe/trunk/test/CodeGen/arm-apcs-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-apcs-arguments.c?rev=81735&r1=81734&r2=81735&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/arm-apcs-arguments.c (original)
+++ cfe/trunk/test/CodeGen/arm-apcs-arguments.c Sun Sep 13 19:35:03 2009
@@ -1,5 +1,5 @@
// RUX: iphone-llvm-gcc -arch armv7 -flto -S -o - %s | FileCheck %s
-// RUN: clang-cc -triple armv7-apple-darwin9 -emit-llvm -w -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) {
More information about the cfe-commits
mailing list