qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/4] target/arm: Introduce store_cpu_field_constant() help


From: Richard Henderson
Subject: Re: [PATCH v2 2/4] target/arm: Introduce store_cpu_field_constant() helper
Date: Wed, 27 Oct 2021 18:17:43 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

On 10/26/21 9:56 PM, Philippe Mathieu-Daudé wrote:
-static inline void store_cpu_offset(TCGv_i32 var, int offset)
+static inline void store_cpu_offset(TCGv_i32 var, int offset, bool is_temp)
  {
      tcg_gen_st_i32(var, cpu_env, offset);
-    tcg_temp_free_i32(var);
+    if (is_temp) {
+        tcg_temp_free_i32(var);
+    }
  }

You don't need to change the function interface; tcg_constant_* is ignored by 
free.

+#define store_cpu_field_constant(val, name) \
+    store_cpu_offset(tcg_constant_i32(val), offsetof(CPUARMState, name), false)

But this could become simply

    tcg_gen_st_i32(tcg_constant_i32(val), cpu_env,
                   offsetof(CPUARMState, name))

without the wrapper inline.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]