mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
Simplify ARMTargetParser::getArchSynonym
Summary: 1) The only caller, ARMTargetParser::parseArch, uses the results for an "endswith" test; so, including the "arm" prefix into the result is unnecessary. 2) Most ARMTargetParser::parseArch callers pass it the output from ARMTargetParser::getCanonicalArchName; so, make this behaviour the default. Then, including the "arm" prefix into the cases is unnecessary. Reviewers: rengolin Reviewed By: rengolin Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10249 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239099 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
083f0122f0
commit
6782fc61ca
@ -293,16 +293,14 @@ StringRef ARMTargetParser::getFPUSynonym(StringRef FPU) {
|
||||
|
||||
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 @@ unsigned ARMTargetParser::parseFPU(StringRef FPU) {
|
||||
|
||||
// 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))
|
||||
|
@ -1147,12 +1147,12 @@ Triple Triple::get64BitArchVariant() const {
|
||||
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 @@ const char *Triple::getARMCPUForArch(StringRef MArch) const {
|
||||
break;
|
||||
}
|
||||
|
||||
MArch = ARMTargetParser::getCanonicalArchName(MArch);
|
||||
if (MArch.empty())
|
||||
return nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user