[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: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v2 2/4] target/arm: Introduce store_cpu_field_constant() helper |
Date: |
Sat, 30 Oct 2021 01:07:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 |
On 10/28/21 03:17, Richard Henderson wrote:
> 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.
Now I see that in c0522136adf ("tcg: Introduce TYPE_CONST temporaries").
>> +#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.
Yep :)