[llvm] 83f065d - [RISCV] static_assert SupportedProfiles and SupportedExperimentalProfiles are sorted

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Wed May 15 13:34:22 PDT 2024


Author: Alex Bradbury
Date: 2024-05-15T21:34:07+01:00
New Revision: 83f065d582977aca5c037c27a7290f30850bdd35

URL: https://github.com/llvm/llvm-project/commit/83f065d582977aca5c037c27a7290f30850bdd35
DIFF: https://github.com/llvm/llvm-project/commit/83f065d582977aca5c037c27a7290f30850bdd35.diff

LOG: [RISCV] static_assert SupportedProfiles and SupportedExperimentalProfiles are sorted

Just as we do for the arrays of extension names.

Added: 
    

Modified: 
    llvm/lib/TargetParser/RISCVISAInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index 706b2853cd2c5..827bc5b443870 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -39,6 +39,10 @@ struct RISCVSupportedExtension {
 struct RISCVProfile {
   StringLiteral Name;
   StringLiteral MArch;
+
+  bool operator<(const RISCVProfile &RHS) const {
+    return StringRef(Name) < StringRef(RHS.Name);
+  }
 };
 
 } // end anonymous namespace
@@ -61,6 +65,10 @@ static void verifyTables() {
            "Extensions are not sorted by name");
     assert(llvm::is_sorted(SupportedExperimentalExtensions) &&
            "Experimental extensions are not sorted by name");
+    assert(llvm::is_sorted(SupportedProfiles) &&
+           "Profiles are not sorted by name");
+    assert(llvm::is_sorted(SupportedExperimentalProfiles) &&
+           "Experimental profiles are not sorted by name");
     TableChecked.store(true, std::memory_order_relaxed);
   }
 #endif


        


More information about the llvm-commits mailing list