[PATCH] D142541: [NFC][AArch64] Get extension strings directly from ArchInfo in target parser
Lucas Prates via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 25 06:53:41 PST 2023
pratlucas created this revision.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
pratlucas requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142541
Files:
clang/lib/Basic/Targets/AArch64.cpp
llvm/include/llvm/TargetParser/AArch64TargetParser.h
llvm/lib/TargetParser/AArch64TargetParser.cpp
Index: llvm/lib/TargetParser/AArch64TargetParser.cpp
===================================================================
--- llvm/lib/TargetParser/AArch64TargetParser.cpp
+++ llvm/lib/TargetParser/AArch64TargetParser.cpp
@@ -25,16 +25,6 @@
return 0;
}
-void AArch64::getFeatureOption(StringRef Name, std::string &Feature) {
- for (const auto &E : llvm::AArch64::Extensions) {
- if (Name == E.Name) {
- Feature = E.Feature;
- return;
- }
- }
- Feature = Name.str();
-}
-
std::optional<AArch64::ArchInfo> AArch64::getArchForCpu(StringRef CPU) {
if (CPU == "generic")
return ARMV8A;
Index: llvm/include/llvm/TargetParser/AArch64TargetParser.h
===================================================================
--- llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -505,7 +505,6 @@
StringRef resolveCPUAlias(StringRef CPU);
// Information by Name
-void getFeatureOption(StringRef Name, std::string &Feature);
std::optional<ArchInfo> getArchForCpu(StringRef CPU);
// Parser
Index: clang/lib/Basic/Targets/AArch64.cpp
===================================================================
--- clang/lib/Basic/Targets/AArch64.cpp
+++ clang/lib/Basic/Targets/AArch64.cpp
@@ -973,12 +973,16 @@
}
}
for (const auto &Feature : FeaturesVec)
- if (Feature[0] == '+') {
- std::string F;
- llvm::AArch64::getFeatureOption(Feature, F);
- UpdatedFeaturesVec.push_back(F);
- } else if (Feature[0] != '?')
- UpdatedFeaturesVec.push_back(Feature);
+ if (Feature[0] != '?') {
+ std::string UpdatedFeature = Feature;
+ if (Feature[0] == '+') {
+ std::optional<llvm::AArch64::ExtensionInfo> Extension =
+ llvm::AArch64::parseArchExtension(Feature.substr(1));
+ if (Extension)
+ UpdatedFeature = Extension->Feature.str();
+ }
+ UpdatedFeaturesVec.push_back(UpdatedFeature);
+ }
return TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142541.492097.patch
Type: text/x-patch
Size: 2041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230125/bb1f9505/attachment.bin>
More information about the cfe-commits
mailing list