1 ; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s
3 ; Note: Print verbose stackmaps using -debug-only=stackmaps.
5 ; CHECK-LABEL: .section .llvm_stackmaps
6 ; CHECK-NEXT: __LLVM_StackMaps:
10 ; CHECK-NEXT: .hword 0
12 ; CHECK-NEXT: .word 14
16 ; CHECK-NEXT: .word 18
18 ; Functions and stack size
19 ; CHECK-NEXT: .xword constantargs
20 ; CHECK-NEXT: .xword 16
21 ; CHECK-NEXT: .xword 1
22 ; CHECK-NEXT: .xword osrinline
23 ; CHECK-NEXT: .xword 32
24 ; CHECK-NEXT: .xword 1
25 ; CHECK-NEXT: .xword osrcold
26 ; CHECK-NEXT: .xword 16
27 ; CHECK-NEXT: .xword 1
28 ; CHECK-NEXT: .xword propertyRead
29 ; CHECK-NEXT: .xword 16
30 ; CHECK-NEXT: .xword 1
31 ; CHECK-NEXT: .xword propertyWrite
32 ; CHECK-NEXT: .xword 16
33 ; CHECK-NEXT: .xword 1
34 ; CHECK-NEXT: .xword jsVoidCall
35 ; CHECK-NEXT: .xword 16
36 ; CHECK-NEXT: .xword 1
37 ; CHECK-NEXT: .xword jsIntCall
38 ; CHECK-NEXT: .xword 16
39 ; CHECK-NEXT: .xword 1
40 ; CHECK-NEXT: .xword spilledValue
41 ; CHECK-NEXT: .xword 144
42 ; CHECK-NEXT: .xword 1
43 ; CHECK-NEXT: .xword spilledStackMapValue
44 ; CHECK-NEXT: .xword 128
45 ; CHECK-NEXT: .xword 1
46 ; CHECK-NEXT: .xword liveConstant
47 ; CHECK-NEXT: .xword 16
48 ; CHECK-NEXT: .xword 1
49 ; CHECK-NEXT: .xword directFrameIdx
50 ; CHECK-NEXT: .xword 64
51 ; CHECK-NEXT: .xword 2
52 ; CHECK-NEXT: .xword longid
53 ; CHECK-NEXT: .xword 16
54 ; CHECK-NEXT: .xword 4
55 ; CHECK-NEXT: .xword clobberLR
56 ; CHECK-NEXT: .xword 112
57 ; CHECK-NEXT: .xword 1
58 ; CHECK-NEXT: .xword needsStackRealignment
59 ; CHECK-NEXT: .xword -1
60 ; CHECK-NEXT: .xword 1
63 ; CHECK-NEXT: .xword 2147483648
64 ; CHECK-NEXT: .xword 4294967295
65 ; CHECK-NEXT: .xword 4294967296
70 ; CHECK-NEXT: .xword 1
71 ; CHECK-NEXT: .word .L{{.*}}-constantargs
72 ; CHECK-NEXT: .hword 0
73 ; CHECK-NEXT: .hword 12
77 ; CHECK-NEXT: .hword 8
78 ; CHECK-NEXT: .hword 0
79 ; CHECK-NEXT: .hword 0
80 ; CHECK-NEXT: .word -1
84 ; CHECK-NEXT: .hword 8
85 ; CHECK-NEXT: .hword 0
86 ; CHECK-NEXT: .hword 0
87 ; CHECK-NEXT: .word -1
91 ; CHECK-NEXT: .hword 8
92 ; CHECK-NEXT: .hword 0
93 ; CHECK-NEXT: .hword 0
94 ; CHECK-NEXT: .word 65536
98 ; CHECK-NEXT: .hword 8
99 ; CHECK-NEXT: .hword 0
100 ; CHECK-NEXT: .hword 0
101 ; CHECK-NEXT: .word 2000000000
103 ; CHECK-NEXT: .byte 4
104 ; CHECK-NEXT: .byte 0
105 ; CHECK-NEXT: .hword 8
106 ; CHECK-NEXT: .hword 0
107 ; CHECK-NEXT: .hword 0
108 ; CHECK-NEXT: .word 2147483647
110 ; CHECK-NEXT: .byte 4
111 ; CHECK-NEXT: .byte 0
112 ; CHECK-NEXT: .hword 8
113 ; CHECK-NEXT: .hword 0
114 ; CHECK-NEXT: .hword 0
115 ; CHECK-NEXT: .word -1
117 ; CHECK-NEXT: .byte 4
118 ; CHECK-NEXT: .byte 0
119 ; CHECK-NEXT: .hword 8
120 ; CHECK-NEXT: .hword 0
121 ; CHECK-NEXT: .hword 0
122 ; CHECK-NEXT: .word -1
124 ; CHECK-NEXT: .byte 4
125 ; CHECK-NEXT: .byte 0
126 ; CHECK-NEXT: .hword 8
127 ; CHECK-NEXT: .hword 0
128 ; CHECK-NEXT: .hword 0
129 ; CHECK-NEXT: .word 0
130 ; LargeConstant at index 0
131 ; CHECK-NEXT: .byte 5
132 ; CHECK-NEXT: .byte 0
133 ; CHECK-NEXT: .hword 8
134 ; CHECK-NEXT: .hword 0
135 ; CHECK-NEXT: .hword 0
136 ; CHECK-NEXT: .word 0
137 ; LargeConstant at index 1
138 ; CHECK-NEXT: .byte 5
139 ; CHECK-NEXT: .byte 0
140 ; CHECK-NEXT: .hword 8
141 ; CHECK-NEXT: .hword 0
142 ; CHECK-NEXT: .hword 0
143 ; CHECK-NEXT: .word 1
144 ; LargeConstant at index 2
145 ; CHECK-NEXT: .byte 5
146 ; CHECK-NEXT: .byte 0
147 ; CHECK-NEXT: .hword 8
148 ; CHECK-NEXT: .hword 0
149 ; CHECK-NEXT: .hword 0
150 ; CHECK-NEXT: .word 2
152 ; CHECK-NEXT: .byte 4
153 ; CHECK-NEXT: .byte 0
154 ; CHECK-NEXT: .hword 8
155 ; CHECK-NEXT: .hword 0
156 ; CHECK-NEXT: .hword 0
157 ; CHECK-NEXT: .word -1
159 define void @constantargs() {
161 %0 = inttoptr i64 12345 to i8*
162 tail call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 1, i32 16, i8* %0, i32 0, i16 65535, i16 -1, i32 65536, i32 2000000000, i32 2147483647, i32 -1, i32 4294967295, i32 4294967296, i64 2147483648, i64 4294967295, i64 4294967296, i64 -1)
168 ; CHECK-LABEL: .word .L{{.*}}-osrinline
169 ; CHECK-NEXT: .hword 0
170 ; CHECK-NEXT: .hword 2
171 ; CHECK-NEXT: .byte 1
172 ; CHECK-NEXT: .byte 0
173 ; CHECK-NEXT: .hword 8
174 ; CHECK-NEXT: .hword {{[0-9]+}}
175 ; CHECK-NEXT: .hword 0
176 ; CHECK-NEXT: .word 0
177 ; CHECK-NEXT: .byte 1
178 ; CHECK-NEXT: .byte 0
179 ; CHECK-NEXT: .hword 8
180 ; CHECK-NEXT: .hword {{[0-9]+}}
181 ; CHECK-NEXT: .hword 0
182 ; CHECK-NEXT: .word 0
183 define void @osrinline(i64 %a, i64 %b) {
185 ; Runtime void->void call.
186 call void inttoptr (i64 -559038737 to void ()*)()
187 ; Followed by inline OSR patchpoint with 12-byte shadow and 2 live vars.
188 call void (i64, i32, ...) @llvm.experimental.stackmap(i64 3, i32 12, i64 %a, i64 %b)
194 ; 2 live variables in register.
196 ; CHECK-LABEL: .word .L{{.*}}-osrcold
197 ; CHECK-NEXT: .hword 0
198 ; CHECK-NEXT: .hword 2
199 ; CHECK-NEXT: .byte 1
200 ; CHECK-NEXT: .byte 0
201 ; CHECK-NEXT: .hword 8
202 ; CHECK-NEXT: .hword {{[0-9]+}}
203 ; CHECK-NEXT: .hword 0
204 ; CHECK-NEXT: .word 0
205 ; CHECK-NEXT: .byte 1
206 ; CHECK-NEXT: .byte 0
207 ; CHECK-NEXT: .hword 8
208 ; CHECK-NEXT: .hword {{[0-9]+}}
209 ; CHECK-NEXT: .hword 0
210 ; CHECK-NEXT: .word 0
211 define void @osrcold(i64 %a, i64 %b) {
213 %test = icmp slt i64 %a, %b
214 br i1 %test, label %ret, label %cold
216 ; OSR patchpoint with 12-byte nop-slide and 2 live vars.
217 %thunk = inttoptr i64 3735928559 to i8*
218 call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 4, i32 16, i8* %thunk, i32 0, i64 %a, i64 %b)
225 ; CHECK-LABEL: .word .L{{.*}}-propertyRead
226 ; CHECK-NEXT: .hword 0
227 ; CHECK-NEXT: .hword 2
228 ; CHECK-NEXT: .byte 1
229 ; CHECK-NEXT: .byte 0
230 ; CHECK-NEXT: .hword 8
231 ; CHECK-NEXT: .hword {{[0-9]+}}
232 ; CHECK-NEXT: .hword 0
233 ; CHECK-NEXT: .word 0
234 ; CHECK-NEXT: .byte 1
235 ; CHECK-NEXT: .byte 0
236 ; CHECK-NEXT: .hword 8
237 ; CHECK-NEXT: .hword {{[0-9]+}}
238 ; CHECK-NEXT: .hword 0
239 ; CHECK-NEXT: .word 0
240 define i64 @propertyRead(i64* %obj) {
242 %resolveRead = inttoptr i64 3735928559 to i8*
243 %result = call anyregcc i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 5, i32 16, i8* %resolveRead, i32 1, i64* %obj)
244 %add = add i64 %result, 3
249 ; CHECK-LABEL: .word .L{{.*}}-propertyWrite
250 ; CHECK-NEXT: .hword 0
251 ; CHECK-NEXT: .hword 2
252 ; CHECK-NEXT: .byte 1
253 ; CHECK-NEXT: .byte 0
254 ; CHECK-NEXT: .hword 8
255 ; CHECK-NEXT: .hword {{[0-9]+}}
256 ; CHECK-NEXT: .hword 0
257 ; CHECK-NEXT: .word 0
258 ; CHECK-NEXT: .byte 1
259 ; CHECK-NEXT: .byte 0
260 ; CHECK-NEXT: .hword 8
261 ; CHECK-NEXT: .hword {{[0-9]+}}
262 ; CHECK-NEXT: .hword 0
263 ; CHECK-NEXT: .word 0
264 define void @propertyWrite(i64 %dummy1, i64* %obj, i64 %dummy2, i64 %a) {
266 %resolveWrite = inttoptr i64 3735928559 to i8*
267 call anyregcc void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 6, i32 16, i8* %resolveWrite, i32 2, i64* %obj, i64 %a)
273 ; 2 live variables in registers.
275 ; CHECK-LABEL: .word .L{{.*}}-jsVoidCall
276 ; CHECK-NEXT: .hword 0
277 ; CHECK-NEXT: .hword 2
278 ; CHECK-NEXT: .byte 1
279 ; CHECK-NEXT: .byte 0
280 ; CHECK-NEXT: .hword 8
281 ; CHECK-NEXT: .hword {{[0-9]+}}
282 ; CHECK-NEXT: .hword 0
283 ; CHECK-NEXT: .word 0
284 ; CHECK-NEXT: .byte 1
285 ; CHECK-NEXT: .byte 0
286 ; CHECK-NEXT: .hword 8
287 ; CHECK-NEXT: .hword {{[0-9]+}}
288 ; CHECK-NEXT: .hword 0
289 ; CHECK-NEXT: .word 0
290 define void @jsVoidCall(i64 %dummy1, i64* %obj, i64 %arg, i64 %l1, i64 %l2) {
292 %resolveCall = inttoptr i64 3735928559 to i8*
293 call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 7, i32 16, i8* %resolveCall, i32 2, i64* %obj, i64 %arg, i64 %l1, i64 %l2)
299 ; 2 live variables in registers.
301 ; CHECK-LABEL: .word .L{{.*}}-jsIntCall
302 ; CHECK-NEXT: .hword 0
303 ; CHECK-NEXT: .hword 2
304 ; CHECK-NEXT: .byte 1
305 ; CHECK-NEXT: .byte 0
306 ; CHECK-NEXT: .hword 8
307 ; CHECK-NEXT: .hword {{[0-9]+}}
308 ; CHECK-NEXT: .hword 0
309 ; CHECK-NEXT: .word 0
310 ; CHECK-NEXT: .byte 1
311 ; CHECK-NEXT: .byte 0
312 ; CHECK-NEXT: .hword 8
313 ; CHECK-NEXT: .hword {{[0-9]+}}
314 ; CHECK-NEXT: .hword 0
315 ; CHECK-NEXT: .word 0
316 define i64 @jsIntCall(i64 %dummy1, i64* %obj, i64 %arg, i64 %l1, i64 %l2) {
318 %resolveCall = inttoptr i64 3735928559 to i8*
319 %result = call i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 8, i32 16, i8* %resolveCall, i32 2, i64* %obj, i64 %arg, i64 %l1, i64 %l2)
320 %add = add i64 %result, 3
324 ; Spilled stack map values.
326 ; Verify 28 stack map entries.
328 ; CHECK-LABEL: .word .L{{.*}}-spilledValue
329 ; CHECK-NEXT: .hword 0
330 ; CHECK-NEXT: .hword 28
332 ; Check that at least one is a spilled entry from RBP.
333 ; Location: Indirect RBP + ...
335 ; CHECK-NEXT: .byte 0
336 ; CHECK-NEXT: .hword 8
337 ; CHECK-NEXT: .hword 29
338 ; CHECK-NEXT: .hword 0
340 define void @spilledValue(i64 %arg0, i64 %arg1, i64 %arg2, i64 %arg3, i64 %arg4, i64 %l0, i64 %l1, i64 %l2, i64 %l3, i64 %l4, i64 %l5, i64 %l6, i64 %l7, i64 %l8, i64 %l9, i64 %l10, i64 %l11, i64 %l12, i64 %l13, i64 %l14, i64 %l15, i64 %l16, i64 %l17, i64 %l18, i64 %l19, i64 %l20, i64 %l21, i64 %l22, i64 %l23, i64 %l24, i64 %l25, i64 %l26, i64 %l27) {
342 call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 11, i32 20, i8* null, i32 5, i64 %arg0, i64 %arg1, i64 %arg2, i64 %arg3, i64 %arg4, i64 %l0, i64 %l1, i64 %l2, i64 %l3, i64 %l4, i64 %l5, i64 %l6, i64 %l7, i64 %l8, i64 %l9, i64 %l10, i64 %l11, i64 %l12, i64 %l13, i64 %l14, i64 %l15, i64 %l16, i64 %l17, i64 %l18, i64 %l19, i64 %l20, i64 %l21, i64 %l22, i64 %l23, i64 %l24, i64 %l25, i64 %l26, i64 %l27)
346 ; Spilled stack map values.
348 ; Verify 30 stack map entries.
350 ; CHECK-LABEL: .word .L{{.*}}-spilledStackMapValue
351 ; CHECK-NEXT: .hword 0
352 ; CHECK-NEXT: .hword 30
354 ; Check that at least one is a spilled entry from RBP.
355 ; Location: Indirect RBP + ...
357 ; CHECK-NEXT: .byte 0
358 ; CHECK-NEXT: .hword 8
359 ; CHECK-NEXT: .hword 29
360 ; CHECK-NEXT: .hword 0
362 define webkit_jscc void @spilledStackMapValue(i64 %l0, i64 %l1, i64 %l2, i64 %l3, i64 %l4, i64 %l5, i64 %l6, i64 %l7, i64 %l8, i64 %l9, i64 %l10, i64 %l11, i64 %l12, i64 %l13, i64 %l14, i64 %l15, i64 %l16, i64 %l17, i64 %l18, i64 %l19, i64 %l20, i64 %l21, i64 %l22, i64 %l23, i64 %l24, i64 %l25, i64 %l26, i64 %l27, i64 %l28, i64 %l29) {
364 call void (i64, i32, ...) @llvm.experimental.stackmap(i64 12, i32 16, i64 %l0, i64 %l1, i64 %l2, i64 %l3, i64 %l4, i64 %l5, i64 %l6, i64 %l7, i64 %l8, i64 %l9, i64 %l10, i64 %l11, i64 %l12, i64 %l13, i64 %l14, i64 %l15, i64 %l16, i64 %l17, i64 %l18, i64 %l19, i64 %l20, i64 %l21, i64 %l22, i64 %l23, i64 %l24, i64 %l25, i64 %l26, i64 %l27, i64 %l28, i64 %l29)
368 ; Map a constant value.
370 ; CHECK-LABEL: .word .L{{.*}}-liveConstant
371 ; CHECK-NEXT: .hword 0
373 ; CHECK-NEXT: .hword 1
374 ; Loc 0: SmallConstant
375 ; CHECK-NEXT: .byte 4
376 ; CHECK-NEXT: .byte 0
377 ; CHECK-NEXT: .hword 8
378 ; CHECK-NEXT: .hword 0
379 ; CHECK-NEXT: .hword 0
380 ; CHECK-NEXT: .word 33
382 define void @liveConstant() {
383 tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 15, i32 4, i32 33)
387 ; Directly map an alloca's address.
390 ; CHECK-LABEL: .word .L{{.*}}-directFrameIdx
391 ; CHECK-NEXT: .hword 0
393 ; CHECK-NEXT: .hword 1
394 ; Loc 0: Direct RBP - ofs
395 ; CHECK-NEXT: .byte 2
396 ; CHECK-NEXT: .byte 0
397 ; CHECK-NEXT: .hword 8
398 ; CHECK-NEXT: .hword 29
399 ; CHECK-NEXT: .hword 0
403 ; CHECK-LABEL: .word .L{{.*}}-directFrameIdx
404 ; CHECK-NEXT: .hword 0
406 ; CHECK-NEXT: .hword 2
407 ; Loc 0: Direct RBP - ofs
408 ; CHECK-NEXT: .byte 2
409 ; CHECK-NEXT: .byte 0
410 ; CHECK-NEXT: .hword 8
411 ; CHECK-NEXT: .hword 29
412 ; CHECK-NEXT: .hword 0
414 ; Loc 1: Direct RBP - ofs
415 ; CHECK-NEXT: .byte 2
416 ; CHECK-NEXT: .byte 0
417 ; CHECK-NEXT: .hword 8
418 ; CHECK-NEXT: .hword 29
419 ; CHECK-NEXT: .hword 0
421 define void @directFrameIdx() {
423 %metadata1 = alloca i64, i32 3, align 8
424 store i64 11, i64* %metadata1
425 store i64 12, i64* %metadata1
426 store i64 13, i64* %metadata1
427 call void (i64, i32, ...) @llvm.experimental.stackmap(i64 16, i32 0, i64* %metadata1)
428 %metadata2 = alloca i8, i32 4, align 8
429 %metadata3 = alloca i16, i32 4, align 8
430 call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 17, i32 4, i8* null, i32 0, i8* %metadata2, i16* %metadata3)
436 ; CHECK: .xword 4294967295
437 ; CHECK-LABEL: .word .L{{.*}}-longid
438 ; CHECK: .xword 4294967296
439 ; CHECK-LABEL: .word .L{{.*}}-longid
440 ; CHECK: .xword 9223372036854775807
441 ; CHECK-LABEL: .word .L{{.*}}-longid
443 ; CHECK-LABEL: .word .L{{.*}}-longid
444 define void @longid() {
446 tail call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 4294967295, i32 0, i8* null, i32 0)
447 tail call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 4294967296, i32 0, i8* null, i32 0)
448 tail call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 9223372036854775807, i32 0, i8* null, i32 0)
449 tail call void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 -1, i32 0, i8* null, i32 0)
453 ; Map a value when R11 is the only free register.
454 ; The scratch register should not be used for a live stackmap value.
456 ; CHECK-LABEL: .word .L{{.*}}-clobberLR
457 ; CHECK-NEXT: .hword 0
459 ; CHECK-NEXT: .hword 1
460 ; Loc 0: Indirect fp - offset
461 ; CHECK-NEXT: .byte 3
462 ; CHECK-NEXT: .byte 0
463 ; CHECK-NEXT: .hword 4
464 ; CHECK-NEXT: .hword 29
465 ; CHECK-NEXT: .hword 0
466 ; CHECK-NEXT: .word -{{[0-9]+}}
467 define void @clobberLR(i32 %a) {
468 tail call void asm sideeffect "nop", "~{x0},~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7},~{x8},~{x9},~{x10},~{x11},~{x12},~{x13},~{x14},~{x15},~{x16},~{x17},~{x18},~{x19},~{x20},~{x21},~{x22},~{x23},~{x24},~{x25},~{x26},~{x27},~{x28},~{x29},~{x31}"() nounwind
469 tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 16, i32 8, i32 %a)
473 ; A stack frame which needs to be realigned at runtime (to meet alignment
474 ; criteria for values on the stack) does not have a fixed frame size.
475 ; CHECK-LABEL: .word .L{{.*}}-needsStackRealignment
476 ; CHECK-NEXT: .hword 0
478 ; CHECK-NEXT: .hword 0
479 define void @needsStackRealignment() {
480 %val = alloca i64, i32 3, align 128
481 tail call void (...) @escape_values(i64* %val)
482 ; Note: Adding any non-constant to the stackmap would fail because we
483 ; expected to be able to address off the frame pointer. In a realigned
484 ; frame, we must use the stack pointer instead. This is a separate bug.
485 tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 0, i32 0)
488 declare void @escape_values(...)
490 declare void @llvm.experimental.stackmap(i64, i32, ...)
491 declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
492 declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)