[ARM] Add v8.1a architecture
Add support for ARMv8.1a architecture.
Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development
Reviewers: jmolloy, rengolin
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D8799
llvm-svn: 237349
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index ac35a09..ee9b495 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -649,7 +649,8 @@
//
// FIXME: Factor out an ARM class so we can cache the arch somewhere.
std::string ArchName =
- arm::getLLVMArchSuffixForARM(arm::getARMTargetCPU(Args, Triple));
+ arm::getLLVMArchSuffixForARM(arm::getARMTargetCPU(Args, Triple),
+ arm::getARMArch(Args, Triple));
if (StringRef(ArchName).startswith("v6") ||
StringRef(ArchName).startswith("v7"))
FloatABI = "softfp";
@@ -692,7 +693,8 @@
break;
case llvm::Triple::Android: {
std::string ArchName =
- arm::getLLVMArchSuffixForARM(arm::getARMTargetCPU(Args, Triple));
+ arm::getLLVMArchSuffixForARM(arm::getARMTargetCPU(Args, Triple),
+ arm::getARMArch(Args, Triple));
if (StringRef(ArchName).startswith("v7"))
FloatABI = "softfp";
else
@@ -768,6 +770,10 @@
else
Features.push_back("-crc");
}
+
+ if (Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v8_1a) {
+ Features.insert(Features.begin(), "+v8.1a");
+ }
}
void Clang::AddARMTargetArgs(const ArgList &Args,
@@ -5624,9 +5630,8 @@
}
// Hexagon tools end.
-/// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
-const char *arm::getARMCPUForMArch(const ArgList &Args,
- const llvm::Triple &Triple) {
+const StringRef arm::getARMArch(const ArgList &Args,
+ const llvm::Triple &Triple) {
StringRef MArch;
if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
// Otherwise, if we have -march= choose the base CPU for that arch.
@@ -5635,6 +5640,12 @@
// Otherwise, use the Arch from the triple.
MArch = Triple.getArchName();
}
+ return MArch;
+}
+/// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
+const char *arm::getARMCPUForMArch(const ArgList &Args,
+ const llvm::Triple &Triple) {
+ StringRef MArch = getARMArch(Args, Triple);
// Handle -march=native.
if (MArch == "native") {
@@ -5642,7 +5653,8 @@
if (CPU != "generic") {
// Translate the native cpu into the architecture. The switch below will
// then chose the minimum cpu for that arch.
- MArch = std::string("arm") + arm::getLLVMArchSuffixForARM(CPU);
+ MArch = std::string("arm") +
+ arm::getLLVMArchSuffixForARM(CPU, arm::getARMArch(Args, Triple));
}
}
@@ -5673,12 +5685,20 @@
}
/// getLLVMArchSuffixForARM - Get the LLVM arch name to use for a particular
-/// CPU.
+/// CPU (or Arch, if CPU is generic).
//
// FIXME: This is redundant with -mcpu, why does LLVM use this.
// FIXME: tblgen this, or kill it!
// FIXME: Use ARMTargetParser.
-const char *arm::getLLVMArchSuffixForARM(StringRef CPU) {
+const char *arm::getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch) {
+ // FIXME: Use ARMTargetParser
+ if (CPU == "generic") {
+ if (Arch == "armv8.1a" || Arch == "armv8.1-a" ||
+ Arch == "armebv8.1a" || Arch == "armebv8.1-a") {
+ return "v8.1a";
+ }
+ }
+
return llvm::StringSwitch<const char *>(CPU)
.Case("strongarm", "v4")
.Cases("arm7tdmi", "arm7tdmi-s", "arm710t", "v4t")
@@ -5705,11 +5725,13 @@
.Default("");
}
-void arm::appendEBLinkFlags(const ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple) {
+void arm::appendEBLinkFlags(const ArgList &Args, ArgStringList &CmdArgs,
+ const llvm::Triple &Triple) {
if (Args.hasArg(options::OPT_r))
return;
- StringRef Suffix = getLLVMArchSuffixForARM(getARMCPUForMArch(Args, Triple));
+ StringRef Suffix = getLLVMArchSuffixForARM(getARMCPUForMArch(Args, Triple),
+ getARMArch(Args, Triple));
const char *LinkFlag = llvm::StringSwitch<const char *>(Suffix)
.Cases("v4", "v4t", "v5", "v5e", nullptr)
.Cases("v6", "v6k", "v6t2", nullptr)