Print the most trivial inline asms.
authorChris Lattner <sabre@nondot.org>
Mon, 30 Jan 2006 23:00:08 +0000 (23:00 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 30 Jan 2006 23:00:08 +0000 (23:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25822 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter.cpp

index 83ecfe24c30b2c802c088a1a485b2c59766e0cda..ab0465df1c3249465768efe573f8f447c1ca815a 100644 (file)
@@ -456,5 +456,16 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
 /// 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";
 }