mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Debug Info: use createAndAddDIE for newly-created Subprogram DIEs.
More patches will be submitted to convert "new DIE(" to use createAddAndDIE in DwarfCompileUnit.cpp. This will simplify implementation of addDIEEntry where we have to decide between ref4 and ref_addr, because DIEs that can be shared across CU will be added to a CU already. Reviewed off-list by Eric. llvm-svn: 193567
This commit is contained in:
parent
2eadeecfe9
commit
3ff85b85e8
@ -1356,12 +1356,14 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
|
|||||||
if (SPDie)
|
if (SPDie)
|
||||||
return SPDie;
|
return SPDie;
|
||||||
|
|
||||||
SPDie = new DIE(dwarf::DW_TAG_subprogram);
|
DISubprogram SPDecl = SP.getFunctionDeclaration();
|
||||||
|
if (SPDecl.isSubprogram())
|
||||||
|
// Add subprogram definitions to the CU die directly.
|
||||||
|
ContextDIE = CUDie.get();
|
||||||
|
|
||||||
// DW_TAG_inlined_subroutine may refer to this DIE.
|
// DW_TAG_inlined_subroutine may refer to this DIE.
|
||||||
insertDIE(SP, SPDie);
|
SPDie = createAndAddDIE(dwarf::DW_TAG_subprogram, *ContextDIE, SP);
|
||||||
|
|
||||||
DISubprogram SPDecl = SP.getFunctionDeclaration();
|
|
||||||
DIE *DeclDie = NULL;
|
DIE *DeclDie = NULL;
|
||||||
if (SPDecl.isSubprogram())
|
if (SPDecl.isSubprogram())
|
||||||
DeclDie = getOrCreateSubprogramDIE(SPDecl);
|
DeclDie = getOrCreateSubprogramDIE(SPDecl);
|
||||||
@ -1375,15 +1377,9 @@ DIE *CompileUnit::getOrCreateSubprogramDIE(DISubprogram SP) {
|
|||||||
// Refer function declaration directly.
|
// Refer function declaration directly.
|
||||||
addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie);
|
addDIEEntry(SPDie, dwarf::DW_AT_specification, DeclDie);
|
||||||
|
|
||||||
// Add subprogram definitions to the CU die directly.
|
|
||||||
addDie(SPDie);
|
|
||||||
|
|
||||||
return SPDie;
|
return SPDie;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to context owner.
|
|
||||||
ContextDIE->addChild(SPDie);
|
|
||||||
|
|
||||||
// Add the linkage name if we have one.
|
// Add the linkage name if we have one.
|
||||||
StringRef LinkageName = SP.getLinkageName();
|
StringRef LinkageName = SP.getLinkageName();
|
||||||
if (!LinkageName.empty())
|
if (!LinkageName.empty())
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
; CHECK: DW_TAG
|
; CHECK: DW_TAG
|
||||||
; CHECK: DW_TAG_class_type
|
; CHECK: DW_TAG_class_type
|
||||||
; CHECK: DW_AT_object_pointer [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[PARAM:0x[0-9a-f]*]]})
|
; CHECK: DW_AT_object_pointer [DW_FORM_ref4] (cu + 0x{{[0-9a-f]*}} => {[[PARAM:0x[0-9a-f]*]]})
|
||||||
; CHECK: [[PARAM]]: DW_TAG_formal_parameter [13]
|
; CHECK: [[PARAM]]: DW_TAG_formal_parameter
|
||||||
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "this")
|
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "this")
|
||||||
|
|
||||||
%class.A = type { i32 }
|
%class.A = type { i32 }
|
||||||
|
@ -3,8 +3,10 @@
|
|||||||
|
|
||||||
; test that the DW_AT_specification is a back edge in the file.
|
; test that the DW_AT_specification is a back edge in the file.
|
||||||
|
|
||||||
; CHECK: 0x0000[[OFFSET:[0-9a-f]*]]: DW_TAG_subprogram [7] *
|
; CHECK: DW_TAG_subprogram [{{[0-9]+}}] *
|
||||||
; CHECK: DW_AT_specification [DW_FORM_ref4] (cu + 0x[[OFFSET]] => {0x0000[[OFFSET]]})
|
; CHECK: DW_AT_specification [DW_FORM_ref4] (cu + 0x[[OFFSET:[0-9a-f]*]] => {0x0000[[OFFSET]]})
|
||||||
|
; CHECK: 0x0000[[OFFSET]]: DW_TAG_subprogram [{{[0-9]+}}] *
|
||||||
|
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "bar")
|
||||||
|
|
||||||
|
|
||||||
@_ZZN3foo3barEvE1x = constant i32 0, align 4
|
@_ZZN3foo3barEvE1x = constant i32 0, align 4
|
||||||
|
@ -4,11 +4,14 @@
|
|||||||
|
|
||||||
; CHECK: 0x0000000b: DW_TAG_compile_unit
|
; CHECK: 0x0000000b: DW_TAG_compile_unit
|
||||||
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000035] = "foo.cpp")
|
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000035] = "foo.cpp")
|
||||||
; CHECK: 0x0000003c: DW_TAG_class_type
|
; CHECK: 0x{{[0-9a-f]+}}: DW_TAG_class_type
|
||||||
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000006d] = "D")
|
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]+}}] = "D")
|
||||||
; CHECK: 0x00000044: DW_TAG_member
|
; CHECK: 0x{{[0-9a-f]+}}: DW_TAG_member
|
||||||
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000005d] = "c1")
|
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]+}}] = "c1")
|
||||||
; CHECK: DW_AT_artificial [DW_FORM_flag_present] (true)
|
; CHECK: DW_TAG_subprogram
|
||||||
|
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]+}}] = "D")
|
||||||
|
; CHECK: DW_TAG_formal_parameter
|
||||||
|
; CHECK: DW_AT_artificial [DW_FORM_flag_present] (true)
|
||||||
|
|
||||||
; CHECK-DIS: [artificial]
|
; CHECK-DIS: [artificial]
|
||||||
|
|
||||||
|
@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
; test that the DW_AT_specification is a back edge in the file.
|
; test that the DW_AT_specification is a back edge in the file.
|
||||||
|
|
||||||
; CHECK: [[BACK:0x[0-9a-f]*]]: DW_TAG_subprogram [6]
|
; CHECK: DW_TAG_subprogram
|
||||||
; CHECK: DW_AT_specification [DW_FORM_ref4] (cu + {{.*}} => {[[BACK]]})
|
; CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]*}}] = "zed")
|
||||||
|
; CHECK: DW_TAG_subprogram
|
||||||
|
; CHECK-NEXT: DW_AT_specification [DW_FORM_ref4] (cu + {{.*}} => {[[BACK:0x[0-9a-f]*]]})
|
||||||
|
; CHECK: [[BACK]]: DW_TAG_subprogram
|
||||||
|
|
||||||
%struct.foo = type { i8 }
|
%struct.foo = type { i8 }
|
||||||
|
|
||||||
|
@ -17,9 +17,6 @@
|
|||||||
; CHECK-NOT: NULL
|
; CHECK-NOT: NULL
|
||||||
; CHECK: DW_TAG_template_type_parameter
|
; CHECK: DW_TAG_template_type_parameter
|
||||||
|
|
||||||
; CHECK: [[INTPTR:0x[0-9a-f]*]]:{{ *}}DW_TAG_pointer_type
|
|
||||||
; CHECK-NEXT: DW_AT_type{{.*}} => {[[INT]]}
|
|
||||||
|
|
||||||
; CHECK: DW_AT_name{{.*}}"func<3, &glbl, y_impl, 1, 2>"
|
; CHECK: DW_AT_name{{.*}}"func<3, &glbl, y_impl, 1, 2>"
|
||||||
; CHECK-NOT: NULL
|
; CHECK-NOT: NULL
|
||||||
; CHECK: DW_TAG_template_value_parameter
|
; CHECK: DW_TAG_template_value_parameter
|
||||||
@ -33,7 +30,7 @@
|
|||||||
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(3)
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(3)
|
||||||
|
|
||||||
; CHECK: DW_TAG_template_value_parameter
|
; CHECK: DW_TAG_template_value_parameter
|
||||||
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INTPTR]]}
|
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INTPTR:0x[0-9a-f]*]]}
|
||||||
|
|
||||||
; The address of the global 'glbl', followed by DW_OP_stack_value (9f), to use
|
; The address of the global 'glbl', followed by DW_OP_stack_value (9f), to use
|
||||||
; the value immediately, rather than indirecting through the address.
|
; the value immediately, rather than indirecting through the address.
|
||||||
@ -56,6 +53,9 @@
|
|||||||
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]}
|
; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]}
|
||||||
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(2)
|
; CHECK-NEXT: DW_AT_const_value [DW_FORM_sdata]{{.*}}(2)
|
||||||
|
|
||||||
|
; CHECK: [[INTPTR]]:{{ *}}DW_TAG_pointer_type
|
||||||
|
; CHECK-NEXT: DW_AT_type{{.*}} => {[[INT]]}
|
||||||
|
|
||||||
%"struct.y_impl<int>::nested" = type { i8 }
|
%"struct.y_impl<int>::nested" = type { i8 }
|
||||||
|
|
||||||
@glbl = global i32 0, align 4
|
@glbl = global i32 0, align 4
|
||||||
|
Loading…
Reference in New Issue
Block a user