[PATCH] Simplify ARMTargetParser::getArchSynonym
Phabricator
reviews at reviews.llvm.org
Thu Jun 4 14:31:00 PDT 2015
REPOSITORY
rL LLVM
http://reviews.llvm.org/D10249
Files:
llvm/trunk/lib/Support/TargetParser.cpp
llvm/trunk/lib/Support/Triple.cpp
Index: llvm/trunk/lib/Support/TargetParser.cpp
===================================================================
--- llvm/trunk/lib/Support/TargetParser.cpp
+++ llvm/trunk/lib/Support/TargetParser.cpp
@@ -293,16 +293,14 @@
StringRef ARMTargetParser::getArchSynonym(StringRef Arch) {
return StringSwitch<StringRef>(Arch)
- .Cases("armv6sm", "v6sm", "armv6s-m")
- .Cases("armv6m", "v6m", "armv6-m")
- .Cases("armv7a", "v7a", "armv7-a")
- .Cases("armv7r", "v7r", "armv7-r")
- .Cases("armv7m", "v7m", "armv7-m")
- .Cases("armv7em", "v7em", "armv7e-m")
- .Cases("armv8", "v8", "armv8-a")
- .Cases("armv8a", "v8a", "armv8-a")
- .Cases("armv8.1a", "v8.1a", "armv8.1-a")
- .Cases("aarch64", "arm64", "armv8-a")
+ .Case("v6sm", "v6s-m")
+ .Case("v6m", "v6-m")
+ .Case("v7a", "v7-a")
+ .Case("v7r", "v7-r")
+ .Case("v7m", "v7-m")
+ .Case("v7em", "v7e-m")
+ .Cases("v8", "v8a", "aarch64", "arm64", "armv8-a")
+ .Case("v8.1a", "v8.1-a")
.Default(Arch);
}
@@ -370,6 +368,7 @@
// Allows partial match, ex. "v7a" matches "armv7a".
unsigned ARMTargetParser::parseArch(StringRef Arch) {
+ Arch = getCanonicalArchName(Arch);
StringRef Syn = getArchSynonym(Arch);
for (const auto A : ARCHNames) {
if (StringRef(A.Name).endswith(Syn))
Index: llvm/trunk/lib/Support/Triple.cpp
===================================================================
--- llvm/trunk/lib/Support/Triple.cpp
+++ llvm/trunk/lib/Support/Triple.cpp
@@ -1147,12 +1147,12 @@
const char *Triple::getARMCPUForArch(StringRef MArch) const {
if (MArch.empty())
MArch = getArchName();
+ MArch = ARMTargetParser::getCanonicalArchName(MArch);
// Some defaults are forced.
switch (getOS()) {
case llvm::Triple::FreeBSD:
case llvm::Triple::NetBSD:
- MArch = ARMTargetParser::getCanonicalArchName(MArch);
if (!MArch.empty() && MArch == "v6")
return "arm1176jzf-s";
break;
@@ -1163,7 +1163,6 @@
break;
}
- MArch = ARMTargetParser::getCanonicalArchName(MArch);
if (MArch.empty())
return nullptr;
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10249.27149.patch
Type: text/x-patch
Size: 2114 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150604/04d16b17/attachment.bin>
More information about the llvm-commits
mailing list