version 1.1.1.2, 2012/02/21 23:50:25
|
version 1.1.1.3, 2012/10/09 09:19:18
|
Line 830 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
Line 830 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
|
|
compiler->temporaries = temporaries; |
compiler->temporaries = temporaries; |
compiler->saveds = saveds; |
compiler->saveds = saveds; |
|
#if (defined SLJIT_DEBUG && SLJIT_DEBUG) |
|
compiler->logical_local_size = local_size; |
|
#endif |
|
|
/* Push saved registers, temporary registers |
/* Push saved registers, temporary registers |
stmdb sp!, {..., lr} */ |
stmdb sp!, {..., lr} */ |
Line 880 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct
|
Line 883 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct
|
|
|
compiler->temporaries = temporaries; |
compiler->temporaries = temporaries; |
compiler->saveds = saveds; |
compiler->saveds = saveds; |
|
#if (defined SLJIT_DEBUG && SLJIT_DEBUG) |
|
compiler->logical_local_size = local_size; |
|
#endif |
|
|
size = (1 + saveds) * sizeof(sljit_uw); |
size = (1 + saveds) * sizeof(sljit_uw); |
if (temporaries >= 4) |
if (temporaries >= 4) |
Line 896 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct
|
Line 902 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct
|
|
|
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_return(compiler, op, src, srcw); |
check_sljit_emit_return(compiler, op, src, srcw); |
|
ADJUST_LOCAL_OFFSET(src, srcw); |
|
|
FAIL_IF(emit_mov_before_return(compiler, op, src, srcw)); |
FAIL_IF(emit_mov_before_return(compiler, op, src, srcw)); |
|
|
Line 1648 static int emit_op(struct sljit_compiler *compiler, in
|
Line 1655 static int emit_op(struct sljit_compiler *compiler, in
|
src2 = src1; |
src2 = src1; |
src2w = src1w; |
src2w = src1w; |
} |
} |
else { | else do { /* do { } while(0) is used because of breaks. */ |
| src1_r = 0; |
if ((inp_flags & ALLOW_ANY_IMM) && (src1 & SLJIT_IMM)) { |
if ((inp_flags & ALLOW_ANY_IMM) && (src1 & SLJIT_IMM)) { |
/* The second check will generate a hit. */ |
/* The second check will generate a hit. */ |
src2_r = get_immediate(src1w); |
src2_r = get_immediate(src1w); |
Line 1656 static int emit_op(struct sljit_compiler *compiler, in
|
Line 1664 static int emit_op(struct sljit_compiler *compiler, in
|
flags |= ARGS_SWAPPED; |
flags |= ARGS_SWAPPED; |
src1 = src2; |
src1 = src2; |
src1w = src2w; |
src1w = src2w; |
|
break; |
} |
} |
if (inp_flags & ALLOW_INV_IMM) { |
if (inp_flags & ALLOW_INV_IMM) { |
src2_r = get_immediate(~src1w); |
src2_r = get_immediate(~src1w); |
Line 1663 static int emit_op(struct sljit_compiler *compiler, in
|
Line 1672 static int emit_op(struct sljit_compiler *compiler, in
|
flags |= ARGS_SWAPPED | INV_IMM; |
flags |= ARGS_SWAPPED | INV_IMM; |
src1 = src2; |
src1 = src2; |
src1w = src2w; |
src1w = src2w; |
|
break; |
} |
} |
} |
} |
|
if (GET_OPCODE(op) == SLJIT_ADD) { |
|
src2_r = get_immediate(-src1w); |
|
if (src2_r) { |
|
/* Note: ARGS_SWAPPED is intentionally not applied! */ |
|
src1 = src2; |
|
src1w = src2w; |
|
op = SLJIT_SUB | GET_ALL_FLAGS(op); |
|
break; |
|
} |
|
} |
} |
} |
|
|
src1_r = 0; |
|
if (getput_arg_fast(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w)) { |
if (getput_arg_fast(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w)) { |
FAIL_IF(compiler->error); |
FAIL_IF(compiler->error); |
src1_r = TMP_REG1; |
src1_r = TMP_REG1; |
} |
} |
} | } while (0); |
|
|
/* Source 2. */ |
/* Source 2. */ |
if (src2_r == 0) { |
if (src2_r == 0) { |
Line 1694 static int emit_op(struct sljit_compiler *compiler, in
|
Line 1713 static int emit_op(struct sljit_compiler *compiler, in
|
break; |
break; |
} |
} |
} |
} |
|
if (GET_OPCODE(op) == SLJIT_ADD) { |
|
src2_r = get_immediate(-src2w); |
|
if (src2_r) { |
|
op = SLJIT_SUB | GET_ALL_FLAGS(op); |
|
flags &= ~ARGS_SWAPPED; |
|
break; |
|
} |
|
} |
|
if (GET_OPCODE(op) == SLJIT_SUB && !(flags & ARGS_SWAPPED)) { |
|
src2_r = get_immediate(-src2w); |
|
if (src2_r) { |
|
op = SLJIT_ADD | GET_ALL_FLAGS(op); |
|
flags &= ~ARGS_SWAPPED; |
|
break; |
|
} |
|
} |
} |
} |
|
|
/* src2_r is 0. */ |
/* src2_r is 0. */ |
Line 1825 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct slj
|
Line 1860 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct slj
|
{ |
{ |
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw); |
check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw); |
|
ADJUST_LOCAL_OFFSET(dst, dstw); |
|
ADJUST_LOCAL_OFFSET(src, srcw); |
|
|
switch (GET_OPCODE(op)) { |
switch (GET_OPCODE(op)) { |
case SLJIT_MOV: |
case SLJIT_MOV: |
Line 1868 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct slj
|
Line 1905 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct slj
|
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG) |
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG) |
compiler->skip_checks = 1; |
compiler->skip_checks = 1; |
#endif |
#endif |
return sljit_emit_op2(compiler, SLJIT_SUB | GET_FLAGS(op), dst, dstw, SLJIT_IMM, 0, src, srcw); | return sljit_emit_op2(compiler, SLJIT_SUB | GET_ALL_FLAGS(op), dst, dstw, SLJIT_IMM, 0, src, srcw); |
|
|
case SLJIT_CLZ: |
case SLJIT_CLZ: |
return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src, srcw); |
return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src, srcw); |
Line 1884 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct slj
|
Line 1921 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct slj
|
{ |
{ |
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w); |
check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w); |
|
ADJUST_LOCAL_OFFSET(dst, dstw); |
|
ADJUST_LOCAL_OFFSET(src1, src1w); |
|
ADJUST_LOCAL_OFFSET(src2, src2w); |
|
|
switch (GET_OPCODE(op)) { |
switch (GET_OPCODE(op)) { |
case SLJIT_ADD: |
case SLJIT_ADD: |
Line 2141 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sl
|
Line 2181 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sl
|
/* Other instructions */ |
/* Other instructions */ |
/* --------------------------------------------------------------------- */ |
/* --------------------------------------------------------------------- */ |
|
|
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int saveds, int local_size) | SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw) |
{ |
{ |
int size; |
|
|
|
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_fast_enter(compiler, dst, dstw, args, temporaries, saveds, local_size); | check_sljit_emit_fast_enter(compiler, dst, dstw); |
| ADJUST_LOCAL_OFFSET(dst, dstw); |
|
|
compiler->temporaries = temporaries; |
|
compiler->saveds = saveds; |
|
|
|
size = (1 + saveds) * sizeof(sljit_uw); |
|
if (temporaries >= 4) |
|
size += (temporaries - 3) * sizeof(sljit_uw); |
|
local_size += size; |
|
local_size = (local_size + 7) & ~7; |
|
local_size -= size; |
|
compiler->local_size = local_size; |
|
|
|
if (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS) |
if (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS) |
return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, RM(TMP_REG3))); |
return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, RM(TMP_REG3))); |
else if (dst & SLJIT_MEM) { |
else if (dst & SLJIT_MEM) { |
Line 2177 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_return(st
|
Line 2205 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_return(st
|
{ |
{ |
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_fast_return(compiler, src, srcw); |
check_sljit_emit_fast_return(compiler, src, srcw); |
|
ADJUST_LOCAL_OFFSET(src, srcw); |
|
|
if (src >= SLJIT_TEMPORARY_REG1 && src <= SLJIT_NO_REGISTERS) |
if (src >= SLJIT_TEMPORARY_REG1 && src <= SLJIT_NO_REGISTERS) |
EMIT_INSTRUCTION(EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG3, SLJIT_UNUSED, RM(src))); |
EMIT_INSTRUCTION(EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG3, SLJIT_UNUSED, RM(src))); |
Line 2316 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ijump(struct s
|
Line 2345 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ijump(struct s
|
|
|
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_ijump(compiler, type, src, srcw); |
check_sljit_emit_ijump(compiler, type, src, srcw); |
|
ADJUST_LOCAL_OFFSET(src, srcw); |
|
|
/* In ARM, we don't need to touch the arguments. */ |
/* In ARM, we don't need to touch the arguments. */ |
if (src & SLJIT_IMM) { |
if (src & SLJIT_IMM) { |
Line 2355 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_cond_value(str
|
Line 2385 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_cond_value(str
|
|
|
CHECK_ERROR(); |
CHECK_ERROR(); |
check_sljit_emit_cond_value(compiler, op, dst, dstw, type); |
check_sljit_emit_cond_value(compiler, op, dst, dstw, type); |
|
ADJUST_LOCAL_OFFSET(dst, dstw); |
|
|
if (dst == SLJIT_UNUSED) |
if (dst == SLJIT_UNUSED) |
return SLJIT_SUCCESS; |
return SLJIT_SUCCESS; |
Line 2393 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emi
|
Line 2424 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emi
|
|
|
CHECK_ERROR_PTR(); |
CHECK_ERROR_PTR(); |
check_sljit_emit_const(compiler, dst, dstw, init_value); |
check_sljit_emit_const(compiler, dst, dstw, init_value); |
|
ADJUST_LOCAL_OFFSET(dst, dstw); |
|
|
const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); |
const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); |
PTR_FAIL_IF(!const_); |
PTR_FAIL_IF(!const_); |