diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-05-27 18:37:43 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-05-27 18:37:43 +0000 |
commit | f7221adb8ed6e60ac3e97ab528ec2e4c2e18fc79 (patch) | |
tree | 94f689b8a8b08e6c0beb83482ca9d28acc469f42 /llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | |
parent | 7f91686f07df6adfe101b8835d01aa8e32128c6c (diff) | |
download | bcm5719-llvm-f7221adb8ed6e60ac3e97ab528ec2e4c2e18fc79.tar.gz bcm5719-llvm-f7221adb8ed6e60ac3e97ab528ec2e4c2e18fc79.zip |
DebugInfo: Lazily attach definition attributes to definitions.
This is a precursor to fixing inlined debug info where the concrete,
out-of-line definition may preceed any inlined usage. To cope with this,
the attributes that may appear on the concrete definition or the
abstract definition are delayed until the end of the module. Then, if an
abstract definition was created, it is referenced (and no other
attributes are added to the out-of-line definition), otherwise the
attributes are added directly to the out-of-line definition.
In a couple of cases this causes not just reordering of attributes, but
reordering of types. When the creation of the attribute is delayed, if
that creation would create a type (such as for a DW_AT_type attribute)
then other top level DIEs may've been constructed during the delay,
causing the referenced type to be created and added after those
intervening DIEs. In the extreme case, in cross-cu-inlining.ll, this
actually causes the DW_TAG_basic_type for "int" to move from one CU to
another.
llvm-svn: 209674
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index c6e47ec0720..2707f8b73d8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1389,6 +1389,11 @@ DIE *DwarfUnit::getOrCreateSubprogramDIE(DISubprogram SP) { // DW_TAG_inlined_subroutine may refer to this DIE. DIE &SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP); + // Abort here and fill this in later, depending on whether or not this + // subprogram turns out to have inlined instances or not. + if (SP.isDefinition()) + return &SPDie; + applySubprogramAttributes(SP, SPDie); return &SPDie; } @@ -1397,7 +1402,8 @@ void DwarfUnit::applySubprogramAttributes(DISubprogram SP, DIE &SPDie) { DIE *DeclDie = nullptr; StringRef DeclLinkageName; if (DISubprogram SPDecl = SP.getFunctionDeclaration()) { - DeclDie = getOrCreateSubprogramDIE(SPDecl); + DeclDie = getDIE(SPDecl); + assert(DeclDie); DeclLinkageName = SPDecl.getLinkageName(); } |