[PATCH] D82084: [DebugInfo] Refactored out `debug_line.dwo` emission from `DwarfTypeUnit` to `DwarfDebug`

Sourabh Singh Tomar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 03:18:04 PDT 2020


SouraVX updated this revision to Diff 278980.
SouraVX added a comment.

Tried one more time disregarding both the approach followed previously.
This time finally worked out(in a much cleaner way).
It exposes `getDwoLineTable` private method. But IMO that's needed
anyways, since it will used/needed subsequently in D81476 <https://reviews.llvm.org/D81476>.

@dblaikie, Could you please share your thoughts on this.
I hope this should avoid the rework from your side.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82084/new/

https://reviews.llvm.org/D82084

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h


Index: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -343,7 +343,6 @@
   uint64_t TypeSignature;
   const DIE *Ty;
   DwarfCompileUnit &CU;
-  MCDwarfDwoLineTable *SplitLineTable;
   bool UsedLineTable = false;
 
   unsigned getOrCreateSourceID(const DIFile *File) override;
@@ -352,7 +351,7 @@
 
 public:
   DwarfTypeUnit(DwarfCompileUnit &CU, AsmPrinter *A, DwarfDebug *DW,
-                DwarfFile *DWU, MCDwarfDwoLineTable *SplitLineTable = nullptr);
+                DwarfFile *DWU);
 
   void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
   void setType(const DIE *Ty) { this->Ty = Ty; }
Index: llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -95,11 +95,8 @@
 }
 
 DwarfTypeUnit::DwarfTypeUnit(DwarfCompileUnit &CU, AsmPrinter *A,
-                             DwarfDebug *DW, DwarfFile *DWU,
-                             MCDwarfDwoLineTable *SplitLineTable)
-    : DwarfUnit(dwarf::DW_TAG_type_unit, CU.getCUNode(), A, DW, DWU), CU(CU),
-      SplitLineTable(SplitLineTable) {
-}
+                             DwarfDebug *DW, DwarfFile *DWU)
+    : DwarfUnit(dwarf::DW_TAG_type_unit, CU.getCUNode(), A, DW, DWU), CU(CU) {}
 
 DwarfUnit::~DwarfUnit() {
   for (unsigned j = 0, M = DIEBlocks.size(); j < M; ++j)
@@ -325,6 +322,7 @@
 }
 
 unsigned DwarfTypeUnit::getOrCreateSourceID(const DIFile *File) {
+  MCDwarfDwoLineTable *SplitLineTable = DD->getDwoLineTable(getCU());
   if (!SplitLineTable)
     return getCU().getOrCreateSourceID(File);
   if (!UsedLineTable) {
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -421,7 +421,6 @@
   // Identify a debugger for "tuning" the debug info.
   DebuggerKind DebuggerTuning = DebuggerKind::Default;
 
-  MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
 
   const SmallVectorImpl<std::unique_ptr<DwarfCompileUnit>> &getUnits() {
     return InfoHolder.getUnits();
@@ -642,6 +641,8 @@
   void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,
                             DIE &Die, const DICompositeType *CTy);
 
+  MCDwarfDwoLineTable *getDwoLineTable(const DwarfCompileUnit &);
+
   class NonTypeUnitContext {
     DwarfDebug *DD;
     decltype(DwarfDebug::TypeUnitsUnderConstruction) TypeUnitsUnderConstruction;
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -3233,8 +3233,7 @@
   bool TopLevelType = TypeUnitsUnderConstruction.empty();
   AddrPool.resetUsedFlag();
 
-  auto OwnedUnit = std::make_unique<DwarfTypeUnit>(CU, Asm, this, &InfoHolder,
-                                                    getDwoLineTable(CU));
+  auto OwnedUnit = std::make_unique<DwarfTypeUnit>(CU, Asm, this, &InfoHolder);
   DwarfTypeUnit &NewTU = *OwnedUnit;
   DIE &UnitDie = NewTU.getUnitDie();
   TypeUnitsUnderConstruction.emplace_back(std::move(OwnedUnit), CTy);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82084.278980.patch
Type: text/x-patch
Size: 3401 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200718/04e5bfd7/attachment.bin>


More information about the llvm-commits mailing list