diff options
| author | Bill Wendling <isanbard@gmail.com> | 2009-02-06 21:45:08 +0000 | 
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2009-02-06 21:45:08 +0000 | 
| commit | b6b0aa2449f1bae36bc3c4f5c1db36e668f51861 (patch) | |
| tree | 09bf08edf98e87c282054a0e3459f3521362aece /llvm/lib/Target/X86/AsmPrinter | |
| parent | 03c34d0d3c65c89e8eda1965ab550afd7b354bb3 (diff) | |
| download | bcm5719-llvm-b6b0aa2449f1bae36bc3c4f5c1db36e668f51861.tar.gz bcm5719-llvm-b6b0aa2449f1bae36bc3c4f5c1db36e668f51861.zip  | |
Record debug location information in the Dwarf writer.
A simple test program shows that debugging works. :-)
llvm-svn: 63968
Diffstat (limited to 'llvm/lib/Target/X86/AsmPrinter')
| -rw-r--r-- | llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 17 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h | 1 | 
2 files changed, 16 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index 9e0afc8d6f2..847355c50d7 100644 --- a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -207,6 +207,7 @@ void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {  ///  bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {    const Function *F = MF.getFunction(); +  this->MF = &MF;    unsigned CC = F->getCallingConv();    SetupMachineFunction(MF); @@ -718,12 +719,24 @@ bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,    return false;  } -/// printMachineInstruction -- Print out a single X86 LLVM instruction -/// MI in AT&T syntax to the current output stream. +/// printMachineInstruction -- Print out a single X86 LLVM instruction MI in +/// AT&T syntax to the current output stream.  ///  void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {    ++EmittedInsts; +  if (TAI->doesSupportDebugInformation()) { +    static DebugLoc PrevDL = DebugLoc::getUnknownLoc(); +    DebugLoc CurDL = MI->getDebugLoc(); + +    if (!CurDL.isInvalid() && !CurDL.isUnknown() && PrevDL != CurDL) { +      DebugLocTuple DLT = MF->getDebugLocTuple(CurDL); +      printLabel(DW->RecordSourceLine(DLT.Line, DLT.Col, DLT.Src)); +    } + +    PrevDL = CurDL; +  } +    // Call the autogenerated instruction printer routines.    printInstruction(MI);  } diff --git a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h index 3732ce86a86..6be9958dcf1 100644 --- a/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h +++ b/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h @@ -29,6 +29,7 @@ namespace llvm {  struct MachineJumpTableInfo;  struct VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter { +  MachineFunction *MF;    DwarfWriter *DW;    MachineModuleInfo *MMI;    const X86Subtarget *Subtarget;  | 

