[all-commits] [llvm/llvm-project] 79d313: [DwarfDebug] Move emission of global vars, types a...

chbessonova via All-commits all-commits at lists.llvm.org
Sat Dec 4 04:10:35 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 79d3132998b2828be8f7d2ec411f91fb11b3e01f
      https://github.com/llvm/llvm-project/commit/79d3132998b2828be8f7d2ec411f91fb11b3e01f
  Author: Kristina Bessonova <kbessonova at accesssoftek.com>
  Date:   2021-12-04 (Sat, 04 Dec 2021)

  Changed paths:
    M lld/test/wasm/debuginfo.test
    M llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    M llvm/test/CodeGen/ARM/2011-01-19-MergedGlobalDbg.ll
    M llvm/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
    M llvm/test/DebugInfo/AMDGPU/variable-locations.ll
    M llvm/test/DebugInfo/BPF/extern-void.ll
    M llvm/test/DebugInfo/Generic/cross-cu-linkonce-distinct.ll
    M llvm/test/DebugInfo/Generic/debug-info-qualifiers.ll
    M llvm/test/DebugInfo/Generic/debug-names-linkage-name.ll
    M llvm/test/DebugInfo/Generic/enum-types.ll
    M llvm/test/DebugInfo/Generic/incorrect-variable-debugloc.ll
    M llvm/test/DebugInfo/Generic/namespace.ll
    M llvm/test/DebugInfo/Generic/varargs.ll
    M llvm/test/DebugInfo/MIR/AArch64/implicit-def-dead-scope.mir
    M llvm/test/DebugInfo/NVPTX/debug-addr-class.ll
    M llvm/test/DebugInfo/NVPTX/debug-info.ll
    M llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
    M llvm/test/DebugInfo/PowerPC/strict-dwarf.ll
    M llvm/test/DebugInfo/X86/2011-09-26-GlobalVarContext.ll
    M llvm/test/DebugInfo/X86/DW_AT_calling-convention.ll
    M llvm/test/DebugInfo/X86/align_cpp11.ll
    M llvm/test/DebugInfo/X86/align_objc.ll
    M llvm/test/DebugInfo/X86/arange-and-stub.ll
    M llvm/test/DebugInfo/X86/containing-type-extension-rust.ll
    M llvm/test/DebugInfo/X86/debug-info-access.ll
    M llvm/test/DebugInfo/X86/debug-info-blocks.ll
    M llvm/test/DebugInfo/X86/debug-info-static-member.ll
    M llvm/test/DebugInfo/X86/debug-loc-offset.mir
    M llvm/test/DebugInfo/X86/dwarf-aranges.ll
    M llvm/test/DebugInfo/X86/dwarf-linkage-names.ll
    M llvm/test/DebugInfo/X86/dwarfdump-DIImportedEntity_elements.ll
    M llvm/test/DebugInfo/X86/generate-odr-hash.ll
    M llvm/test/DebugInfo/X86/gnu-public-names.ll
    M llvm/test/DebugInfo/X86/lexical-block-file-inline.ll
    M llvm/test/DebugInfo/X86/linkage-name.ll
    M llvm/test/DebugInfo/X86/namelist1.ll
    M llvm/test/DebugInfo/X86/sret.ll
    M llvm/test/DebugInfo/X86/subprogram-across-cus.ll
    M llvm/test/DebugInfo/X86/template.ll
    M llvm/test/DebugInfo/X86/tls.ll
    M llvm/test/DebugInfo/X86/vla-global.ll
    M llvm/test/DebugInfo/attr-btf_tag.ll
    M llvm/test/MC/WebAssembly/debug-info.ll
    M llvm/test/MC/WebAssembly/debug-info64.ll
    M llvm/test/MC/WebAssembly/dwarfdump.ll
    M llvm/test/MC/WebAssembly/dwarfdump64.ll

  Log Message:
  -----------
  [DwarfDebug] Move emission of global vars, types and imports to endModule()

This patch proposes to move emission of global variables, types,
imported entities, etc from DwarfDebug::beginModule() to DwarfDebug::endModule().
Effectively, this changes nothing but the order of debug entities which
will be as follows:
* subprograms (including related context, local variables/labels,
  local imported entities; related types can be created as a part of
  the emission of local entities of an abstract subprogram);
* global variables (including related context and types);
* retained types and enums;
* non-local-scoped imported entities;
* basic types;
* other types left (as a part of local variables attributes emission).

Note that the order of emitted compile units may also be changed as now we emit
units that contain subprograms first and then all other non-empty units.

The motivation behind this change is the following:
(1) DwarfDebug::beginModule() is run at the very beginning of backend's pipeline,
    from this time IR can be significantly changed by target-specific passes.
    If it happens for debug metadata of global entities, those changes will not
    be reflected in the emitted DWARF.
(2) imported subprogram names should refer to an abstract subprogram if it exists,
    but it isn't known in DwarfDebug::beginModule() (it's possible to make some
    guesses based on location info, but it's not quite reliable);
(3) aforementioned entities if they are scoped within a bracketed block
    (subject of D113741) couldn't be emitted in DwarfDebug::beginModule()
    (they need parent emitted first). Another problem is if to try to gather
    some information about local entities and defer their emission
    (till subprogram's processing or DwarfDebug::endModule()) all the gathered
    details might be irrelevant / invalid by the time the entities are being
    emitted (because of (1)).

Reviewed By: dblaikie

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




More information about the All-commits mailing list