mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
target/arm: Use DISAS_NORETURN
Fold DISAS_EXC and DISAS_TB_JUMP into DISAS_NORETURN. In both cases all following code is dead. In the first case because we have exited the TB via exception; in the second case because we have exited the TB via goto_tb and its associated machinery. Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
parent
1e39d97af0
commit
a0c231e651
3 changed files with 30 additions and 29 deletions
|
@ -304,7 +304,7 @@ static void gen_exception_internal_insn(DisasContext *s, int offset, int excp)
|
|||
{
|
||||
gen_a64_set_pc_im(s->pc - offset);
|
||||
gen_exception_internal(excp);
|
||||
s->is_jmp = DISAS_EXC;
|
||||
s->is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
|
||||
static void gen_exception_insn(DisasContext *s, int offset, int excp,
|
||||
|
@ -312,7 +312,7 @@ static void gen_exception_insn(DisasContext *s, int offset, int excp,
|
|||
{
|
||||
gen_a64_set_pc_im(s->pc - offset);
|
||||
gen_exception(excp, syndrome, target_el);
|
||||
s->is_jmp = DISAS_EXC;
|
||||
s->is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
|
||||
static void gen_ss_advance(DisasContext *s)
|
||||
|
@ -340,7 +340,7 @@ static void gen_step_complete_exception(DisasContext *s)
|
|||
gen_ss_advance(s);
|
||||
gen_exception(EXCP_UDEF, syn_swstep(s->ss_same_el, 1, s->is_ldex),
|
||||
default_exception_el(s));
|
||||
s->is_jmp = DISAS_EXC;
|
||||
s->is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *s, int n, uint64_t dest)
|
||||
|
@ -371,7 +371,7 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
|
|||
tcg_gen_goto_tb(n);
|
||||
gen_a64_set_pc_im(dest);
|
||||
tcg_gen_exit_tb((intptr_t)tb + n);
|
||||
s->is_jmp = DISAS_TB_JUMP;
|
||||
s->is_jmp = DISAS_NORETURN;
|
||||
} else {
|
||||
gen_a64_set_pc_im(dest);
|
||||
if (s->ss_active) {
|
||||
|
@ -380,7 +380,7 @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
|
|||
gen_exception_internal(EXCP_DEBUG);
|
||||
} else {
|
||||
tcg_gen_lookup_and_goto_ptr(cpu_pc);
|
||||
s->is_jmp = DISAS_TB_JUMP;
|
||||
s->is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11326,7 +11326,7 @@ void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb)
|
|||
assert(num_insns == 1);
|
||||
gen_exception(EXCP_UDEF, syn_swstep(dc->ss_same_el, 0, 0),
|
||||
default_exception_el(dc));
|
||||
dc->is_jmp = DISAS_EXC;
|
||||
dc->is_jmp = DISAS_NORETURN;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -11353,21 +11353,25 @@ void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb)
|
|||
gen_io_end();
|
||||
}
|
||||
|
||||
if (unlikely(cs->singlestep_enabled || dc->ss_active)
|
||||
&& dc->is_jmp != DISAS_EXC) {
|
||||
if (unlikely(cs->singlestep_enabled || dc->ss_active)) {
|
||||
/* Note that this means single stepping WFI doesn't halt the CPU.
|
||||
* For conditional branch insns this is harmless unreachable code as
|
||||
* gen_goto_tb() has already handled emitting the debug exception
|
||||
* (and thus a tb-jump is not possible when singlestepping).
|
||||
*/
|
||||
assert(dc->is_jmp != DISAS_TB_JUMP);
|
||||
if (dc->is_jmp != DISAS_JUMP) {
|
||||
switch (dc->is_jmp) {
|
||||
default:
|
||||
gen_a64_set_pc_im(dc->pc);
|
||||
}
|
||||
if (cs->singlestep_enabled) {
|
||||
gen_exception_internal(EXCP_DEBUG);
|
||||
} else {
|
||||
gen_step_complete_exception(dc);
|
||||
/* fall through */
|
||||
case DISAS_JUMP:
|
||||
if (cs->singlestep_enabled) {
|
||||
gen_exception_internal(EXCP_DEBUG);
|
||||
} else {
|
||||
gen_step_complete_exception(dc);
|
||||
}
|
||||
break;
|
||||
case DISAS_NORETURN:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (dc->is_jmp) {
|
||||
|
@ -11377,8 +11381,7 @@ void gen_intermediate_code_a64(CPUState *cs, TranslationBlock *tb)
|
|||
case DISAS_JUMP:
|
||||
tcg_gen_lookup_and_goto_ptr(cpu_pc);
|
||||
break;
|
||||
case DISAS_TB_JUMP:
|
||||
case DISAS_EXC:
|
||||
case DISAS_NORETURN:
|
||||
case DISAS_SWI:
|
||||
break;
|
||||
case DISAS_WFE:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue