diff options
| author | Vladimir Sukharev <vladimir.sukharev@arm.com> | 2015-05-14 08:25:18 +0000 |
|---|---|---|
| committer | Vladimir Sukharev <vladimir.sukharev@arm.com> | 2015-05-14 08:25:18 +0000 |
| commit | c6dab75bd4459e53468b5e676dc962c3d88126a0 (patch) | |
| tree | 4080f18546d88e94c9b095d32b2f7e6012f8b827 /clang/lib/Driver | |
| parent | 78b8653a84786cd73511d770f3afbc13538af1fe (diff) | |
| download | bcm5719-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')
| -rw-r--r-- | clang/lib/Driver/ToolChain.cpp | 9 | ||||
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 42 | ||||
| -rw-r--r-- | clang/lib/Driver/Tools.h | 4 |
3 files changed, 41 insertions, 14 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index 52e8603851b..f7b7402215a 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -303,9 +303,12 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, // Thumb2 is the default for V7 on Darwin. // // FIXME: Thumb should just be another -target-feaure, not in the triple. - StringRef Suffix = Triple.isOSBinFormatMachO() - ? tools::arm::getLLVMArchSuffixForARM(tools::arm::getARMCPUForMArch(Args, Triple)) - : tools::arm::getLLVMArchSuffixForARM(tools::arm::getARMTargetCPU(Args, Triple)); + StringRef CPU = Triple.isOSBinFormatMachO() + ? tools::arm::getARMCPUForMArch(Args, Triple) + : tools::arm::getARMTargetCPU(Args, Triple); + StringRef Suffix = + tools::arm::getLLVMArchSuffixForARM(CPU, + tools::arm::getARMArch(Args, Triple)); bool ThumbDefault = Suffix.startswith("v6m") || Suffix.startswith("v7m") || Suffix.startswith("v7em") || (Suffix.startswith("v7") && getTriple().isOSBinFormatMachO()); 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) diff --git a/clang/lib/Driver/Tools.h b/clang/lib/Driver/Tools.h index 51dce9d2799..25fe063f7f1 100644 --- a/clang/lib/Driver/Tools.h +++ b/clang/lib/Driver/Tools.h @@ -226,9 +226,11 @@ namespace hexagon { namespace arm { StringRef getARMTargetCPU(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); + const StringRef getARMArch(const llvm::opt::ArgList &Args, + const llvm::Triple &Triple); const char* getARMCPUForMArch(const llvm::opt::ArgList &Args, const llvm::Triple &Triple); - const char* getLLVMArchSuffixForARM(StringRef CPU); + const char* getLLVMArchSuffixForARM(StringRef CPU, StringRef Arch); void appendEBLinkFlags(const llvm::opt::ArgList &Args, ArgStringList &CmdArgs, const llvm::Triple &Triple); } |

