[all-commits] [llvm/llvm-project] 904328: [DwarfCompileUnit] Set parent DIE right after crea...

chbessonova via All-commits all-commits at lists.llvm.org
Sat Nov 27 08:02:08 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 904328932699cd5e0eefab2c81e4f51421fd3f33
      https://github.com/llvm/llvm-project/commit/904328932699cd5e0eefab2c81e4f51421fd3f33
  Author: Kristina Bessonova <kbessonova at accesssoftek.com>
  Date:   2021-11-27 (Sat, 27 Nov 2021)

  Changed paths:
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
    M llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h

  Log Message:
  -----------
  [DwarfCompileUnit] Set parent DIE right after creating a local entity

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, this 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.

Reviewed By: ellis

Differential Revision: https://reviews.llvm.org/D114350




More information about the All-commits mailing list