AsmMatcher: emit subtarget feature enum in deterministic order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190792 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tim Northover
2013-09-16 16:43:16 +00:00
parent 5721d2f674
commit 6dd670af75

View File

@@ -616,7 +616,7 @@ public:
RegisterClassesTy RegisterClasses; RegisterClassesTy RegisterClasses;
/// Map of Predicate records to their subtarget information. /// Map of Predicate records to their subtarget information.
std::map<Record*, SubtargetFeatureInfo*> SubtargetFeatures; std::map<Record*, SubtargetFeatureInfo*, LessRecordByID> SubtargetFeatures;
/// Map of AsmOperandClass records to their class information. /// Map of AsmOperandClass records to their class information.
std::map<Record*, ClassInfo*> AsmOperandClasses; std::map<Record*, ClassInfo*> AsmOperandClasses;
@@ -666,7 +666,7 @@ public:
/// given operand. /// given operand.
SubtargetFeatureInfo *getSubtargetFeature(Record *Def) const { SubtargetFeatureInfo *getSubtargetFeature(Record *Def) const {
assert(Def->isSubClassOf("Predicate") && "Invalid predicate type!"); assert(Def->isSubClassOf("Predicate") && "Invalid predicate type!");
std::map<Record*, SubtargetFeatureInfo*>::const_iterator I = std::map<Record*, SubtargetFeatureInfo*, LessRecordByID>::const_iterator I =
SubtargetFeatures.find(Def); SubtargetFeatures.find(Def);
return I == SubtargetFeatures.end() ? 0 : I->second; return I == SubtargetFeatures.end() ? 0 : I->second;
} }
@@ -2189,7 +2189,7 @@ static void emitSubtargetFeatureFlagEnumeration(AsmMatcherInfo &Info,
OS << "// Flags for subtarget features that participate in " OS << "// Flags for subtarget features that participate in "
<< "instruction matching.\n"; << "instruction matching.\n";
OS << "enum SubtargetFeatureFlag {\n"; OS << "enum SubtargetFeatureFlag {\n";
for (std::map<Record*, SubtargetFeatureInfo*>::const_iterator for (std::map<Record*, SubtargetFeatureInfo*, LessRecordByID>::const_iterator
it = Info.SubtargetFeatures.begin(), it = Info.SubtargetFeatures.begin(),
ie = Info.SubtargetFeatures.end(); it != ie; ++it) { ie = Info.SubtargetFeatures.end(); it != ie; ++it) {
SubtargetFeatureInfo &SFI = *it->second; SubtargetFeatureInfo &SFI = *it->second;
@@ -2227,9 +2227,9 @@ static void emitGetSubtargetFeatureName(AsmMatcherInfo &Info, raw_ostream &OS) {
<< "static const char *getSubtargetFeatureName(unsigned Val) {\n"; << "static const char *getSubtargetFeatureName(unsigned Val) {\n";
if (!Info.SubtargetFeatures.empty()) { if (!Info.SubtargetFeatures.empty()) {
OS << " switch(Val) {\n"; OS << " switch(Val) {\n";
for (std::map<Record*, SubtargetFeatureInfo*>::const_iterator typedef std::map<Record*, SubtargetFeatureInfo*, LessRecordByID> RecFeatMap;
it = Info.SubtargetFeatures.begin(), for (RecFeatMap::const_iterator it = Info.SubtargetFeatures.begin(),
ie = Info.SubtargetFeatures.end(); it != ie; ++it) { ie = Info.SubtargetFeatures.end(); it != ie; ++it) {
SubtargetFeatureInfo &SFI = *it->second; SubtargetFeatureInfo &SFI = *it->second;
// FIXME: Totally just a placeholder name to get the algorithm working. // FIXME: Totally just a placeholder name to get the algorithm working.
OS << " case " << SFI.getEnumName() << ": return \"" OS << " case " << SFI.getEnumName() << ": return \""
@@ -2254,7 +2254,7 @@ static void emitComputeAvailableFeatures(AsmMatcherInfo &Info,
OS << "unsigned " << Info.Target.getName() << ClassName << "::\n" OS << "unsigned " << Info.Target.getName() << ClassName << "::\n"
<< "ComputeAvailableFeatures(uint64_t FB) const {\n"; << "ComputeAvailableFeatures(uint64_t FB) const {\n";
OS << " unsigned Features = 0;\n"; OS << " unsigned Features = 0;\n";
for (std::map<Record*, SubtargetFeatureInfo*>::const_iterator for (std::map<Record*, SubtargetFeatureInfo*, LessRecordByID>::const_iterator
it = Info.SubtargetFeatures.begin(), it = Info.SubtargetFeatures.begin(),
ie = Info.SubtargetFeatures.end(); it != ie; ++it) { ie = Info.SubtargetFeatures.end(); it != ie; ++it) {
SubtargetFeatureInfo &SFI = *it->second; SubtargetFeatureInfo &SFI = *it->second;