[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/37] target/i386: Merge gen_jmp_tb and gen_goto_tb into gen_jmp_
From: |
Paolo Bonzini |
Subject: |
[PULL 27/37] target/i386: Merge gen_jmp_tb and gen_goto_tb into gen_jmp_rel |
Date: |
Tue, 11 Oct 2022 12:26:50 +0200 |
From: Richard Henderson <richard.henderson@linaro.org>
These functions have only one caller, and the logic is more
obvious this way.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20221001140935.465607-23-richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/translate.c | 50 +++++++++++++------------------------
1 file changed, 17 insertions(+), 33 deletions(-)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 9294f12f66..2e7b94700b 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -224,7 +224,6 @@ STUB_HELPER(wrmsr, TCGv_env env)
static void gen_eob(DisasContext *s);
static void gen_jr(DisasContext *s);
-static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num);
static void gen_jmp_rel(DisasContext *s, MemOp ot, int diff, int tb_num);
static void gen_jmp_rel_csize(DisasContext *s, int diff, int tb_num);
static void gen_op(DisasContext *s1, int op, MemOp ot, int d);
@@ -2393,23 +2392,6 @@ static inline int insn_const_size(MemOp ot)
}
}
-static void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
-{
- target_ulong pc = s->cs_base + eip;
-
- if (translator_use_goto_tb(&s->base, pc)) {
- /* jump to same page: we can use a direct jump */
- tcg_gen_goto_tb(tb_num);
- gen_jmp_im(s, eip);
- tcg_gen_exit_tb(s->base.tb, tb_num);
- s->base.is_jmp = DISAS_NORETURN;
- } else {
- /* jump to another page */
- gen_jmp_im(s, eip);
- gen_jr(s);
- }
-}
-
static void gen_jcc(DisasContext *s, int b, int diff)
{
TCGLabel *l1 = gen_new_label();
@@ -2762,20 +2744,6 @@ static void gen_jr(DisasContext *s)
do_gen_eob_worker(s, false, false, true);
}
-/* generate a jump to eip. No segment change must happen before as a
- direct call to the next block may occur */
-static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num)
-{
- gen_update_cc_op(s);
- set_cc_op(s, CC_OP_DYNAMIC);
- if (s->jmp_opt) {
- gen_goto_tb(s, tb_num, eip);
- } else {
- gen_jmp_im(s, eip);
- gen_eob(s);
- }
-}
-
/* Jump to eip+diff, truncating the result to OT. */
static void gen_jmp_rel(DisasContext *s, MemOp ot, int diff, int tb_num)
{
@@ -2789,7 +2757,23 @@ static void gen_jmp_rel(DisasContext *s, MemOp ot, int
diff, int tb_num)
dest &= 0xffffffff;
}
}
- gen_jmp_tb(s, dest, tb_num);
+
+ gen_update_cc_op(s);
+ set_cc_op(s, CC_OP_DYNAMIC);
+ if (!s->jmp_opt) {
+ gen_jmp_im(s, dest);
+ gen_eob(s);
+ } else if (translator_use_goto_tb(&s->base, dest)) {
+ /* jump to same page: we can use a direct jump */
+ tcg_gen_goto_tb(tb_num);
+ gen_jmp_im(s, dest);
+ tcg_gen_exit_tb(s->base.tb, tb_num);
+ s->base.is_jmp = DISAS_NORETURN;
+ } else {
+ /* jump to another page */
+ gen_jmp_im(s, dest);
+ gen_jr(s);
+ }
}
/* Jump to eip+diff, truncating to the current code size. */
--
2.37.3
- [PULL 07/37] target/i386: Return bool from disas_insn, (continued)
- [PULL 07/37] target/i386: Return bool from disas_insn, Paolo Bonzini, 2022/10/11
- [PULL 18/37] target/i386: Introduce DISAS_JUMP, Paolo Bonzini, 2022/10/11
- [PULL 16/37] target/i386: Create cur_insn_len, cur_insn_len_i32, Paolo Bonzini, 2022/10/11
- [PULL 20/37] target/i386: Create eip_next_*, Paolo Bonzini, 2022/10/11
- [PULL 13/37] target/i386: Use DISAS_EOB* in gen_movl_seg_T0, Paolo Bonzini, 2022/10/11
- [PULL 21/37] target/i386: Use DISAS_TOO_MANY to exit after gen_io_start, Paolo Bonzini, 2022/10/11
- [PULL 22/37] target/i386: Create gen_jmp_rel, Paolo Bonzini, 2022/10/11
- [PULL 23/37] target/i386: Use gen_jmp_rel for loop, repz, jecxz insns, Paolo Bonzini, 2022/10/11
- [PULL 24/37] target/i386: Use gen_jmp_rel for gen_jcc, Paolo Bonzini, 2022/10/11
- [PULL 25/37] target/i386: Use gen_jmp_rel for DISAS_TOO_MANY, Paolo Bonzini, 2022/10/11
- [PULL 27/37] target/i386: Merge gen_jmp_tb and gen_goto_tb into gen_jmp_rel,
Paolo Bonzini <=
- [PULL 29/37] target/i386: Add cpu_eip, Paolo Bonzini, 2022/10/11
- [PULL 26/37] target/i386: Remove MemOp argument to gen_op_j*_ecx, Paolo Bonzini, 2022/10/11
- [PULL 30/37] target/i386: Inline gen_jmp_im, Paolo Bonzini, 2022/10/11
- [PULL 28/37] target/i386: Create eip_cur_tl, Paolo Bonzini, 2022/10/11
- [PULL 31/37] target/i386: Enable TARGET_TB_PCREL, Paolo Bonzini, 2022/10/11
- [PULL 32/37] x86: Implement MSR_CORE_THREAD_COUNT MSR, Paolo Bonzini, 2022/10/11
- [PULL 35/37] linux-user: i386/signal: move fpstate at the end of the 32-bit frames, Paolo Bonzini, 2022/10/11
- [PULL 33/37] i386: kvm: Add support for MSR filtering, Paolo Bonzini, 2022/10/11
- [PULL 36/37] linux-user: i386/signal: support FXSAVE fpstate on 32-bit emulation, Paolo Bonzini, 2022/10/11
- [PULL 34/37] KVM: x86: Implement MSR_CORE_THREAD_COUNT MSR, Paolo Bonzini, 2022/10/11