diff options
author | zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2014-08-11 06:42:28 +0000 |
---|---|---|
committer | zherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2014-08-11 06:42:28 +0000 |
commit | 0e3018a0a1aabd41e4a012bb0f8b025454674b59 (patch) | |
tree | 3bab4de93c9dfd39d823c62471b3cc29575be11e /sljit | |
parent | fd411b0b71fc1d0bd1977d0a86e5711599f875d8 (diff) | |
download | pcre-0e3018a0a1aabd41e4a012bb0f8b025454674b59.tar.gz |
JIT compiler update.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1499 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'sljit')
-rw-r--r-- | sljit/sljitLir.c | 70 | ||||
-rw-r--r-- | sljit/sljitLir.h | 174 | ||||
-rw-r--r-- | sljit/sljitNativeARM_32.c | 10 | ||||
-rw-r--r-- | sljit/sljitNativeARM_64.c | 10 | ||||
-rw-r--r-- | sljit/sljitNativeARM_T2_32.c | 10 | ||||
-rw-r--r-- | sljit/sljitNativeMIPS_32.c | 8 | ||||
-rw-r--r-- | sljit/sljitNativeMIPS_64.c | 4 | ||||
-rw-r--r-- | sljit/sljitNativeMIPS_common.c | 24 | ||||
-rw-r--r-- | sljit/sljitNativePPC_common.c | 10 | ||||
-rw-r--r-- | sljit/sljitNativeSPARC_common.c | 10 | ||||
-rw-r--r-- | sljit/sljitNativeTILEGX_64.c | 10 | ||||
-rw-r--r-- | sljit/sljitNativeX86_32.c | 10 | ||||
-rw-r--r-- | sljit/sljitNativeX86_64.c | 10 |
13 files changed, 210 insertions, 150 deletions
diff --git a/sljit/sljitLir.c b/sljit/sljitLir.c index 29b6040..69c4b10 100644 --- a/sljit/sljitLir.c +++ b/sljit/sljitLir.c @@ -801,25 +801,32 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *comp fprintf(compiler->verbose, "fs%d", SLJIT_NUMBER_OF_FLOAT_REGISTERS - (p)); \ } -static SLJIT_CONST char* op_names[] = { - /* op0 */ +static SLJIT_CONST char* op0_names[] = { (char*)"breakpoint", (char*)"nop", (char*)"umul", (char*)"smul", (char*)"udiv", (char*)"sdiv", - /* op1 */ +}; + +static SLJIT_CONST char* op1_names[] = { (char*)"mov", (char*)"mov.ub", (char*)"mov.sb", (char*)"mov.uh", (char*)"mov.sh", (char*)"mov.ui", (char*)"mov.si", (char*)"mov.p", (char*)"movu", (char*)"movu.ub", (char*)"movu.sb", (char*)"movu.uh", (char*)"movu.sh", (char*)"movu.ui", (char*)"movu.si", (char*)"movu.p", (char*)"not", (char*)"neg", (char*)"clz", - /* op2 */ +}; + +static SLJIT_CONST char* op2_names[] = { (char*)"add", (char*)"addc", (char*)"sub", (char*)"subc", (char*)"mul", (char*)"and", (char*)"or", (char*)"xor", (char*)"shl", (char*)"lshr", (char*)"ashr", - /* fop1 */ - (char*)"mov", (char*)"neg", (char*)"abs", (char*)"conv", - (char*)"conv", (char*)"conv", (char*)"conv", (char*)"conv", - (char*)"cmp", - /* fop2 */ +}; + +static SLJIT_CONST char* fop1_names[] = { + (char*)"mov", (char*)"conv", (char*)"conv", (char*)"conv", + (char*)"conv", (char*)"conv", (char*)"cmp", (char*)"neg", + (char*)"abs", +}; + +static SLJIT_CONST char* fop2_names[] = { (char*)"add", (char*)"sub", (char*)"mul", (char*)"div" }; @@ -865,11 +872,12 @@ static SLJIT_INLINE void check_sljit_generate_code(struct sljit_compiler *compil } static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { /* If debug and verbose are disabled, all arguments are unused. */ SLJIT_UNUSED_ARG(compiler); + SLJIT_UNUSED_ARG(options); SLJIT_UNUSED_ARG(args); SLJIT_UNUSED_ARG(scratches); SLJIT_UNUSED_ARG(saveds); @@ -877,6 +885,7 @@ static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, SLJIT_UNUSED_ARG(fsaveds); SLJIT_UNUSED_ARG(local_size); + SLJIT_ASSERT(options == 0); SLJIT_ASSERT(args >= 0 && args <= 3); SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NUMBER_OF_REGISTERS); SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NUMBER_OF_REGISTERS); @@ -888,17 +897,18 @@ static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE); #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) - fprintf(compiler->verbose, " enter args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n", + fprintf(compiler->verbose, " enter options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n", args, scratches, saveds, fscratches, fsaveds, local_size); #endif } static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { /* If debug and verbose are disabled, all arguments are unused. */ SLJIT_UNUSED_ARG(compiler); + SLJIT_UNUSED_ARG(options); SLJIT_UNUSED_ARG(args); SLJIT_UNUSED_ARG(scratches); SLJIT_UNUSED_ARG(saveds); @@ -913,6 +923,7 @@ static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler } #endif + SLJIT_ASSERT(options == 0); SLJIT_ASSERT(args >= 0 && args <= 3); SLJIT_ASSERT(scratches >= 0 && scratches <= SLJIT_NUMBER_OF_REGISTERS); SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NUMBER_OF_REGISTERS); @@ -924,7 +935,7 @@ static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE); #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) - fprintf(compiler->verbose, " set_context args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n", + fprintf(compiler->verbose, " set_context options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n", args, scratches, saveds, fscratches, fsaveds, local_size); #endif } @@ -950,7 +961,7 @@ static SLJIT_INLINE void check_sljit_emit_return(struct sljit_compiler *compiler if (op == SLJIT_UNUSED) fprintf(compiler->verbose, " return\n"); else { - fprintf(compiler->verbose, " return %s ", op_names[op]); + fprintf(compiler->verbose, " return.%s ", op1_names[op - SLJIT_OP1_BASE]); sljit_verbose_param(compiler, src, srcw); fprintf(compiler->verbose, "\n"); } @@ -1007,7 +1018,7 @@ static SLJIT_INLINE void check_sljit_emit_op0(struct sljit_compiler *compiler, s SLJIT_ASSERT(op < SLJIT_UMUL || compiler->scratches >= 2); #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) - fprintf(compiler->verbose, " %s%s\n", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)]); + fprintf(compiler->verbose, " %s%s\n", !(op & SLJIT_INT_OP) ? "" : "i", op0_names[GET_OPCODE(op) - SLJIT_OP0_BASE]); #endif } @@ -1039,7 +1050,7 @@ static SLJIT_INLINE void check_sljit_emit_op1(struct sljit_compiler *compiler, s #endif #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) { - fprintf(compiler->verbose, " %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)], + fprintf(compiler->verbose, " %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE], !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s", !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k"); sljit_verbose_param(compiler, dst, dstw); @@ -1081,7 +1092,7 @@ static SLJIT_INLINE void check_sljit_emit_op2(struct sljit_compiler *compiler, s #endif #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) { - fprintf(compiler->verbose, " %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op_names[GET_OPCODE(op)], + fprintf(compiler->verbose, " %s%s%s%s%s%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE], !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_U) ? "" : ".u", !(op & SLJIT_SET_S) ? "" : ".s", !(op & SLJIT_SET_O) ? "" : ".o", !(op & SLJIT_SET_C) ? "" : ".c", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k"); sljit_verbose_param(compiler, dst, dstw); @@ -1117,9 +1128,9 @@ static SLJIT_INLINE void check_sljit_emit_op_custom(struct sljit_compiler *compi #define SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw) \ SLJIT_ASSERT(sljit_is_fpu_available()); \ - SLJIT_COMPILE_ASSERT(!(SLJIT_CONVW_FROMD & 0x1) && !(SLJIT_CONVD_FROMW & 0x1) && (SLJIT_MOVD < SLJIT_CONVW_FROMD), \ + SLJIT_COMPILE_ASSERT(!(SLJIT_CONVW_FROMD & 0x1) && !(SLJIT_CONVD_FROMW & 0x1), \ invalid_float_opcodes); \ - if (GET_OPCODE(op) >= SLJIT_CONVW_FROMD) { \ + if (GET_OPCODE(op) >= SLJIT_CONVW_FROMD && GET_OPCODE(op) <= SLJIT_CMPD) { \ if (GET_OPCODE(op) == SLJIT_CMPD) { \ check_sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw); \ ADJUST_LOCAL_OFFSET(dst, dstw); \ @@ -1160,7 +1171,7 @@ static SLJIT_INLINE void check_sljit_emit_fop1(struct sljit_compiler *compiler, } #endif - SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_MOVD && GET_OPCODE(op) <= SLJIT_CONVD_FROMS); + SLJIT_ASSERT(GET_OPCODE(op) >= SLJIT_MOVD && GET_OPCODE(op) <= SLJIT_ABSD); #if (defined SLJIT_DEBUG && SLJIT_DEBUG) FUNCTION_CHECK_FOP(); FUNCTION_FCHECK(src, srcw); @@ -1168,7 +1179,7 @@ static SLJIT_INLINE void check_sljit_emit_fop1(struct sljit_compiler *compiler, #endif #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) { - fprintf(compiler->verbose, " %s%s ", op_names[GET_OPCODE(op)], + fprintf(compiler->verbose, " %s%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE], (GET_OPCODE(op) == SLJIT_CONVD_FROMS) ? ((op & SLJIT_SINGLE_OP) ? "s.fromd" : "d.froms") : ((op & SLJIT_SINGLE_OP) ? "s" : "d")); @@ -1207,7 +1218,7 @@ static SLJIT_INLINE void check_sljit_emit_fop1_cmp(struct sljit_compiler *compil #endif #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) { - fprintf(compiler->verbose, " %s%s%s%s ", op_names[GET_OPCODE(op)], (op & SLJIT_SINGLE_OP) ? "s" : "d", + fprintf(compiler->verbose, " %s%s%s%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE], (op & SLJIT_SINGLE_OP) ? "s" : "d", !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_SET_S) ? "" : ".s"); sljit_verbose_fparam(compiler, src1, src1w); fprintf(compiler->verbose, ", "); @@ -1244,7 +1255,7 @@ static SLJIT_INLINE void check_sljit_emit_fop1_convw_fromd(struct sljit_compiler #endif #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) { - fprintf(compiler->verbose, " %s%s.from%s ", op_names[GET_OPCODE(op)], + fprintf(compiler->verbose, " %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE], (GET_OPCODE(op) == SLJIT_CONVI_FROMD) ? "i" : "w", (op & SLJIT_SINGLE_OP) ? "s" : "d"); sljit_verbose_param(compiler, dst, dstw); @@ -1282,7 +1293,7 @@ static SLJIT_INLINE void check_sljit_emit_fop1_convd_fromw(struct sljit_compiler #endif #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) { - fprintf(compiler->verbose, " %s%s.from%s ", op_names[GET_OPCODE(op)], + fprintf(compiler->verbose, " %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE], (op & SLJIT_SINGLE_OP) ? "s" : "d", (GET_OPCODE(op) == SLJIT_CONVD_FROMI) ? "i" : "w"); sljit_verbose_fparam(compiler, dst, dstw); @@ -1318,7 +1329,7 @@ static SLJIT_INLINE void check_sljit_emit_fop2(struct sljit_compiler *compiler, #endif #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) { - fprintf(compiler->verbose, " %s%s ", op_names[GET_OPCODE(op)], (op & SLJIT_SINGLE_OP) ? "s" : "d"); + fprintf(compiler->verbose, " %s%s ", fop2_names[GET_OPCODE(op) - SLJIT_FOP2_BASE], (op & SLJIT_SINGLE_OP) ? "s" : "d"); sljit_verbose_fparam(compiler, dst, dstw); fprintf(compiler->verbose, ", "); sljit_verbose_fparam(compiler, src1, src1w); @@ -1477,7 +1488,8 @@ static SLJIT_INLINE void check_sljit_emit_op_flags(struct sljit_compiler *compil #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) if (SLJIT_UNLIKELY(!!compiler->verbose)) { fprintf(compiler->verbose, " %sflags.%s%s%s ", !(op & SLJIT_INT_OP) ? "" : "i", - op_names[GET_OPCODE(op)], !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k"); + GET_OPCODE(op) >= SLJIT_OP2_BASE ? op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE] : op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE], + !(op & SLJIT_SET_E) ? "" : ".e", !(op & SLJIT_KEEP_FLAGS) ? "" : ".k"); sljit_verbose_param(compiler, dst, dstw); if (src != SLJIT_UNUSED) { fprintf(compiler->verbose, ", "); @@ -1772,10 +1784,11 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code) } SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { SLJIT_UNUSED_ARG(compiler); + SLJIT_UNUSED_ARG(options); SLJIT_UNUSED_ARG(args); SLJIT_UNUSED_ARG(scratches); SLJIT_UNUSED_ARG(saveds); @@ -1787,10 +1800,11 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { SLJIT_UNUSED_ARG(compiler); + SLJIT_UNUSED_ARG(options); SLJIT_UNUSED_ARG(args); SLJIT_UNUSED_ARG(scratches); SLJIT_UNUSED_ARG(saveds); diff --git a/sljit/sljitLir.h b/sljit/sljitLir.h index 50e47fb..9718871 100644 --- a/sljit/sljitLir.h +++ b/sljit/sljitLir.h @@ -260,6 +260,11 @@ of sljitConfigInternal.h */ /* Main structures and functions */ /* --------------------------------------------------------------------- */ +/* + The following structures are private, and can be changed in the + future. Keeping them here allows code inlining. +*/ + struct sljit_memory_fragment { struct sljit_memory_fragment *next; sljit_uw used_size; @@ -291,6 +296,7 @@ struct sljit_const { struct sljit_compiler { sljit_si error; + sljit_si options; struct sljit_label *labels; struct sljit_jump *jumps; @@ -454,23 +460,26 @@ static SLJIT_INLINE sljit_uw sljit_get_generated_code_size(struct sljit_compiler all machine registers and stack handling among other things. The sljit_emit_enter function emits the necessary instructions for setting up a new context for the executable code and moves function - arguments to the saved registers. The number of sljit_sw arguments - passed to the function are specified in the "args" parameter. The - number of arguments must be less than or equal to 3. The first - argument goes to SLJIT_S0, the second goes to SLJIT_S1 and so on. - The register set used by the function must be declared as well. - The number of scratch and saved registers used by the function must - be passed to sljit_emit_enter. Only R registers between R0 and - "scratches" argument can be used later. E.g. if "scratches" is set - to 2, the register set will be limited to R0 and R1. The S registers - and the floating point registers ("fscratches" and "fsaveds") - are specified in a similar way. The sljit_emit_enter is also capable - of allocating a stack space for local variables. The "local_size" - argument contains the size in bytes of this local area and its - staring address is stored in SLJIT_SP. The memory area between - SLJIT_SP (inclusive) and SLJIT_SP + local_size (exclusive) can be - modified freely until the function returns. The stack space is not - initialized. + arguments to the saved registers. Furthermore the options argument + can be used to pass configuration options to the compiler. Currently + there are no options, so it must be set to 0. + + The number of sljit_sw arguments passed to the generated function + are specified in the "args" parameter. The number of arguments must + be less than or equal to 3. The first argument goes to SLJIT_S0, + the second goes to SLJIT_S1 and so on. The register set used by + the function must be declared as well. The number of scratch and + saved registers used by the function must be passed to sljit_emit_enter. + Only R registers between R0 and "scratches" argument can be used + later. E.g. if "scratches" is set to 2, the register set will be + limited to R0 and R1. The S registers and the floating point + registers ("fscratches" and "fsaveds") are specified in a similar + way. The sljit_emit_enter is also capable of allocating a stack + space for local variables. The "local_size" argument contains the + size in bytes of this local area and its staring address is stored + in SLJIT_SP. The memory area between SLJIT_SP (inclusive) and + SLJIT_SP + local_size (exclusive) can be modified freely until + the function returns. The stack space is not initialized. Note: the following conditions must met: 0 <= scratches <= SLJIT_NUMBER_OF_REGISTERS @@ -487,7 +496,7 @@ static SLJIT_INLINE sljit_uw sljit_get_generated_code_size(struct sljit_compiler #define SLJIT_MAX_LOCAL_SIZE 65536 SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size); /* The machine code has a context (which contains the local stack space size, @@ -501,7 +510,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil the previous context. */ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size); /* Return from machine code. The op argument can be SLJIT_UNUSED which means the @@ -651,37 +660,43 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fast_return(struct sljit_compiler * the instruction does not set flags (See: SLJIT_KEEP_FLAGS). - flag combinations: '|' means 'logical or'. */ +/* Starting index of opcodes for sljit_emit_op0. */ +#define SLJIT_OP0_BASE 0 + /* Flags: - (never set any flags) Note: breakpoint instruction is not supported by all architectures (namely ppc) It falls back to SLJIT_NOP in those cases. */ -#define SLJIT_BREAKPOINT 0 +#define SLJIT_BREAKPOINT (SLJIT_OP0_BASE + 0) /* Flags: - (never set any flags) Note: may or may not cause an extra cycle wait it can even decrease the runtime in a few cases. */ -#define SLJIT_NOP 1 +#define SLJIT_NOP (SLJIT_OP0_BASE + 1) /* Flags: - (may destroy flags) Unsigned multiplication of SLJIT_R0 and SLJIT_R1. Result goes to SLJIT_R1:SLJIT_R0 (high:low) word */ -#define SLJIT_UMUL 2 +#define SLJIT_UMUL (SLJIT_OP0_BASE + 2) /* Flags: - (may destroy flags) Signed multiplication of SLJIT_R0 and SLJIT_R1. Result goes to SLJIT_R1:SLJIT_R0 (high:low) word */ -#define SLJIT_SMUL 3 +#define SLJIT_SMUL (SLJIT_OP0_BASE + 3) /* Flags: I - (may destroy flags) Unsigned divide of the value in SLJIT_R0 by the value in SLJIT_R1. The result is placed in SLJIT_R0 and the remainder goes to SLJIT_R1. Note: if SLJIT_R1 contains 0, the behaviour is undefined. */ -#define SLJIT_UDIV 4 +#define SLJIT_UDIV (SLJIT_OP0_BASE + 4) #define SLJIT_IUDIV (SLJIT_UDIV | SLJIT_INT_OP) /* Flags: I - (may destroy flags) Signed divide of the value in SLJIT_R0 by the value in SLJIT_R1. The result is placed in SLJIT_R0 and the remainder goes to SLJIT_R1. Note: if SLJIT_R1 contains 0, the behaviour is undefined. */ -#define SLJIT_SDIV 5 +#define SLJIT_SDIV (SLJIT_OP0_BASE + 5) #define SLJIT_ISDIV (SLJIT_SDIV | SLJIT_INT_OP) SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler, sljit_si op); +/* Starting index of opcodes for sljit_emit_op1. */ +#define SLJIT_OP1_BASE 32 + /* Notes for MOV instructions: U = Mov with update (pre form). If source or destination defined as SLJIT_MEM1(r1) or SLJIT_MEM2(r1, r2), r1 is increased by the sum of r2 and the constant argument @@ -694,115 +709,118 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler P = pointer (sljit_p) size */ /* Flags: - (never set any flags) */ -#define SLJIT_MOV 6 +#define SLJIT_MOV (SLJIT_OP1_BASE + 0) /* Flags: I - (never set any flags) */ -#define SLJIT_MOV_UB 7 +#define SLJIT_MOV_UB (SLJIT_OP1_BASE + 1) #define SLJIT_IMOV_UB (SLJIT_MOV_UB | SLJIT_INT_OP) /* Flags: I - (never set any flags) */ -#define SLJIT_MOV_SB 8 +#define SLJIT_MOV_SB (SLJIT_OP1_BASE + 2) #define SLJIT_IMOV_SB (SLJIT_MOV_SB | SLJIT_INT_OP) /* Flags: I - (never set any flags) */ -#define SLJIT_MOV_UH 9 +#define SLJIT_MOV_UH (SLJIT_OP1_BASE + 3) #define SLJIT_IMOV_UH (SLJIT_MOV_UH | SLJIT_INT_OP) /* Flags: I - (never set any flags) */ -#define SLJIT_MOV_SH 10 +#define SLJIT_MOV_SH (SLJIT_OP1_BASE + 4) #define SLJIT_IMOV_SH (SLJIT_MOV_SH | SLJIT_INT_OP) /* Flags: I - (never set any flags) Note: see SLJIT_INT_OP for further details. */ -#define SLJIT_MOV_UI 11 +#define SLJIT_MOV_UI (SLJIT_OP1_BASE + 5) /* No SLJIT_INT_OP form, since it is the same as SLJIT_IMOV. */ /* Flags: I - (never set any flags) Note: see SLJIT_INT_OP for further details. */ -#define SLJIT_MOV_SI 12 +#define SLJIT_MOV_SI (SLJIT_OP1_BASE + 6) #define SLJIT_IMOV (SLJIT_MOV_SI | SLJIT_INT_OP) /* Flags: - (never set any flags) */ -#define SLJIT_MOV_P 13 +#define SLJIT_MOV_P (SLJIT_OP1_BASE + 7) /* Flags: - (never set any flags) */ -#define SLJIT_MOVU 14 +#define SLJIT_MOVU (SLJIT_OP1_BASE + 8) /* Flags: I - (never set any flags) */ -#define SLJIT_MOVU_UB 15 +#define SLJIT_MOVU_UB (SLJIT_OP1_BASE + 9) #define SLJIT_IMOVU_UB (SLJIT_MOVU_UB | SLJIT_INT_OP) /* Flags: I - (never set any flags) */ -#define SLJIT_MOVU_SB 16 +#define SLJIT_MOVU_SB (SLJIT_OP1_BASE + 10) #define SLJIT_IMOVU_SB (SLJIT_MOVU_SB | SLJIT_INT_OP) /* Flags: I - (never set any flags) */ -#define SLJIT_MOVU_UH 17 +#define SLJIT_MOVU_UH (SLJIT_OP1_BASE + 11) #define SLJIT_IMOVU_UH (SLJIT_MOVU_UH | SLJIT_INT_OP) /* Flags: I - (never set any flags) */ -#define SLJIT_MOVU_SH 18 +#define SLJIT_MOVU_SH (SLJIT_OP1_BASE + 12) #define SLJIT_IMOVU_SH (SLJIT_MOVU_SH | SLJIT_INT_OP) /* Flags: I - (never set any flags) Note: see SLJIT_INT_OP for further details. */ -#define SLJIT_MOVU_UI 19 +#define SLJIT_MOVU_UI (SLJIT_OP1_BASE + 13) /* No SLJIT_INT_OP form, since it is the same as SLJIT_IMOVU. */ /* Flags: I - (never set any flags) Note: see SLJIT_INT_OP for further details. */ -#define SLJIT_MOVU_SI 20 +#define SLJIT_MOVU_SI (SLJIT_OP1_BASE + 14) #define SLJIT_IMOVU (SLJIT_MOVU_SI | SLJIT_INT_OP) /* Flags: - (never set any flags) */ -#define SLJIT_MOVU_P 21 +#define SLJIT_MOVU_P (SLJIT_OP1_BASE + 15) /* Flags: I | E | K */ -#define SLJIT_NOT 22 +#define SLJIT_NOT (SLJIT_OP1_BASE + 16) #define SLJIT_INOT (SLJIT_NOT | SLJIT_INT_OP) /* Flags: I | E | O | K */ -#define SLJIT_NEG 23 +#define SLJIT_NEG (SLJIT_OP1_BASE + 17) #define SLJIT_INEG (SLJIT_NEG | SLJIT_INT_OP) /* Count leading zeroes Flags: I | E | K Important note! Sparc 32 does not support K flag, since the required popc instruction is introduced only in sparc 64. */ -#define SLJIT_CLZ 24 +#define SLJIT_CLZ (SLJIT_OP1_BASE + 18) #define SLJIT_ICLZ (SLJIT_CLZ | SLJIT_INT_OP) SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op1(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src, sljit_sw srcw); +/* Starting index of opcodes for sljit_emit_op2. */ +#define SLJIT_OP2_BASE 96 + /* Flags: I | E | O | C | K */ -#define SLJIT_ADD 25 +#define SLJIT_ADD (SLJIT_OP2_BASE + 0) #define SLJIT_IADD (SLJIT_ADD | SLJIT_INT_OP) /* Flags: I | C | K */ -#define SLJIT_ADDC 26 +#define SLJIT_ADDC (SLJIT_OP2_BASE + 1) #define SLJIT_IADDC (SLJIT_ADDC | SLJIT_INT_OP) /* Flags: I | E | U | S | O | C | K */ -#define SLJIT_SUB 27 +#define SLJIT_SUB (SLJIT_OP2_BASE + 2) #define SLJIT_ISUB (SLJIT_SUB | SLJIT_INT_OP) /* Flags: I | C | K */ -#define SLJIT_SUBC 28 +#define SLJIT_SUBC (SLJIT_OP2_BASE + 3) #define SLJIT_ISUBC (SLJIT_SUBC | SLJIT_INT_OP) /* Note: integer mul Flags: I | O (see SLJIT_C_MUL_*) | K */ -#define SLJIT_MUL 29 +#define SLJIT_MUL (SLJIT_OP2_BASE + 4) #define SLJIT_IMUL (SLJIT_MUL | SLJIT_INT_OP) /* Flags: I | E | K */ -#define SLJIT_AND 30 +#define SLJIT_AND (SLJIT_OP2_BASE + 5) #define SLJIT_IAND (SLJIT_AND | SLJIT_INT_OP) /* Flags: I | E | K */ -#define SLJIT_OR 31 +#define SLJIT_OR (SLJIT_OP2_BASE + 6) #define SLJIT_IOR (SLJIT_OR | SLJIT_INT_OP) /* Flags: I | E | K */ -#define SLJIT_XOR 32 +#define SLJIT_XOR (SLJIT_OP2_BASE + 7) #define SLJIT_IXOR (SLJIT_XOR | SLJIT_INT_OP) /* Flags: I | E | K Let bit_length be the length of the shift operation: 32 or 64. If src2 is immediate, src2w is masked by (bit_length - 1). Otherwise, if the content of src2 is outside the range from 0 - to bit_length - 1, the operation is undefined. */ -#define SLJIT_SHL 33 + to bit_length - 1, the result is undefined. */ +#define SLJIT_SHL (SLJIT_OP2_BASE + 8) #define SLJIT_ISHL (SLJIT_SHL | SLJIT_INT_OP) /* Flags: I | E | K Let bit_length be the length of the shift operation: 32 or 64. If src2 is immediate, src2w is masked by (bit_length - 1). Otherwise, if the content of src2 is outside the range from 0 - to bit_length - 1, the operation is undefined. */ -#define SLJIT_LSHR 34 + to bit_length - 1, the result is undefined. */ +#define SLJIT_LSHR (SLJIT_OP2_BASE + 9) #define SLJIT_ILSHR (SLJIT_LSHR | SLJIT_INT_OP) /* Flags: I | E | K Let bit_length be the length of the shift operation: 32 or 64. If src2 is immediate, src2w is masked by (bit_length - 1). Otherwise, if the content of src2 is outside the range from 0 - to bit_length - 1, the operation is undefined. */ -#define SLJIT_ASHR 35 + to bit_length - 1, the result is undefined. */ +#define SLJIT_ASHR (SLJIT_OP2_BASE + 10) #define SLJIT_IASHR (SLJIT_ASHR | SLJIT_INT_OP) SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler, sljit_si op, @@ -842,55 +860,61 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *co SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_is_fpu_available(void); +/* Starting index of opcodes for sljit_emit_fop1. */ +#define SLJIT_FOP1_BASE 128 + /* Flags: SP - (never set any flags) */ -#define SLJIT_MOVD 36 +#define SLJIT_MOVD (SLJIT_FOP1_BASE + 0) #define SLJIT_MOVS (SLJIT_MOVD | SLJIT_SINGLE_OP) -/* Flags: SP - (never set any flags) */ -#define SLJIT_NEGD 37 -#define SLJIT_NEGS (SLJIT_NEGD | SLJIT_SINGLE_OP) -/* Flags: SP - (never set any flags) */ -#define SLJIT_ABSD 38 -#define SLJIT_ABSS (SLJIT_ABSD | SLJIT_SINGLE_OP) /* Convert opcodes: CONV[DST_TYPE].FROM[SRC_TYPE] SRC/DST TYPE can be: D - double, S - single, W - signed word, I - signed int Rounding mode when the destination is W or I: round towards zero. */ /* Flags: SP - (never set any flags) */ -#define SLJIT_CONVD_FROMS 39 +#define SLJIT_CONVD_FROMS (SLJIT_FOP1_BASE + 1) #define SLJIT_CONVS_FROMD (SLJIT_CONVD_FROMS | SLJIT_SINGLE_OP) /* Flags: SP - (never set any flags) */ -#define SLJIT_CONVW_FROMD 40 +#define SLJIT_CONVW_FROMD (SLJIT_FOP1_BASE + 2) #define SLJIT_CONVW_FROMS (SLJIT_CONVW_FROMD | SLJIT_SINGLE_OP) /* Flags: SP - (never set any flags) */ -#define SLJIT_CONVI_FROMD 41 +#define SLJIT_CONVI_FROMD (SLJIT_FOP1_BASE + 3) #define SLJIT_CONVI_FROMS (SLJIT_CONVI_FROMD | SLJIT_SINGLE_OP) /* Flags: SP - (never set any flags) */ -#define SLJIT_CONVD_FROMW 42 +#define SLJIT_CONVD_FROMW (SLJIT_FOP1_BASE + 4) #define SLJIT_CONVS_FROMW (SLJIT_CONVD_FROMW | SLJIT_SINGLE_OP) /* Flags: SP - (never set any flags) */ -#define SLJIT_CONVD_FROMI 43 +#define SLJIT_CONVD_FROMI (SLJIT_FOP1_BASE + 5) #define SLJIT_CONVS_FROMI (SLJIT_CONVD_FROMI | SLJIT_SINGLE_OP) /* Note: dst is the left and src is the right operand for SLJIT_CMPD. Note: NaN check is always performed. If SLJIT_C_FLOAT_UNORDERED flag is set, the comparison result is unpredictable. Flags: SP | E | S (see SLJIT_C_FLOAT_*) */ -#define SLJIT_CMPD 44 +#define SLJIT_CMPD (SLJIT_FOP1_BASE + 6) #define SLJIT_CMPS (SLJIT_CMPD | SLJIT_SINGLE_OP) +/* Flags: SP - (never set any flags) */ +#define SLJIT_NEGD (SLJIT_FOP1_BASE + 7) +#define SLJIT_NEGS (SLJIT_NEGD | SLJIT_SINGLE_OP) +/* Flags: SP - (never set any flags) */ +#define SLJIT_ABSD (SLJIT_FOP1_BASE + 8) +#define SLJIT_ABSS (SLJIT_ABSD | SLJIT_SINGLE_OP) SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop1(struct sljit_compiler *compiler, sljit_si op, sljit_si dst, sljit_sw dstw, sljit_si src, sljit_sw srcw); +/* Starting index of opcodes for sljit_emit_fop2. */ +#define SLJIT_FOP2_BASE 160 + /* Flags: SP - (never set any flags) */ -#define SLJIT_ADDD 45 +#define SLJIT_ADDD (SLJIT_FOP2_BASE + 0) #define SLJIT_ADDS (SLJIT_ADDD | SLJIT_SINGLE_OP) /* Flags: SP - (never set any flags) */ -#define SLJIT_SUBD 46 +#define SLJIT_SUBD (SLJIT_FOP2_BASE + 1) #define SLJIT_SUBS (SLJIT_SUBD | SLJIT_SINGLE_OP) /* Flags: SP - (never set any flags) */ -#define SLJIT_MULD 47 +#define SLJIT_MULD (SLJIT_FOP2_BASE + 2) #define SLJIT_MULS (SLJIT_MULD | SLJIT_SINGLE_OP) /* Flags: SP - (never set any flags) */ -#define SLJIT_DIVD 48 +#define SLJIT_DIVD (SLJIT_FOP2_BASE + 3) #define SLJIT_DIVS (SLJIT_DIVD | SLJIT_SINGLE_OP) SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_fop2(struct sljit_compiler *compiler, sljit_si op, diff --git a/sljit/sljitNativeARM_32.c b/sljit/sljitNativeARM_32.c index 265e155..0998423 100644 --- a/sljit/sljitNativeARM_32.c +++ b/sljit/sljitNativeARM_32.c @@ -824,15 +824,16 @@ static sljit_si emit_op(struct sljit_compiler *compiler, sljit_si op, sljit_si i sljit_si src2, sljit_sw src2w); SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si size, i, tmp; sljit_uw push; CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -872,14 +873,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si size; CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; diff --git a/sljit/sljitNativeARM_64.c b/sljit/sljitNativeARM_64.c index cad4c2e..fba664e 100644 --- a/sljit/sljitNativeARM_64.c +++ b/sljit/sljitNativeARM_64.c @@ -1062,14 +1062,15 @@ static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit /* --------------------------------------------------------------------- */ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si i, tmp, offs, prev; CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -1134,12 +1135,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; diff --git a/sljit/sljitNativeARM_T2_32.c b/sljit/sljitNativeARM_T2_32.c index 6a714f8..7ea8cd7 100644 --- a/sljit/sljitNativeARM_T2_32.c +++ b/sljit/sljitNativeARM_T2_32.c @@ -1128,15 +1128,16 @@ static SLJIT_INLINE sljit_si emit_op_mem2(struct sljit_compiler *compiler, sljit /* --------------------------------------------------------------------- */ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si size, i, tmp; sljit_ins push; CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -1180,14 +1181,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si size; CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; diff --git a/sljit/sljitNativeMIPS_32.c b/sljit/sljitNativeMIPS_32.c index 55b1f33..b2b60d7 100644 --- a/sljit/sljitNativeMIPS_32.c +++ b/sljit/sljitNativeMIPS_32.c @@ -84,7 +84,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM)); if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) { if (op == SLJIT_MOV_SB) { -#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) +#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) return push_inst(compiler, SEB | T(src2) | D(dst), DR(dst)); #else FAIL_IF(push_inst(compiler, SLL | T(src2) | D(dst) | SH_IMM(24), DR(dst))); @@ -102,7 +102,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM)); if ((flags & (REG_DEST | REG2_SOURCE)) == (REG_DEST | REG2_SOURCE)) { if (op == SLJIT_MOV_SH) { -#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) +#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) return push_inst(compiler, SEH | T(src2) | D(dst), DR(dst)); #else FAIL_IF(push_inst(compiler, SLL | T(src2) | D(dst) | SH_IMM(16), DR(dst))); @@ -125,7 +125,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj case SLJIT_CLZ: SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM)); -#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) +#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) if (op & SLJIT_SET_E) FAIL_IF(push_inst(compiler, CLZ | S(src2) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG)); if (CHECK_FLAGS(SLJIT_SET_E)) @@ -299,7 +299,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj case SLJIT_MUL: SLJIT_ASSERT(!(flags & SRC2_IMM)); if (!(op & SLJIT_SET_O)) { -#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) +#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) return push_inst(compiler, MUL | S(src1) | T(src2) | D(dst), DR(dst)); #else FAIL_IF(push_inst(compiler, MULT | S(src1) | T(src2), MOVABLE_INS)); diff --git a/sljit/sljitNativeMIPS_64.c b/sljit/sljitNativeMIPS_64.c index 1c5ca15..185fb57 100644 --- a/sljit/sljitNativeMIPS_64.c +++ b/sljit/sljitNativeMIPS_64.c @@ -217,7 +217,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj case SLJIT_CLZ: SLJIT_ASSERT(src1 == TMP_REG1 && !(flags & SRC2_IMM)); -#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) +#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) if (op & SLJIT_SET_E) FAIL_IF(push_inst(compiler, SELECT_OP(DCLZ, CLZ) | S(src2) | TA(EQUAL_FLAG) | DA(EQUAL_FLAG), EQUAL_FLAG)); if (CHECK_FLAGS(SLJIT_SET_E)) @@ -391,7 +391,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj case SLJIT_MUL: SLJIT_ASSERT(!(flags & SRC2_IMM)); if (!(op & SLJIT_SET_O)) { -#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) +#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) if (op & SLJIT_INT_OP) return push_inst(compiler, MUL | S(src1) | T(src2) | D(dst), DR(dst)); FAIL_IF(push_inst(compiler, DMULT | S(src1) | T(src2), MOVABLE_INS)); diff --git a/sljit/sljitNativeMIPS_common.c b/sljit/sljitNativeMIPS_common.c index 6ba356c..f1f9f70 100644 --- a/sljit/sljitNativeMIPS_common.c +++ b/sljit/sljitNativeMIPS_common.c @@ -25,13 +25,17 @@ */ /* Latest MIPS architecture. */ -/* Automatically detect SLJIT_MIPS_32_64 */ +/* Automatically detect SLJIT_MIPS_R1 */ SLJIT_API_FUNC_ATTRIBUTE SLJIT_CONST char* sljit_get_platform_name(void) { -#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) - return "MIPS V" SLJIT_CPUINFO; +#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) +#if (defined SLJIT_CONFIG_MIPS_32 && SLJIT_CONFIG_MIPS_32) + return "MIPS32-R1" SLJIT_CPUINFO; #else + return "MIPS64-R1" SLJIT_CPUINFO; +#endif +#else /* SLJIT_MIPS_R1 */ return "MIPS III" SLJIT_CPUINFO; #endif } @@ -171,7 +175,7 @@ static SLJIT_CONST sljit_ub reg_map[SLJIT_NUMBER_OF_REGISTERS + 5] = { #define XOR (HI(0) | LO(38)) #define XORI (HI(14)) -#if (defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) +#if (defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) #define CLZ (HI(28) | LO(32)) #define DCLZ (HI(28) | LO(36)) #define MUL (HI(28) | LO(2)) @@ -535,15 +539,16 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil #endif SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_ins base; sljit_si i, tmp, offs; CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -598,12 +603,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -1064,7 +1070,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op0(struct sljit_compiler *compiler return push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1)); case SLJIT_UDIV: case SLJIT_SDIV: -#if !(defined SLJIT_MIPS_32_64 && SLJIT_MIPS_32_64) +#if !(defined SLJIT_MIPS_R1 && SLJIT_MIPS_R1) FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); #endif diff --git a/sljit/sljitNativePPC_common.c b/sljit/sljitNativePPC_common.c index 8a81375..01cb771 100644 --- a/sljit/sljitNativePPC_common.c +++ b/sljit/sljitNativePPC_common.c @@ -572,14 +572,15 @@ ALT_FORM6 0x200000 */ #endif SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si i, tmp, offs; CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -643,12 +644,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; diff --git a/sljit/sljitNativeSPARC_common.c b/sljit/sljitNativeSPARC_common.c index 3d8ab3c..8926a60 100644 --- a/sljit/sljitNativeSPARC_common.c +++ b/sljit/sljitNativeSPARC_common.c @@ -419,12 +419,13 @@ SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compil #endif SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -450,12 +451,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; diff --git a/sljit/sljitNativeTILEGX_64.c b/sljit/sljitNativeTILEGX_64.c index d438c63..fb4cd38 100644 --- a/sljit/sljitNativeTILEGX_64.c +++ b/sljit/sljitNativeTILEGX_64.c @@ -1174,15 +1174,16 @@ static sljit_si emit_const_64(struct sljit_compiler *compiler, sljit_si dst_ar, } SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_ins base; sljit_ins bundle = 0; CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -1238,12 +1239,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; diff --git a/sljit/sljitNativeX86_32.c b/sljit/sljitNativeX86_32.c index fb68706..515bf7e 100644 --- a/sljit/sljitNativeX86_32.c +++ b/sljit/sljitNativeX86_32.c @@ -64,15 +64,16 @@ static sljit_ub* generate_far_jump_code(struct sljit_jump *jump, sljit_ub *code_ } SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si size; sljit_ub *inst; CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -171,12 +172,13 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; diff --git a/sljit/sljitNativeX86_64.c b/sljit/sljitNativeX86_64.c index 39eb9e5..f356f1c 100644 --- a/sljit/sljitNativeX86_64.c +++ b/sljit/sljitNativeX86_64.c @@ -88,15 +88,16 @@ static sljit_ub* generate_fixed_jump(sljit_ub *code_ptr, sljit_sw addr, sljit_si } SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si i, tmp, size, saved_register_size; sljit_ub *inst; CHECK_ERROR(); - check_sljit_emit_enter(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; @@ -243,14 +244,15 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil } SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, - sljit_si args, sljit_si scratches, sljit_si saveds, + sljit_si options, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si fscratches, sljit_si fsaveds, sljit_si local_size) { sljit_si saved_register_size; CHECK_ERROR_VOID(); - check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size); + check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); + compiler->options = options; compiler->scratches = scratches; compiler->saveds = saveds; compiler->fscratches = fscratches; |