diff options
author | Kristina Bessonova <kbessonova@accesssoftek.com> | 2021-12-04 14:08:10 +0200 |
---|---|---|
committer | Kristina Bessonova <kbessonova@accesssoftek.com> | 2021-12-04 14:10:01 +0200 |
commit | 79d3132998b2828be8f7d2ec411f91fb11b3e01f (patch) | |
tree | 9eb44f124af0030c19bb7ec05eb0624e2a7361c4 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | fd26417a74034ee49c5de711266552e19f6a21ad (diff) | |
download | llvm-79d3132998b2828be8f7d2ec411f91fb11b3e01f.zip llvm-79d3132998b2828be8f7d2ec411f91fb11b3e01f.tar.gz llvm-79d3132998b2828be8f7d2ec411f91fb11b3e01f.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions