[VPlan] Add and use debug location for VPScalarCastRecipe.
[llvm-project.git] / bolt / test / X86 / dwarf5-label-low-pc.s
blob1e3fc17ad516acb70410e60e4b860c0702f379ea
2 # REQUIRES: system-linux
4 # RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %tmain.o
5 # RUN: %clang %cflags -dwarf-5 %tmain.o -o %t.exe -Wl,-q
6 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
7 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
9 # RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
10 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
11 # RUN: llvm-objdump -d %t.bolt >> %t.txt
12 # RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s
14 ## This test checks that we correctly handle DW_AT_low_pc [DW_FORM_addrx] that is part of DW_TAG_label.
16 # PRECHECK: version = 0x0005
17 # PRECHECK: DW_TAG_label
18 # PRECHECK-NEXT: DW_AT_name
19 # PRECHECK-NEXT: DW_AT_decl_file
20 # PRECHECK-NEXT: DW_AT_decl_line
21 # PRECHECK-NEXT:DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001)
22 # PRECHECK: DW_TAG_label
23 # PRECHECK-NEXT: DW_AT_name
24 # PRECHECK-NEXT: DW_AT_decl_file
25 # PRECHECK-NEXT: DW_AT_decl_line
26 # PRECHECK-NEXT:DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002)
29 # POSTCHECK: Addrs: [
30 # POSTCHECK-NEXT: 0x
31 # POSTCHECK-NEXT: 0x
32 # POSTCHECK-NEXT: 0x[[ADDR:[1-9a-f]*]]
33 # POSTCHECK-NEXT: 0x[[ADDR2:[1-9a-f]*]]
35 # POSTCHECK: version = 0x0005
36 # POSTCHECK: DW_TAG_label
37 # POSTCHECK-NEXT: DW_AT_name
38 # POSTCHECK-NEXT: DW_AT_decl_file
39 # POSTCHECK-NEXT: DW_AT_decl_line
40 # POSTCHECK-NEXT:DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002)
41 # POSTCHECK-SAME: 0x[[ADDR]]
42 # POSTCHECK: DW_TAG_label
43 # POSTCHECK-NEXT: DW_AT_name
44 # POSTCHECK-NEXT: DW_AT_decl_file
45 # POSTCHECK-NEXT: DW_AT_decl_line
46 # POSTCHECK-NEXT:DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003)
47 # POSTCHECK-SAME: 0x[[ADDR2]]
49 # POSTCHECK: [[ADDR]]: 8b 45 f8
50 # POSTCHECK: [[ADDR2]]: 8b 45 f8
52 ## clang++ main.cpp -g -S
53 ## int main() {
54 ## int a = 4;
55 ## if (a == 5)
56 ## goto LABEL1;
57 ## else
58 ## goto LABEL2;
59 ## LABEL1:a++;
60 ## LABEL2:a--;
61 ## return 0;
62 ## }
64 .text
65 .file "main.cpp"
66 .globl main # -- Begin function main
67 .p2align 4, 0x90
68 .type main,@function
69 main: # @main
70 .Lfunc_begin0:
71 .file 0 "/testLabel" "main.cpp" md5 0xa0bd66020d06f1303de7008e3c542050
72 .loc 0 1 0 # main.cpp:1:0
73 .cfi_startproc
74 # %bb.0: # %entry
75 pushq %rbp
76 .cfi_def_cfa_offset 16
77 .cfi_offset %rbp, -16
78 movq %rsp, %rbp
79 .cfi_def_cfa_register %rbp
80 movl $0, -4(%rbp)
81 .Ltmp0:
82 .loc 0 2 7 prologue_end # main.cpp:2:7
83 movl $4, -8(%rbp)
84 .Ltmp1:
85 .loc 0 3 9 # main.cpp:3:9
86 cmpl $5, -8(%rbp)
87 .Ltmp2:
88 .loc 0 3 7 is_stmt 0 # main.cpp:3:7
89 jne .LBB0_2
90 # %bb.1: # %if.then
91 .Ltmp3:
92 .loc 0 4 5 is_stmt 1 # main.cpp:4:5
93 jmp .LBB0_3
94 .LBB0_2: # %if.else
95 .loc 0 6 5 # main.cpp:6:5
96 jmp .LBB0_4
97 .Ltmp4:
98 .LBB0_3: # %LABEL1
99 #DEBUG_LABEL: main:LABEL1
100 .loc 0 7 11 # main.cpp:7:11
101 movl -8(%rbp), %eax
102 addl $1, %eax
103 movl %eax, -8(%rbp)
104 .LBB0_4: # %LABEL2
105 .Ltmp5:
106 #DEBUG_LABEL: main:LABEL2
107 .loc 0 8 11 # main.cpp:8:11
108 movl -8(%rbp), %eax
109 addl $-1, %eax
110 movl %eax, -8(%rbp)
111 .loc 0 9 3 # main.cpp:9:3
112 xorl %eax, %eax
113 popq %rbp
114 .cfi_def_cfa %rsp, 8
115 retq
116 .Ltmp6:
117 .Lfunc_end0:
118 .size main, .Lfunc_end0-main
119 .cfi_endproc
120 # -- End function
121 .section .debug_abbrev,"",@progbits
122 .byte 1 # Abbreviation Code
123 .byte 17 # DW_TAG_compile_unit
124 .byte 1 # DW_CHILDREN_yes
125 .byte 37 # DW_AT_producer
126 .byte 37 # DW_FORM_strx1
127 .byte 19 # DW_AT_language
128 .byte 5 # DW_FORM_data2
129 .byte 3 # DW_AT_name
130 .byte 37 # DW_FORM_strx1
131 .byte 114 # DW_AT_str_offsets_base
132 .byte 23 # DW_FORM_sec_offset
133 .byte 16 # DW_AT_stmt_list
134 .byte 23 # DW_FORM_sec_offset
135 .byte 27 # DW_AT_comp_dir
136 .byte 37 # DW_FORM_strx1
137 .byte 17 # DW_AT_low_pc
138 .byte 27 # DW_FORM_addrx
139 .byte 18 # DW_AT_high_pc
140 .byte 6 # DW_FORM_data4
141 .byte 115 # DW_AT_addr_base
142 .byte 23 # DW_FORM_sec_offset
143 .byte 0 # EOM(1)
144 .byte 0 # EOM(2)
145 .byte 2 # Abbreviation Code
146 .byte 46 # DW_TAG_subprogram
147 .byte 1 # DW_CHILDREN_yes
148 .byte 17 # DW_AT_low_pc
149 .byte 27 # DW_FORM_addrx
150 .byte 18 # DW_AT_high_pc
151 .byte 6 # DW_FORM_data4
152 .byte 64 # DW_AT_frame_base
153 .byte 24 # DW_FORM_exprloc
154 .byte 3 # DW_AT_name
155 .byte 37 # DW_FORM_strx1
156 .byte 58 # DW_AT_decl_file
157 .byte 11 # DW_FORM_data1
158 .byte 59 # DW_AT_decl_line
159 .byte 11 # DW_FORM_data1
160 .byte 73 # DW_AT_type
161 .byte 19 # DW_FORM_ref4
162 .byte 63 # DW_AT_external
163 .byte 25 # DW_FORM_flag_present
164 .byte 0 # EOM(1)
165 .byte 0 # EOM(2)
166 .byte 3 # Abbreviation Code
167 .byte 52 # DW_TAG_variable
168 .byte 0 # DW_CHILDREN_no
169 .byte 2 # DW_AT_location
170 .byte 24 # DW_FORM_exprloc
171 .byte 3 # DW_AT_name
172 .byte 37 # DW_FORM_strx1
173 .byte 58 # DW_AT_decl_file
174 .byte 11 # DW_FORM_data1
175 .byte 59 # DW_AT_decl_line
176 .byte 11 # DW_FORM_data1
177 .byte 73 # DW_AT_type
178 .byte 19 # DW_FORM_ref4
179 .byte 0 # EOM(1)
180 .byte 0 # EOM(2)
181 .byte 4 # Abbreviation Code
182 .byte 10 # DW_TAG_label
183 .byte 0 # DW_CHILDREN_no
184 .byte 3 # DW_AT_name
185 .byte 37 # DW_FORM_strx1
186 .byte 58 # DW_AT_decl_file
187 .byte 11 # DW_FORM_data1
188 .byte 59 # DW_AT_decl_line
189 .byte 11 # DW_FORM_data1
190 .byte 17 # DW_AT_low_pc
191 .byte 27 # DW_FORM_addrx
192 .byte 0 # EOM(1)
193 .byte 0 # EOM(2)
194 .byte 5 # Abbreviation Code
195 .byte 36 # DW_TAG_base_type
196 .byte 0 # DW_CHILDREN_no
197 .byte 3 # DW_AT_name
198 .byte 37 # DW_FORM_strx1
199 .byte 62 # DW_AT_encoding
200 .byte 11 # DW_FORM_data1
201 .byte 11 # DW_AT_byte_size
202 .byte 11 # DW_FORM_data1
203 .byte 0 # EOM(1)
204 .byte 0 # EOM(2)
205 .byte 0 # EOM(3)
206 .section .debug_info,"",@progbits
207 .Lcu_begin0:
208 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
209 .Ldebug_info_start0:
210 .short 5 # DWARF version number
211 .byte 1 # DWARF Unit Type
212 .byte 8 # Address Size (in bytes)
213 .long .debug_abbrev # Offset Into Abbrev. Section
214 .byte 1 # Abbrev [1] 0xc:0x41 DW_TAG_compile_unit
215 .byte 0 # DW_AT_producer
216 .short 33 # DW_AT_language
217 .byte 1 # DW_AT_name
218 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
219 .long .Lline_table_start0 # DW_AT_stmt_list
220 .byte 2 # DW_AT_comp_dir
221 .byte 0 # DW_AT_low_pc
222 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
223 .long .Laddr_table_base0 # DW_AT_addr_base
224 .byte 2 # Abbrev [2] 0x23:0x25 DW_TAG_subprogram
225 .byte 0 # DW_AT_low_pc
226 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
227 .byte 1 # DW_AT_frame_base
228 .byte 86
229 .byte 3 # DW_AT_name
230 .byte 0 # DW_AT_decl_file
231 .byte 1 # DW_AT_decl_line
232 .long 72 # DW_AT_type
233 # DW_AT_external
234 .byte 3 # Abbrev [3] 0x32:0xb DW_TAG_variable
235 .byte 2 # DW_AT_location
236 .byte 145
237 .byte 120
238 .byte 5 # DW_AT_name
239 .byte 0 # DW_AT_decl_file
240 .byte 2 # DW_AT_decl_line
241 .long 72 # DW_AT_type
242 .byte 4 # Abbrev [4] 0x3d:0x5 DW_TAG_label
243 .byte 6 # DW_AT_name
244 .byte 0 # DW_AT_decl_file
245 .byte 7 # DW_AT_decl_line
246 .byte 1 # DW_AT_low_pc
247 .byte 4 # Abbrev [4] 0x42:0x5 DW_TAG_label
248 .byte 7 # DW_AT_name
249 .byte 0 # DW_AT_decl_file
250 .byte 8 # DW_AT_decl_line
251 .byte 2 # DW_AT_low_pc
252 .byte 0 # End Of Children Mark
253 .byte 5 # Abbrev [5] 0x48:0x4 DW_TAG_base_type
254 .byte 4 # DW_AT_name
255 .byte 5 # DW_AT_encoding
256 .byte 4 # DW_AT_byte_size
257 .byte 0 # End Of Children Mark
258 .Ldebug_info_end0:
259 .section .debug_str_offsets,"",@progbits
260 .long 36 # Length of String Offsets Set
261 .short 5
262 .short 0
263 .Lstr_offsets_base0:
264 .section .debug_str,"MS",@progbits,1
265 .Linfo_string0:
266 .asciz "clang version 15.0.0" # string offset=0
267 .Linfo_string1:
268 .asciz "main.cpp" # string offset=134
269 .Linfo_string2:
270 .asciz "/testLabel" # string offset=143
271 .Linfo_string3:
272 .asciz "main" # string offset=190
273 .Linfo_string4:
274 .asciz "int" # string offset=195
275 .Linfo_string5:
276 .asciz "a" # string offset=199
277 .Linfo_string6:
278 .asciz "LABEL1" # string offset=201
279 .Linfo_string7:
280 .asciz "LABEL2" # string offset=208
281 .section .debug_str_offsets,"",@progbits
282 .long .Linfo_string0
283 .long .Linfo_string1
284 .long .Linfo_string2
285 .long .Linfo_string3
286 .long .Linfo_string4
287 .long .Linfo_string5
288 .long .Linfo_string6
289 .long .Linfo_string7
290 .section .debug_addr,"",@progbits
291 .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
292 .Ldebug_addr_start0:
293 .short 5 # DWARF version number
294 .byte 8 # Address size
295 .byte 0 # Segment selector size
296 .Laddr_table_base0:
297 .quad .Lfunc_begin0
298 .quad .Ltmp4
299 .quad .Ltmp5
300 .Ldebug_addr_end0:
301 .ident "clang version 15.0.0"
302 .section ".note.GNU-stack","",@progbits
303 .addrsig
304 .section .debug_line,"",@progbits
305 .Lline_table_start0: