From 8e089a9e4d6b7aa2b3968c38644f926f60a7c670 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 10 Feb 2010 00:36:00 +0000 Subject: [PATCH] print all the newlines at the end of instructions with OutStreamer.AddBlankLine instead of textually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95734 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 10 ++++++---- lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 6 +++--- lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp | 2 +- lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp | 2 +- lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp | 2 +- lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 2 +- lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp | 2 +- lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 8 ++++---- lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp | 3 ++- lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp | 2 +- lib/Target/X86/AsmPrinter/X86MCInstLower.cpp | 6 +++--- lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp | 5 +++-- 12 files changed, 27 insertions(+), 23 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 570916f7b78..25e0818404b 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1442,7 +1442,8 @@ void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { } } } - O << "\n\t" << MAI->getCommentString() << MAI->getInlineAsmEnd() << '\n'; + O << "\n\t" << MAI->getCommentString() << MAI->getInlineAsmEnd(); + OutStreamer.AddBlankLine(); } /// printImplicitDef - This method prints the specified machine instruction @@ -1451,7 +1452,8 @@ void AsmPrinter::printImplicitDef(const MachineInstr *MI) const { if (!VerboseAsm) return; O.PadToColumn(MAI->getCommentColumn()); O << MAI->getCommentString() << " implicit-def: " - << TRI->getName(MI->getOperand(0).getReg()) << '\n'; + << TRI->getName(MI->getOperand(0).getReg()); + OutStreamer.AddBlankLine(); } void AsmPrinter::printKill(const MachineInstr *MI) const { @@ -1463,14 +1465,14 @@ void AsmPrinter::printKill(const MachineInstr *MI) const { assert(op.isReg() && "KILL instruction must have only register operands"); O << ' ' << TRI->getName(op.getReg()) << (op.isDef() ? "" : ""); } - O << '\n'; + OutStreamer.AddBlankLine(); } /// printLabel - This method prints a local label used by debug and /// exception handling tables. void AsmPrinter::printLabelInst(const MachineInstr *MI) const { printLabel(MI->getOperand(0).getImm()); - O << '\n'; + OutStreamer.AddBlankLine(); } void AsmPrinter::printLabel(unsigned Id) const { diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index d456123b112..0a75c092e29 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -220,7 +220,7 @@ namespace { O << "-."; O << ')'; } - O << '\n'; + OutStreamer.AddBlankLine(); } void getAnalysisUsage(AnalysisUsage &AU) const { @@ -819,7 +819,7 @@ void ARMAsmPrinter::printCPInstOperand(const MachineInstr *MI, int OpNum, // data itself. if (!strcmp(Modifier, "label")) { unsigned ID = MI->getOperand(OpNum).getImm(); - O << *GetCPISymbol(ID) << ":\n"; + OutStreamer.EmitLabel(GetCPISymbol(ID)); } else { assert(!strcmp(Modifier, "cpentry") && "Unknown modifier for CPE"); unsigned CPI = MI->getOperand(OpNum).getIndex(); @@ -1030,7 +1030,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) { EmitAlignment(2); printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } } diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp index 03a49b27349..733a46c0ad2 100644 --- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp @@ -47,7 +47,7 @@ namespace { void printInstruction(const MachineInstr *MI); void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } static const char *getRegisterName(unsigned RegNo); diff --git a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp index 885e69701c4..fe13e14844c 100644 --- a/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp +++ b/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp @@ -54,7 +54,7 @@ namespace { void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, unsigned AsmVariant, const char *ExtraCode); diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index db653a733ca..2ca05c24f20 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -58,7 +58,7 @@ namespace { void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } void printOp(const MachineOperand &MO); diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index 5ae1cf10af2..b8641c30976 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -77,7 +77,7 @@ namespace { void printInstruction(const MachineInstr *MI); // autogenerated. void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } virtual void EmitFunctionBodyStart(); virtual void EmitFunctionBodyEnd(); diff --git a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp index 0a27827311d..72f7c16c637 100644 --- a/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp +++ b/lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp @@ -45,7 +45,7 @@ PIC16AsmPrinter::PIC16AsmPrinter(formatted_raw_ostream &O, TargetMachine &TM, void PIC16AsmPrinter::EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } static int getFunctionColor(const Function *F) { diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index bf2e693e89d..afc90b1aecb 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -555,7 +555,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) { O << ", "; printOperand(MI, 1); O << ", " << (unsigned int)SH; - O << '\n'; + OutStreamer.AddBlankLine(); return; } } @@ -566,7 +566,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) { printOperand(MI, 0); O << ", "; printOperand(MI, 1); - O << '\n'; + OutStreamer.AddBlankLine(); return; } @@ -580,13 +580,13 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) { O << ", "; printOperand(MI, 1); O << ", " << (unsigned int)SH; - O << '\n'; + OutStreamer.AddBlankLine(); return; } } printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() { diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index e0cafcca7fe..9a2ce6bec17 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -19,6 +19,7 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/MC/MCAsmInfo.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" #include "llvm/Target/TargetRegistry.h" #include "llvm/ADT/StringExtras.h" @@ -44,7 +45,7 @@ namespace { virtual void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } void printInstruction(const MachineInstr *MI); // autogenerated. static const char *getRegisterName(unsigned RegNo); diff --git a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp index 965f5a18098..7a9e8dd2073 100644 --- a/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp +++ b/lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp @@ -79,7 +79,7 @@ namespace { void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) { // Call the autogenerated instruction printer routines. printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum){ diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp index cc9a800f411..fa8d13d6a40 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp @@ -321,7 +321,8 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) { if (MI->getOperand(0).getType()==MachineOperand::MO_Register && MI->getOperand(0).getReg()==0) { // Suppress offset in this case, it is not meaningful. - O << "undef\n"; + O << "undef"; + OutStreamer.AddBlankLine(); return; } else if (MI->getOperand(0).getType()==MachineOperand::MO_FPImmediate) { // This is more naturally done in printOperand, but since the only use @@ -350,7 +351,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) { } O << "+"; printOperand(MI, NOps-2); - O << '\n'; + OutStreamer.AddBlankLine(); return; } case X86::MOVPC32r: { @@ -421,7 +422,6 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) { MCInst TmpInst; MCInstLowering.Lower(MI, TmpInst); - OutStreamer.EmitInstruction(TmpInst); } diff --git a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp index b9ba61e505c..d18f55de81b 100644 --- a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp +++ b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp @@ -305,11 +305,12 @@ void XCoreAsmPrinter::EmitInstruction(const MachineInstr *MI) { unsigned src, dst, srcSR, dstSR; if (TM.getInstrInfo()->isMoveInstr(*MI, src, dst, srcSR, dstSR)) { O << "\tmov " << getRegisterName(dst) << ", "; - O << getRegisterName(src) << '\n'; + O << getRegisterName(src); + OutStreamer.AddBlankLine(); return; } printInstruction(MI); - O << '\n'; + OutStreamer.AddBlankLine(); } // Force static initialization. -- 2.34.1