[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Jan 30 15:00:19 PST 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.41 -> 1.42
---
Log message:

Print the most trivial inline asms.


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

 AsmPrinter.cpp |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.41 llvm/lib/CodeGen/AsmPrinter.cpp:1.42
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.41	Thu Jan 26 20:10:10 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Mon Jan 30 17:00:08 2006
@@ -456,5 +456,16 @@
 /// printInlineAsm - This method formats and prints the specified machine
 /// instruction that is an inline asm.
 void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
-  O << "INLINE ASM NOT EMITTED YET!\n";
+  unsigned NumOperands = MI->getNumOperands();
+  
+  // Count the number of register definitions.
+  unsigned NumDefs = 0;
+  for (; MI->getOperand(NumDefs).isDef(); ++NumDefs)
+    assert(NumDefs != NumOperands-1 && "No asm string?");
+  
+  assert(MI->getOperand(NumDefs).isExternalSymbol() && "No asm string?");
+  
+  const char *AsmStr = MI->getOperand(NumDefs).getSymbolName();
+  
+  O << AsmStr << "\n";
 }






More information about the llvm-commits mailing list