aboutsummaryrefslogtreecommitdiff
path: root/target/nios2
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-04-15 20:54:54 -1000
committerRichard Henderson <richard.henderson@linaro.org>2019-04-24 13:04:33 -0700
commit8b86d6d25807e13a63ab6ea879f976b9f18cc45a (patch)
treef29fd7599e756b459c2fca9af822a6c151fe4ea5 /target/nios2
parent464c2969d5d7a0a5d38d2aa5d930986df876d3fb (diff)
downloadqemu-8b86d6d25807e13a63ab6ea879f976b9f18cc45a.zip
qemu-8b86d6d25807e13a63ab6ea879f976b9f18cc45a.tar.gz
qemu-8b86d6d25807e13a63ab6ea879f976b9f18cc45a.tar.bz2
tcg: Hoist max_insns computation to tb_gen_code
In order to handle TB's that translate to too much code, we need to place the control of the length of the translation in the hands of the code gen master loop. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/nios2')
-rw-r--r--target/nios2/translate.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index f0bbf78..17d8f18 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -806,12 +806,11 @@ static void gen_exception(DisasContext *dc, uint32_t excp)
}
/* generate intermediate code for basic block 'tb'. */
-void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
+void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns)
{
CPUNios2State *env = cs->env_ptr;
DisasContext dc1, *dc = &dc1;
int num_insns;
- int max_insns;
/* Initialize DC */
dc->cpu_env = cpu_env;
@@ -824,20 +823,11 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
/* Set up instruction counts */
num_insns = 0;
- if (cs->singlestep_enabled || singlestep) {
- max_insns = 1;
- } else {
+ if (max_insns > 1) {
int page_insns = (TARGET_PAGE_SIZE - (tb->pc & TARGET_PAGE_MASK)) / 4;
- max_insns = tb_cflags(tb) & CF_COUNT_MASK;
- if (max_insns == 0) {
- max_insns = CF_COUNT_MASK;
- }
if (max_insns > page_insns) {
max_insns = page_insns;
}
- if (max_insns > TCG_MAX_INSNS) {
- max_insns = TCG_MAX_INSNS;
- }
}
gen_tb_start(tb);