/[pcre]/code/trunk/sljit/sljitLir.c
ViewVC logotype

Contents of /code/trunk/sljit/sljitLir.c

Parent Directory Parent Directory | Revision Log Revision Log


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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12