[llvm] 7aa906d - [RISCV] Merge the Arch and Exts variables in RISCVISAInfo::parseArchString. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 12:12:32 PDT 2024


Author: Craig Topper
Date: 2024-07-03T12:11:47-07:00
New Revision: 7aa906dda56ea6843004f1d52eb13860341ca5e5

URL: https://github.com/llvm/llvm-project/commit/7aa906dda56ea6843004f1d52eb13860341ca5e5
DIFF: https://github.com/llvm/llvm-project/commit/7aa906dda56ea6843004f1d52eb13860341ca5e5.diff

LOG: [RISCV] Merge the Arch and Exts variables in RISCVISAInfo::parseArchString. NFC

Added: 
    

Modified: 
    llvm/lib/TargetParser/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index ee8024b3bea36..1d077326e4cf2 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -561,7 +561,7 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
   // Ref: Table 22.1 in RISC-V User-Level ISA V2.2
   char Baseline = Arch.front();
   // Skip the baseline.
-  StringRef Exts = Arch.drop_front();
+  Arch = Arch.drop_front();
 
   unsigned Major, Minor, ConsumeLength;
 
@@ -574,7 +574,7 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
   case 'i':
     // Baseline is `i` or `e`
     if (auto E = getExtensionVersion(
-            StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
+            StringRef(&Baseline, 1), Arch, Major, Minor, ConsumeLength,
             EnableExperimentalExtension, ExperimentalExtensionVersionCheck))
       return std::move(E);
 
@@ -582,7 +582,7 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
     break;
   case 'g':
     // g expands to extensions in RISCVGImplications.
-    if (Arch.size() > 1 && isDigit(Arch[1]))
+    if (!Arch.empty() && isDigit(Arch.front()))
       return getError("version not supported for 'g'");
 
     // Versions for g are disallowed, and this was checked for previously.
@@ -602,18 +602,18 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
 
   // Consume the base ISA version number and any '_' between rvxxx and the
   // first extension
-  Exts = Exts.drop_front(ConsumeLength);
+  Arch = Arch.drop_front(ConsumeLength);
 
-  while (!Exts.empty()) {
-    if (Exts.front() == '_') {
-      if (Exts.size() == 1 || Exts[1] == '_')
+  while (!Arch.empty()) {
+    if (Arch.front() == '_') {
+      if (Arch.size() == 1 || Arch[1] == '_')
         return getError("extension name missing after separator '_'");
-      Exts = Exts.drop_front();
+      Arch = Arch.drop_front();
     }
 
-    size_t Idx = Exts.find('_');
-    StringRef Ext = Exts.slice(0, Idx);
-    Exts = Exts.slice(Idx, StringRef::npos);
+    size_t Idx = Arch.find('_');
+    StringRef Ext = Arch.slice(0, Idx);
+    Arch = Arch.slice(Idx, StringRef::npos);
 
     do {
       StringRef Name, Vers, Desc;


        


More information about the llvm-commits mailing list