DebugInfo: Lazily attach definition attributes to definitions.
authorDavid Blaikie <dblaikie@gmail.com>
Tue, 27 May 2014 18:37:43 +0000 (18:37 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Tue, 27 May 2014 18:37:43 +0000 (18:37 +0000)
commitf7221adb8ed6e60ac3e97ab528ec2e4c2e18fc79
tree94f689b8a8b08e6c0beb83482ca9d28acc469f42
parent7f91686f07df6adfe101b8835d01aa8e32128c6c
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
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll
llvm/test/DebugInfo/X86/concrete_out_of_line.ll
llvm/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
llvm/test/DebugInfo/X86/debug-info-blocks.ll
llvm/test/DebugInfo/X86/empty-and-one-elem-array.ll
llvm/test/DebugInfo/cross-cu-inlining.ll
llvm/test/DebugInfo/namespace_function_definition.ll