diff mbox series

[13/27] accel/tcg/plugin: Tidy plugin_gen_disable_mem_helpers

Message ID 20230130205935.1157347-15-richard.henderson@linaro.org
State New
Headers show
Series tcg: Simplify temporary usage | expand

Commit Message

Richard Henderson Jan. 30, 2023, 8:59 p.m. UTC
Here we are creating a temp whose value needs to be replaced,
but always storing NULL into CPUState.plugin_mem_cbs.
Use tcg_constant_ptr(0) explicitly.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/plugin-gen.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 30, 2023, 11:39 p.m. UTC | #1
On 30/1/23 21:59, Richard Henderson wrote:
> Here we are creating a temp whose value needs to be replaced,
> but always storing NULL into CPUState.plugin_mem_cbs.
> Use tcg_constant_ptr(0) explicitly.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   accel/tcg/plugin-gen.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
index ea875c0990..ae2dbd7ad0 100644
--- a/accel/tcg/plugin-gen.c
+++ b/accel/tcg/plugin-gen.c
@@ -628,16 +628,13 @@  static void inject_mem_disable_helper(struct qemu_plugin_insn *plugin_insn,
 /* called before finishing a TB with exit_tb, goto_tb or goto_ptr */
 void plugin_gen_disable_mem_helpers(void)
 {
-    TCGv_ptr ptr;
-
     if (likely(tcg_ctx->plugin_insn == NULL ||
                !tcg_ctx->plugin_insn->mem_helper)) {
         return;
     }
-    ptr = tcg_const_ptr(NULL);
-    tcg_gen_st_ptr(ptr, cpu_env, offsetof(CPUState, plugin_mem_cbs) -
-                                 offsetof(ArchCPU, env));
-    tcg_temp_free_ptr(ptr);
+
+    tcg_gen_st_ptr(tcg_constant_ptr(NULL), cpu_env,
+                   offsetof(CPUState, plugin_mem_cbs) - offsetof(ArchCPU, env));
     tcg_ctx->plugin_insn->mem_helper = false;
 }