File: trailing-inlined-function.s

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (324 lines) | stat: -rw-r--r-- 7,405 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# REQUIRES: x86-registered-target
# RUN: llvm-mc -filetype=obj --triple=x86_64-pc-windows-msvc %s | llvm-readobj - --codeview --codeview-subsection-bytes | FileCheck %s

# Rust source to regenerate:
# #[no_mangle]
# extern "C" fn add_numbers(x: &Option<i32>, y: &Option<i32>) -> i32 {
#     let x1 = x.unwrap();
#     let y1 = y.unwrap();
#     x1 + y1
# }
# $ rustc trailing-inlined-function.rs --crate-type cdylib --emit=asm -Copt-level=3 -Cpanic=abort -Cdebuginfo=1

# Validate that unwrap() was inlined.
# CHECK:       InlineSiteSym {
# CHECK-NEXT:    Kind: S_INLINESITE (0x114D)
# CHECK-NEXT:    PtrParent: 0x0
# CHECK-NEXT:    PtrEnd: 0x0
# CHECK-NEXT:    Inlinee: unwrap
# CHECK-NEXT:    BinaryAnnotations [
# CHECK-NEXT:      ChangeCodeOffsetAndLineOffset: {CodeOffset: [[#%#x,Offset1_1:]], LineOffset: 1}
# CHECK-NEXT:      ChangeCodeLength: [[#%#x,Length1_1:]]
# CHECK-NEXT:      ChangeLineOffset: 2
# CHECK-NEXT:      ChangeCodeOffset: [[#%#x,Offset1_2:]]
# CHECK-NEXT:      ChangeCodeLength: [[#%#x,]]
# CHECK-NEXT:      (Annotation Padding)
# CHECK:      InlineSiteSym {
# CHECK-NEXT:    Kind: S_INLINESITE (0x114D)
# CHECK-NEXT:    PtrParent: 0x0
# CHECK-NEXT:    PtrEnd: 0x0
# CHECK-NEXT:    Inlinee: unwrap
# CHECK-NEXT:    BinaryAnnotations [
# CHECK-NEXT:      ChangeCodeOffsetAndLineOffset: {CodeOffset: [[#%#x,Offset2_1:]], LineOffset: 1}
# CHECK-NEXT:      ChangeCodeLength: [[#%#x,Length2_1:]]
# CHECK-NEXT:      ChangeLineOffset: 2
# CHECK-NEXT:      ChangeCodeOffset: [[#%#x,Offset2_2:]]
# CHECK-NEXT:      ChangeCodeLength: [[#%#x,]]
# CHECK-NEXT:      (Annotation Padding)

# Validate that basic blocks from an inlined function that are sunk below the rest of the function
# (namely bb1 and bb4 in this test) get the correct debug info.
# CHECK:       SubSectionType: Lines (0xF2)
# CHECK-NEXT:   SubSectionSize: [[#%#x,]]
# CHECK-NEXT:   SubSectionContents (
# CHECK-NEXT:     0000: [[#%.8X,]] [[#%.8X,]] [[#%.8X,]] [[#%.8X,]]
#                       Code starts at line 2
# CHECK-NEXT:     0010: [[#%.8X,]] [[#%.8X,]] [[#%.8X,]] 02000000
#                       The success paths for unwrap() (lines 3 & 4) are next.
# CHECK-NEXT:     0020: [[#%.2X,Offset1_1]]000000 03000000 [[#%.2X,Offset2_1]]000000 04000000
#                       Then the addition (line 5) and the end of the function (end-brace on line 6).
# CHECK-NEXT:     0030: [[#%.8X,]] 05000000 [[#%.8X,]] 06000000
#                       The failure paths for unwrap() (lines 3 & 4) are placed after the `ret` instruction.
# CHECK-NEXT:     0040: [[#%.2X,Offset1_1 + Length1_1 + Offset1_2]]000000 03000000 [[#%.2X,Offset2_1 + Length2_1 + Offset2_2]]000000 04000000
# CHECK-NOT:    SubSectionType: Lines (0xF2)

	.text
	.def	@feat.00;
	.scl	3;
	.type	0;
	.endef
	.globl	@feat.00
