[PATCH] D77489: [DebugInfo]: Allow DwarfCompileUnit to have line table symbol
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 5 01:35:09 PDT 2020
SouraVX created this revision.
SouraVX added reviewers: dblaikie, probinson, jini.susan.george.
SouraVX added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya, aprantl.
Herald added a project: LLVM.
Previously line table symbol was represented as `DIE::value_iterator` inside `DwarfCompileUnit` and subsequent function `intStmtList` was used to create a local `MCSymbol` to initialize it.
This patch removes `DIE::value_iterator` from `DwarfCompileUnit` and intoduce `MCSymbol` for representing this units symbol for `debug_line` section. As a result `applyStmtList` is also modified to utilize this. Further more a helper function `getLineTableStartSym` is also introduced to get this symbol, this would be used by clients which need to access this line table, i.e `debug_macro`.
This patch is based on @dblaikie comment https://reviews.llvm.org/D72828#1958625 on D72828 <https://reviews.llvm.org/D72828>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77489
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
Index: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
+++ llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
@@ -47,9 +47,9 @@
unsigned UniqueID;
bool HasRangeLists = false;
- /// The attribute index of DW_AT_stmt_list in the compile unit DIE, avoiding
- /// the need to search for it in applyStmtList.
- DIE::value_iterator StmtListValue;
+ /// The start of the unit line section, this is also
+ /// reused in appyStmtList.
+ MCSymbol *LineTableStartSym;
/// Skeleton unit associated with this unit.
DwarfCompileUnit *Skeleton = nullptr;
@@ -123,6 +123,9 @@
/// Apply the DW_AT_stmt_list from this compile unit to the specified DIE.
void applyStmtList(DIE &D);
+ /// Get line table start symbol for this unit.
+ MCSymbol *getLineTableStartSym() const { return LineTableStartSym; }
+
/// A pair of GlobalVariable and DIExpression.
struct GlobalExpr {
const GlobalVariable *Var;
Index: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -351,8 +351,6 @@
if (CUNode->isDebugDirectivesOnly())
return;
- // Define start line table label for each Compile Unit.
- MCSymbol *LineTableStartSym;
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
if (DD->useSectionsAsReferences()) {
LineTableStartSym = TLOF.getDwarfLineSection()->getBeginSymbol();
@@ -366,13 +364,14 @@
// left in the skeleton CU and so not included.
// The line table entries are not always emitted in assembly, so it
// is not okay to use line_table_start here.
- StmtListValue =
addSectionLabel(getUnitDie(), dwarf::DW_AT_stmt_list, LineTableStartSym,
TLOF.getDwarfLineSection()->getBeginSymbol());
}
void DwarfCompileUnit::applyStmtList(DIE &D) {
- D.addValue(DIEValueAllocator, *StmtListValue);
+ const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
+ addSectionLabel(D, dwarf::DW_AT_stmt_list, LineTableStartSym,
+ TLOF.getDwarfLineSection()->getBeginSymbol());
}
void DwarfCompileUnit::attachLowHighPC(DIE &D, const MCSymbol *Begin,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77489.255126.patch
Type: text/x-patch
Size: 2352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200405/d4eeb907/attachment.bin>
More information about the llvm-commits
mailing list