rejigger the world so that EmitInstruction prints the \n at
authorChris Lattner <sabre@nondot.org>
Wed, 3 Feb 2010 01:09:55 +0000 (01:09 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 3 Feb 2010 01:09:55 +0000 (01:09 +0000)
the end of the instruction instead of expecting the caller to
do it.  This currently causes the asm-verbose instruction
comments to be on the next line.

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

12 files changed:
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp

index 71668f5e25d825319ca49e7706143122a563e86a..3358d04fc290e276014c551706d56d344754dc04 100644 (file)
@@ -351,15 +351,19 @@ void AsmPrinter::EmitFunctionBody() {
       case TargetInstrInfo::EH_LABEL:
       case TargetInstrInfo::GC_LABEL:
         printLabel(II);
+        O << '\n';
         break;
       case TargetInstrInfo::INLINEASM:
         printInlineAsm(II);
+        O << '\n';
         break;
       case TargetInstrInfo::IMPLICIT_DEF:
         printImplicitDef(II);
+        O << '\n';
         break;
       case TargetInstrInfo::KILL:
         printKill(II);
+        O << '\n';
         break;
       default:
         EmitInstruction(II);
@@ -367,7 +371,6 @@ void AsmPrinter::EmitFunctionBody() {
       }
       if (VerboseAsm)
         EmitComments(*II);
-      O << '\n';
       
       // FIXME: Clean up processDebugLoc.
       processDebugLoc(II, false);
@@ -1580,7 +1583,7 @@ static void PrintChildLoopComment(raw_ostream &OS, const MachineLoop *Loop,
   }
 }
 
-/// EmitComments - Pretty-print comments for basic blocks.
+/// PrintBasicBlockLoopComments - Pretty-print comments for basic blocks.
 static void PrintBasicBlockLoopComments(const MachineBasicBlock &MBB,
                                         const MachineLoopInfo *LI,
                                         const AsmPrinter &AP) {
@@ -1716,8 +1719,6 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
   if (!VerboseAsm)
     return;
 
-  bool Newline = false;
-
   if (!MI.getDebugLoc().isUnknown()) {
     DILocation DLT = MF->getDILocation(MI.getDebugLoc());
 
@@ -1733,7 +1734,7 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
     O << ':' << DLT.getLineNumber();
     if (DLT.getColumnNumber() != 0)
       O << ':' << DLT.getColumnNumber();
-    Newline = true;
+    O << '\n';
   }
 
   // Check for spills and reloads
@@ -1748,37 +1749,29 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
   if (TM.getInstrInfo()->isLoadFromStackSlotPostFE(&MI, FI)) {
     if (FrameInfo->isSpillSlotObjectIndex(FI)) {
       MMO = *MI.memoperands_begin();
-      if (Newline) O << '\n';
       O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Reload";
-      Newline = true;
+      O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Reload\n";
     }
   }
   else if (TM.getInstrInfo()->hasLoadFromStackSlot(&MI, MMO, FI)) {
     if (FrameInfo->isSpillSlotObjectIndex(FI)) {
-      if (Newline) O << '\n';
       O.PadToColumn(MAI->getCommentColumn());
       O << MAI->getCommentString() << ' '
-        << MMO->getSize() << "-byte Folded Reload";
-      Newline = true;
+        << MMO->getSize() << "-byte Folded Reload\n";
     }
   }
   else if (TM.getInstrInfo()->isStoreToStackSlotPostFE(&MI, FI)) {
     if (FrameInfo->isSpillSlotObjectIndex(FI)) {
       MMO = *MI.memoperands_begin();
-      if (Newline) O << '\n';
       O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Spill";
-      Newline = true;
+      O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Spill\n";
     }
   }
   else if (TM.getInstrInfo()->hasStoreToStackSlot(&MI, MMO, FI)) {
     if (FrameInfo->isSpillSlotObjectIndex(FI)) {
-      if (Newline) O << '\n';
       O.PadToColumn(MAI->getCommentColumn());
       O << MAI->getCommentString() << ' '
-        << MMO->getSize() << "-byte Folded Spill";
-      Newline = true;
+        << MMO->getSize() << "-byte Folded Spill\n";
     }
   }
 
@@ -1787,9 +1780,8 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
   if (TM.getInstrInfo()->isMoveInstr(MI, SrcReg, DstReg,
                                       SrcSubIdx, DstSubIdx)) {
     if (MI.getAsmPrinterFlag(ReloadReuse)) {
-      if (Newline) O << '\n';
       O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString() << " Reload Reuse";
+      O << MAI->getCommentString() << " Reload Reuse\n";
     }
   }
 }
index 3f0bd61c685dd852f93c9a4edb1ecc9586b115cb..7e22b62a2607a9de72e11860a76c84443fd40253 100644 (file)
@@ -1034,6 +1034,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
       EmitAlignment(2);
     
     printInstruction(MI);
+    O << '\n';
   }
 }
 
index f5122565ab9cfc509ea63ca928ec3f7f8cceb8b3..03a49b27349c924135f8b151bacdce47bbd66cf8 100644 (file)
@@ -45,7 +45,10 @@ namespace {
       return "Alpha Assembly Printer";
     }
     void printInstruction(const MachineInstr *MI);
