[llvm] [AArch64][TargetParser][NFC] Use parseArchExtension in parseModifier. (PR #80427)
Alexandros Lamprineas via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 2 05:16:21 PST 2024
https://github.com/labrinea updated https://github.com/llvm/llvm-project/pull/80427
>From 31efe12f7b6aade18999b8d69ae85ff1af2257f9 Mon Sep 17 00:00:00 2001
From: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
Date: Fri, 2 Feb 2024 12:11:03 +0000
Subject: [PATCH] [AArch64][TargetParser][NFC] Use parseArchExtension in
parseModifier.
This allows making changes in parseArchExtension to make their
way in the command line as well, not only in target attributes.
---
llvm/lib/TargetParser/AArch64TargetParser.cpp | 29 +++++++------------
1 file changed, 11 insertions(+), 18 deletions(-)
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