target/sh4: Unify code for CHECK_NOT_DELAY_SLOT

We do not need to emit N copies of raising an exception.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <20170718200255.31647-19-rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Richard Henderson 2017-07-18 10:02:43 -10:00 committed by Aurelien Jarno
parent bdcb373902
commit dec16c6ee8

View File

@ -366,10 +366,7 @@ static inline void gen_store_fpr64(DisasContext *ctx, TCGv_i64 t, int reg)
#define CHECK_NOT_DELAY_SLOT \ #define CHECK_NOT_DELAY_SLOT \
if (ctx->envflags & DELAY_SLOT_MASK) { \ if (ctx->envflags & DELAY_SLOT_MASK) { \
gen_save_cpu_state(ctx, true); \ goto do_illegal_slot; \
gen_helper_raise_slot_illegal_instruction(cpu_env); \
ctx->bstate = BS_EXCP; \
return; \
} }
#define CHECK_PRIVILEGED \ #define CHECK_PRIVILEGED \
@ -1796,10 +1793,12 @@ static void _decode_opc(DisasContext * ctx)
ctx->opcode, ctx->pc); ctx->opcode, ctx->pc);
fflush(stderr); fflush(stderr);
#endif #endif
gen_save_cpu_state(ctx, true);
if (ctx->envflags & DELAY_SLOT_MASK) { if (ctx->envflags & DELAY_SLOT_MASK) {
do_illegal_slot:
gen_save_cpu_state(ctx, true);
gen_helper_raise_slot_illegal_instruction(cpu_env); gen_helper_raise_slot_illegal_instruction(cpu_env);
} else { } else {
gen_save_cpu_state(ctx, true);
gen_helper_raise_illegal_instruction(cpu_env); gen_helper_raise_illegal_instruction(cpu_env);
} }
ctx->bstate = BS_EXCP; ctx->bstate = BS_EXCP;