-    void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); }
+    void EmitInstruction(const MachineInstr *MI) {
+      printInstruction(MI);
+      O << '\n';
+    }
     static const char *getRegisterName(unsigned RegNo);
 
     void printOp(const MachineOperand &MO, bool IsCallOp = false);
index 56a1462934528a8c162f7272b5c447375bff8fb4..885e69701c4e0d11ecb0fd25868d2b9083177d03 100644 (file)
@@ -52,7 +52,10 @@ namespace {
     void printInstruction(const MachineInstr *MI);  // autogenerated.
     static const char *getRegisterName(unsigned RegNo);
 
-    void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); }
+    void EmitInstruction(const MachineInstr *MI) {
+      printInstruction(MI);
+      O << '\n';
+    }
     bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
                          unsigned AsmVariant, const char *ExtraCode);
     bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
index 92736c2268c4b55b9e29d04d7b5452f2dcdf96ff..db653a733ca882650e2977f0018b5a4a3c5db369 100644 (file)
@@ -58,6 +58,7 @@ namespace {
 
     void EmitInstruction(const MachineInstr *MI) {
       printInstruction(MI);
+      O << '\n';
     }
     void printOp(const MachineOperand &MO);
 
index 14e39f966f3e1b977287274a6e57579f2356eaaa..20cbde8f14d7a95b2be0cdbba9b08f645f0e5ce2 100644 (file)
@@ -184,6 +184,7 @@ void MSP430AsmPrinter::EmitInstruction(const MachineInstr *MI) {
   MCInst TmpInst;
   MCInstLowering.Lower(MI, TmpInst);
   printMCInst(&TmpInst);
+  O << '\n';
 }
 
 static MCInstPrinter *createMSP430MCInstPrinter(const Target &T,
index 4118e7b8a3604f7822e76451e00efa4bc81b7fb1..5ae1cf10af2fde2e1f2130aa0b1fb2d6807348b3 100644 (file)
@@ -75,7 +75,10 @@ namespace {
     void emitFrameDirective();
 
     void printInstruction(const MachineInstr *MI);  // autogenerated.
-    void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); }
+    void EmitInstruction(const MachineInstr *MI) {
+      printInstruction(MI);
+      O << '\n';
+    }
     virtual void EmitFunctionBodyStart();
     virtual void EmitFunctionBodyEnd();
     static const char *getRegisterName(unsigned RegNo);
index 241bb900cfb4a0e2c23b03fbf661e8b4cd207bc2..17581a97e7dd0c8253411289bc49c647ba45b070 100644 (file)
@@ -555,6 +555,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
       O << ", ";
       printOperand(MI, 1);
       O << ", " << (unsigned int)SH;
+      O << '\n';
       return;
     }
   }
@@ -565,6 +566,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
     printOperand(MI, 0);
     O << ", ";
     printOperand(MI, 1);
+    O << '\n';
     return;
   }
   
@@ -578,11 +580,13 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
       O << ", ";
       printOperand(MI, 1);
       O << ", " << (unsigned int)SH;
+      O << '\n';
       return;
     }
   }
 
   printInstruction(MI);
+  O << '\n';
 }
 
 void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
index 950daa921676ce42762c8e5475d436cce861535e..7f529fe022e445af201299b03d7ae979aa1b717e 100644 (file)
@@ -44,6 +44,7 @@ namespace {
 
     virtual void EmitInstruction(const MachineInstr *MI) {
       printInstruction(MI);
+      O << '\n';
     }
     void printInstruction(const MachineInstr *MI);  // autogenerated.
     static const char *getRegisterName(unsigned RegNo);
index 1611ae89b983ce4c7f7500d98242264038a2dda5..965f5a180987ff320d9fed75cc4d2142c0495de5 100644 (file)
@@ -79,6 +79,7 @@ namespace {
 void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) {
   // Call the autogenerated instruction printer routines.
   printInstruction(MI);
+  O << '\n';
 }
 
 void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum){
index b45e6714db4a523bbf74de4cf60f57c5e58de2fb..3b3b9ffc53daa9b2eb9af763d6c69d3f9d01b380 100644 (file)
@@ -448,6 +448,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
     }
     O << "+";
     printOperand(MI, NOps-2);
+    O << '\n';
     return;
   }
   case X86::MOVPC32r: {
@@ -475,6 +476,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
     TmpInst.setOpcode(X86::POP32r);
     TmpInst.getOperand(0) = MCOperand::CreateReg(MI->getOperand(0).getReg());
     printMCInst(&TmpInst);
+    O << '\n';
     return;
   }
       
@@ -512,6 +514,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
     TmpInst.addOperand(MCOperand::CreateReg(MI->getOperand(1).getReg()));
     TmpInst.addOperand(MCOperand::CreateExpr(DotExpr));
     printMCInst(&TmpInst);
+    O << '\n';
     return;
   }
   }
@@ -521,5 +524,6 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
   
   
   printMCInst(&TmpInst);
+  O << '\n';
 }
 
index f85217cdf5ebbb1cb1ccdf7470221fd69a2fb11d..b9ba61e505c02b8a9d7918c527caee90d8b51aa6 100644 (file)
@@ -309,6 +309,7 @@ void XCoreAsmPrinter::EmitInstruction(const MachineInstr *MI) {
     return;
   }
   printInstruction(MI);
+  O << '\n';
 }
 
 // Force static initialization.