mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
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:
@@ -351,15 +351,19 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
case TargetInstrInfo::EH_LABEL:
|
case TargetInstrInfo::EH_LABEL:
|
||||||
case TargetInstrInfo::GC_LABEL:
|
case TargetInstrInfo::GC_LABEL:
|
||||||
printLabel(II);
|
printLabel(II);
|
||||||
|
O << '\n';
|
||||||
break;
|
break;
|
||||||
case TargetInstrInfo::INLINEASM:
|
case TargetInstrInfo::INLINEASM:
|
||||||
printInlineAsm(II);
|
printInlineAsm(II);
|
||||||
|
O << '\n';
|
||||||
break;
|
break;
|
||||||
case TargetInstrInfo::IMPLICIT_DEF:
|
case TargetInstrInfo::IMPLICIT_DEF:
|
||||||
printImplicitDef(II);
|
printImplicitDef(II);
|
||||||
|
O << '\n';
|
||||||
break;
|
break;
|
||||||
case TargetInstrInfo::KILL:
|
case TargetInstrInfo::KILL:
|
||||||
printKill(II);
|
printKill(II);
|
||||||
|
O << '\n';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
EmitInstruction(II);
|
EmitInstruction(II);
|
||||||
@@ -367,7 +371,6 @@ void AsmPrinter::EmitFunctionBody() {
|
|||||||
}
|
}
|
||||||
if (VerboseAsm)
|
if (VerboseAsm)
|
||||||
EmitComments(*II);
|
EmitComments(*II);
|
||||||
O << '\n';
|
|
||||||
|
|
||||||
// FIXME: Clean up processDebugLoc.
|
// FIXME: Clean up processDebugLoc.
|
||||||
processDebugLoc(II, false);
|
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,
|
static void PrintBasicBlockLoopComments(const MachineBasicBlock &MBB,
|
||||||
const MachineLoopInfo *LI,
|
const MachineLoopInfo *LI,
|
||||||
const AsmPrinter &AP) {
|
const AsmPrinter &AP) {
|
||||||
@@ -1716,8 +1719,6 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
|
|||||||
if (!VerboseAsm)
|
if (!VerboseAsm)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool Newline = false;
|
|
||||||
|
|
||||||
if (!MI.getDebugLoc().isUnknown()) {
|
if (!MI.getDebugLoc().isUnknown()) {
|
||||||
DILocation DLT = MF->getDILocation(MI.getDebugLoc());
|
DILocation DLT = MF->getDILocation(MI.getDebugLoc());
|
||||||
|
|
||||||
@@ -1733,7 +1734,7 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
|
|||||||
O << ':' << DLT.getLineNumber();
|
O << ':' << DLT.getLineNumber();
|
||||||
if (DLT.getColumnNumber() != 0)
|
if (DLT.getColumnNumber() != 0)
|
||||||
O << ':' << DLT.getColumnNumber();
|
O << ':' << DLT.getColumnNumber();
|
||||||
Newline = true;
|
O << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for spills and reloads
|
// Check for spills and reloads
|
||||||
@@ -1748,37 +1749,29 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
|
|||||||
if (TM.getInstrInfo()->isLoadFromStackSlotPostFE(&MI, FI)) {
|
if (TM.getInstrInfo()->isLoadFromStackSlotPostFE(&MI, FI)) {
|
||||||
if (FrameInfo->isSpillSlotObjectIndex(FI)) {
|
if (FrameInfo->isSpillSlotObjectIndex(FI)) {
|
||||||
MMO = *MI.memoperands_begin();
|
MMO = *MI.memoperands_begin();
|
||||||
if (Newline) O << '\n';
|
|
||||||
O.PadToColumn(MAI->getCommentColumn());
|
O.PadToColumn(MAI->getCommentColumn());
|
||||||
O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Reload";
|
O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Reload\n";
|
||||||
Newline = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (TM.getInstrInfo()->hasLoadFromStackSlot(&MI, MMO, FI)) {
|
else if (TM.getInstrInfo()->hasLoadFromStackSlot(&MI, MMO, FI)) {
|
||||||
if (FrameInfo->isSpillSlotObjectIndex(FI)) {
|
if (FrameInfo->isSpillSlotObjectIndex(FI)) {
|
||||||
if (Newline) O << '\n';
|
|
||||||
O.PadToColumn(MAI->getCommentColumn());
|
O.PadToColumn(MAI->getCommentColumn());
|
||||||
O << MAI->getCommentString() << ' '
|
O << MAI->getCommentString() << ' '
|
||||||
<< MMO->getSize() << "-byte Folded Reload";
|
<< MMO->getSize() << "-byte Folded Reload\n";
|
||||||
Newline = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (TM.getInstrInfo()->isStoreToStackSlotPostFE(&MI, FI)) {
|
else if (TM.getInstrInfo()->isStoreToStackSlotPostFE(&MI, FI)) {
|
||||||
if (FrameInfo->isSpillSlotObjectIndex(FI)) {
|
if (FrameInfo->isSpillSlotObjectIndex(FI)) {
|
||||||
MMO = *MI.memoperands_begin();
|
MMO = *MI.memoperands_begin();
|
||||||
if (Newline) O << '\n';
|
|
||||||
O.PadToColumn(MAI->getCommentColumn());
|
O.PadToColumn(MAI->getCommentColumn());
|
||||||
O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Spill";
|
O << MAI->getCommentString() << ' ' << MMO->getSize() << "-byte Spill\n";
|
||||||
Newline = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (TM.getInstrInfo()->hasStoreToStackSlot(&MI, MMO, FI)) {
|
else if (TM.getInstrInfo()->hasStoreToStackSlot(&MI, MMO, FI)) {
|
||||||
if (FrameInfo->isSpillSlotObjectIndex(FI)) {
|
if (FrameInfo->isSpillSlotObjectIndex(FI)) {
|
||||||
if (Newline) O << '\n';
|
|
||||||
O.PadToColumn(MAI->getCommentColumn());
|
O.PadToColumn(MAI->getCommentColumn());
|
||||||
O << MAI->getCommentString() << ' '
|
O << MAI->getCommentString() << ' '
|
||||||
<< MMO->getSize() << "-byte Folded Spill";
|
<< MMO->getSize() << "-byte Folded Spill\n";
|
||||||
Newline = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1787,9 +1780,8 @@ void AsmPrinter::EmitComments(const MachineInstr &MI) const {
|
|||||||
if (TM.getInstrInfo()->isMoveInstr(MI, SrcReg, DstReg,
|
if (TM.getInstrInfo()->isMoveInstr(MI, SrcReg, DstReg,
|
||||||
SrcSubIdx, DstSubIdx)) {
|
SrcSubIdx, DstSubIdx)) {
|
||||||
if (MI.getAsmPrinterFlag(ReloadReuse)) {
|
if (MI.getAsmPrinterFlag(ReloadReuse)) {
|
||||||
if (Newline) O << '\n';
|
|
||||||
O.PadToColumn(MAI->getCommentColumn());
|
O.PadToColumn(MAI->getCommentColumn());
|
||||||
O << MAI->getCommentString() << " Reload Reuse";
|
O << MAI->getCommentString() << " Reload Reuse\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1034,6 +1034,7 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
EmitAlignment(2);
|
EmitAlignment(2);
|
||||||
|
|
||||||
printInstruction(MI);
|
printInstruction(MI);
|
||||||
|
O << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,7 +45,10 @@ namespace {
|
|||||||
return "Alpha Assembly Printer";
|
return "Alpha Assembly Printer";
|
||||||
}
|
}
|
||||||
void printInstruction(const MachineInstr *MI);
|
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);
|
static const char *getRegisterName(unsigned RegNo);
|
||||||
|
|
||||||
void printOp(const MachineOperand &MO, bool IsCallOp = false);
|
void printOp(const MachineOperand &MO, bool IsCallOp = false);
|
||||||
|
@@ -52,7 +52,10 @@ namespace {
|
|||||||
void printInstruction(const MachineInstr *MI); // autogenerated.
|
void printInstruction(const MachineInstr *MI); // autogenerated.
|
||||||
static const char *getRegisterName(unsigned RegNo);
|
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,
|
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||||
unsigned AsmVariant, const char *ExtraCode);
|
unsigned AsmVariant, const char *ExtraCode);
|
||||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||||
|
@@ -58,6 +58,7 @@ namespace {
|
|||||||
|
|
||||||
void EmitInstruction(const MachineInstr *MI) {
|
void EmitInstruction(const MachineInstr *MI) {
|
||||||
printInstruction(MI);
|
printInstruction(MI);
|
||||||
|
O << '\n';
|
||||||
}
|
}
|
||||||
void printOp(const MachineOperand &MO);
|
void printOp(const MachineOperand &MO);
|
||||||
|
|
||||||
|
@@ -184,6 +184,7 @@ void MSP430AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
MCInst TmpInst;
|
MCInst TmpInst;
|
||||||
MCInstLowering.Lower(MI, TmpInst);
|
MCInstLowering.Lower(MI, TmpInst);
|
||||||
printMCInst(&TmpInst);
|
printMCInst(&TmpInst);
|
||||||
|
O << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
static MCInstPrinter *createMSP430MCInstPrinter(const Target &T,
|
static MCInstPrinter *createMSP430MCInstPrinter(const Target &T,
|
||||||
|
@@ -75,7 +75,10 @@ namespace {
|
|||||||
void emitFrameDirective();
|
void emitFrameDirective();
|
||||||
|
|
||||||
void printInstruction(const MachineInstr *MI); // autogenerated.
|
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 EmitFunctionBodyStart();
|
||||||
virtual void EmitFunctionBodyEnd();
|
virtual void EmitFunctionBodyEnd();
|
||||||
static const char *getRegisterName(unsigned RegNo);
|
static const char *getRegisterName(unsigned RegNo);
|
||||||
|
@@ -555,6 +555,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
O << ", ";
|
O << ", ";
|
||||||
printOperand(MI, 1);
|
printOperand(MI, 1);
|
||||||
O << ", " << (unsigned int)SH;
|
O << ", " << (unsigned int)SH;
|
||||||
|
O << '\n';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -565,6 +566,7 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
printOperand(MI, 0);
|
printOperand(MI, 0);
|
||||||
O << ", ";
|
O << ", ";
|
||||||
printOperand(MI, 1);
|
printOperand(MI, 1);
|
||||||
|
O << '\n';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,11 +580,13 @@ void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
O << ", ";
|
O << ", ";
|
||||||
printOperand(MI, 1);
|
printOperand(MI, 1);
|
||||||
O << ", " << (unsigned int)SH;
|
O << ", " << (unsigned int)SH;
|
||||||
|
O << '\n';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printInstruction(MI);
|
printInstruction(MI);
|
||||||
|
O << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
|
void PPCLinuxAsmPrinter::EmitFunctionEntryLabel() {
|
||||||
|
@@ -44,6 +44,7 @@ namespace {
|
|||||||
|
|
||||||
virtual void EmitInstruction(const MachineInstr *MI) {
|
virtual void EmitInstruction(const MachineInstr *MI) {
|
||||||
printInstruction(MI);
|
printInstruction(MI);
|
||||||
|
O << '\n';
|
||||||
}
|
}
|
||||||
void printInstruction(const MachineInstr *MI); // autogenerated.
|
void printInstruction(const MachineInstr *MI); // autogenerated.
|
||||||
static const char *getRegisterName(unsigned RegNo);
|
static const char *getRegisterName(unsigned RegNo);
|
||||||
|
@@ -79,6 +79,7 @@ namespace {
|
|||||||
void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||||
// Call the autogenerated instruction printer routines.
|
// Call the autogenerated instruction printer routines.
|
||||||
printInstruction(MI);
|
printInstruction(MI);
|
||||||
|
O << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum){
|
void SystemZAsmPrinter::printPCRelImmOperand(const MachineInstr *MI, int OpNum){
|
||||||
|
@@ -448,6 +448,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
}
|
}
|
||||||
O << "+";
|
O << "+";
|
||||||
printOperand(MI, NOps-2);
|
printOperand(MI, NOps-2);
|
||||||
|
O << '\n';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case X86::MOVPC32r: {
|
case X86::MOVPC32r: {
|
||||||
@@ -475,6 +476,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
TmpInst.setOpcode(X86::POP32r);
|
TmpInst.setOpcode(X86::POP32r);
|
||||||
TmpInst.getOperand(0) = MCOperand::CreateReg(MI->getOperand(0).getReg());
|
TmpInst.getOperand(0) = MCOperand::CreateReg(MI->getOperand(0).getReg());
|
||||||
printMCInst(&TmpInst);
|
printMCInst(&TmpInst);
|
||||||
|
O << '\n';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,6 +514,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
TmpInst.addOperand(MCOperand::CreateReg(MI->getOperand(1).getReg()));
|
TmpInst.addOperand(MCOperand::CreateReg(MI->getOperand(1).getReg()));
|
||||||
TmpInst.addOperand(MCOperand::CreateExpr(DotExpr));
|
TmpInst.addOperand(MCOperand::CreateExpr(DotExpr));
|
||||||
printMCInst(&TmpInst);
|
printMCInst(&TmpInst);
|
||||||
|
O << '\n';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -521,5 +524,6 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
|
|
||||||
|
|
||||||
printMCInst(&TmpInst);
|
printMCInst(&TmpInst);
|
||||||
|
O << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -309,6 +309,7 @@ void XCoreAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printInstruction(MI);
|
printInstruction(MI);
|
||||||
|
O << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force static initialization.
|
// Force static initialization.
|
||||||
|
Reference in New Issue
Block a user