[llvm-commits] [llvm] r163878 - in /llvm/trunk/utils/TableGen: AsmWriterEmitter.cpp SequenceToOffsetTable.h
Craig Topper
craig.topper at gmail.com
Thu Sep 13 23:37:49 PDT 2012
Author: ctopper
Date: Fri Sep 14 01:37:49 2012
New Revision: 163878
URL: http://llvm.org/viewvc/llvm-project?rev=163878&view=rev
Log:
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.
Modified:
llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
llvm/trunk/utils/TableGen/SequenceToOffsetTable.h
Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=163878&r1=163877&r2=163878&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Fri Sep 14 01:37:49 2012
@@ -581,12 +581,13 @@
StringTable.add(AsmName);
}
- StringTable.layout();
+ unsigned Entries = StringTable.layout();
O << " static const char AsmStrs" << AltName << "[] = {\n";
StringTable.emit(O, printChar);
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) {
if ((i % 14) == 0)
O << "\n ";
Modified: llvm/trunk/utils/TableGen/SequenceToOffsetTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SequenceToOffsetTable.h?rev=163878&r1=163877&r2=163878&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SequenceToOffsetTable.h (original)
+++ llvm/trunk/utils/TableGen/SequenceToOffsetTable.h Fri Sep 14 01:37:49 2012
@@ -82,9 +82,9 @@
}
bool empty() const { return Seqs.empty(); }
-
+
/// layout - Computes the final table layout.
- void layout() {
+ unsigned layout() {
assert(Entries == 0 && "Can only call layout() once");
// Lay out the table in Seqs iteration order.
for (typename SeqMap::iterator I = Seqs.begin(), E = Seqs.end(); I != E;
@@ -93,6 +93,7 @@
// Include space for a terminator.
Entries += I->first.size() + 1;
}
+ return Entries;
}
/// get - Returns the offset of Seq in the final table.
More information about the llvm-commits
mailing list