Message ID | 20230227052505.352889-67-richard.henderson@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | tcg: Drop tcg_temp_free from translators | expand |
On Mon, 27 Feb 2023 at 05:43, Richard Henderson <richard.henderson@linaro.org> wrote: > > Translators are no longer required to free tcg temporaries, > therefore there's no need to record temps for later freeing. > Replace the few uses with tcg_temp_new_i32. > > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > target/sparc/translate.c | 25 ++++--------------------- > 1 file changed, 4 insertions(+), 21 deletions(-) Left my review comment on the v1 version of this patch by mistake, so just copying it here: > @@ -5762,14 +5752,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) > gen_exception(dc, TT_NCP_INSN); > goto egress; > #endif > - egress: > - if (dc->n_t32 != 0) { > - int i; > - for (i = dc->n_t32 - 1; i >= 0; --i) { > - tcg_temp_free_i32(dc->t32[i]); > - } > - dc->n_t32 = 0; > - } > + egress:; > } Stray semicolon after colon, or does C not let you put a label at the end of a function ? Otherwise Reviewed-by: Peter Maydell <peter.maydell@linaro.org> thanks -- PMM
On 3/3/23 11:09, Peter Maydell wrote: > On Mon, 27 Feb 2023 at 05:43, Richard Henderson > <richard.henderson@linaro.org> wrote: >> >> Translators are no longer required to free tcg temporaries, >> therefore there's no need to record temps for later freeing. >> Replace the few uses with tcg_temp_new_i32. >> >> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> >> --- >> target/sparc/translate.c | 25 ++++--------------------- >> 1 file changed, 4 insertions(+), 21 deletions(-) > > Left my review comment on the v1 version of this patch by mistake, > so just copying it here: > >> @@ -5762,14 +5752,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) >> gen_exception(dc, TT_NCP_INSN); >> goto egress; >> #endif >> - egress: >> - if (dc->n_t32 != 0) { >> - int i; >> - for (i = dc->n_t32 - 1; i >= 0; --i) { >> - tcg_temp_free_i32(dc->t32[i]); >> - } >> - dc->n_t32 = 0; >> - } >> + egress:; >> } > > Stray semicolon after colon, or does C not let you put a label at > the end of a function ? Mistaken memory that a label neededs a statement, but that's to do with declarations not following labels. I could change it, though it gets removed in the next patch. r~
diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 2b4af692f6..bdf464f802 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -84,8 +84,6 @@ typedef struct DisasContext { uint32_t cc_op; /* current CC operation */ sparc_def_t *def; - TCGv_i32 t32[3]; - int n_t32; #ifdef TARGET_SPARC64 int fprs_dirty; int asi; @@ -129,14 +127,6 @@ static int sign_extend(int x, int len) #define IS_IMM (insn & (1<<13)) -static inline TCGv_i32 get_temp_i32(DisasContext *dc) -{ - TCGv_i32 t; - assert(dc->n_t32 < ARRAY_SIZE(dc->t32)); - dc->t32[dc->n_t32++] = t = tcg_temp_new_i32(); - return t; -} - static inline void gen_update_fprs_dirty(DisasContext *dc, int rd) { #if defined(TARGET_SPARC64) @@ -153,7 +143,7 @@ static inline void gen_update_fprs_dirty(DisasContext *dc, int rd) /* floating point registers moves */ static TCGv_i32 gen_load_fpr_F(DisasContext *dc, unsigned int src) { - TCGv_i32 ret = get_temp_i32(dc); + TCGv_i32 ret = tcg_temp_new_i32(); if (src & 1) { tcg_gen_extrl_i64_i32(ret, cpu_fpr[src / 2]); } else { @@ -175,7 +165,7 @@ static void gen_store_fpr_F(DisasContext *dc, unsigned int dst, TCGv_i32 v) static TCGv_i32 gen_dest_fpr_F(DisasContext *dc) { - return get_temp_i32(dc); + return tcg_temp_new_i32(); } static TCGv_i64 gen_load_fpr_D(DisasContext *dc, unsigned int src) @@ -5516,7 +5506,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) break; } #endif - cpu_dst_32 = get_temp_i32(dc); + cpu_dst_32 = tcg_temp_new_i32(); tcg_gen_qemu_ld_i32(cpu_dst_32, cpu_addr, dc->mem_idx, MO_TEUL); gen_helper_ldfsr(cpu_fsr, cpu_env, cpu_fsr, cpu_dst_32); @@ -5762,14 +5752,7 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) gen_exception(dc, TT_NCP_INSN); goto egress; #endif - egress: - if (dc->n_t32 != 0) { - int i; - for (i = dc->n_t32 - 1; i >= 0; --i) { - tcg_temp_free_i32(dc->t32[i]); - } - dc->n_t32 = 0; - } + egress:; } static void sparc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)
Translators are no longer required to free tcg temporaries, therefore there's no need to record temps for later freeing. Replace the few uses with tcg_temp_new_i32. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- target/sparc/translate.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-)