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