[llvm] [BOLT][DWARF] Add support for cross-cu references for debug-names (PR #86015)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 13:04:51 PDT 2024


================
@@ -68,6 +68,16 @@ class DWARF5AcceleratorTable {
   std::unique_ptr<DebugBufferVector> releaseBuffer() {
     return std::move(FullTableBuffer);
   }
+  /// Adds a DIE that is referenced across CUs.
+  void addCrossCUDie(const DIE *Die) {
+    CrossCUDies.insert({Die->getOffset(), Die});
+  }
+  /// Returns true if the DIE can generate an entry for a cross cu reference.
+  /// This only checks TAGs of a DIE because when this is invoked DIE might not
+  /// be fully constructed.
----------------
ayermolo wrote:

So for actual Entry creation TAG and other factors are used. So this is actually more permissive so that if the TAG **can** generate an entry referenced cross-cu DIE will be tracked. This does have some memory overhead implications because we can end up tracking referenced cross-cu DIEs whose sources will not have debug_names entries. Although I think more often then not it will end up with an Entry.
Alternative is to scan through AddRefernces vector once everything is constructed (adding to runtime), or parsing DWARFDIE which duplicates the check logic/adds complexity.

https://github.com/llvm/llvm-project/pull/86015


More information about the llvm-commits mailing list