sljitLir.c revision 1.1.1.3.2.3 1 1.1.1.3.2.2 yamt /*
2 1.1.1.3.2.2 yamt * Stack-less Just-In-Time compiler
3 1.1.1.3.2.2 yamt *
4 1.1.1.3.2.2 yamt * Copyright 2009-2012 Zoltan Herczeg (hzmester (at) freemail.hu). All rights reserved.
5 1.1.1.3.2.2 yamt *
6 1.1.1.3.2.2 yamt * Redistribution and use in source and binary forms, with or without modification, are
7 1.1.1.3.2.2 yamt * permitted provided that the following conditions are met:
8 1.1.1.3.2.2 yamt *
9 1.1.1.3.2.2 yamt * 1. Redistributions of source code must retain the above copyright notice, this list of
10 1.1.1.3.2.2 yamt * conditions and the following disclaimer.
11 1.1.1.3.2.2 yamt *
12 1.1.1.3.2.2 yamt * 2. Redistributions in binary form must reproduce the above copyright notice, this list
13 1.1.1.3.2.2 yamt * of conditions and the following disclaimer in the documentation and/or other materials
14 1.1.1.3.2.2 yamt * provided with the distribution.
15 1.1.1.3.2.2 yamt *
16 1.1.1.3.2.2 yamt * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY
17 1.1.1.3.2.2 yamt * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1.1.3.2.2 yamt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19 1.1.1.3.2.2 yamt * SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1.1.3.2.2 yamt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 1.1.1.3.2.2 yamt * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
22 1.1.1.3.2.2 yamt * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.1.1.3.2.2 yamt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24 1.1.1.3.2.2 yamt * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 1.1.1.3.2.2 yamt */
26 1.1.1.3.2.2 yamt
27 1.1.1.3.2.2 yamt #include "sljitLir.h"
28 1.1.1.3.2.2 yamt
29 1.1.1.3.2.2 yamt #define CHECK_ERROR() \
30 1.1.1.3.2.2 yamt do { \
31 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(compiler->error)) \
32 1.1.1.3.2.2 yamt return compiler->error; \
33 1.1.1.3.2.2 yamt } while (0)
34 1.1.1.3.2.2 yamt
35 1.1.1.3.2.2 yamt #define CHECK_ERROR_PTR() \
36 1.1.1.3.2.2 yamt do { \
37 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(compiler->error)) \
38 1.1.1.3.2.2 yamt return NULL; \
39 1.1.1.3.2.2 yamt } while (0)
40 1.1.1.3.2.2 yamt
41 1.1.1.3.2.2 yamt #define CHECK_ERROR_VOID() \
42 1.1.1.3.2.2 yamt do { \
43 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(compiler->error)) \
44 1.1.1.3.2.2 yamt return; \
45 1.1.1.3.2.2 yamt } while (0)
46 1.1.1.3.2.2 yamt
47 1.1.1.3.2.2 yamt #define FAIL_IF(expr) \
48 1.1.1.3.2.2 yamt do { \
49 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(expr)) \
50 1.1.1.3.2.2 yamt return compiler->error; \
51 1.1.1.3.2.2 yamt } while (0)
52 1.1.1.3.2.2 yamt
53 1.1.1.3.2.2 yamt #define PTR_FAIL_IF(expr) \
54 1.1.1.3.2.2 yamt do { \
55 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(expr)) \
56 1.1.1.3.2.2 yamt return NULL; \
57 1.1.1.3.2.2 yamt } while (0)
58 1.1.1.3.2.2 yamt
59 1.1.1.3.2.2 yamt #define FAIL_IF_NULL(ptr) \
60 1.1.1.3.2.2 yamt do { \
61 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!(ptr))) { \
62 1.1.1.3.2.2 yamt compiler->error = SLJIT_ERR_ALLOC_FAILED; \
63 1.1.1.3.2.2 yamt return SLJIT_ERR_ALLOC_FAILED; \
64 1.1.1.3.2.2 yamt } \
65 1.1.1.3.2.2 yamt } while (0)
66 1.1.1.3.2.2 yamt
67 1.1.1.3.2.2 yamt #define PTR_FAIL_IF_NULL(ptr) \
68 1.1.1.3.2.2 yamt do { \
69 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!(ptr))) { \
70 1.1.1.3.2.2 yamt compiler->error = SLJIT_ERR_ALLOC_FAILED; \
71 1.1.1.3.2.2 yamt return NULL; \
72 1.1.1.3.2.2 yamt } \
73 1.1.1.3.2.2 yamt } while (0)
74 1.1.1.3.2.2 yamt
75 1.1.1.3.2.2 yamt #define PTR_FAIL_WITH_EXEC_IF(ptr) \
76 1.1.1.3.2.2 yamt do { \
77 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!(ptr))) { \
78 1.1.1.3.2.2 yamt compiler->error = SLJIT_ERR_EX_ALLOC_FAILED; \
79 1.1.1.3.2.2 yamt return NULL; \
80 1.1.1.3.2.2 yamt } \
81 1.1.1.3.2.2 yamt } while (0)
82 1.1.1.3.2.2 yamt
83 1.1.1.3.2.2 yamt #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
84 1.1.1.3.2.2 yamt
85 1.1.1.3.2.2 yamt #define GET_OPCODE(op) \
86 1.1.1.3.2.2 yamt ((op) & ~(SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
87 1.1.1.3.2.2 yamt
88 1.1.1.3.2.2 yamt #define GET_FLAGS(op) \
89 1.1.1.3.2.2 yamt ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))
90 1.1.1.3.2.2 yamt
91 1.1.1.3.2.2 yamt #define GET_ALL_FLAGS(op) \
92 1.1.1.3.2.2 yamt ((op) & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))
93 1.1.1.3.2.2 yamt
94 1.1.1.3.2.2 yamt #define BUF_SIZE 4096
95 1.1.1.3.2.2 yamt
96 1.1.1.3.2.2 yamt #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
97 1.1.1.3.2.2 yamt #define ABUF_SIZE 2048
98 1.1.1.3.2.2 yamt #else
99 1.1.1.3.2.2 yamt #define ABUF_SIZE 4096
100 1.1.1.3.2.2 yamt #endif
101 1.1.1.3.2.2 yamt
102 1.1.1.3.2.2 yamt /* Jump flags. */
103 1.1.1.3.2.2 yamt #define JUMP_LABEL 0x1
104 1.1.1.3.2.2 yamt #define JUMP_ADDR 0x2
105 1.1.1.3.2.2 yamt /* SLJIT_REWRITABLE_JUMP is 0x1000. */
106 1.1.1.3.2.2 yamt
107 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
108 1.1.1.3.2.2 yamt #define PATCH_MB 0x4
109 1.1.1.3.2.2 yamt #define PATCH_MW 0x8
110 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
111 1.1.1.3.2.2 yamt #define PATCH_MD 0x10
112 1.1.1.3.2.2 yamt #endif
113 1.1.1.3.2.2 yamt #endif
114 1.1.1.3.2.2 yamt
115 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
116 1.1.1.3.2.2 yamt #define IS_BL 0x4
117 1.1.1.3.2.2 yamt #define PATCH_B 0x8
118 1.1.1.3.2.2 yamt #endif
119 1.1.1.3.2.2 yamt
120 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
121 1.1.1.3.2.2 yamt #define CPOOL_SIZE 512
122 1.1.1.3.2.2 yamt #endif
123 1.1.1.3.2.2 yamt
124 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
125 1.1.1.3.2.2 yamt #define IS_COND 0x04
126 1.1.1.3.2.2 yamt #define IS_BL 0x08
127 1.1.1.3.2.2 yamt /* cannot be encoded as branch */
128 1.1.1.3.2.2 yamt #define B_TYPE0 0x00
129 1.1.1.3.2.2 yamt /* conditional + imm8 */
130 1.1.1.3.2.2 yamt #define B_TYPE1 0x10
131 1.1.1.3.2.2 yamt /* conditional + imm20 */
132 1.1.1.3.2.2 yamt #define B_TYPE2 0x20
133 1.1.1.3.2.2 yamt /* IT + imm24 */
134 1.1.1.3.2.2 yamt #define B_TYPE3 0x30
135 1.1.1.3.2.2 yamt /* imm11 */
136 1.1.1.3.2.2 yamt #define B_TYPE4 0x40
137 1.1.1.3.2.2 yamt /* imm24 */
138 1.1.1.3.2.2 yamt #define B_TYPE5 0x50
139 1.1.1.3.2.2 yamt /* BL + imm24 */
140 1.1.1.3.2.2 yamt #define BL_TYPE6 0x60
141 1.1.1.3.2.2 yamt /* 0xf00 cc code for branches */
142 1.1.1.3.2.2 yamt #endif
143 1.1.1.3.2.2 yamt
144 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
145 1.1.1.3.2.2 yamt #define UNCOND_B 0x04
146 1.1.1.3.2.2 yamt #define PATCH_B 0x08
147 1.1.1.3.2.2 yamt #define ABSOLUTE_B 0x10
148 1.1.1.3.2.2 yamt #endif
149 1.1.1.3.2.2 yamt
150 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
151 1.1.1.3.2.2 yamt #define IS_MOVABLE 0x04
152 1.1.1.3.2.2 yamt #define IS_JAL 0x08
153 1.1.1.3.2.2 yamt #define IS_BIT26_COND 0x10
154 1.1.1.3.2.2 yamt #define IS_BIT16_COND 0x20
155 1.1.1.3.2.2 yamt
156 1.1.1.3.2.2 yamt #define IS_COND (IS_BIT26_COND | IS_BIT16_COND)
157 1.1.1.3.2.2 yamt
158 1.1.1.3.2.2 yamt #define PATCH_B 0x40
159 1.1.1.3.2.2 yamt #define PATCH_J 0x80
160 1.1.1.3.2.2 yamt
161 1.1.1.3.2.2 yamt /* instruction types */
162 1.1.1.3.2.2 yamt #define MOVABLE_INS 0
163 1.1.1.3.2.2 yamt /* 1 - 31 last destination register */
164 1.1.1.3.2.2 yamt /* no destination (i.e: store) */
165 1.1.1.3.2.2 yamt #define UNMOVABLE_INS 32
166 1.1.1.3.2.2 yamt /* FPU status register */
167 1.1.1.3.2.2 yamt #define FCSR_FCC 33
168 1.1.1.3.2.2 yamt #endif
169 1.1.1.3.2.2 yamt
170 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
171 1.1.1.3.2.2 yamt #define IS_MOVABLE 0x04
172 1.1.1.3.2.2 yamt #define IS_COND 0x08
173 1.1.1.3.2.2 yamt #define IS_CALL 0x10
174 1.1.1.3.2.2 yamt
175 1.1.1.3.2.2 yamt #define PATCH_B 0x20
176 1.1.1.3.2.2 yamt #define PATCH_CALL 0x40
177 1.1.1.3.2.2 yamt
178 1.1.1.3.2.2 yamt /* instruction types */
179 1.1.1.3.2.2 yamt #define MOVABLE_INS 0
180 1.1.1.3.2.2 yamt /* 1 - 31 last destination register */
181 1.1.1.3.2.2 yamt /* no destination (i.e: store) */
182 1.1.1.3.2.2 yamt #define UNMOVABLE_INS 32
183 1.1.1.3.2.2 yamt
184 1.1.1.3.2.2 yamt #define DST_INS_MASK 0xff
185 1.1.1.3.2.2 yamt
186 1.1.1.3.2.2 yamt /* ICC_SET is the same as SET_FLAGS. */
187 1.1.1.3.2.2 yamt #define ICC_IS_SET (1 << 23)
188 1.1.1.3.2.2 yamt #define FCC_IS_SET (1 << 24)
189 1.1.1.3.2.2 yamt #endif
190 1.1.1.3.2.2 yamt
191 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
192 1.1.1.3.2.2 yamt #define SLJIT_HAS_VARIABLE_LOCALS_OFFSET 1
193 1.1.1.3.2.3 yamt #if !(defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
194 1.1.1.3.2.3 yamt #define FIXED_LOCALS_OFFSET (3 * sizeof(sljit_w))
195 1.1.1.3.2.3 yamt #endif
196 1.1.1.3.2.2 yamt #endif
197 1.1.1.3.2.2 yamt
198 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
199 1.1.1.3.2.2 yamt #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
200 1.1.1.3.2.2 yamt #ifdef _WIN64
201 1.1.1.3.2.2 yamt #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))
202 1.1.1.3.2.2 yamt #else
203 1.1.1.3.2.2 yamt #define FIXED_LOCALS_OFFSET (sizeof(sljit_w))
204 1.1.1.3.2.2 yamt #endif
205 1.1.1.3.2.2 yamt #endif
206 1.1.1.3.2.2 yamt
207 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
208 1.1.1.3.2.2 yamt #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
209 1.1.1.3.2.2 yamt #if (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
210 1.1.1.3.2.2 yamt #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))
211 1.1.1.3.2.2 yamt #else
212 1.1.1.3.2.2 yamt #define FIXED_LOCALS_OFFSET (2 * sizeof(sljit_w))
213 1.1.1.3.2.2 yamt #endif
214 1.1.1.3.2.2 yamt #endif
215 1.1.1.3.2.2 yamt
216 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
217 1.1.1.3.2.2 yamt #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
218 1.1.1.3.2.2 yamt #define FIXED_LOCALS_OFFSET ((6 + 8) * sizeof(sljit_w))
219 1.1.1.3.2.2 yamt #endif
220 1.1.1.3.2.2 yamt
221 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
222 1.1.1.3.2.2 yamt #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
223 1.1.1.3.2.2 yamt #define FIXED_LOCALS_OFFSET (4 * sizeof(sljit_w))
224 1.1.1.3.2.2 yamt #endif
225 1.1.1.3.2.2 yamt
226 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
227 1.1.1.3.2.2 yamt #define SLJIT_HAS_FIXED_LOCALS_OFFSET 1
228 1.1.1.3.2.2 yamt #define FIXED_LOCALS_OFFSET (23 * sizeof(sljit_w))
229 1.1.1.3.2.2 yamt #endif
230 1.1.1.3.2.2 yamt
231 1.1.1.3.2.2 yamt #if (defined SLJIT_HAS_VARIABLE_LOCALS_OFFSET && SLJIT_HAS_VARIABLE_LOCALS_OFFSET)
232 1.1.1.3.2.2 yamt
233 1.1.1.3.2.2 yamt #define ADJUST_LOCAL_OFFSET(p, i) \
234 1.1.1.3.2.2 yamt if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \
235 1.1.1.3.2.2 yamt (i) += compiler->locals_offset;
236 1.1.1.3.2.2 yamt
237 1.1.1.3.2.2 yamt #elif (defined SLJIT_HAS_FIXED_LOCALS_OFFSET && SLJIT_HAS_FIXED_LOCALS_OFFSET)
238 1.1.1.3.2.2 yamt
239 1.1.1.3.2.2 yamt #define ADJUST_LOCAL_OFFSET(p, i) \
240 1.1.1.3.2.2 yamt if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \
241 1.1.1.3.2.2 yamt (i) += FIXED_LOCALS_OFFSET;
242 1.1.1.3.2.2 yamt
243 1.1.1.3.2.2 yamt #else
244 1.1.1.3.2.2 yamt
245 1.1.1.3.2.2 yamt #define ADJUST_LOCAL_OFFSET(p, i)
246 1.1.1.3.2.2 yamt
247 1.1.1.3.2.2 yamt #endif
248 1.1.1.3.2.2 yamt
249 1.1.1.3.2.2 yamt #endif /* !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED) */
250 1.1.1.3.2.2 yamt
251 1.1.1.3.2.2 yamt /* Utils can still be used even if SLJIT_CONFIG_UNSUPPORTED is set. */
252 1.1.1.3.2.2 yamt #include "sljitUtils.c"
253 1.1.1.3.2.2 yamt
254 1.1.1.3.2.2 yamt #if !(defined SLJIT_CONFIG_UNSUPPORTED && SLJIT_CONFIG_UNSUPPORTED)
255 1.1.1.3.2.2 yamt
256 1.1.1.3.2.2 yamt #if (defined SLJIT_EXECUTABLE_ALLOCATOR && SLJIT_EXECUTABLE_ALLOCATOR)
257 1.1.1.3.2.2 yamt #include "sljitExecAllocator.c"
258 1.1.1.3.2.2 yamt #endif
259 1.1.1.3.2.2 yamt
260 1.1.1.3.2.2 yamt #if (defined SLJIT_SSE2_AUTO && SLJIT_SSE2_AUTO) && !(defined SLJIT_SSE2 && SLJIT_SSE2)
261 1.1.1.3.2.2 yamt #error SLJIT_SSE2_AUTO cannot be enabled without SLJIT_SSE2
262 1.1.1.3.2.2 yamt #endif
263 1.1.1.3.2.2 yamt
264 1.1.1.3.2.2 yamt /* --------------------------------------------------------------------- */
265 1.1.1.3.2.2 yamt /* Public functions */
266 1.1.1.3.2.2 yamt /* --------------------------------------------------------------------- */
267 1.1.1.3.2.2 yamt
268 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || ((defined SLJIT_SSE2 && SLJIT_SSE2) && ((defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)))
269 1.1.1.3.2.2 yamt #define SLJIT_NEEDS_COMPILER_INIT 1
270 1.1.1.3.2.2 yamt static int compiler_initialized = 0;
271 1.1.1.3.2.2 yamt /* A thread safe initialization. */
272 1.1.1.3.2.2 yamt static void init_compiler(void);
273 1.1.1.3.2.2 yamt #endif
274 1.1.1.3.2.2 yamt
275 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void)
276 1.1.1.3.2.2 yamt {
277 1.1.1.3.2.2 yamt struct sljit_compiler *compiler = (struct sljit_compiler*)SLJIT_MALLOC(sizeof(struct sljit_compiler));
278 1.1.1.3.2.2 yamt if (!compiler)
279 1.1.1.3.2.2 yamt return NULL;
280 1.1.1.3.2.2 yamt SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));
281 1.1.1.3.2.2 yamt
282 1.1.1.3.2.2 yamt SLJIT_COMPILE_ASSERT(
283 1.1.1.3.2.2 yamt sizeof(sljit_b) == 1 && sizeof(sljit_ub) == 1
284 1.1.1.3.2.2 yamt && sizeof(sljit_h) == 2 && sizeof(sljit_uh) == 2
285 1.1.1.3.2.2 yamt && sizeof(sljit_i) == 4 && sizeof(sljit_ui) == 4
286 1.1.1.3.2.2 yamt && ((sizeof(sljit_w) == 4 && sizeof(sljit_uw) == 4) || (sizeof(sljit_w) == 8 && sizeof(sljit_uw) == 8)),
287 1.1.1.3.2.2 yamt invalid_integer_types);
288 1.1.1.3.2.2 yamt
289 1.1.1.3.2.2 yamt /* Only the non-zero members must be set. */
290 1.1.1.3.2.2 yamt compiler->error = SLJIT_SUCCESS;
291 1.1.1.3.2.2 yamt
292 1.1.1.3.2.2 yamt compiler->buf = (struct sljit_memory_fragment*)SLJIT_MALLOC(BUF_SIZE);
293 1.1.1.3.2.2 yamt compiler->abuf = (struct sljit_memory_fragment*)SLJIT_MALLOC(ABUF_SIZE);
294 1.1.1.3.2.2 yamt
295 1.1.1.3.2.2 yamt if (!compiler->buf || !compiler->abuf) {
296 1.1.1.3.2.2 yamt if (compiler->buf)
297 1.1.1.3.2.2 yamt SLJIT_FREE(compiler->buf);
298 1.1.1.3.2.2 yamt if (compiler->abuf)
299 1.1.1.3.2.2 yamt SLJIT_FREE(compiler->abuf);
300 1.1.1.3.2.2 yamt SLJIT_FREE(compiler);
301 1.1.1.3.2.2 yamt return NULL;
302 1.1.1.3.2.2 yamt }
303 1.1.1.3.2.2 yamt
304 1.1.1.3.2.2 yamt compiler->buf->next = NULL;
305 1.1.1.3.2.2 yamt compiler->buf->used_size = 0;
306 1.1.1.3.2.2 yamt compiler->abuf->next = NULL;
307 1.1.1.3.2.2 yamt compiler->abuf->used_size = 0;
308 1.1.1.3.2.2 yamt
309 1.1.1.3.2.2 yamt compiler->temporaries = -1;
310 1.1.1.3.2.2 yamt compiler->saveds = -1;
311 1.1.1.3.2.2 yamt
312 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
313 1.1.1.3.2.2 yamt compiler->args = -1;
314 1.1.1.3.2.2 yamt #endif
315 1.1.1.3.2.2 yamt
316 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
317 1.1.1.3.2.2 yamt compiler->cpool = (sljit_uw*)SLJIT_MALLOC(CPOOL_SIZE * sizeof(sljit_uw) + CPOOL_SIZE * sizeof(sljit_ub));
318 1.1.1.3.2.2 yamt if (!compiler->cpool) {
319 1.1.1.3.2.2 yamt SLJIT_FREE(compiler->buf);
320 1.1.1.3.2.2 yamt SLJIT_FREE(compiler->abuf);
321 1.1.1.3.2.2 yamt SLJIT_FREE(compiler);
322 1.1.1.3.2.2 yamt return NULL;
323 1.1.1.3.2.2 yamt }
324 1.1.1.3.2.2 yamt compiler->cpool_unique = (sljit_ub*)(compiler->cpool + CPOOL_SIZE);
325 1.1.1.3.2.2 yamt compiler->cpool_diff = 0xffffffff;
326 1.1.1.3.2.2 yamt #endif
327 1.1.1.3.2.2 yamt
328 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
329 1.1.1.3.2.2 yamt compiler->delay_slot = UNMOVABLE_INS;
330 1.1.1.3.2.2 yamt #endif
331 1.1.1.3.2.2 yamt
332 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
333 1.1.1.3.2.2 yamt compiler->delay_slot = UNMOVABLE_INS;
334 1.1.1.3.2.2 yamt #endif
335 1.1.1.3.2.2 yamt
336 1.1.1.3.2.2 yamt #if (defined SLJIT_NEEDS_COMPILER_INIT && SLJIT_NEEDS_COMPILER_INIT)
337 1.1.1.3.2.2 yamt if (!compiler_initialized) {
338 1.1.1.3.2.2 yamt init_compiler();
339 1.1.1.3.2.2 yamt compiler_initialized = 1;
340 1.1.1.3.2.2 yamt }
341 1.1.1.3.2.2 yamt #endif
342 1.1.1.3.2.2 yamt
343 1.1.1.3.2.2 yamt return compiler;
344 1.1.1.3.2.2 yamt }
345 1.1.1.3.2.2 yamt
346 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler)
347 1.1.1.3.2.2 yamt {
348 1.1.1.3.2.2 yamt struct sljit_memory_fragment *buf;
349 1.1.1.3.2.2 yamt struct sljit_memory_fragment *curr;
350 1.1.1.3.2.2 yamt
351 1.1.1.3.2.2 yamt buf = compiler->buf;
352 1.1.1.3.2.2 yamt while (buf) {
353 1.1.1.3.2.2 yamt curr = buf;
354 1.1.1.3.2.2 yamt buf = buf->next;
355 1.1.1.3.2.2 yamt SLJIT_FREE(curr);
356 1.1.1.3.2.2 yamt }
357 1.1.1.3.2.2 yamt
358 1.1.1.3.2.2 yamt buf = compiler->abuf;
359 1.1.1.3.2.2 yamt while (buf) {
360 1.1.1.3.2.2 yamt curr = buf;
361 1.1.1.3.2.2 yamt buf = buf->next;
362 1.1.1.3.2.2 yamt SLJIT_FREE(curr);
363 1.1.1.3.2.2 yamt }
364 1.1.1.3.2.2 yamt
365 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
366 1.1.1.3.2.2 yamt SLJIT_FREE(compiler->cpool);
367 1.1.1.3.2.2 yamt #endif
368 1.1.1.3.2.2 yamt SLJIT_FREE(compiler);
369 1.1.1.3.2.2 yamt }
370 1.1.1.3.2.2 yamt
371 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
372 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
373 1.1.1.3.2.2 yamt {
374 1.1.1.3.2.2 yamt /* Remove thumb mode flag. */
375 1.1.1.3.2.2 yamt SLJIT_FREE_EXEC((void*)((sljit_uw)code & ~0x1));
376 1.1.1.3.2.2 yamt }
377 1.1.1.3.2.2 yamt #elif (defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
378 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
379 1.1.1.3.2.2 yamt {
380 1.1.1.3.2.2 yamt /* Resolve indirection. */
381 1.1.1.3.2.2 yamt code = (void*)(*(sljit_uw*)code);
382 1.1.1.3.2.2 yamt SLJIT_FREE_EXEC(code);
383 1.1.1.3.2.2 yamt }
384 1.1.1.3.2.2 yamt #else
385 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
386 1.1.1.3.2.2 yamt {
387 1.1.1.3.2.2 yamt SLJIT_FREE_EXEC(code);
388 1.1.1.3.2.2 yamt }
389 1.1.1.3.2.2 yamt #endif
390 1.1.1.3.2.2 yamt
391 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sljit_label* label)
392 1.1.1.3.2.2 yamt {
393 1.1.1.3.2.2 yamt if (SLJIT_LIKELY(!!jump) && SLJIT_LIKELY(!!label)) {
394 1.1.1.3.2.2 yamt jump->flags &= ~JUMP_ADDR;
395 1.1.1.3.2.2 yamt jump->flags |= JUMP_LABEL;
396 1.1.1.3.2.2 yamt jump->u.label = label;
397 1.1.1.3.2.2 yamt }
398 1.1.1.3.2.2 yamt }
399 1.1.1.3.2.2 yamt
400 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)
401 1.1.1.3.2.2 yamt {
402 1.1.1.3.2.2 yamt if (SLJIT_LIKELY(!!jump)) {
403 1.1.1.3.2.2 yamt SLJIT_ASSERT(jump->flags & SLJIT_REWRITABLE_JUMP);
404 1.1.1.3.2.2 yamt
405 1.1.1.3.2.2 yamt jump->flags &= ~JUMP_LABEL;
406 1.1.1.3.2.2 yamt jump->flags |= JUMP_ADDR;
407 1.1.1.3.2.2 yamt jump->u.target = target;
408 1.1.1.3.2.2 yamt }
409 1.1.1.3.2.2 yamt }
410 1.1.1.3.2.2 yamt
411 1.1.1.3.2.2 yamt /* --------------------------------------------------------------------- */
412 1.1.1.3.2.2 yamt /* Private functions */
413 1.1.1.3.2.2 yamt /* --------------------------------------------------------------------- */
414 1.1.1.3.2.2 yamt
415 1.1.1.3.2.2 yamt static void* ensure_buf(struct sljit_compiler *compiler, int size)
416 1.1.1.3.2.2 yamt {
417 1.1.1.3.2.2 yamt sljit_ub *ret;
418 1.1.1.3.2.2 yamt struct sljit_memory_fragment *new_frag;
419 1.1.1.3.2.2 yamt
420 1.1.1.3.2.2 yamt if (compiler->buf->used_size + size <= (int)(BUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {
421 1.1.1.3.2.2 yamt ret = compiler->buf->memory + compiler->buf->used_size;
422 1.1.1.3.2.2 yamt compiler->buf->used_size += size;
423 1.1.1.3.2.2 yamt return ret;
424 1.1.1.3.2.2 yamt }
425 1.1.1.3.2.2 yamt new_frag = (struct sljit_memory_fragment*)SLJIT_MALLOC(BUF_SIZE);
426 1.1.1.3.2.2 yamt PTR_FAIL_IF_NULL(new_frag);
427 1.1.1.3.2.2 yamt new_frag->next = compiler->buf;
428 1.1.1.3.2.2 yamt compiler->buf = new_frag;
429 1.1.1.3.2.2 yamt new_frag->used_size = size;
430 1.1.1.3.2.2 yamt return new_frag->memory;
431 1.1.1.3.2.2 yamt }
432 1.1.1.3.2.2 yamt
433 1.1.1.3.2.2 yamt static void* ensure_abuf(struct sljit_compiler *compiler, int size)
434 1.1.1.3.2.2 yamt {
435 1.1.1.3.2.2 yamt sljit_ub *ret;
436 1.1.1.3.2.2 yamt struct sljit_memory_fragment *new_frag;
437 1.1.1.3.2.2 yamt
438 1.1.1.3.2.2 yamt if (compiler->abuf->used_size + size <= (int)(ABUF_SIZE - sizeof(sljit_uw) - sizeof(void*))) {
439 1.1.1.3.2.2 yamt ret = compiler->abuf->memory + compiler->abuf->used_size;
440 1.1.1.3.2.2 yamt compiler->abuf->used_size += size;
441 1.1.1.3.2.2 yamt return ret;
442 1.1.1.3.2.2 yamt }
443 1.1.1.3.2.2 yamt new_frag = (struct sljit_memory_fragment*)SLJIT_MALLOC(ABUF_SIZE);
444 1.1.1.3.2.2 yamt PTR_FAIL_IF_NULL(new_frag);
445 1.1.1.3.2.2 yamt new_frag->next = compiler->abuf;
446 1.1.1.3.2.2 yamt compiler->abuf = new_frag;
447 1.1.1.3.2.2 yamt new_frag->used_size = size;
448 1.1.1.3.2.2 yamt return new_frag->memory;
449 1.1.1.3.2.2 yamt }
450 1.1.1.3.2.2 yamt
451 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, int size)
452 1.1.1.3.2.2 yamt {
453 1.1.1.3.2.2 yamt CHECK_ERROR_PTR();
454 1.1.1.3.2.2 yamt
455 1.1.1.3.2.2 yamt #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
456 1.1.1.3.2.2 yamt if (size <= 0 || size > 128)
457 1.1.1.3.2.2 yamt return NULL;
458 1.1.1.3.2.2 yamt size = (size + 7) & ~7;
459 1.1.1.3.2.2 yamt #else
460 1.1.1.3.2.2 yamt if (size <= 0 || size > 64)
461 1.1.1.3.2.2 yamt return NULL;
462 1.1.1.3.2.2 yamt size = (size + 3) & ~3;
463 1.1.1.3.2.2 yamt #endif
464 1.1.1.3.2.2 yamt return ensure_abuf(compiler, size);
465 1.1.1.3.2.2 yamt }
466 1.1.1.3.2.2 yamt
467 1.1.1.3.2.2 yamt static SLJIT_INLINE void reverse_buf(struct sljit_compiler *compiler)
468 1.1.1.3.2.2 yamt {
469 1.1.1.3.2.2 yamt struct sljit_memory_fragment *buf = compiler->buf;
470 1.1.1.3.2.2 yamt struct sljit_memory_fragment *prev = NULL;
471 1.1.1.3.2.2 yamt struct sljit_memory_fragment *tmp;
472 1.1.1.3.2.2 yamt
473 1.1.1.3.2.2 yamt do {
474 1.1.1.3.2.2 yamt tmp = buf->next;
475 1.1.1.3.2.2 yamt buf->next = prev;
476 1.1.1.3.2.2 yamt prev = buf;
477 1.1.1.3.2.2 yamt buf = tmp;
478 1.1.1.3.2.2 yamt } while (buf != NULL);
479 1.1.1.3.2.2 yamt
480 1.1.1.3.2.2 yamt compiler->buf = prev;
481 1.1.1.3.2.2 yamt }
482 1.1.1.3.2.2 yamt
483 1.1.1.3.2.2 yamt static SLJIT_INLINE void set_label(struct sljit_label *label, struct sljit_compiler *compiler)
484 1.1.1.3.2.2 yamt {
485 1.1.1.3.2.2 yamt label->next = NULL;
486 1.1.1.3.2.2 yamt label->size = compiler->size;
487 1.1.1.3.2.2 yamt if (compiler->last_label)
488 1.1.1.3.2.2 yamt compiler->last_label->next = label;
489 1.1.1.3.2.2 yamt else
490 1.1.1.3.2.2 yamt compiler->labels = label;
491 1.1.1.3.2.2 yamt compiler->last_label = label;
492 1.1.1.3.2.2 yamt }
493 1.1.1.3.2.2 yamt
494 1.1.1.3.2.2 yamt static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, int flags)
495 1.1.1.3.2.2 yamt {
496 1.1.1.3.2.2 yamt jump->next = NULL;
497 1.1.1.3.2.2 yamt jump->flags = flags;
498 1.1.1.3.2.2 yamt if (compiler->last_jump)
499 1.1.1.3.2.2 yamt compiler->last_jump->next = jump;
500 1.1.1.3.2.2 yamt else
501 1.1.1.3.2.2 yamt compiler->jumps = jump;
502 1.1.1.3.2.2 yamt compiler->last_jump = jump;
503 1.1.1.3.2.2 yamt }
504 1.1.1.3.2.2 yamt
505 1.1.1.3.2.2 yamt static SLJIT_INLINE void set_const(struct sljit_const *const_, struct sljit_compiler *compiler)
506 1.1.1.3.2.2 yamt {
507 1.1.1.3.2.2 yamt const_->next = NULL;
508 1.1.1.3.2.2 yamt const_->addr = compiler->size;
509 1.1.1.3.2.2 yamt if (compiler->last_const)
510 1.1.1.3.2.2 yamt compiler->last_const->next = const_;
511 1.1.1.3.2.2 yamt else
512 1.1.1.3.2.2 yamt compiler->consts = const_;
513 1.1.1.3.2.2 yamt compiler->last_const = const_;
514 1.1.1.3.2.2 yamt }
515 1.1.1.3.2.2 yamt
516 1.1.1.3.2.2 yamt #define ADDRESSING_DEPENDS_ON(exp, reg) \
517 1.1.1.3.2.2 yamt (((exp) & SLJIT_MEM) && (((exp) & 0xf) == reg || (((exp) >> 4) & 0xf) == reg))
518 1.1.1.3.2.2 yamt
519 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
520 1.1.1.3.2.2 yamt #define FUNCTION_CHECK_OP() \
521 1.1.1.3.2.2 yamt SLJIT_ASSERT(!GET_FLAGS(op) || !(op & SLJIT_KEEP_FLAGS)); \
522 1.1.1.3.2.2 yamt switch (GET_OPCODE(op)) { \
523 1.1.1.3.2.2 yamt case SLJIT_NOT: \
524 1.1.1.3.2.2 yamt case SLJIT_CLZ: \
525 1.1.1.3.2.2 yamt case SLJIT_AND: \
526 1.1.1.3.2.2 yamt case SLJIT_OR: \
527 1.1.1.3.2.2 yamt case SLJIT_XOR: \
528 1.1.1.3.2.2 yamt case SLJIT_SHL: \
529 1.1.1.3.2.2 yamt case SLJIT_LSHR: \
530 1.1.1.3.2.2 yamt case SLJIT_ASHR: \
531 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C))); \
532 1.1.1.3.2.2 yamt break; \
533 1.1.1.3.2.2 yamt case SLJIT_NEG: \
534 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \
535 1.1.1.3.2.2 yamt break; \
536 1.1.1.3.2.2 yamt case SLJIT_MUL: \
537 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_C))); \
538 1.1.1.3.2.2 yamt break; \
539 1.1.1.3.2.2 yamt case SLJIT_FCMP: \
540 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
541 1.1.1.3.2.2 yamt SLJIT_ASSERT((op & (SLJIT_SET_E | SLJIT_SET_S))); \
542 1.1.1.3.2.2 yamt break; \
543 1.1.1.3.2.2 yamt case SLJIT_ADD: \
544 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(op & (SLJIT_SET_S | SLJIT_SET_U))); \
545 1.1.1.3.2.2 yamt break; \
546 1.1.1.3.2.2 yamt case SLJIT_SUB: \
547 1.1.1.3.2.2 yamt break; \
548 1.1.1.3.2.2 yamt case SLJIT_ADDC: \
549 1.1.1.3.2.2 yamt case SLJIT_SUBC: \
550 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(op & (SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O))); \
551 1.1.1.3.2.2 yamt break; \
552 1.1.1.3.2.2 yamt default: \
553 1.1.1.3.2.2 yamt /* Nothing allowed */ \
554 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(op & (SLJIT_INT_OP | SLJIT_SET_E | SLJIT_SET_S | SLJIT_SET_U | SLJIT_SET_O | SLJIT_SET_C | SLJIT_KEEP_FLAGS))); \
555 1.1.1.3.2.2 yamt break; \
556 1.1.1.3.2.2 yamt }
557 1.1.1.3.2.2 yamt
558 1.1.1.3.2.2 yamt #define FUNCTION_CHECK_IS_REG(r) \
559 1.1.1.3.2.2 yamt ((r) == SLJIT_UNUSED || \
560 1.1.1.3.2.2 yamt ((r) >= SLJIT_TEMPORARY_REG1 && (r) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \
561 1.1.1.3.2.2 yamt ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds))
562 1.1.1.3.2.2 yamt
563 1.1.1.3.2.2 yamt #define FUNCTION_CHECK_SRC(p, i) \
564 1.1.1.3.2.2 yamt SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \
565 1.1.1.3.2.2 yamt if (FUNCTION_CHECK_IS_REG(p)) \
566 1.1.1.3.2.2 yamt SLJIT_ASSERT((i) == 0 && (p) != SLJIT_UNUSED); \
567 1.1.1.3.2.2 yamt else if ((p) == SLJIT_IMM) \
568 1.1.1.3.2.2 yamt ; \
569 1.1.1.3.2.2 yamt else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \
570 1.1.1.3.2.2 yamt SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \
571 1.1.1.3.2.2 yamt else if ((p) & SLJIT_MEM) { \
572 1.1.1.3.2.2 yamt SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \
573 1.1.1.3.2.2 yamt if ((p) & 0xf0) { \
574 1.1.1.3.2.2 yamt SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \
575 1.1.1.3.2.2 yamt SLJIT_ASSERT(!((i) & ~0x3)); \
576 1.1.1.3.2.2 yamt } \
577 1.1.1.3.2.2 yamt SLJIT_ASSERT(((p) >> 9) == 0); \
578 1.1.1.3.2.2 yamt } \
579 1.1.1.3.2.2 yamt else \
580 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
581 1.1.1.3.2.2 yamt
582 1.1.1.3.2.2 yamt #define FUNCTION_CHECK_DST(p, i) \
583 1.1.1.3.2.2 yamt SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \
584 1.1.1.3.2.2 yamt if (FUNCTION_CHECK_IS_REG(p)) \
585 1.1.1.3.2.2 yamt SLJIT_ASSERT((i) == 0); \
586 1.1.1.3.2.2 yamt else if ((p) == (SLJIT_MEM1(SLJIT_LOCALS_REG))) \
587 1.1.1.3.2.2 yamt SLJIT_ASSERT((i) >= 0 && (i) < compiler->logical_local_size); \
588 1.1.1.3.2.2 yamt else if ((p) & SLJIT_MEM) { \
589 1.1.1.3.2.2 yamt SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \
590 1.1.1.3.2.2 yamt if ((p) & 0xf0) { \
591 1.1.1.3.2.2 yamt SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \
592 1.1.1.3.2.2 yamt SLJIT_ASSERT(!((i) & ~0x3)); \
593 1.1.1.3.2.2 yamt } \
594 1.1.1.3.2.2 yamt SLJIT_ASSERT(((p) >> 9) == 0); \
595 1.1.1.3.2.2 yamt } \
596 1.1.1.3.2.2 yamt else \
597 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
598 1.1.1.3.2.2 yamt
599 1.1.1.3.2.2 yamt #define FUNCTION_FCHECK(p, i) \
600 1.1.1.3.2.2 yamt if ((p) >= SLJIT_FLOAT_REG1 && (p) <= SLJIT_FLOAT_REG4) \
601 1.1.1.3.2.2 yamt SLJIT_ASSERT(i == 0); \
602 1.1.1.3.2.2 yamt else if ((p) & SLJIT_MEM) { \
603 1.1.1.3.2.2 yamt SLJIT_ASSERT(FUNCTION_CHECK_IS_REG((p) & 0xf)); \
604 1.1.1.3.2.2 yamt if ((p) & 0xf0) { \
605 1.1.1.3.2.2 yamt SLJIT_ASSERT(FUNCTION_CHECK_IS_REG(((p) >> 4) & 0xf)); \
606 1.1.1.3.2.2 yamt SLJIT_ASSERT(((p) & 0xf0) != (SLJIT_LOCALS_REG << 4) && !(i & ~0x3)); \
607 1.1.1.3.2.2 yamt } else \
608 1.1.1.3.2.2 yamt SLJIT_ASSERT((((p) >> 4) & 0xf) == 0); \
609 1.1.1.3.2.2 yamt SLJIT_ASSERT(((p) >> 9) == 0); \
610 1.1.1.3.2.2 yamt } \
611 1.1.1.3.2.2 yamt else \
612 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
613 1.1.1.3.2.2 yamt
614 1.1.1.3.2.2 yamt #define FUNCTION_CHECK_OP1() \
615 1.1.1.3.2.2 yamt if (GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_MOVU_SI) { \
616 1.1.1.3.2.2 yamt SLJIT_ASSERT(!GET_ALL_FLAGS(op)); \
617 1.1.1.3.2.2 yamt } \
618 1.1.1.3.2.2 yamt if (GET_OPCODE(op) >= SLJIT_MOVU && GET_OPCODE(op) <= SLJIT_MOVU_SI) { \
619 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(src & SLJIT_MEM) || (src & 0xf) != SLJIT_LOCALS_REG); \
620 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(dst & SLJIT_MEM) || (dst & 0xf) != SLJIT_LOCALS_REG); \
621 1.1.1.3.2.2 yamt if ((src & SLJIT_MEM) && (src & 0xf)) \
622 1.1.1.3.2.2 yamt SLJIT_ASSERT((dst & 0xf) != (src & 0xf) && ((dst >> 4) & 0xf) != (src & 0xf)); \
623 1.1.1.3.2.2 yamt }
624 1.1.1.3.2.2 yamt
625 1.1.1.3.2.2 yamt #endif
626 1.1.1.3.2.2 yamt
627 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
628 1.1.1.3.2.2 yamt
629 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *compiler, FILE* verbose)
630 1.1.1.3.2.2 yamt {
631 1.1.1.3.2.2 yamt compiler->verbose = verbose;
632 1.1.1.3.2.2 yamt }
633 1.1.1.3.2.2 yamt
634 1.1.1.3.2.2 yamt static char* reg_names[] = {
635 1.1.1.3.2.2 yamt (char*)"<noreg>", (char*)"t1", (char*)"t2", (char*)"t3",
636 1.1.1.3.2.2 yamt (char*)"te1", (char*)"te2", (char*)"s1", (char*)"s2",
637 1.1.1.3.2.2 yamt (char*)"s3", (char*)"se1", (char*)"se2", (char*)"lcr"
638 1.1.1.3.2.2 yamt };
639 1.1.1.3.2.2 yamt
640 1.1.1.3.2.2 yamt static char* freg_names[] = {
641 1.1.1.3.2.2 yamt (char*)"<noreg>", (char*)"float_r1", (char*)"float_r2", (char*)"float_r3", (char*)"float_r4"
642 1.1.1.3.2.2 yamt };
643 1.1.1.3.2.2 yamt
644 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
645 1.1.1.3.2.2 yamt #ifdef _WIN64
646 1.1.1.3.2.2 yamt #define SLJIT_PRINT_D "I64"
647 1.1.1.3.2.2 yamt #else
648 1.1.1.3.2.2 yamt #define SLJIT_PRINT_D "l"
649 1.1.1.3.2.2 yamt #endif
650 1.1.1.3.2.2 yamt #else
651 1.1.1.3.2.2 yamt #define SLJIT_PRINT_D ""
652 1.1.1.3.2.2 yamt #endif
653 1.1.1.3.2.2 yamt
654 1.1.1.3.2.2 yamt #define sljit_verbose_param(p, i) \
655 1.1.1.3.2.2 yamt if ((p) & SLJIT_IMM) \
656 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i)); \
657 1.1.1.3.2.2 yamt else if ((p) & SLJIT_MEM) { \
658 1.1.1.3.2.2 yamt if ((p) & 0xf) { \
659 1.1.1.3.2.2 yamt if (i) { \
660 1.1.1.3.2.2 yamt if (((p) >> 4) & 0xf) \
661 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[%s + %s * %d]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF], 1 << (i)); \
662 1.1.1.3.2.2 yamt else \
663 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[%s + #%" SLJIT_PRINT_D "d]", reg_names[(p) & 0xF], (i)); \
664 1.1.1.3.2.2 yamt } \
665 1.1.1.3.2.2 yamt else { \
666 1.1.1.3.2.2 yamt if (((p) >> 4) & 0xf) \
667 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[%s + %s]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF]); \
668 1.1.1.3.2.2 yamt else \
669 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[%s]", reg_names[(p) & 0xF]); \
670 1.1.1.3.2.2 yamt } \
671 1.1.1.3.2.2 yamt } \
672 1.1.1.3.2.2 yamt else \
673 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
674 1.1.1.3.2.2 yamt } else \
675 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "%s", reg_names[p]);
676 1.1.1.3.2.2 yamt #define sljit_verbose_fparam(p, i) \
677 1.1.1.3.2.2 yamt if ((p) & SLJIT_MEM) { \
678 1.1.1.3.2.2 yamt if ((p) & 0xf) { \
679 1.1.1.3.2.2 yamt if (i) { \
680 1.1.1.3.2.2 yamt if (((p) >> 4) & 0xf) \
681 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[%s + %s * %d]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF], 1 << (i)); \
682 1.1.1.3.2.2 yamt else \
683 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[%s + #%" SLJIT_PRINT_D "d]", reg_names[(p) & 0xF], (i)); \
684 1.1.1.3.2.2 yamt } \
685 1.1.1.3.2.2 yamt else { \
686 1.1.1.3.2.2 yamt if (((p) >> 4) & 0xF) \
687 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[%s + %s]", reg_names[(p) & 0xF], reg_names[((p) >> 4)& 0xF]); \
688 1.1.1.3.2.2 yamt else \
689 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[%s]", reg_names[(p) & 0xF]); \
690 1.1.1.3.2.2 yamt } \
691 1.1.1.3.2.2 yamt } \
692 1.1.1.3.2.2 yamt else \
693 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
694 1.1.1.3.2.2 yamt } else \
695 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "%s", freg_names[p]);
696 1.1.1.3.2.2 yamt
697 1.1.1.3.2.2 yamt static SLJIT_CONST char* op_names[] = {
698 1.1.1.3.2.2 yamt /* op0 */
699 1.1.1.3.2.2 yamt (char*)"breakpoint", (char*)"nop",
700 1.1.1.3.2.2 yamt (char*)"umul", (char*)"smul", (char*)"udiv", (char*)"sdiv",
701 1.1.1.3.2.2 yamt /* op1 */
702 1.1.1.3.2.2 yamt (char*)"mov", (char*)"mov.ub", (char*)"mov.sb", (char*)"mov.uh",
703 1.1.1.3.2.2 yamt (char*)"mov.sh", (char*)"mov.ui", (char*)"mov.si", (char*)"movu",
704 1.1.1.3.2.2 yamt (char*)"movu.ub", (char*)"movu.sb", (char*)"movu.uh", (char*)"movu.sh",
705 1.1.1.3.2.2 yamt (char*)"movu.ui", (char*)"movu.si", (char*)"not", (char*)"neg",
706 1.1.1.3.2.2 yamt (char*)"clz",
707 1.1.1.3.2.2 yamt /* op2 */
708 1.1.1.3.2.2 yamt (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc",
709 1.1.1.3.2.2 yamt (char*)"mul", (char*)"and", (char*)"or", (char*)"xor",
710 1.1.1.3.2.2 yamt (char*)"shl", (char*)"lshr", (char*)"ashr",
711 1.1.1.3.2.2 yamt /* fop1 */
712 1.1.1.3.2.2 yamt (char*)"fcmp", (char*)"fmov", (char*)"fneg", (char*)"fabs",
713 1.1.1.3.2.2 yamt /* fop2 */
714 1.1.1.3.2.2 yamt (char*)"fadd", (char*)"fsub", (char*)"fmul", (char*)"fdiv"
715 1.1.1.3.2.2 yamt };
716 1.1.1.3.2.2 yamt
717 1.1.1.3.2.2 yamt static char* jump_names[] = {
718 1.1.1.3.2.2 yamt (char*)"c_equal", (char*)"c_not_equal",
719 1.1.1.3.2.2 yamt (char*)"c_less", (char*)"c_greater_equal",
720 1.1.1.3.2.2 yamt (char*)"c_greater", (char*)"c_less_equal",
721 1.1.1.3.2.2 yamt (char*)"c_sig_less", (char*)"c_sig_greater_equal",
722 1.1.1.3.2.2 yamt (char*)"c_sig_greater", (char*)"c_sig_less_equal",
723 1.1.1.3.2.2 yamt (char*)"c_overflow", (char*)"c_not_overflow",
724 1.1.1.3.2.2 yamt (char*)"c_mul_overflow", (char*)"c_mul_not_overflow",
725 1.1.1.3.2.2 yamt (char*)"c_float_equal", (char*)"c_float_not_equal",
726 1.1.1.3.2.2 yamt (char*)"c_float_less", (char*)"c_float_greater_equal",
727 1.1.1.3.2.2 yamt (char*)"c_float_greater", (char*)"c_float_less_equal",
728 1.1.1.3.2.2 yamt (char*)"c_float_nan", (char*)"c_float_not_nan",
729 1.1.1.3.2.2 yamt (char*)"jump", (char*)"fast_call",
730 1.1.1.3.2.2 yamt (char*)"call0", (char*)"call1", (char*)"call2", (char*)"call3"
731 1.1.1.3.2.2 yamt };
732 1.1.1.3.2.2 yamt
733 1.1.1.3.2.2 yamt #endif
734 1.1.1.3.2.2 yamt
735 1.1.1.3.2.2 yamt /* --------------------------------------------------------------------- */
736 1.1.1.3.2.2 yamt /* Arch dependent */
737 1.1.1.3.2.2 yamt /* --------------------------------------------------------------------- */
738 1.1.1.3.2.2 yamt
739 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_generate_code(struct sljit_compiler *compiler)
740 1.1.1.3.2.2 yamt {
741 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
742 1.1.1.3.2.2 yamt struct sljit_jump *jump;
743 1.1.1.3.2.2 yamt #endif
744 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
745 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
746 1.1.1.3.2.2 yamt
747 1.1.1.3.2.2 yamt SLJIT_ASSERT(compiler->size > 0);
748 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
749 1.1.1.3.2.2 yamt jump = compiler->jumps;
750 1.1.1.3.2.2 yamt while (jump) {
751 1.1.1.3.2.2 yamt /* All jumps have target. */
752 1.1.1.3.2.2 yamt SLJIT_ASSERT(jump->flags & (JUMP_LABEL | JUMP_ADDR));
753 1.1.1.3.2.2 yamt jump = jump->next;
754 1.1.1.3.2.2 yamt }
755 1.1.1.3.2.2 yamt #endif
756 1.1.1.3.2.2 yamt }
757 1.1.1.3.2.2 yamt
758 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
759 1.1.1.3.2.2 yamt {
760 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
761 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
762 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(args);
763 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(temporaries);
764 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(saveds);
765 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(local_size);
766 1.1.1.3.2.2 yamt
767 1.1.1.3.2.2 yamt SLJIT_ASSERT(args >= 0 && args <= 3);
768 1.1.1.3.2.2 yamt SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);
769 1.1.1.3.2.2 yamt SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
770 1.1.1.3.2.2 yamt SLJIT_ASSERT(args <= saveds);
771 1.1.1.3.2.2 yamt SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
772 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
773 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose))
774 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " enter args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);
775 1.1.1.3.2.2 yamt #endif
776 1.1.1.3.2.2 yamt }
777 1.1.1.3.2.2 yamt
778 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
779 1.1.1.3.2.2 yamt {
780 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
781 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
782 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(args);
783 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(temporaries);
784 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(saveds);
785 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(local_size);
786 1.1.1.3.2.2 yamt
787 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
788 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(compiler->skip_checks)) {
789 1.1.1.3.2.2 yamt compiler->skip_checks = 0;
790 1.1.1.3.2.2 yamt return;
791 1.1.1.3.2.2 yamt }
792 1.1.1.3.2.2 yamt #endif
793 1.1.1.3.2.2 yamt
794 1.1.1.3.2.2 yamt SLJIT_ASSERT(args >= 0 && args <= 3);
795 1.1.1.3.2.2 yamt SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);
796 1.1.1.3.2.2 yamt SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
797 1.1.1.3.2.2 yamt SLJIT_ASSERT(args <= saveds);
798 1.1.1.3.2.2 yamt SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
799 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
800 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose))
801 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " set_context args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);
802 1.1.1.3.2.2 yamt #endif
803 1.1.1.3.2.2 yamt }
804 1.1.1.3.2.2 yamt
805 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)
806 1.1.1.3.2.2 yamt {
807 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
808 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
809 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
810 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
811 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
812 1.1.1.3.2.2 yamt
813 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
814 1.1.1.3.2.2 yamt if (op != SLJIT_UNUSED) {
815 1.1.1.3.2.2 yamt SLJIT_ASSERT(op >= SLJIT_MOV && op <= SLJIT_MOV_SI);
816 1.1.1.3.2.2 yamt FUNCTION_CHECK_SRC(src, srcw);
817 1.1.1.3.2.2 yamt }
818 1.1.1.3.2.2 yamt else
819 1.1.1.3.2.2 yamt SLJIT_ASSERT(src == 0 && srcw == 0);
820 1.1.1.3.2.2 yamt #endif
821 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
822 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
823 1.1.1.3.2.2 yamt if (op == SLJIT_UNUSED)
824 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " return\n");
825 1.1.1.3.2.2 yamt else {
826 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " return %s ", op_names[op]);
827 1.1.1.3.2.2 yamt sljit_verbose_param(src, srcw);
828 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
829 1.1.1.3.2.2 yamt }
830 1.1.1.3.2.2 yamt }
831 1.1.1.3.2.2 yamt #endif
832 1.1.1.3.2.2 yamt }
833 1.1.1.3.2.2 yamt
834 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw)
835 1.1.1.3.2.2 yamt {
836 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
837 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
838 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
839 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
840 1.1.1.3.2.2 yamt
841 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
842 1.1.1.3.2.2 yamt FUNCTION_CHECK_DST(dst, dstw);
843 1.1.1.3.2.2 yamt #endif
844 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
845 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
846 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " fast_enter ");
847 1.1.1.3.2.2 yamt sljit_verbose_param(dst, dstw);
848 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
849 1.1.1.3.2.2 yamt }
850 1.1.1.3.2.2 yamt #endif
851 1.1.1.3.2.2 yamt }
852 1.1.1.3.2.2 yamt
853 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_fast_return(struct sljit_compiler *compiler, int src, sljit_w srcw)
854 1.1.1.3.2.2 yamt {
855 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
856 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
857 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
858 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
859 1.1.1.3.2.2 yamt
860 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
861 1.1.1.3.2.2 yamt FUNCTION_CHECK_SRC(src, srcw);
862 1.1.1.3.2.2 yamt #endif
863 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
864 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
865 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " fast_return ");
866 1.1.1.3.2.2 yamt sljit_verbose_param(src, srcw);
867 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
868 1.1.1.3.2.2 yamt }
869 1.1.1.3.2.2 yamt #endif
870 1.1.1.3.2.2 yamt }
871 1.1.1.3.2.2 yamt
872 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_op0(struct sljit_compiler *compiler, int op)
873 1.1.1.3.2.2 yamt {
874 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
875 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
876 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
877 1.1.1.3.2.2 yamt
878 1.1.1.3.2.2 yamt SLJIT_ASSERT((op >= SLJIT_BREAKPOINT && op <= SLJIT_SMUL)
879 1.1.1.3.2.2 yamt || ((op & ~SLJIT_INT_OP) >= SLJIT_UDIV && (op & ~SLJIT_INT_OP) <= SLJIT_SDIV));
880 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
881 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose))
882 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " %s%s\n", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)]);
883 1.1.1.3.2.2 yamt #endif
884 1.1.1.3.2.2 yamt }
885 1.1.1.3.2.2 yamt
886 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_op1(struct sljit_compiler *compiler, int op,
887 1.1.1.3.2.2 yamt int dst, sljit_w dstw,
888 1.1.1.3.2.2 yamt int src, sljit_w srcw)
889 1.1.1.3.2.2 yamt {
890 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
891 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
892 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
893 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
894 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
895 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
896 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
897 1.1.1.3.2.2 yamt
898 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
899 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(compiler->skip_checks)) {
900 1.1.1.3.2.2 yamt compiler->skip_checks = 0;
901 1.1.1.3.2.2 yamt return;
902 1.1.1.3.2.2 yamt }
903 1.1.1.3.2.2 yamt #endif
904 1.1.1.3.2.2 yamt
905 1.1.1.3.2.2 yamt SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_MOV && GET_OPCODE(op) <= SLJIT_CLZ);
906 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
907 1.1.1.3.2.2 yamt FUNCTION_CHECK_OP();
908 1.1.1.3.2.2 yamt FUNCTION_CHECK_SRC(src, srcw);
909 1.1.1.3.2.2 yamt FUNCTION_CHECK_DST(dst, dstw);
910 1.1.1.3.2.2 yamt FUNCTION_CHECK_OP1();
911 1.1.1.3.2.2 yamt #endif
912 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
913 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
914 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],
915 1.1.1.3.2.2 yamt !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S", !(op & SLJIT_SET_U) ? "" : "U", !(op & SLJIT_SET_O) ? "" : "O", !(op & SLJIT_SET_C) ? "" : "C", !(op & SLJIT_KEEP_FLAGS) ? "" : "K");
916 1.1.1.3.2.2 yamt sljit_verbose_param(dst, dstw);
917 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", ");
918 1.1.1.3.2.2 yamt sljit_verbose_param(src, srcw);
919 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
920 1.1.1.3.2.2 yamt }
921 1.1.1.3.2.2 yamt #endif
922 1.1.1.3.2.2 yamt }
923 1.1.1.3.2.2 yamt
924 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_op2(struct sljit_compiler *compiler, int op,
925 1.1.1.3.2.2 yamt int dst, sljit_w dstw,
926 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
927 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
928 1.1.1.3.2.2 yamt {
929 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
930 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
931 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
932 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
933 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
934 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1);
935 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1w);
936 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2);
937 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2w);
938 1.1.1.3.2.2 yamt
939 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
940 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(compiler->skip_checks)) {
941 1.1.1.3.2.2 yamt compiler->skip_checks = 0;
942 1.1.1.3.2.2 yamt return;
943 1.1.1.3.2.2 yamt }
944 1.1.1.3.2.2 yamt #endif
945 1.1.1.3.2.2 yamt
946 1.1.1.3.2.2 yamt SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_ADD && GET_OPCODE(op) <= SLJIT_ASHR);
947 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
948 1.1.1.3.2.2 yamt FUNCTION_CHECK_OP();
949 1.1.1.3.2.2 yamt FUNCTION_CHECK_SRC(src1, src1w);
950 1.1.1.3.2.2 yamt FUNCTION_CHECK_SRC(src2, src2w);
951 1.1.1.3.2.2 yamt FUNCTION_CHECK_DST(dst, dstw);
952 1.1.1.3.2.2 yamt #endif
953 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
954 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
955 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)],
956 1.1.1.3.2.2 yamt !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S", !(op & SLJIT_SET_U) ? "" : "U", !(op & SLJIT_SET_O) ? "" : "O", !(op & SLJIT_SET_C) ? "" : "C", !(op & SLJIT_KEEP_FLAGS) ? "" : "K");
957 1.1.1.3.2.2 yamt sljit_verbose_param(dst, dstw);
958 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", ");
959 1.1.1.3.2.2 yamt sljit_verbose_param(src1, src1w);
960 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", ");
961 1.1.1.3.2.2 yamt sljit_verbose_param(src2, src2w);
962 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
963 1.1.1.3.2.2 yamt }
964 1.1.1.3.2.2 yamt #endif
965 1.1.1.3.2.2 yamt }
966 1.1.1.3.2.2 yamt
967 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_get_register_index(int reg)
968 1.1.1.3.2.2 yamt {
969 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(reg);
970 1.1.1.3.2.2 yamt SLJIT_ASSERT(reg > 0 && reg <= SLJIT_NO_REGISTERS);
971 1.1.1.3.2.2 yamt }
972 1.1.1.3.2.2 yamt
973 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_op_custom(struct sljit_compiler *compiler,
974 1.1.1.3.2.2 yamt void *instruction, int size)
975 1.1.1.3.2.2 yamt {
976 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
977 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(instruction);
978 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(size);
979 1.1.1.3.2.2 yamt SLJIT_ASSERT(instruction);
980 1.1.1.3.2.2 yamt }
981 1.1.1.3.2.2 yamt
982 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_fop1(struct sljit_compiler *compiler, int op,
983 1.1.1.3.2.2 yamt int dst, sljit_w dstw,
984 1.1.1.3.2.2 yamt int src, sljit_w srcw)
985 1.1.1.3.2.2 yamt {
986 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
987 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
988 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
989 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
990 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
991 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
992 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
993 1.1.1.3.2.2 yamt
994 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
995 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(compiler->skip_checks)) {
996 1.1.1.3.2.2 yamt compiler->skip_checks = 0;
997 1.1.1.3.2.2 yamt return;
998 1.1.1.3.2.2 yamt }
999 1.1.1.3.2.2 yamt #endif
1000 1.1.1.3.2.2 yamt
1001 1.1.1.3.2.2 yamt SLJIT_ASSERT(sljit_is_fpu_available());
1002 1.1.1.3.2.2 yamt SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FCMP && GET_OPCODE(op) <= SLJIT_FABS);
1003 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1004 1.1.1.3.2.2 yamt FUNCTION_CHECK_OP();
1005 1.1.1.3.2.2 yamt FUNCTION_FCHECK(src, srcw);
1006 1.1.1.3.2.2 yamt FUNCTION_FCHECK(dst, dstw);
1007 1.1.1.3.2.2 yamt #endif
1008 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1009 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1010 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " %s%s%s ", op_names[GET_OPCODE(op)],
1011 1.1.1.3.2.2 yamt !(op & SLJIT_SET_E) ? "" : "E", !(op & SLJIT_SET_S) ? "" : "S");
1012 1.1.1.3.2.2 yamt sljit_verbose_fparam(dst, dstw);
1013 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", ");
1014 1.1.1.3.2.2 yamt sljit_verbose_fparam(src, srcw);
1015 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
1016 1.1.1.3.2.2 yamt }
1017 1.1.1.3.2.2 yamt #endif
1018 1.1.1.3.2.2 yamt }
1019 1.1.1.3.2.2 yamt
1020 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_fop2(struct sljit_compiler *compiler, int op,
1021 1.1.1.3.2.2 yamt int dst, sljit_w dstw,
1022 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1023 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1024 1.1.1.3.2.2 yamt {
1025 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
1026 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1027 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1028 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1029 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1030 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1);
1031 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1w);
1032 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2);
1033 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2w);
1034 1.1.1.3.2.2 yamt
1035 1.1.1.3.2.2 yamt SLJIT_ASSERT(sljit_is_fpu_available());
1036 1.1.1.3.2.2 yamt SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_FADD && GET_OPCODE(op) <= SLJIT_FDIV);
1037 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1038 1.1.1.3.2.2 yamt FUNCTION_CHECK_OP();
1039 1.1.1.3.2.2 yamt FUNCTION_FCHECK(src1, src1w);
1040 1.1.1.3.2.2 yamt FUNCTION_FCHECK(src2, src2w);
1041 1.1.1.3.2.2 yamt FUNCTION_FCHECK(dst, dstw);
1042 1.1.1.3.2.2 yamt #endif
1043 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1044 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1045 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " %s ", op_names[GET_OPCODE(op)]);
1046 1.1.1.3.2.2 yamt sljit_verbose_fparam(dst, dstw);
1047 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", ");
1048 1.1.1.3.2.2 yamt sljit_verbose_fparam(src1, src1w);
1049 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", ");
1050 1.1.1.3.2.2 yamt sljit_verbose_fparam(src2, src2w);
1051 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
1052 1.1.1.3.2.2 yamt }
1053 1.1.1.3.2.2 yamt #endif
1054 1.1.1.3.2.2 yamt }
1055 1.1.1.3.2.2 yamt
1056 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_label(struct sljit_compiler *compiler)
1057 1.1.1.3.2.2 yamt {
1058 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
1059 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1060 1.1.1.3.2.2 yamt
1061 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1062 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose))
1063 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "label:\n");
1064 1.1.1.3.2.2 yamt #endif
1065 1.1.1.3.2.2 yamt }
1066 1.1.1.3.2.2 yamt
1067 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_jump(struct sljit_compiler *compiler, int type)
1068 1.1.1.3.2.2 yamt {
1069 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
1070 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1071 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1072 1.1.1.3.2.2 yamt
1073 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1074 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1075 1.1.1.3.2.2 yamt compiler->skip_checks = 0;
1076 1.1.1.3.2.2 yamt return;
1077 1.1.1.3.2.2 yamt }
1078 1.1.1.3.2.2 yamt #endif
1079 1.1.1.3.2.2 yamt
1080 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));
1081 1.1.1.3.2.2 yamt SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_CALL3);
1082 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1083 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose))
1084 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " jump%s <%s>\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);
1085 1.1.1.3.2.2 yamt #endif
1086 1.1.1.3.2.2 yamt }
1087 1.1.1.3.2.2 yamt
1088 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_cmp(struct sljit_compiler *compiler, int type,
1089 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1090 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1091 1.1.1.3.2.2 yamt {
1092 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1093 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1094 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1);
1095 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1w);
1096 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2);
1097 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2w);
1098 1.1.1.3.2.2 yamt
1099 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(type & ~(0xff | SLJIT_INT_OP | SLJIT_REWRITABLE_JUMP)));
1100 1.1.1.3.2.2 yamt SLJIT_ASSERT((type & 0xff) >= SLJIT_C_EQUAL && (type & 0xff) <= SLJIT_C_SIG_LESS_EQUAL);
1101 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1102 1.1.1.3.2.2 yamt FUNCTION_CHECK_SRC(src1, src1w);
1103 1.1.1.3.2.2 yamt FUNCTION_CHECK_SRC(src2, src2w);
1104 1.1.1.3.2.2 yamt #endif
1105 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1106 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1107 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " %scmp%s <%s> ", !(type & SLJIT_INT_OP) ? "" : "i", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);
1108 1.1.1.3.2.2 yamt sljit_verbose_param(src1, src1w);
1109 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", ");
1110 1.1.1.3.2.2 yamt sljit_verbose_param(src2, src2w);
1111 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
1112 1.1.1.3.2.2 yamt }
1113 1.1.1.3.2.2 yamt #endif
1114 1.1.1.3.2.2 yamt }
1115 1.1.1.3.2.2 yamt
1116 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_fcmp(struct sljit_compiler *compiler, int type,
1117 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1118 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1119 1.1.1.3.2.2 yamt {
1120 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1121 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1122 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1);
1123 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1w);
1124 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2);
1125 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2w);
1126 1.1.1.3.2.2 yamt
1127 1.1.1.3.2.2 yamt SLJIT_ASSERT(sljit_is_fpu_available());
1128 1.1.1.3.2.2 yamt SLJIT_ASSERT(!(type & ~(0xff | SLJIT_REWRITABLE_JUMP)));
1129 1.1.1.3.2.2 yamt SLJIT_ASSERT((type & 0xff) >= SLJIT_C_FLOAT_EQUAL && (type & 0xff) <= SLJIT_C_FLOAT_ORDERED);
1130 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1131 1.1.1.3.2.2 yamt FUNCTION_FCHECK(src1, src1w);
1132 1.1.1.3.2.2 yamt FUNCTION_FCHECK(src2, src2w);
1133 1.1.1.3.2.2 yamt #endif
1134 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1135 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1136 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " fcmp%s <%s> ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : "R", jump_names[type & 0xff]);
1137 1.1.1.3.2.2 yamt sljit_verbose_fparam(src1, src1w);
1138 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", ");
1139 1.1.1.3.2.2 yamt sljit_verbose_fparam(src2, src2w);
1140 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
1141 1.1.1.3.2.2 yamt }
1142 1.1.1.3.2.2 yamt #endif
1143 1.1.1.3.2.2 yamt }
1144 1.1.1.3.2.2 yamt
1145 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_ijump(struct sljit_compiler *compiler, int type, int src, sljit_w srcw)
1146 1.1.1.3.2.2 yamt {
1147 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
1148 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1149 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1150 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
1151 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
1152 1.1.1.3.2.2 yamt
1153 1.1.1.3.2.2 yamt SLJIT_ASSERT(type >= SLJIT_JUMP && type <= SLJIT_CALL3);
1154 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1155 1.1.1.3.2.2 yamt FUNCTION_CHECK_SRC(src, srcw);
1156 1.1.1.3.2.2 yamt #endif
1157 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1158 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1159 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " ijump <%s> ", jump_names[type]);
1160 1.1.1.3.2.2 yamt sljit_verbose_param(src, srcw);
1161 1.1.1.3.2.2 yamt fprintf(compiler->verbose, "\n");
1162 1.1.1.3.2.2 yamt }
1163 1.1.1.3.2.2 yamt #endif
1164 1.1.1.3.2.2 yamt }
1165 1.1.1.3.2.2 yamt
1166 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_cond_value(struct sljit_compiler *compiler, int op, int dst, sljit_w dstw, int type)
1167 1.1.1.3.2.2 yamt {
1168 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
1169 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1170 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1171 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1172 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1173 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1174 1.1.1.3.2.2 yamt
1175 1.1.1.3.2.2 yamt SLJIT_ASSERT(type >= SLJIT_C_EQUAL && type < SLJIT_JUMP);
1176 1.1.1.3.2.2 yamt SLJIT_ASSERT(op == SLJIT_MOV || GET_OPCODE(op) == SLJIT_OR);
1177 1.1.1.3.2.2 yamt SLJIT_ASSERT(GET_ALL_FLAGS(op) == 0 || GET_ALL_FLAGS(op) == SLJIT_SET_E || GET_ALL_FLAGS(op) == SLJIT_KEEP_FLAGS);
1178 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1179 1.1.1.3.2.2 yamt FUNCTION_CHECK_DST(dst, dstw);
1180 1.1.1.3.2.2 yamt #endif
1181 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1182 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1183 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " cond_set%s%s <%s> ", !(op & SLJIT_SET_E) ? "" : "E",
1184 1.1.1.3.2.2 yamt !(op & SLJIT_KEEP_FLAGS) ? "" : "K", op_names[GET_OPCODE(op)]);
1185 1.1.1.3.2.2 yamt sljit_verbose_param(dst, dstw);
1186 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", <%s>\n", jump_names[type]);
1187 1.1.1.3.2.2 yamt }
1188 1.1.1.3.2.2 yamt #endif
1189 1.1.1.3.2.2 yamt }
1190 1.1.1.3.2.2 yamt
1191 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)
1192 1.1.1.3.2.2 yamt {
1193 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1194 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1195 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1196 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(offset);
1197 1.1.1.3.2.2 yamt
1198 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1199 1.1.1.3.2.2 yamt FUNCTION_CHECK_DST(dst, dstw);
1200 1.1.1.3.2.2 yamt #endif
1201 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1202 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1203 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " local_base ");
1204 1.1.1.3.2.2 yamt sljit_verbose_param(dst, dstw);
1205 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", offset);
1206 1.1.1.3.2.2 yamt }
1207 1.1.1.3.2.2 yamt #endif
1208 1.1.1.3.2.2 yamt }
1209 1.1.1.3.2.2 yamt
1210 1.1.1.3.2.2 yamt static SLJIT_INLINE void check_sljit_emit_const(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w init_value)
1211 1.1.1.3.2.2 yamt {
1212 1.1.1.3.2.2 yamt /* If debug and verbose are disabled, all arguments are unused. */
1213 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1214 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1215 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1216 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(init_value);
1217 1.1.1.3.2.2 yamt
1218 1.1.1.3.2.2 yamt #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
1219 1.1.1.3.2.2 yamt FUNCTION_CHECK_DST(dst, dstw);
1220 1.1.1.3.2.2 yamt #endif
1221 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1222 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1223 1.1.1.3.2.2 yamt fprintf(compiler->verbose, " const ");
1224 1.1.1.3.2.2 yamt sljit_verbose_param(dst, dstw);
1225 1.1.1.3.2.2 yamt fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", init_value);
1226 1.1.1.3.2.2 yamt }
1227 1.1.1.3.2.2 yamt #endif
1228 1.1.1.3.2.2 yamt }
1229 1.1.1.3.2.2 yamt
1230 1.1.1.3.2.2 yamt static SLJIT_INLINE int emit_mov_before_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)
1231 1.1.1.3.2.2 yamt {
1232 1.1.1.3.2.2 yamt /* Return if don't need to do anything. */
1233 1.1.1.3.2.2 yamt if (op == SLJIT_UNUSED)
1234 1.1.1.3.2.2 yamt return SLJIT_SUCCESS;
1235 1.1.1.3.2.2 yamt
1236 1.1.1.3.2.2 yamt #if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1237 1.1.1.3.2.2 yamt if (src == SLJIT_RETURN_REG && op == SLJIT_MOV)
1238 1.1.1.3.2.2 yamt return SLJIT_SUCCESS;
1239 1.1.1.3.2.2 yamt #else
1240 1.1.1.3.2.2 yamt if (src == SLJIT_RETURN_REG && (op == SLJIT_MOV || op == SLJIT_MOV_UI || op == SLJIT_MOV_SI))
1241 1.1.1.3.2.2 yamt return SLJIT_SUCCESS;
1242 1.1.1.3.2.2 yamt #endif
1243 1.1.1.3.2.2 yamt
1244 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1245 1.1.1.3.2.2 yamt compiler->skip_checks = 1;
1246 1.1.1.3.2.2 yamt #endif
1247 1.1.1.3.2.2 yamt return sljit_emit_op1(compiler, op, SLJIT_RETURN_REG, 0, src, srcw);
1248 1.1.1.3.2.2 yamt }
1249 1.1.1.3.2.2 yamt
1250 1.1.1.3.2.2 yamt /* CPU description section */
1251 1.1.1.3.2.2 yamt
1252 1.1.1.3.2.2 yamt #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
1253 1.1.1.3.2.2 yamt #define SLJIT_CPUINFO_PART1 " 32bit ("
1254 1.1.1.3.2.2 yamt #elif (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
1255 1.1.1.3.2.2 yamt #define SLJIT_CPUINFO_PART1 " 64bit ("
1256 1.1.1.3.2.2 yamt #else
1257 1.1.1.3.2.2 yamt #error "Internal error: CPU type info missing"
1258 1.1.1.3.2.2 yamt #endif
1259 1.1.1.3.2.2 yamt
1260 1.1.1.3.2.2 yamt #if (defined SLJIT_LITTLE_ENDIAN && SLJIT_LITTLE_ENDIAN)
1261 1.1.1.3.2.2 yamt #define SLJIT_CPUINFO_PART2 "little endian + "
1262 1.1.1.3.2.2 yamt #elif (defined SLJIT_BIG_ENDIAN && SLJIT_BIG_ENDIAN)
1263 1.1.1.3.2.2 yamt #define SLJIT_CPUINFO_PART2 "big endian + "
1264 1.1.1.3.2.2 yamt #else
1265 1.1.1.3.2.2 yamt #error "Internal error: CPU type info missing"
1266 1.1.1.3.2.2 yamt #endif
1267 1.1.1.3.2.2 yamt
1268 1.1.1.3.2.2 yamt #if (defined SLJIT_UNALIGNED && SLJIT_UNALIGNED)
1269 1.1.1.3.2.2 yamt #define SLJIT_CPUINFO_PART3 "unaligned)"
1270 1.1.1.3.2.2 yamt #else
1271 1.1.1.3.2.2 yamt #define SLJIT_CPUINFO_PART3 "aligned)"
1272 1.1.1.3.2.2 yamt #endif
1273 1.1.1.3.2.2 yamt
1274 1.1.1.3.2.2 yamt #define SLJIT_CPUINFO SLJIT_CPUINFO_PART1 SLJIT_CPUINFO_PART2 SLJIT_CPUINFO_PART3
1275 1.1.1.3.2.2 yamt
1276 1.1.1.3.2.2 yamt #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
1277 1.1.1.3.2.2 yamt #include "sljitNativeX86_common.c"
1278 1.1.1.3.2.2 yamt #elif (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
1279 1.1.1.3.2.2 yamt #include "sljitNativeX86_common.c"
1280 1.1.1.3.2.2 yamt #elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5)
1281 1.1.1.3.2.2 yamt #include "sljitNativeARM_v5.c"
1282 1.1.1.3.2.2 yamt #elif (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7)
1283 1.1.1.3.2.2 yamt #include "sljitNativeARM_v5.c"
1284 1.1.1.3.2.2 yamt #elif (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
1285 1.1.1.3.2.2 yamt #include "sljitNativeARM_Thumb2.c"
1286 1.1.1.3.2.2 yamt #elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32)
1287 1.1.1.3.2.2 yamt #include "sljitNativePPC_common.c"
1288 1.1.1.3.2.2 yamt #elif (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
1289 1.1.1.3.2.2 yamt #include "sljitNativePPC_common.c"
1290 1.1.1.3.2.2 yamt #elif (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1291 1.1.1.3.2.2 yamt #include "sljitNativeMIPS_common.c"
1292 1.1.1.3.2.2 yamt #elif (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
1293 1.1.1.3.2.2 yamt #include "sljitNativeSPARC_common.c"
1294 1.1.1.3.2.2 yamt #endif
1295 1.1.1.3.2.2 yamt
1296 1.1.1.3.2.2 yamt #if !(defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32)
1297 1.1.1.3.2.2 yamt
1298 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, int type,
1299 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1300 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1301 1.1.1.3.2.2 yamt {
1302 1.1.1.3.2.2 yamt /* Default compare for most architectures. */
1303 1.1.1.3.2.2 yamt int flags, tmp_src, condition;
1304 1.1.1.3.2.2 yamt sljit_w tmp_srcw;
1305 1.1.1.3.2.2 yamt
1306 1.1.1.3.2.2 yamt CHECK_ERROR_PTR();
1307 1.1.1.3.2.2 yamt check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w);
1308 1.1.1.3.2.2 yamt
1309 1.1.1.3.2.2 yamt condition = type & 0xff;
1310 1.1.1.3.2.2 yamt if (SLJIT_UNLIKELY((src1 & SLJIT_IMM) && !(src2 & SLJIT_IMM))) {
1311 1.1.1.3.2.2 yamt /* Immediate is prefered as second argument by most architectures. */
1312 1.1.1.3.2.2 yamt switch (condition) {
1313 1.1.1.3.2.2 yamt case SLJIT_C_LESS:
1314 1.1.1.3.2.2 yamt condition = SLJIT_C_GREATER;
1315 1.1.1.3.2.2 yamt break;
1316 1.1.1.3.2.2 yamt case SLJIT_C_GREATER_EQUAL:
1317 1.1.1.3.2.2 yamt condition = SLJIT_C_LESS_EQUAL;
1318 1.1.1.3.2.2 yamt break;
1319 1.1.1.3.2.2 yamt case SLJIT_C_GREATER:
1320 1.1.1.3.2.2 yamt condition = SLJIT_C_LESS;
1321 1.1.1.3.2.2 yamt break;
1322 1.1.1.3.2.2 yamt case SLJIT_C_LESS_EQUAL:
1323 1.1.1.3.2.2 yamt condition = SLJIT_C_GREATER_EQUAL;
1324 1.1.1.3.2.2 yamt break;
1325 1.1.1.3.2.2 yamt case SLJIT_C_SIG_LESS:
1326 1.1.1.3.2.2 yamt condition = SLJIT_C_SIG_GREATER;
1327 1.1.1.3.2.2 yamt break;
1328 1.1.1.3.2.2 yamt case SLJIT_C_SIG_GREATER_EQUAL:
1329 1.1.1.3.2.2 yamt condition = SLJIT_C_SIG_LESS_EQUAL;
1330 1.1.1.3.2.2 yamt break;
1331 1.1.1.3.2.2 yamt case SLJIT_C_SIG_GREATER:
1332 1.1.1.3.2.2 yamt condition = SLJIT_C_SIG_LESS;
1333 1.1.1.3.2.2 yamt break;
1334 1.1.1.3.2.2 yamt case SLJIT_C_SIG_LESS_EQUAL:
1335 1.1.1.3.2.2 yamt condition = SLJIT_C_SIG_GREATER_EQUAL;
1336 1.1.1.3.2.2 yamt break;
1337 1.1.1.3.2.2 yamt }
1338 1.1.1.3.2.2 yamt type = condition | (type & (SLJIT_INT_OP | SLJIT_REWRITABLE_JUMP));
1339 1.1.1.3.2.2 yamt tmp_src = src1;
1340 1.1.1.3.2.2 yamt src1 = src2;
1341 1.1.1.3.2.2 yamt src2 = tmp_src;
1342 1.1.1.3.2.2 yamt tmp_srcw = src1w;
1343 1.1.1.3.2.2 yamt src1w = src2w;
1344 1.1.1.3.2.2 yamt src2w = tmp_srcw;
1345 1.1.1.3.2.2 yamt }
1346 1.1.1.3.2.2 yamt
1347 1.1.1.3.2.2 yamt if (condition <= SLJIT_C_NOT_ZERO)
1348 1.1.1.3.2.2 yamt flags = SLJIT_SET_E;
1349 1.1.1.3.2.2 yamt else if (condition <= SLJIT_C_LESS_EQUAL)
1350 1.1.1.3.2.2 yamt flags = SLJIT_SET_U;
1351 1.1.1.3.2.2 yamt else
1352 1.1.1.3.2.2 yamt flags = SLJIT_SET_S;
1353 1.1.1.3.2.2 yamt
1354 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1355 1.1.1.3.2.2 yamt compiler->skip_checks = 1;
1356 1.1.1.3.2.2 yamt #endif
1357 1.1.1.3.2.2 yamt PTR_FAIL_IF(sljit_emit_op2(compiler, SLJIT_SUB | flags | (type & SLJIT_INT_OP),
1358 1.1.1.3.2.2 yamt SLJIT_UNUSED, 0, src1, src1w, src2, src2w));
1359 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1360 1.1.1.3.2.2 yamt compiler->skip_checks = 1;
1361 1.1.1.3.2.2 yamt #endif
1362 1.1.1.3.2.2 yamt return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
1363 1.1.1.3.2.2 yamt }
1364 1.1.1.3.2.2 yamt
1365 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, int type,
1366 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1367 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1368 1.1.1.3.2.2 yamt {
1369 1.1.1.3.2.2 yamt int flags, condition;
1370 1.1.1.3.2.2 yamt
1371 1.1.1.3.2.2 yamt check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w);
1372 1.1.1.3.2.2 yamt
1373 1.1.1.3.2.2 yamt condition = type & 0xff;
1374 1.1.1.3.2.2 yamt if (condition <= SLJIT_C_FLOAT_NOT_EQUAL)
1375 1.1.1.3.2.2 yamt flags = SLJIT_SET_E;
1376 1.1.1.3.2.2 yamt else
1377 1.1.1.3.2.2 yamt flags = SLJIT_SET_S;
1378 1.1.1.3.2.2 yamt
1379 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1380 1.1.1.3.2.2 yamt compiler->skip_checks = 1;
1381 1.1.1.3.2.2 yamt #endif
1382 1.1.1.3.2.2 yamt sljit_emit_fop1(compiler, SLJIT_FCMP | flags, src1, src1w, src2, src2w);
1383 1.1.1.3.2.2 yamt
1384 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1385 1.1.1.3.2.2 yamt compiler->skip_checks = 1;
1386 1.1.1.3.2.2 yamt #endif
1387 1.1.1.3.2.2 yamt return sljit_emit_jump(compiler, condition | (type & SLJIT_REWRITABLE_JUMP));
1388 1.1.1.3.2.2 yamt }
1389 1.1.1.3.2.2 yamt
1390 1.1.1.3.2.2 yamt #endif
1391 1.1.1.3.2.2 yamt
1392 1.1.1.3.2.2 yamt #if !(defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) && !(defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
1393 1.1.1.3.2.2 yamt
1394 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)
1395 1.1.1.3.2.2 yamt {
1396 1.1.1.3.2.2 yamt CHECK_ERROR();
1397 1.1.1.3.2.2 yamt check_sljit_get_local_base(compiler, dst, dstw, offset);
1398 1.1.1.3.2.2 yamt
1399 1.1.1.3.2.2 yamt ADJUST_LOCAL_OFFSET(SLJIT_MEM1(SLJIT_LOCALS_REG), offset);
1400 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
1401 1.1.1.3.2.2 yamt compiler->skip_checks = 1;
1402 1.1.1.3.2.2 yamt #endif
1403 1.1.1.3.2.2 yamt if (offset != 0)
1404 1.1.1.3.2.2 yamt return sljit_emit_op2(compiler, SLJIT_ADD | SLJIT_KEEP_FLAGS, dst, dstw, SLJIT_LOCALS_REG, 0, SLJIT_IMM, offset);
1405 1.1.1.3.2.2 yamt return sljit_emit_op1(compiler, SLJIT_MOV, dst, dstw, SLJIT_LOCALS_REG, 0);
1406 1.1.1.3.2.2 yamt }
1407 1.1.1.3.2.2 yamt
1408 1.1.1.3.2.2 yamt #endif
1409 1.1.1.3.2.2 yamt
1410 1.1.1.3.2.2 yamt #else /* SLJIT_CONFIG_UNSUPPORTED */
1411 1.1.1.3.2.2 yamt
1412 1.1.1.3.2.2 yamt /* Empty function bodies for those machines, which are not (yet) supported. */
1413 1.1.1.3.2.2 yamt
1414 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void)
1415 1.1.1.3.2.2 yamt {
1416 1.1.1.3.2.2 yamt return "unsupported";
1417 1.1.1.3.2.2 yamt }
1418 1.1.1.3.2.2 yamt
1419 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_compiler* sljit_create_compiler(void)
1420 1.1.1.3.2.2 yamt {
1421 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1422 1.1.1.3.2.2 yamt return NULL;
1423 1.1.1.3.2.2 yamt }
1424 1.1.1.3.2.2 yamt
1425 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler)
1426 1.1.1.3.2.2 yamt {
1427 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1428 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1429 1.1.1.3.2.2 yamt }
1430 1.1.1.3.2.2 yamt
1431 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, int size)
1432 1.1.1.3.2.2 yamt {
1433 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1434 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(size);
1435 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1436 1.1.1.3.2.2 yamt return NULL;
1437 1.1.1.3.2.2 yamt }
1438 1.1.1.3.2.2 yamt
1439 1.1.1.3.2.2 yamt #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
1440 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *compiler, FILE* verbose)
1441 1.1.1.3.2.2 yamt {
1442 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1443 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(verbose);
1444 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1445 1.1.1.3.2.2 yamt }
1446 1.1.1.3.2.2 yamt #endif
1447 1.1.1.3.2.2 yamt
1448 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
1449 1.1.1.3.2.2 yamt {
1450 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1451 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1452 1.1.1.3.2.2 yamt return NULL;
1453 1.1.1.3.2.2 yamt }
1454 1.1.1.3.2.2 yamt
1455 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
1456 1.1.1.3.2.2 yamt {
1457 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(code);
1458 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1459 1.1.1.3.2.2 yamt }
1460 1.1.1.3.2.2 yamt
1461 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
1462 1.1.1.3.2.2 yamt {
1463 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1464 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(args);
1465 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(temporaries);
1466 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(saveds);
1467 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(local_size);
1468 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1469 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1470 1.1.1.3.2.2 yamt }
1471 1.1.1.3.2.2 yamt
1472 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
1473 1.1.1.3.2.2 yamt {
1474 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1475 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(args);
1476 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(temporaries);
1477 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(saveds);
1478 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(local_size);
1479 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1480 1.1.1.3.2.2 yamt }
1481 1.1.1.3.2.2 yamt
1482 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int op, int src, sljit_w srcw)
1483 1.1.1.3.2.2 yamt {
1484 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1485 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1486 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
1487 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
1488 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1489 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1490 1.1.1.3.2.2 yamt }
1491 1.1.1.3.2.2 yamt
1492 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int saveds, int local_size)
1493 1.1.1.3.2.2 yamt {
1494 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1495 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1496 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1497 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(args);
1498 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(temporaries);
1499 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(saveds);
1500 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(local_size);
1501 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1502 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1503 1.1.1.3.2.2 yamt }
1504 1.1.1.3.2.2 yamt
1505 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_return(struct sljit_compiler *compiler, int src, sljit_w srcw)
1506 1.1.1.3.2.2 yamt {
1507 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1508 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
1509 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
1510 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1511 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1512 1.1.1.3.2.2 yamt }
1513 1.1.1.3.2.2 yamt
1514 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op0(struct sljit_compiler *compiler, int op)
1515 1.1.1.3.2.2 yamt {
1516 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1517 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1518 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1519 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1520 1.1.1.3.2.2 yamt }
1521 1.1.1.3.2.2 yamt
1522 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct sljit_compiler *compiler, int op,
1523 1.1.1.3.2.2 yamt int dst, sljit_w dstw,
1524 1.1.1.3.2.2 yamt int src, sljit_w srcw)
1525 1.1.1.3.2.2 yamt {
1526 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1527 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1528 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1529 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1530 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
1531 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
1532 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1533 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1534 1.1.1.3.2.2 yamt }
1535 1.1.1.3.2.2 yamt
1536 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct sljit_compiler *compiler, int op,
1537 1.1.1.3.2.2 yamt int dst, sljit_w dstw,
1538 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1539 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1540 1.1.1.3.2.2 yamt {
1541 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1542 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1543 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1544 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1545 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1);
1546 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1w);
1547 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2);
1548 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2w);
1549 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1550 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1551 1.1.1.3.2.2 yamt }
1552 1.1.1.3.2.2 yamt
1553 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_get_register_index(int reg)
1554 1.1.1.3.2.2 yamt {
1555 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1556 1.1.1.3.2.2 yamt return reg;
1557 1.1.1.3.2.2 yamt }
1558 1.1.1.3.2.2 yamt
1559 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op_custom(struct sljit_compiler *compiler,
1560 1.1.1.3.2.2 yamt void *instruction, int size)
1561 1.1.1.3.2.2 yamt {
1562 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1563 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(instruction);
1564 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(size);
1565 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1566 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1567 1.1.1.3.2.2 yamt }
1568 1.1.1.3.2.2 yamt
1569 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_is_fpu_available(void)
1570 1.1.1.3.2.2 yamt {
1571 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1572 1.1.1.3.2.2 yamt return 0;
1573 1.1.1.3.2.2 yamt }
1574 1.1.1.3.2.2 yamt
1575 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop1(struct sljit_compiler *compiler, int op,
1576 1.1.1.3.2.2 yamt int dst, sljit_w dstw,
1577 1.1.1.3.2.2 yamt int src, sljit_w srcw)
1578 1.1.1.3.2.2 yamt {
1579 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1580 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1581 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1582 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1583 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
1584 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
1585 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1586 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1587 1.1.1.3.2.2 yamt }
1588 1.1.1.3.2.2 yamt
1589 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sljit_compiler *compiler, int op,
1590 1.1.1.3.2.2 yamt int dst, sljit_w dstw,
1591 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1592 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1593 1.1.1.3.2.2 yamt {
1594 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1595 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1596 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1597 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1598 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1);
1599 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1w);
1600 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2);
1601 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2w);
1602 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1603 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1604 1.1.1.3.2.2 yamt }
1605 1.1.1.3.2.2 yamt
1606 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler)
1607 1.1.1.3.2.2 yamt {
1608 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1609 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1610 1.1.1.3.2.2 yamt return NULL;
1611 1.1.1.3.2.2 yamt }
1612 1.1.1.3.2.2 yamt
1613 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, int type)
1614 1.1.1.3.2.2 yamt {
1615 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1616 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1617 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1618 1.1.1.3.2.2 yamt return NULL;
1619 1.1.1.3.2.2 yamt }
1620 1.1.1.3.2.2 yamt
1621 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, int type,
1622 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1623 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1624 1.1.1.3.2.2 yamt {
1625 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1626 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1627 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1);
1628 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1w);
1629 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2);
1630 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2w);
1631 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1632 1.1.1.3.2.2 yamt return NULL;
1633 1.1.1.3.2.2 yamt }
1634 1.1.1.3.2.2 yamt
1635 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, int type,
1636 1.1.1.3.2.2 yamt int src1, sljit_w src1w,
1637 1.1.1.3.2.2 yamt int src2, sljit_w src2w)
1638 1.1.1.3.2.2 yamt {
1639 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1640 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1641 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1);
1642 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src1w);
1643 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2);
1644 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src2w);
1645 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1646 1.1.1.3.2.2 yamt return NULL;
1647 1.1.1.3.2.2 yamt }
1648 1.1.1.3.2.2 yamt
1649 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_set_label(struct sljit_jump *jump, struct sljit_label* label)
1650 1.1.1.3.2.2 yamt {
1651 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(jump);
1652 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(label);
1653 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1654 1.1.1.3.2.2 yamt }
1655 1.1.1.3.2.2 yamt
1656 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_set_target(struct sljit_jump *jump, sljit_uw target)
1657 1.1.1.3.2.2 yamt {
1658 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(jump);
1659 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(target);
1660 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1661 1.1.1.3.2.2 yamt }
1662 1.1.1.3.2.2 yamt
1663 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ijump(struct sljit_compiler *compiler, int type, int src, sljit_w srcw)
1664 1.1.1.3.2.2 yamt {
1665 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1666 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1667 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(src);
1668 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(srcw);
1669 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1670 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1671 1.1.1.3.2.2 yamt }
1672 1.1.1.3.2.2 yamt
1673 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_cond_value(struct sljit_compiler *compiler, int op, int dst, sljit_w dstw, int type)
1674 1.1.1.3.2.2 yamt {
1675 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1676 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(op);
1677 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1678 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1679 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(type);
1680 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1681 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1682 1.1.1.3.2.2 yamt }
1683 1.1.1.3.2.2 yamt
1684 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE int sljit_get_local_base(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w offset)
1685 1.1.1.3.2.2 yamt {
1686 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1687 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1688 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1689 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(offset);
1690 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1691 1.1.1.3.2.2 yamt return SLJIT_ERR_UNSUPPORTED;
1692 1.1.1.3.2.2 yamt }
1693 1.1.1.3.2.2 yamt
1694 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, int dst, sljit_w dstw, sljit_w initval)
1695 1.1.1.3.2.2 yamt {
1696 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(compiler);
1697 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dst);
1698 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(dstw);
1699 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(initval);
1700 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1701 1.1.1.3.2.2 yamt return NULL;
1702 1.1.1.3.2.2 yamt }
1703 1.1.1.3.2.2 yamt
1704 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_set_jump_addr(sljit_uw addr, sljit_uw new_addr)
1705 1.1.1.3.2.2 yamt {
1706 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(addr);
1707 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(new_addr);
1708 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1709 1.1.1.3.2.2 yamt }
1710 1.1.1.3.2.2 yamt
1711 1.1.1.3.2.2 yamt SLJIT_API_FUNC_ATTRIBUTE void sljit_set_const(sljit_uw addr, sljit_w new_constant)
1712 1.1.1.3.2.2 yamt {
1713 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(addr);
1714 1.1.1.3.2.2 yamt SLJIT_UNUSED_ARG(new_constant);
1715 1.1.1.3.2.2 yamt SLJIT_ASSERT_STOP();
1716 1.1.1.3.2.2 yamt }
1717 1.1.1.3.2.2 yamt
1718 1.1.1.3.2.2 yamt #endif
1719