Browse Source

implement JIT_OP_MEMMOVE

cache-refactoring
Aleksey Demakov 19 years ago
parent
commit
23068aad8c
  1. 5
      ChangeLog
  2. 42
      jit/jit-rules-x86.sel

5
ChangeLog

@ -1,3 +1,8 @@
2005-12-28 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-rules-x86.sel: implement JIT_OP_MEMMOVE rule. Get rid of
compiler warnings in JIT_OP_MEMSET.
2005-12-24 Avinash Atreya <avinashatreya@gmail.com>
* dpas/dpas-parser.y: implement array expressions (committed by Aleksey

42
jit/jit-rules-x86.sel

@ -3146,8 +3146,37 @@ JIT_OP_MEMCPY: manual
JIT_OP_MEMMOVE: manual
[] -> {
/* TODO */
TODO();
unsigned char *inst;
int reg, reg2, reg3;
reg = _jit_regs_load_value
(gen, insn->dest, 0,
(insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE)));
reg2 = _jit_regs_load_value
(gen, insn->value1, 0,
(insn->flags & (JIT_INSN_VALUE1_NEXT_USE | JIT_INSN_VALUE1_LIVE)));
reg3 = _jit_regs_load_value
(gen, insn->value2, 0,
(insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE)));
/* A function call may destroy EAX,EBX,ECX,EDX registers. */
/* TODO: do not spill ESI and EDI. */
_jit_regs_spill_all(gen);
inst = gen->posn.ptr;
if(!jit_cache_check_for_n(&(gen->posn), 32))
{
jit_cache_mark_full(&(gen->posn));
return;
}
x86_push_reg(inst, _jit_reg_info[reg3].cpu_reg);
x86_push_reg(inst, _jit_reg_info[reg2].cpu_reg);
x86_push_reg(inst, _jit_reg_info[reg].cpu_reg);
x86_call_code(inst, jit_memmove);
x86_alu_reg_imm(inst, X86_ADD, X86_ESP, 3 * sizeof(void *));
gen->posn.ptr = inst;
}
JIT_OP_MEMSET: manual
@ -3162,12 +3191,14 @@ JIT_OP_MEMSET: manual
}
else if(insn->value2->is_constant && insn->value2->address <= 32)
{
save_reg3 = 0;
reg = _jit_regs_load_value
(gen, insn->dest, 0,
(insn->flags & (JIT_INSN_DEST_NEXT_USE | JIT_INSN_DEST_LIVE)));
reg2 = -1;
reg3 = -1;
save_reg3 = 0;
if(insn->value1->is_constant)
{
inst = gen->posn.ptr;
@ -3309,6 +3340,9 @@ JIT_OP_MEMSET: manual
reg3 = _jit_regs_load_value
(gen, insn->value2, 0,
(insn->flags & (JIT_INSN_VALUE2_NEXT_USE | JIT_INSN_VALUE2_LIVE)));
/* A function call may destroy EAX,EBX,ECX,EDX registers. */
/* TODO: do not spill ESI and EDI. */
_jit_regs_spill_all(gen);
inst = gen->posn.ptr;

Loading…
Cancel
Save