[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 42/68] target/nios2: Use tcg_constant_tl
From: |
Richard Henderson |
Subject: |
[PULL 42/68] target/nios2: Use tcg_constant_tl |
Date: |
Tue, 26 Apr 2022 11:18:41 -0700 |
Replace current uses of tcg_const_tl, and remove the frees.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220421151735.31996-43-richard.henderson@linaro.org>
---
target/nios2/translate.c | 30 ++++++------------------------
1 file changed, 6 insertions(+), 24 deletions(-)
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index b27269bf08..f33015f942 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -99,7 +99,6 @@
typedef struct DisasContext {
DisasContextBase base;
- TCGv_i32 zero;
target_ulong pc;
int mem_idx;
const ControlRegState *cr_state;
@@ -125,31 +124,20 @@ static uint8_t get_opxcode(uint32_t code)
return instr.opx;
}
-static TCGv load_zero(DisasContext *dc)
+static TCGv load_gpr(DisasContext *dc, unsigned reg)
{
- if (!dc->zero) {
- dc->zero = tcg_const_i32(0);
- }
- return dc->zero;
-}
-
-static TCGv load_gpr(DisasContext *dc, uint8_t reg)
-{
- if (likely(reg != R_ZERO)) {
- return cpu_R[reg];
- } else {
- return load_zero(dc);
+ assert(reg < NUM_GP_REGS);
+ if (unlikely(reg == R_ZERO)) {
+ return tcg_constant_tl(0);
}
+ return cpu_R[reg];
}
static void t_gen_helper_raise_exception(DisasContext *dc,
uint32_t index)
{
- TCGv_i32 tmp = tcg_const_i32(index);
-
tcg_gen_movi_tl(cpu_pc, dc->pc);
- gen_helper_raise_exception(cpu_env, tmp);
- tcg_temp_free_i32(tmp);
+ gen_helper_raise_exception(cpu_env, tcg_constant_i32(index));
dc->base.is_jmp = DISAS_NORETURN;
}
@@ -876,14 +864,8 @@ static void nios2_tr_translate_insn(DisasContextBase
*dcbase, CPUState *cs)
return;
}
- dc->zero = NULL;
-
instr = &i_type_instructions[op];
instr->handler(dc, code, instr->flags);
-
- if (dc->zero) {
- tcg_temp_free(dc->zero);
- }
}
static void nios2_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
--
2.34.1
- [PULL 36/68] target/nios2: Clean up handling of tlbmisc in do_exception, (continued)
- [PULL 36/68] target/nios2: Clean up handling of tlbmisc in do_exception, Richard Henderson, 2022/04/26
- [PULL 40/68] target/nios2: Remove CPU_INTERRUPT_NMI, Richard Henderson, 2022/04/26
- [PULL 43/68] target/nios2: Split out named structs for [IRJ]_TYPE, Richard Henderson, 2022/04/26
- [PULL 46/68] target/nios2: Split out helpers for gen_r_math_logic, Richard Henderson, 2022/04/26
- [PULL 44/68] target/nios2: Split out helpers for gen_i_cmpxx, Richard Henderson, 2022/04/26
- [PULL 49/68] target/nios2: Introduce dest_gpr, Richard Henderson, 2022/04/26
- [PULL 51/68] target/nios2: Enable unaligned traps for system mode, Richard Henderson, 2022/04/26
- [PULL 56/68] target/nios2: Implement Misaligned destination exception, Richard Henderson, 2022/04/26
- [PULL 53/68] target/nios2: Hoist set of is_jmp into gen_goto_tb, Richard Henderson, 2022/04/26
- [PULL 41/68] target/nios2: Support division error exception, Richard Henderson, 2022/04/26
- [PULL 42/68] target/nios2: Use tcg_constant_tl,
Richard Henderson <=
- [PULL 54/68] target/nios2: Use gen_goto_tb for DISAS_TOO_MANY, Richard Henderson, 2022/04/26
- [PULL 64/68] hw/nios2: Introduce Nios2MachineState, Richard Henderson, 2022/04/26
- [PULL 45/68] target/nios2: Split out helpers for gen_i_math_logic, Richard Henderson, 2022/04/26
- [PULL 50/68] target/nios2: Drop CR_STATUS_EH from tb->flags, Richard Henderson, 2022/04/26
- [PULL 52/68] target/nios2: Create gen_jumpr, Richard Henderson, 2022/04/26
- [PULL 57/68] target/nios2: Introduce shadow register sets, Richard Henderson, 2022/04/26
- [PULL 55/68] target/nios2: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2022/04/26
- [PULL 59/68] target/nios2: Update helper_eret for shadow registers, Richard Henderson, 2022/04/26
- [PULL 60/68] target/nios2: Implement EIC interrupt processing, Richard Henderson, 2022/04/26
- [PULL 61/68] target/nios2: Advance pc when raising exceptions, Richard Henderson, 2022/04/26