[llvm] 9599eef - [TableGen] Stabilize sort in GET_SUBTARGETINFO_MACRO block

Kevin P. Neal via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 05:55:06 PDT 2023


Author: Kevin P. Neal
Date: 2023-06-28T08:54:59-04:00
New Revision: 9599eefb21b71cf85669006b504c8a5955827bd2

URL: https://github.com/llvm/llvm-project/commit/9599eefb21b71cf85669006b504c8a5955827bd2
DIFF: https://github.com/llvm/llvm-project/commit/9599eefb21b71cf85669006b504c8a5955827bd2.diff

LOG: [TableGen] Stabilize sort in GET_SUBTARGETINFO_MACRO block

Add missed change requested in D153371.

Added: 
    

Modified: 
    llvm/include/llvm/TableGen/Record.h
    llvm/utils/TableGen/SubtargetEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index 698e777748cc2..321b0f4566be8 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -2033,15 +2033,6 @@ struct LessRecordFieldName {
   }
 };
 
-/// Sorting predicate to sort record pointers by their
-/// FieldName field.
-struct LessRecordFieldFieldName {
-  bool operator()(const Record *Rec1, const Record *Rec2) const {
-    return Rec1->getValueAsString("FieldName") <
-           Rec2->getValueAsString("FieldName");
-  }
-};
-
 struct LessRecordRegister {
   struct RecordParts {
     SmallVector<std::pair< bool, StringRef>, 4> Parts;

diff  --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp
index c63c8f1f4aa93..e4eb23649e962 100644
--- a/llvm/utils/TableGen/SubtargetEmitter.cpp
+++ b/llvm/utils/TableGen/SubtargetEmitter.cpp
@@ -41,6 +41,15 @@ using namespace llvm;
 
 namespace {
 
+/// Sorting predicate to sort record pointers by their
+/// FieldName field.
+struct LessRecordFieldFieldName {
+  bool operator()(const Record *Rec1, const Record *Rec2) const {
+    return Rec1->getValueAsString("FieldName") <
+           Rec2->getValueAsString("FieldName");
+  }
+};
+
 class SubtargetEmitter {
   // Each processor has a SchedClassDesc table with an entry for each SchedClass.
   // The SchedClassDesc table indexes into a global write resource table, write


        


More information about the llvm-commits mailing list