.set @feat.00, 0
	.file	"trailing_inlined_function.3a6e73a087a7434a-cgu.0"
	.def	add_numbers;
	.scl	2;
	.type	32;
	.endef
	.section	.text,"xr",one_only,add_numbers
	.globl	add_numbers
	.p2align	4, 0x90
add_numbers:
.Lfunc_begin0:
	.cv_func_id 0
	.cv_file	1 "C:\\llvm\\trailing-inlined-function.rs" "A63E3A719BDF505386FDB73BF86EC58591BDAC588181F0E423E724AEEC3E4852" 3
	.cv_loc	0 1 2 0
.seh_proc add_numbers
	subq	$40, %rsp
	.seh_stackalloc 40
	.seh_endprologue
.Ltmp0:
	.cv_file	2 "/rustc/bc28abf92efc32f8f9312851bf8af38fbd23be42\\library\\core\\src\\option.rs" "7B702FA8D5AAEDC0CCA1EE32F30D5922BC11516B54D592279493A30457F918D9" 3
	.cv_inline_site_id 1 within 0 inlined_at 1 3 0
	.cv_loc	1 2 933 0
	cmpl	$0, (%rcx)
	je	.LBB0_1
.Ltmp1:
	.cv_inline_site_id 2 within 0 inlined_at 1 4 0
	.cv_loc	2 2 933 0
	cmpl	$0, (%rdx)
	je	.LBB0_4
.Ltmp2:
	.cv_loc	0 1 5 0
	movl	4(%rcx), %eax
.Ltmp3:
	addl	4(%rdx), %eax
.Ltmp4:
	.cv_loc	0 1 6 0
	addq	$40, %rsp
	retq
.LBB0_1:
.Ltmp5:
	.cv_loc	1 2 935 0
	leaq	__unnamed_1(%rip), %rcx
	leaq	__unnamed_2(%rip), %r8
.Ltmp6:
	movl	$43, %edx
	callq	_ZN4core9panicking5panic17hd083df7b722701afE
	ud2
.LBB0_4:
.Ltmp7:
	.cv_loc	2 2 935 0
	leaq	__unnamed_1(%rip), %rcx
	leaq	__unnamed_3(%rip), %r8
.Ltmp8:
	movl	$43, %edx
	callq	_ZN4core9panicking5panic17hd083df7b722701afE
	ud2
.Ltmp9:
.Lfunc_end0:
	.seh_endproc

	.section	.rdata,"dr",one_only,__unnamed_1
__unnamed_1:
	.ascii	"called `Option::unwrap()` on a `None` value"

	.section	.rdata,"dr",one_only,__unnamed_4
__unnamed_4:
	.ascii	"trailing-inlined-function.rs"

	.section	.rdata,"dr",one_only,__unnamed_2
	.p2align	3, 0x0
__unnamed_2:
	.quad	__unnamed_4
	.asciz	"\034\000\000\000\000\000\000\000\003\000\000\000\020\000\000"

	.section	.rdata,"dr",one_only,__unnamed_3
	.p2align	3, 0x0
__unnamed_3:
	.quad	__unnamed_4
	.asciz	"\034\000\000\000\000\000\000\000\004\000\000\000\020\000\000"

	.section	.debug$S,"dr"
	.p2align	2, 0x0
	.long	4
	.long	241
	.long	.Ltmp11-.Ltmp10
.Ltmp10:
	.short	.Ltmp13-.Ltmp12
.Ltmp12:
	.short	4353
	.long	0
	.byte	0
	.p2align	2, 0x0
.Ltmp13:
	.short	.Ltmp15-.Ltmp14
.Ltmp14:
	.short	4412
	.long	21
	.short	208
	.short	1
	.short	73
	.short	0
	.short	0
	.short	17000
	.short	0
	.short	0
	.short	0
	.asciz	"clang LLVM (rustc version 1.73.0-beta.3 (bc28abf92 2023-08-27))"
	.p2align	2, 0x0
