added some more macro opcodes

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4077
This commit is contained in:
David Anderson 2006-09-20 04:14:53 +00:00
parent 7b3530de67
commit 7d0bb14848
2 changed files with 68 additions and 7 deletions

View File

@ -963,6 +963,46 @@ inline void WriteOp_Pop_Heap_Pri(JitWriter *jit)
IA32_Mov_Reg_Rm_Disp_Reg(jit, AMX_REG_PRI, AMX_REG_DAT, AMX_REG_TMP, NOSCALE);
}
inline void WriteOp_Load_Both(JitWriter *jit)
{
WriteOp_Const_Pri(jit);
WriteOp_Const_Alt(jit);
}
inline void WriteOp_Load_S_Both(JitWriter *jit)
{
WriteOp_Load_S_Pri(jit);
WriteOp_Load_S_Alt(jit);
}
inline void WriteOp_Const(JitWriter *jit)
{
//mov [edi+<addr>], <val>
cell_t addr = jit->read_cell();
cell_t val = jit->read_cell();
if (addr < SCHAR_MAX && addr > SCHAR_MIN)
{
IA32_Mov_Rm_Imm32_Disp8(jit, AMX_REG_DAT, val, (jit_int8_t)addr);
} else {
IA32_Mov_Rm_Imm32_Disp32(jit, AMX_REG_DAT, val, addr);
}
}
inline void WriteOp_Const_S(JitWriter *jit)
{
//mov [ebx+<offs>], <val>
cell_t offs = jit->read_cell();
cell_t val = jit->read_cell();
if (offs < SCHAR_MAX && offs > SCHAR_MIN)
{
IA32_Mov_Rm_Imm32_Disp8(jit, AMX_REG_FRM, val, (jit_int8_t)offs);
} else {
IA32_Mov_Rm_Imm32_Disp32(jit, AMX_REG_FRM, val, offs);
}
}
/*************************************************
*************************************************
* JIT PROPER ************************************
@ -1591,10 +1631,31 @@ IPluginContext *JITX86::CompileToContext(ICompilation *co, int *err)
WriteOp_Push_Alt(jit);
break;
}
case OP_LOAD_BOTH:
{
WriteOp_Load_Both(jit);
break;
}
case OP_LOAD_S_BOTH:
{
WriteOp_Load_S_Both(jit);
break;
}
case OP_CONST:
{
WriteOp_Const(jit);
break;
}
case OP_CONST_S:
{
WriteOp_Const_S(jit);
break;
}
default:
{
/* :TODO: error! */
break;
AbortCompilation(co);
*err = SP_ERR_INVALID_INSTRUCTION;
return NULL;
}
}
}

View File

@ -143,7 +143,7 @@ typedef enum
OP_CASETBL,
OP_SWAP_PRI, //DONE
OP_SWAP_ALT, //DONE
OP_PUSH_ADR,
OP_PUSH_ADR, //DONE
OP_NOP, //DONE
OP_SYSREQ_N,
OP_SYMTAG, //DEPRECATED
@ -164,10 +164,10 @@ typedef enum
OP_PUSH5, //DONE
OP_PUSH5_S, //DONE
OP_PUSH5_ADR, //DONE
OP_LOAD_BOTH,
OP_LOAD_S_BOTH,
OP_CONST,
OP_CONST_S,
OP_LOAD_BOTH, //DONE
OP_LOAD_S_BOTH, //DONE
OP_CONST, //DONE
OP_CONST_S, //DONE
/* ----- */
OP_SYSREQ_D, //UNSUPPORTED
OP_SYSREQ_ND, //UNSUPPORTED