qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-arm@nongnu.org
Subject: Re: [PATCH v2 2/4] target/arm: Introduce store_cpu_field_constant() helper
Date: Wed, 27 Oct 2021 18:17:43 -0700	[thread overview]
Message-ID: <267b4bdc-8311-cc18-afeb-5e98aea5a3ea@linaro.org> (raw)
In-Reply-To: <20211027045607.1261526-3-f4bug@amsat.org>

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	other threads:[~2021-10-28  1:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27  4:56 [PATCH v2 0/4] target/arm: Use tcg_constant_* Philippe Mathieu-Daudé
2021-10-27  4:56 ` [PATCH v2 1/4] target/arm: Use tcg_constant_i32() in op_smlad() Philippe Mathieu-Daudé
2021-10-27  4:56 ` [PATCH v2 2/4] target/arm: Introduce store_cpu_field_constant() helper Philippe Mathieu-Daudé
2021-10-28  1:17   ` Richard Henderson [this message]
2021-10-29 23:07     ` Philippe Mathieu-Daudé
2021-10-27  4:56 ` [PATCH v2 3/4] target/arm: Use the constant variant of store_cpu_field() when possible Philippe Mathieu-Daudé
2021-10-27  4:56 ` [PATCH v2 4/4] target/arm: Use tcg_constant_i64() in do_sat_addsub_64() Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=267b4bdc-8311-cc18-afeb-5e98aea5a3ea@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).