From: "Emilio G. Cota" <cota@braap.org>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Artyom Tarasenko <atar4qemu@gmail.com>
Subject: [Qemu-devel] [PATCH 03/18] target/sparc: convert to DisasJumpType
Date: Fri, 20 Apr 2018 14:55:02 -0400 [thread overview]
Message-ID: <1524250517-28032-4-git-send-email-cota@braap.org> (raw)
In-Reply-To: <1524250517-28032-1-git-send-email-cota@braap.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
target/sparc/translate.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index 5aa367a..03c6510 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -30,6 +30,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/translator.h"
#include "exec/log.h"
#include "asi.h"
@@ -69,7 +70,7 @@ typedef struct DisasContext {
target_ulong pc; /* current Program Counter: integer or DYNAMIC_PC */
target_ulong npc; /* next PC: integer or DYNAMIC_PC or JUMP_PC */
target_ulong jump_pc[2]; /* used when JUMP_PC pc value is used */
- int is_br;
+ DisasJumpType is_jmp;
int mem_idx;
bool fpu_enabled;
bool address_mask_32bit;
@@ -995,7 +996,7 @@ static void gen_branch_a(DisasContext *dc, target_ulong pc1)
gen_set_label(l1);
gen_goto_tb(dc, 1, npc + 4, npc + 8);
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
}
static void gen_branch_n(DisasContext *dc, target_ulong pc1)
@@ -1078,7 +1079,7 @@ static void gen_exception(DisasContext *dc, int which)
t = tcg_const_i32(which);
gen_helper_raise_exception(cpu_env, t);
tcg_temp_free_i32(t);
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
}
static void gen_check_align(TCGv addr, int mask)
@@ -3351,7 +3352,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
if (cond == 8) {
/* An unconditional trap ends the TB. */
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
goto jmp_insn;
} else {
/* A conditional trap falls through to the next insn. */
@@ -4331,7 +4332,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
save_state(dc);
gen_op_next_insn();
tcg_gen_exit_tb(0);
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
break;
case 0x6: /* V9 wrfprs */
tcg_gen_xor_tl(cpu_tmp0, cpu_src1, cpu_src2);
@@ -4340,7 +4341,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
save_state(dc);
gen_op_next_insn();
tcg_gen_exit_tb(0);
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
break;
case 0xf: /* V9 sir, nop if user */
#if !defined(CONFIG_USER_ONLY)
@@ -4468,7 +4469,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
save_state(dc);
gen_op_next_insn();
tcg_gen_exit_tb(0);
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
#endif
}
break;
@@ -4624,7 +4625,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
save_state(dc);
gen_op_next_insn();
tcg_gen_exit_tb(0);
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
break;
case 1: // htstate
// XXX gen_op_wrhtstate();
@@ -5690,7 +5691,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
} else if (dc->npc == JUMP_PC) {
/* we can do a static jump */
gen_branch2(dc, dc->jump_pc[0], dc->jump_pc[1], cpu_cond);
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
} else {
dc->pc = dc->npc;
dc->npc = dc->npc + 4;
@@ -5752,6 +5753,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb)
pc_start = tb->pc;
dc->pc = pc_start;
last_pc = dc->pc;
+ dc->is_jmp = DISAS_NEXT;
dc->npc = (target_ulong) tb->cs_base;
dc->cc_op = CC_OP_DYNAMIC;
dc->mem_idx = tb->flags & TB_FLAG_MMU_MASK;
@@ -5796,7 +5798,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb)
}
gen_helper_debug(cpu_env);
tcg_gen_exit_tb(0);
- dc->is_br = 1;
+ dc->is_jmp = DISAS_NORETURN;
goto exit_gen_loop;
}
@@ -5808,8 +5810,9 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb)
disas_sparc_insn(dc, insn);
- if (dc->is_br)
+ if (dc->is_jmp == DISAS_NORETURN) {
break;
+ }
/* if the next PC is different, we abort now */
if (dc->pc != (last_pc + 4))
break;
@@ -5830,7 +5833,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock * tb)
if (tb_cflags(tb) & CF_LAST_IO) {
gen_io_end();
}
- if (!dc->is_br) {
+ if (dc->is_jmp != DISAS_NORETURN) {
if (dc->pc != DYNAMIC_PC &&
(dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) {
/* static PC and NPC: we can use direct chaining */
--
2.7.4
next prev parent reply other threads:[~2018-04-20 18:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 18:54 [Qemu-devel] [PATCH v3 00/18] Translation loop conversion for sh4/sparc/mips/s390x/openrisc/riscv targets Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 01/18] translator: merge max_insns into DisasContextBase Emilio G. Cota
2018-05-09 10:04 ` Michael Clark
2018-04-20 18:55 ` [Qemu-devel] [PATCH 02/18] target/sh4: convert to TranslatorOps Emilio G. Cota
2018-04-20 18:55 ` Emilio G. Cota [this message]
2018-04-20 18:55 ` [Qemu-devel] [PATCH 04/18] target/sparc: convert to DisasContextBase Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 05/18] target/sparc: convert to TranslatorOps Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 06/18] target/mips: use lookup_and_goto_ptr on BS_STOP Emilio G. Cota
2018-04-22 19:37 ` Richard Henderson
2018-04-20 18:55 ` [Qemu-devel] [PATCH 07/18] target/mips: convert to DisasJumpType Emilio G. Cota
2018-04-22 19:52 ` Richard Henderson
2018-04-23 16:54 ` Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 08/18] target/mips: convert to DisasContextBase Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 09/18] target/mips: use *ctx for DisasContext Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 10/18] target/mips: convert to TranslatorOps Emilio G. Cota
2018-04-22 19:54 ` Richard Henderson
2018-04-20 18:55 ` [Qemu-devel] [PATCH 11/18] target/s390x: convert to DisasJumpType Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 12/18] target/s390x: convert to DisasContextBase Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 13/18] target/s390x: convert to TranslatorOps Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 14/18] target/openrisc: convert to DisasContextBase Emilio G. Cota
2018-04-20 19:44 ` Philippe Mathieu-Daudé
2018-04-20 18:55 ` [Qemu-devel] [PATCH 15/18] target/openrisc: convert to TranslatorOps Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 16/18] target/riscv: convert to DisasJumpType Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 17/18] target/riscv: convert to DisasContextBase Emilio G. Cota
2018-04-20 18:55 ` [Qemu-devel] [PATCH 18/18] target/riscv: convert to TranslatorOps Emilio G. Cota
2018-05-09 10:11 ` Michael Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1524250517-28032-4-git-send-email-cota@braap.org \
--to=cota@braap.org \
--cc=atar4qemu@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).