xref: /llvm-project/bolt/test/X86/Inputs/dwarf5-locaddrx.s (revision e51a6b7374ca2d11e07375843bf24ef51307308a)
1# clang++ -g -gdwarf-5 -emit-llvm -S  mainlocadddrx.cpp
2# llc -O0 -mtriple=x86_64-unknown-linux-gnu mainlocadddrx.ll
3# void use(int * x, int * y) {
4# *x += 4;
5# *y -= 2;
6# }
7#
8# int x = 0;
9# int y = 1;
10# int  main(int argc, char *argv[]) {
11#    x = argc;
12#    y = argc + 3;
13#    use(&x, &y);
14#    return x + y;
15# }
16
17	.text
18	.file	"mainlocadddrx.cpp"
19	.file	0 "." "mainlocadddrx.cpp" md5 0xd4fd79ce0087c4cefd089752bf2182c6
20	.globl	_Z3usePiS_                      # -- Begin function _Z3usePiS_
21	.p2align	4, 0x90
22	.type	_Z3usePiS_,@function
23_Z3usePiS_:                             # @_Z3usePiS_
24.Lfunc_begin0:
25	.loc	0 1 0                           # mainlocadddrx.cpp:1:0
26	.cfi_startproc
27# %bb.0:                                # %entry
28	pushq	%rbp
29	.cfi_def_cfa_offset 16
30	.cfi_offset %rbp, -16
31	movq	%rsp, %rbp
32	.cfi_def_cfa_register %rbp
33	movq	%rdi, -8(%rbp)
34	movq	%rsi, -16(%rbp)
35.Ltmp0:
36	.loc	0 2 2 prologue_end              # mainlocadddrx.cpp:2:2
37	movq	-8(%rbp), %rax
38	.loc	0 2 4 is_stmt 0                 # mainlocadddrx.cpp:2:4
39	movl	(%rax), %ecx
40	addl	$4, %ecx
41	movl	%ecx, (%rax)
42	.loc	0 3 2 is_stmt 1                 # mainlocadddrx.cpp:3:2
43	movq	-16(%rbp), %rax
44	.loc	0 3 4 is_stmt 0                 # mainlocadddrx.cpp:3:4
45	movl	(%rax), %ecx
46	subl	$2, %ecx
47	movl	%ecx, (%rax)
48	.loc	0 4 1 is_stmt 1                 # mainlocadddrx.cpp:4:1
49	popq	%rbp
50	.cfi_def_cfa %rsp, 8
51	retq
52.Ltmp1:
53.Lfunc_end0:
54	.size	_Z3usePiS_, .Lfunc_end0-_Z3usePiS_
55	.cfi_endproc
56                                        # -- End function
57	.globl	main                            # -- Begin function main
58	.p2align	4, 0x90
59	.type	main,@function
60main:                                   # @main
61.Lfunc_begin1:
62	.loc	0 8 0                           # mainlocadddrx.cpp:8:0
63	.cfi_startproc
64# %bb.0:                                # %entry
65	pushq	%rbp
66	.cfi_def_cfa_offset 16
67	.cfi_offset %rbp, -16
68	movq	%rsp, %rbp
69	.cfi_def_cfa_register %rbp
70	subq	$16, %rsp
71	movl	$0, -4(%rbp)
72	movl	%edi, -8(%rbp)
73	movq	%rsi, -16(%rbp)
74.Ltmp2:
75	.loc	0 9 8 prologue_end              # mainlocadddrx.cpp:9:8
76	movl	-8(%rbp), %eax
77	.loc	0 9 6 is_stmt 0                 # mainlocadddrx.cpp:9:6
78	movl	%eax, x
79	.loc	0 10 8 is_stmt 1                # mainlocadddrx.cpp:10:8
80	movl	-8(%rbp), %eax
81	.loc	0 10 13 is_stmt 0               # mainlocadddrx.cpp:10:13
82	addl	$3, %eax
83	.loc	0 10 6                          # mainlocadddrx.cpp:10:6
84	movl	%eax, y
85	.loc	0 11 4 is_stmt 1                # mainlocadddrx.cpp:11:4
86	movabsq	$x, %rdi
87	movabsq	$y, %rsi
88	callq	_Z3usePiS_
89	.loc	0 12 11                         # mainlocadddrx.cpp:12:11
90	movl	x, %eax
91	.loc	0 12 13 is_stmt 0               # mainlocadddrx.cpp:12:13
92	addl	y, %eax
93	.loc	0 12 4                          # mainlocadddrx.cpp:12:4
94	addq	$16, %rsp
95	popq	%rbp
96	.cfi_def_cfa %rsp, 8
97	retq
98.Ltmp3:
99.Lfunc_end1:
100	.size	main, .Lfunc_end1-main
101	.cfi_endproc
102                                        # -- End function
103	.type	x,@object                       # @x
104	.bss
105	.globl	x
106	.p2align	2
107x:
108	.long	0                               # 0x0
109	.size	x, 4
110
111	.type	y,@object                       # @y
112	.data
113	.globl	y
114	.p2align	2
115y:
116	.long	1                               # 0x1
117	.size	y, 4
118
119	.section	.debug_abbrev,"",@progbits
120	.byte	1                               # Abbreviation Code
121	.byte	74                              # DW_TAG_skeleton_unit
122	.byte	0                               # DW_CHILDREN_no
123	.byte	16                              # DW_AT_stmt_list
124	.byte	23                              # DW_FORM_sec_offset
125	.byte	114                             # DW_AT_str_offsets_base
126	.byte	23                              # DW_FORM_sec_offset
127	.byte	27                              # DW_AT_comp_dir
128	.byte	37                              # DW_FORM_strx1
129	.ascii	"\264B"                         # DW_AT_GNU_pubnames
130	.byte	25                              # DW_FORM_flag_present
131	.byte	118                             # DW_AT_dwo_name
132	.byte	37                              # DW_FORM_strx1
133	.byte	17                              # DW_AT_low_pc
134	.byte	27                              # DW_FORM_addrx
135	.byte	18                              # DW_AT_high_pc
136	.byte	6                               # DW_FORM_data4
137	.byte	115                             # DW_AT_addr_base
138	.byte	23                              # DW_FORM_sec_offset
139	.byte	0                               # EOM(1)
140	.byte	0                               # EOM(2)
141	.byte	0                               # EOM(3)
142	.section	.debug_info,"",@progbits
143.Lcu_begin0:
144	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
145.Ldebug_info_start0:
146	.short	5                               # DWARF version number
147	.byte	4                               # DWARF Unit Type
148	.byte	8                               # Address Size (in bytes)
149	.long	.debug_abbrev                   # Offset Into Abbrev. Section
150	.quad	6364283817788887055
151	.byte	1                               # Abbrev [1] 0x14:0x14 DW_TAG_skeleton_unit
152	.long	.Lline_table_start0             # DW_AT_stmt_list
153	.long	.Lstr_offsets_base0             # DW_AT_str_offsets_base
154	.byte	0                               # DW_AT_comp_dir
155                                        # DW_AT_GNU_pubnames
156	.byte	1                               # DW_AT_dwo_name
157	.byte	2                               # DW_AT_low_pc
158	.long	.Lfunc_end1-.Lfunc_begin0       # DW_AT_high_pc
159	.long	.Laddr_table_base0              # DW_AT_addr_base
160.Ldebug_info_end0:
161	.section	.debug_str_offsets,"",@progbits
162	.long	12                              # Length of String Offsets Set
163	.short	5
164	.short	0
165.Lstr_offsets_base0:
166	.section	.debug_str,"MS",@progbits,1
167.Lskel_string0:
168	.asciz	"."                             # string offset=0
169.Lskel_string1:
170	.asciz	"mainlocadddrx.dwo"             # string offset=2
171	.section	.debug_str_offsets,"",@progbits
172	.long	.Lskel_string0
173	.long	.Lskel_string1
174	.section	.debug_str_offsets.dwo,"e",@progbits
175	.long	52                              # Length of String Offsets Set
176	.short	5
177	.short	0
178	.section	.debug_str.dwo,"eMS",@progbits,1
179.Linfo_string0:
180	.asciz	"x"                             # string offset=0
181.Linfo_string1:
182	.asciz	"int"                           # string offset=2
183.Linfo_string2:
184	.asciz	"y"                             # string offset=6
185.Linfo_string3:
186	.asciz	"_Z3usePiS_"                    # string offset=8
187.Linfo_string4:
188	.asciz	"use"                           # string offset=19
189.Linfo_string5:
190	.asciz	"main"                          # string offset=23
191.Linfo_string6:
192	.asciz	"argc"                          # string offset=28
193.Linfo_string7:
194	.asciz	"argv"                          # string offset=33
195.Linfo_string8:
196	.asciz	"char"                          # string offset=38
197.Linfo_string9:
198	.asciz	"clang version 15.0.0"          # string offset=43
199.Linfo_string10:
200	.asciz	"mainlocadddrx.cpp"             # string offset=64
201.Linfo_string11:
202	.asciz	"mainlocadddrx.dwo"             # string offset=82
203	.section	.debug_str_offsets.dwo,"e",@progbits
204	.long	0
205	.long	2
206	.long	6
207	.long	8
208	.long	19
209	.long	23
210	.long	28
211	.long	33
212	.long	38
213	.long	43
214	.long	64
215	.long	82
216	.section	.debug_info.dwo,"e",@progbits
217	.long	.Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
218.Ldebug_info_dwo_start0:
219	.short	5                               # DWARF version number
220	.byte	5                               # DWARF Unit Type
221	.byte	8                               # Address Size (in bytes)
222	.long	0                               # Offset Into Abbrev. Section
223	.quad	6364283817788887055
224	.byte	1                               # Abbrev [1] 0x14:0x7d DW_TAG_compile_unit
225	.byte	9                               # DW_AT_producer
226	.short	33                              # DW_AT_language
227	.byte	10                              # DW_AT_name
228	.byte	11                              # DW_AT_dwo_name
229	.byte	2                               # Abbrev [2] 0x1a:0xb DW_TAG_variable
230	.byte	0                               # DW_AT_name
231	.long	37                              # DW_AT_type
232                                        # DW_AT_external
233	.byte	0                               # DW_AT_decl_file
234	.byte	6                               # DW_AT_decl_line
235	.byte	2                               # DW_AT_location
236	.byte	161
237	.byte	0
238	.byte	3                               # Abbrev [3] 0x25:0x4 DW_TAG_base_type
239	.byte	1                               # DW_AT_name
240	.byte	5                               # DW_AT_encoding
241	.byte	4                               # DW_AT_byte_size
242	.byte	2                               # Abbrev [2] 0x29:0xb DW_TAG_variable
243	.byte	2                               # DW_AT_name
244	.long	37                              # DW_AT_type
245                                        # DW_AT_external
246	.byte	0                               # DW_AT_decl_file
247	.byte	7                               # DW_AT_decl_line
248	.byte	2                               # DW_AT_location
249	.byte	161
250	.byte	1
251	.byte	4                               # Abbrev [4] 0x34:0x23 DW_TAG_subprogram
252	.byte	2                               # DW_AT_low_pc
253	.long	.Lfunc_end0-.Lfunc_begin0       # DW_AT_high_pc
254	.byte	1                               # DW_AT_frame_base
255	.byte	86
256	.byte	3                               # DW_AT_linkage_name
257	.byte	4                               # DW_AT_name
258	.byte	0                               # DW_AT_decl_file
259	.byte	1                               # DW_AT_decl_line
260                                        # DW_AT_external
261	.byte	5                               # Abbrev [5] 0x40:0xb DW_TAG_formal_parameter
262	.byte	2                               # DW_AT_location
263	.byte	145
264	.byte	120
265	.byte	0                               # DW_AT_name
266	.byte	0                               # DW_AT_decl_file
267	.byte	1                               # DW_AT_decl_line
268	.long	125                             # DW_AT_type
269	.byte	5                               # Abbrev [5] 0x4b:0xb DW_TAG_formal_parameter
270	.byte	2                               # DW_AT_location
271	.byte	145
272	.byte	112
273	.byte	2                               # DW_AT_name
274	.byte	0                               # DW_AT_decl_file
275	.byte	1                               # DW_AT_decl_line
276	.long	125                             # DW_AT_type
277	.byte	0                               # End Of Children Mark
278	.byte	6                               # Abbrev [6] 0x57:0x26 DW_TAG_subprogram
279	.byte	3                               # DW_AT_low_pc
280	.long	.Lfunc_end1-.Lfunc_begin1       # DW_AT_high_pc
281	.byte	1                               # DW_AT_frame_base
282	.byte	86
283	.byte	5                               # DW_AT_name
284	.byte	0                               # DW_AT_decl_file
285	.byte	8                               # DW_AT_decl_line
286	.long	37                              # DW_AT_type
287                                        # DW_AT_external
288	.byte	5                               # Abbrev [5] 0x66:0xb DW_TAG_formal_parameter
289	.byte	2                               # DW_AT_location
290	.byte	145
291	.byte	120
292	.byte	6                               # DW_AT_name
293	.byte	0                               # DW_AT_decl_file
294	.byte	8                               # DW_AT_decl_line
295	.long	37                              # DW_AT_type
296	.byte	5                               # Abbrev [5] 0x71:0xb DW_TAG_formal_parameter
297	.byte	2                               # DW_AT_location
298	.byte	145
299	.byte	112
300	.byte	7                               # DW_AT_name
301	.byte	0                               # DW_AT_decl_file
302	.byte	8                               # DW_AT_decl_line
303	.long	130                             # DW_AT_type
304	.byte	0                               # End Of Children Mark
305	.byte	7                               # Abbrev [7] 0x7d:0x5 DW_TAG_pointer_type
306	.long	37                              # DW_AT_type
307	.byte	7                               # Abbrev [7] 0x82:0x5 DW_TAG_pointer_type
308	.long	135                             # DW_AT_type
309	.byte	7                               # Abbrev [7] 0x87:0x5 DW_TAG_pointer_type
310	.long	140                             # DW_AT_type
311	.byte	3                               # Abbrev [3] 0x8c:0x4 DW_TAG_base_type
312	.byte	8                               # DW_AT_name
313	.byte	6                               # DW_AT_encoding
314	.byte	1                               # DW_AT_byte_size
315	.byte	0                               # End Of Children Mark
316.Ldebug_info_dwo_end0:
317	.section	.debug_abbrev.dwo,"e",@progbits
318	.byte	1                               # Abbreviation Code
319	.byte	17                              # DW_TAG_compile_unit
320	.byte	1                               # DW_CHILDREN_yes
321	.byte	37                              # DW_AT_producer
322	.byte	37                              # DW_FORM_strx1
323	.byte	19                              # DW_AT_language
324	.byte	5                               # DW_FORM_data2
325	.byte	3                               # DW_AT_name
326	.byte	37                              # DW_FORM_strx1
327	.byte	118                             # DW_AT_dwo_name
328	.byte	37                              # DW_FORM_strx1
329	.byte	0                               # EOM(1)
330	.byte	0                               # EOM(2)
331	.byte	2                               # Abbreviation Code
332	.byte	52                              # DW_TAG_variable
333	.byte	0                               # DW_CHILDREN_no
334	.byte	3                               # DW_AT_name
335	.byte	37                              # DW_FORM_strx1
336	.byte	73                              # DW_AT_type
337	.byte	19                              # DW_FORM_ref4
338	.byte	63                              # DW_AT_external
339	.byte	25                              # DW_FORM_flag_present
340	.byte	58                              # DW_AT_decl_file
341	.byte	11                              # DW_FORM_data1
342	.byte	59                              # DW_AT_decl_line
343	.byte	11                              # DW_FORM_data1
344	.byte	2                               # DW_AT_location
345	.byte	24                              # DW_FORM_exprloc
346	.byte	0                               # EOM(1)
347	.byte	0                               # EOM(2)
348	.byte	3                               # Abbreviation Code
349	.byte	36                              # DW_TAG_base_type
350	.byte	0                               # DW_CHILDREN_no
351	.byte	3                               # DW_AT_name
352	.byte	37                              # DW_FORM_strx1
353	.byte	62                              # DW_AT_encoding
354	.byte	11                              # DW_FORM_data1
355	.byte	11                              # DW_AT_byte_size
356	.byte	11                              # DW_FORM_data1
357	.byte	0                               # EOM(1)
358	.byte	0                               # EOM(2)
359	.byte	4                               # Abbreviation Code
360	.byte	46                              # DW_TAG_subprogram
361	.byte	1                               # DW_CHILDREN_yes
362	.byte	17                              # DW_AT_low_pc
363	.byte	27                              # DW_FORM_addrx
364	.byte	18                              # DW_AT_high_pc
365	.byte	6                               # DW_FORM_data4
366	.byte	64                              # DW_AT_frame_base
367	.byte	24                              # DW_FORM_exprloc
368	.byte	110                             # DW_AT_linkage_name
369	.byte	37                              # DW_FORM_strx1
370	.byte	3                               # DW_AT_name
371	.byte	37                              # DW_FORM_strx1
372	.byte	58                              # DW_AT_decl_file
373	.byte	11                              # DW_FORM_data1
374	.byte	59                              # DW_AT_decl_line
375	.byte	11                              # DW_FORM_data1
376	.byte	63                              # DW_AT_external
377	.byte	25                              # DW_FORM_flag_present
378	.byte	0                               # EOM(1)
379	.byte	0                               # EOM(2)
380	.byte	5                               # Abbreviation Code
381	.byte	5                               # DW_TAG_formal_parameter
382	.byte	0                               # DW_CHILDREN_no
383	.byte	2                               # DW_AT_location
384	.byte	24                              # DW_FORM_exprloc
385	.byte	3                               # DW_AT_name
386	.byte	37                              # DW_FORM_strx1
387	.byte	58                              # DW_AT_decl_file
388	.byte	11                              # DW_FORM_data1
389	.byte	59                              # DW_AT_decl_line
390	.byte	11                              # DW_FORM_data1
391	.byte	73                              # DW_AT_type
392	.byte	19                              # DW_FORM_ref4
393	.byte	0                               # EOM(1)
394	.byte	0                               # EOM(2)
395	.byte	6                               # Abbreviation Code
396	.byte	46                              # DW_TAG_subprogram
397	.byte	1                               # DW_CHILDREN_yes
398	.byte	17                              # DW_AT_low_pc
399	.byte	27                              # DW_FORM_addrx
400	.byte	18                              # DW_AT_high_pc
401	.byte	6                               # DW_FORM_data4
402	.byte	64                              # DW_AT_frame_base
403	.byte	24                              # DW_FORM_exprloc
404	.byte	3                               # DW_AT_name
405	.byte	37                              # DW_FORM_strx1
406	.byte	58                              # DW_AT_decl_file
407	.byte	11                              # DW_FORM_data1
408	.byte	59                              # DW_AT_decl_line
409	.byte	11                              # DW_FORM_data1
410	.byte	73                              # DW_AT_type
411	.byte	19                              # DW_FORM_ref4
412	.byte	63                              # DW_AT_external
413	.byte	25                              # DW_FORM_flag_present
414	.byte	0                               # EOM(1)
415	.byte	0                               # EOM(2)
416	.byte	7                               # Abbreviation Code
417	.byte	15                              # DW_TAG_pointer_type
418	.byte	0                               # DW_CHILDREN_no
419	.byte	73                              # DW_AT_type
420	.byte	19                              # DW_FORM_ref4
421	.byte	0                               # EOM(1)
422	.byte	0                               # EOM(2)
423	.byte	0                               # EOM(3)
424	.section	.debug_addr,"",@progbits
425	.long	.Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
426.Ldebug_addr_start0:
427	.short	5                               # DWARF version number
428	.byte	8                               # Address size
429	.byte	0                               # Segment selector size
430.Laddr_table_base0:
431	.quad	x
432	.quad	y
433	.quad	.Lfunc_begin0
434	.quad	.Lfunc_begin1
435.Ldebug_addr_end0:
436	.section	.debug_gnu_pubnames,"",@progbits
437	.long	.LpubNames_end0-.LpubNames_start0 # Length of Public Names Info
438.LpubNames_start0:
439	.short	2                               # DWARF Version
440	.long	.Lcu_begin0                     # Offset of Compilation Unit Info
441	.long	40                              # Compilation Unit Length
442	.long	87                              # DIE offset
443	.byte	48                              # Attributes: FUNCTION, EXTERNAL
444	.asciz	"main"                          # External Name
445	.long	26                              # DIE offset
446	.byte	32                              # Attributes: VARIABLE, EXTERNAL
447	.asciz	"x"                             # External Name
448	.long	41                              # DIE offset
449	.byte	32                              # Attributes: VARIABLE, EXTERNAL
450	.asciz	"y"                             # External Name
451	.long	52                              # DIE offset
452	.byte	48                              # Attributes: FUNCTION, EXTERNAL
453	.asciz	"use"                           # External Name
454	.long	0                               # End Mark
455.LpubNames_end0:
456	.section	.debug_gnu_pubtypes,"",@progbits
457	.long	.LpubTypes_end0-.LpubTypes_start0 # Length of Public Types Info
458.LpubTypes_start0:
459	.short	2                               # DWARF Version
460	.long	.Lcu_begin0                     # Offset of Compilation Unit Info
461	.long	40                              # Compilation Unit Length
462	.long	37                              # DIE offset
463	.byte	144                             # Attributes: TYPE, STATIC
464	.asciz	"int"                           # External Name
465	.long	140                             # DIE offset
466	.byte	144                             # Attributes: TYPE, STATIC
467	.asciz	"char"                          # External Name
468	.long	0                               # End Mark
469.LpubTypes_end0:
470	.ident	"clang version 15.0.0"
471	.section	".note.GNU-stack","",@progbits
472	.section	.debug_line,"",@progbits
473.Lline_table_start0:
474