qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Cc: Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [4544] added tcg_temp_free() and improved the handling of constants
Date: Fri, 23 May 2008 20:27:37 +0200	[thread overview]
Message-ID: <48370C99.70708@bellard.org> (raw)
In-Reply-To: <200805231903.35923.paul@codesourcery.com>

I will update the TCG documentation soon to explain it and other 
modifications I am about to do.

In short, tcg_const() is now exactly equivalent to a temporary, hence it 
should be freed. Freeing temporaries is useful to reduce translation 
time and memory usage. However it has little consequences on the quality 
of the generated code.

Fabrice.

Paul Brook wrote:
>> added tcg_temp_free() and improved the handling of constants
> 
> Should the return value of tcg_const_i32 et. al. be considered immutable, or 
> is it ok to use it as a temporary?
> 
> e.g.:
> 
> static TCGv do_frob(TCGv base, int addend)
> {
>   TCGv tmp = tcg_const_i32(addend);
>   tcg_gen_helper_frob(tmp, tmp, base)
>   return tmp;
> }
> 
> or should this be written as:
> 
> static TCGv do_frob(TCGv base, int addend)
> {
>   TCGv tmp = tcg_temp_new(TCG_TYPE_I32);
>   tcg_gen_movi_i32(tmp, addend);
>   tcg_gen_helper_frob(tmp, tmp, base)
>   return tmp;
> }
> 
> Currently it's fairly hard to enforce this restriction automatically, but we 
> need to decide whether it's a feature or a bug.
> 
> Paul
> 

  reply	other threads:[~2008-05-23 18:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-23 17:33 [Qemu-devel] [4544] added tcg_temp_free() and improved the handling of constants Fabrice Bellard
2008-05-23 18:03 ` Paul Brook
2008-05-23 18:27   ` Fabrice Bellard [this message]
2008-05-30 18:59 ` Blue Swirl

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=48370C99.70708@bellard.org \
    --to=fabrice@bellard.org \
    --cc=paul@codesourcery.com \
    --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).