Lines Matching refs:compiler
4 * Stack-less Just-In-Time compiler
43 if (SLJIT_UNLIKELY(compiler->error)) \
44 return compiler->error; \
49 if (SLJIT_UNLIKELY(compiler->error)) \
56 return compiler->error; \
68 compiler->error = SLJIT_ERR_ALLOC_FAILED; \
76 compiler->error = SLJIT_ERR_ALLOC_FAILED; \
84 compiler->error = SLJIT_ERR_EX_ALLOC_FAILED; \
294 compiler->error = SLJIT_ERR_BAD_ARGUMENT; \
302 compiler->error = SLJIT_ERR_BAD_ARGUMENT; \
358 struct sljit_compiler *compiler = (struct sljit_compiler*)SLJIT_MALLOC(sizeof(struct sljit_compiler), allocator_data);
359 if (!compiler)
361 SLJIT_ZEROMEM(compiler, sizeof(struct sljit_compiler));
380 compiler->error = SLJIT_SUCCESS;
382 compiler->allocator_data = allocator_data;
383 compiler->buf = (struct sljit_memory_fragment*)SLJIT_MALLOC(BUF_SIZE, allocator_data);
384 compiler->abuf = (struct sljit_memory_fragment*)SLJIT_MALLOC(ABUF_SIZE, allocator_data);
386 if (!compiler->buf || !compiler->abuf) {
387 if (compiler->buf)
388 SLJIT_FREE(compiler->buf, allocator_data);
389 if (compiler->abuf)
390 SLJIT_FREE(compiler->abuf, allocator_data);
391 SLJIT_FREE(compiler, allocator_data);
395 compiler->buf->next = NULL;
396 compiler->buf->used_size = 0;
397 compiler->abuf->next = NULL;
398 compiler->abuf->used_size = 0;
400 compiler->scratches = -1;
401 compiler->saveds = -1;
402 compiler->fscratches = -1;
403 compiler->fsaveds = -1;
404 compiler->local_size = -1;
407 compiler->args = -1;
411 compiler->cpool = (sljit_uw*)SLJIT_MALLOC(CPOOL_SIZE * sizeof(sljit_uw)
413 if (!compiler->cpool) {
414 SLJIT_FREE(compiler->buf, allocator_data);
415 SLJIT_FREE(compiler->abuf, allocator_data);
416 SLJIT_FREE(compiler, allocator_data);
419 compiler->cpool_unique = (sljit_u8*)(compiler->cpool + CPOOL_SIZE);
420 compiler->cpool_diff = 0xffffffff;
424 compiler->delay_slot = UNMOVABLE_INS;
428 compiler->delay_slot = UNMOVABLE_INS;
438 return compiler;
441 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler)
445 void *allocator_data = compiler->allocator_data;
448 buf = compiler->buf;
455 buf = compiler->abuf;
463 SLJIT_FREE(compiler->cpool, allocator_data);
465 SLJIT_FREE(compiler, allocator_data);
468 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler)
470 if (compiler->error == SLJIT_SUCCESS)
471 compiler->error = SLJIT_ERR_ALLOC_FAILED;
512 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags)
514 SLJIT_UNUSED_ARG(compiler);
519 compiler->last_flags = GET_FLAG_TYPE(current_flags) | (current_flags & (SLJIT_I32_OP | SLJIT_SET_Z));
528 static void* ensure_buf(struct sljit_compiler *compiler, sljit_uw size)
534 if (compiler->buf->used_size + size <= (BUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
535 ret = compiler->buf->memory + compiler->buf->used_size;
536 compiler->buf->used_size += size;
539 new_frag = (struct sljit_memory_fragment*)SLJIT_MALLOC(BUF_SIZE, compiler->allocator_data);
541 new_frag->next = compiler->buf;
542 compiler->buf = new_frag;
547 static void* ensure_abuf(struct sljit_compiler *compiler, sljit_uw size)
553 if (compiler->abuf->used_size + size <= (ABUF_SIZE - (sljit_uw)SLJIT_OFFSETOF(struct sljit_memory_fragment, memory))) {
554 ret = compiler->abuf->memory + compiler->abuf->used_size;
555 compiler->abuf->used_size += size;
558 new_frag = (struct sljit_memory_fragment*)SLJIT_MALLOC(ABUF_SIZE, compiler->allocator_data);
560 new_frag->next = compiler->abuf;
561 compiler->abuf = new_frag;
566 SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_s32 size)
579 return ensure_abuf(compiler, size);
582 static SLJIT_INLINE void reverse_buf(struct sljit_compiler *compiler)
584 struct sljit_memory_fragment *buf = compiler->buf;
595 compiler->buf = prev;
598 static SLJIT_INLINE void set_emit_enter(struct sljit_compiler *compiler,
605 compiler->options = options;
606 compiler->scratches = scratches;
607 compiler->saveds = saveds;
608 compiler->fscratches = fscratches;
609 compiler->fsaveds = fsaveds;
611 compiler->logical_local_size = local_size;
615 static SLJIT_INLINE void set_set_context(struct sljit_compiler *compiler,
622 compiler->options = options;
623 compiler->scratches = scratches;
624 compiler->saveds = saveds;
625 compiler->fscratches = fscratches;
626 compiler->fsaveds = fsaveds;
628 compiler->logical_local_size = local_size;
632 static SLJIT_INLINE void set_label(struct sljit_label *label, struct sljit_compiler *compiler)
635 label->size = compiler->size;
636 if (compiler->last_label)
637 compiler->last_label->next = label;
639 compiler->labels = label;
640 compiler->last_label = label;
643 static SLJIT_INLINE void set_jump(struct sljit_jump *jump, struct sljit_compiler *compiler, sljit_s32 flags)
647 if (compiler->last_jump)
648 compiler->last_jump->next = jump;
650 compiler->jumps = jump;
651 compiler->last_jump = jump;
654 static SLJIT_INLINE void set_const(struct sljit_const *const_, struct sljit_compiler *compiler)
657 const_->addr = compiler->size;
658 if (compiler->last_const)
659 compiler->last_const->next = const_;
661 compiler->consts = const_;
662 compiler->last_const = const_;
671 (((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) || \
672 ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
676 ((r) >= SLJIT_R0 && (r) < (SLJIT_R0 + compiler->scratches)) || \
677 ((r) > (SLJIT_S0 - compiler->saveds) && (r) <= SLJIT_S0))
687 CHECK_ARGUMENT(compiler->scratches != -1 && compiler->saveds != -1); \
693 CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
708 CHECK_ARGUMENT(compiler->scratches != -1 && compiler->saveds != -1); \
712 CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
727 CHECK_ARGUMENT(compiler->fscratches != -1 && compiler->fsaveds != -1); \
728 if (((p) >= SLJIT_FR0 && (p) < (SLJIT_FR0 + compiler->fscratches)) || \
729 ((p) > (SLJIT_FS0 - compiler->fsaveds) && (p) <= SLJIT_FS0)) \
732 CHECK_ARGUMENT((i) >= 0 && (i) < compiler->logical_local_size); \
750 SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *compiler, FILE* verbose)
752 compiler->verbose = verbose;
765 #define sljit_verbose_reg(compiler, r) \
767 if ((r) < (SLJIT_R0 + compiler->scratches)) \
768 fprintf(compiler->verbose, "r%d", (r) - SLJIT_R0); \
770 fprintf(compiler->verbose, "s%d", SLJIT_NUMBER_OF_REGISTERS - (r)); \
772 fprintf(compiler->verbose, "sp"); \
775 #define sljit_verbose_param(compiler, p, i) \
777 fprintf(compiler->verbose, "#%" SLJIT_PRINT_D "d", (i)); \
780 fputc('[', compiler->verbose); \
781 sljit_verbose_reg(compiler, (p) & REG_MASK); \
783 fprintf(compiler->verbose, " + "); \
784 sljit_verbose_reg(compiler, OFFS_REG(p)); \
786 fprintf(compiler->verbose, " * %d", 1 << (i)); \
789 fprintf(compiler->verbose, " + %" SLJIT_PRINT_D "d", (i)); \
790 fputc(']', compiler->verbose); \
793 fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
795 sljit_verbose_reg(compiler, p); \
797 fprintf(compiler->verbose, "unused");
799 #define sljit_verbose_fparam(compiler, p, i) \
802 fputc('[', compiler->verbose); \
803 sljit_verbose_reg(compiler, (p) & REG_MASK); \
805 fprintf(compiler->verbose, " + "); \
806 sljit_verbose_reg(compiler, OFFS_REG(p)); \
808 fprintf(compiler->verbose, "%d", 1 << (i)); \
811 fprintf(compiler->verbose, "%" SLJIT_PRINT_D "d", (i)); \
812 fputc(']', compiler->verbose); \
815 fprintf(compiler->verbose, "[#%" SLJIT_PRINT_D "d]", (i)); \
818 if ((p) < (SLJIT_FR0 + compiler->fscratches)) \
819 fprintf(compiler->verbose, "fr%d", (p) - SLJIT_FR0); \
821 fprintf(compiler->verbose, "fs%d", SLJIT_NUMBER_OF_FLOAT_REGISTERS - (p)); \
883 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_generate_code(struct sljit_compiler *compiler)
889 SLJIT_UNUSED_ARG(compiler);
892 CHECK_ARGUMENT(compiler->size > 0);
893 jump = compiler->jumps;
903 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_enter(struct sljit_compiler *compiler,
907 SLJIT_UNUSED_ARG(compiler);
920 compiler->last_flags = 0;
923 if (SLJIT_UNLIKELY(!!compiler->verbose))
924 fprintf(compiler->verbose, " enter options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
930 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_set_context(struct sljit_compiler *compiler,
945 compiler->last_flags = 0;
948 if (SLJIT_UNLIKELY(!!compiler->verbose))
949 fprintf(compiler->verbose, " set_context options:none args:%d scratches:%d saveds:%d fscratches:%d fsaveds:%d local_size:%d\n",
955 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
958 CHECK_ARGUMENT(compiler->scratches >= 0);
965 compiler->last_flags = 0;
968 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
970 fprintf(compiler->verbose, " return\n");
972 fprintf(compiler->verbose, " return%s ", op1_names[op - SLJIT_OP1_BASE]);
973 sljit_verbose_param(compiler, src, srcw);
974 fprintf(compiler->verbose, "\n");
981 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
985 compiler->last_flags = 0;
988 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
989 fprintf(compiler->verbose, " fast_enter ");
990 sljit_verbose_param(compiler, dst, dstw);
991 fprintf(compiler->verbose, "\n");
997 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
1001 compiler->last_flags = 0;
1004 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1005 fprintf(compiler->verbose, " fast_return ");
1006 sljit_verbose_param(compiler, src, srcw);
1007 fprintf(compiler->verbose, "\n");
1013 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
1018 CHECK_ARGUMENT(op < SLJIT_LMUL_UW || compiler->scratches >= 2);
1020 compiler->last_flags = 0;
1023 if (SLJIT_UNLIKELY(!!compiler->verbose))
1025 fprintf(compiler->verbose, " %s", op0_names[GET_OPCODE(op) - SLJIT_OP0_BASE]);
1027 fprintf(compiler->verbose, (op & SLJIT_I32_OP) ? "32" : "w");
1029 fprintf(compiler->verbose, "\n");
1035 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
1039 if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1040 compiler->skip_checks = 0;
1076 compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
1088 compiler->last_flags = 0;
1092 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1095 fprintf(compiler->verbose, " mov%s%s%s ", (GET_OPCODE(op) >= SLJIT_MOVU) ? "u" : "",
1100 fprintf(compiler->verbose, " %s%s%s%s%s ", op1_names[GET_OPCODE(op) - SLJIT_OP1_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
1105 sljit_verbose_param(compiler, dst, dstw);
1106 fprintf(compiler->verbose, ", ");
1107 sljit_verbose_param(compiler, src, srcw);
1108 fprintf(compiler->verbose, "\n");
1114 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
1119 if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1120 compiler->skip_checks = 0;
1157 CHECK_ARGUMENT((compiler->last_flags & 0xff) == GET_FLAG_TYPE(SLJIT_SET_CARRY));
1158 CHECK_ARGUMENT((op & SLJIT_I32_OP) == (compiler->last_flags & SLJIT_I32_OP));
1168 compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
1171 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1172 fprintf(compiler->verbose, " %s%s%s%s%s ", op2_names[GET_OPCODE(op) - SLJIT_OP2_BASE], !(op & SLJIT_I32_OP) ? "" : "32",
1175 sljit_verbose_param(compiler, dst, dstw);
1176 fprintf(compiler->verbose, ", ");
1177 sljit_verbose_param(compiler, src1, src1w);
1178 fprintf(compiler->verbose, ", ");
1179 sljit_verbose_param(compiler, src2, src2w);
1180 fprintf(compiler->verbose, "\n");
1204 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_op_custom(struct sljit_compiler *compiler,
1211 SLJIT_UNUSED_ARG(compiler);
1225 compiler->last_flags = 0;
1228 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1229 fprintf(compiler->verbose, " op_custom");
1231 fprintf(compiler->verbose, " 0x%x", ((sljit_u8*)instruction)[i]);
1232 fprintf(compiler->verbose, "\n");
1238 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
1242 if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1243 compiler->skip_checks = 0;
1255 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1257 fprintf(compiler->verbose, " %s%s ", fop1_names[SLJIT_CONV_F64_FROM_F32 - SLJIT_FOP1_BASE],
1260 fprintf(compiler->verbose, " %s%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
1263 sljit_verbose_fparam(compiler, dst, dstw);
1264 fprintf(compiler->verbose, ", ");
1265 sljit_verbose_fparam(compiler, src, srcw);
1266 fprintf(compiler->verbose, "\n");
1272 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op,
1277 compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
1280 if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1281 compiler->skip_checks = 0;
1295 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1296 fprintf(compiler->verbose, " %s%s", fop1_names[SLJIT_CMP_F64 - SLJIT_FOP1_BASE], (op & SLJIT_F32_OP) ? ".f32" : ".f64");
1298 fprintf(compiler->verbose, ".%s_f", jump_names[GET_FLAG_TYPE(op)]);
1300 fprintf(compiler->verbose, " ");
1301 sljit_verbose_fparam(compiler, src1, src1w);
1302 fprintf(compiler->verbose, ", ");
1303 sljit_verbose_fparam(compiler, src2, src2w);
1304 fprintf(compiler->verbose, "\n");
1310 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, sljit_s32 op,
1314 if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1315 compiler->skip_checks = 0;
1327 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1328 fprintf(compiler->verbose, " %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
1331 sljit_verbose_param(compiler, dst, dstw);
1332 fprintf(compiler->verbose, ", ");
1333 sljit_verbose_fparam(compiler, src, srcw);
1334 fprintf(compiler->verbose, "\n");
1340 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, sljit_s32 op,
1344 if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1345 compiler->skip_checks = 0;
1357 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1358 fprintf(compiler->verbose, " %s%s.from%s ", fop1_names[GET_OPCODE(op) - SLJIT_FOP1_BASE],
1361 sljit_verbose_fparam(compiler, dst, dstw);
1362 fprintf(compiler->verbose, ", ");
1363 sljit_verbose_param(compiler, src, srcw);
1364 fprintf(compiler->verbose, "\n");
1370 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
1384 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1385 fprintf(compiler->verbose, " %s%s ", fop2_names[GET_OPCODE(op) - SLJIT_FOP2_BASE], (op & SLJIT_F32_OP) ? ".f32" : ".f64");
1386 sljit_verbose_fparam(compiler, dst, dstw);
1387 fprintf(compiler->verbose, ", ");
1388 sljit_verbose_fparam(compiler, src1, src1w);
1389 fprintf(compiler->verbose, ", ");
1390 sljit_verbose_fparam(compiler, src2, src2w);
1391 fprintf(compiler->verbose, "\n");
1397 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_label(struct sljit_compiler *compiler)
1399 SLJIT_UNUSED_ARG(compiler);
1402 compiler->last_flags = 0;
1406 if (SLJIT_UNLIKELY(!!compiler->verbose))
1407 fprintf(compiler->verbose, "label:\n");
1412 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
1414 if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1415 compiler->skip_checks = 0;
1424 CHECK_ARGUMENT((type & 0xff) <= SLJIT_CALL0 || ((type & 0xff) - SLJIT_CALL0) <= compiler->scratches);
1428 CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
1430 CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff));
1431 CHECK_ARGUMENT((type & SLJIT_I32_OP) == (compiler->last_flags & SLJIT_I32_OP));
1435 if (SLJIT_UNLIKELY(!!compiler->verbose))
1436 fprintf(compiler->verbose, " jump%s %s%s\n", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
1442 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
1451 compiler->last_flags = 0;
1454 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1455 fprintf(compiler->verbose, " cmp%s %s%s, ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
1457 sljit_verbose_param(compiler, src1, src1w);
1458 fprintf(compiler->verbose, ", ");
1459 sljit_verbose_param(compiler, src2, src2w);
1460 fprintf(compiler->verbose, "\n");
1466 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
1476 compiler->last_flags = 0;
1479 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1480 fprintf(compiler->verbose, " fcmp%s %s%s, ", !(type & SLJIT_REWRITABLE_JUMP) ? "" : ".r",
1482 sljit_verbose_fparam(compiler, src1, src1w);
1483 fprintf(compiler->verbose, ", ");
1484 sljit_verbose_fparam(compiler, src2, src2w);
1485 fprintf(compiler->verbose, "\n");
1491 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
1494 compiler->last_flags = 0;
1497 if (SLJIT_UNLIKELY(compiler->skip_checks)) {
1498 compiler->skip_checks = 0;
1504 CHECK_ARGUMENT(type <= SLJIT_CALL0 || (type - SLJIT_CALL0) <= compiler->scratches);
1508 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1509 fprintf(compiler->verbose, " ijump.%s ", jump_names[type]);
1510 sljit_verbose_param(compiler, src, srcw);
1511 fprintf(compiler->verbose, "\n");
1517 compiler, sljit_s32 op,
1531 CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
1533 CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff));
1539 compiler->last_flags = GET_FLAG_TYPE(op) | (op & (SLJIT_I32_OP | SLJIT_SET_Z));
1544 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1545 fprintf(compiler->verbose, " flags%s %s%s, ",
1549 sljit_verbose_param(compiler, dst, dstw);
1551 fprintf(compiler->verbose, ", ");
1552 sljit_verbose_param(compiler, src, srcw);
1554 fprintf(compiler->verbose, ", %s%s\n", jump_names[type & 0xff], JUMP_POSTFIX(type));
1560 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
1568 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1569 fprintf(compiler->verbose, " local_base ");
1570 sljit_verbose_param(compiler, dst, dstw);
1571 fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", offset);
1577 static SLJIT_INLINE CHECK_RETURN_TYPE check_sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw init_value)
1585 if (SLJIT_UNLIKELY(!!compiler->verbose)) {
1586 fprintf(compiler->verbose, " const ");
1587 sljit_verbose_param(compiler, dst, dstw);
1588 fprintf(compiler->verbose, ", #%" SLJIT_PRINT_D "d\n", init_value);
1596 #define SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw) \
1601 CHECK(check_sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw)); \
1604 return sljit_emit_fop1_cmp(compiler, op, dst, dstw, src, srcw); \
1607 CHECK(check_sljit_emit_fop1_conv_sw_from_f64(compiler, op, dst, dstw, src, srcw)); \
1610 return sljit_emit_fop1_conv_sw_from_f64(compiler, op, dst, dstw, src, srcw); \
1612 CHECK(check_sljit_emit_fop1_conv_f64_from_sw(compiler, op, dst, dstw, src, srcw)); \
1615 return sljit_emit_fop1_conv_f64_from_sw(compiler, op, dst, dstw, src, srcw); \
1617 CHECK(check_sljit_emit_fop1(compiler, op, dst, dstw, src, srcw)); \
1621 static SLJIT_INLINE sljit_s32 emit_mov_before_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
1638 compiler->skip_checks = 1;
1640 return sljit_emit_op1(compiler, op, SLJIT_RETURN_REG, 0, src, srcw);
1691 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
1700 CHECK_PTR(check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w));
1712 return emit_cmp_to0(compiler, type, src1, src1w);
1761 compiler->skip_checks = 1;
1763 PTR_FAIL_IF(sljit_emit_op2(compiler, SLJIT_SUB | flags | (type & SLJIT_I32_OP),
1767 compiler->skip_checks = 1;
1769 return sljit_emit_jump(compiler, condition | (type & (SLJIT_REWRITABLE_JUMP | SLJIT_I32_OP)));
1774 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
1779 CHECK_PTR(check_sljit_emit_fcmp(compiler, type, src1, src1w, src2, src2w));
1783 compiler->skip_checks = 1;
1785 sljit_emit_fop1(compiler, SLJIT_CMP_F64 | ((type & 0xff) << VARIABLE_FLAG_SHIFT) | (type & SLJIT_I32_OP), src1, src1w, src2, src2w);
1789 compiler->skip_checks = 1;
1791 return sljit_emit_jump(compiler, type);
1796 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
1799 CHECK(check_sljit_get_local_base(compiler, dst, dstw, offset));
1804 compiler->skip_checks = 1;
1807 return sljit_emit_op2(compiler, SLJIT_ADD, dst, dstw, SLJIT_SP, 0, SLJIT_IMM, offset);
1808 return sljit_emit_op1(compiler, SLJIT_MOV, dst, dstw, SLJIT_SP, 0);
1829 SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compiler)
1831 SLJIT_UNUSED_ARG(compiler);
1835 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler)
1837 SLJIT_UNUSED_ARG(compiler);
1841 SLJIT_API_FUNC_ATTRIBUTE void* sljit_alloc_memory(struct sljit_compiler *compiler, sljit_s32 size)
1843 SLJIT_UNUSED_ARG(compiler);
1850 SLJIT_API_FUNC_ATTRIBUTE void sljit_compiler_verbose(struct sljit_compiler *compiler, FILE* verbose)
1852 SLJIT_UNUSED_ARG(compiler);
1858 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
1860 SLJIT_UNUSED_ARG(compiler);
1871 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
1875 SLJIT_UNUSED_ARG(compiler);
1887 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
1891 SLJIT_UNUSED_ARG(compiler);
1903 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
1905 SLJIT_UNUSED_ARG(compiler);
1913 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
1915 SLJIT_UNUSED_ARG(compiler);
1922 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
1924 SLJIT_UNUSED_ARG(compiler);
1931 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op)
1933 SLJIT_UNUSED_ARG(compiler);
1939 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op,
1943 SLJIT_UNUSED_ARG(compiler);
1953 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
1958 SLJIT_UNUSED_ARG(compiler);
1976 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
1979 SLJIT_UNUSED_ARG(compiler);
1986 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags)
1988 SLJIT_UNUSED_ARG(compiler);
1998 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op,
2002 SLJIT_UNUSED_ARG(compiler);
2012 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op,
2017 SLJIT_UNUSED_ARG(compiler);
2029 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler)
2031 SLJIT_UNUSED_ARG(compiler);
2036 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler
2038 SLJIT_UNUSED_ARG(compiler);
2044 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s32 type,
2048 SLJIT_UNUSED_ARG(compiler);
2058 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_fcmp(struct sljit_compiler *compiler, sljit_s32 type,
2062 SLJIT_UNUSED_ARG(compiler);
2086 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type, sljit_s32 src, sljit_sw srcw)
2088 SLJIT_UNUSED_ARG(compiler);
2096 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 op,
2101 SLJIT_UNUSED_ARG(compiler);
2112 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_get_local_base(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw offset)
2114 SLJIT_UNUSED_ARG(compiler);
2122 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw, sljit_sw initval)
2124 SLJIT_UNUSED_ARG(compiler);