[llvm] 260fe03 - [llvm][AArch64][TargetParser][NFC] Use parseArchExtension in parseModifier. (#80427)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 3 04:29:54 PST 2024
Author: Alexandros Lamprineas
Date: 2024-02-03T12:29:50Z
New Revision: 260fe032c2506cd53c6a813a71c2f096ba161e7f
URL: https://github.com/llvm/llvm-project/commit/260fe032c2506cd53c6a813a71c2f096ba161e7f
DIFF: https://github.com/llvm/llvm-project/commit/260fe032c2506cd53c6a813a71c2f096ba161e7f.diff
LOG: [llvm][AArch64][TargetParser][NFC] Use parseArchExtension in parseModifier. (#80427)
This allows making changes in parseArchExtension to make their way in
the command line as well, not only in target attributes.
Added:
Modified:
llvm/lib/TargetParser/AArch64TargetParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/TargetParser/AArch64TargetParser.cpp b/llvm/lib/TargetParser/AArch64TargetParser.cpp
index fd47f786a46ef..6f7b421f4e080 100644
--- a/llvm/lib/TargetParser/AArch64TargetParser.cpp
+++ b/llvm/lib/TargetParser/AArch64TargetParser.cpp
@@ -260,24 +260,17 @@ void AArch64::ExtensionSet::addArchDefaults(const ArchInfo &Arch) {
bool AArch64::ExtensionSet::parseModifier(StringRef Modifier) {
LLVM_DEBUG(llvm::dbgs() << "parseModifier(" << Modifier << ")\n");
- // Negative modifiers, with the syntax "no<feat>"
- if (Modifier.starts_with("no")) {
- StringRef ModifierBase(Modifier.substr(2));
- for (const auto &AE : Extensions) {
- if (!AE.NegFeature.empty() && ModifierBase == AE.Name) {
- disable(AE.ID);
- return true;
- }
- }
- }
-
- // Positive modifiers
- for (const auto &AE : Extensions) {
- if (!AE.Feature.empty() && Modifier == AE.Name) {
- enable(AE.ID);
- return true;
- }
+ bool IsNegated = Modifier.starts_with("no");
+ StringRef ArchExt = IsNegated ? Modifier.drop_front(2) : Modifier;
+
+ if (auto AE = parseArchExtension(ArchExt)) {
+ if (AE->Feature.empty() || AE->NegFeature.empty())
+ return false;
+ if (IsNegated)
+ disable(AE->ID);
+ else
+ enable(AE->ID);
+ return true;
}
-
return false;
}
More information about the llvm-commits
mailing list