hoist the call to processDebugLoc out of the generated
authorChris Lattner <sabre@nondot.org>
Wed, 9 Sep 2009 20:34:59 +0000 (20:34 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 9 Sep 2009 20:34:59 +0000 (20:34 +0000)
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

lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
utils/TableGen/AsmWriterEmitter.cpp

index 34ad2d479878ecf24f82922ce264fe4e2810efdc..59c2174020a111855443dc15bb00541304463184 100644 (file)
@@ -1029,6 +1029,7 @@ void ARMAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
   }}
 
   // Call the autogenerated instruction printer routines.
+  processDebugLoc(MI->getDebugLoc());
   printInstruction(MI);
 }
 
index fde999fd89a5c504d2f73f2c9c60c366b719b3a7..230f0f5280369f4f3783ed045df6d73515f4aa0b 100644 (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);
index 704a439db26fa3084af37510fcdff5e957f14488..a92aa4850efd936507c5c84c055bd22d8d157114 100644 (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) {
index e608f7ec37a3df5bb60a43c8a7e0bbb68c0410df..168034641b89d478fa1a8fee6f070508d0b82251 100644 (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;
     }
index 2d76916f85c6e446cdf5b526c76905098ad24045..7b91819f9798c478abfe37db36cbf43e7a00f814 100644 (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);
index 11813de0e6088a084fefa523051186b3e38de554..cc8c74b7a484616f8bd419ffb7e1be4c2a9d6de9 100644 (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);
 }
index ccc12d9e0b9d54817c0a7624aaea211ff603c70e..e27c83b5ddbfbec40679f074c63b0e4ec22e23bf 100644 (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:
index 9ee0e86da1d073191daa370f14d1d44da694fb55..801a1b33c8563d3b1675f45aea67d04a87a9d5d7 100644 (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)) {
index 1e85ff9b7f268ccc7a6a1f73b0e2d161da42162a..34dc30f60483185862c59ae26490ccc8fe7986ae 100644 (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"