[PATCH 1/2] tcg: Return TCGOp from tcg_gen_op[1-6]

Richard Henderson posted 2 patches 2 months, 2 weeks ago
[PATCH 1/2] tcg: Return TCGOp from tcg_gen_op[1-6]
Posted by Richard Henderson 2 months, 2 weeks ago
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tcg/tcg-internal.h | 12 ++++++------
 tcg/tcg-op.c       | 23 +++++++++++++++--------
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h
index 52103f4164..8099248076 100644
--- a/tcg/tcg-internal.h
+++ b/tcg/tcg-internal.h
@@ -92,12 +92,12 @@ TCGTemp *tcg_temp_new_internal(TCGType type, TCGTempKind kind);
  */
 TCGTemp *tcg_constant_internal(TCGType type, int64_t val);
 
-void tcg_gen_op1(TCGOpcode, TCGArg);
-void tcg_gen_op2(TCGOpcode, TCGArg, TCGArg);
-void tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg);
-void tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg);
-void tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
-void tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
+TCGOp *tcg_gen_op1(TCGOpcode, TCGArg);
+TCGOp *tcg_gen_op2(TCGOpcode, TCGArg, TCGArg);
+TCGOp *tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg);
+TCGOp *tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg);
+TCGOp *tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
+TCGOp *tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
 
 void vec_gen_2(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg);
 void vec_gen_3(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg);
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index eff3728622..28c41b37a4 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -37,38 +37,43 @@
  */
 #define NI  __attribute__((noinline))
 
-void NI tcg_gen_op1(TCGOpcode opc, TCGArg a1)
+TCGOp * NI tcg_gen_op1(TCGOpcode opc, TCGArg a1)
 {
     TCGOp *op = tcg_emit_op(opc, 1);
     op->args[0] = a1;
+    return op;
 }
 
-void NI tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2)
+TCGOp * NI tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2)
 {
     TCGOp *op = tcg_emit_op(opc, 2);
     op->args[0] = a1;
     op->args[1] = a2;
+    return op;
 }
 
-void NI tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3)
+TCGOp * NI tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3)
 {
     TCGOp *op = tcg_emit_op(opc, 3);
     op->args[0] = a1;
     op->args[1] = a2;
     op->args[2] = a3;
+    return op;
 }
 
-void NI tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4)
+TCGOp * NI tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2,
+                       TCGArg a3, TCGArg a4)
 {
     TCGOp *op = tcg_emit_op(opc, 4);
     op->args[0] = a1;
     op->args[1] = a2;
     op->args[2] = a3;
     op->args[3] = a4;
+    return op;
 }
 
-void NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
-                     TCGArg a4, TCGArg a5)
+TCGOp * NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2,
+                       TCGArg a3, TCGArg a4, TCGArg a5)
 {
     TCGOp *op = tcg_emit_op(opc, 5);
     op->args[0] = a1;
@@ -76,10 +81,11 @@ void NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
     op->args[2] = a3;
     op->args[3] = a4;
     op->args[4] = a5;
+    return op;
 }
 
