aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-07-18 17:38:46 +0000
committerChris Lattner <sabre@nondot.org>2006-07-18 17:38:46 +0000
commitb51ecd4dd93b8eccf2cba3d541cff0f7cdbf7e1c (patch)
treeb0f052a6f7f2bbb7f498a0200fb37f10e8069287
parent5561640043666174a1e4d828107702a8992e59f6 (diff)
downloadexternal_llvm-b51ecd4dd93b8eccf2cba3d541cff0f7cdbf7e1c.zip
external_llvm-b51ecd4dd93b8eccf2cba3d541cff0f7cdbf7e1c.tar.gz
external_llvm-b51ecd4dd93b8eccf2cba3d541cff0f7cdbf7e1c.tar.bz2
Steal bits from the asm string index to use for operand information. On both
x86 and ppc, this gets us 4 more bits to play with, since the string indices both only use 12 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29180 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/TableGen/AsmWriterEmitter.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp
index ea4f159..f84ebbf 100644
--- a/utils/TableGen/AsmWriterEmitter.cpp
+++ b/utils/TableGen/AsmWriterEmitter.cpp
@@ -457,8 +457,7 @@ void AsmWriterEmitter::run(std::ostream &O) {
// To reduce code size, we compactify common instructions into a few bits
// in the opcode-indexed table.
- // 16 bits to play with.
- unsigned BitsLeft = 16;
+ unsigned BitsLeft = 32-AsmStrBits;
std::vector<std::vector<std::string> > TableDrivenOperandPrinters;
@@ -501,7 +500,7 @@ void AsmWriterEmitter::run(std::ostream &O) {
O<<" static const unsigned OpInfo[] = {\n";
for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
- O << " " << OpcodeInfo[i] << ",\t// "
+ O << " " << OpcodeInfo[i] << "U,\t// "
<< NumberedInstructions[i]->TheDef->getName() << "\n";
}
// Add a dummy entry so the array init doesn't end with a comma.
@@ -548,7 +547,7 @@ void AsmWriterEmitter::run(std::ostream &O) {
<< " O << AsmStrs+(Bits & " << (1 << AsmStrBits)-1 << ");\n\n";
// Output the table driven operand information.
- BitsLeft = 16;
+ BitsLeft = 32-AsmStrBits;
for (unsigned i = 0, e = TableDrivenOperandPrinters.size(); i != e; ++i) {
std::vector<std::string> &Commands = TableDrivenOperandPrinters[i];
@@ -595,12 +594,15 @@ void AsmWriterEmitter::run(std::ostream &O) {
// elements in the vector.
std::reverse(Instructions.begin(), Instructions.end());
- // Find the opcode # of inline asm
- O << " switch (MI->getOpcode()) {\n";
- while (!Instructions.empty())
- EmitInstructions(Instructions, O);
+ if (!Instructions.empty()) {
+ // Find the opcode # of inline asm.
+ O << " switch (MI->getOpcode()) {\n";
+ while (!Instructions.empty())
+ EmitInstructions(Instructions, O);
- O << " }\n"
- " return true;\n"
+ O << " }\n";
+ }
+
+ O << " return true;\n"
"}\n";
}