[llvm-commits] [llvm] r56106 - in /llvm/trunk/utils/TableGen: Record.h SubtargetEmitter.cpp
Jim Grosbach
grosbach at apple.com
Thu Sep 11 10:05:33 PDT 2008
Author: grosbach
Date: Thu Sep 11 12:05:32 2008
New Revision: 56106
URL: http://llvm.org/viewvc/llvm-project?rev=56106&view=rev
Log:
lib/Target/SubtargetFeature.cpp asserts that the FeatureKV[] table be sorted
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.
Modified:
llvm/trunk/utils/TableGen/Record.h
llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
Modified: llvm/trunk/utils/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.h?rev=56106&r1=56105&r2=56106&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/Record.h (original)
+++ llvm/trunk/utils/TableGen/Record.h Thu Sep 11 12:05:32 2008
@@ -1183,7 +1183,8 @@
}
};
-/// 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 {
Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=56106&r1=56105&r2=56106&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Thu Sep 11 12:05:32 2008
@@ -61,7 +61,7 @@
// 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"
More information about the llvm-commits
mailing list