1 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s
3 ; Note: Print verbose stackmaps using -debug-only=stackmaps.
5 ; We are not getting the correct stack alignment when cross compiling for arm64.
6 ; So specify a datalayout here.
7 target datalayout = "E-m:e-i64:64-n32:64"
8 target triple = "powerpc64-unknown-linux-gnu"
10 ; CHECK-LABEL: constantargs:
11 ; CHECK: {{^}}.L[[constantargs_BEGIN:.*]]:{{$}}
13 ; CHECK-LABEL: osrinline:
14 ; CHECK: {{^}}.L[[osrinline_BEGIN:.*]]:{{$}}
16 ; CHECK-LABEL: osrcold:
17 ; CHECK: {{^}}.L[[osrcold_BEGIN:.*]]:{{$}}
19 ; CHECK-LABEL: propertyRead:
20 ; CHECK: {{^}}.L[[propertyRead_BEGIN:.*]]:{{$}}
22 ; CHECK-LABEL: propertyWrite:
23 ; CHECK: {{^}}.L[[propertyWrite_BEGIN:.*]]:{{$}}
25 ; CHECK-LABEL: jsVoidCall:
26 ; CHECK: {{^}}.L[[jsVoidCall_BEGIN:.*]]:{{$}}
28 ; CHECK-LABEL: jsIntCall:
29 ; CHECK: {{^}}.L[[jsIntCall_BEGIN:.*]]:{{$}}
31 ; CHECK-LABEL: spilledValue:
32 ; CHECK: {{^}}.L[[spilledValue_BEGIN:.*]]:{{$}}
34 ; CHECK-LABEL: spilledStackMapValue:
35 ; CHECK: {{^}}.L[[spilledStackMapValue_BEGIN:.*]]:{{$}}
37 ; CHECK-LABEL: liveConstant:
38 ; CHECK: {{^}}.L[[liveConstant_BEGIN:.*]]:{{$}}
40 ; CHECK-LABEL: clobberLR:
41 ; CHECK: {{^}}.L[[clobberLR_BEGIN:.*]]:{{$}}
43 ; CHECK-LABEL: floats:
44 ; CHECK: {{^}}.L[[floats_BEGIN:.*]]:{{$}}
47 ; CHECK-LABEL: .section .llvm_stackmaps
48 ; CHECK-NEXT: __LLVM_StackMaps:
52 ; CHECK-NEXT: .short 0
54 ; CHECK-NEXT: .long 12
58 ; CHECK-NEXT: .long 12
60 ; Functions and stack size
61 ; CHECK-NEXT: .quad constantargs
62 ; CHECK-NEXT: .quad 128
64 ; CHECK-NEXT: .quad osrinline
65 ; CHECK-NEXT: .quad 144
67 ; CHECK-NEXT: .quad osrcold
68 ; CHECK-NEXT: .quad 128
70 ; CHECK-NEXT: .quad propertyRead
71 ; CHECK-NEXT: .quad 128
73 ; CHECK-NEXT: .quad propertyWrite
74 ; CHECK-NEXT: .quad 128
76 ; CHECK-NEXT: .quad jsVoidCall
77 ; CHECK-NEXT: .quad 128
79 ; CHECK-NEXT: .quad jsIntCall
80 ; CHECK-NEXT: .quad 128
82 ; CHECK-NEXT: .quad spilledValue
83 ; CHECK-NEXT: .quad 304
85 ; CHECK-NEXT: .quad spilledStackMapValue
86 ; CHECK-NEXT: .quad 224
88 ; CHECK-NEXT: .quad liveConstant
89 ; CHECK-NEXT: .quad 64
91 ; CHECK-NEXT: .quad clobberLR
92 ; CHECK-NEXT: .quad 208
94 ; CHECK-NEXT: .quad floats
95 ; CHECK-NEXT: .quad 80
99 ; CHECK-NEXT: .quad 4294967295
100 ; CHECK-NEXT: .quad 4294967296
101 ; CHECK-NEXT: .quad 4294967297
105 ; CHECK-NEXT: .quad 1
106 ; CHECK-NEXT: .long .L{{.*}}-.L[[constantargs_BEGIN]]
107 ; CHECK-NEXT: .short 0
108 ; CHECK-NEXT: .short 6
110 ; CHECK-NEXT: .byte 4
111 ; CHECK-NEXT: .byte 0
112 ; CHECK-NEXT: .short 8
113 ; CHECK-NEXT: .short 0
114 ; CHECK-NEXT: .short 0
115 ; CHECK-NEXT: .long 65535
117 ; CHECK-NEXT: .byte 4
118 ; CHECK-NEXT: .byte 0
119 ; CHECK-NEXT: .short 8
120 ; CHECK-NEXT: .short 0
121 ; CHECK-NEXT: .short 0
122 ; CHECK-NEXT: .long 65536
123 ; LargeConstant at index 0
124 ; CHECK-NEXT: .byte 5
125 ; CHECK-NEXT: .byte 0
126 ; CHECK-NEXT: .short 8
127 ; CHECK-NEXT: .short 0
128 ; CHECK-NEXT: .short 0
129 ; CHECK-NEXT: .long 0
130 ; LargeConstant at index 1
131 ; CHECK-NEXT: .byte 5
132 ; CHECK-NEXT: .byte 0
133 ; CHECK-NEXT: .short 8
134 ; CHECK-NEXT: .short 0
135 ; CHECK-NEXT: .short 0
136 ; CHECK-NEXT: .long 1
138 ; CHECK-NEXT: .byte 4
139 ; CHECK-NEXT: .byte 0
140 ; CHECK-NEXT: .short 8
141 ; CHECK-NEXT: .short 0
142 ; CHECK-NEXT: .short 0
143 ; CHECK-NEXT: .long 66
144 ; LargeConstant at index 2
145 ; CHECK-NEXT: .byte 5
146 ; CHECK-NEXT: .byte 0
147 ; CHECK-NEXT: .short 8
148 ; CHECK-NEXT: .short 0
149 ; CHECK-NEXT: .short 0
150 ; CHECK-NEXT: .long 2
152 define void @constantargs() {
154 %0 = inttoptr i64 244837814094590 to ptr
155 tail call void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 1, i32 40, ptr %0, i32 0, i64 65535, i64 65536, i64 4294967295, i64 4294967296, i128 66, i128 4294967297)
161 ; CHECK: .long .L{{.*}}-.L[[osrinline_BEGIN]]
162 ; CHECK-NEXT: .short 0
163 ; CHECK-NEXT: .short 2
164 ; CHECK-NEXT: .byte 1
165 ; CHECK-NEXT: .byte 0
166 ; CHECK-NEXT: .short 8
167 ; CHECK-NEXT: .short {{[0-9]+}}
168 ; CHECK-NEXT: .short 0
169 ; CHECK-NEXT: .long 0
170 ; CHECK-NEXT: .byte 1
171 ; CHECK-NEXT: .byte 0
172 ; CHECK-NEXT: .short 8
173 ; CHECK-NEXT: .short {{[0-9]+}}
174 ; CHECK-NEXT: .short 0
175 ; CHECK-NEXT: .long 0
176 define void @osrinline(i64 %a, i64 %b) {
178 ; Runtime void->void call.
179 call void inttoptr (i64 244837814094590 to ptr)()
180 ; Followed by inline OSR patchpoint with 12-byte shadow and 2 live vars.
181 call void (i64, i32, ...) @llvm.experimental.stackmap(i64 3, i32 12, i64 %a, i64 %b)
187 ; 2 live variables in register.
189 ; CHECK: .long .L{{.*}}-.L[[osrcold_BEGIN]]
190 ; CHECK-NEXT: .short 0
191 ; CHECK-NEXT: .short 2
192 ; CHECK-NEXT: .byte 1
193 ; CHECK-NEXT: .byte 0
194 ; CHECK-NEXT: .short 8
195 ; CHECK-NEXT: .short {{[0-9]+}}
196 ; CHECK-NEXT: .short 0
197 ; CHECK-NEXT: .long 0
198 ; CHECK-NEXT: .byte 1
199 ; CHECK-NEXT: .byte 0
200 ; CHECK-NEXT: .short 8
201 ; CHECK-NEXT: .short {{[0-9]+}}
202 ; CHECK-NEXT: .short 0
203 ; CHECK-NEXT: .long 0
204 define void @osrcold(i64 %a, i64 %b) {
206 %test = icmp slt i64 %a, %b
207 br i1 %test, label %ret, label %cold
209 ; OSR patchpoint with 12-byte nop-slide and 2 live vars.
210 %thunk = inttoptr i64 244837814094590 to ptr
211 call void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 4, i32 40, ptr %thunk, i32 0, i64 %a, i64 %b)
218 ; CHECK: .long .L{{.*}}-.L[[propertyRead_BEGIN]]
219 ; CHECK-NEXT: .short 0
220 ; CHECK-NEXT: .short 0
222 ; FIXME: There are currently no stackmap entries. After moving to
223 ; AnyRegCC, we will have entries for the object and return value.
224 define i64 @propertyRead(ptr %obj) {
226 %resolveRead = inttoptr i64 244837814094590 to ptr
227 %result = call i64 (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.i64(i64 5, i32 40, ptr %resolveRead, i32 1, ptr %obj)
228 %add = add i64 %result, 3
233 ; CHECK: .long .L{{.*}}-.L[[propertyWrite_BEGIN]]
234 ; CHECK-NEXT: .short 0
235 ; CHECK-NEXT: .short 2
236 ; CHECK-NEXT: .byte 1
237 ; CHECK-NEXT: .byte 0
238 ; CHECK-NEXT: .short 8
239 ; CHECK-NEXT: .short {{[0-9]+}}
240 ; CHECK-NEXT: .short 0
241 ; CHECK-NEXT: .long 0
242 ; CHECK-NEXT: .byte 1
243 ; CHECK-NEXT: .byte 0
244 ; CHECK-NEXT: .short 8
245 ; CHECK-NEXT: .short {{[0-9]+}}
246 ; CHECK-NEXT: .short 0
247 ; CHECK-NEXT: .long 0
248 define void @propertyWrite(i64 %dummy1, ptr %obj, i64 %dummy2, i64 %a) {
250 %resolveWrite = inttoptr i64 244837814094590 to ptr
251 call anyregcc void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 6, i32 40, ptr %resolveWrite, i32 2, ptr %obj, i64 %a)
257 ; 2 live variables in registers.
259 ; CHECK: .long .L{{.*}}-.L[[jsVoidCall_BEGIN]]
260 ; CHECK-NEXT: .short 0
261 ; CHECK-NEXT: .short 2
262 ; CHECK-NEXT: .byte 1
263 ; CHECK-NEXT: .byte 0
264 ; CHECK-NEXT: .short 8
265 ; CHECK-NEXT: .short {{[0-9]+}}
266 ; CHECK-NEXT: .short 0
267 ; CHECK-NEXT: .long 0
268 ; CHECK-NEXT: .byte 1
269 ; CHECK-NEXT: .byte 0
270 ; CHECK-NEXT: .short 8
271 ; CHECK-NEXT: .short {{[0-9]+}}
272 ; CHECK-NEXT: .short 0
273 ; CHECK-NEXT: .long 0
274 define void @jsVoidCall(i64 %dummy1, ptr %obj, i64 %arg, i64 %l1, i64 %l2) {
276 %resolveCall = inttoptr i64 244837814094590 to ptr
277 call void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 7, i32 40, ptr %resolveCall, i32 2, ptr %obj, i64 %arg, i64 %l1, i64 %l2)
283 ; 2 live variables in registers.
285 ; CHECK: .long .L{{.*}}-.L[[jsIntCall_BEGIN]]
286 ; CHECK-NEXT: .short 0
287 ; CHECK-NEXT: .short 2
288 ; CHECK-NEXT: .byte 1
289 ; CHECK-NEXT: .byte 0
290 ; CHECK-NEXT: .short 8
291 ; CHECK-NEXT: .short {{[0-9]+}}
292 ; CHECK-NEXT: .short 0
293 ; CHECK-NEXT: .long 0
294 ; CHECK-NEXT: .byte 1
295 ; CHECK-NEXT: .byte 0
296 ; CHECK-NEXT: .short 8
297 ; CHECK-NEXT: .short {{[0-9]+}}
298 ; CHECK-NEXT: .short 0
299 ; CHECK-NEXT: .long 0
300 define i64 @jsIntCall(i64 %dummy1, ptr %obj, i64 %arg, i64 %l1, i64 %l2) {
302 %resolveCall = inttoptr i64 244837814094590 to ptr
303 %result = call i64 (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.i64(i64 8, i32 40, ptr %resolveCall, i32 2, ptr %obj, i64 %arg, i64 %l1, i64 %l2)
304 %add = add i64 %result, 3
308 ; Spilled stack map values.
310 ; Verify 28 stack map entries.
312 ; CHECK: .long .L{{.*}}-.L[[spilledValue_BEGIN]]
313 ; CHECK-NEXT: .short 0
314 ; CHECK-NEXT: .short 28
316 ; Check that at least one is a spilled entry from r31.
317 ; Location: Indirect FP + ...
319 ; CHECK-NEXT: .byte 0
321 ; CHECK-NEXT: .short 31
322 ; CHECK-NEXT: .short 0
324 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) {
326 call void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 11, i32 40, ptr 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)
330 ; Spilled stack map values.
332 ; Verify 30 stack map entries.
334 ; CHECK: .long .L{{.*}}-.L[[spilledStackMapValue_BEGIN]]
335 ; CHECK-NEXT: .short 0
336 ; CHECK-NEXT: .short 30
338 ; Check that at least one is a spilled entry from r31.
339 ; Location: Indirect FP + ...
341 ; CHECK-NEXT: .byte 0
343 ; CHECK-NEXT: .short 31
344 ; CHECK-NEXT: .short 0
346 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) {
348 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)
353 ; Map a constant value.
355 ; CHECK: .long .L{{.*}}-.L[[liveConstant_BEGIN]]
356 ; CHECK-NEXT: .short 0
358 ; CHECK-NEXT: .short 1
359 ; Loc 0: SmallConstant
360 ; CHECK-NEXT: .byte 4
361 ; CHECK-NEXT: .byte 0
362 ; CHECK-NEXT: .short 8
363 ; CHECK-NEXT: .short 0
364 ; CHECK-NEXT: .short 0
365 ; CHECK-NEXT: .long 33
367 define void @liveConstant() {
368 tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 15, i32 8, i32 33)
372 ; Map a value when LR is the only free register.
374 ; CHECK: .long .L{{.*}}-.L[[clobberLR_BEGIN]]
375 ; CHECK-NEXT: .short 0
377 ; CHECK-NEXT: .short 1
378 ; Loc 0: Indirect FP (r31) - offset
379 ; CHECK-NEXT: .byte 3
380 ; CHECK-NEXT: .byte 0
381 ; CHECK-NEXT: .short 4
382 ; CHECK-NEXT: .short 31
383 ; CHECK-NEXT: .short 0
384 ; CHECK-NEXT: .long {{[0-9]+}}
385 define void @clobberLR(i32 %a) {
386 tail call void asm sideeffect "nop", "~{r0},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r14},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27},~{r28},~{r29},~{r30},~{r31}"() nounwind
387 tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 16, i32 8, i32 %a)
391 ; CHECK: .long .L{{.*}}-.L[[floats_BEGIN]]
392 ; CHECK-NEXT: .short 0
394 ; CHECK-NEXT: .short 6
395 ; Loc 0: constant float stored to FP register
396 ; CHECK-NEXT: .byte 1
397 ; CHECK-NEXT: .byte 0
398 ; CHECK-NEXT: .short 8
399 ; CHECK-NEXT: .short {{.*}}
400 ; CHECK-NEXT: .short 0
401 ; CHECK-NEXT: .long 0
402 ; Loc 0: constant double stored to FP register
403 ; CHECK-NEXT: .byte 1
404 ; CHECK-NEXT: .byte 0
405 ; CHECK-NEXT: .short 8
406 ; CHECK-NEXT: .short {{.*}}
407 ; CHECK-NEXT: .short 0
408 ; CHECK-NEXT: .long 0
409 ; Loc 1: float value in FP register
410 ; CHECK-NEXT: .byte 1
411 ; CHECK-NEXT: .byte 0
412 ; CHECK-NEXT: .short 8
413 ; CHECK-NEXT: .short {{.*}}
414 ; CHECK-NEXT: .short 0
415 ; CHECK-NEXT: .long 0
416 ; Loc 2: double value in FP register
417 ; CHECK-NEXT: .byte 1
418 ; CHECK-NEXT: .byte 0
419 ; CHECK-NEXT: .short 8
420 ; CHECK-NEXT: .short {{.*}}
421 ; CHECK-NEXT: .short 0
422 ; CHECK-NEXT: .long 0
423 ; Loc 3: float on stack
424 ; CHECK-NEXT: .byte 2
425 ; CHECK-NEXT: .byte 0
426 ; CHECK-NEXT: .short 8
427 ; CHECK-NEXT: .short {{.*}}
428 ; CHECK-NEXT: .short 0
429 ; CHECK-NEXT: .long {{.*}}
430 ; Loc 4: double on stack
431 ; CHECK-NEXT: .byte 2
432 ; CHECK-NEXT: .byte 0
433 ; CHECK-NEXT: .short 8
434 ; CHECK-NEXT: .short {{.*}}
435 ; CHECK-NEXT: .short 0
436 ; CHECK-NEXT: .long {{.*}}
437 define void @floats(float %f, double %g) {
440 call void (i64, i32, ...) @llvm.experimental.stackmap(i64 888, i32 0, float 1.25,
441 double 1.5, float %f, double %g, ptr %ff, ptr %gg)
445 declare void @llvm.experimental.stackmap(i64, i32, ...)
446 declare void @llvm.experimental.patchpoint.void(i64, i32, ptr, i32, ...)
447 declare i64 @llvm.experimental.patchpoint.i64(i64, i32, ptr, i32, ...)