Annotation of embedaddon/pcre/sljit/sljitLir.c, revision 1.1.1.5

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>