target/alpha: Use tcg_constant_* elsewhere

Replace the remaining uses of tcg_const_*.  These uses are
all local, with the allocate and free close together.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-07-07 18:54:44 -07:00
parent 212c88c0c7
commit 904bd855d3

View File

@ -250,11 +250,9 @@ static void gen_excp_1(int exception, int error_code)
{ {
TCGv_i32 tmp1, tmp2; TCGv_i32 tmp1, tmp2;
tmp1 = tcg_const_i32(exception); tmp1 = tcg_constant_i32(exception);
tmp2 = tcg_const_i32(error_code); tmp2 = tcg_constant_i32(error_code);
gen_helper_excp(cpu_env, tmp1, tmp2); gen_helper_excp(cpu_env, tmp1, tmp2);
tcg_temp_free_i32(tmp2);
tcg_temp_free_i32(tmp1);
} }
static DisasJumpType gen_excp(DisasContext *ctx, int exception, int error_code) static DisasJumpType gen_excp(DisasContext *ctx, int exception, int error_code)
@ -474,15 +472,11 @@ static DisasJumpType gen_bcond_internal(DisasContext *ctx, TCGCond cond,
return DISAS_NORETURN; return DISAS_NORETURN;
} else { } else {
TCGv_i64 z = tcg_const_i64(0); TCGv_i64 z = load_zero(ctx);
TCGv_i64 d = tcg_const_i64(dest); TCGv_i64 d = tcg_constant_i64(dest);
TCGv_i64 p = tcg_const_i64(ctx->base.pc_next); TCGv_i64 p = tcg_constant_i64(ctx->base.pc_next);
tcg_gen_movcond_i64(cond, cpu_pc, cmp, z, d, p); tcg_gen_movcond_i64(cond, cpu_pc, cmp, z, d, p);
tcg_temp_free_i64(z);
tcg_temp_free_i64(d);
tcg_temp_free_i64(p);
return DISAS_PC_UPDATED; return DISAS_PC_UPDATED;
} }
} }
@ -684,22 +678,19 @@ static void gen_fp_exc_raise(int rc, int fn11)
if (!(fn11 & QUAL_I)) { if (!(fn11 & QUAL_I)) {
ignore |= FPCR_INE; ignore |= FPCR_INE;
} }
ign = tcg_const_i32(ignore); ign = tcg_constant_i32(ignore);
/* ??? Pass in the regno of the destination so that the helper can /* ??? Pass in the regno of the destination so that the helper can
set EXC_MASK, which contains a bitmask of destination registers set EXC_MASK, which contains a bitmask of destination registers
that have caused arithmetic traps. A simple userspace emulation that have caused arithmetic traps. A simple userspace emulation
does not require this. We do need it for a guest kernel's entArith, does not require this. We do need it for a guest kernel's entArith,
or if we were to do something clever with imprecise exceptions. */ or if we were to do something clever with imprecise exceptions. */
reg = tcg_const_i32(rc + 32); reg = tcg_constant_i32(rc + 32);
if (fn11 & QUAL_S) { if (fn11 & QUAL_S) {
gen_helper_fp_exc_raise_s(cpu_env, ign, reg); gen_helper_fp_exc_raise_s(cpu_env, ign, reg);
} else { } else {
gen_helper_fp_exc_raise(cpu_env, ign, reg); gen_helper_fp_exc_raise(cpu_env, ign, reg);
} }
tcg_temp_free_i32(reg);
tcg_temp_free_i32(ign);
} }
static void gen_cvtlq(TCGv vc, TCGv vb) static void gen_cvtlq(TCGv vc, TCGv vb)
@ -792,7 +783,7 @@ IEEE_INTCVT(cvtqt)
static void gen_cpy_mask(TCGv vc, TCGv va, TCGv vb, bool inv_a, uint64_t mask) static void gen_cpy_mask(TCGv vc, TCGv va, TCGv vb, bool inv_a, uint64_t mask)
{ {
TCGv vmask = tcg_const_i64(mask); TCGv vmask = tcg_constant_i64(mask);
TCGv tmp = tcg_temp_new_i64(); TCGv tmp = tcg_temp_new_i64();
if (inv_a) { if (inv_a) {
@ -804,7 +795,6 @@ static void gen_cpy_mask(TCGv vc, TCGv va, TCGv vb, bool inv_a, uint64_t mask)
tcg_gen_andc_i64(vc, vb, vmask); tcg_gen_andc_i64(vc, vb, vmask);
tcg_gen_or_i64(vc, vc, tmp); tcg_gen_or_i64(vc, vc, tmp);
tcg_temp_free(vmask);
tcg_temp_free(tmp); tcg_temp_free(tmp);
} }
@ -1178,12 +1168,9 @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode)
case 0x3E: case 0x3E:
/* WTINT */ /* WTINT */
{ tcg_gen_st_i32(tcg_constant_i32(1), cpu_env,
TCGv_i32 tmp = tcg_const_i32(1); -offsetof(AlphaCPU, env) +
tcg_gen_st_i32(tmp, cpu_env, -offsetof(AlphaCPU, env) + offsetof(CPUState, halted));
offsetof(CPUState, halted));
tcg_temp_free_i32(tmp);
}
tcg_gen_movi_i64(ctx->ir[IR_V0], 0); tcg_gen_movi_i64(ctx->ir[IR_V0], 0);
return gen_excp(ctx, EXCP_HALTED, 0); return gen_excp(ctx, EXCP_HALTED, 0);
@ -1334,12 +1321,8 @@ static DisasJumpType gen_mtpr(DisasContext *ctx, TCGv vb, int regno)
case 253: case 253:
/* WAIT */ /* WAIT */
{ tcg_gen_st_i32(tcg_constant_i32(1), cpu_env,
TCGv_i32 tmp = tcg_const_i32(1); -offsetof(AlphaCPU, env) + offsetof(CPUState, halted));
tcg_gen_st_i32(tmp, cpu_env, -offsetof(AlphaCPU, env) +
offsetof(CPUState, halted));
tcg_temp_free_i32(tmp);
}
return gen_excp(ctx, EXCP_HALTED, 0); return gen_excp(ctx, EXCP_HALTED, 0);
case 252: case 252:
@ -2712,9 +2695,8 @@ static DisasJumpType translate_one(DisasContext *ctx, uint32_t insn)
vb = load_gpr(ctx, rb); vb = load_gpr(ctx, rb);
} }
tcg_gen_movi_i64(cpu_lock_addr, -1); tcg_gen_movi_i64(cpu_lock_addr, -1);
st_flag_byte(load_zero(ctx), ENV_FLAG_RX_SHIFT);
tmp = tcg_temp_new(); tmp = tcg_temp_new();
tcg_gen_movi_i64(tmp, 0);
st_flag_byte(tmp, ENV_FLAG_RX_SHIFT);
tcg_gen_andi_i64(tmp, vb, 1); tcg_gen_andi_i64(tmp, vb, 1);
st_flag_byte(tmp, ENV_FLAG_PAL_SHIFT); st_flag_byte(tmp, ENV_FLAG_PAL_SHIFT);
tcg_temp_free(tmp); tcg_temp_free(tmp);