-void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
-                     TCGArg a4, TCGArg a5, TCGArg a6)
+TCGOp * NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
+                       TCGArg a4, TCGArg a5, TCGArg a6)
 {
     TCGOp *op = tcg_emit_op(opc, 6);
     op->args[0] = a1;
@@ -88,6 +94,7 @@ void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
     op->args[3] = a4;
     op->args[4] = a5;
     op->args[5] = a6;
+    return op;
 }
 
 /*
-- 
2.43.0
Re: [PATCH 1/2] tcg: Return TCGOp from tcg_gen_op[1-6]
Posted by Philippe Mathieu-Daudé 2 months, 1 week ago
Maybe a line like "See the justification in the next commit"?

On 10/9/24 23:23, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   tcg/tcg-internal.h | 12 ++++++------
>   tcg/tcg-op.c       | 23 +++++++++++++++--------
>   2 files changed, 21 insertions(+), 14 deletions(-)
Re: [PATCH 1/2] tcg: Return TCGOp from tcg_gen_op[1-6]
Posted by Alex Bennée 2 months, 1 week ago
Richard Henderson <richard.henderson@linaro.org> writes:

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

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH 1/2] tcg: Return TCGOp from tcg_gen_op[1-6]
Posted by Pierrick Bouvier 2 months, 2 weeks ago
On 9/10/24 14:23, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   tcg/tcg-internal.h | 12 ++++++------
>   tcg/tcg-op.c       | 23 +++++++++++++++--------
>   2 files changed, 21 insertions(+), 14 deletions(-)
> 
> diff --git a/tcg/tcg-internal.h b/tcg/tcg-internal.h
> index 52103f4164..8099248076 100644
> --- a/tcg/tcg-internal.h
> +++ b/tcg/tcg-internal.h
> @@ -92,12 +92,12 @@ TCGTemp *tcg_temp_new_internal(TCGType type, TCGTempKind kind);
>    */
>   TCGTemp *tcg_constant_internal(TCGType type, int64_t val);
>   
> -void tcg_gen_op1(TCGOpcode, TCGArg);
> -void tcg_gen_op2(TCGOpcode, TCGArg, TCGArg);
> -void tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg);
> -void tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg);
> -void tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
> -void tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
> +TCGOp *tcg_gen_op1(TCGOpcode, TCGArg);
> +TCGOp *tcg_gen_op2(TCGOpcode, TCGArg, TCGArg);
> +TCGOp *tcg_gen_op3(TCGOpcode, TCGArg, TCGArg, TCGArg);
> +TCGOp *tcg_gen_op4(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg);
> +TCGOp *tcg_gen_op5(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
> +TCGOp *tcg_gen_op6(TCGOpcode, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg, TCGArg);
>   
>   void vec_gen_2(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg);
>   void vec_gen_3(TCGOpcode, TCGType, unsigned, TCGArg, TCGArg, TCGArg);
> diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
> index eff3728622..28c41b37a4 100644
> --- a/tcg/tcg-op.c
> +++ b/tcg/tcg-op.c
> @@ -37,38 +37,43 @@
>    */
>   #define NI  __attribute__((noinline))
>   
> -void NI tcg_gen_op1(TCGOpcode opc, TCGArg a1)
> +TCGOp * NI tcg_gen_op1(TCGOpcode opc, TCGArg a1)
>   {
>       TCGOp *op = tcg_emit_op(opc, 1);
>       op->args[0] = a1;
> +    return op;
>   }
>   
> -void NI tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2)
> +TCGOp * NI tcg_gen_op2(TCGOpcode opc, TCGArg a1, TCGArg a2)
>   {
>       TCGOp *op = tcg_emit_op(opc, 2);
>       op->args[0] = a1;
>       op->args[1] = a2;
> +    return op;
>   }
>   
> -void NI tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3)
> +TCGOp * NI tcg_gen_op3(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3)
>   {
>       TCGOp *op = tcg_emit_op(opc, 3);
>       op->args[0] = a1;
>       op->args[1] = a2;
>       op->args[2] = a3;
> +    return op;
>   }
>   
> -void NI tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, TCGArg a4)
> +TCGOp * NI tcg_gen_op4(TCGOpcode opc, TCGArg a1, TCGArg a2,
> +                       TCGArg a3, TCGArg a4)
>   {
>       TCGOp *op = tcg_emit_op(opc, 4);
>       op->args[0] = a1;
>       op->args[1] = a2;
>       op->args[2] = a3;
>       op->args[3] = a4;
> +    return op;
>   }
>   
> -void NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
> -                     TCGArg a4, TCGArg a5)
> +TCGOp * NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2,
> +                       TCGArg a3, TCGArg a4, TCGArg a5)
>   {
>       TCGOp *op = tcg_emit_op(opc, 5);
>       op->args[0] = a1;
> @@ -76,10 +81,11 @@ void NI tcg_gen_op5(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
>       op->args[2] = a3;
>       op->args[3] = a4;
>       op->args[4] = a5;
> +    return op;
>   }
>   
> -void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
> -                     TCGArg a4, TCGArg a5, TCGArg a6)
> +TCGOp * NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
> +                       TCGArg a4, TCGArg a5, TCGArg a6)
>   {
>       TCGOp *op = tcg_emit_op(opc, 6);
>       op->args[0] = a1;
> @@ -88,6 +94,7 @@ void NI tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3,
>       op->args[3] = a4;
>       op->args[4] = a5;
>       op->args[5] = a6;
> +    return op;
>   }
>   
>   /*

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>