tcg/e2k: add ibranch emmiter and refactor code
This commit is contained in:
parent
d1faf68515
commit
12389936d9
|
@ -143,6 +143,7 @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct)
|
|||
#define WBS 4
|
||||
|
||||
typedef enum {
|
||||
CTPR_NONE = 0,
|
||||
CTPR1 = 1,
|
||||
CTPR2 = 2,
|
||||
CTPR3 = 3,
|
||||
|
@ -769,6 +770,12 @@ static void e2k_out_ct(Bundle *bundle, CtprReg ctpr, CtCond cond, uint8_t pred)
|
|||
bundle->ss = deposit32(bundle->ss, 10, 2, ctpr);
|
||||
}
|
||||
|
||||
static void e2k_out_ibranch(Bundle *bundle, int32_t offset, CtCond cond, uint8_t pred)
|
||||
{
|
||||
e2k_out_ct(bundle, CTPR_NONE, cond, pred);
|
||||
e2k_out_cs(bundle, 0, encode_cs0_imm28(offset));
|
||||
}
|
||||
|
||||
static void e2k_out_call(Bundle *bundle, CtprReg ctpr, CtCond cond, uint8_t pred)
|
||||
{
|
||||
e2k_out_ct(bundle, ctpr, cond, pred);
|
||||
|
@ -793,13 +800,6 @@ static void e2k_out_mov(Bundle *bundle, int alc, TCGType type, TCGReg ret, TCGRe
|
|||
}
|
||||
}
|
||||
|
||||
static void e2k_out_sxt(Bundle *bundle, int alc, TCGType type, TCGReg ret, TCGReg arg)
|
||||
{
|
||||
if (type == TCG_TYPE_I32) {
|
||||
e2k_out_alf2_rr(bundle, alc, ALC_SXTW, ret, arg);
|
||||
}
|
||||
}
|
||||
|
||||
static void e2k_out_movi(Bundle *bundle, int alc, TCGReg ret, int64_t val)
|
||||
{
|
||||
e2k_out_alf2_ri(bundle, alc, ALC_MOVD, ret, val);
|
||||
|
@ -1209,7 +1209,7 @@ static void tcg_out_clz_int(TCGContext *s, TCGType type, TCGReg ret,
|
|||
|
||||
e2k_out_start(&bundle);
|
||||
e2k_out_alf2_rc(&bundle, 0, mov, ret, a1, c1);
|
||||
e2k_out_alf(&bundle, 1, clz, GPR(ret), 0, GPR(a0), 0);
|
||||
e2k_out_alf2_rr(&bundle, 1, clz, ret, a0);
|
||||
e2k_out_rlp(&bundle, 0, PREG_TMP0, false);
|
||||
e2k_out_rlp(&bundle, 1, PREG_TMP0, true);
|
||||
e2k_out_end(s, &bundle);
|
||||
|
@ -1506,7 +1506,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, TCGReg *pbase,
|
|||
/* Compare masked address with the TLB entry. */
|
||||
e2k_out_start(&bundle);
|
||||
e2k_out_prep(&bundle, CTPR1, 0);
|
||||
e2k_out_alf(&bundle, 0, ALC_CMPEDB, PREG_TMP0, GPR(TCG_REG_TMP0), GPR(TCG_REG_TMP1), 0);
|
||||
e2k_out_alf7_prr(&bundle, 0, ALC_CMPEDB, PREG_TMP0, TCG_REG_TMP0, TCG_REG_TMP1);
|
||||
e2k_out_end(s, &bundle);
|
||||
ldst->label_ptr[0] = s->code_ptr - bundle.len + bundle.cs_offset[0];
|
||||
ldst->label_addend[0] = bundle.cs_offset[0];
|
||||
|
@ -1537,7 +1537,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, TCGReg *pbase,
|
|||
|
||||
e2k_out_start(&bundle);
|
||||
e2k_out_prep(&bundle, CTPR1, 0);
|
||||
e2k_out_alf_lit(&bundle, 0, ALC_CMPANDEDB, PREG_TMP0, GPR(addr_reg), a_mask, true, 0);
|
||||
e2k_out_alf7_pri(&bundle, 0, ALC_CMPANDEDB, PREG_TMP0, addr_reg, a_mask);
|
||||
e2k_out_end(s, &bundle);
|
||||
ldst->label_ptr[0] = s->code_ptr - bundle.len + bundle.cs_offset[0];
|
||||
ldst->label_addend[0] = bundle.cs_offset[0];
|
||||
|
@ -2231,8 +2231,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
|
|||
|
||||
e2k_out_start(&bundle);
|
||||
/* user stack is freed automatically */
|
||||
e2k_out_lit(&bundle, 0, -FRAME_SIZE);
|
||||
e2k_out_alf(&bundle, 0, ALC_GETSP, GPR(TCG_REG_SP), 0, 0, 0);
|
||||
e2k_out_alf2_ri(&bundle, 0, ALC_GETSP, TCG_REG_SP, -FRAME_SIZE);
|
||||
/* Call generated code */
|
||||
e2k_out_ct(&bundle, CTPR1, CT_ALWAYS, 0);
|
||||
e2k_out_end(s, &bundle);
|
||||
|
|
Loading…
Reference in New Issue