Lines Matching refs:compiler

148 static sljit_s32 push_cpool(struct sljit_compiler *compiler)  in push_cpool()  argument
157 if (compiler->last_label && compiler->last_label->size == compiler->size) in push_cpool()
158 compiler->last_label->size += compiler->cpool_fill + (CONST_POOL_ALIGNMENT - 1) + 1; in push_cpool()
160 SLJIT_ASSERT(compiler->cpool_fill > 0 && compiler->cpool_fill <= CPOOL_SIZE); in push_cpool()
161 inst = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_cpool()
163 compiler->size++; in push_cpool()
164 *inst = 0xff000000 | compiler->cpool_fill; in push_cpool()
167 inst = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_cpool()
169 compiler->size++; in push_cpool()
173 cpool_ptr = compiler->cpool; in push_cpool()
174 cpool_end = cpool_ptr + compiler->cpool_fill; in push_cpool()
176 inst = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_cpool()
178 compiler->size++; in push_cpool()
181 compiler->cpool_diff = CONST_POOL_EMPTY; in push_cpool()
182 compiler->cpool_fill = 0; in push_cpool()
186 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_uw inst) in push_inst() argument
190 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in push_inst()
191 FAIL_IF(push_cpool(compiler)); in push_inst()
193 ptr = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_inst()
195 compiler->size++; in push_inst()
200 static sljit_s32 push_inst_with_literal(struct sljit_compiler *compiler, sljit_uw inst, sljit_uw li… in push_inst_with_literal() argument
208 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in push_inst_with_literal()
209 FAIL_IF(push_cpool(compiler)); in push_inst_with_literal()
210 else if (compiler->cpool_fill > 0) { in push_inst_with_literal()
211 cpool_ptr = compiler->cpool; in push_inst_with_literal()
212 cpool_end = cpool_ptr + compiler->cpool_fill; in push_inst_with_literal()
213 cpool_unique_ptr = compiler->cpool_unique; in push_inst_with_literal()
216 cpool_index = (sljit_uw)(cpool_ptr - compiler->cpool); in push_inst_with_literal()
226 if (compiler->cpool_fill < CPOOL_SIZE) { in push_inst_with_literal()
227 cpool_index = compiler->cpool_fill; in push_inst_with_literal()
228 compiler->cpool_fill++; in push_inst_with_literal()
231 FAIL_IF(push_cpool(compiler)); in push_inst_with_literal()
233 compiler->cpool_fill = 1; in push_inst_with_literal()
238 ptr = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_inst_with_literal()
240 compiler->size++; in push_inst_with_literal()
243 compiler->cpool[cpool_index] = literal; in push_inst_with_literal()
244 compiler->cpool_unique[cpool_index] = 0; in push_inst_with_literal()
245 if (compiler->cpool_diff == CONST_POOL_EMPTY) in push_inst_with_literal()
246 compiler->cpool_diff = compiler->size; in push_inst_with_literal()
250 static sljit_s32 push_inst_with_unique_literal(struct sljit_compiler *compiler, sljit_uw inst, slji… in push_inst_with_unique_literal() argument
253 …(SLJIT_UNLIKELY((compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_diff… in push_inst_with_unique_literal()
254 FAIL_IF(push_cpool(compiler)); in push_inst_with_unique_literal()
256 SLJIT_ASSERT(compiler->cpool_fill < CPOOL_SIZE && (inst & 0xfff) == 0); in push_inst_with_unique_literal()
257 ptr = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_inst_with_unique_literal()
259 compiler->size++; in push_inst_with_unique_literal()
260 *ptr = inst | compiler->cpool_fill; in push_inst_with_unique_literal()
262 compiler->cpool[compiler->cpool_fill] = literal; in push_inst_with_unique_literal()
263 compiler->cpool_unique[compiler->cpool_fill] = 1; in push_inst_with_unique_literal()
264 compiler->cpool_fill++; in push_inst_with_unique_literal()
265 if (compiler->cpool_diff == CONST_POOL_EMPTY) in push_inst_with_unique_literal()
266 compiler->cpool_diff = compiler->size; in push_inst_with_unique_literal()
270 static SLJIT_INLINE sljit_s32 prepare_blx(struct sljit_compiler *compiler) in prepare_blx() argument
273 …if (SLJIT_UNLIKELY(compiler->cpool_diff != CONST_POOL_EMPTY && compiler->size - compiler->cpool_di… in prepare_blx()
274 return push_cpool(compiler); in prepare_blx()
278 static SLJIT_INLINE sljit_s32 emit_blx(struct sljit_compiler *compiler) in emit_blx() argument
281 …SLJIT_ASSERT(compiler->cpool_diff == CONST_POOL_EMPTY || compiler->size - compiler->cpool_diff < M… in emit_blx()
284 return push_inst(compiler, BLX | RM(TMP_REG1)); in emit_blx()
339 static sljit_s32 resolve_const_pool_index(struct sljit_compiler *compiler, struct future_patch **fi… in resolve_const_pool_index() argument
344 SLJIT_UNUSED_ARG(compiler); in resolve_const_pool_index()
363 SLJIT_FREE(curr_patch, compiler->allocator_data); in resolve_const_pool_index()
373 …curr_patch = (struct future_patch*)SLJIT_MALLOC(sizeof(struct future_patch), compiler->allocator_d… in resolve_const_pool_index()
378 SLJIT_FREE(curr_patch, compiler->allocator_data); in resolve_const_pool_index()
394 static sljit_s32 push_inst(struct sljit_compiler *compiler, sljit_uw inst) in push_inst() argument
398 ptr = (sljit_uw*)ensure_buf(compiler, sizeof(sljit_uw)); in push_inst()
400 compiler->size++; in push_inst()
405 static SLJIT_INLINE sljit_s32 emit_imm(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm) in emit_imm() argument
407 FAIL_IF(push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | ((sljit_u32)imm & 0xfff))); in emit_imm()
408 …return push_inst(compiler, MOVT | RD(reg) | ((imm >> 12) & 0xf0000) | (((sljit_u32)imm >> 16) & 0x… in emit_imm()
566 static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm);
660 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler) in sljit_generate_code() argument
687 CHECK_PTR(check_sljit_generate_code(compiler)); in sljit_generate_code()
688 reverse_buf(compiler); in sljit_generate_code()
692 size = compiler->size + (compiler->patches << 1); in sljit_generate_code()
693 if (compiler->cpool_fill > 0) in sljit_generate_code()
694 size += compiler->cpool_fill + CONST_POOL_ALIGNMENT - 1; in sljit_generate_code()
696 size = compiler->size; in sljit_generate_code()
698 code = (sljit_uw*)SLJIT_MALLOC_EXEC(size * sizeof(sljit_uw), compiler->exec_allocator_data); in sljit_generate_code()
700 buf = compiler->buf; in sljit_generate_code()
716 label = compiler->labels; in sljit_generate_code()
717 jump = compiler->jumps; in sljit_generate_code()
718 const_ = compiler->consts; in sljit_generate_code()
719 put_label = compiler->put_labels; in sljit_generate_code()
738 …if (SLJIT_UNLIKELY(resolve_const_pool_index(compiler, &first_patch, cpool_current_index, cpool_sta… in sljit_generate_code()
739 SLJIT_FREE_EXEC(code, compiler->exec_allocator_data); in sljit_generate_code()
740 compiler->error = SLJIT_ERR_ALLOC_FAILED; in sljit_generate_code()
831 if (compiler->cpool_fill > 0) { in sljit_generate_code()
833 …ndex = patch_pc_relative_loads(last_pc_patch, code_ptr, cpool_start_address, compiler->cpool_fill); in sljit_generate_code()
837 buf_ptr = compiler->cpool; in sljit_generate_code()
838 buf_end = buf_ptr + compiler->cpool_fill; in sljit_generate_code()
841 …if (SLJIT_UNLIKELY(resolve_const_pool_index(compiler, &first_patch, cpool_current_index, cpool_sta… in sljit_generate_code()
842 SLJIT_FREE_EXEC(code, compiler->exec_allocator_data); in sljit_generate_code()
843 compiler->error = SLJIT_ERR_ALLOC_FAILED; in sljit_generate_code()
853 jump = compiler->jumps; in sljit_generate_code()
897 const_ = compiler->consts; in sljit_generate_code()
916 put_label = compiler->put_labels; in sljit_generate_code()
934 compiler->error = SLJIT_ERR_COMPILED; in sljit_generate_code()
935 compiler->executable_offset = executable_offset; in sljit_generate_code()
936 compiler->executable_size = (sljit_uw)(code_ptr - code) * sizeof(sljit_uw); in sljit_generate_code()
1042 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags,
1047 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
1062 …CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds,… in sljit_emit_enter()
1063 set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
1080 FAIL_IF(push_inst(compiler, PUSH | (1 << 14) | imm)); in sljit_emit_enter()
1082 FAIL_IF(push_inst(compiler, 0xe52d0004 | RD(TMP_REG2))); in sljit_emit_enter()
1089 FAIL_IF(push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | sizeof(sljit_sw))); in sljit_emit_enter()
1094 …FAIL_IF(push_inst(compiler, VPUSH | VD(SLJIT_FS0) | ((sljit_uw)SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTE… in sljit_emit_enter()
1097 FAIL_IF(push_inst(compiler, VPUSH | VD(SLJIT_FS0) | ((sljit_uw)fsaveds << 1))); in sljit_emit_enter()
1099 …FAIL_IF(push_inst(compiler, VPUSH | VD(fscratches) | ((sljit_uw)(fscratches - (SLJIT_FIRST_SAVED_F… in sljit_emit_enter()
1104 compiler->local_size = local_size; in sljit_emit_enter()
1122 …FAIL_IF(push_inst(compiler, VMOV2 | (offset << 10) | ((offset + sizeof(sljit_sw)) << 14) | float_a… in sljit_emit_enter()
1124 FAIL_IF(push_inst(compiler, VLDR_F32 | 0x800100 | RN(SLJIT_SP) in sljit_emit_enter()
1131 FAIL_IF(push_inst(compiler, VMOV | (float_arg_count << 16) | (offset << 10))); in sljit_emit_enter()
1133 FAIL_IF(push_inst(compiler, VLDR_F32 | 0x800000 | RN(SLJIT_SP) in sljit_emit_enter()
1149 FAIL_IF(push_inst(compiler, MOV | RD(tmp) | (offset >> 2))); in sljit_emit_enter()
1151 FAIL_IF(push_inst(compiler, data_transfer_insts[WORD_SIZE | LOAD_DATA] | 0x800000 in sljit_emit_enter()
1160 compiler->args_size = offset; in sljit_emit_enter()
1188 …FAIL_IF(push_inst(compiler, MOV | RD(SLJIT_S0 - saved_arg_count) | RM(SLJIT_R0 + word_arg_count))); in sljit_emit_enter()
1201 FAIL_IF(push_inst(compiler, *(--remap_ptr))); in sljit_emit_enter()
1205 FAIL_IF(emit_op(compiler, SLJIT_SUB, ALLOW_IMM, SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, local_size)); in sljit_emit_enter()
1210 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
1217 …CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds… in sljit_set_context()
1218 set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
1225 compiler->local_size = ((size + local_size + 0x7) & ~0x7) - size; in sljit_set_context()
1229 static sljit_s32 emit_add_sp(struct sljit_compiler *compiler, sljit_uw imm) in emit_add_sp() argument
1234 FAIL_IF(load_immediate(compiler, TMP_REG2, imm)); in emit_add_sp()
1238 return push_inst(compiler, ADD | RD(SLJIT_SP) | RN(SLJIT_SP) | imm2); in emit_add_sp()
1241 static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit_s32 frame_size) in emit_stack_frame_release() argument
1249 local_size = compiler->local_size; in emit_stack_frame_release()
1250 fscratches = compiler->fscratches; in emit_stack_frame_release()
1251 fsaveds = compiler->fsaveds; in emit_stack_frame_release()
1255 FAIL_IF(emit_add_sp(compiler, (sljit_uw)local_size)); in emit_stack_frame_release()
1258 …FAIL_IF(push_inst(compiler, VPOP | VD(SLJIT_FS0) | ((sljit_uw)SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTER… in emit_stack_frame_release()
1261 …FAIL_IF(push_inst(compiler, VPOP | VD(fscratches) | ((sljit_uw)(fscratches - (SLJIT_FIRST_SAVED_FL… in emit_stack_frame_release()
1263 FAIL_IF(push_inst(compiler, VPOP | VD(SLJIT_FS0) | ((sljit_uw)fsaveds << 1))); in emit_stack_frame_release()
1266 local_size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 1) & 0x7; in emit_stack_frame_release()
1279 tmp = SLJIT_S0 - compiler->saveds; in emit_stack_frame_release()
1283 for (i = compiler->scratches; i >= SLJIT_FIRST_SAVED_REG; i--) in emit_stack_frame_release()
1294 …FAIL_IF(push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | (1 << 25) | (sljit_uw)(frame_size … in emit_stack_frame_release()
1296 FAIL_IF(emit_add_sp(compiler, (sljit_uw)(local_size - frame_size))); in emit_stack_frame_release()
1301 if (compiler->saveds > 0) { in emit_stack_frame_release()
1309 return push_inst(compiler, data_transfer_insts[WORD_SIZE | LOAD_DATA] | 0x800000 in emit_stack_frame_release()
1314 FAIL_IF(emit_add_sp(compiler, (sljit_uw)local_size)); in emit_stack_frame_release()
1323 return push_inst(compiler, 0xe49d0004 | RD(lr_dst)); in emit_stack_frame_release()
1326 FAIL_IF(push_inst(compiler, POP | reg_list)); in emit_stack_frame_release()
1328 …return push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | (1 << 25) | ((sljit_uw)frame_size -… in emit_stack_frame_release()
1332 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_void(struct sljit_compiler *compiler) in sljit_emit_return_void() argument
1335 CHECK(check_sljit_emit_return_void(compiler)); in sljit_emit_return_void()
1337 return emit_stack_frame_release(compiler, 0); in sljit_emit_return_void()
1346 if (compiler->shift_imm != 0x20) { \
1350 if (compiler->shift_imm != 0) \
1351 return push_inst(compiler, MOV | (flags & SET_FLAGS) | \
1352 RD(dst) | (compiler->shift_imm << 7) | (opcode << 5) | RM(src2)); \
1353 return push_inst(compiler, MOV | (flags & SET_FLAGS) | RD(dst) | RM(src2)); \
1355 return push_inst(compiler, MOV | (flags & SET_FLAGS) | RD(dst) \
1359 static SLJIT_INLINE sljit_s32 emit_single_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s… in emit_single_op() argument
1367 return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2); in emit_single_op()
1369 return push_inst(compiler, MOV | RD(dst) | RM(src2)); in emit_single_op()
1379 return push_inst(compiler, AND | RD(dst) | RN(src2) | SRC2_IMM | 0xff); in emit_single_op()
1380 FAIL_IF(push_inst(compiler, MOV | RD(dst) | (24 << 7) | RM(src2))); in emit_single_op()
1381 …return push_inst(compiler, MOV | RD(dst) | (24 << 7) | (op == SLJIT_MOV_U8 ? 0x20 : 0x40) | RM(dst… in emit_single_op()
1383 return push_inst(compiler, (op == SLJIT_MOV_U8 ? UXTB : SXTB) | RD(dst) | RM(src2)); in emit_single_op()
1388 return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2); in emit_single_op()
1397 FAIL_IF(push_inst(compiler, MOV | RD(dst) | (16 << 7) | RM(src2))); in emit_single_op()
1398 …return push_inst(compiler, MOV | RD(dst) | (16 << 7) | (op == SLJIT_MOV_U16 ? 0x20 : 0x40) | RM(ds… in emit_single_op()
1400 return push_inst(compiler, (op == SLJIT_MOV_U16 ? UXTH : SXTH) | RD(dst) | RM(src2)); in emit_single_op()
1405 return push_inst(compiler, ((flags & INV_IMM) ? MVN : MOV) | RD(dst) | src2); in emit_single_op()
1411 …return push_inst(compiler, ((flags & INV_IMM) ? MOV : MVN) | (flags & SET_FLAGS) | RD(dst) | src2); in emit_single_op()
1413 return push_inst(compiler, MVN | (flags & SET_FLAGS) | RD(dst) | RM(src2)); in emit_single_op()
1418 FAIL_IF(push_inst(compiler, CLZ | RD(dst) | RM(src2))); in emit_single_op()
1425 return push_inst(compiler, CMN | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2))); in emit_single_op()
1426 …return push_inst(compiler, ADD | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? s… in emit_single_op()
1430 …return push_inst(compiler, ADC | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? s… in emit_single_op()
1436 return push_inst(compiler, CMP | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2))); in emit_single_op()
1438 return push_inst(compiler, (!(flags & ARGS_SWAPPED) ? SUB : RSB) | (flags & SET_FLAGS) in emit_single_op()
1443 return push_inst(compiler, (!(flags & ARGS_SWAPPED) ? SBC : RSC) | (flags & SET_FLAGS) in emit_single_op()
1449 compiler->status_flags_state = 0; in emit_single_op()
1452 return push_inst(compiler, MUL | RN(dst) | RM8(src2) | RM(src1)); in emit_single_op()
1454 FAIL_IF(push_inst(compiler, SMULL | RN(TMP_REG1) | RD(dst) | RM8(src2) | RM(src1))); in emit_single_op()
1457 return push_inst(compiler, CMP | SET_FLAGS | RN(TMP_REG1) | RM(dst) | 0xfc0); in emit_single_op()
1461 return push_inst(compiler, TST | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2))); in emit_single_op()
1462 return push_inst(compiler, (!(flags & INV_IMM) ? AND : BIC) | (flags & SET_FLAGS) in emit_single_op()
1467 …return push_inst(compiler, ORR | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? s… in emit_single_op()
1471 …return push_inst(compiler, EOR | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? s… in emit_single_op()
1529 static sljit_s32 generate_int(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm, sljit_s… in generate_int() argument
1634 FAIL_IF(push_inst(compiler, (positive ? MOV : MVN) | RD(reg) | imm1)); in generate_int()
1635 FAIL_IF(push_inst(compiler, (positive ? ORR : BIC) | RD(reg) | RN(reg) | imm2)); in generate_int()
1640 static sljit_s32 load_immediate(struct sljit_compiler *compiler, sljit_s32 reg, sljit_uw imm) in load_immediate() argument
1646 return push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | (imm & 0xfff)); in load_immediate()
1652 return push_inst(compiler, MOV | RD(reg) | tmp); in load_immediate()
1656 return push_inst(compiler, MVN | RD(reg) | tmp); in load_immediate()
1660 FAIL_IF(generate_int(compiler, reg, imm, 1)); in load_immediate()
1661 FAIL_IF(generate_int(compiler, reg, ~imm, 0)); in load_immediate()
1664 …return push_inst_with_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, reg, TMP_PC, … in load_immediate()
1666 FAIL_IF(push_inst(compiler, MOVW | RD(reg) | ((imm << 4) & 0xf0000) | (imm & 0xfff))); in load_immediate()
1669 return push_inst(compiler, MOVT | RD(reg) | ((imm >> 12) & 0xf0000) | ((imm >> 16) & 0xfff)); in load_immediate()
1673 static SLJIT_INLINE sljit_s32 emit_op_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s… in emit_op_mem() argument
1684 FAIL_IF(load_immediate(compiler, tmp_reg, (sljit_uw)argw & ~(sljit_uw)0xfff)); in emit_op_mem()
1688 FAIL_IF(load_immediate(compiler, tmp_reg, (sljit_uw)argw & ~(sljit_uw)0xff)); in emit_op_mem()
1692 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, tmp_reg, in emit_op_mem()
1702 …FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg) | RM(offset_reg) | ((sljit_uw)argw << 7))); in emit_op_mem()
1703 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, tmp_reg, TYPE2_TRANSFER_IMM(0))); in emit_op_mem()
1707 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, in emit_op_mem()
1717 FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg) | imm)); in emit_op_mem()
1725 FAIL_IF(push_inst(compiler, SUB | RD(tmp_reg) | RN(arg) | imm)); in emit_op_mem()
1732 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, argw)); in emit_op_mem()
1735 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 0, reg, arg, -argw)); in emit_op_mem()
1741 FAIL_IF(push_inst(compiler, ADD | RD(tmp_reg) | RN(arg) | imm)); in emit_op_mem()
1749 FAIL_IF(push_inst(compiler, SUB | RD(tmp_reg) | RN(arg) | imm)); in emit_op_mem()
1756 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, TYPE2_TRANSFER_IMM(argw))); in emit_op_mem()
1760 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 0, reg, arg, TYPE2_TRANSFER_IMM(argw))); in emit_op_mem()
1764 FAIL_IF(load_immediate(compiler, tmp_reg, (sljit_uw)argw)); in emit_op_mem()
1765 return push_inst(compiler, EMIT_DATA_TRANSFER(flags, 1, reg, arg, in emit_op_mem()
1769 static sljit_s32 emit_op(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 inp_flags, in emit_op() argument
1793 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD; in emit_op()
1797 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD; in emit_op()
1801 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_SUB; in emit_op()
1805 compiler->status_flags_state = SLJIT_CURRENT_FLAGS_SUB; in emit_op()
1869 FAIL_IF(emit_op_mem(compiler, inp_flags | LOAD_DATA, TMP_REG1, src1, src1w, TMP_REG1)); in emit_op()
1873 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)src1w)); in emit_op()
1886 return emit_op_mem(compiler, inp_flags, src2, dst, dstw, TMP_REG2); in emit_op()
1900 FAIL_IF(emit_op_mem(compiler, inp_flags | LOAD_DATA, src2_reg, src2, src2w, TMP_REG2)); in emit_op()
1902 FAIL_IF(load_immediate(compiler, src2_reg, (sljit_uw)src2w)); in emit_op()
1905 …FAIL_IF(emit_single_op(compiler, op, flags, (sljit_uw)dst_reg, (sljit_uw)src1_reg, (sljit_uw)src2_… in emit_op()
1910 return emit_op_mem(compiler, inp_flags, dst_reg, dst, dstw, TMP_REG1); in emit_op()
1928 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op0(struct sljit_compiler *compiler, sljit_s32 op) in sljit_emit_op0() argument
1934 CHECK(check_sljit_emit_op0(compiler, op)); in sljit_emit_op0()
1939 FAIL_IF(push_inst(compiler, BKPT)); in sljit_emit_op0()
1942 FAIL_IF(push_inst(compiler, NOP)); in sljit_emit_op0()
1946 return push_inst(compiler, (op == SLJIT_LMUL_UW ? UMULL : SMULL) in sljit_emit_op0()
1956 if (compiler->scratches >= 4) in sljit_emit_op0()
1958 if (compiler->scratches >= 3) in sljit_emit_op0()
1964 FAIL_IF(push_inst(compiler, 0xe52d0000 | (saved_reg_count >= 3 ? 16 : 8) in sljit_emit_op0()
1968 FAIL_IF(push_inst(compiler, 0xe58d0004 | (saved_reg_list[1] << 12) /* str rX, [sp, #4] */)); in sljit_emit_op0()
1972 FAIL_IF(push_inst(compiler, 0xe58d0008 | (saved_reg_list[2] << 12) /* str rX, [sp, #8] */)); in sljit_emit_op0()
1977 FAIL_IF(sljit_emit_ijump(compiler, SLJIT_FAST_CALL, SLJIT_IMM, in sljit_emit_op0()
1986 FAIL_IF(push_inst(compiler, 0xe59d0008 | (saved_reg_list[2] << 12) /* ldr rX, [sp, #8] */)); in sljit_emit_op0()
1990 FAIL_IF(push_inst(compiler, 0xe59d0004 | (saved_reg_list[1] << 12) /* ldr rX, [sp, #4] */)); in sljit_emit_op0()
1992 return push_inst(compiler, 0xe49d0000 | (sljit_uw)(saved_reg_count >= 3 ? 16 : 8) in sljit_emit_op0()
2004 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op1() argument
2009 CHECK(check_sljit_emit_op1(compiler, op, dst, dstw, src, srcw)); in sljit_emit_op1()
2019 return emit_op(compiler, SLJIT_MOV, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
2022 …return emit_op(compiler, SLJIT_MOV_U8, ALLOW_ANY_IMM | BYTE_SIZE, dst, dstw, TMP_REG1, 0, src, (sr… in sljit_emit_op1()
2025 …return emit_op(compiler, SLJIT_MOV_S8, ALLOW_ANY_IMM | SIGNED | BYTE_SIZE, dst, dstw, TMP_REG1, 0,… in sljit_emit_op1()
2028 …return emit_op(compiler, SLJIT_MOV_U16, ALLOW_ANY_IMM | HALF_SIZE, dst, dstw, TMP_REG1, 0, src, (s… in sljit_emit_op1()
2031 …return emit_op(compiler, SLJIT_MOV_S16, ALLOW_ANY_IMM | SIGNED | HALF_SIZE, dst, dstw, TMP_REG1, 0… in sljit_emit_op1()
2034 return emit_op(compiler, op, ALLOW_ANY_IMM, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
2037 return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src, srcw); in sljit_emit_op1()
2043 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2() argument
2049 CHECK(check_sljit_emit_op2(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_op2()
2059 return emit_op(compiler, op, ALLOW_IMM | ALLOW_NEG_IMM, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2063 return emit_op(compiler, op, ALLOW_IMM, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2066 return emit_op(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2069 return emit_op(compiler, op, ALLOW_ANY_IMM, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2075 compiler->shift_imm = src2w & 0x1f; in sljit_emit_op2()
2076 return emit_op(compiler, op, 0, dst, dstw, TMP_REG1, 0, src1, src1w); in sljit_emit_op2()
2079 compiler->shift_imm = 0x20; in sljit_emit_op2()
2080 return emit_op(compiler, op, 0, dst, dstw, src1, src1w, src2, src2w); in sljit_emit_op2()
2087 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2u(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op2u() argument
2092 CHECK(check_sljit_emit_op2(compiler, op, 1, 0, 0, src1, src1w, src2, src2w)); in sljit_emit_op2u()
2096 compiler->skip_checks = 1; in sljit_emit_op2u()
2098 return sljit_emit_op2(compiler, op, TMP_REG2, 0, src1, src1w, src2, src2w); in sljit_emit_op2u()
2101 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_op_src() argument
2105 CHECK(check_sljit_emit_op_src(compiler, op, src, srcw)); in sljit_emit_op_src()
2113 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG2) | RM(src))); in sljit_emit_op_src()
2115 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG2, src, srcw, TMP_REG1)); in sljit_emit_op_src()
2117 return push_inst(compiler, BX | RM(TMP_REG2)); in sljit_emit_op_src()
2126 return emit_op_mem(compiler, PRELOAD | LOAD_DATA, TMP_PC, src, srcw, TMP_REG1); in sljit_emit_op_src()
2147 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler, in sljit_emit_op_custom() argument
2152 CHECK(check_sljit_emit_op_custom(compiler, instruction, size)); in sljit_emit_op_custom()
2154 return push_inst(compiler, *(sljit_uw*)instruction); in sljit_emit_op_custom()
2165 static sljit_s32 emit_fop_mem(struct sljit_compiler *compiler, sljit_s32 flags, sljit_s32 reg, slji… in emit_fop_mem() argument
2174 …FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | RM(OFFS_REG(arg)) | (((sljit… in emit_fop_mem()
2182 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, arg & REG_MASK, reg, argw >> 2)); in emit_fop_mem()
2184 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, arg & REG_MASK, reg, (-argw) >> 2)); in emit_fop_mem()
2188 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | imm)); in emit_fop_mem()
2189 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG2, reg, (argw & 0x3fc) >> 2)); in emit_fop_mem()
2194 FAIL_IF(push_inst(compiler, SUB | RD(TMP_REG2) | RN(arg & REG_MASK) | imm)); in emit_fop_mem()
2195 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 0, TMP_REG2, reg, (argw & 0x3fc) >> 2)); in emit_fop_mem()
2200 FAIL_IF(load_immediate(compiler, TMP_REG2, (sljit_uw)argw)); in emit_fop_mem()
2201 FAIL_IF(push_inst(compiler, ADD | RD(TMP_REG2) | RN(arg & REG_MASK) | RM(TMP_REG2))); in emit_fop_mem()
2204 FAIL_IF(load_immediate(compiler, TMP_REG2, (sljit_uw)argw)); in emit_fop_mem()
2206 return push_inst(compiler, EMIT_FPU_DATA_TRANSFER(inst, 1, TMP_REG2, reg, 0)); in emit_fop_mem()
2209 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
2216 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG1, src, srcw)); in sljit_emit_fop1_conv_sw_from_f64()
2220 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_S32_F32, op & SLJIT_32, TMP_FREG1, src, 0))); in sljit_emit_fop1_conv_sw_from_f64()
2223 return push_inst(compiler, VMOV | (1 << 20) | RD(dst) | VN(TMP_FREG1)); in sljit_emit_fop1_conv_sw_from_f64()
2226 return emit_fop_mem(compiler, 0, TMP_FREG1, dst, dstw); in sljit_emit_fop1_conv_sw_from_f64()
2229 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
2238 FAIL_IF(push_inst(compiler, VMOV | RD(src) | VN(TMP_FREG1))); in sljit_emit_fop1_conv_f64_from_sw()
2241 FAIL_IF(emit_fop_mem(compiler, FPU_LOAD, TMP_FREG1, src, srcw)); in sljit_emit_fop1_conv_f64_from_sw()
2244 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)srcw)); in sljit_emit_fop1_conv_f64_from_sw()
2245 FAIL_IF(push_inst(compiler, VMOV | RD(TMP_REG1) | VN(TMP_FREG1))); in sljit_emit_fop1_conv_f64_from_sw()
2248 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F32_S32, op & SLJIT_32, dst_r, TMP_FREG1, 0))); in sljit_emit_fop1_conv_f64_from_sw()
2251 return emit_fop_mem(compiler, (op & SLJIT_32), TMP_FREG1, dst, dstw); in sljit_emit_fop1_conv_f64_from_sw()
2255 static SLJIT_INLINE sljit_s32 sljit_emit_fop1_cmp(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1_cmp() argument
2262 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG1, src1, src1w)); in sljit_emit_fop1_cmp()
2267 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG2, src2, src2w)); in sljit_emit_fop1_cmp()
2271 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCMP_F32, op & SLJIT_32, src1, src2, 0))); in sljit_emit_fop1_cmp()
2272 return push_inst(compiler, VMRS); in sljit_emit_fop1_cmp()
2275 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop1(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop1() argument
2284 SELECT_FOP1_OPERATION_WITH_CHECKS(compiler, op, dst, dstw, src, srcw); in sljit_emit_fop1()
2292 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, dst_r, src, srcw)); in sljit_emit_fop1()
2300 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, op & SLJIT_32, dst_r, src, 0))); in sljit_emit_fop1()
2306 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VNEG_F32, op & SLJIT_32, dst_r, src, 0))); in sljit_emit_fop1()
2309 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VABS_F32, op & SLJIT_32, dst_r, src, 0))); in sljit_emit_fop1()
2312 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VCVT_F64_F32, op & SLJIT_32, dst_r, src, 0))); in sljit_emit_fop1()
2318 return emit_fop_mem(compiler, (op & SLJIT_32), dst_r, dst, dstw); in sljit_emit_fop1()
2322 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fop2(struct sljit_compiler *compiler, sljit_s32 op, in sljit_emit_fop2() argument
2330 CHECK(check_sljit_emit_fop2(compiler, op, dst, dstw, src1, src1w, src2, src2w)); in sljit_emit_fop2()
2340 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG2, src2, src2w)); in sljit_emit_fop2()
2345 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32) | FPU_LOAD, TMP_FREG1, src1, src1w)); in sljit_emit_fop2()
2351 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VADD_F32, op & SLJIT_32, dst_r, src2, src1))); in sljit_emit_fop2()
2355 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VSUB_F32, op & SLJIT_32, dst_r, src2, src1))); in sljit_emit_fop2()
2359 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMUL_F32, op & SLJIT_32, dst_r, src2, src1))); in sljit_emit_fop2()
2363 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VDIV_F32, op & SLJIT_32, dst_r, src2, src1))); in sljit_emit_fop2()
2368 FAIL_IF(emit_fop_mem(compiler, (op & SLJIT_32), TMP_FREG1, dst, dstw)); in sljit_emit_fop2()
2380 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_fast_enter() argument
2383 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw)); in sljit_emit_fast_enter()
2389 return push_inst(compiler, MOV | RD(dst) | RM(TMP_REG2)); in sljit_emit_fast_enter()
2392 return emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1); in sljit_emit_fast_enter()
2399 static sljit_uw get_cc(struct sljit_compiler *compiler, sljit_s32 type) in get_cc() argument
2411 if (compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD) in get_cc()
2420 if (compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD) in get_cc()
2449 if (!(compiler->status_flags_state & (SLJIT_CURRENT_FLAGS_ADD | SLJIT_CURRENT_FLAGS_SUB))) in get_cc()
2457 if (!(compiler->status_flags_state & (SLJIT_CURRENT_FLAGS_ADD | SLJIT_CURRENT_FLAGS_SUB))) in get_cc()
2470 SLJIT_API_FUNC_ATTRIBUTE struct sljit_label* sljit_emit_label(struct sljit_compiler *compiler) in sljit_emit_label() argument
2475 CHECK_PTR(check_sljit_emit_label(compiler)); in sljit_emit_label()
2477 if (compiler->last_label && compiler->last_label->size == compiler->size) in sljit_emit_label()
2478 return compiler->last_label; in sljit_emit_label()
2480 label = (struct sljit_label*)ensure_abuf(compiler, sizeof(struct sljit_label)); in sljit_emit_label()
2482 set_label(label, compiler); in sljit_emit_label()
2486 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_… in sljit_emit_jump() argument
2491 CHECK_PTR(check_sljit_emit_jump(compiler, type)); in sljit_emit_jump()
2493 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_jump()
2495 set_jump(jump, compiler, type & SLJIT_REWRITABLE_JUMP); in sljit_emit_jump()
2502 PTR_FAIL_IF(prepare_blx(compiler)); in sljit_emit_jump()
2503 PTR_FAIL_IF(push_inst_with_unique_literal(compiler, ((EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, in sljit_emit_jump()
2504 type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, TMP_PC, 0)) & ~COND_MASK) | get_cc(compiler, type), 0)); in sljit_emit_jump()
2507 jump->addr = compiler->size; in sljit_emit_jump()
2508 compiler->patches++; in sljit_emit_jump()
2513 PTR_FAIL_IF(emit_blx(compiler)); in sljit_emit_jump()
2517 jump->addr = compiler->size; in sljit_emit_jump()
2521 PTR_FAIL_IF(emit_imm(compiler, TMP_REG1, 0)); in sljit_emit_jump()
2522 …PTR_FAIL_IF(push_inst(compiler, (((type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1)) & ~COND_MASK) | … in sljit_emit_jump()
2523 jump->addr = compiler->size; in sljit_emit_jump()
2530 static sljit_s32 softfloat_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, slj… in softfloat_call_with_args() argument
2572 if (offset > 4 * sizeof(sljit_sw) && (!is_tail_call || offset > compiler->args_size)) { in softfloat_call_with_args()
2582 FAIL_IF(emit_stack_frame_release(compiler, (sljit_s32)offset)); in softfloat_call_with_args()
2584 FAIL_IF(push_inst(compiler, SUB | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | offset)); in softfloat_call_with_args()
2587 FAIL_IF(emit_stack_frame_release(compiler, -1)); in softfloat_call_with_args()
2602 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2))); in softfloat_call_with_args()
2605 …FAIL_IF(push_inst(compiler, VMOV2 | 0x100000 | (offset << 10) | ((offset + sizeof(sljit_sw)) << 14… in softfloat_call_with_args()
2607 FAIL_IF(push_inst(compiler, VSTR_F32 | 0x800100 | RN(SLJIT_SP) in softfloat_call_with_args()
2616 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2))); in softfloat_call_with_args()
2619 FAIL_IF(push_inst(compiler, VMOV | 0x100000 | (float_arg_count << 16) | (offset << 10))); in softfloat_call_with_args()
2621 FAIL_IF(push_inst(compiler, VSTR_F32 | 0x800000 | RN(SLJIT_SP) in softfloat_call_with_args()
2633 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | (src_offset >> 2))); in softfloat_call_with_args()
2640 FAIL_IF(push_inst(compiler, MOV | (offset << 10) | (word_arg_offset >> 2))); in softfloat_call_with_args()
2642 …FAIL_IF(push_inst(compiler, data_transfer_insts[WORD_SIZE] | 0x800000 | RN(SLJIT_SP) | (word_arg_o… in softfloat_call_with_args()
2653 static sljit_s32 softfloat_post_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types) in softfloat_post_call_with_args() argument
2656 FAIL_IF(push_inst(compiler, VMOV2 | (1 << 16) | (0 << 12) | 0)); in softfloat_post_call_with_args()
2658 FAIL_IF(push_inst(compiler, VMOV | (0 << 16) | (0 << 12))); in softfloat_post_call_with_args()
2665 static sljit_s32 hardfloat_call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types) in hardfloat_call_with_args() argument
2678 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, in hardfloat_call_with_args()
2686 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, in hardfloat_call_with_args()
2691 FAIL_IF(push_inst(compiler, EMIT_FPU_OPERATION(VMOV_F32, in hardfloat_call_with_args()
2709 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_… in sljit_emit_call() argument
2718 CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types)); in sljit_emit_call()
2721 PTR_FAIL_IF(softfloat_call_with_args(compiler, arg_types, NULL, &extra_space)); in sljit_emit_call()
2729 compiler->skip_checks = 1; in sljit_emit_call()
2732 jump = sljit_emit_jump(compiler, type); in sljit_emit_call()
2737 PTR_FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, in sljit_emit_call()
2740 PTR_FAIL_IF(push_inst(compiler, ADD | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | extra_space)); in sljit_emit_call()
2743 PTR_FAIL_IF(push_inst(compiler, BX | RM(TMP_REG2))); in sljit_emit_call()
2749 PTR_FAIL_IF(softfloat_post_call_with_args(compiler, arg_types)); in sljit_emit_call()
2753 PTR_FAIL_IF(emit_stack_frame_release(compiler, -1)); in sljit_emit_call()
2757 PTR_FAIL_IF(hardfloat_call_with_args(compiler, arg_types)); in sljit_emit_call()
2761 compiler->skip_checks = 1; in sljit_emit_call()
2764 return sljit_emit_jump(compiler, type); in sljit_emit_call()
2768 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_ijump(struct sljit_compiler *compiler, sljit_s32 type… in sljit_emit_ijump() argument
2773 CHECK(check_sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_ijump()
2781 return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(src)); in sljit_emit_ijump()
2785 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1)); in sljit_emit_ijump()
2786 return push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1)); in sljit_emit_ijump()
2790 jump = (struct sljit_jump*)ensure_abuf(compiler, sizeof(struct sljit_jump)); in sljit_emit_ijump()
2792 set_jump(jump, compiler, JUMP_ADDR | ((type >= SLJIT_FAST_CALL) ? IS_BL : 0)); in sljit_emit_ijump()
2797 FAIL_IF(prepare_blx(compiler)); in sljit_emit_ijump()
2798 …FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, type … in sljit_emit_ijump()
2800 FAIL_IF(emit_blx(compiler)); in sljit_emit_ijump()
2802 FAIL_IF(emit_imm(compiler, TMP_REG1, 0)); in sljit_emit_ijump()
2803 FAIL_IF(push_inst(compiler, (type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1))); in sljit_emit_ijump()
2805 jump->addr = compiler->size; in sljit_emit_ijump()
2809 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_icall() argument
2818 CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw)); in sljit_emit_icall()
2821 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, src, srcw, TMP_REG1)); in sljit_emit_icall()
2826 FAIL_IF(push_inst(compiler, MOV | RD(TMP_REG1) | RM(src))); in sljit_emit_icall()
2831 FAIL_IF(softfloat_call_with_args(compiler, arg_types, &src, &extra_space)); in sljit_emit_icall()
2839 compiler->skip_checks = 1; in sljit_emit_icall()
2842 FAIL_IF(sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_icall()
2846 FAIL_IF(push_inst(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, in sljit_emit_icall()
2849 FAIL_IF(push_inst(compiler, ADD | RD(SLJIT_SP) | RN(SLJIT_SP) | SRC2_IMM | extra_space)); in sljit_emit_icall()
2852 return push_inst(compiler, BX | RM(TMP_REG2)); in sljit_emit_icall()
2856 return softfloat_post_call_with_args(compiler, arg_types); in sljit_emit_icall()
2859 FAIL_IF(emit_stack_frame_release(compiler, -1)); in sljit_emit_icall()
2863 FAIL_IF(hardfloat_call_with_args(compiler, arg_types)); in sljit_emit_icall()
2867 compiler->skip_checks = 1; in sljit_emit_icall()
2870 return sljit_emit_ijump(compiler, type, src, srcw); in sljit_emit_icall()
2874 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_flags(struct sljit_compiler *compiler, sljit_s32 o… in sljit_emit_op_flags() argument
2882 CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type)); in sljit_emit_op_flags()
2886 cc = get_cc(compiler, type & 0xff); in sljit_emit_op_flags()
2890 FAIL_IF(push_inst(compiler, MOV | RD(dst_reg) | SRC2_IMM | 0)); in sljit_emit_op_flags()
2891 FAIL_IF(push_inst(compiler, ((MOV | RD(dst_reg) | SRC2_IMM | 1) & ~COND_MASK) | cc)); in sljit_emit_op_flags()
2893 return emit_op_mem(compiler, WORD_SIZE, TMP_REG1, dst, dstw, TMP_REG2); in sljit_emit_op_flags()
2900 FAIL_IF(emit_op_mem(compiler, WORD_SIZE | LOAD_DATA, TMP_REG1, dst, dstw, TMP_REG2)); in sljit_emit_op_flags()
2902 FAIL_IF(push_inst(compiler, ((ins | RD(dst_reg) | RN(dst_reg) | SRC2_IMM | 1) & ~COND_MASK) | cc)); in sljit_emit_op_flags()
2905 …FAIL_IF(push_inst(compiler, ((ins | RD(dst_reg) | RN(dst_reg) | SRC2_IMM | 0) & ~COND_MASK) | (cc … in sljit_emit_op_flags()
2908 FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG1, dst, dstw, TMP_REG2)); in sljit_emit_op_flags()
2911 return push_inst(compiler, MOV | SET_FLAGS | RD(TMP_REG2) | RM(dst_reg)); in sljit_emit_op_flags()
2915 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_cmov(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_cmov() argument
2922 CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw)); in sljit_emit_cmov()
2926 cc = get_cc(compiler, type & 0xff); in sljit_emit_cmov()
2931 return push_inst(compiler, ((MOV | RD(dst_reg) | tmp) & ~COND_MASK) | cc); in sljit_emit_cmov()
2935 return push_inst(compiler, ((MVN | RD(dst_reg) | tmp) & ~COND_MASK) | cc); in sljit_emit_cmov()
2939 …FAIL_IF(push_inst(compiler, (MOVW & ~COND_MASK) | cc | RD(dst_reg) | ((tmp << 4) & 0xf0000) | (tmp… in sljit_emit_cmov()
2942 …return push_inst(compiler, (MOVT & ~COND_MASK) | cc | RD(dst_reg) | ((tmp >> 12) & 0xf0000) | ((tm… in sljit_emit_cmov()
2944 FAIL_IF(load_immediate(compiler, TMP_REG1, (sljit_uw)srcw)); in sljit_emit_cmov()
2949 return push_inst(compiler, ((MOV | RD(dst_reg) | RM(src)) & ~COND_MASK) | cc); in sljit_emit_cmov()
2952 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_mem() argument
2960 CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw)); in sljit_emit_mem()
3030 return push_inst(compiler, inst); in sljit_emit_mem()
3046 return push_inst(compiler, inst | (sljit_uw)memw); in sljit_emit_mem()
3054 return push_inst(compiler, inst | TYPE2_TRANSFER_IMM((sljit_uw)memw)); in sljit_emit_mem()
3057 SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compiler *compiler, slji… in sljit_emit_const() argument
3063 CHECK_PTR(check_sljit_emit_const(compiler, dst, dstw, init_value)); in sljit_emit_const()
3069 PTR_FAIL_IF(push_inst_with_unique_literal(compiler, in sljit_emit_const()
3071 compiler->patches++; in sljit_emit_const()
3073 PTR_FAIL_IF(emit_imm(compiler, dst_r, init_value)); in sljit_emit_const()
3076 const_ = (struct sljit_const*)ensure_abuf(compiler, sizeof(struct sljit_const)); in sljit_emit_const()
3078 set_const(const_, compiler); in sljit_emit_const()
3081 PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1)); in sljit_emit_const()
3085 …UTE struct sljit_put_label* sljit_emit_put_label(struct sljit_compiler *compiler, sljit_s32 dst, s… in sljit_emit_put_label() argument
3091 CHECK_PTR(check_sljit_emit_put_label(compiler, dst, dstw)); in sljit_emit_put_label()
3097 …PTR_FAIL_IF(push_inst_with_unique_literal(compiler, EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1, d… in sljit_emit_put_label()
3098 compiler->patches++; in sljit_emit_put_label()
3100 PTR_FAIL_IF(emit_imm(compiler, dst_r, 0)); in sljit_emit_put_label()
3103 put_label = (struct sljit_put_label*)ensure_abuf(compiler, sizeof(struct sljit_put_label)); in sljit_emit_put_label()
3105 set_put_label(put_label, compiler, 0); in sljit_emit_put_label()
3108 PTR_FAIL_IF(emit_op_mem(compiler, WORD_SIZE, TMP_REG2, dst, dstw, TMP_REG1)); in sljit_emit_put_label()