r258976 - ARMv7k: select ABI based on v7k Arch rather than watchos OS.
Tim Northover via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 27 11:32:40 PST 2016
Author: tnorthover
Date: Wed Jan 27 13:32:40 2016
New Revision: 258976
URL: http://llvm.org/viewvc/llvm-project?rev=258976&view=rev
Log:
ARMv7k: select ABI based on v7k Arch rather than watchos OS.
Various bits we'd like to use the new ABI actually compile with "-arch armv7k
-miphoneos-version-min=9.0". Not ideal, but also not ridiculous given how
slices work.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/arch-armv7k.c
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=258976&r1=258975&r2=258976&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Jan 27 13:32:40 2016
@@ -4500,7 +4500,7 @@ public:
Triple.getOS() == llvm::Triple::UnknownOS ||
StringRef(CPU).startswith("cortex-m")) {
setABI("aapcs");
- } else if (Triple.isWatchOS()) {
+ } else if (Triple.isWatchABI()) {
setABI("aapcs16");
} else {
setABI("apcs-gnu");
@@ -4716,7 +4716,7 @@ public:
// Unfortunately, __ARM_ARCH_7K__ is now more of an ABI descriptor. The CPU
// happens to be Cortex-A7 though, so it should still get __ARM_ARCH_7A__.
- if (getTriple().isWatchOS())
+ if (getTriple().isWatchABI())
Builder.defineMacro("__ARM_ARCH_7K__", "2");
if (!CPUAttr.empty())
@@ -4905,8 +4905,8 @@ public:
BuiltinVaListKind getBuiltinVaListKind() const override {
return IsAAPCS
? AAPCSABIBuiltinVaList
- : (getTriple().isWatchOS() ? TargetInfo::CharPtrBuiltinVaList
- : TargetInfo::VoidPtrBuiltinVaList);
+ : (getTriple().isWatchABI() ? TargetInfo::CharPtrBuiltinVaList
+ : TargetInfo::VoidPtrBuiltinVaList);
}
ArrayRef<const char *> getGCCRegNames() const override;
ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override;
@@ -5247,7 +5247,7 @@ public:
// ARMleTargetInfo.
MaxAtomicInlineWidth = 64;
- if (Triple.isWatchOS()) {
+ if (Triple.isWatchABI()) {
// Darwin on iOS uses a variant of the ARM C++ ABI.
TheCXXABI.set(TargetCXXABI::WatchOS);
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=258976&r1=258975&r2=258976&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Jan 27 13:32:40 2016
@@ -4939,7 +4939,7 @@ void ARMABIInfo::computeInfo(CGFunctionI
/// Return the default calling convention that LLVM will use.
llvm::CallingConv::ID ARMABIInfo::getLLVMDefaultCC() const {
// The default calling convention that LLVM will infer.
- if (isEABIHF() || getTarget().getTriple().isWatchOS())
+ if (isEABIHF() || getTarget().getTriple().isWatchABI())
return llvm::CallingConv::ARM_AAPCS_VFP;
else if (isEABI())
return llvm::CallingConv::ARM_AAPCS;
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=258976&r1=258975&r2=258976&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jan 27 13:32:40 2016
@@ -1075,7 +1075,9 @@ bool Darwin::UseSjLjExceptions(const Arg
return false;
// Only watchOS uses the new DWARF/Compact unwinding method.
- return !isTargetWatchOS();
+ llvm::Triple Triple(ComputeLLVMTriple(Args));
+ return !(Triple.getArchName() == "armv7k" ||
+ Triple.getArchName() == "thumbv7k") && !isTargetWatchOS();
}
bool MachO::isPICDefault() const { return true; }
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=258976&r1=258975&r2=258976&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jan 27 13:32:40 2016
@@ -698,6 +698,7 @@ arm::FloatABI arm::getARMFloatABI(const
case llvm::Triple::TvOS: {
// Darwin defaults to "softfp" for v6 and v7.
ABI = (SubArch == 6 || SubArch == 7) ? FloatABI::SoftFP : FloatABI::Soft;
+ ABI = Triple.isWatchABI() ? FloatABI::Hard : ABI;
break;
}
case llvm::Triple::WatchOS:
@@ -954,7 +955,7 @@ void Clang::AddARMTargetArgs(const llvm:
} else if (Triple.isOSBinFormatMachO()) {
if (useAAPCSForMachO(Triple)) {
ABIName = "aapcs";
- } else if (Triple.isWatchOS()) {
+ } else if (Triple.isWatchABI()) {
ABIName = "aapcs16";
} else {
ABIName = "apcs-gnu";
Modified: cfe/trunk/test/Driver/arch-armv7k.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arch-armv7k.c?rev=258976&r1=258975&r2=258976&view=diff
==============================================================================
--- cfe/trunk/test/Driver/arch-armv7k.c (original)
+++ cfe/trunk/test/Driver/arch-armv7k.c Wed Jan 27 13:32:40 2016
@@ -5,9 +5,7 @@
// CHECK-NOT: "-fsjlj-exceptions"
// "thumbv7k-apple-ios" is a bit of a weird triple, but since the backend is
-// going to choose to use sjlj-based exceptions for it, the front-end needs to
+// going to choose to use dwarf-based exceptions for it, the front-end needs to
// match.
-// RUN: %clang -target x86_64-apple-macosx10.9 -arch armv7k -miphoneos-version-min=9.0 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SJLJ
-// CHECK-SJLJ: "-cc1"{{.*}} "-target-cpu" "cortex-a7"
-// CHECK-SJLJ: "-fsjlj-exceptions"
+// RUN: %clang -target x86_64-apple-macosx10.9 -arch armv7k -miphoneos-version-min=9.0 -c %s -### 2>&1 | FileCheck %s
More information about the cfe-commits
mailing list