xref: /llvm-project/llvm/test/CodeGen/X86/stackmap-liveness.ll (revision 29b7eb8400f48fe7d8de3cb3741584c329ec597c)
1; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -enable-patchpoint-liveness=false | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx                                   | FileCheck -check-prefix=PATCH %s
3;
4; Note: Print verbose stackmaps using -debug-only=stackmaps.
5
6; CHECK-LABEL:  .section  __LLVM_STACKMAPS,__llvm_stackmaps
7; CHECK-NEXT:   __LLVM_StackMaps:
8; Header
9; CHECK-NEXT:   .byte 3
10; CHECK-NEXT:   .byte 0
11; CHECK-NEXT:   .short 0
12; Num Functions
13; CHECK-NEXT:   .long 2
14; Num LargeConstants
15; CHECK-NEXT:   .long   0
16; Num Callsites
17; CHECK-NEXT:   .long   5
18
19; Functions and stack size
20; CHECK-NEXT:   .quad _stackmap_liveness
21; CHECK-NEXT:   .quad 8
22; CHECK-NEXT:   .quad 3
23; CHECK-NEXT:   .quad _mixed_liveness
24; CHECK-NEXT:   .quad 8
25; CHECK-NEXT:   .quad 2
26
27define void @stackmap_liveness() {
28entry:
29  %a1 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
30; StackMap 1 (no liveness information available)
31; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
32; CHECK-NEXT:   .short  0
33; CHECK-NEXT:   .short  0
34; Padding
35; CHECK-NEXT:   .p2align 3
36; CHECK-NEXT:   .short  0
37; Num LiveOut Entries: 0
38; CHECK-NEXT:   .short  0
39; Align
40; CHECK-NEXT:   .p2align  3
41
42; StackMap 1 (patchpoint liveness information enabled)
43; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
44; PATCH-NEXT:   .short  0
45; PATCH-NEXT:   .short  0
46; Padding
47; PATCH-NEXT:   .p2align  3
48; PATCH-NEXT:   .short  0
49; Num LiveOut Entries: 6
50; PATCH-NEXT:   .short  6
51; LiveOut Entry 1:
52; PATCH-NEXT:   .short 3
53; PATCH-NEXT:   .byte 0
54; PATCH-NEXT:   .byte 8
55; LiveOut Entry 2:
56; PATCH-NEXT:   .short 12
57; PATCH-NEXT:   .byte 0
58; PATCH-NEXT:   .byte 8
59; LiveOut Entry 3:
60; PATCH-NEXT:   .short 13
61; PATCH-NEXT:   .byte 0
62; PATCH-NEXT:   .byte 8
63; LiveOut Entry 4:
64; PATCH-NEXT:   .short 14
65; PATCH-NEXT:   .byte 0
66; PATCH-NEXT:   .byte 8
67; LiveOut Entry 5:
68; PATCH-NEXT:   .short 15
69; PATCH-NEXT:   .byte 0
70; PATCH-NEXT:   .byte 8
71; LiveOut Entry 6: %ymm2 (16 bytes) --> %xmm2
72; PATCH-NEXT:   .short  19
73; PATCH-NEXT:   .byte 0
74; PATCH-NEXT:   .byte 16
75; Align
76; PATCH-NEXT:   .p2align  3
77  call anyregcc void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 1, i32 12, ptr null, i32 0)
78  %a2 = call i64 asm sideeffect "", "={r8}"() nounwind
79  %a3 = call i8 asm sideeffect "", "={ah}"() nounwind
80  %a4 = call <4 x double> asm sideeffect "", "={ymm0}"() nounwind
81  %a5 = call <4 x double> asm sideeffect "", "={ymm1}"() nounwind
82
83; StackMap 2 (no liveness information available)
84; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
85; CHECK-NEXT:   .short  0
86; CHECK-NEXT:   .short  0
87; Padding
88; CHECK-NEXT:   .p2align  3
89; CHECK-NEXT:   .short  0
90; Num LiveOut Entries: 0
91; CHECK-NEXT:   .short  0
92; Align
93; CHECK-NEXT:   .p2align  3
94
95; StackMap 2 (patchpoint liveness information enabled)
96; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
97; PATCH-NEXT:   .short  0
98; PATCH-NEXT:   .short  0
99; Padding
100; PATCH-NEXT:   .p2align  3
101; PATCH-NEXT:   .short  0
102; Num LiveOut Entries: 10
103; PATCH-NEXT:   .short 10
104
105; LiveOut Entry 1: %rax (1 bytes) --> %al or %ah
106; PATCH-NEXT:   .short  0
107; PATCH-NEXT:   .byte 0
108; PATCH-NEXT:   .byte 1
109; LiveOut Entry 2:
110; PATCH-NEXT:   .short 3
111; PATCH-NEXT:   .byte 0
112; PATCH-NEXT:   .byte 8
113; LiveOut Entry 3: %r8 (8 bytes)
114; PATCH-NEXT:   .short  8
115; PATCH-NEXT:   .byte 0
116; PATCH-NEXT:   .byte 8
117; LiveOut Entry 4:
118; PATCH-NEXT:   .short 12
119; PATCH-NEXT:   .byte 0
120; PATCH-NEXT:   .byte 8
121; LiveOut Entry 5:
122; PATCH-NEXT:   .short 13
123; PATCH-NEXT:   .byte 0
124; PATCH-NEXT:   .byte 8
125; LiveOut Entry 6:
126; PATCH-NEXT:   .short 14
127; PATCH-NEXT:   .byte 0
128; PATCH-NEXT:   .byte 8
129; LiveOut Entry 7:
130; PATCH-NEXT:   .short 15
131; PATCH-NEXT:   .byte 0
132; PATCH-NEXT:   .byte 8
133; LiveOut Entry 8: %ymm0 (32 bytes)
134; PATCH-NEXT:   .short  17
135; PATCH-NEXT:   .byte 0
136; PATCH-NEXT:   .byte 32
137; LiveOut Entry 9: %ymm1 (32 bytes)
138; PATCH-NEXT:   .short  18
139; PATCH-NEXT:   .byte 0
140; PATCH-NEXT:   .byte 32
141; LiveOut Entry 10: %ymm2 (16 bytes) --> %xmm2
142; PATCH-NEXT:   .short  19
143; PATCH-NEXT:   .byte 0
144; PATCH-NEXT:   .byte 16
145; Align
146; PATCH-NEXT:   .p2align  3
147  call anyregcc void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 2, i32 12, ptr null, i32 0)
148  call void asm sideeffect "", "{r8},{ah},{ymm0},{ymm1}"(i64 %a2, i8 %a3, <4 x double> %a4, <4 x double> %a5) nounwind
149
150; StackMap 3 (no liveness information available)
151; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
152; CHECK-NEXT:   .short  0
153; CHECK-NEXT:   .short  0
154; Padding
155; CHECK-NEXT:   .p2align  3
156; CHECK-NEXT:   .short  0
157; Num LiveOut Entries: 0
158; CHECK-NEXT:   .short  0
159; Align
160; CHECK-NEXT:   .p2align  3
161
162; StackMap 3 (patchpoint liveness information enabled)
163; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
164; PATCH-NEXT:   .short  0
165; PATCH-NEXT:   .short  0
166; Padding
167; PATCH-NEXT:   .p2align  3
168; PATCH-NEXT:   .short  0
169; Num LiveOut Entries: 7
170; PATCH-NEXT:   .short 7
171; LiveOut Entry 1:
172; PATCH-NEXT:   .short 3
173; PATCH-NEXT:   .byte 0
174; PATCH-NEXT:   .byte 8
175; LiveOut Entry 2: %rsp (8 bytes)
176; PATCH-NEXT:   .short  7
177; PATCH-NEXT:   .byte 0
178; PATCH-NEXT:   .byte 8
179; LiveOut Entry 3:
180; PATCH-NEXT:   .short 12
181; PATCH-NEXT:   .byte 0
182; PATCH-NEXT:   .byte 8
183; LiveOut Entry 4:
184; PATCH-NEXT:   .short 13
185; PATCH-NEXT:   .byte 0
186; PATCH-NEXT:   .byte 8
187; LiveOut Entry 5:
188; PATCH-NEXT:   .short 14
189; PATCH-NEXT:   .byte 0
190; PATCH-NEXT:   .byte 8
191; LiveOut Entry 6:
192; PATCH-NEXT:   .short 15
193; PATCH-NEXT:   .byte 0
194; PATCH-NEXT:   .byte 8
195; LiveOut Entry 7: %ymm2 (16 bytes) --> %xmm2
196; PATCH-NEXT:   .short  19
197; PATCH-NEXT:   .byte 0
198; PATCH-NEXT:   .byte 16
199; Align
200; PATCH-NEXT:   .p2align  3
201  call anyregcc void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 3, i32 12, ptr null, i32 0)
202  call void asm sideeffect "", "{xmm2}"(<2 x double> %a1) nounwind
203  ret void
204}
205
206define void @mixed_liveness() {
207entry:
208  %a1 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
209; StackMap 4 (patchpoint liveness information enabled)
210; PATCH-LABEL:  .long L{{.*}}-_mixed_liveness
211; PATCH-NEXT:   .short  0
212; PATCH-NEXT:   .short  0
213; Padding
214; PATCH-NEXT:   .p2align  3
215; PATCH-NEXT:   .short  0
216; Num LiveOut Entries: 0
217; PATCH-NEXT:   .short  0
218; Align
219; PATCH-NEXT:   .p2align  3
220
221; StackMap 5 (patchpoint liveness information enabled)
222; PATCH-LABEL:  .long L{{.*}}-_mixed_liveness
223; PATCH-NEXT:   .short  0
224; PATCH-NEXT:   .short  0
225; Padding
226; PATCH-NEXT:   .p2align  3
227; PATCH-NEXT:   .short  0
228; Num LiveOut Entries: 7
229; PATCH-NEXT:   .short 7
230; LiveOut Entry 1:
231; PATCH-NEXT:   .short 3
232; PATCH-NEXT:   .byte 0
233; PATCH-NEXT:   .byte 8
234; LiveOut Entry 2: %rsp (8 bytes)
235; PATCH-NEXT:   .short  7
236; PATCH-NEXT:   .byte 0
237; PATCH-NEXT:   .byte 8
238; LiveOut Entry 3:
239; PATCH-NEXT:   .short 12
240; PATCH-NEXT:   .byte 0
241; PATCH-NEXT:   .byte 8
242; LiveOut Entry 4:
243; PATCH-NEXT:   .short 13
244; PATCH-NEXT:   .byte 0
245; PATCH-NEXT:   .byte 8
246; LiveOut Entry 5:
247; PATCH-NEXT:   .short 14
248; PATCH-NEXT:   .byte 0
249; PATCH-NEXT:   .byte 8
250; LiveOut Entry 6:
251; PATCH-NEXT:   .short 15
252; PATCH-NEXT:   .byte 0
253; PATCH-NEXT:   .byte 8
254; LiveOut Entry 7: %ymm2 (16 bytes) --> %xmm2
255; PATCH-NEXT:   .short  19
256; PATCH-NEXT:   .byte 0
257; PATCH-NEXT:   .byte 16
258; Align
259; PATCH-NEXT:   .p2align  3
260  call void (i64, i32, ...) @llvm.experimental.stackmap(i64 4, i32 5)
261  call anyregcc void (i64, i32, ptr, i32, ...) @llvm.experimental.patchpoint.void(i64 5, i32 0, ptr null, i32 0)
262  call void asm sideeffect "", "{xmm2}"(<2 x double> %a1) nounwind
263  ret void
264}
265
266declare void @llvm.experimental.stackmap(i64, i32, ...)
267declare void @llvm.experimental.patchpoint.void(i64, i32, ptr, i32, ...)
268