summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorVladimir Sukharev <vladimir.sukharev@arm.com>2015-05-14 08:25:18 +0000
committerVladimir Sukharev <vladimir.sukharev@arm.com>2015-05-14 08:25:18 +0000
commitc6dab75bd4459e53468b5e676dc962c3d88126a0 (patch)
tree4080f18546d88e94c9b095d32b2f7e6012f8b827 /clang/lib/Driver/Tools.cpp
parent78b8653a84786cd73511d770f3afbc13538af1fe (diff)
downloadbcm5719-llvm-c6dab75bd4459e53468b5e676dc962c3d88126a0.tar.gz
bcm5719-llvm-c6dab75bd4459e53468b5e676dc962c3d88126a0.zip
[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
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp42
1 files changed, 32 insertions, 10 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index ac35a09e1e2..ee9b495edbf 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -649,7 +649,8 @@ StringRef tools::arm::getARMFloatABI(const Driver &D, const ArgList &Args,
//
// 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 @@ StringRef tools::arm::getARMFloatABI(const Driver &D, const ArgList &Args,
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 @@ static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
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 @@ void hexagon::Link::ConstructJob(Compilation &C, const JobAction &JA,
}
// 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 @@ const char *arm::getARMCPUForMArch(const ArgList &Args,
// 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 @@ const char *arm::getARMCPUForMArch(const ArgList &Args,
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 @@ StringRef arm::getARMTargetCPU(const ArgList &Args,
}
/// 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 @@ const char *arm::getLLVMArchSuffixForARM(StringRef CPU) {
.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)
OpenPOWER on IntegriCloud