[llvm] r209674 - DebugInfo: Lazily attach definition attributes to definitions.

David Blaikie dblaikie at gmail.com
Wed Jun 4 17:33:17 PDT 2014


On Tue, May 27, 2014 at 1:41 PM, Eric Christopher <echristo at gmail.com> wrote:
> Couple of small nits.
>
>> +    DIArray Subprograms = TheCU.getSubprograms();
>> +    for (unsigned i = 0, e = Subprograms.getNumElements(); i != e; ++i) {
>> +      DISubprogram SP(Subprograms.getElement(i));
>> +      if (DIE *D = SPCU->getDIE(SP))
>> +        SPCU->applySubprogramAttributes(SP, *D);
>> +    }
>
> This isn't an assert because it could be a cross CU reference right?
> Might want to add a comment to that effect.

True then, not true anymore - the code is now a bit more complicated
due to delaying subprogram DIE construction entirely (as well as
delaying the attributes). Various comments are provided in
DwarfDebug::finishSubprogramDefinitions.

>
>> +  // 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;
>
> Abort is a bit of a specific thing - that we aren't doing here.

Rephrased to use the term "stop" rather than "abort".

>
>> +
>>    applySubprogramAttributes(SP, SPDie);
>>    return &SPDie;
>>  }
>> @@ -1397,7 +1402,8 @@ void DwarfUnit::applySubprogramAttribute
>>    DIE *DeclDie = nullptr;
>>    StringRef DeclLinkageName;
>>    if (DISubprogram SPDecl = SP.getFunctionDeclaration()) {
>> -    DeclDie = getOrCreateSubprogramDIE(SPDecl);
>> +    DeclDie = getDIE(SPDecl);
>> +    assert(DeclDie);
>
> Some text in the assert?

Added text to the assert:

assert(DeclDie && "This DIE should've already been constructed when the "
                      "definition DIE was creaeted in "
                      "getOrCreateSubprogramDIE");

in r210228

- Dave

>
> -eric
>
>>      DeclLinkageName = SPDecl.getLinkageName();
>>    }
>>
>>
>> Modified: llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll?rev=209674&r1=209673&r2=209674&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll (original)
>> +++ llvm/trunk/test/DebugInfo/2010-04-06-NestedFnDbgInfo.ll Tue May 27 13:37:43 2014
>> @@ -10,10 +10,10 @@
>>  ; Check that the subprogram inside the class definition has low_pc, only
>>  ; attached to the definition.
>>  ; CHECK: [[FOO_INL:0x........]]: DW_TAG_subprogram
>> -; CHECK-NEXT: DW_AT_MIPS_linkage_name {{.*}} "_ZZN1B2fnEvEN1A3fooEv"
>> -; CHECK-NOT: NULL
>>  ; CHECK-NOT: DW_TAG
>>  ; CHECK: DW_AT_low_pc
>> +; CHECK-NOT: DW_TAG
>> +; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZZN1B2fnEvEN1A3fooEv"
>>  ; And just double check that there's no out of line definition that references
>>  ; this subprogram.
>>  ; CHECK-NOT: DW_AT_specification {{.*}} {[[FOO_INL]]}
>>
>> Modified: llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.ll?rev=209674&r1=209673&r2=209674&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.ll (original)
>> +++ llvm/trunk/test/DebugInfo/X86/concrete_out_of_line.ll Tue May 27 13:37:43 2014
>> @@ -34,17 +34,16 @@
>>  ; CHECK-NEXT: DW_AT_abstract_origin {{.*}} {[[D2_ABS:0x........]]}
>>
>>  ; CHECK: [[D1_ABS]]: DW_TAG_subprogram
>> +; CHECK-NEXT:     DW_AT_inline
>>  ; CHECK-NEXT:     DW_AT_{{.*}}linkage_name
>>  ; CHECK-NEXT:     DW_AT_specification {{.*}} {[[DTOR_DECL]]}
>> -; CHECK-NEXT:     DW_AT_inline
>> -; CHECK-NOT:     DW_AT_inline
>> -; CHECK-NOT: DW_TAG
>> +; CHECK-NOT:     DW_AT
>>  ; CHECK: [[D1_THIS_ABS:0x........]]: DW_TAG_formal_parameter
>>  ; CHECK: [[D2_ABS]]: DW_TAG_subprogram
>> +; CHECK-NEXT:     DW_AT_inline
>>  ; CHECK-NEXT:     DW_AT_{{.*}}linkage_name
>>  ; CHECK-NEXT:     DW_AT_specification {{.*}} {[[DTOR_DECL]]}
>> -; CHECK-NEXT:     DW_AT_inline
>> -; CHECK-NOT:     DW_AT_inline
>> +; CHECK-NOT:     DW_AT
>>  ; CHECK: DW_TAG
>>
>>  ; and then that a TAG_subprogram refers to it with AT_abstract_origin.
>>
>> Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll?rev=209674&r1=209673&r2=209674&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll (original)
>> +++ llvm/trunk/test/DebugInfo/X86/dbg-value-inlined-parameter.ll Tue May 27 13:37:43 2014
>> @@ -9,9 +9,9 @@
>>  ; incorrect. They should be separate
>>  ; CHECK: [[ABS:.*]]: DW_TAG_subprogram
>>  ; CHECK-NOT: DW_TAG
>> -; CHECK:   DW_AT_name {{.*}} "foo"
>> -; CHECK-NOT: DW_TAG
>>  ; CHECK:   DW_AT_high_pc
>> +; CHECK-NOT: DW_TAG
>> +; CHECK:   DW_AT_name {{.*}} "foo"
>>  ; CHECK: [[ABS_SP:.*]]:   DW_TAG_formal_parameter
>>  ; CHECK-NEXT:     DW_AT_name {{.*}} "sp"
>>  ; CHECK: [[ABS_NUMS:.*]]:  DW_TAG_formal_parameter
>>
>> Modified: llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll?rev=209674&r1=209673&r2=209674&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll (original)
>> +++ llvm/trunk/test/DebugInfo/X86/debug-info-blocks.ll Tue May 27 13:37:43 2014
>> @@ -6,16 +6,20 @@
>>  ; test that the DW_AT_location of self is at ( fbreg +{{[0-9]+}}, deref, +{{[0-9]+}} )
>>
>>  ; CHECK: DW_TAG_subprogram
>> -; CHECK: DW_AT_name{{.*}}_block_invoke
>> +; CHECK: DW_TAG_subprogram
>> +; CHECK-NOT: DW_TAG
>>  ; CHECK: DW_AT_object_pointer
>> +; CHECK-NOT: DW_TAG
>> +; CHECK: DW_AT_name{{.*}}_block_invoke
>>
>> -; CHECK-NOT: DW_TAG_subprogram
>> +; CHECK-NOT: {{DW_TAG|NULL}}
>>  ; CHECK: DW_TAG_formal_parameter
>> -; CHECK-NEXT: DW_AT_name{{.*}}.block_descriptor
>> +; CHECK-NOT: DW_TAG
>> +; CHECK: DW_AT_name{{.*}}.block_descriptor
>>  ; CHECK-NOT: DW_TAG
>>  ; CHECK: DW_AT_location
>>
>> -; CHECK-NOT: DW_TAG_subprogram
>> +; CHECK-NOT: {{DW_TAG|NULL}}
>>  ; CHECK: DW_TAG_variable
>>  ; CHECK-NEXT: DW_AT_name{{.*}}"self"
>>  ; CHECK-NOT: DW_TAG
>> @@ -31,7 +35,7 @@
>>  ; CHECK: [[A:.*]]:   DW_TAG_structure_type
>>  ; CHECK-NEXT: DW_AT_APPLE_objc_complete_type
>>  ; CHECK-NEXT: DW_AT_name{{.*}}"A"
>> -; CHECK: [[APTR]]:   DW_TAG_pointer_type [5]
>> +; CHECK: [[APTR]]:   DW_TAG_pointer_type
>>  ; CHECK-NEXT: {[[A]]}
>>
>>
>>
>> Modified: llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll?rev=209674&r1=209673&r2=209674&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll (original)
>> +++ llvm/trunk/test/DebugInfo/X86/empty-and-one-elem-array.ll Tue May 27 13:37:43 2014
>> @@ -28,11 +28,6 @@ declare void @llvm.dbg.declare(metadata,
>>  ; An empty array should not have an AT_upper_bound attribute. But an array of 1
>>  ; should.
>>
>> -; CHECK:      DW_TAG_base_type
>> -; CHECK-NEXT: DW_AT_name [DW_FORM_strp]  ( .debug_str[{{.*}}] = "int")
>> -; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1]   (0x05)
>> -; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1]  (0x04)
>> -
>>  ; int foo::b[1]:
>>  ; CHECK: DW_TAG_structure_type
>>  ; CHECK: DW_AT_name{{.*}}"foo"
>> @@ -41,6 +36,11 @@ declare void @llvm.dbg.declare(metadata,
>>  ; CHECK-NEXT: DW_AT_name [DW_FORM_strp]  ( .debug_str[{{.*}}] = "b")
>>  ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]
>>
>> +; CHECK:      DW_TAG_base_type
>> +; CHECK-NEXT: DW_AT_name [DW_FORM_strp]  ( .debug_str[{{.*}}] = "int")
>> +; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1]   (0x05)
>> +; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1]  (0x04)
>> +
>>  ; int[1]:
>>  ; CHECK:      DW_TAG_array_type [{{.*}}] *
>>  ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]
>>
>> Modified: llvm/trunk/test/DebugInfo/cross-cu-inlining.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/cross-cu-inlining.ll?rev=209674&r1=209673&r2=209674&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/cross-cu-inlining.ll (original)
>> +++ llvm/trunk/test/DebugInfo/cross-cu-inlining.ll Tue May 27 13:37:43 2014
>> @@ -23,13 +23,11 @@
>>  ; CHECK: DW_TAG_compile_unit
>>  ; CHECK:   DW_AT_name {{.*}} "a.cpp"
>>  ; CHECK:   DW_TAG_subprogram
>> +; CHECK:     DW_AT_type [DW_FORM_ref_addr] (0x00000000[[INT:.*]])
>>  ; CHECK:     DW_TAG_inlined_subroutine
>>  ; CHECK-NEXT:       DW_AT_abstract_origin {{.*}}[[ABS_FUNC:........]])
>>  ; CHECK:       DW_TAG_formal_parameter
>>  ; CHECK-NEXT:         DW_AT_abstract_origin {{.*}}[[ABS_VAR:........]])
>> -; CHECK: 0x[[INT:.*]]: DW_TAG_base_type
>> -; CHECK-NOT: DW_TAG
>> -; CHECK:   DW_AT_name {{.*}} "int"
>>
>>  ; Check the abstract definition is in the 'b.cpp' CU and doesn't contain any
>>  ; concrete information (address range or variable location)
>> @@ -40,9 +38,13 @@
>>  ; CHECK: 0x[[ABS_VAR]]: DW_TAG_formal_parameter
>>  ; CHECK-NOT: DW_TAG
>>  ; CHECK-NOT: DW_AT_location
>> -; CHECK: DW_AT_type [DW_FORM_ref_addr] (0x00000000[[INT]])
>> +; CHECK: DW_AT_type [DW_FORM_ref4] {{.*}} {0x[[INT]]}
>>  ; CHECK-NOT: DW_AT_location
>>
>> +; CHECK: 0x[[INT]]: DW_TAG_base_type
>> +; CHECK-NOT: DW_TAG
>> +; CHECK:   DW_AT_name {{.*}} "int"
>> +
>>  ; Check the concrete out of line definition references the abstract and
>>  ; provides the address range and variable location
>>  ; CHECK: DW_TAG_subprogram
>>
>> Modified: llvm/trunk/test/DebugInfo/namespace_function_definition.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/namespace_function_definition.ll?rev=209674&r1=209673&r2=209674&view=diff
>> ==============================================================================
>> --- llvm/trunk/test/DebugInfo/namespace_function_definition.ll (original)
>> +++ llvm/trunk/test/DebugInfo/namespace_function_definition.ll Tue May 27 13:37:43 2014
>> @@ -12,9 +12,9 @@
>>  ; CHECK-NEXT: DW_AT_name {{.*}} "ns"
>>  ; CHECK: DW_TAG_subprogram
>>  ; CHECK-NOT: DW_TAG
>> -; CHECK:   DW_AT_MIPS_linkage_name {{.*}} "_ZN2ns4funcEv"
>> -; CHECK-NOT: DW_TAG
>>  ; CHECK:   DW_AT_low_pc
>> +; CHECK-NOT: DW_TAG
>> +; CHECK:   DW_AT_MIPS_linkage_name {{.*}} "_ZN2ns4funcEv"
>>  ; CHECK: NULL
>>  ; CHECK: NULL
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list