Lines Matching refs:compiler

130 static sljit_s32 push_cpool(struct sljit_compiler *compiler)  in push_cpool()  argument
139 if (compiler->last_label && compiler->last_label->size == compiler->size) in push_cpool()
140 compiler->last_label->size += compiler->cpool_fill + (CONST_POOL_ALIGNMENT - 1) + 1; in push_cpool()
142 SLJIT_ASSERT(compiler->cpool_fill > 0 && compiler->cpool_fill <= CPOOL_SIZE); in push_cpool()
143 inst = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_cpool()
145 compiler->size++; in push_cpool()
146 *inst = 0xff000000 | compiler->cpool_fill; in push_cpool()
149 inst = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_cpool()
151 compiler->size++; in push_cpool()
155 cpool_ptr = compiler->cpool; in push_cpool()
156 cpool_end = cpool_ptr + compiler->cpool_fill; in push_cpool()
158 inst = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_cpool()
160 compiler->size++; in push_cpool()
163 compiler->cpool_diff = CONST_POOL_EMPTY; in push_cpool()
164 compiler->cpool_fill = 0; in push_cpool()
168 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_uw inst) in push_inst() argument
172 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in push_inst()
173 FAIL_IF(push_cpool(compiler)); in push_inst()
175 ptr = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_inst()
177 compiler->size++; in push_inst()
182 static sljit_s32 push_inst_with_literal(struct sljit_compiler *compiler, sljit_uw inst, sljit_uw li… in push_inst_with_literal() argument
190 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in push_inst_with_literal()
191 FAIL_IF(push_cpool(compiler)); in push_inst_with_literal()
192 else if (compiler->cpool_fill > 0) { in push_inst_with_literal()
193 cpool_ptr = compiler->cpool; in push_inst_with_literal()
194 cpool_end = cpool_ptr + compiler->cpool_fill; in push_inst_with_literal()
195 cpool_unique_ptr = compiler->cpool_unique; in push_inst_with_literal()
198 cpool_index = cpool_ptr - compiler->cpool; in push_inst_with_literal()
208 if (compiler->cpool_fill < CPOOL_SIZE) { in push_inst_with_literal()
209 cpool_index = compiler->cpool_fill; in push_inst_with_literal()
210 compiler->cpool_fill++; in push_inst_with_literal()
213 FAIL_IF(push_cpool(compiler)); in push_inst_with_literal()
215 compiler->cpool_fill = 1; in push_inst_with_literal()
220 ptr = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_inst_with_literal()
222 compiler->size++; in push_inst_with_literal()
225 compiler->cpool[cpool_index] = literal; in push_inst_with_literal()
226 compiler->cpool_unique[cpool_index] = 0; in push_inst_with_literal()
227 if (compiler->cpool_diff == CONST_POOL_EMPTY) in push_inst_with_literal()
228 compiler->cpool_diff = compiler->size; in push_inst_with_literal()
232 static sljit_s32 push_inst_with_unique_literal(struct sljit_compiler *compiler, sljit_uw inst, slji… in push_inst_with_unique_literal() argument
235 …(SLJIT_UNLIKELY((compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_diff… in push_inst_with_unique_literal()
236 FAIL_IF(push_cpool(compiler)); in push_inst_with_unique_literal()
238 SLJIT_ASSERT(compiler->cpool_fill < CPOOL_SIZE && (inst & 0xfff) == 0); in push_inst_with_unique_literal()
239 ptr = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_inst_with_unique_literal()
241 compiler->size++; in push_inst_with_unique_literal()
242 *ptr = inst | compiler->cpool_fill; in push_inst_with_unique_literal()
244 compiler->cpool[compiler->cpool_fill] = literal; in push_inst_with_unique_literal()
245 compiler->cpool_unique[compiler->cpool_fill] = 1; in push_inst_with_unique_literal()
246 compiler->cpool_fill++; in push_inst_with_unique_literal()
247 if (compiler->cpool_diff == CONST_POOL_EMPTY) in push_inst_with_unique_literal()
248 compiler->cpool_diff = compiler->size; in push_inst_with_unique_literal()
252 static SLJIT_INLINE sljit_s32 prepare_blx(struct sljit_compiler *compiler) in prepare_blx() argument
255 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in prepare_blx()
256 return push_cpool(compiler); in prepare_blx()
260 static SLJIT_INLINE sljit_s32 emit_blx(struct sljit_compiler *compiler) in emit_blx() argument
263 …SLJIT_ASSERT(compiler->cpool_diff == CONST_POOL_EMPTY || compiler->size - compiler->cpool_diff < M… in emit_blx()
264 return push_inst(compiler, BLX | RM(TMP_REG2)); in emit_blx()
319 static sljit_s32 resolve_const_pool_index(struct sljit_compiler *compiler, struct future_patch **fi… in resolve_const_pool_index() argument
324 SLJIT_UNUSED_ARG(compiler); in resolve_const_pool_index()
343 SLJIT_FREE(curr_patch, compiler->allocator_data); in resolve_const_pool_index()
353 …curr_patch = (struct future_patch*)SLJIT_MALLOC(sizeof(struct future_patch), compiler->allocator_d… in resolve_const_pool_index()
358 SLJIT_FREE(curr_patch, compiler->allocator_data); in resolve_const_pool_index()
374 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_uw inst) in push_inst() argument
378 ptr = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_inst()
380 compiler->size++; in push_inst()
385 static SLJIT_INLINE sljit_s32 emit_imm(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm) in emit_imm() argument
387 FAIL_IF(push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | (imm & 0xfff))); in emit_imm()
388 return push_inst(compiler, MOVT | RD(reg) | ((imm >> 12) & 0xf0000) | ((imm >> 16) & 0xfff)); in emit_imm()
566 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler) in sljit_generate_code() argument
591 CHECK_PTR(check_sljit_generate_code(compiler)); in sljit_generate_code()
592 reverse_buf(compiler); in sljit_generate_code()
596 size = compiler->size + (compiler->patches << 1); in sljit_generate_code()
597 if (compiler->cpool_fill > 0) in sljit_generate_code()
598 size += compiler->cpool_fill + CONST_POOL_ALIGNMENT - 1; in sljit_generate_code()
600 size = compiler->size; in sljit_generate_code()
604 buf = compiler->buf; in sljit_generate_code()
619 label = compiler->labels; in sljit_generate_code()
620 jump = compiler->jumps; in sljit_generate_code()
621 const_ = compiler->consts; in sljit_generate_code()
640 …if (SLJIT_UNLIKELY(resolve_const_pool_index(compiler, &first_patch, cpool_current_index, cpool_sta… in sljit_generate_code()
642 compiler->error = SLJIT_ERR_ALLOC_FAILED; in sljit_generate_code()
720 if (compiler->cpool_fill > 0) { in sljit_generate_code()
722 …ndex = patch_pc_relative_loads(last_pc_patch, code_ptr, cpool_start_address, compiler->cpool_fill); in sljit_generate_code()
726 buf_ptr = compiler->cpool; in sljit_generate_code()
727 buf_end = buf_ptr + compiler->cpool_fill; in sljit_generate_code()
730 …if (SLJIT_UNLIKELY(resolve_const_pool_index(compiler, &first_patch, cpool_current_index, cpool_sta… in sljit_generate_code()
732 compiler->error = SLJIT_ERR_ALLOC_FAILED; in sljit_generate_code()
742 jump = compiler->jumps; in sljit_generate_code()
786 const_ = compiler->consts; in sljit_generate_code()
807 compiler->error = SLJIT_ERR_COMPILED; in sljit_generate_code()
808 compiler->executable_offset = executable_offset; in sljit_generate_code()
809 compiler->executable_size = (code_ptr - code) * sizeof(sljit_uw); in sljit_generate_code()
875 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags,
880 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
888 …CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, loca… in sljit_emit_enter()
889 set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
902 FAIL_IF(push_inst(compiler, push)); in sljit_emit_enter()
907 compiler->local_size = local_size; in sljit_emit_enter()
909 FAIL_IF(emit_op(compiler, SLJIT_SUB, ALLOW_IMM, SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, local_size)); in sljit_emit_enter()
912 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, SLJIT_S0, SLJIT_UNUSED, RM(SLJIT_R0))… in sljit_emit_enter()
914 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, SLJIT_S1, SLJIT_UNUSED, RM(SLJIT_R1))… in sljit_emit_enter()
916 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, SLJIT_S2, SLJIT_UNUSED, RM(SLJIT_R2))… in sljit_emit_enter()
921 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
928 …CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, loc… in sljit_set_context()
929 set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
932 compiler->local_size = ((size + local_size + 7) & ~7) - size; in sljit_set_context()
936 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op,… in sljit_emit_return() argument
942 CHECK(check_sljit_emit_return(compiler, op, src, srcw)); in sljit_emit_return()
944 FAIL_IF(emit_mov_before_return(compiler, op, src, srcw)); in sljit_emit_return()
946 if (compiler->local_size > 0) in sljit_emit_return()
947 …FAIL_IF(emit_op(compiler, SLJIT_ADD, ALLOW_IMM, SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, compiler->loc… in sljit_emit_return()
953 …tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJ… in sljit_emit_return()
957 for (i = compiler->scratches; i >= SLJIT_FIRST_SAVED_REG; i--) in sljit_emit_return()
960 return push_inst(compiler, pop); in sljit_emit_return()
984 if (compiler->shift_imm != 0x20) { \
988 if (compiler->shift_imm != 0) \
989 return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, flags & SET_FLAGS, \
990 dst, SLJIT_UNUSED, (compiler->shift_imm << 7) | (opcode << 5) | RM(src2))); \
991 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, flags & SET_FLAGS, dst, SLJIT_UNUSED, RM(…
993 return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, flags & SET_FLAGS, \
996 static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s… in emit_single_op() argument
1004 return push_inst(compiler, EMIT_DATA_PROCESS_INS((flags & INV_IMM) ? MVN_DP : MOV_DP, 0, in emit_single_op()
1007 return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, RM(src2))); in emit_single_op()
1017 return push_inst(compiler, EMIT_DATA_PROCESS_INS(AND_DP, 0, dst, src2, SRC2_IMM | 0xff)); in emit_single_op()
1018 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (24 << 7) | RM(src… in emit_single_op()
1019 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (24 << 7) | (op == … in emit_single_op()
1021 return push_inst(compiler, (op == SLJIT_MOV_U8 ? UXTB : SXTB) | RD(dst) | RM(src2)); in emit_single_op()
1026 return push_inst(compiler, EMIT_DATA_PROCESS_INS((flags & INV_IMM) ? MVN_DP : MOV_DP, 0, in emit_single_op()
1036 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (16 << 7) | RM(src… in emit_single_op()
1037 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, (16 << 7) | (op == … in emit_single_op()
1039 return push_inst(compiler, (op == SLJIT_MOV_U16 ? UXTH : SXTH) | RD(dst) | RM(src2)); in emit_single_op()
1044 return push_inst(compiler, EMIT_DATA_PROCESS_INS((flags & INV_IMM) ? MVN_DP : MOV_DP, 0, in emit_single_op()
1051 …return push_inst(compiler, EMIT_DATA_PROCESS_INS((flags & INV_IMM) ? MOV_DP : MVN_DP, flags & SET_… in emit_single_op()
1054 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(MVN_DP, flags & SET_FLAGS, dst, SLJIT_UNUSED, RM(… in emit_single_op()
1059 FAIL_IF(push_inst(compiler, CLZ | RD(dst) | RM(src2))); in emit_single_op()
1061 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(CMP_DP, flags & SET_FLAGS, SLJIT_UNUSED, dst, SRC… in emit_single_op()
1066 return push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, flags & SET_FLAGS, in emit_single_op()
1071 return push_inst(compiler, EMIT_DATA_PROCESS_INS(ADC_DP, flags & SET_FLAGS, in emit_single_op()
1076 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(!(flags & ARGS_SWAPPED) ? SUB_DP : RSB_DP, flags … in emit_single_op()
1081 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(!(flags & ARGS_SWAPPED) ? SBC_DP : RSC_DP, flags … in emit_single_op()
1089 return push_inst(compiler, MUL | (reg_map[dst] << 16) | (reg_map[src2] << 8) | reg_map[src1]); in emit_single_op()
1091 …FAIL_IF(push_inst(compiler, SMULL | (reg_map[TMP_REG1] << 16) | (reg_map[dst] << 12) | (reg_map[sr… in emit_single_op()
1094 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(CMP_DP, SET_FLAGS, SLJIT_UNUSED, TMP_REG1, RM(dst… in emit_single_op()
1097 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(!(flags & INV_IMM) ? AND_DP : BIC_DP, flags & SET… in emit_single_op()
1102 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(ORR_DP, flags & SET_FLAGS, dst, src1, (src2 & SRC… in emit_single_op()
1106 …return push_inst(compiler, EMIT_DATA_PROCESS_INS(EOR_DP, flags & SET_FLAGS, dst, src1, (src2 & SRC… in emit_single_op()
1164 static sljit_s32 generate_int(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm, sljit_s… in generate_int() argument
1269 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(positive ? MOV_DP : MVN_DP, 0, reg, SLJIT_UNUSED… in generate_int()
1270 FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(positive ? ORR_DP : BIC_DP, 0, reg, reg, imm2))); in generate_int()
1275 static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm) in load_immediate() argument
1281 return push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | (imm & 0xfff)); in load_immediate()
1287 return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, reg, SLJIT_UNUSED, tmp)); in load_immediate()
1291 return push_inst(compiler, EMIT_DATA_PROCESS_INS(MVN_DP, 0, reg, SLJIT_UNUSED, tmp)); in load_immediate()
1295 FAIL_IF(generate_int(compiler, reg, imm, 1)); in load_immediate()
1296 FAIL_IF(generate_int(compiler, reg, ~imm, 0)); in load_immediate()
1299 …return push_inst_with_literal(compiler, EMIT_DATA_TRANSFER(WORD_DATA | LOAD_DATA, 1, 0, reg, TMP_P… in load_immediate()
1301 return emit_imm(compiler, reg, imm); in load_immediate()
1305 static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s… in emit_op_mem() argument
1318 FAIL_IF(load_immediate(compiler, tmp_reg, argw)); in emit_op_mem()
1319 …return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, 0, reg, tmp_reg, is_type1_transfer ? 0 : T… in emit_op_mem()
1330 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, tmp_reg, arg, RM(offset_reg) | (argw … in emit_op_mem()
1331 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, 0, reg, tmp_reg, TYPE2_TRANSFER_IMM(0))); in emit_op_mem()
1335 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, flags & WRITE_BACK, reg, arg, in emit_op_mem()
1346 FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, offset_reg, arg, imm))); in emit_op_mem()
1355 FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(SUB_DP, 0, offset_reg, arg, imm))); in emit_op_mem()
1362 …return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, flags & WRITE_BACK, reg, arg & REG_MASK, a… in emit_op_mem()
1365 …return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 0, flags & WRITE_BACK, reg, arg & REG_MASK, -… in emit_op_mem()
1373 FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, offset_reg, arg, imm))); in emit_op_mem()
1382 FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(SUB_DP, 0, offset_reg, arg, imm))); in emit_op_mem()
1389 …return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, flags & WRITE_BACK, reg, arg, TYPE2_TRANSF… in emit_op_mem()
1393 …return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 0, flags & WRITE_BACK, reg, arg, TYPE2_TRANSF… in emit_op_mem()
1397 FAIL_IF(load_immediate(compiler, tmp_reg, argw)); in emit_op_mem()
1398 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, flags & WRITE_BACK, reg, arg, in emit_op_mem()
1402 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags, in emit_op() argument
1492 FAIL_IF(emit_op_mem(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w, TMP_REG1)); in emit_op()
1496 FAIL_IF(load_immediate(compiler, TMP_REG1, src1w)); in emit_op()
1509 return emit_op_mem(compiler, inp_flags, src2, dst, dstw, TMP_REG2); in emit_op()
1523 FAIL_IF(emit_op_mem(compiler, inp_flags | LOAD_DATA, src2_reg, src2, src2w, TMP_REG2)); in emit_op()
1525 FAIL_IF(load_immediate(compiler, src2_reg, src2w)); in emit_op()
1528 FAIL_IF(emit_single_op(compiler, op, flags, dst_reg, src1_reg, src2_reg)); in emit_op()
1533 return emit_op_mem(compiler, inp_flags, dst_reg, dst, dstw, TMP_REG1); in emit_op()
1551 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op) in sljit_emit_op0() argument
1557 CHECK(check_sljit_emit_op0(compiler, op)); in sljit_emit_op0()
1562 FAIL_IF(push_inst(compiler, BKPT)); in sljit_emit_op0()
1565 FAIL_IF(push_inst(compiler, NOP)); in sljit_emit_op0()
1569 return push_inst(compiler, (op == SLJIT_LMUL_UW ? UMULL : SMULL) in sljit_emit_op0()
1582 if (compiler->scratches >= 4) in sljit_emit_op0()
1584 if (compiler->scratches >= 3) in sljit_emit_op0()
1590 FAIL_IF(push_inst(compiler, 0xe52d0000 | (saved_reg_count >= 3 ? 16 : 8) in sljit_emit_op0()
1594 FAIL_IF(push_inst(compiler, 0xe58d0004 | (saved_reg_list[1] << 12) /* str rX, [sp, #4] */)); in sljit_emit_op0()
1598 FAIL_IF(push_inst(compiler, 0xe58d0008 | (saved_reg_list[2] << 12) /* str rX, [sp, #8] */)); in sljit_emit_op0()
1603 FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM, in sljit_emit_op0()
1612 FAIL_IF(push_inst(compiler, 0xe59d0008 | (saved_reg_list[2] << 12) /* ldr rX, [sp, #8] */)); in sljit_emit_op0()
1616 FAIL_IF(push_inst(compiler, 0xe59d0004 | (saved_reg_list[1] << 12) /* ldr rX, [sp, #4] */)); in sljit_emit_op0()
1618 return push_inst(compiler, 0xe49d0000 | (saved_reg_count >= 3 ? 16 : 8) in sljit_emit_op0()
1627 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op1() argument
1632 CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw)); in sljit_emit_op1()
1641 return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1644 …return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_DATA, dst, dstw, TMP_REG1, 0, src, (sr… in sljit_emit_op1()
1647 …return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA, dst, dstw, TMP_REG… in sljit_emit_op1()
1650 …return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_DATA, dst, dstw, TMP_REG1, 0, src, (s… in sljit_emit_op1()
1653 …return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA, dst, dstw, TMP_RE… in sljit_emit_op1()
1659 …return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM | WRITE_BACK, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1662 …return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_DATA | WRITE_BACK, dst, dstw, TMP_REG1… in sljit_emit_op1()
1665 …return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED_DATA | BYTE_DATA | WRITE_BACK, dst, … in sljit_emit_op1()
1668 …return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_DATA | WRITE_BACK, dst, dstw, TMP_REG… in sljit_emit_op1()
1671 …return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED_DATA | HALF_DATA | WRITE_BACK, dst,… in sljit_emit_op1()
1674 return emit_op(compiler, op, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1679 compiler->skip_checks = 1; in sljit_emit_op1()
1681 …return sljit_emit_op2(compiler, SLJIT_SUB | GET_ALL_FLAGS(op), dst, dstw, SLJIT_IMM, 0, src, srcw); in sljit_emit_op1()
1684 return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
1690 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2() argument
1696 CHECK(check_sljit_emit_op2(compiler, op, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_op2()
1708 return emit_op(compiler, op, ALLOW_IMM, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1711 return emit_op(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1714 return emit_op(compiler, op, ALLOW_ANY_IMM, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1720 compiler->shift_imm = src2w & 0x1f; in sljit_emit_op2()
1721 return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src1, src1w); in sljit_emit_op2()
1724 compiler->shift_imm = 0x20; in sljit_emit_op2()
1725 return emit_op(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
1744 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler, in sljit_emit_op_custom() argument
1748 CHECK(check_sljit_emit_op_custom(compiler, instruction, size)); in sljit_emit_op_custom()
1750 return push_inst(compiler, *(sljit_uw*)instruction); in sljit_emit_op_custom()
1801 static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, slji… in emit_fop_mem() argument
1810 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, TMP_REG2, arg & REG_MASK, RM(OFFS_REG… in emit_fop_mem()
1818 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, arg & REG_MASK, reg, argw >> 2)); in emit_fop_mem()
1820 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, arg & REG_MASK, reg, (-argw) >> 2)); in emit_fop_mem()
1824 FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, TMP_REG2, arg & REG_MASK, imm))); in emit_fop_mem()
1825 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG2, reg, (argw & 0x3fc) >> 2)); in emit_fop_mem()
1830 FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(SUB_DP, 0, TMP_REG2, arg & REG_MASK, imm))); in emit_fop_mem()
1831 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, TMP_REG2, reg, (argw & 0x3fc) >> 2)); in emit_fop_mem()
1836 FAIL_IF(load_immediate(compiler, TMP_REG2, argw)); in emit_fop_mem()
1837 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(ADD_DP, 0, TMP_REG2, arg & REG_MASK, RM(TMP_REG2… in emit_fop_mem()
1840 FAIL_IF(load_immediate(compiler, TMP_REG2, argw)); in emit_fop_mem()
1842 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG2, reg, 0)); in emit_fop_mem()
1845 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
1852 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src, srcw)); in sljit_emit_fop1_conv_sw_from_f64()
1856 …FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_S32_F32, op & SLJIT_F32_OP, TMP_FREG1, src, 0)… in sljit_emit_fop1_conv_sw_from_f64()
1862 return push_inst(compiler, VMOV | (1 << 20) | RD(dst) | (TMP_FREG1 << 16)); in sljit_emit_fop1_conv_sw_from_f64()
1865 return emit_fop_mem(compiler, 0, TMP_FREG1, dst, dstw); in sljit_emit_fop1_conv_sw_from_f64()
1868 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
1877 FAIL_IF(push_inst(compiler, VMOV | RD(src) | (TMP_FREG1 << 16))); in sljit_emit_fop1_conv_f64_from_sw()
1880 FAIL_IF(emit_fop_mem(compiler, FPU_LOAD, TMP_FREG1, src, srcw)); in sljit_emit_fop1_conv_f64_from_sw()
1883 FAIL_IF(load_immediate(compiler, TMP_REG1, srcw)); in sljit_emit_fop1_conv_f64_from_sw()
1884 FAIL_IF(push_inst(compiler, VMOV | RD(TMP_REG1) | (TMP_FREG1 << 16))); in sljit_emit_fop1_conv_f64_from_sw()
1887 …FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F32_S32, op & SLJIT_F32_OP, dst_r, TMP_FREG1, … in sljit_emit_fop1_conv_f64_from_sw()
1890 return emit_fop_mem(compiler, (op & SLJIT_F32_OP), TMP_FREG1, dst, dstw); in sljit_emit_fop1_conv_f64_from_sw()
1894 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1_cmp() argument
1901 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src1, src1w)); in sljit_emit_fop1_cmp()
1906 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG2, src2, src2w)); in sljit_emit_fop1_cmp()
1910 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCMP_F32, op & SLJIT_F32_OP, src1, src2, 0))); in sljit_emit_fop1_cmp()
1911 return push_inst(compiler, VMRS); in sljit_emit_fop1_cmp()
1914 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1() argument
1923 SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw); in sljit_emit_fop1()
1931 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, dst_r, src, srcw)); in sljit_emit_fop1()
1939 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, op & SLJIT_F32_OP, dst_r, src, 0))); in sljit_emit_fop1()
1945 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VNEG_F32, op & SLJIT_F32_OP, dst_r, src, 0))); in sljit_emit_fop1()
1948 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VABS_F32, op & SLJIT_F32_OP, dst_r, src, 0))); in sljit_emit_fop1()
1951 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F64_F32, op & SLJIT_F32_OP, dst_r, src, 0))); in sljit_emit_fop1()
1957 return emit_fop_mem(compiler, (op & SLJIT_F32_OP), dst_r, dst, dstw); in sljit_emit_fop1()
1961 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop2() argument
1969 CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_fop2()
1979 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG2, src2, src2w)); in sljit_emit_fop2()
1984 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP) | FPU_LOAD, TMP_FREG1, src1, src1w)); in sljit_emit_fop2()
1990 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VADD_F32, op & SLJIT_F32_OP, dst_r, src2, src1))); in sljit_emit_fop2()
1994 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VSUB_F32, op & SLJIT_F32_OP, dst_r, src2, src1))); in sljit_emit_fop2()
1998 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMUL_F32, op & SLJIT_F32_OP, dst_r, src2, src1))); in sljit_emit_fop2()
2002 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VDIV_F32, op & SLJIT_F32_OP, dst_r, src2, src1))); in sljit_emit_fop2()
2007 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_F32_OP), TMP_FREG1, dst, dstw)); in sljit_emit_fop2()
2020 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_fast_enter() argument
2023 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw)); in sljit_emit_fast_enter()
2033 return push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst, SLJIT_UNUSED, RM(TMP_REG1))); in sljit_emit_fast_enter()
2036 return emit_op_mem(compiler, WORD_DATA, TMP_REG1, dst, dstw, TMP_REG2); in sljit_emit_fast_enter()
2039 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s3… in sljit_emit_fast_return() argument
2042 CHECK(check_sljit_emit_fast_return(compiler, src, srcw)); in sljit_emit_fast_return()
2048 FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, TMP_REG1, 0, RM(src)))); in sljit_emit_fast_return()
2050 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG2)); in sljit_emit_fast_return()
2052 FAIL_IF(load_immediate(compiler, TMP_REG1, srcw)); in sljit_emit_fast_return()
2054 return push_inst(compiler, BX | RM(TMP_REG1)); in sljit_emit_fast_return()
2116 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler) in sljit_emit_label() argument
2121 CHECK_PTR(check_sljit_emit_label(compiler)); in sljit_emit_label()
2123 if (compiler->last_label && compiler->last_label->size == compiler->size) in sljit_emit_label()
2124 return compiler->last_label; in sljit_emit_label()
2126 label = (struct sljit_label*)ensure_abuf(compiler, sizeof(struct sljit_label)); in sljit_emit_label()
2128 set_label(label, compiler); in sljit_emit_label()
2132 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_… in sljit_emit_jump() argument
2137 CHECK_PTR(check_sljit_emit_jump(compiler, type)); in sljit_emit_jump()
2139 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2141 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2147 PTR_FAIL_IF(prepare_blx(compiler)); in sljit_emit_jump()
2148 …PTR_FAIL_IF(push_inst_with_unique_literal(compiler, ((EMIT_DATA_TRANSFER(WORD_DATA | LOAD_DATA, 1,… in sljit_emit_jump()
2152 jump->addr = compiler->size; in sljit_emit_jump()
2153 compiler->patches++; in sljit_emit_jump()
2158 PTR_FAIL_IF(emit_blx(compiler)); in sljit_emit_jump()
2162 jump->addr = compiler->size; in sljit_emit_jump()
2166 PTR_FAIL_IF(emit_imm(compiler, TMP_REG2, 0)); in sljit_emit_jump()
2167 …PTR_FAIL_IF(push_inst(compiler, (((type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG2)) & ~COND_MASK) | … in sljit_emit_jump()
2168 jump->addr = compiler->size; in sljit_emit_jump()
2173 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type… in sljit_emit_ijump() argument
2178 CHECK(check_sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_ijump()
2184 return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(src)); in sljit_emit_ijump()
2187 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG2, src, srcw, TMP_REG2)); in sljit_emit_ijump()
2188 return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG2)); in sljit_emit_ijump()
2191 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2193 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_BL : 0)); in sljit_emit_ijump()
2198 FAIL_IF(prepare_blx(compiler)); in sljit_emit_ijump()
2199 …FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_DATA | LOAD_DATA, 1, 0, ty… in sljit_emit_ijump()
2201 FAIL_IF(emit_blx(compiler)); in sljit_emit_ijump()
2203 FAIL_IF(emit_imm(compiler, TMP_REG2, 0)); in sljit_emit_ijump()
2204 FAIL_IF(push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG2))); in sljit_emit_ijump()
2206 jump->addr = compiler->size; in sljit_emit_ijump()
2210 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 o… in sljit_emit_op_flags() argument
2219 CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, src, srcw, type)); in sljit_emit_op_flags()
2231 …FAIL_IF(push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst_reg, SLJIT_UNUSED, SRC2_IMM | 0))… in sljit_emit_op_flags()
2232 …FAIL_IF(push_inst(compiler, (EMIT_DATA_PROCESS_INS(MOV_DP, 0, dst_reg, SLJIT_UNUSED, SRC2_IMM | 1)… in sljit_emit_op_flags()
2233 …return (dst_reg == TMP_REG2) ? emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw, TMP_REG1) : S… in sljit_emit_op_flags()
2238 …FAIL_IF(push_inst(compiler, (EMIT_DATA_PROCESS_INS(ins, 0, dst, dst, SRC2_IMM | 1) & ~COND_MASK) |… in sljit_emit_op_flags()
2240 …return (flags & SLJIT_SET_Z) ? push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, SET_FLAGS, TMP_RE… in sljit_emit_op_flags()
2244 FAIL_IF(emit_op_mem(compiler, WORD_DATA | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1)); in sljit_emit_op_flags()
2247 FAIL_IF(load_immediate(compiler, TMP_REG1, srcw)); in sljit_emit_op_flags()
2251 …FAIL_IF(push_inst(compiler, (EMIT_DATA_PROCESS_INS(ins, 0, dst_reg, src, SRC2_IMM | 1) & ~COND_MAS… in sljit_emit_op_flags()
2252 …FAIL_IF(push_inst(compiler, (EMIT_DATA_PROCESS_INS(ins, 0, dst_reg, src, SRC2_IMM | 0) & ~COND_MAS… in sljit_emit_op_flags()
2254 FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw, TMP_REG1)); in sljit_emit_op_flags()
2256 …return (flags & SLJIT_SET_Z) ? push_inst(compiler, EMIT_DATA_PROCESS_INS(MOV_DP, SET_FLAGS, TMP_RE… in sljit_emit_op_flags()
2259 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, slji… in sljit_emit_const() argument
2265 CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); in sljit_emit_const()
2268 const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); in sljit_emit_const()
2274 …PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_DATA | LOAD_DATA, 1, 0… in sljit_emit_const()
2275 compiler->patches++; in sljit_emit_const()
2277 PTR_FAIL_IF(emit_imm(compiler, reg, init_value)); in sljit_emit_const()
2279 set_const(const_, compiler); in sljit_emit_const()
2282 PTR_FAIL_IF(emit_op_mem(compiler, WORD_DATA, TMP_REG2, dst, dstw, TMP_REG1)); in sljit_emit_const()