Lines Matching refs:compiler
29 static sljit_s32 emit_do_imm(struct sljit_compiler *compiler, sljit_u8 opcode, sljit_sw imm) in emit_do_imm() argument
33 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + sizeof(sljit_sw)); in emit_do_imm()
66 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler, in sljit_emit_enter() argument
74 …CHECK(check_sljit_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds,… in sljit_emit_enter()
75 set_emit_enter(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_emit_enter()
78 compiler->args = args; in sljit_emit_enter()
81 compiler->stack_tmp_size = 2 * sizeof(sljit_sw); in sljit_emit_enter()
85 compiler->stack_tmp_size = 3 * sizeof(sljit_sw); in sljit_emit_enter()
88 compiler->saveds_offset = compiler->stack_tmp_size; in sljit_emit_enter()
90 compiler->saveds_offset += ((scratches > (3 + 6)) ? 6 : (scratches - 3)) * sizeof(sljit_sw); in sljit_emit_enter()
92 compiler->locals_offset = compiler->saveds_offset; in sljit_emit_enter()
95 compiler->locals_offset += (saveds - 3) * sizeof(sljit_sw); in sljit_emit_enter()
98 …compiler->locals_offset = (compiler->locals_offset + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) … in sljit_emit_enter()
106 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in sljit_emit_enter()
174 compiler->local_size = local_size; in sljit_emit_enter()
180 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096); in sljit_emit_enter()
182 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096 * 2); in sljit_emit_enter()
184 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -4096 * 3); in sljit_emit_enter()
187 EMIT_MOV(compiler, SLJIT_R0, 0, SLJIT_SP, 0); in sljit_emit_enter()
188 EMIT_MOV(compiler, SLJIT_R1, 0, SLJIT_IMM, (local_size - 1) >> 12); in sljit_emit_enter()
192 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_R0), -4096); in sljit_emit_enter()
193 FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB), in sljit_emit_enter()
195 FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB), in sljit_emit_enter()
198 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in sljit_emit_enter()
206 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), -local_size); in sljit_emit_enter()
214 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_SP, 0); in sljit_emit_enter()
217 FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB), in sljit_emit_enter()
221 if (compiler->local_size > 1024) in sljit_emit_enter()
222 FAIL_IF(emit_cum_binary(compiler, BINARY_OPCODE(ADD), in sljit_emit_enter()
226 inst = (sljit_u8*)ensure_buf(compiler, 1 + 6); in sljit_emit_enter()
235 return emit_mov(compiler, SLJIT_MEM1(SLJIT_SP), compiler->local_size, TMP_REG1, 0); in sljit_emit_enter()
238 return emit_non_cum_binary(compiler, BINARY_OPCODE(SUB), in sljit_emit_enter()
242 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler, in sljit_set_context() argument
247 …CHECK(check_sljit_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds… in sljit_set_context()
248 set_set_context(compiler, options, arg_types, scratches, saveds, fscratches, fsaveds, local_size); in sljit_set_context()
250 compiler->args = get_arg_count(arg_types); in sljit_set_context()
253 compiler->stack_tmp_size = 2 * sizeof(sljit_sw); in sljit_set_context()
257 compiler->stack_tmp_size = 3 * sizeof(sljit_sw); in sljit_set_context()
260 compiler->saveds_offset = compiler->stack_tmp_size; in sljit_set_context()
262 compiler->saveds_offset += ((scratches > (3 + 6)) ? 6 : (scratches - 3)) * sizeof(sljit_sw); in sljit_set_context()
264 compiler->locals_offset = compiler->saveds_offset; in sljit_set_context()
267 compiler->locals_offset += (saveds - 3) * sizeof(sljit_sw); in sljit_set_context()
270 …compiler->locals_offset = (compiler->locals_offset + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) … in sljit_set_context()
274 compiler->local_size = ((SLJIT_LOCALS_OFFSET + saveds + local_size + 15) & ~15) - saveds; in sljit_set_context()
277 …compiler->local_size = SLJIT_LOCALS_OFFSET + ((local_size + sizeof(sljit_f64) - 1) & ~(sizeof(slji… in sljit_set_context()
279 …compiler->local_size = SLJIT_LOCALS_OFFSET + ((local_size + sizeof(sljit_sw) - 1) & ~(sizeof(sljit… in sljit_set_context()
284 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op,… in sljit_emit_return() argument
290 CHECK(check_sljit_emit_return(compiler, op, src, srcw)); in sljit_emit_return()
291 SLJIT_ASSERT(compiler->args >= 0); in sljit_emit_return()
293 FAIL_IF(emit_mov_before_return(compiler, op, src, srcw)); in sljit_emit_return()
295 SLJIT_ASSERT(compiler->local_size > 0); in sljit_emit_return()
298 if (compiler->options & SLJIT_F64_ALIGNMENT) in sljit_emit_return()
299 EMIT_MOV(compiler, SLJIT_SP, 0, SLJIT_MEM1(SLJIT_SP), compiler->local_size) in sljit_emit_return()
301 FAIL_IF(emit_cum_binary(compiler, BINARY_OPCODE(ADD), in sljit_emit_return()
302 SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, compiler->local_size)); in sljit_emit_return()
304 FAIL_IF(emit_cum_binary(compiler, BINARY_OPCODE(ADD), in sljit_emit_return()
305 SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, compiler->local_size)); in sljit_emit_return()
308 size = 2 + (compiler->scratches > 7 ? (compiler->scratches - 7) : 0) + in sljit_emit_return()
309 (compiler->saveds <= 3 ? compiler->saveds : 3); in sljit_emit_return()
311 if (compiler->args > 2) in sljit_emit_return()
314 if (compiler->args > 0) in sljit_emit_return()
317 inst = (sljit_u8*)ensure_buf(compiler, 1 + size); in sljit_emit_return()
322 if (compiler->saveds > 0 || compiler->scratches > 11) in sljit_emit_return()
324 if (compiler->saveds > 1 || compiler->scratches > 10) in sljit_emit_return()
326 if (compiler->saveds > 2 || compiler->scratches > 9) in sljit_emit_return()
330 if (compiler->args > 2) in sljit_emit_return()
346 static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32 size, in emit_x86_instruction() argument
422 inst = (sljit_u8*)ensure_buf(compiler, 1 + inst_size); in emit_x86_instruction()
546 static sljit_s32 c_fast_call_with_args(struct sljit_compiler *compiler, in c_fast_call_with_args() argument
553 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in c_fast_call_with_args()
560 … EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), compiler->saveds_offset - sizeof(sljit_sw)); in c_fast_call_with_args()
562 FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB), in c_fast_call_with_args()
573 FAIL_IF(emit_sse2_store(compiler, 1, SLJIT_MEM1(SLJIT_SP), stack_size, float_arg_count)); in c_fast_call_with_args()
578 FAIL_IF(emit_sse2_store(compiler, 0, SLJIT_MEM1(SLJIT_SP), stack_size, float_arg_count)); in c_fast_call_with_args()
584 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), stack_size, SLJIT_R2, 0); in c_fast_call_with_args()
588 EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), stack_size, TMP_REG1, 0); in c_fast_call_with_args()
600 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in c_fast_call_with_args()
607 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2); in c_fast_call_with_args()
621 static sljit_s32 cdecl_call_get_stack_size(struct sljit_compiler *compiler, sljit_s32 arg_types, sl… in cdecl_call_get_stack_size() argument
648 if (stack_size <= compiler->stack_tmp_size) in cdecl_call_get_stack_size()
652 return ((stack_size - compiler->stack_tmp_size + 15) & ~15); in cdecl_call_get_stack_size()
654 return stack_size - compiler->stack_tmp_size; in cdecl_call_get_stack_size()
658 static sljit_s32 cdecl_call_with_args(struct sljit_compiler *compiler, in cdecl_call_with_args() argument
664 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_MEM1(SLJIT_SP), compiler->saveds_offset - sizeof(sljit_sw)); in cdecl_call_with_args()
667 FAIL_IF(emit_non_cum_binary(compiler, BINARY_OPCODE(SUB), in cdecl_call_with_args()
678 FAIL_IF(emit_sse2_store(compiler, 1, SLJIT_MEM1(SLJIT_SP), stack_size, float_arg_count)); in cdecl_call_with_args()
683 FAIL_IF(emit_sse2_store(compiler, 0, SLJIT_MEM1(SLJIT_SP), stack_size, float_arg_count)); in cdecl_call_with_args()
688 …EMIT_MOV(compiler, SLJIT_MEM1(SLJIT_SP), stack_size, (word_arg_count >= 4) ? TMP_REG1 : word_arg_c… in cdecl_call_with_args()
699 static sljit_s32 post_call_with_args(struct sljit_compiler *compiler, in post_call_with_args() argument
706 FAIL_IF(emit_cum_binary(compiler, BINARY_OPCODE(ADD), in post_call_with_args()
714 inst = (sljit_u8*)ensure_buf(compiler, 1 + 3); in post_call_with_args()
721 return emit_sse2_load(compiler, single, SLJIT_FR0, SLJIT_MEM1(SLJIT_SP), 0); in post_call_with_args()
724 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_call(struct sljit_compiler *compiler, sljit_… in sljit_emit_call() argument
732 CHECK_PTR(check_sljit_emit_call(compiler, type, arg_types)); in sljit_emit_call()
737 PTR_FAIL_IF(c_fast_call_with_args(compiler, arg_types, stack_size, word_arg_count, 0)); in sljit_emit_call()
741 compiler->skip_checks = 1; in sljit_emit_call()
744 jump = sljit_emit_jump(compiler, type); in sljit_emit_call()
747 PTR_FAIL_IF(post_call_with_args(compiler, arg_types, 0)); in sljit_emit_call()
752 stack_size = cdecl_call_get_stack_size(compiler, arg_types, &word_arg_count); in sljit_emit_call()
753 PTR_FAIL_IF(cdecl_call_with_args(compiler, arg_types, stack_size, word_arg_count)); in sljit_emit_call()
757 compiler->skip_checks = 1; in sljit_emit_call()
760 jump = sljit_emit_jump(compiler, type); in sljit_emit_call()
763 PTR_FAIL_IF(post_call_with_args(compiler, arg_types, stack_size)); in sljit_emit_call()
767 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_icall(struct sljit_compiler *compiler, sljit_s32 type, in sljit_emit_icall() argument
778 CHECK(check_sljit_emit_icall(compiler, type, arg_types, src, srcw)); in sljit_emit_icall()
797 FAIL_IF(c_fast_call_with_args(compiler, arg_types, stack_size, word_arg_count, swap_args)); in sljit_emit_icall()
799 compiler->saveds_offset += stack_size; in sljit_emit_icall()
800 compiler->locals_offset += stack_size; in sljit_emit_icall()
804 compiler->skip_checks = 1; in sljit_emit_icall()
806 FAIL_IF(sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_icall()
808 compiler->saveds_offset -= stack_size; in sljit_emit_icall()
809 compiler->locals_offset -= stack_size; in sljit_emit_icall()
811 return post_call_with_args(compiler, arg_types, 0); in sljit_emit_icall()
815 stack_size = cdecl_call_get_stack_size(compiler, arg_types, &word_arg_count); in sljit_emit_icall()
816 FAIL_IF(cdecl_call_with_args(compiler, arg_types, stack_size, word_arg_count)); in sljit_emit_icall()
818 compiler->saveds_offset += stack_size; in sljit_emit_icall()
819 compiler->locals_offset += stack_size; in sljit_emit_icall()
823 compiler->skip_checks = 1; in sljit_emit_icall()
825 FAIL_IF(sljit_emit_ijump(compiler, type, src, srcw)); in sljit_emit_icall()
827 compiler->saveds_offset -= stack_size; in sljit_emit_icall()
828 compiler->locals_offset -= stack_size; in sljit_emit_icall()
830 return post_call_with_args(compiler, arg_types, stack_size); in sljit_emit_icall()
833 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32… in sljit_emit_fast_enter() argument
838 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw)); in sljit_emit_fast_enter()
849 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in sljit_emit_fast_enter()
858 inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw); in sljit_emit_fast_enter()
864 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s3… in sljit_emit_fast_return() argument
869 CHECK(check_sljit_emit_fast_return(compiler, src, srcw)); in sljit_emit_fast_return()
875 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 1); in sljit_emit_fast_return()
882 inst = emit_x86_instruction(compiler, 1, 0, 0, src, srcw); in sljit_emit_fast_return()
887 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1); in sljit_emit_fast_return()