[Stackmaps] Record the stack size of each function that contains a stackmap/patchpoin...
[oota-llvm.git] / test / CodeGen / X86 / stackmap-liveness.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim -enable-stackmap-liveness| FileCheck -check-prefix=STACK %s
3 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim -enable-patchpoint-liveness| FileCheck -check-prefix=PATCH %s
4 ;
5 ; Note: Print verbose stackmaps using -debug-only=stackmaps.
6
7 ; CHECK-LABEL:  .section  __LLVM_STACKMAPS,__llvm_stackmaps
8 ; CHECK-NEXT:   __LLVM_StackMaps:
9 ; CHECK-NEXT:   .long 0
10 ; Num Functions
11 ; CHECK-NEXT:   .long 2
12 ; CHECK-NEXT:   .long _stackmap_liveness
13 ; CHECK-NEXT:   .long 8
14 ; CHECK-NEXT:   .long _mixed_liveness
15 ; CHECK-NEXT:   .long 8
16 ; Num LargeConstants
17 ; CHECK-NEXT:   .long   0
18 ; Num Callsites
19 ; CHECK-NEXT:   .long   5
20 define void @stackmap_liveness() {
21 entry:
22   %a1 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
23 ; StackMap 1 (no liveness information available)
24 ; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
25 ; CHECK-NEXT:   .short  0
26 ; CHECK-NEXT:   .short  0
27 ; Num LiveOut Entries: 0
28 ; CHECK-NEXT:   .short  0
29
30 ; StackMap 1 (stackmap liveness information enabled)
31 ; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
32 ; STACK-NEXT:   .short  0
33 ; STACK-NEXT:   .short  0
34 ; Num LiveOut Entries: 2
35 ; STACK-NEXT:   .short  2
36 ; LiveOut Entry 1: %RSP (8 bytes)
37 ; STACK-NEXT:   .short  7
38 ; STACK-NEXT:   .byte 0
39 ; STACK-NEXT:   .byte 8
40 ; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
41 ; STACK-NEXT:   .short  19
42 ; STACK-NEXT:   .byte 0
43 ; STACK-NEXT:   .byte 16
44
45 ; StackMap 1 (patchpoint liveness information enabled)
46 ; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
47 ; PATCH-NEXT:   .short  0
48 ; PATCH-NEXT:   .short  0
49 ; Num LiveOut Entries: 0
50 ; PATCH-NEXT:   .short  0
51   call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 1, i32 5)
52   %a2 = call i64 asm sideeffect "", "={r8}"() nounwind
53   %a3 = call i8 asm sideeffect "", "={ah}"() nounwind
54   %a4 = call <4 x double> asm sideeffect "", "={ymm0}"() nounwind
55   %a5 = call <4 x double> asm sideeffect "", "={ymm1}"() nounwind
56
57 ; StackMap 2 (no liveness information available)
58 ; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
59 ; CHECK-NEXT:   .short  0
60 ; CHECK-NEXT:   .short  0
61 ; Num LiveOut Entries: 0
62 ; CHECK-NEXT:   .short  0
63
64 ; StackMap 2 (stackmap liveness information enabled)
65 ; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
66 ; STACK-NEXT:   .short  0
67 ; STACK-NEXT:   .short  0
68 ; Num LiveOut Entries: 6
69 ; STACK-NEXT:   .short  6
70 ; LiveOut Entry 2: %RAX (1 bytes) --> %AL or %AH
71 ; STACK-NEXT:   .short  0
72 ; STACK-NEXT:   .byte 0
73 ; STACK-NEXT:   .byte 1
74 ; LiveOut Entry 2: %RSP (8 bytes)
75 ; STACK-NEXT:   .short  7
76 ; STACK-NEXT:   .byte 0
77 ; STACK-NEXT:   .byte 8
78 ; LiveOut Entry 2: %R8 (8 bytes)
79 ; STACK-NEXT:   .short  8
80 ; STACK-NEXT:   .byte 0
81 ; STACK-NEXT:   .byte 8
82 ; LiveOut Entry 2: %YMM0 (32 bytes)
83 ; STACK-NEXT:   .short  17
84 ; STACK-NEXT:   .byte 0
85 ; STACK-NEXT:   .byte 32
86 ; LiveOut Entry 2: %YMM1 (32 bytes)
87 ; STACK-NEXT:   .short  18
88 ; STACK-NEXT:   .byte 0
89 ; STACK-NEXT:   .byte 32
90 ; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
91 ; STACK-NEXT:   .short  19
92 ; STACK-NEXT:   .byte 0
93 ; STACK-NEXT:   .byte 16
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 ; Num LiveOut Entries: 0
100 ; PATCH-NEXT:   .short  0
101   call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 2, i32 5)
102   call void asm sideeffect "", "{r8},{ah},{ymm0},{ymm1}"(i64 %a2, i8 %a3, <4 x double> %a4, <4 x double> %a5) nounwind
103
104 ; StackMap 3 (no liveness information available)
105 ; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
106 ; CHECK-NEXT:   .short  0
107 ; CHECK-NEXT:   .short  0
108 ; Num LiveOut Entries: 0
109 ; CHECK-NEXT:   .short  0
110
111 ; StackMap 3 (stackmap liveness information enabled)
112 ; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
113 ; STACK-NEXT:   .short  0
114 ; STACK-NEXT:   .short  0
115 ; Num LiveOut Entries: 2
116 ; STACK-NEXT:   .short  2
117 ; LiveOut Entry 2: %RSP (8 bytes)
118 ; STACK-NEXT:   .short  7
119 ; STACK-NEXT:   .byte 0
120 ; STACK-NEXT:   .byte 8
121 ; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
122 ; STACK-NEXT:   .short  19
123 ; STACK-NEXT:   .byte 0
124 ; STACK-NEXT:   .byte 16
125
126 ; StackMap 3 (patchpoint liveness information enabled)
127 ; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
128 ; PATCH-NEXT:   .short  0
129 ; PATCH-NEXT:   .short  0
130 ; Num LiveOut Entries: 0
131 ; PATCH-NEXT:   .short  0
132   call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 3, i32 5)
133   call void asm sideeffect "", "{xmm2}"(<2 x double> %a1) nounwind
134   ret void
135 }
136
137 define void @mixed_liveness() {
138 entry:
139   %a1 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
140 ; StackMap 4 (stackmap liveness information enabled)
141 ; STACK-LABEL:  .long L{{.*}}-_mixed_liveness
142 ; STACK-NEXT:   .short  0
143 ; STACK-NEXT:   .short  0
144 ; Num LiveOut Entries: 1
145 ; STACK-NEXT:   .short  1
146 ; LiveOut Entry 1: %YMM2 (16 bytes) --> %XMM2
147 ; STACK-NEXT:   .short  19
148 ; STACK-NEXT:   .byte 0
149 ; STACK-NEXT:   .byte 16
150 ; StackMap 5 (stackmap liveness information enabled)
151 ; STACK-LABEL:  .long L{{.*}}-_mixed_liveness
152 ; STACK-NEXT:   .short  0
153 ; STACK-NEXT:   .short  0
154 ; Num LiveOut Entries: 0
155 ; STACK-NEXT:   .short  0
156
157 ; StackMap 4 (patchpoint liveness information enabled)
158 ; PATCH-LABEL:  .long L{{.*}}-_mixed_liveness
159 ; PATCH-NEXT:   .short  0
160 ; PATCH-NEXT:   .short  0
161 ; Num LiveOut Entries: 0
162 ; PATCH-NEXT:   .short  0
163 ; StackMap 5 (patchpoint liveness information enabled)
164 ; PATCH-LABEL:  .long L{{.*}}-_mixed_liveness
165 ; PATCH-NEXT:   .short  0
166 ; PATCH-NEXT:   .short  0
167 ; Num LiveOut Entries: 2
168 ; PATCH-NEXT:   .short  2
169 ; LiveOut Entry 1: %RSP (8 bytes)
170 ; PATCH-NEXT:   .short  7
171 ; PATCH-NEXT:   .byte 0
172 ; PATCH-NEXT:   .byte 8
173 ; LiveOut Entry 1: %YMM2 (16 bytes) --> %XMM2
174 ; PATCH-NEXT:   .short  19
175 ; PATCH-NEXT:   .byte 0
176 ; PATCH-NEXT:   .byte 16
177   call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 4, i32 5)
178   call anyregcc void (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i64 5, i32 0, i8* null, i32 0)
179   call void asm sideeffect "", "{xmm2}"(<2 x double> %a1) nounwind
180   ret void
181 }
182
183 declare void @llvm.experimental.stackmap(i64, i32, ...)
184 declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)