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
This commit is contained in:
Chris Lattner 2009-09-09 20:34:59 +00:00
parent 9647994e09
commit 634cca377a
9 changed files with 12 additions and 7 deletions

View File

@ -1029,6 +1029,7 @@ void ARMAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
}}
// Call the autogenerated instruction printer routines.
processDebugLoc(MI->getDebugLoc());
printInstruction(MI);
}

View File

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

View File

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

View File

@ -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;
}

View File

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

View File

@ -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);
}

View File

@ -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:

View File

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

View File

@ -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"