[PATCH] D143985: [DwarfDebug] Move emission of imported entities from beginModule() to endModule() (2/7)

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 06:26:59 PST 2023


krisb created this revision.
Herald added subscribers: mattd, gchakrabarti, asavonic, hiraditya.
Herald added a project: All.
krisb edited the summary of this revision.
krisb added reviewers: dblaikie, jmmartinez, ellis.
krisb added projects: LLVM, debug-info.
krisb published this revision for review.
Herald added subscribers: llvm-commits, jholewinski.

RFC https://discourse.llvm.org/t/rfc-dwarfdebug-fix-and-improve-handling-imported-entities-types-and-static-local-in-subprogram-and-lexical-block-scopes/68544

!Note! Extracted from the following patch for review purpose only, should
be squashed with the next patch (D144004 <https://reviews.llvm.org/D144004>) before committing.

Currently the back-end emits imported entities in `DwarfDebug::beginModule()`.
However in case an imported declaration is a function, it must point to an
abstract subprogram if it exists (see PR51501). But in `DwarfDebug::beginModule()`
the DWARF generator doesn't have information to identify if an abstract
subprogram needs to be created.

Only by entering `DwarfDebug::endModule()` all subprograms are processed,
so it's clear which subprogram DIE should be referred to. Hence, the patch moves
the emission there.

The patch is need to fix PR51501, but it only does the preliminary
work. Since it changes the order of debug entities in emitted DWARF and
therefore affect many tests it's separated from the fix for the sake of
simplifying review.

Note that there are other issues with handling an imported declaration in
`DwarfDebug::beginModule()`. They are described in more details in D114705 <https://reviews.llvm.org/D114705>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143985

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/test/DebugInfo/BPF/extern-void.ll
  llvm/test/DebugInfo/Generic/namespace.ll
  llvm/test/DebugInfo/NVPTX/debug-info.ll
  llvm/test/DebugInfo/X86/gnu-public-names.ll
  llvm/test/DebugInfo/X86/lexical-block-file-inline.ll



More information about the llvm-commits mailing list