1 ; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
2 ; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64-nvidia-cuda | %ptxas-verify %}
4 ; CHECK: .target sm_30, debug
6 ; CHECK: .visible .func use_dbg_declare()
7 ; CHECK: .local .align 8 .b8 __local_depot0[8];
8 ; CHECK: mov.u64 %SPL, __local_depot0;
9 ; CHECK: add.u64 %rd1, %SP, 0;
10 ; CHECK: .loc 1 5 3 // t.c:5:3
11 ; CHECK: { // callseq 0, 0
12 ; CHECK: .param .b64 param0;
13 ; CHECK: st.param.b64 [param0], %rd1;
19 ; CHECK: } // callseq 0
20 ; CHECK: .loc 1 6 1 // t.c:6:1
24 ; CHECK: .file 1 "test{{(/|\\\\)}}t.c"
26 ; CHECK: .section .debug_abbrev
28 ; CHECK-NEXT: .b8 1 // Abbreviation Code
29 ; CHECK-NEXT: .b8 17 // DW_TAG_compile_unit
30 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
31 ; CHECK-NEXT: .b8 37 // DW_AT_producer
32 ; CHECK-NEXT: .b8 8 // DW_FORM_string
33 ; CHECK-NEXT: .b8 19 // DW_AT_language
34 ; CHECK-NEXT: .b8 5 // DW_FORM_data2
35 ; CHECK-NEXT: .b8 3 // DW_AT_name
36 ; CHECK-NEXT: .b8 8 // DW_FORM_string
37 ; CHECK-NEXT: .b8 16 // DW_AT_stmt_list
38 ; CHECK-NEXT: .b8 6 // DW_FORM_data4
39 ; CHECK-NEXT: .b8 27 // DW_AT_comp_dir
40 ; CHECK-NEXT: .b8 8 // DW_FORM_string
41 ; CHECK-NEXT: .b8 0 // EOM(1)
42 ; CHECK-NEXT: .b8 0 // EOM(2)
43 ; CHECK-NEXT: .b8 2 // Abbreviation Code
44 ; CHECK-NEXT: .b8 46 // DW_TAG_subprogram
45 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
46 ; CHECK-NEXT: .b8 17 // DW_AT_low_pc
47 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
48 ; CHECK-NEXT: .b8 18 // DW_AT_high_pc
49 ; CHECK-NEXT: .b8 1 // DW_FORM_addr
50 ; CHECK-NEXT: .b8 64 // DW_AT_frame_base
51 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
52 ; CHECK-NEXT: .b8 3 // DW_AT_name
53 ; CHECK-NEXT: .b8 8 // DW_FORM_string
54 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
55 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
56 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
57 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
58 ; CHECK-NEXT: .b8 39 // DW_AT_prototyped
59 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
60 ; CHECK-NEXT: .b8 63 // DW_AT_external
61 ; CHECK-NEXT: .b8 12 // DW_FORM_flag
62 ; CHECK-NEXT: .b8 0 // EOM(1)
63 ; CHECK-NEXT: .b8 0 // EOM(2)
64 ; CHECK-NEXT: .b8 3 // Abbreviation Code
65 ; CHECK-NEXT: .b8 52 // DW_TAG_variable
66 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
67 ; CHECK-NEXT: .b8 51 // DW_AT_address_class
68 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
69 ; CHECK-NEXT: .b8 2 // DW_AT_location
70 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
71 ; CHECK-NEXT: .b8 3 // DW_AT_name
72 ; CHECK-NEXT: .b8 8 // DW_FORM_string
73 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
74 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
75 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
76 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
77 ; CHECK-NEXT: .b8 73 // DW_AT_type
78 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
79 ; CHECK-NEXT: .b8 0 // EOM(1)
80 ; CHECK-NEXT: .b8 0 // EOM(2)
81 ; CHECK-NEXT: .b8 4 // Abbreviation Code
82 ; CHECK-NEXT: .b8 19 // DW_TAG_structure_type
83 ; CHECK-NEXT: .b8 1 // DW_CHILDREN_yes
84 ; CHECK-NEXT: .b8 3 // DW_AT_name
85 ; CHECK-NEXT: .b8 8 // DW_FORM_string
86 ; CHECK-NEXT: .b8 11 // DW_AT_byte_size
87 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
88 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
89 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
90 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
91 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
92 ; CHECK-NEXT: .b8 0 // EOM(1)
93 ; CHECK-NEXT: .b8 0 // EOM(2)
94 ; CHECK-NEXT: .b8 5 // Abbreviation Code
95 ; CHECK-NEXT: .b8 13 // DW_TAG_member
96 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
97 ; CHECK-NEXT: .b8 3 // DW_AT_name
98 ; CHECK-NEXT: .b8 8 // DW_FORM_string
99 ; CHECK-NEXT: .b8 73 // DW_AT_type
100 ; CHECK-NEXT: .b8 19 // DW_FORM_ref4
101 ; CHECK-NEXT: .b8 58 // DW_AT_decl_file
102 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
103 ; CHECK-NEXT: .b8 59 // DW_AT_decl_line
104 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
105 ; CHECK-NEXT: .b8 56 // DW_AT_data_member_location
106 ; CHECK-NEXT: .b8 10 // DW_FORM_block1
107 ; CHECK-NEXT: .b8 0 // EOM(1)
108 ; CHECK-NEXT: .b8 0 // EOM(2)
109 ; CHECK-NEXT: .b8 6 // Abbreviation Code
110 ; CHECK-NEXT: .b8 36 // DW_TAG_base_type
111 ; CHECK-NEXT: .b8 0 // DW_CHILDREN_no
112 ; CHECK-NEXT: .b8 3 // DW_AT_name
113 ; CHECK-NEXT: .b8 8 // DW_FORM_string
114 ; CHECK-NEXT: .b8 62 // DW_AT_encoding
115 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
116 ; CHECK-NEXT: .b8 11 // DW_AT_byte_size
117 ; CHECK-NEXT: .b8 11 // DW_FORM_data1
118 ; CHECK-NEXT: .b8 0 // EOM(1)
119 ; CHECK-NEXT: .b8 0 // EOM(2)
120 ; CHECK-NEXT: .b8 0 // EOM(3)
122 ; CHECK-NEXT: .section .debug_info
124 ; CHECK-NEXT: .b32 118 // Length of Unit
125 ; CHECK-NEXT: .b8 2 // DWARF version number
127 ; CHECK-NEXT: .b32 .debug_abbrev // Offset Into Abbrev. Section
128 ; CHECK-NEXT: .b8 8 // Address Size (in bytes)
129 ; CHECK-NEXT: .b8 1 // Abbrev [1] 0xb:0x6f DW_TAG_compile_unit
130 ; CHECK-NEXT: .b8 99 // DW_AT_producer
131 ; CHECK-NEXT: .b8 108
133 ; CHECK-NEXT: .b8 110
134 ; CHECK-NEXT: .b8 103
136 ; CHECK-NEXT: .b8 12 // DW_AT_language
138 ; CHECK-NEXT: .b8 116 // DW_AT_name
142 ; CHECK-NEXT: .b32 .debug_line // DW_AT_stmt_list
143 ; CHECK-NEXT: .b8 116 // DW_AT_comp_dir
144 ; CHECK-NEXT: .b8 101
145 ; CHECK-NEXT: .b8 115
146 ; CHECK-NEXT: .b8 116
148 ; CHECK-NEXT: .b8 2 // Abbrev [2] 0x21:0x3c DW_TAG_subprogram
149 ; CHECK-NEXT: .b64 $L__func_begin0 // DW_AT_low_pc
150 ; CHECK-NEXT: .b64 $L__func_end0 // DW_AT_high_pc
151 ; CHECK-NEXT: .b8 1 // DW_AT_frame_base
152 ; CHECK-NEXT: .b8 156
153 ; CHECK-NEXT: .b8 117 // DW_AT_name
154 ; CHECK-NEXT: .b8 115
155 ; CHECK-NEXT: .b8 101
157 ; CHECK-NEXT: .b8 100
159 ; CHECK-NEXT: .b8 103
161 ; CHECK-NEXT: .b8 100
162 ; CHECK-NEXT: .b8 101
164 ; CHECK-NEXT: .b8 108
166 ; CHECK-NEXT: .b8 114
167 ; CHECK-NEXT: .b8 101
169 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
170 ; CHECK-NEXT: .b8 3 // DW_AT_decl_line
171 ; CHECK-NEXT: .b8 1 // DW_AT_prototyped
172 ; CHECK-NEXT: .b8 1 // DW_AT_external
173 ; CHECK-NEXT: .b8 3 // Abbrev [3] 0x48:0x14 DW_TAG_variable
174 ; CHECK-NEXT: .b8 6 // DW_AT_address_class
175 ; CHECK-NEXT: .b8 9 // DW_AT_location
177 ; CHECK-NEXT: .b64 __local_depot0
178 ; CHECK-NEXT: .b8 111 // DW_AT_name
180 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
181 ; CHECK-NEXT: .b8 4 // DW_AT_decl_line
182 ; CHECK-NEXT: .b32 93 // DW_AT_type
183 ; CHECK-NEXT: .b8 0 // End Of Children Mark
184 ; CHECK-NEXT: .b8 4 // Abbrev [4] 0x5d:0x15 DW_TAG_structure_type
185 ; CHECK-NEXT: .b8 70 // DW_AT_name
186 ; CHECK-NEXT: .b8 111
187 ; CHECK-NEXT: .b8 111
189 ; CHECK-NEXT: .b8 4 // DW_AT_byte_size
190 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
191 ; CHECK-NEXT: .b8 1 // DW_AT_decl_line
192 ; CHECK-NEXT: .b8 5 // Abbrev [5] 0x65:0xc DW_TAG_member
193 ; CHECK-NEXT: .b8 120 // DW_AT_name
195 ; CHECK-NEXT: .b32 114 // DW_AT_type
196 ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
197 ; CHECK-NEXT: .b8 1 // DW_AT_decl_line
198 ; CHECK-NEXT: .b8 2 // DW_AT_data_member_location
201 ; CHECK-NEXT: .b8 0 // End Of Children Mark
202 ; CHECK-NEXT: .b8 6 // Abbrev [6] 0x72:0x7 DW_TAG_base_type
203 ; CHECK-NEXT: .b8 105 // DW_AT_name
204 ; CHECK-NEXT: .b8 110
205 ; CHECK-NEXT: .b8 116
207 ; CHECK-NEXT: .b8 5 // DW_AT_encoding
208 ; CHECK-NEXT: .b8 4 // DW_AT_byte_size
209 ; CHECK-NEXT: .b8 0 // End Of Children Mark
212 %struct.Foo = type { i32 }
214 ; Function Attrs: noinline nounwind uwtable
215 define void @use_dbg_declare() #0 !dbg !7 {
217 %o = alloca %struct.Foo, align 8
218 call void @llvm.dbg.declare(metadata ptr %o, metadata !10, metadata !15), !dbg !16
219 call void @escape_foo(ptr %o), !dbg !17
223 ; Function Attrs: nounwind readnone speculatable
224 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
226 declare void @escape_foo(ptr)
228 attributes #0 = { noinline nounwind uwtable }
229 attributes #1 = { nounwind readnone speculatable }
232 !llvm.module.flags = !{!3, !4, !5}
235 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
236 !1 = !DIFile(filename: "t.c", directory: "test")
238 !3 = !{i32 2, !"Dwarf Version", i32 2}
239 !4 = !{i32 2, !"Debug Info Version", i32 3}
240 !5 = !{i32 1, !"wchar_size", i32 4}
242 !7 = distinct !DISubprogram(name: "use_dbg_declare", scope: !1, file: !1, line: 3, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
243 !8 = !DISubroutineType(types: !9)
245 !10 = !DILocalVariable(name: "o", scope: !7, file: !1, line: 4, type: !11)
246 !11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !1, line: 1, size: 32, elements: !12)
248 !13 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !11, file: !1, line: 1, baseType: !14, size: 32)
249 !14 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
250 !15 = !DIExpression()
251 !16 = !DILocation(line: 4, column: 14, scope: !7)
252 !17 = !DILocation(line: 5, column: 3, scope: !7)
253 !18 = !DILocation(line: 6, column: 1, scope: !7)