All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Kirill Batuzov <batuzovk@ispras.ru>
Cc: zhur@ispras.ru, qemu-devel@nongnu.org,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [RFC][PATCH v0 0/8] Improve register allocator
Date: Tue, 24 May 2011 09:07:20 -0700	[thread overview]
Message-ID: <4DDBD7B8.4060806@twiddle.net> (raw)
In-Reply-To: <alpine.DEB.2.02.1105241423250.2267@bulbul>

On 05/24/2011 04:31 AM, Kirill Batuzov wrote:
> 
> 
> On Mon, 23 May 2011, Aurelien Jarno wrote:
> 
>>
>> Thanks for this patch series. Your approach to solve this issue is
>> really different than mine. Instead I added more state to the dead/live
>> states, and use them to mark some input deads even for global, and mark
>> some output arguments to be synced. This informations are then used
>> directly in the tcg_reg_alloc_* functions to make better usage of the
>> available registers. On the other hand my patch series only tries to
>> really lower the number of spills and doesn't try to make better spill
>> choices.
>>
>> I guess it would be a good idea that I continue with this approach (I
>> basically just have to fix a few cases were some regs are wrongly copied
>> back to memory), so that we can more easily compare the two approaches.
>> Your last patch is anyway interesting, having some statistics is always
>> something interesting.
>>
>> In any case I really think we need a better register allocator before we
>> can do any serious optimization passes like constant or copy propagation,
>> otherwise we end up with a lot of register in use for no real reason.
>>
> When I started working on this patch series I first wanted to write a
> better register allocator, something linear scan based.  But TBs
> currently have quite specific and very simple structure.  They have globals 
> which are alive everywhere and temps, packed in a count of nests.  Each nest
> is a result of translation of one guest instruction.  Live ranges of temps in
> one nest always intersect, while live ranges of temps from different
> nests never intersect.  As a result more sophisticated algorithm being
> applied to this test case works very similar to a simple greedy algorithm we
> have right now.

Something that would be helpful for the RISC hosts would be to add some
mechanism to add constants -- or constant fragments, if you like -- into
the register allocation mix.

If you have access to a Sparc or PPC host (perhaps emulated under qemu),
have a look at the code generated for an i386, or even arm executable.
You'll see lots of similar constants being created, all in a 2-3 insn
sequence.  Have a look at the code generated for a 64-bit target like
Alpha and it'll be a 4-6 insn sequence.

Ideally we'd be able to register-allocate these partial constant loads,
and so collapse similar sequences.  We have tons of registers that are
not being used on these hosts, which seems a shame.


r~

      parent reply	other threads:[~2011-05-24 16:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-23 14:40 [Qemu-devel] [RFC][PATCH v0 0/8] Improve register allocator Kirill Batuzov
2011-05-23 14:40 ` [Qemu-devel] [RFC][PATCH v0 1/8] Compute additional liveness information for " Kirill Batuzov
2011-05-23 14:40 ` [Qemu-devel] [RFC][PATCH v0 2/8] Propagate REG_NEXT_USE value through process of register allocation Kirill Batuzov
2011-05-23 14:40 ` [Qemu-devel] [RFC][PATCH v0 3/8] Do better spill choice Kirill Batuzov
2011-05-23 14:40 ` [Qemu-devel] [RFC][PATCH v0 4/8] Calculate NEXT_CALL liveness information Kirill Batuzov
2011-05-23 14:40 ` [Qemu-devel] [RFC][PATCH v0 5/8] Track call-clobbered uses of registers Kirill Batuzov
2011-05-23 14:40 ` [Qemu-devel] [RFC][PATCH v0 6/8] Spill globals early if their next use is in call Kirill Batuzov
2011-05-23 14:40 ` [Qemu-devel] [RFC][PATCH v0 7/8] Spill globals early if their next use is at the BB end Kirill Batuzov
2011-05-23 14:40 ` [Qemu-devel] [RFC][PATCH v0 8/8] Add spill count profiling Kirill Batuzov
2011-05-23 19:32   ` Blue Swirl
2011-05-23 21:22 ` [Qemu-devel] [RFC][PATCH v0 0/8] Improve register allocator Aurelien Jarno
2011-05-24 11:31   ` Kirill Batuzov
2011-05-24 12:40     ` Aurelien Jarno
2011-05-24 13:24     ` Laurent Desnogues
2011-05-24 13:32       ` Kirill Batuzov
2011-05-24 16:07     ` Richard Henderson [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=4DDBD7B8.4060806@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --cc=batuzovk@ispras.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=zhur@ispras.ru \
    /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.