Print empty inline asms as a blank line instead of:
authorChris Lattner <sabre@nondot.org>
Fri, 28 Jul 2006 00:17:20 +0000 (00:17 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 28 Jul 2006 00:17:20 +0000 (00:17 +0000)
        # InlineAsm Start

        # InlineAsm End

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29372 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter.cpp

index 489d3414de0eb6a65e0914048cbaf25f7e4b81c9..205c68751f6f0072f1920881dd139b0d505b5d1d 100644 (file)
@@ -615,7 +615,6 @@ 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 << InlineAsmStart << "\n\t";
   unsigned NumOperands = MI->getNumOperands();
   
   // Count the number of register definitions.
@@ -628,6 +627,14 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const {
   // 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;