1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[X86] Sort the tables before printing in X86FoldTablesEmitter.

This makes diffing with the manual tables easier. And if we ever
directly use the autogenerated tables instead of the manual tables
we'll need them to be in sorted order for the binary search.
This commit is contained in:
Craig Topper 2020-10-18 17:16:14 -07:00
parent f676298a92
commit 159c8567b3

View File

@ -127,6 +127,15 @@ class X86FoldTablesEmitter {
OS << "0 },\n";
}
bool operator<(const X86FoldTableEntry &RHS) const {
bool LHSpseudo = RegInst->TheDef->getValueAsBit("isPseudo");
bool RHSpseudo = RHS.RegInst->TheDef->getValueAsBit("isPseudo");
if (LHSpseudo != RHSpseudo)
return LHSpseudo;
return RegInst->TheDef->getName() < RHS.RegInst->TheDef->getName();
}
};
typedef std::vector<X86FoldTableEntry> FoldTable;
@ -647,6 +656,14 @@ void X86FoldTablesEmitter::run(formatted_raw_ostream &OS) {
&(Target.getInstruction(MemInstIter)), Entry.Strategy);
}
// Sort the tables before printing.
llvm::sort(Table2Addr);
llvm::sort(Table0);
llvm::sort(Table1);
llvm::sort(Table2);
llvm::sort(Table3);
llvm::sort(Table4);
// Print all tables.
printTable(Table2Addr, "Table2Addr", OS);
printTable(Table0, "Table0", OS);