Update processDebugLoc() so that it can be used to process debug info before and after printing an instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83363 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 5006939..00f3980 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1353,18 +1353,20 @@
/// processDebugLoc - Processes the debug information of each machine
/// instruction's DebugLoc.
-void AsmPrinter::processDebugLoc(const MachineInstr *MI) {
+void AsmPrinter::processDebugLoc(const MachineInstr *MI,
+ bool BeforePrintingInsn) {
if (!MAI || !DW)
return;
DebugLoc DL = MI->getDebugLoc();
if (MAI->doesSupportDebugInformation() && DW->ShouldEmitDwarfDebug()) {
if (!DL.isUnknown()) {
DebugLocTuple CurDLT = MF->getDebugLocTuple(DL);
-
- if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT) {
- printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,
- CurDLT.CompileUnit));
- O << '\n';
+ if (BeforePrintingInsn) {
+ if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT) {
+ printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,
+ CurDLT.CompileUnit));
+ O << '\n';
+ }
}
PrevDLT = CurDLT;