.Ltmp15:
.Ltmp11:
	.p2align	2, 0x0
	.long	246
	.long	.Ltmp17-.Ltmp16
.Ltmp16:
	.long	0


	.long	4099
	.cv_filechecksumoffset	2
	.long	932


	.long	4099
	.cv_filechecksumoffset	2
	.long	932
.Ltmp17:
	.p2align	2, 0x0
	.section	.debug$S,"dr",associative,add_numbers
	.p2align	2, 0x0
	.long	4
	.long	241
	.long	.Ltmp19-.Ltmp18
.Ltmp18:
	.short	.Ltmp21-.Ltmp20
.Ltmp20:
	.short	4423
	.long	0
	.long	0
	.long	0
	.long	.Lfunc_end0-add_numbers
	.long	0
	.long	0
	.long	4101
	.secrel32	add_numbers
	.secidx	add_numbers
	.byte	128
	.asciz	"trailing_inlined_function::add_numbers"
	.p2align	2, 0x0
.Ltmp21:
	.short	.Ltmp23-.Ltmp22
.Ltmp22:
	.short	4114
	.long	40
	.long	0
	.long	0
	.long	0
	.long	0
	.short	0
	.long	1138688
	.p2align	2, 0x0
.Ltmp23:
	.short	.Ltmp25-.Ltmp24
.Ltmp24:
	.short	4429
	.long	0
	.long	0
	.long	4099
	.cv_inline_linetable	1 2 932 .Lfunc_begin0 .Lfunc_end0
	.p2align	2, 0x0
.Ltmp25:
	.short	2
	.short	4430
	.short	.Ltmp27-.Ltmp26
.Ltmp26:
	.short	4429
	.long	0
	.long	0
	.long	4099
	.cv_inline_linetable	2 2 932 .Lfunc_begin0 .Lfunc_end0
	.p2align	2, 0x0
.Ltmp27:
	.short	2
	.short	4430
	.short	2
	.short	4431
.Ltmp19:
	.p2align	2, 0x0
	.cv_linetable	0, add_numbers, .Lfunc_end0
	.section	.debug$S,"dr"
	.cv_filechecksums
	.cv_stringtable
	.long	241
	.long	.Ltmp29-.Ltmp28
.Ltmp28:
	.short	.Ltmp31-.Ltmp30
.Ltmp30:
	.short	4428
	.long	4105
	.p2align	2, 0x0
.Ltmp31:
.Ltmp29:
	.p2align	2, 0x0
	.section	.debug$T,"dr"
	.p2align	2, 0x0
	.long	4
	.short	0x1e
	.short	0x1605
	.long	0x0
	.asciz	"core::option::Option"
	.byte	243
	.byte	242
	.byte	241
	.short	0x6
	.short	0x1201
	.long	0x0
	.short	0xe
	.short	0x1008
	.long	0x3
	.byte	0x0
	.byte	0x0
	.short	0x0
	.long	0x1001
	.short	0x12
	.short	0x1601
	.long	0x1000
	.long	0x1002
	.asciz	"unwrap"
	.byte	241
	.short	0x22
	.short	0x1605
	.long	0x0
	.asciz	"trailing_inlined_function"
	.byte	242
	.byte	241
	.short	0x16
	.short	0x1601
	.long	0x1004
	.long	0x1002
	.asciz	"add_numbers"
	.short	0xe
	.short	0x1605
	.long	0x0
	.asciz	"C:\\llvm"
	.short	0x56
	.short	0x1605
	.long	0x0
	.asciz	"trailing-inlined-function.rs\\@\\trailing_inlined_function.3a6e73a087a7434a-cgu.0"
	.short	0xa
	.short	0x1605
	.long	0x0
	.byte	0
	.byte	243
	.byte	242
	.byte	241
	.short	0x1a
	.short	0x1603
	.short	0x5
	.long	0x1006
	.long	0x0
	.long	0x1007
	.long	0x1008
	.long	0x0
	.byte	242
	.byte	241