All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: Laurent Desnogues <laurent.desnogues@gmail.com>,
	Filip Navara <filip.navara@gmail.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH 00/18] target-arm cleanup
Date: Tue, 10 Nov 2009 23:39:26 +0000	[thread overview]
Message-ID: <200911102339.27007.paul@codesourcery.com> (raw)
In-Reply-To: <20091015174054.GZ4127@hall.aurel32.net>

> On the code itself, I don't really like the remaining, new_tmp(),
> dead_tmp(), and even more the fact that some functions can allocate
> (e.g load_reg) or free (e.g. store_reg) some TCG variables implicitely.
> This is a way to make errors by reallocating or forgetting to free some
> 
> variables, and that leads to strange code like:
> |    if (rn == 15) {
> |        tmp = new_tmp();
> |        tcg_gen_movi_i32(tmp, 0);
> |    } else {
> |        tmp = load_reg(s, rn);
> |    }

There is actually logic behind this
Consider the obvious implementation of the "neg" instruction:

val = load_reg(rn);
tcg_gen_neg_i32(val, val);
store_reg(rd, val);

With the current code this is safe. However if load_reg returns cpu_R[n] 
instead of a temporary then the above code will incorrectly clobber the source 
register.

My theory was that tracking down an accidental write to a source register is 
much harder than tracking down a mismatched temporary.

Paul

      parent reply	other threads:[~2009-11-10 23:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19 15:43 [Qemu-devel] [PATCH 00/18] target-arm cleanup Filip Navara
2009-10-15 17:40 ` Aurelien Jarno
2009-10-15 17:49   ` Laurent Desnogues
2009-10-15 18:36     ` Aurelien Jarno
2009-10-16 15:41   ` Filip Navara
2009-10-16 17:56     ` Aurelien Jarno
2009-10-19  6:23       ` Juha.Riihimaki
2009-10-19  6:35         ` Laurent Desnogues
2009-11-10 23:38           ` Paul Brook
2009-11-10 23:53             ` Aurelien Jarno
2009-10-19 13:23         ` Aurelien Jarno
2009-10-20  6:18           ` Juha.Riihimaki
2009-11-10 23:39   ` Paul Brook [this message]

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=200911102339.27007.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=aurelien@aurel32.net \
    --cc=filip.navara@gmail.com \
    --cc=laurent.desnogues@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.