qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Aurelien Jarno <aurelien@aurel32.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 00/26] tcg: rework liveness analysis and register allocator
Date: Mon, 22 Oct 2012 06:35:06 +1000	[thread overview]
Message-ID: <50845C7A.3050907@twiddle.net> (raw)
In-Reply-To: <1350682755-31635-1-git-send-email-aurelien@aurel32.net>

On 2012-10-20 07:38, Aurelien Jarno wrote:
> This patch series rework the liveness analysis and register allocator
> in order to generate more optimized code, by avoiding a lot of move
> instructions. I have measured a 9% performance improvement in user mode
> and 4% in system mode.
> 
> The idea behind this patch series is to free registers as soon as the
> temps are not used anymore instead of waiting for a basic block end or
> an op with side effects. In addition temps are copied to memory as soon
> as they are not going to be written anymore, this way even globals can
> be marked as "dead", avoiding moves to a new register when inputs and
> outputs are aliased. Finally qemu_ld/st operations do not save back
> globals to memory, but only copy them there. In case of an exception
> the globals have the correct values, and otherwise they do not have
> to be reloaded.
> 
> Overall this greatly reduces the number of moves emitted, and spread
> them all over the TBs, increasing the performances on in-order CPUs.
> This also reduces register spilling, especially on CPUs with few
> registers.
> 
> In practice it means the liveness analysis is providing more
> information to the register allocator, and especially when to the memory
> version of a temp with the content of the associated register. This
> means that the two are now quite linked, and that for some functions the
> code exist in two versions, one used when the liveness analysis is
> enabled which only does some checks with assert(), the other when it is
> disabled. It might be possible to keep only one version, but it implies
> de-optimizing the liveness analysis disabled case. In any case the
> checks with assert() should be kept, as they are quite useful to make
> sure nothing subtly breaks.
> 
> 
> Changes v2 -> v3:
>  - rebased against master
>  - patch 7: fixed indentation
>  - patch 14 and later: renamed TCG_CALL_NO_RG into TCG_CALL_NO_RWG
>                        renamed TCG_CALL_NO_WGSE into TCG_CALL_NO_WG_SE
>                        renamed TCG_CALL_NO_RGSE TCG_CALL_NO_RWG_SE

Reviewed-by: Richard Henderson <rth@twiddle.net>

It all looks good.


r~


> 
> Aurelien Jarno (26):
>   tcg: add temp_dead()
>   tcg: add tcg_reg_sync()
>   tcg: add temp_sync()
>   tcg: sync output arguments on liveness request
>   tcg: rework liveness analysis
>   tcg: improve tcg_reg_alloc_movi()
>   tcg: rewrite tcg_reg_alloc_mov()
>   tcg: always mark dead input arguments as dead
>   tcg: start with local temps in TEMP_VAL_MEM state
>   tcg: don't explicitly save globals and temps
>   tcg: fix some op flags
>   tcg: forbid ld/st function to modify globals
>   tcg: synchronize globals for ops with side effects
>   tcg: rework TCG helper flags
>   target-alpha: rename helper flags
>   target-arm: rename helper flags
>   target-cris: rename helper flags
>   target-i386: rename helper flags
>   target-microblaze: rename helper flags
>   target-mips: rename helper flags
>   target-ppc: rename helper flags
>   target-s390x: rename helper flags
>   target-sh4: rename helper flags
>   target-sparc: rename helper flags
>   target-xtensa: rename helper flags
>   tcg: remove compatiblity call flags
> 
>  target-alpha/helper.h      |  176 ++++++++---------
>  target-arm/helper.h        |   18 +-
>  target-cris/helper.h       |   18 +-
>  target-i386/helper.h       |    4 +-
>  target-microblaze/helper.h |    6 +-
>  target-mips/helper.h       |  106 +++++------
>  target-ppc/helper.h        |   38 ++--
>  target-s390x/helper.h      |   76 ++++----
>  target-sh4/helper.h        |    6 +-
>  target-sparc/helper.h      |   50 ++---
>  target-xtensa/helper.h     |   16 +-
>  tcg/README                 |   22 ++-
>  tcg/optimize.c             |    3 +-
>  tcg/tcg-op.h               |   18 +-
>  tcg/tcg-opc.h              |   29 ++-
>  tcg/tcg.c                  |  449 +++++++++++++++++++++++++++-----------------
>  tcg/tcg.h                  |   29 ++-
>  17 files changed, 595 insertions(+), 469 deletions(-)
> 

      parent reply	other threads:[~2012-10-21 20:35 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 21:38 [Qemu-devel] [PATCH v3 00/26] tcg: rework liveness analysis and register allocator Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 01/26] tcg: add temp_dead() Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 02/26] tcg: add tcg_reg_sync() Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 03/26] tcg: add temp_sync() Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 04/26] tcg: sync output arguments on liveness request Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 05/26] tcg: rework liveness analysis Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 06/26] tcg: improve tcg_reg_alloc_movi() Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH 07/26] tcg: rewrite tcg_reg_alloc_mov() Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 08/26] tcg: always mark dead input arguments as dead Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 09/26] tcg: start with local temps in TEMP_VAL_MEM state Aurelien Jarno
2012-10-19 21:38 ` [Qemu-devel] [PATCH v3 10/26] tcg: don't explicitly save globals and temps Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 11/26] tcg: fix some op flags Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 12/26] tcg: forbid ld/st function to modify globals Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 13/26] tcg: synchronize globals for ops with side effects Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 14/26] tcg: rework TCG helper flags Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 15/26] target-alpha: rename " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 16/26] target-arm: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 17/26] target-cris: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 18/26] target-i386: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 19/26] target-microblaze: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 20/26] target-mips: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 21/26] target-ppc: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 22/26] target-s390x: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 23/26] target-sh4: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 24/26] target-sparc: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 25/26] target-xtensa: " Aurelien Jarno
2012-10-19 21:39 ` [Qemu-devel] [PATCH v3 26/26] tcg: remove compatiblity call flags Aurelien Jarno
2012-10-21 20:35 ` 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=50845C7A.3050907@twiddle.net \
    --to=rth@twiddle.net \
    --cc=aurelien@aurel32.net \
    --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).