lib/Target/SubtargetFeature.cpp asserts that the FeatureKV[] table be sorted
authorJim Grosbach <grosbach@apple.com>
Thu, 11 Sep 2008 17:05:32 +0000 (17:05 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 11 Sep 2008 17:05:32 +0000 (17:05 +0000)
by its first field, but TableGen doesn't actually enforce creating it that
way. TableGen sorts the records that will be used to create it by the names
of the records, not the Name field of those records.

This patch corrects the sort to use the "Name" field of the record as the
sort key.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56106 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/Record.h
utils/TableGen/SubtargetEmitter.cpp

index d597715cd1af76286b78624eaf5c342b87963a96..90e246eb4779522575d9277f0d2f5043b59bdbd9 100644 (file)
@@ -1183,7 +1183,8 @@ struct LessRecord {
   }
 };
 
-/// LessRecord - Sorting predicate to sort record pointers by their name field.
+/// LessRecordFieldName - Sorting predicate to sort record pointers by their 
+/// name field.
 ///
 struct LessRecordFieldName {
   bool operator()(const Record *Rec1, const Record *Rec2) const {
index 9b5f6df4d4abf5f6038d2851004f463534fe7414..b05b9968a2e83a149f09152e63f82c2a5a44d601 100644 (file)
@@ -61,7 +61,7 @@ void SubtargetEmitter::FeatureKeyValues(std::ostream &OS) {
   // Gather and sort all the features
   std::vector<Record*> FeatureList =
                            Records.getAllDerivedDefinitions("SubtargetFeature");
-  std::sort(FeatureList.begin(), FeatureList.end(), LessRecord());
+  std::sort(FeatureList.begin(), FeatureList.end(), LessRecordFieldName());
 
   // Begin feature table
   OS << "// Sorted (by key) array of values for CPU features.\n"