Re: [PATCH 2/6] target/xtensa: use tcg_constant_* for exceptions

2022-04-21 Thread Richard Henderson

On 4/21/22 14:39, Max Filippov wrote:

Exception number, exception cause and debug cause codes are small
numbers, use tcg_contant_* for them.

Signed-off-by: Max Filippov
---
  target/xtensa/translate.c | 12 +++-
  1 file changed, 3 insertions(+), 9 deletions(-)


Reviewed-by: Richard Henderson 


r~



[PATCH 2/6] target/xtensa: use tcg_constant_* for exceptions

2022-04-21 Thread Max Filippov
Exception number, exception cause and debug cause codes are small
numbers, use tcg_contant_* for them.

Signed-off-by: Max Filippov 
---
 target/xtensa/translate.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 3379fc1fc774..77d2e1303746 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -318,18 +318,14 @@ static void gen_left_shift_sar(DisasContext *dc, TCGv_i32 
sa)
 
 static void gen_exception(DisasContext *dc, int excp)
 {
-TCGv_i32 tmp = tcg_const_i32(excp);
-gen_helper_exception(cpu_env, tmp);
-tcg_temp_free(tmp);
+gen_helper_exception(cpu_env, tcg_constant_i32(excp));
 }
 
 static void gen_exception_cause(DisasContext *dc, uint32_t cause)
 {
 TCGv_i32 tpc = tcg_const_i32(dc->pc);
-TCGv_i32 tcause = tcg_const_i32(cause);
-gen_helper_exception_cause(cpu_env, tpc, tcause);
+gen_helper_exception_cause(cpu_env, tpc, tcg_constant_i32(cause));
 tcg_temp_free(tpc);
-tcg_temp_free(tcause);
 if (cause == ILLEGAL_INSTRUCTION_CAUSE ||
 cause == SYSCALL_CAUSE) {
 dc->base.is_jmp = DISAS_NORETURN;
@@ -339,10 +335,8 @@ static void gen_exception_cause(DisasContext *dc, uint32_t 
cause)
 static void gen_debug_exception(DisasContext *dc, uint32_t cause)
 {
 TCGv_i32 tpc = tcg_const_i32(dc->pc);
-TCGv_i32 tcause = tcg_const_i32(cause);
-gen_helper_debug_exception(cpu_env, tpc, tcause);
+gen_helper_debug_exception(cpu_env, tpc, tcg_constant_i32(cause));
 tcg_temp_free(tpc);
-tcg_temp_free(tcause);
 if (cause & (DEBUGCAUSE_IB | DEBUGCAUSE_BI | DEBUGCAUSE_BN)) {
 dc->base.is_jmp = DISAS_NORETURN;
 }
-- 
2.30.2