aboutsummaryrefslogtreecommitdiffstats
path: root/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
commitac06d004a0ac856a747e612708ad4541b18aa165 (patch)
treeea786b074ec2a322551e998ad6994166d3f94592 /lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
parent8fcf170a66de974989f730d1e0d01d5fc63d6b8b (diff)
downloadexternal_llvm-ac06d004a0ac856a747e612708ad4541b18aa165.zip
external_llvm-ac06d004a0ac856a747e612708ad4541b18aa165.tar.gz
external_llvm-ac06d004a0ac856a747e612708ad4541b18aa165.tar.bz2
Record debug location information in the Dwarf writer.
A simple test program shows that debugging works. :-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63968 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp')
-rw-r--r--lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
index 9e0afc8..847355c 100644
--- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
+++ b/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);
}