Lines Matching refs:compiler
2 * Stack-less Just-In-Time compiler
29 static sljit_s32 emit_load_imm64(struct sljit_compiler *compiler, sljit_s32 reg, sljit_sw imm)
33 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2 + sizeof(sljit_sw));
90 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
98 CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
99 set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
101 compiler->flags_saved = 0;
109 inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
119 inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
129 inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
170 compiler->local_size = local_size;
175 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 + (3 + sizeof(sljit_s32)));
199 compiler->skip_checks = 1;
201 FAIL_IF(sljit_emit_ijump(compiler, SLJIT_CALL1, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_grow_stack)));
207 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
216 inst = (sljit_u8*)ensure_buf(compiler, 1 + 7);
229 inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
240 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
247 CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
248 set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
252 compiler->local_size = ((local_size + SLJIT_LOCALS_OFFSET + saved_register_size + 15) & ~15) - saved_register_size;
256 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
262 CHECK(check_sljit_emit_return(compiler, op, src, srcw));
264 compiler->flags_saved = 0;
265 FAIL_IF(emit_mov_before_return(compiler, op, src, srcw));
269 if (compiler->fscratches >= 6 || compiler->fsaveds >= 1) {
270 inst = (sljit_u8*)ensure_buf(compiler, 1 + 5);
278 SLJIT_ASSERT(compiler->local_size > 0);
279 if (compiler->local_size <= 127) {
280 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4);
286 *inst = compiler->local_size;
289 inst = (sljit_u8*)ensure_buf(compiler, 1 + 7);
295 sljit_unaligned_store_s32(inst, compiler->local_size);
298 tmp = compiler->scratches;
301 inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
309 tmp = compiler->saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - compiler->saveds) : SLJIT_FIRST_SAVED_REG;
312 inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
320 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
331 static sljit_s32 emit_do_imm32(struct sljit_compiler *compiler, sljit_u8 rex, sljit_u8 opcode, sljit_sw imm)
336 inst = (sljit_u8*)ensure_buf(compiler, 1 + length);
346 static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32 size,
359 SLJIT_ASSERT(!(a & SLJIT_IMM) || compiler->mode32 || IS_HALFWORD(imma));
375 if (!compiler->mode32 && !(flags & EX86_NO_REXW))
390 if (emit_load_imm64(compiler, TMP_REG3, immb))
437 imma &= compiler->mode32 ? 0x1f : 0x3f;
459 inst = (sljit_u8*)ensure_buf(compiler, 1 + inst_size);
556 static SLJIT_INLINE sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 type)
563 inst = (sljit_u8*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
577 inst = (sljit_u8*)ensure_buf(compiler, 1 + ((type < SLJIT_CALL3) ? 3 : 6));
592 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
597 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
606 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
613 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2);
622 compiler->mode32 = 1;
623 inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw);
629 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
634 CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
638 FAIL_IF(emit_load_imm64(compiler, TMP_REG1, srcw));
644 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 1);
651 inst = (sljit_u8*)ensure_buf(compiler, 1 + 2 + 1);
661 compiler->mode32 = 1;
662 inst = emit_x86_instruction(compiler, 1, 0, 0, src, srcw);
667 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
674 inst = (sljit_u8*)ensure_buf(compiler, 1 + 5 + 1);
692 static sljit_s32 emit_mov_int(struct sljit_compiler *compiler, sljit_s32 sign,
699 compiler->mode32 = 0;
707 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_s32)srcw, dst, dstw);
712 return emit_load_imm64(compiler, dst, srcw);
714 compiler->mode32 = 1;
715 inst = emit_x86_instruction(compiler, 1, SLJIT_IMM, (sljit_sw)(sljit_s32)srcw, dst, dstw);
718 compiler->mode32 = 0;
728 inst = emit_x86_instruction(compiler, 1, dst_r, 0, src, srcw);
732 compiler->mode32 = 1;
733 FAIL_IF(emit_mov(compiler, dst_r, 0, src, srcw));
734 compiler->mode32 = 0;
739 compiler->mode32 = 1;
740 inst = emit_x86_instruction(compiler, 1, dst_r, 0, dst, dstw);
743 compiler->mode32 = 0;