[Stackmap] Liveness Analysis Pass
[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 LargeConstants
11 ; CHECK-NEXT:   .long   0
12 ; Num Callsites
13 ; CHECK-NEXT:   .long   5
14 define void @stackmap_liveness() {
15 entry:
16   %a1 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
17 ; StackMap 1 (no liveness information available)
18 ; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
19 ; CHECK-NEXT:   .short  0
20 ; CHECK-NEXT:   .short  0
21 ; Num LiveOut Entries: 0
22 ; CHECK-NEXT:   .short  0
23
24 ; StackMap 1 (stackmap liveness information enabled)
25 ; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
26 ; STACK-NEXT:   .short  0
27 ; STACK-NEXT:   .short  0
28 ; Num LiveOut Entries: 2
29 ; STACK-NEXT:   .short  2
30 ; LiveOut Entry 1: %RSP (8 bytes)
31 ; STACK-NEXT:   .short  7
32 ; STACK-NEXT:   .byte 0
33 ; STACK-NEXT:   .byte 8
34 ; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
35 ; STACK-NEXT:   .short  19
36 ; STACK-NEXT:   .byte 0
37 ; STACK-NEXT:   .byte 16
38
39 ; StackMap 1 (patchpoint liveness information enabled)
40 ; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
41 ; PATCH-NEXT:   .short  0
42 ; PATCH-NEXT:   .short  0
43 ; Num LiveOut Entries: 0
44 ; PATCH-NEXT:   .short  0
45   call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 1, i32 5)
46   %a2 = call i64 asm sideeffect "", "={r8}"() nounwind
47   %a3 = call i8 asm sideeffect "", "={ah}"() nounwind
48   %a4 = call <4 x double> asm sideeffect "", "={ymm0}"() nounwind
49   %a5 = call <4 x double> asm sideeffect "", "={ymm1}"() nounwind
50
51 ; StackMap 2 (no liveness information available)
52 ; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
53 ; CHECK-NEXT:   .short  0
54 ; CHECK-NEXT:   .short  0
55 ; Num LiveOut Entries: 0
56 ; CHECK-NEXT:   .short  0
57
58 ; StackMap 2 (stackmap liveness information enabled)
59 ; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
60 ; STACK-NEXT:   .short  0
61 ; STACK-NEXT:   .short  0
62 ; Num LiveOut Entries: 6
63 ; STACK-NEXT:   .short  6
64 ; LiveOut Entry 2: %RAX (1 bytes) --> %AL or %AH
65 ; STACK-NEXT:   .short  0
66 ; STACK-NEXT:   .byte 0
67 ; STACK-NEXT:   .byte 1
68 ; LiveOut Entry 2: %RSP (8 bytes)
69 ; STACK-NEXT:   .short  7
70 ; STACK-NEXT:   .byte 0
71 ; STACK-NEXT:   .byte 8
72 ; LiveOut Entry 2: %R8 (8 bytes)
73 ; STACK-NEXT:   .short  8
74 ; STACK-NEXT:   .byte 0
75 ; STACK-NEXT:   .byte 8
76 ; LiveOut Entry 2: %YMM0 (32 bytes)
77 ; STACK-NEXT:   .short  17
78 ; STACK-NEXT:   .byte 0
79 ; STACK-NEXT:   .byte 32
80 ; LiveOut Entry 2: %YMM1 (32 bytes)
81 ; STACK-NEXT:   .short  18
82 ; STACK-NEXT:   .byte 0
83 ; STACK-NEXT:   .byte 32
84 ; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
85 ; STACK-NEXT:   .short  19
86 ; STACK-NEXT:   .byte 0
87 ; STACK-NEXT:   .byte 16
88
89 ; StackMap 2 (patchpoint liveness information enabled)
90 ; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
91 ; PATCH-NEXT:   .short  0
92 ; PATCH-NEXT:   .short  0
93 ; Num LiveOut Entries: 0
94 ; PATCH-NEXT:   .short  0
95   call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 2, i32 5)
96   call void asm sideeffect "", "{r8},{ah},{ymm0},{ymm1}"(i64 %a2, i8 %a3, <4 x double> %a4, <4 x double> %a5) nounwind
97
98 ; StackMap 3 (no liveness information available)
99 ; CHECK-LABEL:  .long L{{.*}}-_stackmap_liveness
100 ; CHECK-NEXT:   .short  0
101 ; CHECK-NEXT:   .short  0
102 ; Num LiveOut Entries: 0
103 ; CHECK-NEXT:   .short  0
104
105 ; StackMap 3 (stackmap liveness information enabled)
106 ; STACK-LABEL:  .long L{{.*}}-_stackmap_liveness
107 ; STACK-NEXT:   .short  0
108 ; STACK-NEXT:   .short  0
109 ; Num LiveOut Entries: 2
110 ; STACK-NEXT:   .short  2
111 ; LiveOut Entry 2: %RSP (8 bytes)
112 ; STACK-NEXT:   .short  7
113 ; STACK-NEXT:   .byte 0
114 ; STACK-NEXT:   .byte 8
115 ; LiveOut Entry 2: %YMM2 (16 bytes) --> %XMM2
116 ; STACK-NEXT:   .short  19
117 ; STACK-NEXT:   .byte 0
118 ; STACK-NEXT:   .byte 16
119
120 ; StackMap 3 (patchpoint liveness information enabled)
121 ; PATCH-LABEL:  .long L{{.*}}-_stackmap_liveness
122 ; PATCH-NEXT:   .short  0
123 ; PATCH-NEXT:   .short  0
124 ; Num LiveOut Entries: 0
125 ; PATCH-NEXT:   .short  0
126   call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 3, i32 5)
127   call void asm sideeffect "", "{xmm2}"(<2 x double> %a1) nounwind
128   ret void
129 }
130
131 define void @mixed_liveness() {
132 entry:
133   %a1 = call <2 x double> asm sideeffect "", "={xmm2}"() nounwind
134 ; StackMap 4 (stackmap liveness information enabled)
135 ; STACK-LABEL:  .long L{{.*}}-_mixed_liveness
136 ; STACK-NEXT:   .short  0
137 ; STACK-NEXT:   .short  0
138 ; Num LiveOut Entries: 1
139 ; STACK-NEXT:   .short  1
140 ; LiveOut Entry 1: %YMM2 (16 bytes) --> %XMM2
141 ; STACK-NEXT:   .short  19
142 ; STACK-NEXT:   .byte 0
143 ; STACK-NEXT:   .byte 16
144 ; StackMap 5 (stackmap liveness information enabled)
145 ; STACK-LABEL:  .long L{{.*}}-_mixed_liveness
146 ; STACK-NEXT:   .short  0
147 ; STACK-NEXT:   .short  0
148 ; Num LiveOut Entries: 0
149 ; STACK-NEXT:   .short  0
150
151 ; StackMap 4 (patchpoint liveness information enabled)
152 ; PATCH-LABEL:  .long L{{.*}}-_mixed_liveness
153 ; PATCH-NEXT:   .short  0
154 ; PATCH-NEXT:   .short  0
155 ; Num LiveOut Entries: 0
156 ; PATCH-NEXT:   .short  0
157 ; StackMap 5 (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: 2
162 ; PATCH-NEXT:   .short  2
163 ; LiveOut Entry 1: %RSP (8 bytes)
164 ; PATCH-NEXT:   .short  7
165 ; PATCH-NEXT:   .byte 0
166 ; PATCH-NEXT:   .byte 8
167 ; LiveOut Entry 1: %YMM2 (16 bytes) --> %XMM2
168 ; PATCH-NEXT:   .short  19
169 ; PATCH-NEXT:   .byte 0
170 ; PATCH-NEXT:   .byte 16
171   call void (i64, i32, ...)* @llvm.experimental.stackmap(i64 4, i32 5)
172   call anyregcc void (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.void(i64 5, i32 0, i8* null, i32 0)
173   call void asm sideeffect "", "{xmm2}"(<2 x double> %a1) nounwind
174   ret void
175 }
176
177 declare void @llvm.experimental.stackmap(i64, i32, ...)
178 declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)