qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [4544] added tcg_temp_free() and improved the handling


From: Fabrice Bellard
Subject: Re: [Qemu-devel] [4544] added tcg_temp_free() and improved the handling of constants
Date: Fri, 23 May 2008 20:27:37 +0200
User-agent: Thunderbird 2.0.0.5 (X11/20070727)

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 via email to

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