xref: /PHP-8.4/ext/opcache/jit/ir/ir_builder.h (revision 56381e8f)
1 /*
2  * IR - Lightweight JIT Compilation Framework
3  * (IR Construction API)
4  * Copyright (C) 2022 Zend by Perforce.
5  * Authors: Dmitry Stogov <dmitry@php.net>
6  */
7 
8 #ifndef IR_BUILDER_H
9 #define IR_BUILDER_H
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /* _ir_CTX may be redefined by the user */
16 #define _ir_CTX                           ctx
17 
18 #define ir_NOP()                          ir_emit0(_ir_CTX, IR_NOP)
19 
20 #define ir_CONST_BOOL(_val)               ir_const_bool(_ir_CTX, (_val))
21 #define ir_CONST_U8(_val)                 ir_const_u8(_ir_CTX, (_val))
22 #define ir_CONST_U16(_val)                ir_const_u16(_ir_CTX, (_val))
23 #define ir_CONST_U32(_val)                ir_const_u32(_ir_CTX, (_val))
24 #define ir_CONST_U64(_val)                ir_const_u64(_ir_CTX, (_val))
25 #define ir_CONST_ADDR(_val)               ir_const_addr(_ir_CTX, (uintptr_t)(_val))
26 #define ir_CONST_CHAR(_val)               ir_const_char(_ir_CTX, (_val))
27 #define ir_CONST_I8(_val)                 ir_const_i8(_ir_CTX, (_val))
28 #define ir_CONST_I16(_val)                ir_const_i16(_ir_CTX, (_val))
29 #define ir_CONST_I32(_val)                ir_const_i32(_ir_CTX, (_val))
30 #define ir_CONST_I64(_val)                ir_const_i64(_ir_CTX, (_val))
31 #define ir_CONST_DOUBLE(_val)             ir_const_double(_ir_CTX, (_val))
32 #define ir_CONST_FLOAT(_val)              ir_const_float(_ir_CTX, (_val))
33 
34 #define ir_CMP_OP(_op, _op1, _op2)        ir_fold2(_ir_CTX, IR_OPT((_op), IR_BOOL), (_op1), (_op2))
35 
36 #define ir_UNARY_OP(_op, _type, _op1)     ir_fold1(_ir_CTX, IR_OPT((_op), (_type)),   (_op1))
37 #define ir_UNARY_OP_B(_op, _op1)          ir_fold1(_ir_CTX, IR_OPT((_op), IR_BOOL),   (_op1))
38 #define ir_UNARY_OP_U8(_op, _op1)         ir_fold1(_ir_CTX, IR_OPT((_op), IR_U8),     (_op1))
39 #define ir_UNARY_OP_U16(_op, _op1)        ir_fold1(_ir_CTX, IR_OPT((_op), IR_U16),    (_op1))
40 #define ir_UNARY_OP_U32(_op, _op1)        ir_fold1(_ir_CTX, IR_OPT((_op), IR_U32),    (_op1))
41 #define ir_UNARY_OP_U64(_op, _op1)        ir_fold1(_ir_CTX, IR_OPT((_op), IR_U64),    (_op1))
42 #define ir_UNARY_OP_A(_op, _op1)          ir_fold1(_ir_CTX, IR_OPT((_op), IR_ADDR),   (_op1))
43 #define ir_UNARY_OP_C(_op, _op1)          ir_fold1(_ir_CTX, IR_OPT((_op), IR_CHAR),   (_op1))
44 #define ir_UNARY_OP_I8(_op, _op1)         ir_fold1(_ir_CTX, IR_OPT((_op), IR_I8),     (_op1))
45 #define ir_UNARY_OP_I16(_op, _op1)        ir_fold1(_ir_CTX, IR_OPT((_op), IR_I16),    (_op1))
46 #define ir_UNARY_OP_I32(_op, _op1)        ir_fold1(_ir_CTX, IR_OPT((_op), IR_I32),    (_op1))
47 #define ir_UNARY_OP_I64(_op, _op1)        ir_fold1(_ir_CTX, IR_OPT((_op), IR_I64),    (_op1))
48 #define ir_UNARY_OP_D(_op, _op1)          ir_fold1(_ir_CTX, IR_OPT((_op), IR_DOUBLE), (_op1))
49 #define ir_UNARY_OP_F(_op, _op1)          ir_fold1(_ir_CTX, IR_OPT((_op), IR_FLOAT),  (_op1))
50 
51 #define ir_BINARY_OP(_op, _t, _op1, _op2) ir_fold2(_ir_CTX, IR_OPT((_op), (_t)),      (_op1), (_op2))
52 #define ir_BINARY_OP_B(_op, _op1, _op2)   ir_fold2(_ir_CTX, IR_OPT((_op), IR_BOOL),   (_op1), (_op2))
53 #define ir_BINARY_OP_U8(_op, _op1, _op2)  ir_fold2(_ir_CTX, IR_OPT((_op), IR_U8),     (_op1), (_op2))
54 #define ir_BINARY_OP_U16(_op, _op1, _op2) ir_fold2(_ir_CTX, IR_OPT((_op), IR_U16),    (_op1), (_op2))
55 #define ir_BINARY_OP_U32(_op, _op1, _op2) ir_fold2(_ir_CTX, IR_OPT((_op), IR_U32),    (_op1), (_op2))
56 #define ir_BINARY_OP_U64(_op, _op1, _op2) ir_fold2(_ir_CTX, IR_OPT((_op), IR_U64),    (_op1), (_op2))
57 #define ir_BINARY_OP_A(_op, _op1, _op2)   ir_fold2(_ir_CTX, IR_OPT((_op), IR_ADDR),   (_op1), (_op2))
58 #define ir_BINARY_OP_C(_op, _op1, _op2)   ir_fold2(_ir_CTX, IR_OPT((_op), IR_CHAR),   (_op1), (_op2))
59 #define ir_BINARY_OP_I8(_op, _op1, _op2)  ir_fold2(_ir_CTX, IR_OPT((_op), IR_I8),     (_op1), (_op2))
60 #define ir_BINARY_OP_I16(_op, _op1, _op2) ir_fold2(_ir_CTX, IR_OPT((_op), IR_I16),    (_op1), (_op2))
61 #define ir_BINARY_OP_I32(_op, _op1, _op2) ir_fold2(_ir_CTX, IR_OPT((_op), IR_I32),    (_op1), (_op2))
62 #define ir_BINARY_OP_I64(_op, _op1, _op2) ir_fold2(_ir_CTX, IR_OPT((_op), IR_I64),    (_op1), (_op2))
63 #define ir_BINARY_OP_D(_op, _op1, _op2)   ir_fold2(_ir_CTX, IR_OPT((_op), IR_DOUBLE), (_op1), (_op2))
64 #define ir_BINARY_OP_F(_op, _op1, _op2)   ir_fold2(_ir_CTX, IR_OPT((_op), IR_FLOAT),  (_op1), (_op2))
65 
66 #define ir_EQ(_op1, _op2)                 ir_CMP_OP(IR_EQ, (_op1), (_op2))
67 #define ir_NE(_op1, _op2)                 ir_CMP_OP(IR_NE, (_op1), (_op2))
68 
69 #define ir_LT(_op1, _op2)                 ir_CMP_OP(IR_LT, (_op1), (_op2))
70 #define ir_GE(_op1, _op2)                 ir_CMP_OP(IR_GE, (_op1), (_op2))
71 #define ir_LE(_op1, _op2)                 ir_CMP_OP(IR_LE, (_op1), (_op2))
72 #define ir_GT(_op1, _op2)                 ir_CMP_OP(IR_GT, (_op1), (_op2))
73 
74 #define ir_ULT(_op1, _op2)                ir_CMP_OP(IR_ULT, (_op1), (_op2))
75 #define ir_UGE(_op1, _op2)                ir_CMP_OP(IR_UGE, (_op1), (_op2))
76 #define ir_ULE(_op1, _op2)                ir_CMP_OP(IR_ULE, (_op1), (_op2))
77 #define ir_UGT(_op1, _op2)                ir_CMP_OP(IR_UGT, (_op1), (_op2))
78 
79 #define ir_ADD(_type, _op1, _op2)         ir_BINARY_OP(IR_ADD, (_type), (_op1), (_op2))
80 #define ir_ADD_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_ADD, (_op1), (_op2))
81 #define ir_ADD_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_ADD, (_op1), (_op2))
82 #define ir_ADD_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_ADD, (_op1), (_op2))
83 #define ir_ADD_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_ADD, (_op1), (_op2))
84 #define ir_ADD_A(_op1, _op2)              ir_BINARY_OP_A(IR_ADD, (_op1), (_op2))
85 #define ir_ADD_C(_op1, _op2)              ir_BINARY_OP_C(IR_ADD, (_op1), (_op2))
86 #define ir_ADD_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_ADD, (_op1), (_op2))
87 #define ir_ADD_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_ADD, (_op1), (_op2))
88 #define ir_ADD_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_ADD, (_op1), (_op2))
89 #define ir_ADD_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_ADD, (_op1), (_op2))
90 #define ir_ADD_D(_op1, _op2)              ir_BINARY_OP_D(IR_ADD, (_op1), (_op2))
91 #define ir_ADD_F(_op1, _op2)              ir_BINARY_OP_F(IR_ADD, (_op1), (_op2))
92 
93 #define ir_SUB(_type, _op1, _op2)         ir_BINARY_OP(IR_SUB, (_type), (_op1), (_op2))
94 #define ir_SUB_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_SUB, (_op1), (_op2))
95 #define ir_SUB_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_SUB, (_op1), (_op2))
96 #define ir_SUB_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_SUB, (_op1), (_op2))
97 #define ir_SUB_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_SUB, (_op1), (_op2))
98 #define ir_SUB_A(_op1, _op2)              ir_BINARY_OP_A(IR_SUB, (_op1), (_op2))
99 #define ir_SUB_C(_op1, _op2)              ir_BINARY_OP_C(IR_SUB, (_op1), (_op2))
100 #define ir_SUB_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_SUB, (_op1), (_op2))
101 #define ir_SUB_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_SUB, (_op1), (_op2))
102 #define ir_SUB_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_SUB, (_op1), (_op2))
103 #define ir_SUB_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_SUB, (_op1), (_op2))
104 #define ir_SUB_D(_op1, _op2)              ir_BINARY_OP_D(IR_SUB, (_op1), (_op2))
105 #define ir_SUB_F(_op1, _op2)              ir_BINARY_OP_F(IR_SUB, (_op1), (_op2))
106 
107 #define ir_MUL(_type, _op1, _op2)         ir_BINARY_OP(IR_MUL, (_type), (_op1), (_op2))
108 #define ir_MUL_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_MUL, (_op1), (_op2))
109 #define ir_MUL_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_MUL, (_op1), (_op2))
110 #define ir_MUL_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_MUL, (_op1), (_op2))
111 #define ir_MUL_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_MUL, (_op1), (_op2))
112 #define ir_MUL_A(_op1, _op2)              ir_BINARY_OP_A(IR_MUL, (_op1), (_op2))
113 #define ir_MUL_C(_op1, _op2)              ir_BINARY_OP_C(IR_MUL, (_op1), (_op2))
114 #define ir_NUL_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_MUL, (_op1), (_op2))
115 #define ir_MUL_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_MUL, (_op1), (_op2))
116 #define ir_MUL_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_MUL, (_op1), (_op2))
117 #define ir_MUL_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_MUL, (_op1), (_op2))
118 #define ir_MUL_D(_op1, _op2)              ir_BINARY_OP_D(IR_MUL, (_op1), (_op2))
119 #define ir_MUL_F(_op1, _op2)              ir_BINARY_OP_F(IR_MUL, (_op1), (_op2))
120 
121 #define ir_DIV(_type, _op1, _op2)         ir_BINARY_OP(IR_DIV, (_type), (_op1), (_op2))
122 #define ir_DIV_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_DIV, (_op1), (_op2))
123 #define ir_DIV_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_DIV, (_op1), (_op2))
124 #define ir_DIV_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_DIV, (_op1), (_op2))
125 #define ir_DIV_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_DIV, (_op1), (_op2))
126 #define ir_DIV_A(_op1, _op2)              ir_BINARY_OP_A(IR_DIV, (_op1), (_op2))
127 #define ir_DIV_C(_op1, _op2)              ir_BINARY_OP_C(IR_DIV, (_op1), (_op2))
128 #define ir_DIV_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_DIV, (_op1), (_op2))
129 #define ir_DIV_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_DIV, (_op1), (_op2))
130 #define ir_DIV_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_DIV, (_op1), (_op2))
131 #define ir_DIV_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_DIV, (_op1), (_op2))
132 #define ir_DIV_D(_op1, _op2)              ir_BINARY_OP_D(IR_DIV, (_op1), (_op2))
133 #define ir_DIV_F(_op1, _op2)              ir_BINARY_OP_F(IR_DIV, (_op1), (_op2))
134 
135 #define ir_MOD(_type, _op1, _op2)         ir_BINARY_OP(IR_MOD, (_type), (_op1), (_op2))
136 #define ir_MOD_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_MOD, (_op1), (_op2))
137 #define ir_MOD_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_MOD, (_op1), (_op2))
138 #define ir_MOD_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_MOD, (_op1), (_op2))
139 #define ir_MOD_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_MOD, (_op1), (_op2))
140 #define ir_MOD_A(_op1, _op2)              ir_BINARY_OP_A(IR_MOD, (_op1), (_op2))
141 #define ir_MOD_C(_op1, _op2)              ir_BINARY_OP_C(IR_MOD, (_op1), (_op2))
142 #define ir_MOD_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_MOD, (_op1), (_op2))
143 #define ir_MOD_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_MOD, (_op1), (_op2))
144 #define ir_MOD_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_MOD, (_op1), (_op2))
145 #define ir_MOD_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_MOD, (_op1), (_op2))
146 
147 #define ir_NEG(_type, _op1)               ir_UNARY_OP(IR_NEG, (_type), (_op1))
148 #define ir_NEG_C(_op1)                    ir_UNARY_OP_C(IR_NEG, (_op1))
149 #define ir_NEG_I8(_op1)                   ir_UNARY_OP_I8(IR_NEG, (_op1))
150 #define ir_NEG_I16(_op1)                  ir_UNARY_OP_I16(IR_NEG, (_op1))
151 #define ir_NEG_I32(_op1)                  ir_UNARY_OP_I32(IR_NEG, (_op1))
152 #define ir_NEG_I64(_op1)                  ir_UNARY_OP_I64(IR_NEG, (_op1))
153 #define ir_NEG_D(_op1)                    ir_UNARY_OP_D(IR_NEG, (_op1))
154 #define ir_NEG_F(_op1)                    ir_UNARY_OP_F(IR_NEG, (_op1))
155 
156 #define ir_ABS(_type, _op1)               ir_UNARY_OP(IR_ABS, (_type), (_op1))
157 #define ir_ABS_C(_op1)                    ir_UNARY_OP_C(IR_ABS, (_op1))
158 #define ir_ABS_I8(_op1)                   ir_UNARY_OP_I8(IR_ABS, (_op1))
159 #define ir_ABS_I16(_op1)                  ir_UNARY_OP_I16(IR_ABS, (_op1))
160 #define ir_ABS_I32(_op1)                  ir_UNARY_OP_I32(IR_ABS, (_op1))
161 #define ir_ABS_I64(_op1)                  ir_UNARY_OP_I64(IR_ABS, (_op1))
162 #define ir_ABS_D(_op1)                    ir_UNARY_OP_D(IR_ABS, (_op1))
163 #define ir_ABS_F(_op1)                    ir_UNARY_OP_F(IR_ABS, (_op1))
164 
165 #define ir_SEXT(_type, _op1)              ir_UNARY_OP(IR_SEXT, (_type), (_op1))
166 #define ir_SEXT_U8(_op1)                  ir_UNARY_OP_U8(IR_SEXT, (_op1))
167 #define ir_SEXT_U16(_op1)                 ir_UNARY_OP_U16(IR_SEXT, (_op1))
168 #define ir_SEXT_U32(_op1)                 ir_UNARY_OP_U32(IR_SEXT, (_op1))
169 #define ir_SEXT_U64(_op1)                 ir_UNARY_OP_U64(IR_SEXT, (_op1))
170 #define ir_SEXT_A(_op1)                   ir_UNARY_OP_A(IR_SEXT, (_op1))
171 #define ir_SEXT_C(_op1)                   ir_UNARY_OP_C(IR_SEXT, (_op1))
172 #define ir_SEXT_I8(_op1)                  ir_UNARY_OP_I8(IR_SEXT, (_op1))
173 #define ir_SEXT_I16(_op1)                 ir_UNARY_OP_I16(IR_SEXT, (_op1))
174 #define ir_SEXT_I32(_op1)                 ir_UNARY_OP_I32(IR_SEXT, (_op1))
175 #define ir_SEXT_I64(_op1)                 ir_UNARY_OP_I64(IR_SEXT, (_op1))
176 
177 #define ir_ZEXT(_type, _op1)              ir_UNARY_OP(IR_ZEXT, (_type), (_op1))
178 #define ir_ZEXT_U8(_op1)                  ir_UNARY_OP_U8(IR_ZEXT, (_op1))
179 #define ir_ZEXT_U16(_op1)                 ir_UNARY_OP_U16(IR_ZEXT, (_op1))
180 #define ir_ZEXT_U32(_op1)                 ir_UNARY_OP_U32(IR_ZEXT, (_op1))
181 #define ir_ZEXT_U64(_op1)                 ir_UNARY_OP_U64(IR_ZEXT, (_op1))
182 #define ir_ZEXT_A(_op1)                   ir_UNARY_OP_A(IR_ZEXT, (_op1))
183 #define ir_ZEXT_C(_op1)                   ir_UNARY_OP_C(IR_ZEXT, (_op1))
184 #define ir_ZEXT_I8(_op1)                  ir_UNARY_OP_I8(IR_ZEXT, (_op1))
185 #define ir_ZEXT_I16(_op1)                 ir_UNARY_OP_I16(IR_ZEXT, (_op1))
186 #define ir_ZEXT_I32(_op1)                 ir_UNARY_OP_I32(IR_ZEXT, (_op1))
187 #define ir_ZEXT_I64(_op1)                 ir_UNARY_OP_I64(IR_ZEXT, (_op1))
188 
189 #define ir_TRUNC(_type, _op1)             ir_UNARY_OP(IR_TRUNC, (_type), (_op1))
190 #define ir_TRUNC_U8(_op1)                 ir_UNARY_OP_U8(IR_TRUNC, (_op1))
191 #define ir_TRUNC_U16(_op1)                ir_UNARY_OP_U16(IR_TRUNC, (_op1))
192 #define ir_TRUNC_U32(_op1)                ir_UNARY_OP_U32(IR_TRUNC, (_op1))
193 #define ir_TRUNC_U64(_op1)                ir_UNARY_OP_U64(IR_TRUNC, (_op1))
194 #define ir_TRUNC_A(_op1)                  ir_UNARY_OP_A(IR_TRUNC, (_op1))
195 #define ir_TRUNC_C(_op1)                  ir_UNARY_OP_C(IR_TRUNC, (_op1))
196 #define ir_TRUNC_I8(_op1)                 ir_UNARY_OP_I8(IR_TRUNC, (_op1))
197 #define ir_TRUNC_I16(_op1)                ir_UNARY_OP_I16(IR_TRUNC, (_op1))
198 #define ir_TRUNC_I32(_op1)                ir_UNARY_OP_I32(IR_TRUNC, (_op1))
199 #define ir_TRUNC_I64(_op1)                ir_UNARY_OP_I64(IR_TRUNC, (_op1))
200 
201 #define ir_BITCAST(_type, _op1)           ir_UNARY_OP(IR_BITCAST, (_type), (_op1))
202 #define ir_BITCAST_U8(_op1)               ir_UNARY_OP_U8(IR_BITCAST, (_op1))
203 #define ir_BITCAST_U16(_op1)              ir_UNARY_OP_U16(IR_BITCAST, (_op1))
204 #define ir_BITCAST_U32(_op1)              ir_UNARY_OP_U32(IR_BITCAST, (_op1))
205 #define ir_BITCAST_U64(_op1)              ir_UNARY_OP_U64(IR_BITCAST, (_op1))
206 #define ir_BITCAST_A(_op1)                ir_UNARY_OP_A(IR_BITCAST, (_op1))
207 #define ir_BITCAST_C(_op1)                ir_UNARY_OP_C(IR_BITCAST, (_op1))
208 #define ir_BITCAST_I8(_op1)               ir_UNARY_OP_I8(IR_BITCAST, (_op1))
209 #define ir_BITCAST_I16(_op1)              ir_UNARY_OP_I16(IR_BITCAST, (_op1))
210 #define ir_BITCAST_I32(_op1)              ir_UNARY_OP_I32(IR_BITCAST, (_op1))
211 #define ir_BITCAST_I64(_op1)              ir_UNARY_OP_I64(IR_BITCAST, (_op1))
212 #define ir_BITCAST_D(_op1)                ir_UNARY_OP_D(IR_BITCAST, (_op1))
213 #define ir_BITCAST_F(_op1)                ir_UNARY_OP_F(IR_BITCAST, (_op1))
214 
215 #define ir_INT2FP(_type, _op1)            ir_UNARY_OP(IR_INT2FP, (_type), (_op1))
216 #define ir_INT2D(_op1)                    ir_UNARY_OP_D(IR_INT2FP, (_op1))
217 #define ir_INT2F(_op1)                    ir_UNARY_OP_F(IR_INT2FP, (_op1))
218 
219 #define ir_FP2INT(_type, _op1)            ir_UNARY_OP(IR_FP2INT, (_type), (_op1))
220 #define ir_FP2U8(_op1)                    ir_UNARY_OP_U8(IR_FP2INT, (_op1))
221 #define ir_FP2U16(_op1)                   ir_UNARY_OP_U16(IR_FP2INT, (_op1))
222 #define ir_FP2U32(_op1)                   ir_UNARY_OP_U32(IR_FP2INT, (_op1))
223 #define ir_FP2U64(_op1)                   ir_UNARY_OP_U64(IR_FP2INT, (_op1))
224 #define ir_FP2I8(_op1)                    ir_UNARY_OP_I8(IR_FP2INT, (_op1))
225 #define ir_FP2I16(_op1)                   ir_UNARY_OP_I16(IR_FP2INT, (_op1))
226 #define ir_FP2I32(_op1)                   ir_UNARY_OP_I32(IR_FP2INT, (_op1))
227 #define ir_FP2I64(_op1)                   ir_UNARY_OP_I64(IR_FP2INT, (_op1))
228 
229 #define ir_FP2FP(_type, _op1)             ir_UNARY_OP(IR_FP2FP, (_type), (_op1))
230 #define ir_F2D(_op1)                      ir_UNARY_OP_D(IR_FP2FP, (_op1))
231 #define ir_D2F(_op1)                      ir_UNARY_OP_F(IR_FP2FP, (_op1))
232 
233 #define ir_ADD_OV(_type, _op1, _op2)      ir_BINARY_OP(IR_ADD_OV, (_type), (_op1), (_op2))
234 #define ir_ADD_OV_U8(_op1, _op2)          ir_BINARY_OP_U8(IR_ADD_OV, (_op1), (_op2))
235 #define ir_ADD_OV_U16(_op1, _op2)         ir_BINARY_OP_U16(IR_ADD_OV, (_op1), (_op2))
236 #define ir_ADD_OV_U32(_op1, _op2)         ir_BINARY_OP_U32(IR_ADD_OV, (_op1), (_op2))
237 #define ir_ADD_OV_U64(_op1, _op2)         ir_BINARY_OP_U64(IR_ADD_OV, (_op1), (_op2))
238 #define ir_ADD_OV_A(_op1, _op2)           ir_BINARY_OP_A(IR_ADD_OV, (_op1), (_op2))
239 #define ir_ADD_OV_C(_op1, _op2)           ir_BINARY_OP_C(IR_ADD_OV, (_op1), (_op2))
240 #define ir_ADD_OV_I8(_op1, _op2)          ir_BINARY_OP_I8(IR_ADD_OV, (_op1), (_op2))
241 #define ir_ADD_OV_I16(_op1, _op2)         ir_BINARY_OP_I16(IR_ADD_OV, (_op1), (_op2))
242 #define ir_ADD_OV_I32(_op1, _op2)         ir_BINARY_OP_I32(IR_ADD_OV, (_op1), (_op2))
243 #define ir_ADD_OV_I64(_op1, _op2)         ir_BINARY_OP_I64(IR_ADD_OV, (_op1), (_op2))
244 
245 #define ir_SUB_OV(_type, _op1, _op2)      ir_BINARY_OP(IR_SUB_OV, (_type), (_op1), (_op2))
246 #define ir_SUB_OV_U8(_op1, _op2)          ir_BINARY_OP_U8(IR_SUB_OV, (_op1), (_op2))
247 #define ir_SUB_OV_U16(_op1, _op2)         ir_BINARY_OP_U16(IR_SUB_OV, (_op1), (_op2))
248 #define ir_SUB_OV_U32(_op1, _op2)         ir_BINARY_OP_U32(IR_SUB_OV, (_op1), (_op2))
249 #define ir_SUB_OV_U64(_op1, _op2)         ir_BINARY_OP_U64(IR_SUB_OV, (_op1), (_op2))
250 #define ir_SUB_OV_A(_op1, _op2)           ir_BINARY_OP_A(IR_SUB_OV, (_op1), (_op2))
251 #define ir_SUB_OV_C(_op1, _op2)           ir_BINARY_OP_C(IR_SUB_OV, (_op1), (_op2))
252 #define ir_SUB_OV_I8(_op1, _op2)          ir_BINARY_OP_I8(IR_SUB_OV, (_op1), (_op2))
253 #define ir_SUB_OV_I16(_op1, _op2)         ir_BINARY_OP_I16(IR_SUB_OV, (_op1), (_op2))
254 #define ir_SUB_OV_I32(_op1, _op2)         ir_BINARY_OP_I32(IR_SUB_OV, (_op1), (_op2))
255 #define ir_SUB_OV_I64(_op1, _op2)         ir_BINARY_OP_I64(IR_SUB_OV, (_op1), (_op2))
256 
257 #define ir_MUL_OV(_type, _op1, _op2)      ir_BINARY_OP(IR_MUL_OV, (_type), (_op1), (_op2))
258 #define ir_MUL_OV_U8(_op1, _op2)          ir_BINARY_OP_U8(IR_MUL_OV, (_op1), (_op2))
259 #define ir_MUL_OV_U16(_op1, _op2)         ir_BINARY_OP_U16(IR_MUL_OV, (_op1), (_op2))
260 #define ir_MUL_OV_U32(_op1, _op2)         ir_BINARY_OP_U32(IR_MUL_OV, (_op1), (_op2))
261 #define ir_MUL_OV_U64(_op1, _op2)         ir_BINARY_OP_U64(IR_MUL_OV, (_op1), (_op2))
262 #define ir_MUL_OV_A(_op1, _op2)           ir_BINARY_OP_A(IR_MUL_OV, (_op1), (_op2))
263 #define ir_MUL_OV_C(_op1, _op2)           ir_BINARY_OP_C(IR_MUL_OV, (_op1), (_op2))
264 #define ir_MUL_OV_I8(_op1, _op2)          ir_BINARY_OP_I8(IR_MUL_OV, (_op1), (_op2))
265 #define ir_MUL_OV_I16(_op1, _op2)         ir_BINARY_OP_I16(IR_MUL_OV, (_op1), (_op2))
266 #define ir_MUL_OV_I32(_op1, _op2)         ir_BINARY_OP_I32(IR_MUL_OV, (_op1), (_op2))
267 #define ir_MUL_OV_I64(_op1, _op2)         ir_BINARY_OP_I64(IR_MUL_OV, (_op1), (_op2))
268 
269 #define ir_OVERFLOW(_op1)                 ir_fold1(_ir_CTX, IR_OPT(IR_OVERFLOW, IR_BOOL), (_op1))
270 
271 #define ir_NOT(_type, _op1)               ir_UNARY_OP(IR_NOT, (_type), (_op1))
272 #define ir_NOT_B(_op1)                    ir_UNARY_OP_B(IR_NOT, (_op1))
273 #define ir_NOT_U8(_op1)                   ir_UNARY_OP_U8(IR_NOT, (_op1))
274 #define ir_NOT_U16(_op1)                  ir_UNARY_OP_U16(IR_NOT, (_op1))
275 #define ir_NOT_U32(_op1)                  ir_UNARY_OP_U32(IR_NOT, (_op1))
276 #define ir_NOT_U64(_op1)                  ir_UNARY_OP_U64(IR_NOT, (_op1))
277 #define ir_NOT_A(_op1)                    ir_UNARY_OP_A(IR_NOT, (_op1))
278 #define ir_NOT_C(_op1)                    ir_UNARY_OP_C(IR_NOT, (_op1))
279 #define ir_NOT_I8(_op1)                   ir_UNARY_OP_I8(IR_NOT, (_op1))
280 #define ir_NOT_I16(_op1)                  ir_UNARY_OP_I16(IR_NOT, (_op1))
281 #define ir_NOT_I32(_op1)                  ir_UNARY_OP_I32(IR_NOT, (_op1))
282 #define ir_NOT_I64(_op1)                  ir_UNARY_OP_I64(IR_NOT, (_op1))
283 
284 #define ir_OR(_type, _op1, _op2)          ir_BINARY_OP(IR_OR, (_type), (_op1), (_op2))
285 #define ir_OR_B(_op1, _op2)               ir_BINARY_OP_B(IR_OR, (_op1), (_op2))
286 #define ir_OR_U8(_op1, _op2)              ir_BINARY_OP_U8(IR_OR, (_op1), (_op2))
287 #define ir_OR_U16(_op1, _op2)             ir_BINARY_OP_U16(IR_OR, (_op1), (_op2))
288 #define ir_OR_U32(_op1, _op2)             ir_BINARY_OP_U32(IR_OR, (_op1), (_op2))
289 #define ir_OR_U64(_op1, _op2)             ir_BINARY_OP_U64(IR_OR, (_op1), (_op2))
290 #define ir_OR_A(_op1, _op2)               ir_BINARY_OP_A(IR_OR, (_op1), (_op2))
291 #define ir_OR_C(_op1, _op2)               ir_BINARY_OP_C(IR_OR, (_op1), (_op2))
292 #define ir_OR_I8(_op1, _op2)              ir_BINARY_OP_I8(IR_OR, (_op1), (_op2))
293 #define ir_OR_I16(_op1, _op2)             ir_BINARY_OP_I16(IR_OR, (_op1), (_op2))
294 #define ir_OR_I32(_op1, _op2)             ir_BINARY_OP_I32(IR_OR, (_op1), (_op2))
295 #define ir_OR_I64(_op1, _op2)             ir_BINARY_OP_I64(IR_OR, (_op1), (_op2))
296 
297 #define ir_AND(_type, _op1, _op2)         ir_BINARY_OP(IR_AND, (_type), (_op1), (_op2))
298 #define ir_AND_B(_op1, _op2)              ir_BINARY_OP_B(IR_AND, (_op1), (_op2))
299 #define ir_AND_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_AND, (_op1), (_op2))
300 #define ir_AND_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_AND, (_op1), (_op2))
301 #define ir_AND_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_AND, (_op1), (_op2))
302 #define ir_AND_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_AND, (_op1), (_op2))
303 #define ir_AND_A(_op1, _op2)              ir_BINARY_OP_A(IR_AND, (_op1), (_op2))
304 #define ir_AND_C(_op1, _op2)              ir_BINARY_OP_C(IR_AND, (_op1), (_op2))
305 #define ir_AND_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_AND, (_op1), (_op2))
306 #define ir_AND_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_AND, (_op1), (_op2))
307 #define ir_AND_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_AND, (_op1), (_op2))
308 #define ir_AND_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_AND, (_op1), (_op2))
309 
310 #define ir_XOR(_type, _op1, _op2)         ir_BINARY_OP(IR_XOR, (_type), (_op1), (_op2))
311 #define ir_XOR_B(_op1, _op2)              ir_BINARY_OP_B(IR_XOR, (_op1), (_op2))
312 #define ir_XOR_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_XOR, (_op1), (_op2))
313 #define ir_XOR_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_XOR, (_op1), (_op2))
314 #define ir_XOR_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_XOR, (_op1), (_op2))
315 #define ir_XOR_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_XOR, (_op1), (_op2))
316 #define ir_XOR_A(_op1, _op2)              ir_BINARY_OP_A(IR_XOR, (_op1), (_op2))
317 #define ir_XOR_C(_op1, _op2)              ir_BINARY_OP_C(IR_XOR, (_op1), (_op2))
318 #define ir_XOR_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_XOR, (_op1), (_op2))
319 #define ir_XOR_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_XOR, (_op1), (_op2))
320 #define ir_XOR_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_XOR, (_op1), (_op2))
321 #define ir_XOR_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_XOR, (_op1), (_op2))
322 
323 #define ir_SHL(_type, _op1, _op2)         ir_BINARY_OP(IR_SHL, (_type), (_op1), (_op2))
324 #define ir_SHL_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_SHL, (_op1), (_op2))
325 #define ir_SHL_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_SHL, (_op1), (_op2))
326 #define ir_SHL_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_SHL, (_op1), (_op2))
327 #define ir_SHL_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_SHL, (_op1), (_op2))
328 #define ir_SHL_A(_op1, _op2)              ir_BINARY_OP_A(IR_SHL, (_op1), (_op2))
329 #define ir_SHL_C(_op1, _op2)              ir_BINARY_OP_C(IR_SHL, (_op1), (_op2))
330 #define ir_SHL_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_SHL, (_op1), (_op2))
331 #define ir_SHL_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_SHL, (_op1), (_op2))
332 #define ir_SHL_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_SHL, (_op1), (_op2))
333 #define ir_SHL_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_SHL, (_op1), (_op2))
334 
335 #define ir_SHR(_type, _op1, _op2)         ir_BINARY_OP(IR_SHR, (_type), (_op1), (_op2))
336 #define ir_SHR_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_SHR, (_op1), (_op2))
337 #define ir_SHR_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_SHR, (_op1), (_op2))
338 #define ir_SHR_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_SHR, (_op1), (_op2))
339 #define ir_SHR_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_SHR, (_op1), (_op2))
340 #define ir_SHR_A(_op1, _op2)              ir_BINARY_OP_A(IR_SHR, (_op1), (_op2))
341 #define ir_SHR_C(_op1, _op2)              ir_BINARY_OP_C(IR_SHR, (_op1), (_op2))
342 #define ir_SHR_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_SHR, (_op1), (_op2))
343 #define ir_SHR_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_SHR, (_op1), (_op2))
344 #define ir_SHR_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_SHR, (_op1), (_op2))
345 #define ir_SHR_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_SHR, (_op1), (_op2))
346 
347 #define ir_SAR(_type, _op1, _op2)         ir_BINARY_OP(IR_SAR, (_type), (_op1), (_op2))
348 #define ir_SAR_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_SAR, (_op1), (_op2))
349 #define ir_SAR_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_SAR, (_op1), (_op2))
350 #define ir_SAR_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_SAR, (_op1), (_op2))
351 #define ir_SAR_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_SAR, (_op1), (_op2))
352 #define ir_SAR_A(_op1, _op2)              ir_BINARY_OP_A(IR_SAR, (_op1), (_op2))
353 #define ir_SAR_C(_op1, _op2)              ir_BINARY_OP_C(IR_SAR, (_op1), (_op2))
354 #define ir_SAR_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_SAR, (_op1), (_op2))
355 #define ir_SAR_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_SAR, (_op1), (_op2))
356 #define ir_SAR_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_SAR, (_op1), (_op2))
357 #define ir_SAR_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_SAR, (_op1), (_op2))
358 
359 #define ir_ROL(_type, _op1, _op2)         ir_BINARY_OP(IR_ROL, (_type), (_op1), (_op2))
360 #define ir_ROL_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_ROL, (_op1), (_op2))
361 #define ir_ROL_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_ROL, (_op1), (_op2))
362 #define ir_ROL_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_ROL, (_op1), (_op2))
363 #define ir_ROL_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_ROL, (_op1), (_op2))
364 #define ir_ROL_A(_op1, _op2)              ir_BINARY_OP_A(IR_ROL, (_op1), (_op2))
365 #define ir_ROL_C(_op1, _op2)              ir_BINARY_OP_C(IR_ROL, (_op1), (_op2))
366 #define ir_ROL_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_ROL, (_op1), (_op2))
367 #define ir_ROL_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_ROL, (_op1), (_op2))
368 #define ir_ROL_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_ROL, (_op1), (_op2))
369 #define ir_ROL_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_ROL, (_op1), (_op2))
370 
371 #define ir_ROR(_type, _op1, _op2)         ir_BINARY_OP(IR_ROR, (_type), (_op1), (_op2))
372 #define ir_ROR_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_ROR, (_op1), (_op2))
373 #define ir_ROR_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_ROR, (_op1), (_op2))
374 #define ir_ROR_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_ROR, (_op1), (_op2))
375 #define ir_ROR_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_ROR, (_op1), (_op2))
376 #define ir_ROR_A(_op1, _op2)              ir_BINARY_OP_A(IR_ROR, (_op1), (_op2))
377 #define ir_ROR_C(_op1, _op2)              ir_BINARY_OP_C(IR_ROR, (_op1), (_op2))
378 #define ir_ROR_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_ROR, (_op1), (_op2))
379 #define ir_ROR_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_ROR, (_op1), (_op2))
380 #define ir_ROR_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_ROR, (_op1), (_op2))
381 #define ir_ROR_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_ROR, (_op1), (_op2))
382 
383 #define ir_BSWAP(_type, _op1)             ir_UNARY_OP(IR_BSWAP, (_type), (_op1))
384 #define ir_BSWAP_U16(_op1)                ir_UNARY_OP_U16(IR_BSWAP, (_op1))
385 #define ir_BSWAP_U32(_op1)                ir_UNARY_OP_U32(IR_BSWAP, (_op1))
386 #define ir_BSWAP_U64(_op1)                ir_UNARY_OP_U64(IR_BSWAP, (_op1))
387 #define ir_BSWAP_A(_op1)                  ir_UNARY_OP_A(IR_BSWAP, (_op1))
388 #define ir_BSWAP_I16(_op1)                ir_UNARY_OP_I16(IR_BSWAP, (_op1))
389 #define ir_BSWAP_I32(_op1)                ir_UNARY_OP_I32(IR_BSWAP, (_op1))
390 #define ir_BSWAP_I64(_op1)                ir_UNARY_OP_I64(IR_BSWAP, (_op1))
391 
392 #define ir_CTPOP(_type, _op1)             ir_UNARY_OP(IR_CTPOP, (_type), (_op1))
393 #define ir_CTPOP_8(_op1)                  ir_UNARY_OP_U8(IR_CTPOP, (_op1))
394 #define ir_CTPOP_U16(_op1)                ir_UNARY_OP_U16(IR_CTPOP, (_op1))
395 #define ir_CTPOP_U32(_op1)                ir_UNARY_OP_U32(IR_CTPOP, (_op1))
396 #define ir_CTPOP_U64(_op1)                ir_UNARY_OP_U64(IR_CTPOP, (_op1))
397 #define ir_CTPOP_A(_op1)                  ir_UNARY_OP_A(IR_CTPOP, (_op1))
398 #define ir_CTPOP_C(_op1)                  ir_UNARY_OP_C(IR_CTPOP, (_op1))
399 #define ir_CTPOP_I8(_op1)                 ir_UNARY_OP_I8(IR_CTPOP, (_op1))
400 #define ir_CTPOP_I16(_op1)                ir_UNARY_OP_I16(IR_CTPOP, (_op1))
401 #define ir_CTPOP_I32(_op1)                ir_UNARY_OP_I32(IR_CTPOP, (_op1))
402 #define ir_CTPOP_I64(_op1)                ir_UNARY_OP_I64(IR_CTPOP, (_op1))
403 
404 #define ir_CTLZ(_type, _op1)              ir_UNARY_OP(IR_CTLZ, (_type), (_op1))
405 #define ir_CTLZ_8(_op1)                   ir_UNARY_OP_U8(IR_CTLZ, (_op1))
406 #define ir_CTLZ_U16(_op1)                 ir_UNARY_OP_U16(IR_CTLZ, (_op1))
407 #define ir_CTLZ_U32(_op1)                 ir_UNARY_OP_U32(IR_CTLZ, (_op1))
408 #define ir_CTLZ_U64(_op1)                 ir_UNARY_OP_U64(IR_CTLZ, (_op1))
409 #define ir_CTLZ_A(_op1)                   ir_UNARY_OP_A(IR_CTLZ, (_op1))
410 #define ir_CTLZ_C(_op1)                   ir_UNARY_OP_C(IR_CTLZ, (_op1))
411 #define ir_CTLZ_I8(_op1)                  ir_UNARY_OP_I8(IR_CTLZ, (_op1))
412 #define ir_CTLZ_I16(_op1)                 ir_UNARY_OP_I16(IR_CTLZ, (_op1))
413 #define ir_CTLZ_I32(_op1)                 ir_UNARY_OP_I32(IR_CTLZ, (_op1))
414 #define ir_CTLZ_I64(_op1)                 ir_UNARY_OP_I64(IR_CTLZ, (_op1))
415 
416 #define ir_CTTZ(_type, _op1)              ir_UNARY_OP(IR_CTTZ, (_type), (_op1))
417 #define ir_CTTZ_8(_op1)                   ir_UNARY_OP_U8(IR_CTTZ, (_op1))
418 #define ir_CTTZ_U16(_op1)                 ir_UNARY_OP_U16(IR_CTTZ, (_op1))
419 #define ir_CTTZ_U32(_op1)                 ir_UNARY_OP_U32(IR_CTTZ, (_op1))
420 #define ir_CTTZ_U64(_op1)                 ir_UNARY_OP_U64(IR_CTTZ, (_op1))
421 #define ir_CTTZ_A(_op1)                   ir_UNARY_OP_A(IR_CTTZ, (_op1))
422 #define ir_CTTZ_C(_op1)                   ir_UNARY_OP_C(IR_CTTZ, (_op1))
423 #define ir_CTTZ_I8(_op1)                  ir_UNARY_OP_I8(IR_CTTZ, (_op1))
424 #define ir_CTTZ_I16(_op1)                 ir_UNARY_OP_I16(IR_CTTZ, (_op1))
425 #define ir_CTTZ_I32(_op1)                 ir_UNARY_OP_I32(IR_CTTZ, (_op1))
426 #define ir_CTTZ_I64(_op1)                 ir_UNARY_OP_I64(IR_CTTZ, (_op1))
427 
428 #define ir_MIN(_type, _op1, _op2)         ir_BINARY_OP(IR_MIN, (_type), (_op1), (_op2))
429 #define ir_MIN_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_MIN, (_op1), (_op2))
430 #define ir_MIN_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_MIN, (_op1), (_op2))
431 #define ir_MIN_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_MIN, (_op1), (_op2))
432 #define ir_MIN_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_MIN, (_op1), (_op2))
433 #define ir_MIN_A(_op1, _op2)              ir_BINARY_OP_A(IR_MIN, (_op1), (_op2))
434 #define ir_MIN_C(_op1, _op2)              ir_BINARY_OP_C(IR_MIN, (_op1), (_op2))
435 #define ir_MIN_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_MIN, (_op1), (_op2))
436 #define ir_MIN_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_MIN, (_op1), (_op2))
437 #define ir_MIN_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_MIN, (_op1), (_op2))
438 #define ir_MIN_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_MIN, (_op1), (_op2))
439 #define ir_MIN_D(_op1, _op2)              ir_BINARY_OP_D(IR_MIN, (_op1), (_op2))
440 #define ir_MIN_F(_op1, _op2)              ir_BINARY_OP_F(IR_MIN, (_op1), (_op2))
441 
442 #define ir_MAX(_type, _op1, _op2)         ir_BINARY_OP(IR_MAX, (_type), (_op1), (_op2))
443 #define ir_MAX_U8(_op1, _op2)             ir_BINARY_OP_U8(IR_MAX, (_op1), (_op2))
444 #define ir_MAX_U16(_op1, _op2)            ir_BINARY_OP_U16(IR_MAX, (_op1), (_op2))
445 #define ir_MAX_U32(_op1, _op2)            ir_BINARY_OP_U32(IR_MAX, (_op1), (_op2))
446 #define ir_MAX_U64(_op1, _op2)            ir_BINARY_OP_U64(IR_MAX, (_op1), (_op2))
447 #define ir_MAX_A(_op1, _op2)              ir_BINARY_OP_A(IR_MAX, (_op1), (_op2))
448 #define ir_MAX_C(_op1, _op2)              ir_BINARY_OP_C(IR_MAX, (_op1), (_op2))
449 #define ir_MAX_I8(_op1, _op2)             ir_BINARY_OP_I8(IR_MAX, (_op1), (_op2))
450 #define ir_MAX_I16(_op1, _op2)            ir_BINARY_OP_I16(IR_MAX, (_op1), (_op2))
451 #define ir_MAX_I32(_op1, _op2)            ir_BINARY_OP_I32(IR_MAX, (_op1), (_op2))
452 #define ir_MAX_I64(_op1, _op2)            ir_BINARY_OP_I64(IR_MAX, (_op1), (_op2))
453 #define ir_MAX_D(_op1, _op2)              ir_BINARY_OP_D(IR_MAX, (_op1), (_op2))
454 #define ir_MAX_F(_op1, _op2)              ir_BINARY_OP_F(IR_MAX, (_op1), (_op2))
455 
456 #define ir_COND(_type, _op1, _op2, _op3)  ir_fold3(_ir_CTX, IR_OPT(IR_COND, (_type)),   (_op1), (_op2), (_op3))
457 #define ir_COND_U8(_op1, _op2, _op3)      ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_U8),     (_op1), (_op2), (_op3))
458 #define ir_COND_U16(_op1, _op2, _op3)     ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_U16),    (_op1), (_op2), (_op3))
459 #define ir_COND_U32(_op1, _op2, _op3)     ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_U32),    (_op1), (_op2), (_op3))
460 #define ir_COND_U64(_op1, _op2, _op3)     ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_U64),    (_op1), (_op2), (_op3))
461 #define ir_COND_A(_op1, _op2, _op3)       ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_ADDR),   (_op1), (_op2), (_op3))
462 #define ir_COND_C(_op1, _op2, _op3)       ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_CHAR),   (_op1), (_op2), (_op3))
463 #define ir_COND_I8(_op1, _op2, _op3)      ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_I8),     (_op1), (_op2), (_op3))
464 #define ir_COND_I16(_op1, _op2, _op3)     ir_fold3(_ir_CTX, IR_OPT(IR_COMD, IR_I16),    (_op1), (_op2), (_op3))
465 #define ir_COND_I32(_op1, _op2, _op3)     ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_I32),    (_op1), (_op2), (_op3))
466 #define ir_COND_I64(_op1, _op2, _op3)     ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_I64),    (_op1), (_op2), (_op3))
467 #define ir_COND_D(_op1, _op2, _op3)       ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_DOUBLE), (_op1), (_op2), (_op3))
468 #define ir_COND_F(_op1, _op2, _op3)       ir_fold3(_ir_CTX, IR_OPT(IR_COND, IR_FLOAT),  (_op1), (_op2), (_op3))
469 
470 #define ir_PHI_2(type, _src1, _src2)      _ir_PHI_2(_ir_CTX, type, (_src1), (_src2))
471 #define ir_PHI_N(type, _n, _inputs)       _ir_PHI_N(_ir_CTX, type, (_n), (_inputs))
472 #define ir_PHI_SET_OP(_ref, _pos, _src)   _ir_PHI_SET_OP(_ir_CTX, (_ref), (_pos), (_src))
473 
474 #define ir_COPY(_type, _op1)              ir_UNARY_OP(IR_COPY, (_type), (_op1))
475 #define ir_COPY_B(_op1)                   ir_UNARY_OP_B(IR_COPY, (_op1))
476 #define ir_COPY_U8(_op1)                  ir_UNARY_OP_U8(IR_COPY, (_op1))
477 #define ir_COPY_U16(_op1)                 ir_UNARY_OP_U16(IR_COPY, (_op1))
478 #define ir_COPY_U32(_op1)                 ir_UNARY_OP_U32(IR_COPY, (_op1))
479 #define ir_COPY_U64(_op1)                 ir_UNARY_OP_U64(IR_COPY, (_op1))
480 #define ir_COPY_A(_op1)                   ir_UNARY_OP_A(IR_COPY, (_op1))
481 #define ir_COPY_C(_op1)                   ir_UNARY_OP_C(IR_COPY, (_op1))
482 #define ir_COPY_I8(_op1)                  ir_UNARY_OP_I8(IR_COPY, (_op1))
483 #define ir_COPY_I16(_op1)                 ir_UNARY_OP_I16(IR_COPY, (_op1))
484 #define ir_COPY_I32(_op1)                 ir_UNARY_OP_I32(IR_COPY, (_op1))
485 #define ir_COPY_I64(_op1)                 ir_UNARY_OP_I64(IR_COPY, (_op1))
486 #define ir_COPY_D(_op1)                   ir_UNARY_OP_D(IR_COPY, (_op1))
487 #define ir_COPY_F(_op1)                   ir_UNARY_OP_F(IR_COPY, (_op1))
488 
489 /* Helper to add address with a constant offset */
490 #define ir_ADD_OFFSET(_addr, _offset)     _ir_ADD_OFFSET(_ir_CTX, (_addr), (_offset))
491 
492 /* Unfoldable variant of COPY */
493 #define ir_HARD_COPY(_type, _op1)         ir_BINARY_OP(IR_COPY, (_type), (_op1), 1)
494 #define ir_HARD_COPY_B(_op1)              ir_BINARY_OP_B(IR_COPY, (_op1), 1)
495 #define ir_HARD_COPY_U8(_op1)             ir_BINARY_OP_U8(IR_COPY, (_op1), 1)
496 #define ir_HARD_COPY_U16(_op1)            ir_BINARY_OP_U16(IR_COPY, (_op1), 1)
497 #define ir_HARD_COPY_U32(_op1)            ir_BINARY_OP_U32(IR_COPY, (_op1), 1)
498 #define ir_HARD_COPY_U64(_op1)            ir_BINARY_OP_U64(IR_COPY, (_op1), 1)
499 #define ir_HARD_COPY_A(_op1)              ir_BINARY_OP_A(IR_COPY, (_op1), 1)
500 #define ir_HARD_COPY_C(_op1)              ir_BINARY_OP_C(IR_COPY, (_op1), 1)
501 #define ir_HARD_COPY_I8(_op1)             ir_BINARY_OP_I8(IR_COPY, (_op1), 1)
502 #define ir_HARD_COPY_I16(_op1)            ir_BINARY_OP_I16(IR_COPY, (_op1), 1)
503 #define ir_HARD_COPY_I32(_op1)            ir_BINARY_OP_I32(IR_COPY, (_op1), 1)
504 #define ir_HARD_COPY_I64(_op1)            ir_BINARY_OP_I64(IR_COPY, (_op1), 1)
505 #define ir_HARD_COPY_D(_op1)              ir_BINARY_OP_D(IR_COPY, (_op1), 1)
506 #define ir_HARD_COPY_F(_op1)              ir_BINARY_OP_F(IR_COPY, (_op1), 1)
507 
508 #define ir_PARAM(_type, _name, _num)      _ir_PARAM(_ir_CTX, (_type), (_name), (_num))
509 #define ir_VAR(_type, _name)              _ir_VAR(_ir_CTX, (_type), (_name))
510 
511 #define ir_CALL(type, func)                        _ir_CALL(_ir_CTX, type, func)
512 #define ir_CALL_1(type, func, a1)                  _ir_CALL_1(_ir_CTX, type, func, a1)
513 #define ir_CALL_2(type, func, a1, a2)              _ir_CALL_2(_ir_CTX, type, func, a1, a2)
514 #define ir_CALL_3(type, func, a1, a2, a3)          _ir_CALL_3(_ir_CTX, type, func, a1, a2, a3)
515 #define ir_CALL_4(type, func, a1, a2, a3, a4)      _ir_CALL_4(_ir_CTX, type, func, a1, a2, a3, a4)
516 #define ir_CALL_5(type, func, a1, a2, a3, a4, a5)  _ir_CALL_5(_ir_CTX, type, func, a1, a2, a3, a4, a5)
517 #define ir_CALL_6(type, func, a, b, c, d, e, f)    _ir_CALL_6(_ir_CTX, type, func, a, b, c, d, e, f)
518 #define ir_CALL_N(type, func, count, args)         _ir_CALL_N(_ir_CTX, type, func, count, args)
519 
520 #define ir_TAILCALL(type, func)                       _ir_TAILCALL(_ir_CTX, type, func)
521 #define ir_TAILCALL_1(type, func, a1)                 _ir_TAILCALL_1(_ir_CTX, type, func, a1)
522 #define ir_TAILCALL_2(type, func, a1, a2)             _ir_TAILCALL_2(_ir_CTX, type, func, a1, a2)
523 #define ir_TAILCALL_3(type, func, a1, a2, a3)         _ir_TAILCALL_3(_ir_CTX, type, func, a1, a2, a3)
524 #define ir_TAILCALL_4(type, func, a1, a2, a3, a4)     _ir_TAILCALL_4(_ir_CTX, type, func, a1, a2, a3, a4)
525 #define ir_TAILCALL_5(type, func, a1, a2, a3, a4, a5) _ir_TAILCALL_5(_ir_CTX, type, func, a1, a2, a3, a4, a5)
526 #define ir_TAILCALL_6(type, func, a, b, c, d, e, f)   _ir_TAILCALL_6(_ir_CTX, type, func, a, b, c, d, e, f)
527 #define ir_TAILCALL_N(type, func, count, args)        _ir_TAILCALL_N(_ir_CTX, type, func, count, args)
528 
529 #define ir_ALLOCA(_size)                  _ir_ALLOCA(_ir_CTX, (_size))
530 #define ir_AFREE(_size)                   _ir_AFREE(_ir_CTX, (_size))
531 #define ir_VADDR(_var)                    ir_emit1(_ir_CTX, IR_OPT(IR_VADDR, IR_ADDR), (_var))
532 #define ir_VLOAD(_type, _var)             _ir_VLOAD(_ir_CTX, (_type), (_var))
533 #define ir_VLOAD_B(_var)                  _ir_VLOAD(_ir_CTX, IR_BOOL, (_var))
534 #define ir_VLOAD_U8(_var)                 _ir_VLOAD(_ir_CTX, IR_U8, (_var))
535 #define ir_VLOAD_U16(_var)                _ir_VLOAD(_ir_CTX, IR_U16, (_var))
536 #define ir_VLOAD_U32(_var)                _ir_VLOAD(_ir_CTX, IR_U32, (_var))
537 #define ir_VLOAD_U64(_var)                _ir_VLOAD(_ir_CTX, IR_U64, (_var))
538 #define ir_VLOAD_A(_var)                  _ir_VLOAD(_ir_CTX, IR_ADDR, (_var))
539 #define ir_VLOAD_C(_var)                  _ir_VLOAD(_ir_CTX, IR_CHAR, (_var))
540 #define ir_VLOAD_I8(_var)                 _ir_VLOAD(_ir_CTX, IR_I8, (_var))
541 #define ir_VLOAD_I16(_var)                _ir_VLOAD(_ir_CTX, IR_I16, (_var))
542 #define ir_VLOAD_I32(_var)                _ir_VLOAD(_ir_CTX, IR_I32, (_var))
543 #define ir_VLOAD_I64(_var)                _ir_VLOAD(_ir_CTX, IR_I64, (_var))
544 #define ir_VLOAD_D(_var)                  _ir_VLOAD(_ir_CTX, IR_DOUBLE, (_var))
545 #define ir_VLOAD_F(_var)                  _ir_VLOAD(_ir_CTX, IR_FLOAT, (_var))
546 #define ir_VSTORE(_var, _val)             _ir_VSTORE(_ir_CTX, (_var), (_val))
547 #define ir_RLOAD(_type, _reg)             _ir_RLOAD(_ir_CTX, (_type), (_reg))
548 #define ir_RLOAD_B(_reg)                  _ir_RLOAD(_ir_CTX, IR_BOOL, (_reg))
549 #define ir_RLOAD_U8(_reg)                 _ir_RLOAD(_ir_CTX, IR_U8, (_reg))
550 #define ir_RLOAD_U16(_reg)                _ir_RLOAD(_ir_CTX, IR_U16, (_reg))
551 #define ir_RLOAD_U32(_reg)                _ir_RLOAD(_ir_CTX, IR_U32, (_reg))
552 #define ir_RLOAD_U64(_reg)                _ir_RLOAD(_ir_CTX, IR_U64, (_reg))
553 #define ir_RLOAD_A(_reg)                  _ir_RLOAD(_ir_CTX, IR_ADDR, (_reg))
554 #define ir_RLOAD_C(_reg)                  _ir_RLOAD(_ir_CTX, IR_CHAR, (_reg))
555 #define ir_RLOAD_I8(_reg)                 _ir_RLOAD(_ir_CTX, IR_I8, (_reg))
556 #define ir_RLOAD_I16(_reg)                _ir_RLOAD(_ir_CTX, IR_I16, (_reg))
557 #define ir_RLOAD_I32(_reg)                _ir_RLOAD(_ir_CTX, IR_I32, (_reg))
558 #define ir_RLOAD_I64(_reg)                _ir_RLOAD(_ir_CTX, IR_I64, (_reg))
559 #define ir_RLOAD_D(_reg)                  _ir_RLOAD(_ir_CTX, IR_DOUBLE, (_reg))
560 #define ir_RLOAD_F(_reg)                  _ir_RLOAD(_ir_CTX, IR_FLOAT, (_reg))
561 #define ir_RSTORE(_reg, _val)             _ir_RSTORE(_ir_CTX, (_reg), (_val))
562 #define ir_LOAD(_type, _addr)             _ir_LOAD(_ir_CTX, (_type), (_addr))
563 #define ir_LOAD_B(_addr)                  _ir_LOAD(_ir_CTX, IR_BOOL, (_addr))
564 #define ir_LOAD_U8(_addr)                 _ir_LOAD(_ir_CTX, IR_U8, (_addr))
565 #define ir_LOAD_U16(_addr)                _ir_LOAD(_ir_CTX, IR_U16, (_addr))
566 #define ir_LOAD_U32(_addr)                _ir_LOAD(_ir_CTX, IR_U32, (_addr))
567 #define ir_LOAD_U64(_addr)                _ir_LOAD(_ir_CTX, IR_U64, (_addr))
568 #define ir_LOAD_A(_addr)                  _ir_LOAD(_ir_CTX, IR_ADDR, (_addr))
569 #define ir_LOAD_C(_addr)                  _ir_LOAD(_ir_CTX, IR_CHAR, (_addr))
570 #define ir_LOAD_I8(_addr)                 _ir_LOAD(_ir_CTX, IR_I8, (_addr))
571 #define ir_LOAD_I16(_addr)                _ir_LOAD(_ir_CTX, IR_I16, (_addr))
572 #define ir_LOAD_I32(_addr)                _ir_LOAD(_ir_CTX, IR_I32, (_addr))
573 #define ir_LOAD_I64(_addr)                _ir_LOAD(_ir_CTX, IR_I64, (_addr))
574 #define ir_LOAD_D(_addr)                  _ir_LOAD(_ir_CTX, IR_DOUBLE, (_addr))
575 #define ir_LOAD_F(_addr)                  _ir_LOAD(_ir_CTX, IR_FLOAT, (_addr))
576 #define ir_STORE(_addr, _val)             _ir_STORE(_ir_CTX, (_addr), (_val))
577 #define ir_TLS(_index, _offset)           _ir_TLS(_ir_CTX, (_index), (_offset))
578 #define ir_TRAP()                         do {_ir_CTX->control = ir_emit1(_ir_CTX, IR_TRAP, _ir_CTX->control);} while (0)
579 
580 #define ir_FRAME_ADDR()                   ir_fold0(_ir_CTX, IR_OPT(IR_FRAME_ADDR, IR_ADDR))
581 
582 #define ir_BLOCK_BEGIN()                  _ir_BLOCK_BEGIN(_ir_CTX)
583 #define ir_BLOCK_END(_val)                do {_ir_CTX->control = ir_emit2(_ir_CTX, IR_BLOCK_END, _ir_CTX->control, (_val));} while (0)
584 
585 #define ir_VA_START(_list)                _ir_VA_START(_ir_CTX, _list)
586 #define ir_VA_END(_list)                  _ir_VA_END(_ir_CTX, _list)
587 #define ir_VA_COPY(_dst, _src)            _ir_VA_COPY(_ir_CTX, _dst, _src)
588 #define ir_VA_ARG(_list, _type)           _ir_VA_ARG(_ir_CTX, _type, _list)
589 
590 #define ir_START()                        _ir_START(_ir_CTX)
591 #define ir_ENTRY(_src, _num)              _ir_ENTRY(_ir_CTX, (_src), (_num))
592 #define ir_BEGIN(_src)                    _ir_BEGIN(_ir_CTX, (_src))
593 #define ir_IF(_condition)                 _ir_IF(_ir_CTX, (_condition))
594 #define ir_IF_TRUE(_if)                   _ir_IF_TRUE(_ir_CTX, (_if))
595 #define ir_IF_TRUE_cold(_if)              _ir_IF_TRUE_cold(_ir_CTX, (_if))
596 #define ir_IF_FALSE(_if)                  _ir_IF_FALSE(_ir_CTX, (_if))
597 #define ir_IF_FALSE_cold(_if)             _ir_IF_FALSE_cold(_ir_CTX, (_if))
598 #define ir_END()                          _ir_END(_ir_CTX)
599 #define ir_MERGE_2(_src1, _src2)          _ir_MERGE_2(_ir_CTX, (_src1), (_src2))
600 #define ir_MERGE_N(_n, _inputs)           _ir_MERGE_N(_ir_CTX, (_n), (_inputs))
601 #define ir_MERGE_SET_OP(_ref, _pos, _src) _ir_MERGE_SET_OP(_ir_CTX, (_ref), (_pos), (_src))
602 #define ir_LOOP_BEGIN(_src1)              _ir_LOOP_BEGIN(_ir_CTX, (_src1))
603 #define ir_LOOP_END()                     _ir_LOOP_END(_ir_CTX)
604 #define ir_SWITCH(_val)                   _ir_SWITCH(_ir_CTX, (_val))
605 #define ir_CASE_VAL(_switch, _val)        _ir_CASE_VAL(_ir_CTX, (_switch), (_val))
606 #define ir_CASE_DEFAULT(_switch)          _ir_CASE_DEFAULT(_ir_CTX, (_switch))
607 #define ir_RETURN(_val)                   _ir_RETURN(_ir_CTX, (_val))
608 #define ir_IJMP(_addr)                    _ir_IJMP(_ir_CTX, (_addr))
609 #define ir_UNREACHABLE()                  _ir_UNREACHABLE(_ir_CTX)
610 
611 #define ir_GUARD(_condition, _addr)       _ir_GUARD(_ir_CTX, (_condition), (_addr))
612 #define ir_GUARD_NOT(_condition, _addr)   _ir_GUARD_NOT(_ir_CTX, (_condition), (_addr))
613 
614 #define ir_SNAPSHOT(_n)                   _ir_SNAPSHOT(_ir_CTX, (_n))
615 #define ir_SNAPSHOT_SET_OP(_s, _pos, _v)  _ir_SNAPSHOT_SET_OP(_ir_CTX, (_s), (_pos), (_v))
616 
617 #define ir_EXITCALL(_func)                _ir_EXITCALL(_ir_CTX,(_func))
618 
619 #define ir_END_list(_list)                do { _list = _ir_END_LIST(_ir_CTX, _list); } while (0)
620 #define ir_MERGE_list(_list)              _ir_MERGE_LIST(_ir_CTX, (_list))
621 
622 #define ir_END_PHI_list(_list, _val)      do { _list = _ir_END_PHI_LIST(_ir_CTX, _list, _val); } while (0)
623 #define ir_PHI_list(_list)                _ir_PHI_LIST(_ir_CTX, (_list))
624 
625 #define ir_MERGE_WITH(_src2)              do {ir_ref end = ir_END(); ir_MERGE_2(end, _src2);} while (0)
626 #define ir_MERGE_WITH_EMPTY_TRUE(_if)     do {ir_ref end = ir_END(); ir_IF_TRUE(_if); ir_MERGE_2(end, ir_END());} while (0)
627 #define ir_MERGE_WITH_EMPTY_FALSE(_if)    do {ir_ref end = ir_END(); ir_IF_FALSE(_if); ir_MERGE_2(end, ir_END());} while (0)
628 
629 ir_ref _ir_ADD_OFFSET(ir_ctx *ctx, ir_ref addr, uintptr_t offset);
630 ir_ref _ir_PHI_2(ir_ctx *ctx, ir_type type, ir_ref src1, ir_ref src2);
631 ir_ref _ir_PHI_N(ir_ctx *ctx, ir_type type, ir_ref n, ir_ref *inputs);
632 void   _ir_PHI_SET_OP(ir_ctx *ctx, ir_ref phi, ir_ref pos, ir_ref src);
633 ir_ref _ir_PARAM(ir_ctx *ctx, ir_type type, const char* name, ir_ref num);
634 ir_ref _ir_VAR(ir_ctx *ctx, ir_type type, const char* name);
635 ir_ref _ir_CALL(ir_ctx *ctx, ir_type type, ir_ref func);
636 ir_ref _ir_CALL_1(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1);
637 ir_ref _ir_CALL_2(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2);
638 ir_ref _ir_CALL_3(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2, ir_ref arg3);
639 ir_ref _ir_CALL_4(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2, ir_ref arg3, ir_ref arg4);
640 ir_ref _ir_CALL_5(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2, ir_ref arg3, ir_ref arg4, ir_ref arg5);
641 ir_ref _ir_CALL_6(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2, ir_ref arg3, ir_ref arg4, ir_ref arg5, ir_ref atg6);
642 ir_ref _ir_CALL_N(ir_ctx *ctx, ir_type type, ir_ref func, uint32_t count, ir_ref *args);
643 void   _ir_TAILCALL(ir_ctx *ctx, ir_type type, ir_ref func);
644 void   _ir_TAILCALL_1(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1);
645 void   _ir_TAILCALL_2(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2);
646 void   _ir_TAILCALL_3(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2, ir_ref arg3);
647 void   _ir_TAILCALL_4(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2, ir_ref arg3, ir_ref arg4);
648 void   _ir_TAILCALL_5(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2, ir_ref arg3, ir_ref arg4, ir_ref arg5);
649 void   _ir_TAILCALL_6(ir_ctx *ctx, ir_type type, ir_ref func, ir_ref arg1, ir_ref arg2, ir_ref arg3, ir_ref arg4, ir_ref arg5, ir_ref arg6);
650 ir_ref _ir_TAILCALL_N(ir_ctx *ctx, ir_type type, ir_ref func, uint32_t count, ir_ref *args);
651 ir_ref _ir_ALLOCA(ir_ctx *ctx, ir_ref size);
652 void   _ir_AFREE(ir_ctx *ctx, ir_ref size);
653 ir_ref _ir_VLOAD(ir_ctx *ctx, ir_type type, ir_ref var);
654 void   _ir_VSTORE(ir_ctx *ctx, ir_ref var, ir_ref val);
655 ir_ref _ir_RLOAD(ir_ctx *ctx, ir_type type, ir_ref reg);
656 void   _ir_RSTORE(ir_ctx *ctx, ir_ref reg, ir_ref val);
657 ir_ref _ir_LOAD(ir_ctx *ctx, ir_type type, ir_ref addr);
658 void   _ir_STORE(ir_ctx *ctx, ir_ref addr, ir_ref val);
659 void   _ir_VA_START(ir_ctx *ctx, ir_ref list);
660 void   _ir_VA_END(ir_ctx *ctx, ir_ref list);
661 void   _ir_VA_COPY(ir_ctx *ctx, ir_ref dst, ir_ref src);
662 ir_ref _ir_VA_ARG(ir_ctx *ctx, ir_type type, ir_ref list);
663 void   _ir_START(ir_ctx *ctx);
664 void   _ir_ENTRY(ir_ctx *ctx, ir_ref src, ir_ref num);
665 void   _ir_BEGIN(ir_ctx *ctx, ir_ref src);
666 ir_ref _ir_END(ir_ctx *ctx);
667 ir_ref _ir_END_LIST(ir_ctx *ctx, ir_ref list);
668 ir_ref _ir_END_PHI_LIST(ir_ctx *ctx, ir_ref list, ir_ref val);
669 ir_ref _ir_IF(ir_ctx *ctx, ir_ref condition);
670 void   _ir_IF_TRUE(ir_ctx *ctx, ir_ref if_ref);
671 void   _ir_IF_TRUE_cold(ir_ctx *ctx, ir_ref if_ref);
672 void   _ir_IF_FALSE(ir_ctx *ctx, ir_ref if_ref);
673 void   _ir_IF_FALSE_cold(ir_ctx *ctx, ir_ref if_ref);
674 void   _ir_MERGE_2(ir_ctx *ctx, ir_ref src1, ir_ref src2);
675 void   _ir_MERGE_N(ir_ctx *ctx, ir_ref n, ir_ref *inputs);
676 void   _ir_MERGE_SET_OP(ir_ctx *ctx, ir_ref merge, ir_ref pos, ir_ref src);
677 void   _ir_MERGE_LIST(ir_ctx *ctx, ir_ref list);
678 ir_ref _ir_PHI_LIST(ir_ctx *ctx, ir_ref list);
679 ir_ref _ir_LOOP_BEGIN(ir_ctx *ctx, ir_ref src1);
680 ir_ref _ir_LOOP_END(ir_ctx *ctx);
681 ir_ref _ir_TLS(ir_ctx *ctx, ir_ref index, ir_ref offset);
682 void   _ir_UNREACHABLE(ir_ctx *ctx);
683 ir_ref _ir_SWITCH(ir_ctx *ctx, ir_ref val);
684 void   _ir_CASE_VAL(ir_ctx *ctx, ir_ref switch_ref, ir_ref val);
685 void   _ir_CASE_DEFAULT(ir_ctx *ctx, ir_ref switch_ref);
686 void   _ir_RETURN(ir_ctx *ctx, ir_ref val);
687 void   _ir_IJMP(ir_ctx *ctx, ir_ref addr);
688 void   _ir_GUARD(ir_ctx *ctx, ir_ref condition, ir_ref addr);
689 void   _ir_GUARD_NOT(ir_ctx *ctx, ir_ref condition, ir_ref addr);
690 ir_ref _ir_BLOCK_BEGIN(ir_ctx *ctx);
691 ir_ref _ir_SNAPSHOT(ir_ctx *ctx, ir_ref n);
692 void   _ir_SNAPSHOT_SET_OP(ir_ctx *ctx, ir_ref snapshot, ir_ref pos, ir_ref val);
693 ir_ref _ir_EXITCALL(ir_ctx *ctx, ir_ref func);
694 
695 #ifdef __cplusplus
696 } /* extern "C" */
697 #endif
698 
699 #endif /* IR_BUILDER_H */
700