[llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jul 18 10:38:59 PDT 2006



Changes in directory llvm/utils/TableGen:

AsmWriterEmitter.cpp updated: 1.32 -> 1.33
---
Log message:

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.


---
Diffs of the changes:  (+12 -10)

 AsmWriterEmitter.cpp |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)


Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.32 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.33
--- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.32	Tue Jul 18 12:32:27 2006
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp	Tue Jul 18 12:38:46 2006
@@ -457,8 +457,7 @@
   
   // 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 @@
   
   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 @@
     << "  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 @@
   // 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";
 }






More information about the llvm-commits mailing list