From 0a7df5da986bd7ee0789f2d7b8611f2e8eee5046 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 30 Mar 2014 14:50:30 -0700 Subject: tcg: Move emit of INDEX_op_end into gen_tb_end Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- include/exec/gen-icount.h | 2 ++ target-alpha/translate.c | 2 +- target-arm/translate-a64.c | 1 - target-arm/translate.c | 1 - target-cris/translate.c | 2 +- target-i386/translate.c | 2 +- target-lm32/translate.c | 2 +- target-m68k/translate.c | 1 - target-microblaze/translate.c | 2 +- target-mips/translate.c | 2 +- target-moxie/translate.c | 2 +- target-openrisc/translate.c | 2 +- target-ppc/translate.c | 2 +- target-s390x/translate.c | 2 +- target-sh4/translate.c | 2 +- target-sparc/translate.c | 2 +- target-tricore/translate.c | 1 - target-unicore32/translate.c | 1 - target-xtensa/translate.c | 1 - 19 files changed, 14 insertions(+), 18 deletions(-) diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index 221aad0bfd..a37a61d038 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -48,6 +48,8 @@ static void gen_tb_end(TranslationBlock *tb, int num_insns) gen_set_label(icount_label); tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_ICOUNT_EXPIRED); } + + *tcg_ctx.gen_opc_ptr = INDEX_op_end; } static inline void gen_io_start(void) diff --git a/target-alpha/translate.c b/target-alpha/translate.c index f8883672a8..aa04c603af 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -2912,7 +2912,7 @@ static inline void gen_intermediate_code_internal(AlphaCPU *cpu, } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c index acf4b162bd..3605eb4d77 100644 --- a/target-arm/translate-a64.c +++ b/target-arm/translate-a64.c @@ -11108,7 +11108,6 @@ void gen_intermediate_code_internal_a64(ARMCPU *cpu, done_generating: gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { diff --git a/target-arm/translate.c b/target-arm/translate.c index 1c36b8b05e..d8ecfc1621 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -11357,7 +11357,6 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu, done_generating: gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { diff --git a/target-cris/translate.c b/target-cris/translate.c index b675ed0b18..b5a792cd01 100644 --- a/target-cris/translate.c +++ b/target-cris/translate.c @@ -3344,7 +3344,7 @@ gen_intermediate_code_internal(CRISCPU *cpu, TranslationBlock *tb, } } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-i386/translate.c b/target-i386/translate.c index 9ebdf4b384..e2e21e471c 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -8077,7 +8077,7 @@ static inline void gen_intermediate_code_internal(X86CPU *cpu, gen_io_end(); done_generating: gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + /* we don't forget to fill the last values */ if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; diff --git a/target-lm32/translate.c b/target-lm32/translate.c index a7579dc8be..cd09293a1c 100644 --- a/target-lm32/translate.c +++ b/target-lm32/translate.c @@ -1158,7 +1158,7 @@ void gen_intermediate_code_internal(LM32CPU *cpu, } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 47edc7ae51..7e98a175f7 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -3075,7 +3075,6 @@ gen_intermediate_code_internal(M68kCPU *cpu, TranslationBlock *tb, } } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c index 69ce4df4a3..437a069c24 100644 --- a/target-microblaze/translate.c +++ b/target-microblaze/translate.c @@ -1846,7 +1846,7 @@ gen_intermediate_code_internal(MicroBlazeCPU *cpu, TranslationBlock *tb, } } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-mips/translate.c b/target-mips/translate.c index 1faeb5d740..f7ada9f8e3 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -19244,7 +19244,7 @@ gen_intermediate_code_internal(MIPSCPU *cpu, TranslationBlock *tb, } done_generating: gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-moxie/translate.c b/target-moxie/translate.c index 564f3eedaf..121ebf6783 100644 --- a/target-moxie/translate.c +++ b/target-moxie/translate.c @@ -900,7 +900,7 @@ gen_intermediate_code_internal(MoxieCPU *cpu, TranslationBlock *tb, } done_generating: gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c index b90181dc70..91505127fe 100644 --- a/target-openrisc/translate.c +++ b/target-openrisc/translate.c @@ -1759,7 +1759,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu, } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; k++; diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 7c801f36e3..955dfb35e2 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -11598,7 +11598,7 @@ static inline void gen_intermediate_code_internal(PowerPCCPU *cpu, tcg_gen_exit_tb(0); } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (unlikely(search_pc)) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 8b36eca718..47414aaa2d 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -4938,7 +4938,7 @@ static inline void gen_intermediate_code_internal(S390CPU *cpu, } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-sh4/translate.c b/target-sh4/translate.c index 7010740b21..82ec6fd2d3 100644 --- a/target-sh4/translate.c +++ b/target-sh4/translate.c @@ -1962,7 +1962,7 @@ gen_intermediate_code_internal(SuperHCPU *cpu, TranslationBlock *tb, } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (search_pc) { i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; ii++; diff --git a/target-sparc/translate.c b/target-sparc/translate.c index 68527d595f..00015be117 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -5320,7 +5320,7 @@ static inline void gen_intermediate_code_internal(SPARCCPU *cpu, } } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; + if (spc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; diff --git a/target-tricore/translate.c b/target-tricore/translate.c index a73b7000b4..4fb13dd704 100644 --- a/target-tricore/translate.c +++ b/target-tricore/translate.c @@ -5538,7 +5538,6 @@ gen_intermediate_code_internal(TriCoreCPU *cpu, struct TranslationBlock *tb, } gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { printf("done_generating search pc\n"); } else { diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c index ab7e96f937..2397a25646 100644 --- a/target-unicore32/translate.c +++ b/target-unicore32/translate.c @@ -2037,7 +2037,6 @@ static inline void gen_intermediate_code_internal(UniCore32CPU *cpu, done_generating: gen_tb_end(tb, num_insns); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c index 9e137fe5ec..2024ba90be 100644 --- a/target-xtensa/translate.c +++ b/target-xtensa/translate.c @@ -3133,7 +3133,6 @@ void gen_intermediate_code_internal(XtensaCPU *cpu, gen_jumpi(&dc, dc.pc, 0); } gen_tb_end(tb, insn_count); - *tcg_ctx.gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { -- cgit v1.2.3