Skip to content

RFC TCG indirect registers

Richard Henderson qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest16 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16tcg: Change tcg_global_mem_new_* to take a TCGv_ptrtarget-alpha/translate.c target-arm/translate.c target-cris/translate.c +16 more+296 -2740 replies
2/16tcg: Introduce TCGTempTypetcg/tcg.h+7 -50 replies
3/16tcg: Change ts->mem_reg to ts->mem_basetcg/tcg.c tcg/tcg.h+38 -320 replies
4/16tcg: Compress TCGLabelQemuLdsttcg/tcg.h+10 -70 replies
5/16tcg: More use of TCGReg where appropriatetcg/tcg.c tcg/tcg.h+19 -150 replies
6/16tcg: Remove tcg_get_arg_str_i32/64tcg/tcg.c tcg/tcg.h+0 -150 replies
7/16tcg: Change reg_to_temp to TCGTemp pointertcg/tcg.c tcg/tcg.h+56 -610 replies
8/16tcg: Change temp_dead argument to TCGTemptcg/tcg.c+19 -200 replies
9/16tcg: Change temp_sync argument to TCGTemptcg/tcg.c+8 -80 replies
10/16tcg: Change temp_save argument to TCGTemptcg/tcg.c+7 -90 replies
11/16tcg: Introduce temp_loadtcg/tcg.c+90 -1020 replies
12/16tcg: Tidy temporary allocationtcg/tcg.c+60 -680 replies
13/16tcg: Use temp_idxtcg/tcg.c+3 -30 replies
14/16tcg: Implement indirect memory registerstcg/tcg.c tcg/tcg.h+73 -330 replies
15/16target-sparc: Tidy global register initializationtarget-sparc/translate.c+71 -890 replies
16/16target-sparc: Use global registers for the register windowtarget-sparc/translate.c+27 -220 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [RFC 00/16] TCG indirect registers

This is an attempt to improve performance of target-sparc by exposing the windowed registers as TCG globals, and all the optimization that we can do there.

This is done via allowing tcg_global_mem_new to be used with any base pointer, not just off of a fixed register. Thus the sparc windowed registers are globals off cpu_regwptr.

In the process of working through this, I attempt to remove as many uses of "int" as I can throughout the TCG code gen paths, replacing them with TCGReg when we're talking about hard registers, and TCGTemp pointers when we're talking about temporaries. This, IMO, reduces confusion as to what kind of "int" we mean at any given time.

By the time we get to patch 14, actually implementing the indirect temps, it's fairly easy to recurse in order to load the base pointer when we need to load or store an indirect temp.

I've not yet tried to measure the performance. As far as testing, linux-user-0.3 and sparc-test-0.2 works. I've scanned some of the dumps from those. In the cases where no real optimization was possible, we generate practically the same code -- usually with different registers selected. In the cases where we can optimize, I've seen some TB's cut in half.

Anyway, I wanted some feedback before I take this any further.

r~

Richard Henderson (16):
tcg: Change tcg_global_mem_new_* to take a TCGv_ptr
tcg: Introduce TCGTempType
tcg: Change ts->mem_reg to ts->mem_base
tcg: Compress TCGLabelQemuLdst
tcg: More use of TCGReg where appropriate
tcg: Remove tcg_get_arg_str_i32/64
tcg: Change reg_to_temp to TCGTemp pointer
tcg: Change temp_dead argument to TCGTemp
tcg: Change temp_sync argument to TCGTemp
tcg: Change temp_save argument to TCGTemp
tcg: Introduce temp_load
tcg: Tidy temporary allocation
tcg: Use temp_idx
tcg: Implement indirect memory registers
target-sparc: Tidy global register initialization
target-sparc: Use global registers for the register window

 target-alpha/translate.c      |  40 +--
 target-arm/translate.c        |  20 +-
 target-cris/translate.c       |  24 +-
 target-cris/translate_v10.c   |  82 +++---
 target-i386/translate.c       |  56 ++--
 target-lm32/translate.c       |  24 +-
 target-m68k/translate.c       |  28 +-
 target-microblaze/translate.c |  14 +-
 target-mips/translate.c       |  25 +-
 target-moxie/translate.c      |   8 +-
 target-openrisc/translate.c   |  26 +-
 target-ppc/translate.c        |  40 +--
 target-s390x/translate.c      |  16 +-
 target-sh4/translate.c        |  36 +--
 target-sparc/translate.c      | 195 ++++++-------
 target-unicore32/translate.c  |   2 +-
 target-xtensa/translate.c     |  10 +-
 tcg/tcg.c                     | 641 +++++++++++++++++++++---------------------
 tcg/tcg.h                     |  78 +++--
 19 files changed, 693 insertions(+), 672 deletions(-)
Signature · 1 line
1.8.1.4