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

Chris Lattner lattner at cs.uiuc.edu
Thu Jul 27 17:17:35 PDT 2006



Changes in directory llvm/lib/CodeGen:

AsmPrinter.cpp updated: 1.86 -> 1.87
---
Log message:

Print empty inline asms as a blank line instead of:

        # InlineAsm Start

        # InlineAsm End



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

 AsmPrinter.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/AsmPrinter.cpp
diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.86 llvm/lib/CodeGen/AsmPrinter.cpp:1.87
--- llvm/lib/CodeGen/AsmPrinter.cpp:1.86	Thu Jul 27 11:46:58 2006
+++ llvm/lib/CodeGen/AsmPrinter.cpp	Thu Jul 27 19:17:20 2006
@@ -615,7 +615,6 @@
 /// printInlineAsm - This method formats and prints the specified machine
 /// instruction that is an inline asm.
 void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
-  O << InlineAsmStart << "\n\t";
   unsigned NumOperands = MI->getNumOperands();
   
   // Count the number of register definitions.
@@ -628,6 +627,14 @@
   // Disassemble the AsmStr, printing out the literal pieces, the operands, etc.
   const char *AsmStr = MI->getOperand(NumDefs).getSymbolName();
 
+  // If this asmstr is empty, don't bother printing the #APP/#NOAPP markers.
+  if (AsmStr[0] == 0) {
+    O << "\n";  // Tab already printed, avoid double indenting next instr.
+    return;
+  }
+  
+  O << InlineAsmStart << "\n\t";
+
   // The variant of the current asmprinter: FIXME: change.
   int AsmPrinterVariant = 0;
   






More information about the llvm-commits mailing list