diff mbox series

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

Message ID 20220421213917.368830-3-jcmvbkbc@gmail.com (mailing list archive)
State New, archived
Headers show
Series target/xtensa: use tcg_constant_* where possible | expand

Commit Message

Max Filippov April 21, 2022, 9:39 p.m. UTC
Exception number, exception cause and debug cause codes are small
numbers, use tcg_contant_* for them.

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

Comments

Richard Henderson April 21, 2022, 9:54 p.m. UTC | #1
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<jcmvbkbc@gmail.com>
> ---
>   target/xtensa/translate.c | 12 +++---------
>   1 file changed, 3 insertions(+), 9 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

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;
     }