diff options
author | Erich Keane <erich.keane@intel.com> | 2018-02-08 23:16:55 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-02-08 23:16:55 +0000 |
commit | e44bdb3f70918c67c99326e12f929e0466a20f9d (patch) | |
tree | 86ea268a8deeaed4bd51a4d6d912dd96c76eacd5 /clang/lib/Basic/Targets/SystemZ.cpp | |
parent | d45879d8add0c2d831f89bc638f75e23b75e9a72 (diff) | |
download | bcm5719-llvm-e44bdb3f70918c67c99326e12f929e0466a20f9d.tar.gz bcm5719-llvm-e44bdb3f70918c67c99326e12f929e0466a20f9d.zip |
Add Rest of Targets Support to ValidCPUList (enabling march notes)
A followup to: https://reviews.llvm.org/D42978
Most of the rest of the Targets were pretty rote, so this
patch knocks them all out at once.
Differential Revision: https://reviews.llvm.org/D43057
llvm-svn: 324676
Diffstat (limited to 'clang/lib/Basic/Targets/SystemZ.cpp')
-rw-r--r-- | clang/lib/Basic/Targets/SystemZ.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/clang/lib/Basic/Targets/SystemZ.cpp b/clang/lib/Basic/Targets/SystemZ.cpp index 61f3dc64b63..6f06f1fc760 100644 --- a/clang/lib/Basic/Targets/SystemZ.cpp +++ b/clang/lib/Basic/Targets/SystemZ.cpp @@ -83,14 +83,32 @@ bool SystemZTargetInfo::validateAsmConstraint( } } +struct ISANameRevision { + llvm::StringLiteral Name; + int ISARevisionID; +}; +static constexpr ISANameRevision ISARevisions[] = { + {{"arch8"}, 8}, {{"z10"}, 8}, + {{"arch9"}, 9}, {{"z196"}, 9}, + {{"arch10"}, 10}, {{"zEC12"}, 10}, + {{"arch11"}, 11}, {{"z13"}, 11}, + {{"arch12"}, 12}, {{"z14"}, 12} +}; + int SystemZTargetInfo::getISARevision(StringRef Name) const { - return llvm::StringSwitch<int>(Name) - .Cases("arch8", "z10", 8) - .Cases("arch9", "z196", 9) - .Cases("arch10", "zEC12", 10) - .Cases("arch11", "z13", 11) - .Cases("arch12", "z14", 12) - .Default(-1); + const auto Rev = + llvm::find_if(ISARevisions, [Name](const ISANameRevision &CR) { + return CR.Name == Name; + }); + if (Rev == std::end(ISARevisions)) + return -1; + return Rev->ISARevisionID; +} + +void SystemZTargetInfo::fillValidCPUList( + SmallVectorImpl<StringRef> &Values) const { + for (const ISANameRevision &Rev : ISARevisions) + Values.push_back(Rev.Name); } bool SystemZTargetInfo::hasFeature(StringRef Feature) const { |