qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/13] tcg: rework liveness analysis and register allocator
@ 2012-09-27 17:15 Aurelien Jarno
  2012-09-27 17:15 ` [Qemu-devel] [PATCH 01/13] tcg: add temp_dead() Aurelien Jarno
                   ` (12 more replies)
  0 siblings, 13 replies; 41+ messages in thread
From: Aurelien Jarno @ 2012-09-27 17:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Aurelien Jarno

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.

Aurelien Jarno (13):
  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 explicitely save globals and temps
  tcg: sync globals for pure helpers instead of saving them
  tcg: fix some op flags
  tcg: rework TCG ops flags

 tcg/README    |   15 +-
 tcg/tcg-opc.h |   55 ++++---
 tcg/tcg.c     |  443 ++++++++++++++++++++++++++++++++++++---------------------
 tcg/tcg.h     |   19 ++-
 4 files changed, 329 insertions(+), 203 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2012-09-27 23:11 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-27 17:15 [Qemu-devel] [PATCH 00/13] tcg: rework liveness analysis and register allocator Aurelien Jarno
2012-09-27 17:15 ` [Qemu-devel] [PATCH 01/13] tcg: add temp_dead() Aurelien Jarno
2012-09-27 18:19   ` Richard Henderson
2012-09-27 17:15 ` [Qemu-devel] [PATCH 02/13] tcg: add tcg_reg_sync() Aurelien Jarno
2012-09-27 18:24   ` Richard Henderson
2012-09-27 20:00     ` Aurelien Jarno
2012-09-27 17:15 ` [Qemu-devel] [PATCH 03/13] tcg: add temp_sync() Aurelien Jarno
2012-09-27 18:30   ` Richard Henderson
2012-09-27 20:02     ` Aurelien Jarno
2012-09-27 17:15 ` [Qemu-devel] [PATCH 04/13] tcg: sync output arguments on liveness request Aurelien Jarno
2012-09-27 18:39   ` Richard Henderson
2012-09-27 20:05     ` Aurelien Jarno
2012-09-27 20:10       ` Richard Henderson
2012-09-27 20:25         ` Aurelien Jarno
2012-09-27 17:15 ` [Qemu-devel] [PATCH 05/13] tcg: rework liveness analysis Aurelien Jarno
2012-09-27 18:54   ` Richard Henderson
2012-09-27 17:15 ` [Qemu-devel] [PATCH 06/13] tcg: improve tcg_reg_alloc_movi() Aurelien Jarno
2012-09-27 18:55   ` Richard Henderson
2012-09-27 17:15 ` [Qemu-devel] [PATCH 07/13] tcg: rewrite tcg_reg_alloc_mov() Aurelien Jarno
2012-09-27 19:09   ` Richard Henderson
2012-09-27 20:17     ` Aurelien Jarno
2012-09-27 22:18   ` Richard Henderson
2012-09-27 17:15 ` [Qemu-devel] [PATCH 08/13] tcg: always mark dead input arguments as dead Aurelien Jarno
2012-09-27 19:10   ` Richard Henderson
2012-09-27 17:15 ` [Qemu-devel] [PATCH 09/13] tcg: start with local temps in TEMP_VAL_MEM state Aurelien Jarno
2012-09-27 19:10   ` Richard Henderson
2012-09-27 17:15 ` [Qemu-devel] [PATCH 10/13] tcg: don't explicitely save globals and temps Aurelien Jarno
2012-09-27 19:13   ` Richard Henderson
2012-09-27 20:23     ` Aurelien Jarno
2012-09-27 17:15 ` [Qemu-devel] [PATCH 11/13] tcg: sync globals for pure helpers instead of saving them Aurelien Jarno
2012-09-27 19:39   ` Richard Henderson
2012-09-27 20:34     ` Aurelien Jarno
2012-09-27 22:02       ` Richard Henderson
2012-09-27 17:15 ` [Qemu-devel] [PATCH 12/13] tcg: fix some op flags Aurelien Jarno
2012-09-27 19:44   ` Richard Henderson
2012-09-27 17:15 ` [Qemu-devel] [PATCH 13/13] tcg: rework TCG ops flags Aurelien Jarno
2012-09-27 19:56   ` Richard Henderson
2012-09-27 20:37     ` Aurelien Jarno
2012-09-27 22:00       ` Richard Henderson
2012-09-27 23:08         ` Aurelien Jarno
2012-09-27 23:11           ` Richard Henderson

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).