diff mbox series

[PATCH-for-10.1,04/12] tcg: Declare local 'insn_start_words' variable in tcg_gen_insn_start()

Message ID 20250319134507.45045-5-philmd@linaro.org
State New
Headers show
Series tcg: Make tcg_gen_insn_start() target-agnostic | expand

Commit Message

Philippe Mathieu-Daudé March 19, 2025, 1:44 p.m. UTC
In order to keep following commits simple, introduce the
'insn_start_words' local variable in tcg_gen_insn_start().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/tcg/tcg-op.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Richard Henderson March 19, 2025, 4:18 p.m. UTC | #1
On 3/19/25 06:44, Philippe Mathieu-Daudé wrote:
> In order to keep following commits simple, introduce the
> 'insn_start_words' local variable in tcg_gen_insn_start().
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/tcg/tcg-op.h | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)

I think there's no point in this, or the follow ups vs this block of code.


r~

> 
> diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h
> index 8938f386599..e0038e70a8d 100644
> --- a/include/tcg/tcg-op.h
> +++ b/include/tcg/tcg-op.h
> @@ -25,20 +25,29 @@
>   #if TARGET_INSN_START_EXTRA_WORDS == 0
>   static inline void tcg_gen_insn_start(uint64_t pc)
>   {
> -    TCGOp *op = tcg_emit_op(INDEX_op_insn_start, 64 / TCG_TARGET_REG_BITS);
> +    unsigned insn_start_words = 1;
> +    TCGOp *op = tcg_emit_op(INDEX_op_insn_start,
> +                            insn_start_words * 64 / TCG_TARGET_REG_BITS);
> +
>       tcg_set_insn_start_param(op, 0, pc);
>   }
>   #elif TARGET_INSN_START_EXTRA_WORDS == 1
>   static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1)
>   {
> -    TCGOp *op = tcg_emit_op(INDEX_op_insn_start, 2 * 64 / TCG_TARGET_REG_BITS);
> +    unsigned insn_start_words = 1 + TARGET_INSN_START_EXTRA_WORDS;
> +    TCGOp *op = tcg_emit_op(INDEX_op_insn_start,
> +                            insn_start_words * 64 / TCG_TARGET_REG_BITS);
> +
>       tcg_set_insn_start_param(op, 0, pc);
>       tcg_set_insn_start_param(op, 1, a1);
>   }
>   #elif TARGET_INSN_START_EXTRA_WORDS == 2
>   static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2)
>   {
> -    TCGOp *op = tcg_emit_op(INDEX_op_insn_start, 3 * 64 / TCG_TARGET_REG_BITS);
> +    unsigned insn_start_words = 1 + TARGET_INSN_START_EXTRA_WORDS;
> +    TCGOp *op = tcg_emit_op(INDEX_op_insn_start,
> +                            insn_start_words * 64 / TCG_TARGET_REG_BITS);
> +
>       tcg_set_insn_start_param(op, 0, pc);
>       tcg_set_insn_start_param(op, 1, a1);
>       tcg_set_insn_start_param(op, 2, a2);
diff mbox series

Patch

diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h
index 8938f386599..e0038e70a8d 100644
--- a/include/tcg/tcg-op.h
+++ b/include/tcg/tcg-op.h
@@ -25,20 +25,29 @@ 
 #if TARGET_INSN_START_EXTRA_WORDS == 0
 static inline void tcg_gen_insn_start(uint64_t pc)
 {
-    TCGOp *op = tcg_emit_op(INDEX_op_insn_start, 64 / TCG_TARGET_REG_BITS);
+    unsigned insn_start_words = 1;
+    TCGOp *op = tcg_emit_op(INDEX_op_insn_start,
+                            insn_start_words * 64 / TCG_TARGET_REG_BITS);
+
     tcg_set_insn_start_param(op, 0, pc);
 }
 #elif TARGET_INSN_START_EXTRA_WORDS == 1
 static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1)
 {
-    TCGOp *op = tcg_emit_op(INDEX_op_insn_start, 2 * 64 / TCG_TARGET_REG_BITS);
+    unsigned insn_start_words = 1 + TARGET_INSN_START_EXTRA_WORDS;
+    TCGOp *op = tcg_emit_op(INDEX_op_insn_start,
+                            insn_start_words * 64 / TCG_TARGET_REG_BITS);
+
     tcg_set_insn_start_param(op, 0, pc);
     tcg_set_insn_start_param(op, 1, a1);
 }
 #elif TARGET_INSN_START_EXTRA_WORDS == 2
 static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2)
 {
-    TCGOp *op = tcg_emit_op(INDEX_op_insn_start, 3 * 64 / TCG_TARGET_REG_BITS);
+    unsigned insn_start_words = 1 + TARGET_INSN_START_EXTRA_WORDS;
+    TCGOp *op = tcg_emit_op(INDEX_op_insn_start,
+                            insn_start_words * 64 / TCG_TARGET_REG_BITS);
+
     tcg_set_insn_start_param(op, 0, pc);
     tcg_set_insn_start_param(op, 1, a1);
     tcg_set_insn_start_param(op, 2, a2);