1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Reduce size of register name index tables by using uint16_t for all in tree targets. If more than 16-bits are needed for any out of tree targets, code will detect and use uint32_t instead.

llvm-svn: 163878
This commit is contained in:
Craig Topper 2012-09-14 06:37:49 +00:00
parent 064f380b12
commit 5cd6b912e7
2 changed files with 6 additions and 4 deletions

View File

@ -581,12 +581,13 @@ emitRegisterNameString(raw_ostream &O, StringRef AltName,
StringTable.add(AsmName); StringTable.add(AsmName);
} }
StringTable.layout(); unsigned Entries = StringTable.layout();
O << " static const char AsmStrs" << AltName << "[] = {\n"; O << " static const char AsmStrs" << AltName << "[] = {\n";
StringTable.emit(O, printChar); StringTable.emit(O, printChar);
O << " };\n\n"; O << " };\n\n";
O << " static const unsigned RegAsmOffset" << AltName << "[] = {"; O << " static const uint" << ((Entries > 0xffff) ? "32" : "16")
<< "_t RegAsmOffset" << AltName << "[] = {";
for (unsigned i = 0, e = Registers.size(); i != e; ++i) { for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
if ((i % 14) == 0) if ((i % 14) == 0)
O << "\n "; O << "\n ";

View File

@ -84,7 +84,7 @@ public:
bool empty() const { return Seqs.empty(); } bool empty() const { return Seqs.empty(); }
/// layout - Computes the final table layout. /// layout - Computes the final table layout.
void layout() { unsigned layout() {
assert(Entries == 0 && "Can only call layout() once"); assert(Entries == 0 && "Can only call layout() once");
// Lay out the table in Seqs iteration order. // Lay out the table in Seqs iteration order.
for (typename SeqMap::iterator I = Seqs.begin(), E = Seqs.end(); I != E; for (typename SeqMap::iterator I = Seqs.begin(), E = Seqs.end(); I != E;
@ -93,6 +93,7 @@ public:
// Include space for a terminator. // Include space for a terminator.
Entries += I->first.size() + 1; Entries += I->first.size() + 1;
} }
return Entries;
} }
/// get - Returns the offset of Seq in the final table. /// get - Returns the offset of Seq in the final table.