Lines Matching refs:compiler

291 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_ins ins, sljit_s32 delay_slot)  in push_inst()  argument
295 sljit_ins *ptr = (sljit_ins*)ensure_buf(compiler, sizeof(sljit_ins)); in push_inst()
298 compiler->size++; in push_inst()
299 compiler->delay_slot = delay_slot; in push_inst()
502 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler) in sljit_generate_code() argument
520 CHECK_PTR(check_sljit_generate_code(compiler)); in sljit_generate_code()
521 reverse_buf(compiler); in sljit_generate_code()
523 code = (sljit_ins*)SLJIT_MALLOC_EXEC(compiler->size * sizeof(sljit_ins)); in sljit_generate_code()
525 buf = compiler->buf; in sljit_generate_code()
532 label = compiler->labels; in sljit_generate_code()
533 jump = compiler->jumps; in sljit_generate_code()
534 const_ = compiler->consts; in sljit_generate_code()
535 put_label = compiler->put_labels; in sljit_generate_code()
595 SLJIT_ASSERT(code_ptr - code <= (sljit_sw)compiler->size); in sljit_generate_code()
597 jump = compiler->jumps; in sljit_generate_code()
642 put_label = compiler->put_labels; in sljit_generate_code()
657 compiler->error = SLJIT_ERR_COMPILED; in sljit_generate_code()
658 compiler->executable_offset = executable_offset; in sljit_generate_code()
659 compiler->executable_size = (code_ptr - code) * sizeof(sljit_ins); in sljit_generate_code()
743 static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s…
751 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
759 …CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds,… in sljit_emit_enter()
760 set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
768 compiler->local_size = local_size; in sljit_emit_enter()
772 …FAIL_IF(push_inst(compiler, ADDIU_W | S(SLJIT_SP) | T(SLJIT_SP) | IMM(-local_size), DR(SLJIT_SP))); in sljit_emit_enter()
777 FAIL_IF(load_immediate(compiler, DR(OTHER_FLAG), local_size)); in sljit_emit_enter()
778 FAIL_IF(push_inst(compiler, ADDU_W | S(SLJIT_SP) | TA(0) | D(TMP_REG2), DR(TMP_REG2))); in sljit_emit_enter()
779 FAIL_IF(push_inst(compiler, SUBU_W | S(SLJIT_SP) | T(OTHER_FLAG) | D(SLJIT_SP), DR(SLJIT_SP))); in sljit_emit_enter()
785 FAIL_IF(push_inst(compiler, STACK_STORE | base | TA(RETURN_ADDR_REG) | IMM(offs), MOVABLE_INS)); in sljit_emit_enter()
790 FAIL_IF(push_inst(compiler, STACK_STORE | base | T(i) | IMM(offs), MOVABLE_INS)); in sljit_emit_enter()
795 FAIL_IF(push_inst(compiler, STACK_STORE | base | T(i) | IMM(offs), MOVABLE_INS)); in sljit_emit_enter()
801 FAIL_IF(push_inst(compiler, ADDU_W | SA(4) | TA(0) | D(SLJIT_S0), DR(SLJIT_S0))); in sljit_emit_enter()
803 FAIL_IF(push_inst(compiler, ADDU_W | SA(5) | TA(0) | D(SLJIT_S1), DR(SLJIT_S1))); in sljit_emit_enter()
805 FAIL_IF(push_inst(compiler, ADDU_W | SA(6) | TA(0) | D(SLJIT_S2), DR(SLJIT_S2))); in sljit_emit_enter()
810 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
815 …CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds… in sljit_set_context()
816 set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
820 compiler->local_size = (local_size + 15) & ~0xf; in sljit_set_context()
822 compiler->local_size = (local_size + 31) & ~0x1f; in sljit_set_context()
827 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op,… in sljit_emit_return() argument
833 CHECK(check_sljit_emit_return(compiler, op, src, srcw)); in sljit_emit_return()
835 FAIL_IF(emit_mov_before_return(compiler, op, src, srcw)); in sljit_emit_return()
837 local_size = compiler->local_size; in sljit_emit_return()
841 FAIL_IF(load_immediate(compiler, DR(TMP_REG1), local_size)); in sljit_emit_return()
842 FAIL_IF(push_inst(compiler, ADDU_W | S(SLJIT_SP) | T(TMP_REG1) | D(TMP_REG1), DR(TMP_REG1))); in sljit_emit_return()
847 …FAIL_IF(push_inst(compiler, STACK_LOAD | base | TA(RETURN_ADDR_REG) | IMM(local_size - (sljit_s32)… in sljit_emit_return()
848 offs = local_size - (sljit_s32)GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1); in sljit_emit_return()
850 tmp = compiler->scratches; in sljit_emit_return()
852 FAIL_IF(push_inst(compiler, STACK_LOAD | base | T(i) | IMM(offs), DR(i))); in sljit_emit_return()
856 …tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJ… in sljit_emit_return()
858 FAIL_IF(push_inst(compiler, STACK_LOAD | base | T(i) | IMM(offs), DR(i))); in sljit_emit_return()
864 FAIL_IF(push_inst(compiler, JR | SA(RETURN_ADDR_REG), UNMOVABLE_INS)); in sljit_emit_return()
865 if (compiler->local_size <= SIMM_MAX) in sljit_emit_return()
866 …return push_inst(compiler, ADDIU_W | S(SLJIT_SP) | T(SLJIT_SP) | IMM(compiler->local_size), UNMOVA… in sljit_emit_return()
868 return push_inst(compiler, ADDU_W | S(TMP_REG1) | TA(0) | D(SLJIT_SP), UNMOVABLE_INS); in sljit_emit_return()
914 static sljit_s32 getput_arg_fast(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar… in getput_arg_fast() argument
922 FAIL_IF(push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(arg & REG_MASK) in getput_arg_fast()
955 static sljit_s32 getput_arg(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg_ar, slj… in getput_arg() argument
979 if (argw == compiler->cache_argw) { in getput_arg()
980 if (arg == compiler->cache_arg) in getput_arg()
981 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(TMP_REG3) | TA(reg_ar), delay… in getput_arg()
983 if ((SLJIT_MEM | (arg & OFFS_REG_MASK)) == compiler->cache_arg) { in getput_arg()
985 compiler->cache_arg = arg; in getput_arg()
986 compiler->cache_argw = argw; in getput_arg()
987 FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | D(TMP_REG3), DR(TMP_REG3))); in getput_arg()
988 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(TMP_REG3) | TA(reg_ar), delay… in getput_arg()
990 FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(TMP_REG3) | DA(tmp_ar), tmp_ar)); in getput_arg()
991 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_… in getput_arg()
996 compiler->cache_arg = SLJIT_MEM | (arg & OFFS_REG_MASK); in getput_arg()
997 compiler->cache_argw = argw; in getput_arg()
998 … FAIL_IF(push_inst(compiler, SLL_W | T(OFFS_REG(arg)) | D(TMP_REG3) | SH_IMM(argw), DR(TMP_REG3))); in getput_arg()
1002 compiler->cache_arg = arg; in getput_arg()
1003 compiler->cache_argw = argw; in getput_arg()
1004 …FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(!argw ? OFFS_REG(arg) : TMP_REG3) | D(TMP_REG3), … in getput_arg()
1008 …FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(!argw ? OFFS_REG(arg) : TMP_REG3) | DA(tmp_ar), t… in getput_arg()
1009 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_… in getput_arg()
1012 …if (compiler->cache_arg == arg && argw - compiler->cache_argw <= SIMM_MAX && argw - compiler->cach… in getput_arg()
1013 if (argw != compiler->cache_argw) { in getput_arg()
1014 …FAIL_IF(push_inst(compiler, ADDIU_W | S(TMP_REG3) | T(TMP_REG3) | IMM(argw - compiler->cache_argw)… in getput_arg()
1015 compiler->cache_argw = argw; in getput_arg()
1017 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(TMP_REG3) | TA(reg_ar), delay… in getput_arg()
1020 …if (compiler->cache_arg == SLJIT_MEM && argw - compiler->cache_argw <= SIMM_MAX && argw - compiler in getput_arg()
1021 if (argw != compiler->cache_argw) in getput_arg()
1022 …FAIL_IF(push_inst(compiler, ADDIU_W | S(TMP_REG3) | T(TMP_REG3) | IMM(argw - compiler->cache_argw)… in getput_arg()
1025 compiler->cache_arg = SLJIT_MEM; in getput_arg()
1026 FAIL_IF(load_immediate(compiler, DR(TMP_REG3), argw)); in getput_arg()
1028 compiler->cache_argw = argw; in getput_arg()
1031 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(TMP_REG3) | TA(reg_ar), delay… in getput_arg()
1034 compiler->cache_arg = arg; in getput_arg()
1035 FAIL_IF(push_inst(compiler, ADDU_W | S(TMP_REG3) | T(base) | D(TMP_REG3), DR(TMP_REG3))); in getput_arg()
1036 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | S(TMP_REG3) | TA(reg_ar), delay… in getput_arg()
1039 FAIL_IF(push_inst(compiler, ADDU_W | S(TMP_REG3) | T(base) | DA(tmp_ar), tmp_ar)); in getput_arg()
1040 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_… in getput_arg()
1043 static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s… in emit_op_mem() argument
1047 if (getput_arg_fast(compiler, flags, reg_ar, arg, argw)) in emit_op_mem()
1048 return compiler->error; in emit_op_mem()
1064 FAIL_IF(push_inst(compiler, SLL_W | T(OFFS_REG(arg)) | DA(tmp_ar) | SH_IMM(argw), tmp_ar)); in emit_op_mem()
1065 FAIL_IF(push_inst(compiler, ADDU_W | S(base) | TA(tmp_ar) | DA(tmp_ar), tmp_ar)); in emit_op_mem()
1068 FAIL_IF(push_inst(compiler, ADDU_W | S(base) | T(OFFS_REG(arg)) | DA(tmp_ar), tmp_ar)); in emit_op_mem()
1069 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_… in emit_op_mem()
1072 FAIL_IF(load_immediate(compiler, tmp_ar, argw)); in emit_op_mem()
1075 FAIL_IF(push_inst(compiler, ADDU_W | S(base) | TA(tmp_ar) | DA(tmp_ar), tmp_ar)); in emit_op_mem()
1077 …return push_inst(compiler, data_transfer_insts[flags & MEM_MASK] | SA(tmp_ar) | TA(reg_ar), delay_… in emit_op_mem()
1080 static SLJIT_INLINE sljit_s32 emit_op_mem2(struct sljit_compiler *compiler, sljit_s32 flags, sljit_… in emit_op_mem2() argument
1082 if (getput_arg_fast(compiler, flags, reg, arg1, arg1w)) in emit_op_mem2()
1083 return compiler->error; in emit_op_mem2()
1084 return getput_arg(compiler, flags, reg, arg1, arg1w, arg2, arg2w); in emit_op_mem2()
1087 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 flags, in emit_op() argument
1102 compiler->cache_arg = 0; in emit_op()
1103 compiler->cache_argw = 0; in emit_op()
1116 …else if ((dst & SLJIT_MEM) && !getput_arg_fast(compiler, flags | ARG_TEST, DR(TMP_REG1), dst, dstw… in emit_op()
1149 FAIL_IF(load_immediate(compiler, DR(TMP_REG1), src1w)); in emit_op()
1156 if (getput_arg_fast(compiler, flags | LOAD_DATA, DR(TMP_REG1), src1, src1w)) in emit_op()
1157 FAIL_IF(compiler->error); in emit_op()
1173 FAIL_IF(load_immediate(compiler, DR(sugg_src2_r), src2w)); in emit_op()
1184 if (getput_arg_fast(compiler, flags | LOAD_DATA, DR(sugg_src2_r), src2, src2w)) in emit_op()
1185 FAIL_IF(compiler->error); in emit_op()
1194 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, DR(TMP_REG2), src2, src2w, src1, src1w)); in emit_op()
1195 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, DR(TMP_REG1), src1, src1w, dst, dstw)); in emit_op()
1198 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, DR(TMP_REG1), src1, src1w, src2, src2w)); in emit_op()
1199 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, DR(TMP_REG2), src2, src2w, dst, dstw)); in emit_op()
1203 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, DR(TMP_REG1), src1, src1w, dst, dstw)); in emit_op()
1205 FAIL_IF(getput_arg(compiler, flags | LOAD_DATA, DR(sugg_src2_r), src2, src2w, dst, dstw)); in emit_op()
1207 FAIL_IF(emit_single_op(compiler, op, flags, dst_r, src1_r, src2_r)); in emit_op()
1211 getput_arg_fast(compiler, flags, DR(dst_r), dst, dstw); in emit_op()
1212 return compiler->error; in emit_op()
1214 return getput_arg(compiler, flags, DR(dst_r), dst, dstw, 0, 0); in emit_op()
1220 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op) in sljit_emit_op0() argument
1227 CHECK(check_sljit_emit_op0(compiler, op)); in sljit_emit_op0()
1232 return push_inst(compiler, BREAK, UNMOVABLE_INS); in sljit_emit_op0()
1234 return push_inst(compiler, NOP, UNMOVABLE_INS); in sljit_emit_op0()
1239 …FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? DMULU : DMUL) | S(SLJIT_R0) | T(SLJIT_R1) | D(T… in sljit_emit_op0()
1240 …FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? DMUHU : DMUH) | S(SLJIT_R0) | T(SLJIT_R1) | D(T… in sljit_emit_op0()
1242 …FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? MULU : MUL) | S(SLJIT_R0) | T(SLJIT_R1) | D(TMP… in sljit_emit_op0()
1243 …FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? MUHU : MUH) | S(SLJIT_R0) | T(SLJIT_R1) | D(TMP… in sljit_emit_op0()
1245 FAIL_IF(push_inst(compiler, ADDU_W | S(TMP_REG3) | TA(0) | D(SLJIT_R0), DR(SLJIT_R0))); in sljit_emit_op0()
1246 return push_inst(compiler, ADDU_W | S(TMP_REG1) | TA(0) | D(SLJIT_R1), DR(SLJIT_R1)); in sljit_emit_op0()
1249 …FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? DMULTU : DMULT) | S(SLJIT_R0) | T(SLJIT_R1), MO… in sljit_emit_op0()
1251 …FAIL_IF(push_inst(compiler, (op == SLJIT_LMUL_UW ? MULTU : MULT) | S(SLJIT_R0) | T(SLJIT_R1), MOVA… in sljit_emit_op0()
1253 FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0))); in sljit_emit_op0()
1254 return push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1)); in sljit_emit_op0()
1264 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1) … in sljit_emit_op0()
1265 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? MODU : MOD) | S(SLJIT_R0) | T(SLJIT_R1) … in sljit_emit_op0()
1268 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1… in sljit_emit_op0()
1269 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DMODU : DMOD) | S(SLJIT_R0) | T(SLJIT_R1… in sljit_emit_op0()
1272 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1) … in sljit_emit_op0()
1273 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? MODU : MOD) | S(SLJIT_R0) | T(SLJIT_R1) … in sljit_emit_op0()
1275 FAIL_IF(push_inst(compiler, ADDU_W | S(TMP_REG3) | TA(0) | D(SLJIT_R0), DR(SLJIT_R0))); in sljit_emit_op0()
1276 …return (op >= SLJIT_DIV_UW) ? SLJIT_SUCCESS : push_inst(compiler, ADDU_W | S(TMP_REG1) | TA(0) | D… in sljit_emit_op0()
1279 FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); in sljit_emit_op0()
1280 FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); in sljit_emit_op0()
1284 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1),… in sljit_emit_op0()
1286 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DDIVU : DDIV) | S(SLJIT_R0) | T(SLJIT_R1… in sljit_emit_op0()
1288 …FAIL_IF(push_inst(compiler, ((op | 0x2) == SLJIT_DIV_UW ? DIVU : DIV) | S(SLJIT_R0) | T(SLJIT_R1),… in sljit_emit_op0()
1290 FAIL_IF(push_inst(compiler, MFLO | D(SLJIT_R0), DR(SLJIT_R0))); in sljit_emit_op0()
1291 …return (op >= SLJIT_DIV_UW) ? SLJIT_SUCCESS : push_inst(compiler, MFHI | D(SLJIT_R1), DR(SLJIT_R1)… in sljit_emit_op0()
1302 static sljit_s32 emit_prefetch(struct sljit_compiler *compiler, in emit_prefetch() argument
1307 return push_inst(compiler, PREF | S(src & REG_MASK) | IMM(srcw), MOVABLE_INS); in emit_prefetch()
1309 FAIL_IF(load_immediate(compiler, DR(TMP_REG1), srcw)); in emit_prefetch()
1310 return push_inst(compiler, PREFX | S(src & REG_MASK) | T(TMP_REG1), MOVABLE_INS); in emit_prefetch()
1316 FAIL_IF(push_inst(compiler, SLL_W | T(OFFS_REG(src)) | D(TMP_REG1) | SH_IMM(srcw), DR(TMP_REG1))); in emit_prefetch()
1317 return push_inst(compiler, PREFX | S(src & REG_MASK) | T(TMP_REG1), MOVABLE_INS); in emit_prefetch()
1320 return push_inst(compiler, PREFX | S(src & REG_MASK) | T(OFFS_REG(src)), MOVABLE_INS); in emit_prefetch()
1324 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op1() argument
1335 CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw)); in sljit_emit_op1()
1347 return emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1351 return emit_op(compiler, SLJIT_MOV_U32, INT_DATA, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1353 …return emit_op(compiler, SLJIT_MOV_U32, INT_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ?… in sljit_emit_op1()
1358 …return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1360 …return emit_op(compiler, SLJIT_MOV_S32, INT_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src … in sljit_emit_op1()
1364 …return emit_op(compiler, SLJIT_MOV_U8, BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) ?… in sljit_emit_op1()
1367 …return emit_op(compiler, SLJIT_MOV_S8, BYTE_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src … in sljit_emit_op1()
1370 …return emit_op(compiler, SLJIT_MOV_U16, HALF_DATA, dst, dstw, TMP_REG1, 0, src, (src & SLJIT_IMM) … in sljit_emit_op1()
1373 …return emit_op(compiler, SLJIT_MOV_S16, HALF_DATA | SIGNED_DATA, dst, dstw, TMP_REG1, 0, src, (src… in sljit_emit_op1()
1376 return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1379 …return emit_op(compiler, SLJIT_SUB | GET_ALL_FLAGS(op), flags | IMM_OP, dst, dstw, SLJIT_IMM, 0, s… in sljit_emit_op1()
1382 return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1393 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2() argument
1405 CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_op2()
1426 return emit_op(compiler, op, flags | CUMULATIVE_OP | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1430 return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1433 return emit_op(compiler, op, flags | CUMULATIVE_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1438 …return emit_op(compiler, op, flags | CUMULATIVE_OP | LOGICAL_OP | IMM_OP, dst, dstw, src1, src1w, … in sljit_emit_op2()
1454 return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1465 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op_src() argument
1469 CHECK(check_sljit_emit_op_src(compiler, op, src, srcw)); in sljit_emit_op_src()
1475 FAIL_IF(push_inst(compiler, ADDU_W | S(src) | TA(0) | DA(RETURN_ADDR_REG), RETURN_ADDR_REG)); in sljit_emit_op_src()
1477 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, RETURN_ADDR_REG, src, srcw)); in sljit_emit_op_src()
1479 FAIL_IF(push_inst(compiler, JR | SA(RETURN_ADDR_REG), UNMOVABLE_INS)); in sljit_emit_op_src()
1480 return push_inst(compiler, NOP, UNMOVABLE_INS); in sljit_emit_op_src()
1488 return emit_prefetch(compiler, src, srcw); in sljit_emit_op_src()
1509 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler, in sljit_emit_op_custom() argument
1513 CHECK(check_sljit_emit_op_custom(compiler, instruction, size)); in sljit_emit_op_custom()
1515 return push_inst(compiler, *(sljit_ins*)instruction, UNMOVABLE_INS); in sljit_emit_op_custom()
1525 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_sw_from_f64(struct sljit_compiler *compiler, slj… in sljit_emit_fop1_conv_sw_from_f64() argument
1536 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src, srcw, dst, dstw)); in sljit_emit_fop1_conv_sw_from_f64()
1540 …FAIL_IF(push_inst(compiler, (TRUNC_W_S ^ (flags >> 19)) | FMT(op) | FS(src) | FD(TMP_FREG1), MOVAB… in sljit_emit_fop1_conv_sw_from_f64()
1543 return push_inst(compiler, MFC1 | flags | T(dst) | FS(TMP_FREG1), MOVABLE_INS); in sljit_emit_fop1_conv_sw_from_f64()
1546 return emit_op_mem2(compiler, flags ? DOUBLE_DATA : SINGLE_DATA, FR(TMP_FREG1), dst, dstw, 0, 0); in sljit_emit_fop1_conv_sw_from_f64()
1553 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_conv_f64_from_sw(struct sljit_compiler *compiler, slj… in sljit_emit_fop1_conv_f64_from_sw() argument
1566 FAIL_IF(push_inst(compiler, MTC1 | flags | T(src) | FS(TMP_FREG1), MOVABLE_INS)); in sljit_emit_fop1_conv_f64_from_sw()
1569 …FAIL_IF(emit_op_mem2(compiler, ((flags) ? DOUBLE_DATA : SINGLE_DATA) | LOAD_DATA, FR(TMP_FREG1), s… in sljit_emit_fop1_conv_f64_from_sw()
1576 FAIL_IF(load_immediate(compiler, DR(TMP_REG1), srcw)); in sljit_emit_fop1_conv_f64_from_sw()
1577 FAIL_IF(push_inst(compiler, MTC1 | flags | T(TMP_REG1) | FS(TMP_FREG1), MOVABLE_INS)); in sljit_emit_fop1_conv_f64_from_sw()
1580 …FAIL_IF(push_inst(compiler, CVT_S_S | flags | (4 << 21) | (((op & SLJIT_F32_OP) ^ SLJIT_F32_OP) >>… in sljit_emit_fop1_conv_f64_from_sw()
1583 return emit_op_mem2(compiler, FLOAT_DATA(op), FR(TMP_FREG1), dst, dstw, 0, 0); in sljit_emit_fop1_conv_f64_from_sw()
1591 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1_cmp() argument
1598 …FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w, src2, src2w… in sljit_emit_fop1_cmp()
1603 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w, 0, 0)); in sljit_emit_fop1_cmp()
1625 return push_inst(compiler, inst | FMT(op) | FT(src2) | FS(src1) | C_FD, UNMOVABLE_INS); in sljit_emit_fop1_cmp()
1628 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1() argument
1635 compiler->cache_arg = 0; in sljit_emit_fop1()
1636 compiler->cache_argw = 0; in sljit_emit_fop1()
1639 SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw); in sljit_emit_fop1()
1647 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(dst_r), src, srcw, dst, dstw)); in sljit_emit_fop1()
1655 FAIL_IF(push_inst(compiler, MOV_S | FMT(op) | FS(src) | FD(dst_r), MOVABLE_INS)); in sljit_emit_fop1()
1661 FAIL_IF(push_inst(compiler, NEG_S | FMT(op) | FS(src) | FD(dst_r), MOVABLE_INS)); in sljit_emit_fop1()
1664 FAIL_IF(push_inst(compiler, ABS_S | FMT(op) | FS(src) | FD(dst_r), MOVABLE_INS)); in sljit_emit_fop1()
1667 …FAIL_IF(push_inst(compiler, CVT_S_S | ((op & SLJIT_F32_OP) ? 1 : (1 << 21)) | FS(src) | FD(dst_r),… in sljit_emit_fop1()
1673 return emit_op_mem2(compiler, FLOAT_DATA(op), FR(dst_r), dst, dstw, 0, 0); in sljit_emit_fop1()
1677 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop2() argument
1685 CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_fop2()
1690 compiler->cache_arg = 0; in sljit_emit_fop2()
1691 compiler->cache_argw = 0; in sljit_emit_fop2()
1696 if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w)) { in sljit_emit_fop2()
1697 FAIL_IF(compiler->error); in sljit_emit_fop2()
1704 if (getput_arg_fast(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w)) { in sljit_emit_fop2()
1705 FAIL_IF(compiler->error); in sljit_emit_fop2()
1713 …FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w, src1, src1w)); in sljit_emit_fop2()
1714 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w, dst, dstw)); in sljit_emit_fop2()
1717 …FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w, src2, src2w)); in sljit_emit_fop2()
1718 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w, dst, dstw)); in sljit_emit_fop2()
1722 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG1), src1, src1w, dst, dstw)); in sljit_emit_fop2()
1724 FAIL_IF(getput_arg(compiler, FLOAT_DATA(op) | LOAD_DATA, FR(TMP_FREG2), src2, src2w, dst, dstw)); in sljit_emit_fop2()
1733 FAIL_IF(push_inst(compiler, ADD_S | FMT(op) | FT(src2) | FS(src1) | FD(dst_r), MOVABLE_INS)); in sljit_emit_fop2()
1737 FAIL_IF(push_inst(compiler, SUB_S | FMT(op) | FT(src2) | FS(src1) | FD(dst_r), MOVABLE_INS)); in sljit_emit_fop2()
1741 FAIL_IF(push_inst(compiler, MUL_S | FMT(op) | FT(src2) | FS(src1) | FD(dst_r), MOVABLE_INS)); in sljit_emit_fop2()
1745 FAIL_IF(push_inst(compiler, DIV_S | FMT(op) | FT(src2) | FS(src1) | FD(dst_r), MOVABLE_INS)); in sljit_emit_fop2()
1750 FAIL_IF(emit_op_mem2(compiler, FLOAT_DATA(op), FR(TMP_FREG2), dst, dstw, 0, 0)); in sljit_emit_fop2()
1759 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_fast_enter() argument
1762 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw)); in sljit_emit_fast_enter()
1766 return push_inst(compiler, ADDU_W | SA(RETURN_ADDR_REG) | TA(0) | D(dst), UNMOVABLE_INS); in sljit_emit_fast_enter()
1769 FAIL_IF(emit_op_mem(compiler, WORD_DATA, RETURN_ADDR_REG, dst, dstw)); in sljit_emit_fast_enter()
1770 compiler->delay_slot = UNMOVABLE_INS; in sljit_emit_fast_enter()
1778 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler) in sljit_emit_label() argument
1783 CHECK_PTR(check_sljit_emit_label(compiler)); in sljit_emit_label()
1785 if (compiler->last_label && compiler->last_label->size == compiler->size) in sljit_emit_label()
1786 return compiler->last_label; in sljit_emit_label()
1788 label = (struct sljit_label*)ensure_abuf(compiler, sizeof(struct sljit_label)); in sljit_emit_label()
1790 set_label(label, compiler); in sljit_emit_label()
1791 compiler->delay_slot = UNMOVABLE_INS; in sljit_emit_label()
1835 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_… in sljit_emit_jump() argument
1843 CHECK_PTR(check_sljit_emit_jump(compiler, type)); in sljit_emit_jump()
1845 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
1847 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
1892 …if (compiler->delay_slot == MOVABLE_INS || (compiler->delay_slot != UNMOVABLE_INS && compiler->del… in sljit_emit_jump()
1896 PTR_FAIL_IF(push_inst(compiler, inst, UNMOVABLE_INS)); in sljit_emit_jump()
1898 PTR_FAIL_IF(emit_const(compiler, TMP_REG2, 0)); in sljit_emit_jump()
1901 PTR_FAIL_IF(push_inst(compiler, JR | S(TMP_REG2), UNMOVABLE_INS)); in sljit_emit_jump()
1904 PTR_FAIL_IF(push_inst(compiler, JALR | S(TMP_REG2) | DA(RETURN_ADDR_REG), UNMOVABLE_INS)); in sljit_emit_jump()
1907 jump->addr = compiler->size; in sljit_emit_jump()
1908 PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); in sljit_emit_jump()
1915 PTR_FAIL_IF(load_immediate(compiler, DR(TMP_REG1), src1w)); \
1925 PTR_FAIL_IF(load_immediate(compiler, DR(TMP_REG2), src2w)); \
1932 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler *compiler, sljit_s… in sljit_emit_cmp() argument
1941 CHECK_PTR(check_sljit_emit_cmp(compiler, type, src1, src1w, src2, src2w)); in sljit_emit_cmp()
1945 compiler->cache_arg = 0; in sljit_emit_cmp()
1946 compiler->cache_argw = 0; in sljit_emit_cmp()
1949 PTR_FAIL_IF(emit_op_mem2(compiler, flags, DR(TMP_REG1), src1, src1w, src2, src2w)); in sljit_emit_cmp()
1953 PTR_FAIL_IF(emit_op_mem2(compiler, flags, DR(TMP_REG2), src2, src2w, 0, 0)); in sljit_emit_cmp()
1957 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_cmp()
1959 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_cmp()
1966 …if (compiler->delay_slot == MOVABLE_INS || (compiler->delay_slot != UNMOVABLE_INS && compiler->del… in sljit_emit_cmp()
1968 …PTR_FAIL_IF(push_inst(compiler, (type == SLJIT_EQUAL ? BNE : BEQ) | S(src1) | T(src2) | JUMP_LENGT… in sljit_emit_cmp()
2015 PTR_FAIL_IF(push_inst(compiler, inst | S(src1) | JUMP_LENGTH, UNMOVABLE_INS)); in sljit_emit_cmp()
2021 …PTR_FAIL_IF(push_inst(compiler, (type <= SLJIT_LESS_EQUAL ? SLTIU : SLTI) | S(src1) | T(TMP_REG1) … in sljit_emit_cmp()
2024 …PTR_FAIL_IF(push_inst(compiler, (type <= SLJIT_LESS_EQUAL ? SLTU : SLT) | S(src1) | T(src2) | D(TM… in sljit_emit_cmp()
2031 …PTR_FAIL_IF(push_inst(compiler, (type <= SLJIT_LESS_EQUAL ? SLTIU : SLTI) | S(src2) | T(TMP_REG1) … in sljit_emit_cmp()
2034 …PTR_FAIL_IF(push_inst(compiler, (type <= SLJIT_LESS_EQUAL ? SLTU : SLT) | S(src2) | T(src1) | D(TM… in sljit_emit_cmp()
2040 …PTR_FAIL_IF(push_inst(compiler, (type == SLJIT_EQUAL ? BNE : BEQ) | S(TMP_REG1) | TA(0) | JUMP_LEN… in sljit_emit_cmp()
2043 PTR_FAIL_IF(emit_const(compiler, TMP_REG2, 0)); in sljit_emit_cmp()
2044 PTR_FAIL_IF(push_inst(compiler, JR | S(TMP_REG2), UNMOVABLE_INS)); in sljit_emit_cmp()
2045 jump->addr = compiler->size; in sljit_emit_cmp()
2046 PTR_FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); in sljit_emit_cmp()
2062 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type… in sljit_emit_ijump() argument
2067 CHECK(check_sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_ijump()
2071 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2073 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_JAL : 0)); in sljit_emit_ijump()
2076 if (compiler->delay_slot != UNMOVABLE_INS) in sljit_emit_ijump()
2079 FAIL_IF(emit_const(compiler, TMP_REG2, 0)); in sljit_emit_ijump()
2083 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, DR(TMP_REG2), src, srcw)); in sljit_emit_ijump()
2087 FAIL_IF(push_inst(compiler, JR | S(src), UNMOVABLE_INS)); in sljit_emit_ijump()
2089 jump->addr = compiler->size; in sljit_emit_ijump()
2090 FAIL_IF(push_inst(compiler, NOP, UNMOVABLE_INS)); in sljit_emit_ijump()
2094 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 o… in sljit_emit_op_flags() argument
2107 CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type)); in sljit_emit_op_flags()
2117 compiler->cache_arg = 0; in sljit_emit_op_flags()
2118 compiler->cache_argw = 0; in sljit_emit_op_flags()
2121 FAIL_IF(emit_op_mem2(compiler, mem_type | LOAD_DATA, DR(TMP_REG1), dst, dstw, dst, dstw)); in sljit_emit_op_flags()
2126 FAIL_IF(push_inst(compiler, SLTIU | SA(EQUAL_FLAG) | TA(dst_ar) | IMM(1), dst_ar)); in sljit_emit_op_flags()
2131 FAIL_IF(push_inst(compiler, SLTIU | SA(OTHER_FLAG) | TA(dst_ar) | IMM(1), dst_ar)); in sljit_emit_op_flags()
2145 FAIL_IF(push_inst(compiler, MFC1 | TA(dst_ar) | FS(TMP_FREG3), dst_ar)); in sljit_emit_op_flags()
2147 FAIL_IF(push_inst(compiler, CFC1 | TA(dst_ar) | DA(FCSR_REG), dst_ar)); in sljit_emit_op_flags()
2149 FAIL_IF(push_inst(compiler, SRL | TA(dst_ar) | DA(dst_ar) | SH_IMM(23), dst_ar)); in sljit_emit_op_flags()
2150 FAIL_IF(push_inst(compiler, ANDI | SA(dst_ar) | TA(dst_ar) | IMM(1), dst_ar)); in sljit_emit_op_flags()
2160 FAIL_IF(push_inst(compiler, XORI | SA(src_ar) | TA(dst_ar) | IMM(1), dst_ar)); in sljit_emit_op_flags()
2166 return emit_op_mem(compiler, mem_type, src_ar, dst, dstw); in sljit_emit_op_flags()
2169 return push_inst(compiler, ADDU_W | SA(src_ar) | TA(0) | DA(dst_ar), dst_ar); in sljit_emit_op_flags()
2175 FAIL_IF(push_inst(compiler, ADDU_W | SA(src_ar) | TA(0) | D(TMP_REG2), DR(TMP_REG2))); in sljit_emit_op_flags()
2180 return emit_op(compiler, saved_op, mem_type, dst, dstw, TMP_REG1, 0, TMP_REG2, 0); in sljit_emit_op_flags()
2181 return emit_op(compiler, saved_op, mem_type, dst, dstw, dst, dstw, TMP_REG2, 0); in sljit_emit_op_flags()
2184 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_cmov() argument
2193 CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw)); in sljit_emit_cmov()
2202 FAIL_IF(load_immediate(compiler, DR(TMP_REG1), srcw)); in sljit_emit_cmov()
2250 return push_inst(compiler, ins | S(src) | D(dst_reg), DR(dst_reg)); in sljit_emit_cmov()
2253 return sljit_emit_cmov_generic(compiler, type, dst_reg, src, srcw); in sljit_emit_cmov()
2257 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, slji… in sljit_emit_const() argument
2263 CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); in sljit_emit_const()
2266 const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); in sljit_emit_const()
2268 set_const(const_, compiler); in sljit_emit_const()
2271 PTR_FAIL_IF(emit_const(compiler, dst_r, init_value)); in sljit_emit_const()
2274 PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0)); in sljit_emit_const()
2279 …UTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, s… in sljit_emit_put_label() argument
2285 CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); in sljit_emit_put_label()
2288 put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); in sljit_emit_put_label()
2290 set_put_label(put_label, compiler, 0); in sljit_emit_put_label()
2294 PTR_FAIL_IF(emit_const(compiler, dst_r, 0)); in sljit_emit_put_label()
2296 PTR_FAIL_IF(push_inst(compiler, dst_r, UNMOVABLE_INS)); in sljit_emit_put_label()
2297 compiler->size += 5; in sljit_emit_put_label()
2301 PTR_FAIL_IF(emit_op(compiler, SLJIT_MOV, WORD_DATA, dst, dstw, TMP_REG1, 0, TMP_REG2, 0)); in sljit_emit_put_label()