version 1.1.1.2, 2012/02/21 23:50:25
|
version 1.1.1.3, 2012/10/09 09:19:18
|
Line 49 static void ppc_cache_flush(sljit_ins *from, sljit_ins
|
Line 49 static void ppc_cache_flush(sljit_ins *from, sljit_ins
|
#define TMP_REG2 (SLJIT_NO_REGISTERS + 2) |
#define TMP_REG2 (SLJIT_NO_REGISTERS + 2) |
#define TMP_REG3 (SLJIT_NO_REGISTERS + 3) |
#define TMP_REG3 (SLJIT_NO_REGISTERS + 3) |
#define ZERO_REG (SLJIT_NO_REGISTERS + 4) |
#define ZERO_REG (SLJIT_NO_REGISTERS + 4) |
#define REAL_STACK_PTR (SLJIT_NO_REGISTERS + 5) |
|
|
|
#define TMP_FREG1 (SLJIT_FLOAT_REG4 + 1) |
#define TMP_FREG1 (SLJIT_FLOAT_REG4 + 1) |
#define TMP_FREG2 (SLJIT_FLOAT_REG4 + 2) |
#define TMP_FREG2 (SLJIT_FLOAT_REG4 + 2) |
Line 168 static void ppc_cache_flush(sljit_ins *from, sljit_ins
|
Line 167 static void ppc_cache_flush(sljit_ins *from, sljit_ins
|
#define SIMM_MIN (-0x8000) |
#define SIMM_MIN (-0x8000) |
#define UIMM_MAX (0xffff) |
#define UIMM_MAX (0xffff) |
|
|
/* SLJIT_LOCALS_REG is not the real stack register, since it must |
|
point to the head of the stack chain. */ |
|
static SLJIT_CONST sljit_ub reg_map[SLJIT_NO_REGISTERS + 6] = { |
static SLJIT_CONST sljit_ub reg_map[SLJIT_NO_REGISTERS + 6] = { |
0, 3, 4, 5, 6, 7, 29, 28, 27, 26, 25, 31, 8, 9, 10, 30, 1 | 0, 3, 4, 5, 6, 7, 30, 29, 28, 27, 26, 1, 8, 9, 10, 31 |
}; |
}; |
|
|
static int push_inst(struct sljit_compiler *compiler, sljit_ins ins) |
static int push_inst(struct sljit_compiler *compiler, sljit_ins ins) |
Line 440 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
Line 437 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
|
|
compiler->temporaries = temporaries; |
compiler->temporaries = temporaries; |
compiler->saveds = saveds; |
compiler->saveds = saveds; |
compiler->has_locals = local_size > 0; | #if (defined SLJIT_DEBUG && SLJIT_DEBUG) |
| compiler->logical_local_size = local_size; |
| #endif |
|
|
FAIL_IF(push_inst(compiler, MFLR | D(0))); |
FAIL_IF(push_inst(compiler, MFLR | D(0))); |
if (compiler->has_locals) | FAIL_IF(push_inst(compiler, STACK_STORE | S(ZERO_REG) | A(SLJIT_LOCALS_REG) | IMM(-(int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_LOCALS_REG) | A(REAL_STACK_PTR) | IMM(-(int)(sizeof(sljit_w))) )); | |
FAIL_IF(push_inst(compiler, STACK_STORE | S(ZERO_REG) | A(REAL_STACK_PTR) | IMM(-2 * (int)(sizeof(sljit_w))) )); | |
if (saveds >= 1) |
if (saveds >= 1) |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG1) | A(REAL_STACK_PTR) | IMM(-3 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG1) | A(SLJIT_LOCALS_REG) | IMM(-2 * (int)(sizeof(sljit_w))) )); |
if (saveds >= 2) |
if (saveds >= 2) |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG2) | A(REAL_STACK_PTR) | IMM(-4 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG2) | A(SLJIT_LOCALS_REG) | IMM(-3 * (int)(sizeof(sljit_w))) )); |
if (saveds >= 3) |
if (saveds >= 3) |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG3) | A(REAL_STACK_PTR) | IMM(-5 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG3) | A(SLJIT_LOCALS_REG) | IMM(-4 * (int)(sizeof(sljit_w))) )); |
if (saveds >= 4) |
if (saveds >= 4) |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_EREG1) | A(REAL_STACK_PTR) | IMM(-6 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_EREG1) | A(SLJIT_LOCALS_REG) | IMM(-5 * (int)(sizeof(sljit_w))) )); |
if (saveds >= 5) |
if (saveds >= 5) |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_EREG2) | A(REAL_STACK_PTR) | IMM(-7 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_EREG2) | A(SLJIT_LOCALS_REG) | IMM(-6 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_STORE | S(0) | A(REAL_STACK_PTR) | IMM(sizeof(sljit_w)) )); | FAIL_IF(push_inst(compiler, STACK_STORE | S(0) | A(SLJIT_LOCALS_REG) | IMM(sizeof(sljit_w)) )); |
|
|
FAIL_IF(push_inst(compiler, ADDI | D(ZERO_REG) | A(0) | 0)); |
FAIL_IF(push_inst(compiler, ADDI | D(ZERO_REG) | A(0) | 0)); |
if (args >= 1) |
if (args >= 1) |
Line 467 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
Line 464 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct s
|
FAIL_IF(push_inst(compiler, OR | S(SLJIT_TEMPORARY_REG3) | A(SLJIT_SAVED_REG3) | B(SLJIT_TEMPORARY_REG3))); |
FAIL_IF(push_inst(compiler, OR | S(SLJIT_TEMPORARY_REG3) | A(SLJIT_SAVED_REG3) | B(SLJIT_TEMPORARY_REG3))); |
|
|
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
compiler->local_size = (2 + saveds + 2) * sizeof(sljit_w) + local_size; | compiler->local_size = (1 + saveds + 2) * sizeof(sljit_w) + local_size; |
#else |
#else |
compiler->local_size = (2 + saveds + 7 + 8) * sizeof(sljit_w) + local_size; | compiler->local_size = (1 + saveds + 7 + 8) * sizeof(sljit_w) + local_size; |
#endif |
#endif |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
|
|
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
if (compiler->local_size <= SIMM_MAX) |
if (compiler->local_size <= SIMM_MAX) |
FAIL_IF(push_inst(compiler, STWU | S(REAL_STACK_PTR) | A(REAL_STACK_PTR) | IMM(-compiler->local_size))); | FAIL_IF(push_inst(compiler, STWU | S(SLJIT_LOCALS_REG) | A(SLJIT_LOCALS_REG) | IMM(-compiler->local_size))); |
else { |
else { |
FAIL_IF(load_immediate(compiler, 0, -compiler->local_size)); |
FAIL_IF(load_immediate(compiler, 0, -compiler->local_size)); |
FAIL_IF(push_inst(compiler, STWUX | S(REAL_STACK_PTR) | A(REAL_STACK_PTR) | B(0))); | FAIL_IF(push_inst(compiler, STWUX | S(SLJIT_LOCALS_REG) | A(SLJIT_LOCALS_REG) | B(0))); |
} |
} |
if (compiler->has_locals) |
|
FAIL_IF(push_inst(compiler, ADDI | D(SLJIT_LOCALS_REG) | A(REAL_STACK_PTR) | IMM(2 * sizeof(sljit_w)))); |
|
#else |
#else |
if (compiler->local_size <= SIMM_MAX) |
if (compiler->local_size <= SIMM_MAX) |
FAIL_IF(push_inst(compiler, STDU | S(REAL_STACK_PTR) | A(REAL_STACK_PTR) | IMM(-compiler->local_size))); | FAIL_IF(push_inst(compiler, STDU | S(SLJIT_LOCALS_REG) | A(SLJIT_LOCALS_REG) | IMM(-compiler->local_size))); |
else { |
else { |
FAIL_IF(load_immediate(compiler, 0, -compiler->local_size)); |
FAIL_IF(load_immediate(compiler, 0, -compiler->local_size)); |
FAIL_IF(push_inst(compiler, STDUX | S(REAL_STACK_PTR) | A(REAL_STACK_PTR) | B(0))); | FAIL_IF(push_inst(compiler, STDUX | S(SLJIT_LOCALS_REG) | A(SLJIT_LOCALS_REG) | B(0))); |
} |
} |
if (compiler->has_locals) |
|
FAIL_IF(push_inst(compiler, ADDI | D(SLJIT_LOCALS_REG) | A(REAL_STACK_PTR) | IMM((7 + 8) * sizeof(sljit_w)))); |
|
#endif |
#endif |
|
|
return SLJIT_SUCCESS; |
return SLJIT_SUCCESS; |
Line 503 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct
|
Line 496 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 |
|
|
compiler->has_locals = local_size > 0; |
|
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
compiler->local_size = (2 + saveds + 2) * sizeof(sljit_w) + local_size; | compiler->local_size = (1 + saveds + 2) * sizeof(sljit_w) + local_size; |
#else |
#else |
compiler->local_size = (2 + saveds + 7 + 8) * sizeof(sljit_w) + local_size; | compiler->local_size = (1 + saveds + 7 + 8) * sizeof(sljit_w) + local_size; |
#endif |
#endif |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
} |
} |
Line 517 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct
|
Line 512 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)); |
|
|
if (compiler->local_size <= SIMM_MAX) |
if (compiler->local_size <= SIMM_MAX) |
FAIL_IF(push_inst(compiler, ADDI | D(REAL_STACK_PTR) | A(REAL_STACK_PTR) | IMM(compiler->local_size))); | FAIL_IF(push_inst(compiler, ADDI | D(SLJIT_LOCALS_REG) | A(SLJIT_LOCALS_REG) | IMM(compiler->local_size))); |
else { |
else { |
FAIL_IF(load_immediate(compiler, 0, compiler->local_size)); |
FAIL_IF(load_immediate(compiler, 0, compiler->local_size)); |
FAIL_IF(push_inst(compiler, ADD | D(REAL_STACK_PTR) | A(REAL_STACK_PTR) | B(0))); | FAIL_IF(push_inst(compiler, ADD | D(SLJIT_LOCALS_REG) | A(SLJIT_LOCALS_REG) | B(0))); |
} |
} |
|
|
FAIL_IF(push_inst(compiler, STACK_LOAD | D(0) | A(REAL_STACK_PTR) | IMM(sizeof(sljit_w)))); | FAIL_IF(push_inst(compiler, STACK_LOAD | D(0) | A(SLJIT_LOCALS_REG) | IMM(sizeof(sljit_w)))); |
if (compiler->saveds >= 5) |
if (compiler->saveds >= 5) |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_EREG2) | A(REAL_STACK_PTR) | IMM(-7 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_EREG2) | A(SLJIT_LOCALS_REG) | IMM(-6 * (int)(sizeof(sljit_w))) )); |
if (compiler->saveds >= 4) |
if (compiler->saveds >= 4) |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_EREG1) | A(REAL_STACK_PTR) | IMM(-6 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_EREG1) | A(SLJIT_LOCALS_REG) | IMM(-5 * (int)(sizeof(sljit_w))) )); |
if (compiler->saveds >= 3) |
if (compiler->saveds >= 3) |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG3) | A(REAL_STACK_PTR) | IMM(-5 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG3) | A(SLJIT_LOCALS_REG) | IMM(-4 * (int)(sizeof(sljit_w))) )); |
if (compiler->saveds >= 2) |
if (compiler->saveds >= 2) |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG2) | A(REAL_STACK_PTR) | IMM(-4 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG2) | A(SLJIT_LOCALS_REG) | IMM(-3 * (int)(sizeof(sljit_w))) )); |
if (compiler->saveds >= 1) |
if (compiler->saveds >= 1) |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG1) | A(REAL_STACK_PTR) | IMM(-3 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG1) | A(SLJIT_LOCALS_REG) | IMM(-2 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(ZERO_REG) | A(REAL_STACK_PTR) | IMM(-2 * (int)(sizeof(sljit_w))) )); | FAIL_IF(push_inst(compiler, STACK_LOAD | D(ZERO_REG) | A(SLJIT_LOCALS_REG) | IMM(-(int)(sizeof(sljit_w))) )); |
if (compiler->has_locals) | |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_LOCALS_REG) | A(REAL_STACK_PTR) | IMM(-(int)(sizeof(sljit_w))) )); | |
|
|
FAIL_IF(push_inst(compiler, MTLR | S(0))); |
FAIL_IF(push_inst(compiler, MTLR | S(0))); |
FAIL_IF(push_inst(compiler, BLR)); |
FAIL_IF(push_inst(compiler, BLR)); |
Line 1077 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op1(struct slj
|
Line 1071 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); |
|
|
if ((src & SLJIT_IMM) && srcw == 0) |
if ((src & SLJIT_IMM) && srcw == 0) |
src = ZERO_REG; |
src = ZERO_REG; |
Line 1193 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct slj
|
Line 1189 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); |
|
|
if ((src1 & SLJIT_IMM) && src1w == 0) |
if ((src1 & SLJIT_IMM) && src1w == 0) |
src1 = ZERO_REG; |
src1 = ZERO_REG; |
Line 1550 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fop2(struct sl
|
Line 1549 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) |
{ |
{ |
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; |
|
|
|
compiler->has_locals = local_size > 0; |
|
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
|
compiler->local_size = (2 + saveds + 2) * sizeof(sljit_w) + local_size; |
|
#else |
|
compiler->local_size = (2 + saveds + 7 + 8) * sizeof(sljit_w) + local_size; |
|
#endif |
|
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
|
|
|
if (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS) |
if (dst >= SLJIT_TEMPORARY_REG1 && dst <= SLJIT_NO_REGISTERS) |
return push_inst(compiler, MFLR | D(dst)); |
return push_inst(compiler, MFLR | D(dst)); |
else if (dst & SLJIT_MEM) { |
else if (dst & SLJIT_MEM) { |
Line 1580 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_return(st
|
Line 1569 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) |
FAIL_IF(push_inst(compiler, MTLR | S(src))); |
FAIL_IF(push_inst(compiler, MTLR | S(src))); |
Line 1712 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ijump(struct s
|
Line 1702 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); |
|
|
bo_bi_flags = get_bo_bi_flags(compiler, type); |
bo_bi_flags = get_bo_bi_flags(compiler, type); |
FAIL_IF(!bo_bi_flags); |
FAIL_IF(!bo_bi_flags); |
Line 1752 SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_cond_value(str
|
Line 1743 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 1857 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emi
|
Line 1849 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_); |