e2k: Disable debug restore checks if not needed.

Do not check illtag if not needed.
This commit is contained in:
Denis Drakhnia 2021-01-19 15:14:20 +02:00 committed by Denis Drakhnia
parent 89aa3a80c1
commit 3b03e60115
3 changed files with 37 additions and 24 deletions

View File

@ -243,11 +243,12 @@ static inline void gen_goto_ctpr_disp(TCGv_i64 ctpr)
static inline void do_reset(DisasContext *ctx)
{
ctx->max_wreg_cur = -1;
ctx->max_breg_cur = -1;
ctx->do_check_illtag = false;
memset(ctx->mas, 0, sizeof(ctx->mas));
ctx->illtag = e2k_get_temp_i32(ctx);
tcg_gen_movi_i32(ctx->illtag, 0);
ctx->max_wreg_cur = -1;
ctx->max_breg_cur = -1;
}
static inline target_ulong do_decode(DisasContext *ctx, CPUState *cs)
@ -282,15 +283,7 @@ static inline void do_execute(DisasContext *ctx)
e2k_plu_execute(ctx);
}
/*
* Writes results of instructions from a bundle to the state
*
* Note
* ====
*
* Must not generate any exception.
* */
static inline void do_commit(DisasContext *ctx)
static inline void do_window_bounds_check(DisasContext *ctx)
{
if (ctx->max_wreg < ctx->max_wreg_cur) {
TCGLabel *l0 = gen_new_label();
@ -308,6 +301,18 @@ static inline void do_commit(DisasContext *ctx)
gen_set_label(l0);
}
}
/*
* Writes results of instructions from a bundle to the state
*
* Note
* ====
*
* Must not generate any exception.
* */
static inline void do_commit(DisasContext *ctx)
{
e2k_control_window_change(ctx);
e2k_alc_commit(ctx);
e2k_aau_commit(ctx);
@ -319,9 +324,11 @@ static inline void do_branch(DisasContext *ctx, target_ulong pc_next)
{
TCGLabel *l0 = gen_new_label();
tcg_gen_brcondi_i32(TCG_COND_EQ, ctx->illtag, 0, l0);
e2k_gen_exception(E2K_EXCP_ILLOPC);
gen_set_label(l0);
if (ctx->do_check_illtag) {
tcg_gen_brcondi_i32(TCG_COND_EQ, ctx->illtag, 0, l0);
e2k_gen_exception(E2K_EXCP_ILLOPC);
gen_set_label(l0);
}
if (ctx->ct.type == CT_NONE) {
e2k_gen_save_pc(ctx->base.pc_next);
@ -385,8 +392,6 @@ static void e2k_tr_init_disas_context(DisasContextBase *db, CPUState *cs)
CPUE2KState *env = &cpu->env;
ctx->version = env->version;
ctx->max_wreg = -1;
ctx->max_breg = -1;
if (version != ctx->version) {
if (version > 0) {
@ -400,8 +405,10 @@ static void e2k_tr_init_disas_context(DisasContextBase *db, CPUState *cs)
static void e2k_tr_tb_start(DisasContextBase *db, CPUState *cs)
{
// DisasContext *ctx = container_of(db, DisasContext, base);
DisasContext *ctx = container_of(db, DisasContext, base);
ctx->max_wreg = -1;
ctx->max_breg = -1;
tcg_gen_movi_i32(e2k_cs.ct_cond, 0);
}
@ -415,16 +422,19 @@ static void e2k_tr_insn_start(DisasContextBase *db, CPUState *cs)
static void e2k_tr_translate_insn(DisasContextBase *db, CPUState *cs)
{
DisasContext *ctx = container_of(db, DisasContext, base);
TCGLabel *l0 = gen_new_label();
target_ulong pc_next;
tcg_gen_brcondi_i32(TCG_COND_EQ, e2k_cs.is_bp, 0, l0);
gen_helper_break_restore_state(cpu_env);
gen_set_label(l0);
if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
TCGLabel *l0 = gen_new_label();
tcg_gen_brcondi_i32(TCG_COND_EQ, e2k_cs.is_bp, 0, l0);
gen_helper_break_restore_state(cpu_env);
gen_set_label(l0);
}
do_reset(ctx);
pc_next = do_decode(ctx, cs);
do_execute(ctx);
do_window_bounds_check(ctx);
do_commit(ctx);
do_branch(ctx, pc_next);

View File

@ -216,8 +216,10 @@ typedef struct DisasContext {
int max_breg;
int max_breg_cur;
/* illegal tag for delayed exception */
/* Delayed illegal tag check */
TCGv_i32 illtag;
bool do_check_illtag;
TCGv_i64 cond[6];
AlResult al_results[6];
TCGv_i32 al_cond[6];

View File

@ -198,7 +198,7 @@ static inline void gen_literal_i64(DisasContext *ctx, Src64 *ret, uint8_t arg)
uint64_t lit = ctx->bundle.lts[i];
if (!ctx->bundle.lts_present[i]) {
e2k_gen_exception(E2K_EXCP_ILLOPN);
e2k_tr_gen_exception(ctx, E2K_EXCP_ILLOPN);
} else if (IS_LIT16_LO(arg) && i < 2) {
lit = ((int64_t) lit << 48) >> 48;
} else if (IS_LIT16_HI(arg) && i < 2) {
@ -224,7 +224,7 @@ static inline void gen_literal_i32(DisasContext *ctx, Src32 *ret, uint8_t arg)
int32_t lit = ctx->bundle.lts[i];
if (!ctx->bundle.lts_present[i]) {
e2k_gen_exception(E2K_EXCP_ILLOPN);
e2k_tr_gen_exception(ctx, E2K_EXCP_ILLOPN);
} else if (IS_LIT16_LO(arg) && i < 2) {
lit = (lit << 16) >> 16;
} else if (IS_LIT16_HI(arg) && i < 2) {
@ -437,6 +437,7 @@ static inline void gen_tag1(TCGv_i32 ret, int tag, TCGv_i32 arg1)
static inline void gen_tag_check(Instr *instr, TCGv_i32 tag)
{
if (!instr->sm && tag != NULL) {
instr->ctx->do_check_illtag = true;
TCGv_i32 illtag = instr->ctx->illtag;
tcg_gen_or_i32(illtag, illtag, tag);
}