From: Aurelien Jarno <aurelien@aurel32.net>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org, mark.cave-ayland@ilande.co.uk,
atar4qemu@gmail.com
Subject: Re: [Qemu-devel] [PATCH v3 9/9] tcg: Lower indirect registers in a separate pass
Date: Mon, 25 Jul 2016 21:23:42 +0200 [thread overview]
Message-ID: <20160725192342.GA16143@aurel32.net> (raw)
In-Reply-To: <1466740107-15042-10-git-send-email-rth@twiddle.net>
On 2016-06-23 20:48, Richard Henderson wrote:
> Rather than rely on recursion during the middle of register allocation,
> lower indirect registers to loads and stores off the indirect base into
> plain temps.
>
> For an x86_64 host, with sufficient registers, this results in identical
> code, modulo the actual register assignments.
>
> For an i686 host, with insufficient registers, this means that temps can
> be (temporarily) spilled to the stack in order to satisfy an allocation.
> This as opposed to the possibility of not being able to spill, to allocate
> a register for the indirect base, in order to perform a spill.
>
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
> include/qemu/log.h | 1 +
> tcg/optimize.c | 31 +-----
> tcg/tcg.c | 306 +++++++++++++++++++++++++++++++++++++++++++----------
> tcg/tcg.h | 4 +
> util/log.c | 5 +-
> 5 files changed, 263 insertions(+), 84 deletions(-)
This patch is a difficult one to review... On the purely technical side
it does what it is supposed to do and I haven't found any issue, though
it's probably very easy to miss one in this kind of code. I have done
tests with various sparc images and I haven't found any obvious
regression on an x86_64 host.
Now on the less technical side, I really like the idea of being able to
transform more or less in place the TCG instruction stream. Your more or
less recent patches towards that direction are great. That said I am a
bit worried that we loop many times on the various ops. We used to have
one forward pass (optimizer) and one backward pass (liveness analysis).
Your patch adds up to two additional passes (one forward and one
backward), this clearly has a cost. Given that indirect registers bring
a lot of performance I think it is worth it. Now I wonder if there is
any way to do the lowering of registers earlier, I mean before the
liveness analysis. This would probably generate plenty of useless ops,
but that are later removed by the liveness analysis. Maybe you have
already try that?
I think it also depends on which direction we want to go with TCG,
either plenty of small independent optimization passes, or keep the
number of passes limited which means more complex code. Contrary to
a compiler we have to do a much more difficult trade-off between the
optimization time and the level of optimization.
Nevertheless I think it's the correct way to go forward for now and
this patch fixes real issues on hosts with limited registers. Maybe just
add a note saying there *might* be better ways to do that.
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
next prev parent reply other threads:[~2016-07-25 19:23 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 3:48 [Qemu-devel] [PATCH v3 0/9] Third try at fixing sparc register allocation Richard Henderson
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 1/9] tcg: Fix name for high-half register Richard Henderson
2016-07-25 11:23 ` Aurelien Jarno
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 2/9] tcg: Optimize spills of constants Richard Henderson
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 3/9] tcg: Require liveness analysis Richard Henderson
2016-07-25 11:23 ` Aurelien Jarno
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 4/9] tcg: Compress liveness data to 16 bits Richard Henderson
2016-07-25 11:23 ` Aurelien Jarno
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 5/9] tcg: Reorg TCGOp chaining Richard Henderson
2016-07-25 11:23 ` Aurelien Jarno
2016-08-03 18:08 ` Richard Henderson
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 6/9] tcg: Fold life data into TCGOp Richard Henderson
2016-07-25 14:07 ` Aurelien Jarno
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 7/9] tcg: Compress dead_temps and mem_temps into a single array Richard Henderson
2016-07-25 15:15 ` Aurelien Jarno
2016-08-03 18:22 ` Richard Henderson
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 8/9] tcg: Include liveness info in the dumps Richard Henderson
2016-07-25 15:15 ` Aurelien Jarno
2016-07-25 16:16 ` Aurelien Jarno
2016-06-24 3:48 ` [Qemu-devel] [PATCH v3 9/9] tcg: Lower indirect registers in a separate pass Richard Henderson
2016-07-25 19:23 ` Aurelien Jarno [this message]
2016-08-03 19:27 ` Richard Henderson
2016-06-24 10:31 ` [Qemu-devel] [PATCH v3 0/9] Third try at fixing sparc register allocation Mark Cave-Ayland
2016-07-19 3:39 ` Richard Henderson
2016-07-22 13:40 ` Aurelien Jarno
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=20160725192342.GA16143@aurel32.net \
--to=aurelien@aurel32.net \
--cc=atar4qemu@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).