aboutsummaryrefslogtreecommitdiff
path: root/target/loongarch/translate.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-02-24 19:05:39 -1000
committerRichard Henderson <richard.henderson@linaro.org>2023-03-05 13:44:07 -0800
commit60a7e25ea23bd05b4f780c1f2fd20cad5efde130 (patch)
treec785682a0ba2e2d31492197c9f83e2125b433b30 /target/loongarch/translate.c
parentaf1872380d8b05a8bfd8316549fa74190be0311a (diff)
target/loongarch: Drop temp_new
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. Reviewed-by: Song Gao <gaosong@loongson.cn> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'target/loongarch/translate.c')
-rw-r--r--target/loongarch/translate.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/target/loongarch/translate.c b/target/loongarch/translate.c
index 2a43ab0201..f443b5822f 100644
--- a/target/loongarch/translate.c
+++ b/target/loongarch/translate.c
@@ -85,9 +85,6 @@ static void loongarch_tr_init_disas_context(DisasContextBase *dcbase,
bound = -(ctx->base.pc_first | TARGET_PAGE_MASK) / 4;
ctx->base.max_insns = MIN(ctx->base.max_insns, bound);
- ctx->ntemp = 0;
- memset(ctx->temp, 0, sizeof(ctx->temp));
-
ctx->zero = tcg_constant_tl(0);
}
@@ -110,12 +107,6 @@ static void loongarch_tr_insn_start(DisasContextBase *dcbase, CPUState *cs)
*
* Further, we may provide an extension for word operations.
*/
-static TCGv temp_new(DisasContext *ctx)
-{
- assert(ctx->ntemp < ARRAY_SIZE(ctx->temp));
- return ctx->temp[ctx->ntemp++] = tcg_temp_new();
-}
-
static TCGv gpr_src(DisasContext *ctx, int reg_num, DisasExtend src_ext)
{
TCGv t;
@@ -128,11 +119,11 @@ static TCGv gpr_src(DisasContext *ctx, int reg_num, DisasExtend src_ext)
case EXT_NONE:
return cpu_gpr[reg_num];
case EXT_SIGN:
- t = temp_new(ctx);
+ t = tcg_temp_new();
tcg_gen_ext32s_tl(t, cpu_gpr[reg_num]);
return t;
case EXT_ZERO:
- t = temp_new(ctx);
+ t = tcg_temp_new();
tcg_gen_ext32u_tl(t, cpu_gpr[reg_num]);
return t;
}
@@ -142,7 +133,7 @@ static TCGv gpr_src(DisasContext *ctx, int reg_num, DisasExtend src_ext)
static TCGv gpr_dst(DisasContext *ctx, int reg_num, DisasExtend dst_ext)
{
if (reg_num == 0 || dst_ext) {
- return temp_new(ctx);
+ return tcg_temp_new();
}
return cpu_gpr[reg_num];
}
@@ -195,12 +186,6 @@ static void loongarch_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
generate_exception(ctx, EXCCODE_INE);
}
- for (int i = ctx->ntemp - 1; i >= 0; --i) {
- tcg_temp_free(ctx->temp[i]);
- ctx->temp[i] = NULL;
- }
- ctx->ntemp = 0;
-
ctx->base.pc_next += 4;
}