Lines Matching refs:compiler
33 static sljit_s32 emit_load_imm64(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm) in emit_load_imm64() argument
37 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2 + sizeof(sljit_sw)); in emit_load_imm64()
46 static sljit_s32 emit_do_imm32(struct sljit_compiler *compiler, sljit_u8 rex, sljit_u8 opcode, slji… in emit_do_imm32() argument
51 inst = (sljit_u8*)ensure_buf(compiler, 1 + length); in emit_do_imm32()
61 static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_uw size, in emit_x86_instruction() argument
75 SLJIT_ASSERT(!(a & SLJIT_IMM) || compiler->mode32 || IS_HALFWORD(imma)); in emit_x86_instruction()
91 if (!compiler->mode32 && !(flags & EX86_NO_REXW)) in emit_x86_instruction()
106 PTR_FAIL_IF(emit_load_imm64(compiler, TMP_REG2, immb)); in emit_x86_instruction()
156 imma &= compiler->mode32 ? 0x1f : 0x3f; in emit_x86_instruction()
182 inst = (sljit_u8*)ensure_buf(compiler, 1 + inst_size); in emit_x86_instruction()
363 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
379 …CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds,… in sljit_emit_enter()
380 set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
383 FAIL_IF(emit_endbranch(compiler)); in sljit_emit_enter()
385 compiler->mode32 = 0; in sljit_emit_enter()
393 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in sljit_emit_enter()
403 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in sljit_emit_enter()
461 EMIT_MOV(compiler, SLJIT_R0 + word_arg_count, 0, tmp, 0); in sljit_emit_enter()
463 EMIT_MOV(compiler, SLJIT_S0 - saved_arg_count, 0, tmp, 0); in sljit_emit_enter()
472 FAIL_IF(emit_sse2_load(compiler, (arg_types & SLJIT_ARG_MASK) == SLJIT_ARG_TYPE_F32, in sljit_emit_enter()
480 compiler->local_size = local_size; in sljit_emit_enter()
486 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096); in sljit_emit_enter()
488 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096 * 2); in sljit_emit_enter()
490 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096 * 3); in sljit_emit_enter()
493 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, local_size >> 12); in sljit_emit_enter()
495 EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_MEM1(SLJIT_SP), -4096); in sljit_emit_enter()
499 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in sljit_emit_enter()
509 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -local_size); in sljit_emit_enter()
518 compiler->mode32 = 1; in sljit_emit_enter()
522 …inst = emit_x86_instruction(compiler, 2 | EX86_SSE2, i, 0, SLJIT_MEM1(SLJIT_SP), saved_float_regs_… in sljit_emit_enter()
529 …inst = emit_x86_instruction(compiler, 2 | EX86_SSE2, i, 0, SLJIT_MEM1(SLJIT_SP), saved_float_regs_… in sljit_emit_enter()
540 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
550 …CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds… in sljit_set_context()
551 set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
565 compiler->local_size = ((local_size + saved_regs_size + 0xf) & ~0xf) - saved_regs_size; in sljit_set_context()
569 static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler) in emit_stack_frame_release() argument
576 sljit_s32 fscratches = compiler->fscratches; in emit_stack_frame_release()
577 sljit_s32 fsaveds = compiler->fsaveds; in emit_stack_frame_release()
584 compiler->mode32 = 1; in emit_stack_frame_release()
585 saved_float_regs_offset = (compiler->local_size - saved_float_regs_offset) & ~0xf; in emit_stack_frame_release()
589 …inst = emit_x86_instruction(compiler, 2 | EX86_SSE2, i, 0, SLJIT_MEM1(SLJIT_SP), saved_float_regs_… in emit_stack_frame_release()
596 …inst = emit_x86_instruction(compiler, 2 | EX86_SSE2, i, 0, SLJIT_MEM1(SLJIT_SP), saved_float_regs_… in emit_stack_frame_release()
604 if (compiler->local_size > 0) { in emit_stack_frame_release()
605 if (compiler->local_size <= 127) { in emit_stack_frame_release()
606 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4); in emit_stack_frame_release()
612 *inst = U8(compiler->local_size); in emit_stack_frame_release()
615 inst = (sljit_u8*)ensure_buf(compiler, 1 + 7); in emit_stack_frame_release()
621 sljit_unaligned_store_s32(inst, compiler->local_size); in emit_stack_frame_release()
625 tmp = compiler->scratches; in emit_stack_frame_release()
628 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in emit_stack_frame_release()
636 …tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJ… in emit_stack_frame_release()
639 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in emit_stack_frame_release()
650 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_void(struct sljit_compiler *compiler) in sljit_emit_return_void() argument
655 CHECK(check_sljit_emit_return_void(compiler)); in sljit_emit_return_void()
657 FAIL_IF(emit_stack_frame_release(compiler)); in sljit_emit_return_void()
659 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in sljit_emit_return_void()
672 static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *sr… in call_with_args() argument
695 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R2, 0); in call_with_args()
698 return emit_mov(compiler, SLJIT_R2, 0, SLJIT_R0, 0); in call_with_args()
703 static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *sr… in call_with_args() argument
738 EMIT_MOV(compiler, TMP_REG2, 0, src, 0); in call_with_args()
755 FAIL_IF(emit_sse2_load(compiler, 0, arg_count, float_arg_count, 0)); in call_with_args()
761 FAIL_IF(emit_sse2_load(compiler, 1, arg_count, float_arg_count, 0)); in call_with_args()
767 EMIT_MOV(compiler, word_arg_regs[arg_count], 0, word_arg_count, 0); in call_with_args()
781 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_… in sljit_emit_call() argument
785 CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types)); in sljit_emit_call()
787 compiler->mode32 = 0; in sljit_emit_call()
789 PTR_FAIL_IF(call_with_args(compiler, arg_types, NULL)); in sljit_emit_call()
792 PTR_FAIL_IF(emit_stack_frame_release(compiler)); in sljit_emit_call()
798 compiler->skip_checks = 1; in sljit_emit_call()
800 return sljit_emit_jump(compiler, type); in sljit_emit_call()
803 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_icall() argument
808 CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw)); in sljit_emit_icall()
810 compiler->mode32 = 0; in sljit_emit_icall()
814 EMIT_MOV(compiler, TMP_REG2, 0, src, srcw); in sljit_emit_icall()
820 EMIT_MOV(compiler, TMP_REG2, 0, src, srcw); in sljit_emit_icall()
824 FAIL_IF(emit_stack_frame_release(compiler)); in sljit_emit_icall()
828 FAIL_IF(call_with_args(compiler, arg_types, &src)); in sljit_emit_icall()
832 compiler->skip_checks = 1; in sljit_emit_icall()
835 return sljit_emit_ijump(compiler, type, src, srcw); in sljit_emit_icall()
838 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_fast_enter() argument
843 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw)); in sljit_emit_fast_enter()
848 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in sljit_emit_fast_enter()
855 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in sljit_emit_fast_enter()
864 compiler->mode32 = 1; in sljit_emit_fast_enter()
865 inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw); in sljit_emit_fast_enter()
871 static sljit_s32 emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw) in emit_fast_return() argument
877 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 1); in emit_fast_return()
884 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2 + 1); in emit_fast_return()
894 compiler->mode32 = 1; in emit_fast_return()
895 inst = emit_x86_instruction(compiler, 1, 0, 0, src, srcw); in emit_fast_return()
900 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in emit_fast_return()
913 static sljit_s32 emit_mov_int(struct sljit_compiler *compiler, sljit_s32 sign, in emit_mov_int() argument
920 compiler->mode32 = 0; in emit_mov_int()
925 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_s32)srcw, dst, dstw); in emit_mov_int()
930 return emit_load_imm64(compiler, dst, srcw); in emit_mov_int()
932 compiler->mode32 = 1; in emit_mov_int()
933 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_s32)srcw, dst, dstw); in emit_mov_int()
936 compiler->mode32 = 0; in emit_mov_int()
946 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src, srcw); in emit_mov_int()
950 compiler->mode32 = 1; in emit_mov_int()
951 FAIL_IF(emit_mov(compiler, dst_r, 0, src, srcw)); in emit_mov_int()
952 compiler->mode32 = 0; in emit_mov_int()
957 compiler->mode32 = 1; in emit_mov_int()
958 inst = emit_x86_instruction(compiler, 1, dst_r, 0, dst, dstw); in emit_mov_int()
961 compiler->mode32 = 0; in emit_mov_int()
967 static sljit_s32 skip_frames_before_return(struct sljit_compiler *compiler) in skip_frames_before_return() argument
975 size = compiler->local_size; in skip_frames_before_return()
976 tmp = compiler->scratches; in skip_frames_before_return()
979 …tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJ… in skip_frames_before_return()
983 return adjust_shadow_stack(compiler, SLJIT_MEM1(SLJIT_SP), size); in skip_frames_before_return()