Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/DebugInfo/X86/dwarf-public-names.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -o %t.spv
3 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o - | llvm-dis -o %t.ll
4
5 ; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=obj -o %t.o < %t.ll
6 ; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=LINUX %s
7 ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -o %t.o < %t.ll
8 ; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=NOPUB %s
9 ; RUN: llc -mtriple=x86_64-scei-ps4 -filetype=obj -o %t.o < %t.ll
10 ; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck --check-prefix=NOPUB %s
11
12 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
13 target triple = "spir64-unknown-unknown"
14 ; ModuleID = 'dwarf-public-names.cpp'
15 ;
16 ; Generated from:
17 ;
18 ; struct C {
19 ; void member_function();
20 ; static int static_member_function();
21 ; static int static_member_variable;
22 ; };
23 ;
24 ; int C::static_member_variable = 0;
25 ;
26 ; void C::member_function() {
27 ; static_member_variable = 0;
28 ; }
29 ;
30 ; int C::static_member_function() {
31 ; return static_member_variable;
32 ; }
33 ;
34 ; C global_variable;
35 ;
36 ; int global_function() {
37 ; return -1;
38 ; }
39 ;
40 ; namespace ns {
41 ; void global_namespace_function() {
42 ; global_variable.member_function();
43 ; }
44 ; int global_namespace_variable = 1;
45 ; }
46
47 ; Darwin and PS4 shouldn't be generating the section by default
48 ; NOPUB: debug_pubnames
49 ; NOPUB-NEXT: {{^$}}
50
51 ; Skip the output to the header of the pubnames section.
52 ; LINUX: debug_pubnames
53 ; LINUX-NEXT: unit_size = 0x0000012b
54
55 ; Check for each name in the output.
56 ; LINUX-DAG: "ns"
57 ; LINUX-DAG: "C::static_member_function"
58 ; LINUX-DAG: "global_variable"
59 ; LINUX-DAG: "ns::global_namespace_variable"
60 ; LINUX-DAG: "ns::global_namespace_function"
61 ; LINUX-DAG: "global_function"
62 ; LINUX-DAG: "C::static_member_variable"
63 ; LINUX-DAG: "C::member_function"
64
65 source_filename = "test/DebugInfo/X86/dwarf-public-names.ll"
66
67 %struct.C = type { i8 }
68
69 @_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !0
70 @global_variable = global %struct.C zeroinitializer, align 1, !dbg !15
71 @_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !17
72
73 ; Function Attrs: nounwind uwtable
74 define void @_ZN1C15member_functionEv(%struct.C* %this) #0 align 2 !dbg !23 {
75 entry:
76 %this.addr = alloca %struct.C*, align 8
77 store %struct.C* %this, %struct.C** %this.addr, align 8
78 call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !24, metadata !26), !dbg !27
79 %this1 = load %struct.C*, %struct.C** %this.addr
80 store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !28
81 ret void, !dbg !29
82 }
83
84 ; Function Attrs: nounwind readnone
85 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
86
87 ; Function Attrs: nounwind uwtable
88 define i32 @_ZN1C22static_member_functionEv() #0 align 2 !dbg !30 {
89 entry:
90 %0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31
91 ret i32 %0, !dbg !31
92 }
93
94 ; Function Attrs: nounwind uwtable
95 define i32 @_Z15global_functionv() #0 !dbg !32 {
96 entry:
97 ret i32 -1, !dbg !33
98 }
99
100 ; Function Attrs: nounwind uwtable
101 define void @_ZN2ns25global_namespace_functionEv() #0 !dbg !34 {
102 entry:
103 call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !37
104 ret void, !dbg !38
105 }
106
107 attributes #0 = { nounwind uwtable }
108 attributes #1 = { nounwind readnone }
109
110 !llvm.dbg.cu = !{!20}
111 !llvm.module.flags = !{!22}
112
113 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
114 !1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5)
115 !2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, elements: !4)
116 !3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
117 !4 = !{!5, !7, !12}
118 !5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember)
119 !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
120 !7 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11)
121 !8 = !DISubroutineType(types: !9)
122 !9 = !{null, !10}
123 !10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
124 !11 = !{}
125 !12 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: !2, file: !3, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, retainedNodes: !11)
126 !13 = !DISubroutineType(types: !14)
127 !14 = !{!6}
128 !15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())
129 !16 = !DIGlobalVariable(name: "global_variable", scope: null, file: !3, line: 17, type: !2, isLocal: false, isDefinition: true) ; previously: invalid DW_TAG_base_type
130 !17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression())
131 !18 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !19, file: !3, line: 27, type: !6, isLocal: false, isDefinition: true)
132 !19 = !DINamespace(name: "ns", scope: null)
133 !20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type
134 !21 = !{!0, !15, !17}
135 !22 = !{i32 1, !"Debug Info Version", i32 3}
136 !23 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: null, file: !3, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !7, retainedNodes: !11)
137 !24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer)
138 !25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64)
139 !26 = !DIExpression()
140 !27 = !DILocation(line: 9, scope: !23)
141 !28 = !DILocation(line: 10, scope: !23)
142 !29 = !DILocation(line: 11, scope: !23)
143 !30 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: null, file: !3, line: 13, type: !13, isLocal: false, isDefinition: true, scopeLine: 13, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !12, retainedNodes: !11)
144 !31 = !DILocation(line: 14, scope: !30)
145 !32 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", scope: !3, file: !3, line: 19, type: !13, isLocal: false, isDefinition: true, scopeLine: 19, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11)
146 !33 = !DILocation(line: 20, scope: !32)
147 !34 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", scope: !19, file: !3, line: 24, type: !35, isLocal: false, isDefinition: true, scopeLine: 24, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, retainedNodes: !11)
148 !35 = !DISubroutineType(types: !36)
149 !36 = !{null}
150 !37 = !DILocation(line: 25, scope: !34)
151 !38 = !DILocation(line: 26, scope: !34)
152