Skip to content

Commit 852bb68

Browse files
committed
[NFC][AArch64] Get extension strings directly from ArchInfo in target parser
Reviewed By: tmatheson Differential Revision: https://reviews.llvm.org/D142541
1 parent a369bb8 commit 852bb68

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

clang/lib/Basic/Targets/AArch64.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -973,12 +973,16 @@ bool AArch64TargetInfo::initFeatureMap(
973973
}
974974
}
975975
for (const auto &Feature : FeaturesVec)
976-
if (Feature[0] == '+') {
977-
std::string F;
978-
llvm::AArch64::getFeatureOption(Feature, F);
979-
UpdatedFeaturesVec.push_back(F);
980-
} else if (Feature[0] != '?')
981-
UpdatedFeaturesVec.push_back(Feature);
976+
if (Feature[0] != '?') {
977+
std::string UpdatedFeature = Feature;
978+
if (Feature[0] == '+') {
979+
std::optional<llvm::AArch64::ExtensionInfo> Extension =
980+
llvm::AArch64::parseArchExtension(Feature.substr(1));
981+
if (Extension)
982+
UpdatedFeature = Extension->Feature.str();
983+
}
984+
UpdatedFeaturesVec.push_back(UpdatedFeature);
985+
}
982986

983987
return TargetInfo::initFeatureMap(Features, Diags, CPU, UpdatedFeaturesVec);
984988
}

llvm/include/llvm/TargetParser/AArch64TargetParser.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ StringRef getArchExtFeature(StringRef ArchExt);
513513
StringRef resolveCPUAlias(StringRef CPU);
514514

515515
// Information by Name
516-
void getFeatureOption(StringRef Name, std::string &Feature);
517516
std::optional<ArchInfo> getArchForCpu(StringRef CPU);
518517

519518
// Parser

llvm/lib/TargetParser/AArch64TargetParser.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ static unsigned checkArchVersion(llvm::StringRef Arch) {
2525
return 0;
2626
}
2727

28-
void AArch64::getFeatureOption(StringRef Name, std::string &Feature) {
29-
for (const auto &E : llvm::AArch64::Extensions) {
30-
if (Name == E.Name) {
31-
Feature = E.Feature;
32-
return;
33-
}
34-
}
35-
Feature = Name.str();
36-
}
37-
3828
std::optional<AArch64::ArchInfo> AArch64::getArchForCpu(StringRef CPU) {
3929
if (CPU == "generic")
4030
return ARMV8A;

0 commit comments

Comments
 (0)