From: Chris Lattner Date: Wed, 9 Sep 2009 20:34:59 +0000 (+0000) Subject: hoist the call to processDebugLoc out of the generated X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=634cca377a8254cfe8a5afe99ef2e6c6db7f0c6b;p=oota-llvm.git hoist the call to processDebugLoc out of the generated asm printer into the "printInstruction" routine. This fixes a problem where the experimental asmprinter would drop debug labels in some cases, and fixes issues on ppc/xcore where pseudo instructions like "mr" didn't get debug locs properly. It is annoying that this moves the call from one place into each target, but a future set of more invasive refactorings will fix that problem. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81377 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 34ad2d47987..59c2174020a 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -1029,6 +1029,7 @@ void ARMAsmPrinter::printMachineInstruction(const MachineInstr *MI) { }} // Call the autogenerated instruction printer routines. + processDebugLoc(MI->getDebugLoc()); printInstruction(MI); } diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index fde999fd89a..230f0f52803 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -408,15 +408,14 @@ bool SPUAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, /// void SPUAsmPrinter::printMachineInstruction(const MachineInstr *MI) { ++EmittedInsts; + processDebugLoc(MI->getDebugLoc()); printInstruction(MI); } /// runOnMachineFunction - This uses the printMachineInstruction() /// method to print assembly for each instruction. /// -bool -LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) -{ +bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) { this->MF = &MF; SetupMachineFunction(MF); diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 704a439db26..a92aa4850ef 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -556,6 +556,8 @@ void PPCAsmPrinter::printPredicateOperand(const MachineInstr *MI, unsigned OpNo, /// void PPCAsmPrinter::printMachineInstruction(const MachineInstr *MI) { ++EmittedInsts; + + processDebugLoc(MI->getDebugLoc()); // Check for slwi/srwi mnemonics. if (MI->getOpcode() == PPC::RLWINM) { diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index e608f7ec37a..168034641b8 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -127,6 +127,7 @@ bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) { for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end(); II != E; ++II) { // Print the assembly for the instruction. + processDebugLoc(II->getDebugLoc()); printInstruction(II); ++EmittedInsts; } diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 2d76916f85c..7b91819f979 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -695,6 +695,8 @@ bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) { ++EmittedInsts; + processDebugLoc(MI->getDebugLoc()); + // Call the autogenerated instruction printer routines. if (NewAsmPrinter) printInstructionThroughMCStreamer(MI); diff --git a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp index 11813de0e60..cc8c74b7a48 100644 --- a/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp @@ -433,6 +433,8 @@ bool X86IntelAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI, void X86IntelAsmPrinter::printMachineInstruction(const MachineInstr *MI) { ++EmittedInsts; + processDebugLoc(MI->getDebugLoc()); + // Call the autogenerated instruction printer routines. printInstruction(MI); } diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp index ccc12d9e0b9..e27c83b5ddb 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp @@ -266,9 +266,7 @@ MCOperand X86ATTAsmPrinter::LowerSymbolOperand(const MachineOperand &MO, void X86ATTAsmPrinter:: printInstructionThroughMCStreamer(const MachineInstr *MI) { - MCInst TmpInst; - switch (MI->getOpcode()) { case TargetInstrInfo::DBG_LABEL: case TargetInstrInfo::EH_LABEL: diff --git a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp index 9ee0e86da1d..801a1b33c85 100644 --- a/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp +++ b/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp @@ -355,6 +355,8 @@ bool XCoreAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNo, void XCoreAsmPrinter::printMachineInstruction(const MachineInstr *MI) { ++EmittedInsts; + processDebugLoc(MI->getDebugLoc()); + // Check for mov mnemonic unsigned src, dst, srcSR, dstSR; if (TM.getInstrInfo()->isMoveInstr(*MI, src, dst, srcSR, dstSR)) { diff --git a/utils/TableGen/AsmWriterEmitter.cpp b/utils/TableGen/AsmWriterEmitter.cpp index 1e85ff9b7f2..34dc30f6048 100644 --- a/utils/TableGen/AsmWriterEmitter.cpp +++ b/utils/TableGen/AsmWriterEmitter.cpp @@ -726,8 +726,6 @@ void AsmWriterEmitter::run(raw_ostream &O) { } O << "\";\n\n"; - O << " processDebugLoc(MI->getDebugLoc());\n\n"; - O << "\n#ifndef NO_ASM_WRITER_BOILERPLATE\n"; O << " if (MI->getOpcode() == TargetInstrInfo::INLINEASM) {\n"