mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 06:30:19 +00:00
b056aa798d
Move the specialized metadata nodes for the new debug info hierarchy into place, finishing off PR22464. I've done bootstraps (and all that) and I'm confident this commit is NFC as far as DWARF output is concerned. Let me know if I'm wrong :). The code changes are fairly mechanical: - Bumped the "Debug Info Version". - `DIBuilder` now creates the appropriate subclass of `MDNode`. - Subclasses of DIDescriptor now expect to hold their "MD" counterparts (e.g., `DIBasicType` expects `MDBasicType`). - Deleted a ton of dead code in `AsmWriter.cpp` and `DebugInfo.cpp` for printing comments. - Big update to LangRef to describe the nodes in the new hierarchy. Feel free to make it better. Testcase changes are enormous. There's an accompanying clang commit on its way. If you have out-of-tree debug info testcases, I just broke your build. - `upgrade-specialized-nodes.sh` is attached to PR22564. I used it to update all the IR testcases. - Unfortunately I failed to find way to script the updates to CHECK lines, so I updated all of these by hand. This was fairly painful, since the old CHECKs are difficult to reason about. That's one of the benefits of the new hierarchy. This work isn't quite finished, BTW. The `DIDescriptor` subclasses are almost empty wrappers, but not quite: they still have loose casting checks (see the `RETURN_FROM_RAW()` macro). Once they're completely gutted, I'll rename the "MD" classes to "DI" and kill the wrappers. I also expect to make a few schema changes now that it's easier to reason about everything. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231082 91177308-0d34-0410-b5e6-96231b3b80d8
132 lines
6.8 KiB
LLVM
132 lines
6.8 KiB
LLVM
; REQUIRES: object-emission
|
|
|
|
; RUN: %llc_dwarf -generate-dwarf-pub-sections=Enable -filetype=obj -o %t.o < %s
|
|
; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s
|
|
; ModuleID = 'dwarf-public-names.cpp'
|
|
;
|
|
; Generated from:
|
|
;
|
|
; struct C {
|
|
; void member_function();
|
|
; static int static_member_function();
|
|
; static int static_member_variable;
|
|
; };
|
|
;
|
|
; int C::static_member_variable = 0;
|
|
;
|
|
; void C::member_function() {
|
|
; static_member_variable = 0;
|
|
; }
|
|
;
|
|
; int C::static_member_function() {
|
|
; return static_member_variable;
|
|
; }
|
|
;
|
|
; C global_variable;
|
|
;
|
|
; int global_function() {
|
|
; return -1;
|
|
; }
|
|
;
|
|
; namespace ns {
|
|
; void global_namespace_function() {
|
|
; global_variable.member_function();
|
|
; }
|
|
; int global_namespace_variable = 1;
|
|
; }
|
|
|
|
; Skip the output to the header of the pubnames section.
|
|
; CHECK: debug_pubnames
|
|
; CHECK: version = 0x0002
|
|
|
|
; Check for each name in the output.
|
|
; CHECK-DAG: "ns"
|
|
; CHECK-DAG: "C::static_member_function"
|
|
; CHECK-DAG: "global_variable"
|
|
; CHECK-DAG: "ns::global_namespace_variable"
|
|
; CHECK-DAG: "ns::global_namespace_function"
|
|
; CHECK-DAG: "global_function"
|
|
; CHECK-DAG: "C::static_member_variable"
|
|
; CHECK-DAG: "C::member_function"
|
|
|
|
%struct.C = type { i8 }
|
|
|
|
@_ZN1C22static_member_variableE = global i32 0, align 4
|
|
@global_variable = global %struct.C zeroinitializer, align 1
|
|
@_ZN2ns25global_namespace_variableE = global i32 1, align 4
|
|
|
|
define void @_ZN1C15member_functionEv(%struct.C* %this) nounwind uwtable align 2 {
|
|
entry:
|
|
%this.addr = alloca %struct.C*, align 8
|
|
store %struct.C* %this, %struct.C** %this.addr, align 8
|
|
call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !28, metadata !MDExpression()), !dbg !30
|
|
%this1 = load %struct.C*, %struct.C** %this.addr
|
|
store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31
|
|
ret void, !dbg !32
|
|
}
|
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
|
|
|
|
define i32 @_ZN1C22static_member_functionEv() nounwind uwtable align 2 {
|
|
entry:
|
|
%0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !33
|
|
ret i32 %0, !dbg !33
|
|
}
|
|
|
|
define i32 @_Z15global_functionv() nounwind uwtable {
|
|
entry:
|
|
ret i32 -1, !dbg !34
|
|
}
|
|
|
|
define void @_ZN2ns25global_namespace_functionEv() nounwind uwtable {
|
|
entry:
|
|
call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !35
|
|
ret void, !dbg !36
|
|
}
|
|
|
|
attributes #0 = { nounwind uwtable }
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!38}
|
|
|
|
!0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)", isOptimized: false, emissionKind: 0, file: !37, enums: !1, retainedTypes: !1, subprograms: !2, globals: !24, imports: !1)
|
|
!1 = !{}
|
|
!2 = !{!3, !18, !19, !20}
|
|
!3 = !MDSubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 9, file: !4, scope: null, type: !5, function: void (%struct.C*)* @_ZN1C15member_functionEv, declaration: !12, variables: !1)
|
|
!4 = !MDFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
|
|
!5 = !MDSubroutineType(types: !6)
|
|
!6 = !{null, !7}
|
|
!7 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)
|
|
!8 = !MDCompositeType(tag: DW_TAG_structure_type, name: "C", line: 1, size: 8, align: 8, file: !37, elements: !9)
|
|
!9 = !{!10, !12, !14}
|
|
!10 = !MDDerivedType(tag: DW_TAG_member, name: "static_member_variable", line: 4, flags: DIFlagStaticMember, file: !37, scope: !8, baseType: !11)
|
|
!11 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
!12 = !MDSubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !4, scope: !8, type: !5, variables: !13)
|
|
!13 = !{} ; previously: invalid DW_TAG_base_type
|
|
!14 = !MDSubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !4, scope: !8, type: !15, variables: !17)
|
|
!15 = !MDSubroutineType(types: !16)
|
|
!16 = !{!11}
|
|
!17 = !{} ; previously: invalid DW_TAG_base_type
|
|
!18 = !MDSubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 13, file: !4, scope: null, type: !15, function: i32 ()* @_ZN1C22static_member_functionEv, declaration: !14, variables: !1)
|
|
!19 = !MDSubprogram(name: "global_function", linkageName: "_Z15global_functionv", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 19, file: !4, scope: !4, type: !15, function: i32 ()* @_Z15global_functionv, variables: !1)
|
|
!20 = !MDSubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", line: 24, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 24, file: !4, scope: !21, type: !22, function: void ()* @_ZN2ns25global_namespace_functionEv, variables: !1)
|
|
!21 = !MDNamespace(name: "ns", line: 23, file: !4, scope: null)
|
|
!22 = !MDSubroutineType(types: !23)
|
|
!23 = !{null}
|
|
!24 = !{!25, !26, !27}
|
|
!25 = !MDGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", line: 7, isLocal: false, isDefinition: true, scope: !8, file: !4, type: !11, variable: i32* @_ZN1C22static_member_variableE, declaration: !10)
|
|
!26 = !MDGlobalVariable(name: "global_variable", line: 17, isLocal: false, isDefinition: true, scope: null, file: !4, type: !8, variable: %struct.C* @global_variable)
|
|
!27 = !MDGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", line: 27, isLocal: false, isDefinition: true, scope: !21, file: !4, type: !11, variable: i32* @_ZN2ns25global_namespace_variableE)
|
|
!28 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", line: 9, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !3, file: !4, type: !29)
|
|
!29 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !8)
|
|
!30 = !MDLocation(line: 9, scope: !3)
|
|
!31 = !MDLocation(line: 10, scope: !3)
|
|
!32 = !MDLocation(line: 11, scope: !3)
|
|
!33 = !MDLocation(line: 14, scope: !18)
|
|
!34 = !MDLocation(line: 20, scope: !19)
|
|
!35 = !MDLocation(line: 25, scope: !20)
|
|
!36 = !MDLocation(line: 26, scope: !20)
|
|
!37 = !MDFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
|
|
!38 = !{i32 1, !"Debug Info Version", i32 3}
|