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()
105 PTR_FAIL_IF(emit_load_imm64(compiler, TMP_REG2, immb)); in emit_x86_instruction()
160 SLJIT_ASSERT(imma <= (compiler->mode32 ? 0x1f : 0x3f)); in emit_x86_instruction()
186 inst = (sljit_u8*)ensure_buf(compiler, 1 + inst_size); in emit_x86_instruction()
373 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
389 …CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds,… in sljit_emit_enter()
390 set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
396 FAIL_IF(emit_endbranch(compiler)); in sljit_emit_enter()
398 compiler->mode32 = 0; in sljit_emit_enter()
406 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in sljit_emit_enter()
416 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in sljit_emit_enter()
474 EMIT_MOV(compiler, SLJIT_R0 + word_arg_count, 0, tmp, 0); in sljit_emit_enter()
476 EMIT_MOV(compiler, SLJIT_S0 - saved_arg_count, 0, tmp, 0); in sljit_emit_enter()
485 FAIL_IF(emit_sse2_load(compiler, (arg_types & SLJIT_ARG_MASK) == SLJIT_ARG_TYPE_F32, in sljit_emit_enter()
493 compiler->local_size = local_size; in sljit_emit_enter()
499 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096); in sljit_emit_enter()
501 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096 * 2); in sljit_emit_enter()
503 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096 * 3); in sljit_emit_enter()
506 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, local_size >> 12); in sljit_emit_enter()
508 EMIT_MOV(compiler, TMP_REG2, 0, SLJIT_MEM1(SLJIT_SP), -4096); in sljit_emit_enter()
512 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in sljit_emit_enter()
522 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -local_size); in sljit_emit_enter()
531 compiler->mode32 = 1; in sljit_emit_enter()
535 …inst = emit_x86_instruction(compiler, 2 | EX86_SSE2, i, 0, SLJIT_MEM1(SLJIT_SP), saved_float_regs_… in sljit_emit_enter()
542 …inst = emit_x86_instruction(compiler, 2 | EX86_SSE2, i, 0, SLJIT_MEM1(SLJIT_SP), saved_float_regs_… in sljit_emit_enter()
553 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
563 …CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds… in sljit_set_context()
564 set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
578 compiler->local_size = ((local_size + saved_regs_size + 0xf) & ~0xf) - saved_regs_size; in sljit_set_context()
582 static sljit_s32 emit_stack_frame_release(struct sljit_compiler *compiler, sljit_s32 is_return_to) in emit_stack_frame_release() argument
589 sljit_s32 fscratches = compiler->fscratches; in emit_stack_frame_release()
590 sljit_s32 fsaveds = compiler->fsaveds; in emit_stack_frame_release()
597 compiler->mode32 = 1; in emit_stack_frame_release()
598 saved_float_regs_offset = (compiler->local_size - saved_float_regs_offset) & ~0xf; in emit_stack_frame_release()
602 …inst = emit_x86_instruction(compiler, 2 | EX86_SSE2, i, 0, SLJIT_MEM1(SLJIT_SP), saved_float_regs_… in emit_stack_frame_release()
609 …inst = emit_x86_instruction(compiler, 2 | EX86_SSE2, i, 0, SLJIT_MEM1(SLJIT_SP), saved_float_regs_… in emit_stack_frame_release()
615 compiler->mode32 = 0; in emit_stack_frame_release()
619 local_size = compiler->local_size; in emit_stack_frame_release()
621 …if (is_return_to && compiler->scratches < SLJIT_FIRST_SAVED_REG && (compiler->saveds == SLJIT_KEPT… in emit_stack_frame_release()
629 tmp = compiler->scratches; in emit_stack_frame_release()
632 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in emit_stack_frame_release()
640 tmp = SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options); in emit_stack_frame_release()
641 for (i = SLJIT_S0 + 1 - compiler->saveds; i <= tmp; i++) { in emit_stack_frame_release()
643 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in emit_stack_frame_release()
657 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_void(struct sljit_compiler *compiler) in sljit_emit_return_void() argument
662 CHECK(check_sljit_emit_return_void(compiler)); in sljit_emit_return_void()
664 compiler->mode32 = 0; in sljit_emit_return_void()
666 FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_return_void()
668 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in sljit_emit_return_void()
675 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return_to(struct sljit_compiler *compiler, in sljit_emit_return_to() argument
679 CHECK(check_sljit_emit_return_to(compiler, src, srcw)); in sljit_emit_return_to()
681 compiler->mode32 = 0; in sljit_emit_return_to()
683 …(src >= SLJIT_FIRST_SAVED_REG && src <= (SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options)))) { in sljit_emit_return_to()
686 EMIT_MOV(compiler, TMP_REG2, 0, src, srcw); in sljit_emit_return_to()
691 FAIL_IF(emit_stack_frame_release(compiler, 1)); in sljit_emit_return_to()
693 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_return_to()
694 return sljit_emit_ijump(compiler, SLJIT_JUMP, src, srcw); in sljit_emit_return_to()
703 static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *sr… in call_with_args() argument
726 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_R2, 0); in call_with_args()
729 return emit_mov(compiler, SLJIT_R2, 0, SLJIT_R0, 0); in call_with_args()
734 static sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 arg_types, sljit_s32 *sr… in call_with_args() argument
769 EMIT_MOV(compiler, TMP_REG2, 0, src, 0); in call_with_args()
786 FAIL_IF(emit_sse2_load(compiler, 0, arg_count, float_arg_count, 0)); in call_with_args()
792 FAIL_IF(emit_sse2_load(compiler, 1, arg_count, float_arg_count, 0)); in call_with_args()
798 EMIT_MOV(compiler, word_arg_regs[arg_count], 0, word_arg_count, 0); in call_with_args()
812 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_… in sljit_emit_call() argument
816 CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types)); in sljit_emit_call()
818 compiler->mode32 = 0; in sljit_emit_call()
821 PTR_FAIL_IF(call_with_args(compiler, arg_types, NULL)); in sljit_emit_call()
824 PTR_FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_call()
828 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_call()
829 return sljit_emit_jump(compiler, type); in sljit_emit_call()
832 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_icall() argument
837 CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw)); in sljit_emit_icall()
839 compiler->mode32 = 0; in sljit_emit_icall()
843 EMIT_MOV(compiler, TMP_REG2, 0, src, srcw); in sljit_emit_icall()
848 …if (src >= SLJIT_FIRST_SAVED_REG && src <= (SLJIT_S0 - SLJIT_KEPT_SAVEDS_COUNT(compiler->options))… in sljit_emit_icall()
849 EMIT_MOV(compiler, TMP_REG2, 0, src, srcw); in sljit_emit_icall()
853 FAIL_IF(emit_stack_frame_release(compiler, 0)); in sljit_emit_icall()
857 FAIL_IF(call_with_args(compiler, arg_types, &src)); in sljit_emit_icall()
862 SLJIT_SKIP_CHECKS(compiler); in sljit_emit_icall()
863 return sljit_emit_ijump(compiler, type, src, srcw); in sljit_emit_icall()
866 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_fast_enter() argument
871 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw)); in sljit_emit_fast_enter()
876 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in sljit_emit_fast_enter()
883 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in sljit_emit_fast_enter()
892 compiler->mode32 = 1; in sljit_emit_fast_enter()
893 inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw); in sljit_emit_fast_enter()
899 static sljit_s32 emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw) in emit_fast_return() argument
905 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 1); in emit_fast_return()
912 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2 + 1); in emit_fast_return()
922 compiler->mode32 = 1; in emit_fast_return()
923 inst = emit_x86_instruction(compiler, 1, 0, 0, src, srcw); in emit_fast_return()
928 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in emit_fast_return()
941 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_mem(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_mem() argument
950 CHECK(check_sljit_emit_mem(compiler, type, reg, mem, memw)); in sljit_emit_mem()
953 return sljit_emit_mem_unaligned(compiler, type, reg, mem, memw); in sljit_emit_mem()
957 compiler->mode32 = 0; in sljit_emit_mem()
960 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, memw); in sljit_emit_mem()
965 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_IMM, memw); in sljit_emit_mem()
979 EMIT_MOV(compiler, TMP_REG1, 0, OFFS_REG(mem), 0); in sljit_emit_mem()
998 inst = (sljit_u8*)ensure_buf(compiler, (sljit_uw)(1 + 5)); in sljit_emit_mem()
1009 EMIT_MOV(compiler, mem, memw, reg, 0); in sljit_emit_mem()
1011 EMIT_MOV(compiler, reg, 0, mem, memw); in sljit_emit_mem()
1021 static sljit_s32 emit_mov_int(struct sljit_compiler *compiler, sljit_s32 sign, in emit_mov_int() argument
1028 compiler->mode32 = 0; in emit_mov_int()
1033 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_s32)srcw, dst, dstw); in emit_mov_int()
1038 return emit_load_imm64(compiler, dst, srcw); in emit_mov_int()
1040 compiler->mode32 = 1; in emit_mov_int()
1041 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_s32)srcw, dst, dstw); in emit_mov_int()
1044 compiler->mode32 = 0; in emit_mov_int()
1054 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src, srcw); in emit_mov_int()
1058 compiler->mode32 = 1; in emit_mov_int()
1059 FAIL_IF(emit_mov(compiler, dst_r, 0, src, srcw)); in emit_mov_int()
1060 compiler->mode32 = 0; in emit_mov_int()
1065 compiler->mode32 = 1; in emit_mov_int()
1066 inst = emit_x86_instruction(compiler, 1, dst_r, 0, dst, dstw); in emit_mov_int()
1069 compiler->mode32 = 0; in emit_mov_int()
1075 static sljit_s32 skip_frames_before_return(struct sljit_compiler *compiler) in skip_frames_before_return() argument
1083 size = compiler->local_size; in skip_frames_before_return()
1084 tmp = compiler->scratches; in skip_frames_before_return()
1087 …tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJ… in skip_frames_before_return()
1091 return adjust_shadow_stack(compiler, SLJIT_MEM1(SLJIT_SP), size); in skip_frames_before_return()