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

Chris Lattner lattner at cs.uiuc.edu
Thu Jan 26 18:11:02 PST 2006



Changes in directory llvm/utils/TableGen:

AsmWriterEmitter.cpp updated: 1.23 -> 1.24
---
Log message:

Use printInlineAsm to, well, print inline asm's.


---
Diffs of the changes:  (+7 -4)

 AsmWriterEmitter.cpp |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)


Index: llvm/utils/TableGen/AsmWriterEmitter.cpp
diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.23 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.24
--- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.23	Wed Nov 30 12:54:35 2005
+++ llvm/utils/TableGen/AsmWriterEmitter.cpp	Thu Jan 26 20:10:50 2006
@@ -345,6 +345,9 @@
       break;
     }
 
+  std::vector<const CodeGenInstruction*> NumberedInstructions;
+  Target.getInstructionsByEnumValue(NumberedInstructions);
+  
   if (AllStartWithString) {
     // Compute the CodeGenInstruction -> AsmWriterInst mapping.  Note that not
     // all machine instructions are necessarily being printed, so there may be
@@ -354,9 +357,6 @@
       CGIAWIMap.insert(std::make_pair(Instructions[i].CGI, &Instructions[i]));
 
     // Emit a table of constant strings.
-    std::vector<const CodeGenInstruction*> NumberedInstructions;
-    Target.getInstructionsByEnumValue(NumberedInstructions);
-
     O << "  static const char * const OpStrs[] = {\n";
     for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
       AsmWriterInst *AWI = CGIAWIMap[NumberedInstructions[i]];
@@ -380,8 +380,11 @@
   // elements in the vector.
   std::reverse(Instructions.begin(), Instructions.end());
 
+  // Find the opcode # of inline asm
   O << "  switch (MI->getOpcode()) {\n"
-       "  default: return false;\n";
+       "  default: return false;\n"
+       "  case " << NumberedInstructions.back()->Namespace
+    << "::INLINEASM: printInlineAsm(MI); break;\n";
 
   while (!Instructions.empty())
     EmitInstructions(Instructions, O);






More information about the llvm-commits mailing list