| 437 |
int src1, sljit_w src1w, |
int src1, sljit_w src1w, |
| 438 |
int src2, sljit_w src2w); |
int src2, sljit_w src2w); |
| 439 |
|
|
| 440 |
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int generals, int local_size) |
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size) |
| 441 |
{ |
{ |
| 442 |
CHECK_ERROR(); |
CHECK_ERROR(); |
| 443 |
check_sljit_emit_enter(compiler, args, temporaries, generals, local_size); |
check_sljit_emit_enter(compiler, args, temporaries, saveds, local_size); |
| 444 |
|
|
| 445 |
compiler->temporaries = temporaries; |
compiler->temporaries = temporaries; |
| 446 |
compiler->generals = generals; |
compiler->saveds = saveds; |
| 447 |
compiler->has_locals = local_size > 0; |
compiler->has_locals = local_size > 0; |
| 448 |
|
|
| 449 |
FAIL_IF(push_inst(compiler, MFLR | D(0))); |
FAIL_IF(push_inst(compiler, MFLR | D(0))); |
| 450 |
if (compiler->has_locals) |
if (compiler->has_locals) |
| 451 |
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(SLJIT_LOCALS_REG) | A(REAL_STACK_PTR) | IMM(-(int)(sizeof(sljit_w))) )); |
| 452 |
FAIL_IF(push_inst(compiler, STACK_STORE | S(ZERO_REG) | A(REAL_STACK_PTR) | IMM(-2 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_STORE | S(ZERO_REG) | A(REAL_STACK_PTR) | IMM(-2 * (int)(sizeof(sljit_w))) )); |
| 453 |
if (generals >= 1) |
if (saveds >= 1) |
| 454 |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_GENERAL_REG1) | A(REAL_STACK_PTR) | IMM(-3 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG1) | A(REAL_STACK_PTR) | IMM(-3 * (int)(sizeof(sljit_w))) )); |
| 455 |
if (generals >= 2) |
if (saveds >= 2) |
| 456 |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_GENERAL_REG2) | A(REAL_STACK_PTR) | IMM(-4 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG2) | A(REAL_STACK_PTR) | IMM(-4 * (int)(sizeof(sljit_w))) )); |
| 457 |
if (generals >= 3) |
if (saveds >= 3) |
| 458 |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_GENERAL_REG3) | A(REAL_STACK_PTR) | IMM(-5 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_REG3) | A(REAL_STACK_PTR) | IMM(-5 * (int)(sizeof(sljit_w))) )); |
| 459 |
if (generals >= 4) |
if (saveds >= 4) |
| 460 |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_GENERAL_EREG1) | A(REAL_STACK_PTR) | IMM(-6 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_EREG1) | A(REAL_STACK_PTR) | IMM(-6 * (int)(sizeof(sljit_w))) )); |
| 461 |
if (generals >= 5) |
if (saveds >= 5) |
| 462 |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_GENERAL_EREG2) | A(REAL_STACK_PTR) | IMM(-7 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_STORE | S(SLJIT_SAVED_EREG2) | A(REAL_STACK_PTR) | IMM(-7 * (int)(sizeof(sljit_w))) )); |
| 463 |
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(REAL_STACK_PTR) | IMM(sizeof(sljit_w)) )); |
| 464 |
|
|
| 465 |
FAIL_IF(push_inst(compiler, ADDI | D(ZERO_REG) | A(0) | 0)); |
FAIL_IF(push_inst(compiler, ADDI | D(ZERO_REG) | A(0) | 0)); |
| 466 |
if (args >= 1) |
if (args >= 1) |
| 467 |
FAIL_IF(push_inst(compiler, OR | S(SLJIT_TEMPORARY_REG1) | A(SLJIT_GENERAL_REG1) | B(SLJIT_TEMPORARY_REG1))); |
FAIL_IF(push_inst(compiler, OR | S(SLJIT_TEMPORARY_REG1) | A(SLJIT_SAVED_REG1) | B(SLJIT_TEMPORARY_REG1))); |
| 468 |
if (args >= 2) |
if (args >= 2) |
| 469 |
FAIL_IF(push_inst(compiler, OR | S(SLJIT_TEMPORARY_REG2) | A(SLJIT_GENERAL_REG2) | B(SLJIT_TEMPORARY_REG2))); |
FAIL_IF(push_inst(compiler, OR | S(SLJIT_TEMPORARY_REG2) | A(SLJIT_SAVED_REG2) | B(SLJIT_TEMPORARY_REG2))); |
| 470 |
if (args >= 3) |
if (args >= 3) |
| 471 |
FAIL_IF(push_inst(compiler, OR | S(SLJIT_TEMPORARY_REG3) | A(SLJIT_GENERAL_REG3) | B(SLJIT_TEMPORARY_REG3))); |
FAIL_IF(push_inst(compiler, OR | S(SLJIT_TEMPORARY_REG3) | A(SLJIT_SAVED_REG3) | B(SLJIT_TEMPORARY_REG3))); |
| 472 |
|
|
| 473 |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
| 474 |
compiler->local_size = (2 + generals + 2) * sizeof(sljit_w) + local_size; |
compiler->local_size = (2 + saveds + 2) * sizeof(sljit_w) + local_size; |
| 475 |
#else |
#else |
| 476 |
compiler->local_size = (2 + generals + 7 + 8) * sizeof(sljit_w) + local_size; |
compiler->local_size = (2 + saveds + 7 + 8) * sizeof(sljit_w) + local_size; |
| 477 |
#endif |
#endif |
| 478 |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
| 479 |
|
|
| 500 |
return SLJIT_SUCCESS; |
return SLJIT_SUCCESS; |
| 501 |
} |
} |
| 502 |
|
|
| 503 |
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int generals, int local_size) |
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size) |
| 504 |
{ |
{ |
| 505 |
CHECK_ERROR_VOID(); |
CHECK_ERROR_VOID(); |
| 506 |
check_sljit_set_context(compiler, args, temporaries, generals, local_size); |
check_sljit_set_context(compiler, args, temporaries, saveds, local_size); |
| 507 |
|
|
| 508 |
compiler->temporaries = temporaries; |
compiler->temporaries = temporaries; |
| 509 |
compiler->generals = generals; |
compiler->saveds = saveds; |
| 510 |
|
|
| 511 |
compiler->has_locals = local_size > 0; |
compiler->has_locals = local_size > 0; |
| 512 |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
| 513 |
compiler->local_size = (2 + generals + 2) * sizeof(sljit_w) + local_size; |
compiler->local_size = (2 + saveds + 2) * sizeof(sljit_w) + local_size; |
| 514 |
#else |
#else |
| 515 |
compiler->local_size = (2 + generals + 7 + 8) * sizeof(sljit_w) + local_size; |
compiler->local_size = (2 + saveds + 7 + 8) * sizeof(sljit_w) + local_size; |
| 516 |
#endif |
#endif |
| 517 |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
| 518 |
} |
} |
| 532 |
} |
} |
| 533 |
|
|
| 534 |
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(REAL_STACK_PTR) | IMM(sizeof(sljit_w)))); |
| 535 |
if (compiler->generals >= 5) |
if (compiler->saveds >= 5) |
| 536 |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_GENERAL_EREG2) | A(REAL_STACK_PTR) | IMM(-7 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_EREG2) | A(REAL_STACK_PTR) | IMM(-7 * (int)(sizeof(sljit_w))) )); |
| 537 |
if (compiler->generals >= 4) |
if (compiler->saveds >= 4) |
| 538 |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_GENERAL_EREG1) | A(REAL_STACK_PTR) | IMM(-6 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_EREG1) | A(REAL_STACK_PTR) | IMM(-6 * (int)(sizeof(sljit_w))) )); |
| 539 |
if (compiler->generals >= 3) |
if (compiler->saveds >= 3) |
| 540 |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_GENERAL_REG3) | A(REAL_STACK_PTR) | IMM(-5 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG3) | A(REAL_STACK_PTR) | IMM(-5 * (int)(sizeof(sljit_w))) )); |
| 541 |
if (compiler->generals >= 2) |
if (compiler->saveds >= 2) |
| 542 |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_GENERAL_REG2) | A(REAL_STACK_PTR) | IMM(-4 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG2) | A(REAL_STACK_PTR) | IMM(-4 * (int)(sizeof(sljit_w))) )); |
| 543 |
if (compiler->generals >= 1) |
if (compiler->saveds >= 1) |
| 544 |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_GENERAL_REG1) | A(REAL_STACK_PTR) | IMM(-3 * (int)(sizeof(sljit_w))) )); |
FAIL_IF(push_inst(compiler, STACK_LOAD | D(SLJIT_SAVED_REG1) | A(REAL_STACK_PTR) | IMM(-3 * (int)(sizeof(sljit_w))) )); |
| 545 |
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(REAL_STACK_PTR) | IMM(-2 * (int)(sizeof(sljit_w))) )); |
| 546 |
if (compiler->has_locals) |
if (compiler->has_locals) |
| 547 |
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, STACK_LOAD | D(SLJIT_LOCALS_REG) | A(REAL_STACK_PTR) | IMM(-(int)(sizeof(sljit_w))) )); |
| 1554 |
/* Other instructions */ |
/* Other instructions */ |
| 1555 |
/* --------------------------------------------------------------------- */ |
/* --------------------------------------------------------------------- */ |
| 1556 |
|
|
| 1557 |
SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int generals, int local_size) |
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) |
| 1558 |
{ |
{ |
| 1559 |
CHECK_ERROR(); |
CHECK_ERROR(); |
| 1560 |
check_sljit_emit_fast_enter(compiler, dst, dstw, args, temporaries, generals, local_size); |
check_sljit_emit_fast_enter(compiler, dst, dstw, args, temporaries, saveds, local_size); |
| 1561 |
|
|
| 1562 |
compiler->temporaries = temporaries; |
compiler->temporaries = temporaries; |
| 1563 |
compiler->generals = generals; |
compiler->saveds = saveds; |
| 1564 |
|
|
| 1565 |
compiler->has_locals = local_size > 0; |
compiler->has_locals = local_size > 0; |
| 1566 |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
#if (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) |
| 1567 |
compiler->local_size = (2 + generals + 2) * sizeof(sljit_w) + local_size; |
compiler->local_size = (2 + saveds + 2) * sizeof(sljit_w) + local_size; |
| 1568 |
#else |
#else |
| 1569 |
compiler->local_size = (2 + generals + 7 + 8) * sizeof(sljit_w) + local_size; |
compiler->local_size = (2 + saveds + 7 + 8) * sizeof(sljit_w) + local_size; |
| 1570 |
#endif |
#endif |
| 1571 |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
compiler->local_size = (compiler->local_size + 15) & ~0xf; |
| 1572 |
|
|