[PATCH] D114350: [DwarfCompileUnit] Set parent DIE right after creating a local entity

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 22 00:45:28 PST 2021


krisb created this revision.
krisb added reviewers: dblaikie, ellis.
Herald added a subscriber: hiraditya.
krisb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

No functional changes intended.

Before this patch DwarfCompileUnit::createScopeChildrenDIE() and
DwarfCompileUnit::createAndAddScopeChildrenDIE() used to emit child subtrees
and then when all the children get created, attach them to a parent scope DIE.
However, when a DIE doesn't have a parent, all the requests for its unit DIE
fail.

Currently, it is not a big issue since it isn't usually needed to know unit DIE
for a local (function-scoped) entity. But once we introduce lexical blocks as
a valid scope for global variables (static locals) and type DIEs, any requests
for a unit DIE need to be guarded against local scope due to the potential
absence of the DIE's parent.

To avoid the aforementioned issue, this patch refactors a few DwarfCompileUnit
methods to support the idea of attaching a DIE to its parent as close to the
creation of this DIE as possible.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114350

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114350.388808.patch
Type: text/x-patch
Size: 7185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211122/cb91b34e/attachment.bin>


More information about the llvm-commits mailing list