diff mbox series

[PATCH-for-10.1,12/12] tcg: Uninline tcg_gen_insn_start()

Message ID 20250319134507.45045-13-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:45 p.m. UTC
tcg_gen_insn_start() is now common to all TCG frontends.
We don't need to keep it inlined, move it to tcg.c.

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

Comments

Alex Bennée March 19, 2025, 4:45 p.m. UTC | #1
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> tcg_gen_insn_start() is now common to all TCG frontends.
> We don't need to keep it inlined, move it to tcg.c.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  include/tcg/tcg-op.h | 15 ---------------
>  include/tcg/tcg.h    |  2 ++
>  tcg/tcg.c            | 15 +++++++++++++++
>  3 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h
> index cf177a1fd3b..470cb46225e 100644
> --- a/include/tcg/tcg-op.h
> +++ b/include/tcg/tcg-op.h
> @@ -22,21 +22,6 @@
>  # error
>  #endif
>  
> -static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2)
> -{
> -    unsigned insn_start_words = tcg_ctx->insn_start_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);
> -    if (insn_start_words > 1) {
> -        tcg_set_insn_start_param(op, 1, a1);
> -    }
> -    if (insn_start_words > 2) {
> -        tcg_set_insn_start_param(op, 2, a2);
> -    }
> -}
> -
>  #if TARGET_LONG_BITS == 32
>  typedef TCGv_i32 TCGv;
>  #define tcg_temp_new() tcg_temp_new_i32()
> diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
> index 92a23e10218..d87d900bf81 100644
> --- a/include/tcg/tcg.h
> +++ b/include/tcg/tcg.h
> @@ -609,6 +609,8 @@ static inline void tcg_set_insn_start_param(TCGOp *op, int arg, uint64_t v)
>      }
>  }
>  
> +void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2);
> +

Is would be nice to docstring the function to explain what it does and
note where the additional data is interpreted
(cpu_restore_state_from_tb?).

Otherwise:

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

Patch

diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h
index cf177a1fd3b..470cb46225e 100644
--- a/include/tcg/tcg-op.h
+++ b/include/tcg/tcg-op.h
@@ -22,21 +22,6 @@ 
 # error
 #endif
 
-static inline void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2)
-{
-    unsigned insn_start_words = tcg_ctx->insn_start_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);
-    if (insn_start_words > 1) {
-        tcg_set_insn_start_param(op, 1, a1);
-    }
-    if (insn_start_words > 2) {
-        tcg_set_insn_start_param(op, 2, a2);
-    }
-}
-
 #if TARGET_LONG_BITS == 32
 typedef TCGv_i32 TCGv;
 #define tcg_temp_new() tcg_temp_new_i32()
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index 92a23e10218..d87d900bf81 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -609,6 +609,8 @@  static inline void tcg_set_insn_start_param(TCGOp *op, int arg, uint64_t v)
     }
 }
 
+void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2);
+
 /* The last op that was emitted.  */
 static inline TCGOp *tcg_last_op(void)
 {
diff --git a/tcg/tcg.c b/tcg/tcg.c
index e8950df2ad3..904f858e4dc 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3468,6 +3468,21 @@  TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *old_op,
     return new_op;
 }
 
+void tcg_gen_insn_start(uint64_t pc, uint64_t a1, uint64_t a2)
+{
+    unsigned insn_start_words = tcg_ctx->insn_start_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);
+    if (insn_start_words > 1) {
+        tcg_set_insn_start_param(op, 1, a1);
+    }
+    if (insn_start_words > 2) {
+        tcg_set_insn_start_param(op, 2, a2);
+    }
+}
+
 static void move_label_uses(TCGLabel *to, TCGLabel *from)
 {
     TCGLabelUse *u;