rejigger the world so that EmitInstruction prints the \n at

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
This commit is contained in:
Chris Lattner 2010-02-03 01:09:55 +00:00
parent 0d883e3f84
commit d1ff72b8a7
12 changed files with 37 additions and 22 deletions

View 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";
}
}
}

View File

@ -1034,6 +1034,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
EmitAlignment(2);
printInstruction(MI);
O << '\n';
}
}

View 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);

View 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,

View File

@ -58,6 +58,7 @@ namespace {
void EmitInstruction(const MachineInstr *MI) {
printInstruction(MI);
O << '\n';
}
void printOp(const MachineOperand &MO);

View 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,

View 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);

View 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() {

View 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);

View 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){

View 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';
}

View File

@ -309,6 +309,7 @@ void XCoreAsmPrinter::EmitInstruction(const MachineInstr *MI) {
return;
}
printInstruction(MI);
O << '\n';
}
// Force static initialization.