summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorGabor Ballabas <gaborb@inf.u-szeged.hu>2015-06-11 12:29:56 +0000
committerGabor Ballabas <gaborb@inf.u-szeged.hu>2015-06-11 12:29:56 +0000
commitcebcb3b52f7982f0a2c2db930967810bcd0a6b2d (patch)
tree40dd3a3b276583c3692f437f3a0963824c78025c /clang/lib
parent647e61244b3f1b41a38ccb60e7fb3ec68dd8460c (diff)
downloadbcm5719-llvm-cebcb3b52f7982f0a2c2db930967810bcd0a6b2d.tar.gz
bcm5719-llvm-cebcb3b52f7982f0a2c2db930967810bcd0a6b2d.zip
Allow case-insensitive values for -march for ARM in line with GCC.
GCC allows case-insensitive values for -mcpu, -march and -mtune options. This patch implements the same behaviour for the -march option for ARM. llvm-svn: 239527
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Tools.cpp13
-rw-r--r--clang/lib/Driver/Tools.h4
2 files changed, 9 insertions, 8 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index e7bb49cb950..43d6ce9bbbb 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -679,7 +679,7 @@ static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
// getARMArch is used here instead of just checking the -march value in order
// to handle -march=native correctly.
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
- StringRef Arch = arm::getARMArch(Args, Triple);
+ std::string Arch = arm::getARMArch(Args, Triple);
if (llvm::ARMTargetParser::parseArch(Arch) == llvm::ARM::AK_INVALID)
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
}
@@ -689,7 +689,7 @@ static void getARMTargetFeatures(const Driver &D, const llvm::Triple &Triple,
// getLLVMArchSuffixForARM which also needs an architecture.
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
std::string CPU = arm::getARMTargetCPU(Args, Triple);
- StringRef Arch = arm::getARMArch(Args, Triple);
+ std::string Arch = arm::getARMArch(Args, Triple);
if (strcmp(arm::getLLVMArchSuffixForARM(CPU, Arch), "") == 0)
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
}
@@ -5631,9 +5631,9 @@ void hexagon::Link::ConstructJob(Compilation &C, const JobAction &JA,
}
// Hexagon tools end.
-const StringRef arm::getARMArch(const ArgList &Args,
- const llvm::Triple &Triple) {
- StringRef MArch;
+const std::string arm::getARMArch(const ArgList &Args,
+ const llvm::Triple &Triple) {
+ std::string MArch;
if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
// Otherwise, if we have -march= choose the base CPU for that arch.
MArch = A->getValue();
@@ -5641,6 +5641,7 @@ const StringRef arm::getARMArch(const ArgList &Args,
// Otherwise, use the Arch from the triple.
MArch = Triple.getArchName();
}
+ MArch = StringRef(MArch).lower();
// Handle -march=native.
if (MArch == "native") {
@@ -5662,7 +5663,7 @@ const StringRef arm::getARMArch(const ArgList &Args,
/// 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);
+ std::string MArch = getARMArch(Args, Triple);
// getARMCPUForArch defaults to the triple if MArch is empty, but empty MArch
// here means an -march=native that we can't handle, so instead return no CPU.
if (MArch.empty())
diff --git a/clang/lib/Driver/Tools.h b/clang/lib/Driver/Tools.h
index 133a389e510..0420eea1237 100644
--- a/clang/lib/Driver/Tools.h
+++ b/clang/lib/Driver/Tools.h
@@ -227,8 +227,8 @@ namespace hexagon {
namespace arm {
std::string getARMTargetCPU(const llvm::opt::ArgList &Args,
const llvm::Triple &Triple);
- const StringRef getARMArch(const llvm::opt::ArgList &Args,
- const llvm::Triple &Triple);
+ const std::string 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, StringRef Arch);
OpenPOWER on IntegriCloud