Add support to handle debug info attached to an instruction.
This is not yet enabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83400 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/CodeGen/DwarfWriter.h b/include/llvm/CodeGen/DwarfWriter.h
index 46be8d2..e7a2f66 100644
--- a/include/llvm/CodeGen/DwarfWriter.h
+++ b/include/llvm/CodeGen/DwarfWriter.h
@@ -110,9 +110,10 @@
/// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
unsigned RecordInlinedFnEnd(DISubprogram SP);
+ void SetDbgScopeBeginLabels(const MachineInstr *MI, unsigned L);
+ void SetDbgScopeEndLabels(const MachineInstr *MI, unsigned L);
};
-
} // end llvm namespace
#endif
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index f149f10..3a7fe0e 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1363,12 +1363,18 @@
DebugLocTuple CurDLT = MF->getDebugLocTuple(DL);
if (BeforePrintingInsn) {
if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT) {
- printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,
- CurDLT.CompileUnit));
- O << '\n';
+ unsigned L = DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,
+ CurDLT.CompileUnit);
+ printLabel(L);
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+ DW->SetDbgScopeBeginLabels(MI, L);
+#endif
+ } else {
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+ DW->SetDbgScopeEndLabels(MI, 0);
+#endif
}
- }
-
+ }
PrevDLT = CurDLT;
}
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index cd4fd76..5b3f3ce 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1322,7 +1322,6 @@
Parent->AddScope(Slot);
else
// First function is top level function.
- // FIXME - Dpatel - What is FunctionDbgScope ?
if (!FunctionDbgScope)
FunctionDbgScope = Slot;
@@ -1901,6 +1900,12 @@
if (TimePassesIsEnabled)
DebugTimer->startTimer();
+#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
+ if (!ExtractScopeInformation(MF))
+ return;
+ CollectVariableInfo();
+#endif
+
// Begin accumulating function debug information.
MMI->BeginFunction(MF);
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index bebf8e0..0638d35 100644
--- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -119,3 +119,9 @@
return DD->RecordInlinedFnEnd(SP);
}
+void DwarfWriter::SetDbgScopeBeginLabels(const MachineInstr *MI, unsigned L) {
+ DD->SetDbgScopeEndLabels(MI, L);
+}
+void DwarfWriter::SetDbgScopeEndLabels(const MachineInstr *MI, unsigned L) {
+ DD->SetDbgScopeBeginLabels(MI, L);
+}
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp
index 0bec2cf..bccff16 100644
--- a/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -425,7 +425,9 @@
if (AllocaLocation)
MMI->setVariableDbgInfo(DI->getVariable(), AllocaLocation, FI);
}
+#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
DW->RecordVariable(DI->getVariable(), FI);
+#endif
return true;
}
case Intrinsic::eh_exception: {