diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2023-09-14 07:48:39 -0700 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2023-09-28 10:07:32 -0700 |
commit | 5d97e94638100fd3e5b8d76ab30e1066cd4b1823 (patch) | |
tree | 0d3a6c58239bf36ead584f3b5adede8f75838d9d /accel/tcg | |
parent | f47a90dacca8f74210a2675bdde7ab3856872b94 (diff) | |
download | qemu-5d97e94638100fd3e5b8d76ab30e1066cd4b1823.zip qemu-5d97e94638100fd3e5b8d76ab30e1066cd4b1823.tar.gz qemu-5d97e94638100fd3e5b8d76ab30e1066cd4b1823.tar.bz2 |
accel/tcg: Hoist CF_MEMI_ONLY check outside translation loop
The condition checked is loop invariant; check it only once.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'accel/tcg')
-rw-r--r-- | accel/tcg/translator.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c index a398301..b6ab9f3 100644 --- a/accel/tcg/translator.c +++ b/accel/tcg/translator.c @@ -158,7 +158,13 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, ops->tb_start(db, cpu); tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ - plugin_enabled = plugin_gen_tb_start(cpu, db, cflags & CF_MEMI_ONLY); + if (cflags & CF_MEMI_ONLY) { + /* We should only see CF_MEMI_ONLY for io_recompile. */ + assert(cflags & CF_LAST_IO); + plugin_enabled = plugin_gen_tb_start(cpu, db, true); + } else { + plugin_enabled = plugin_gen_tb_start(cpu, db, false); + } while (true) { *max_insns = ++db->num_insns; @@ -176,12 +182,8 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, if (db->num_insns == db->max_insns && (cflags & CF_LAST_IO)) { /* Accept I/O on the last instruction. */ gen_io_start(); - ops->translate_insn(db, cpu); - } else { - /* we should only see CF_MEMI_ONLY for io_recompile */ - tcg_debug_assert(!(cflags & CF_MEMI_ONLY)); - ops->translate_insn(db, cpu); } + ops->translate_insn(db, cpu); /* * We can't instrument after instructions that change control |