From: Tim Northover Date: Wed, 27 Jan 2016 19:32:40 +0000 (+0000) Subject: ARMv7k: select ABI based on v7k Arch rather than watchos OS. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d011f8c7ef2f525b0264df4d7785418058c157db;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@258976 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index 4bb77a01ec..d75aa3e009 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -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 getGCCRegNames() const override; ArrayRef 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); diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 2e73ee162f..d781626011 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -4939,7 +4939,7 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const { /// 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; diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index f57d0871c2..4f72a96ace 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1075,7 +1075,9 @@ bool Darwin::UseSjLjExceptions(const ArgList &Args) const { 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; } diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index faec8a1c3f..2819ab3988 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -698,6 +698,7 @@ arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) { 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::Triple &Triple, const ArgList &Args, } else if (Triple.isOSBinFormatMachO()) { if (useAAPCSForMachO(Triple)) { ABIName = "aapcs"; - } else if (Triple.isWatchOS()) { + } else if (Triple.isWatchABI()) { ABIName = "aapcs16"; } else { ABIName = "apcs-gnu"; diff --git a/test/Driver/arch-armv7k.c b/test/Driver/arch-armv7k.c index f5c33cfd9f..24a1851bc5 100644 --- a/test/Driver/arch-armv7k.c +++ b/test/Driver/arch-armv7k.c @@ -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