summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2009-02-06 21:45:08 +0000
committerBill Wendling <isanbard@gmail.com>2009-02-06 21:45:08 +0000
commitb6b0aa2449f1bae36bc3c4f5c1db36e668f51861 (patch)
tree09bf08edf98e87c282054a0e3459f3521362aece /llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
parent03c34d0d3c65c89e8eda1965ab550afd7b354bb3 (diff)
downloadbcm5719-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/X86ATTAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp17
1 files changed, 15 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);
}
OpenPOWER on IntegriCloud