1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
3 ; Note: Print verbose stackmaps using -debug-only=stackmaps.
5 ; CHECK-LABEL: .section __LLVM_STACKMAPS,__llvm_stackmaps
6 ; CHECK-NEXT: __LLVM_StackMaps:
10 ; CHECK-NEXT: .quad 4294967296
17 ; CHECK-NEXT: .long L{{.*}}-_constantargs
18 ; CHECK-NEXT: .short 0
19 ; CHECK-NEXT: .short 4
23 ; CHECK-NEXT: .short 0
24 ; CHECK-NEXT: .long 65535
28 ; CHECK-NEXT: .short 0
29 ; CHECK-NEXT: .long 65536
33 ; CHECK-NEXT: .short 0
34 ; CHECK-NEXT: .long 4294967295
35 ; LargeConstant at index 0
38 ; CHECK-NEXT: .short 0
41 define void @constantargs() {
43 %0 = inttoptr i64 12345 to i8*
44 tail call void (i32, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i32 1, i32 15, i8* %0, i32 0, i64 65535, i64 65536, i64 4294967295, i64 4294967296)
51 ; CHECK-NEXT: .long L{{.*}}-_osrinline
52 ; CHECK-NEXT: .short 0
53 ; CHECK-NEXT: .short 2
56 ; CHECK-NEXT: .short {{[0-9]+}}
60 ; CHECK-NEXT: .short {{[0-9]+}}
62 define void @osrinline(i64 %a, i64 %b) {
64 ; Runtime void->void call.
65 call void inttoptr (i64 -559038737 to void ()*)()
66 ; Followed by inline OSR patchpoint with 12-byte shadow and 2 live vars.
67 call void (i32, i32, ...)* @llvm.experimental.stackmap(i32 3, i32 12, i64 %a, i64 %b)
73 ; 2 live variables in register.
76 ; CHECK-NEXT: .long L{{.*}}-_osrcold
77 ; CHECK-NEXT: .short 0
78 ; CHECK-NEXT: .short 2
81 ; CHECK-NEXT: .short {{[0-9]+}}
85 ; CHECK-NEXT: .short {{[0-9]+}}
87 define void @osrcold(i64 %a, i64 %b) {
89 %test = icmp slt i64 %a, %b
90 br i1 %test, label %ret, label %cold
92 ; OSR patchpoint with 12-byte nop-slide and 2 live vars.
93 %thunk = inttoptr i64 -559038737 to i8*
94 call void (i32, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i32 4, i32 15, i8* %thunk, i32 0, i64 %a, i64 %b)
101 ; CHECK-NEXT: .long 5
102 ; CHECK-NEXT: .long L{{.*}}-_propertyRead
103 ; CHECK-NEXT: .short 0
104 ; CHECK-NEXT: .short 0
106 ; FIXME: There are currently no stackmap entries. After moving to
107 ; AnyRegCC, we will have entries for the object and return value.
108 define i64 @propertyRead(i64* %obj) {
110 %resolveRead = inttoptr i64 -559038737 to i8*
111 %result = call i64 (i32, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(i32 5, i32 15, i8* %resolveRead, i32 1, i64* %obj)
112 %add = add i64 %result, 3
117 ; CHECK-NEXT: .long 6
118 ; CHECK-NEXT: .long L{{.*}}-_propertyWrite
119 ; CHECK-NEXT: .short 0
120 ; CHECK-NEXT: .short 0
122 ; FIXME: There are currently no stackmap entries. After moving to
123 ; AnyRegCC, we will have entries for the object and return value.
124 define void @propertyWrite(i64 %dummy1, i64* %obj, i64 %dummy2, i64 %a) {
126 %resolveWrite = inttoptr i64 -559038737 to i8*
127 call void (i32, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i32 6, i32 15, i8* %resolveWrite, i32 2, i64* %obj, i64 %a)
133 ; 2 live variables in registers.
135 ; CHECK-NEXT: .long 7
136 ; CHECK-NEXT: .long L{{.*}}-_jsVoidCall
137 ; CHECK-NEXT: .short 0
138 ; CHECK-NEXT: .short 2
139 ; CHECK-NEXT: .byte 1
140 ; CHECK-NEXT: .byte 0
141 ; CHECK-NEXT: .short {{[0-9]+}}
142 ; CHECK-NEXT: .long 0
143 ; CHECK-NEXT: .byte 1
144 ; CHECK-NEXT: .byte 0
145 ; CHECK-NEXT: .short {{[0-9]+}}
146 ; CHECK-NEXT: .long 0
147 define void @jsVoidCall(i64 %dummy1, i64* %obj, i64 %arg, i64 %l1, i64 %l2) {
149 %resolveCall = inttoptr i64 -559038737 to i8*
150 call void (i32, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i32 7, i32 15, i8* %resolveCall, i32 2, i64* %obj, i64 %arg, i64 %l1, i64 %l2)
156 ; 2 live variables in registers.
159 ; CHECK-NEXT: .long L{{.*}}-_jsIntCall
160 ; CHECK-NEXT: .short 0
161 ; CHECK-NEXT: .short 2
162 ; CHECK-NEXT: .byte 1
163 ; CHECK-NEXT: .byte 0
164 ; CHECK-NEXT: .short {{[0-9]+}}
165 ; CHECK-NEXT: .long 0
166 ; CHECK-NEXT: .byte 1
167 ; CHECK-NEXT: .byte 0
168 ; CHECK-NEXT: .short {{[0-9]+}}
169 ; CHECK-NEXT: .long 0
170 define i64 @jsIntCall(i64 %dummy1, i64* %obj, i64 %arg, i64 %l1, i64 %l2) {
172 %resolveCall = inttoptr i64 -559038737 to i8*
173 %result = call i64 (i32, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(i32 8, i32 15, i8* %resolveCall, i32 2, i64* %obj, i64 %arg, i64 %l1, i64 %l2)
174 %add = add i64 %result, 3
178 ; Spilled stack map values.
180 ; Verify 17 stack map entries.
183 ; CHECK-NEXT: .long L{{.*}}-_spilledValue
184 ; CHECK-NEXT: .short 0
185 ; CHECK-NEXT: .short 10
187 ; Check that at least one is a spilled entry (Indirect).
190 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) {
192 %resolveCall = inttoptr i64 -559038737 to i8*
193 call void (i32, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i32 11, i32 15, i8* %resolveCall, 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)
195 ; FIXME: The Spiller needs to be able to fold all rematted loads! This
196 ; can be seen by adding %l15 to the stackmap.
197 ; <rdar:/15202984> [JS] Ran out of registers during register allocation
198 ; %resolveCall = inttoptr i64 -559038737 to i8*
199 ; call void (i32, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i32 12, i32 15, i8* %resolveCall, 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)
203 declare void @llvm.experimental.stackmap(i32, i32, ...)
204 declare void @llvm.experimental.patchpoint.void(i32, i32, i8*, i32, ...)
205 declare i64 @llvm.experimental.patchpoint.i64(i32, i32, i8*, i32, ...)