Skip to content

Linked list for tcg ops

Richard Henderson qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 4 repliesIn review
  2. v18 patches 12 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8tcg: Move some opcode generation functions out of lineMakefile.target tcg/tcg-op.c tcg/tcg-op.h +2 more+2339 -22692 replies
2/8tcg: Reduce ifdefs in tcg-op.ctcg/tcg-op.c+207 -2420 replies
3/8tcg: Move emit of INDEX_op_end into gen_tb_endinclude/exec/gen-icount.h target-alpha/translate.c target-arm/translate-a64.c +16 more+14 -180 replies
4/8tcg: Introduce tcg_op_buf_count and tcg_op_buf_fulltarget-alpha/translate.c target-arm/translate-a64.c target-arm/translate.c +16 more+79 -1130 replies
5/8tcg: Put opcodes in a linked listinclude/exec/gen-icount.h tcg/optimize.c tcg/tcg-op.c +2 more+431 -5011 reply
6/8tcg: Remove opcodes instead of noping them outtcg/optimize.c tcg/tcg.c tcg/tcg.h+32 -110 replies
7/8tcg: Implement insert_op_beforetcg/optimize.c tcg/tcg-op.c tcg/tcg-op.h+35 -441 reply
8/8tcg: Remove unused opcodestcg/tcg-opc.h tcg/tcg.c tci.c+2 -270 replies

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by.

PatchBastian Koppelmann
1/8R-b
2/8R-b
3/8R-b
4/8R-b
5/8R-b
6/8R-b
7/8R-b
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [Qemu-devel] [PATCH v3 0/8] Linked list for tcg ops

Currently tcg ops are simply placed in a buffer in order. Which is fine until we want to actually do something with the opcode stream, such as optimize them. Note the horrible things like call opcodes needing their argument count both prefixed and postfixed so that we can iterate across the call either forward or backward.

While I'm changing this, I also move quite a lot of tcg-op.h out of line. There is very little benefit to having most of them be inline, since their arguments are extracted from the guest instructions being translated, and thus their values are not really predictable.

I chose a cutoff of one function call. If a tcg-op.h function consists of a single function call, inline it, otherwise move it out of line.

This also removes a bit of boilerplate from each target.

I haven't been able to measure a performance difference with this patch set. I wouldn't really expect any, as the complexity level remains the same. I simply find the link list significantly more maintainable.

Changes v2-v3:
* Parameter order bug affecting 32-bit hosts fixed (thanks Peter).

r~

Richard Henderson (8):
tcg: Move some opcode generation functions out of line
tcg: Reduce ifdefs in tcg-op.c
tcg: Move emit of INDEX_op_end into gen_tb_end
tcg: Introduce tcg_op_buf_count and tcg_op_buf_full
tcg: Put opcodes in a linked list
tcg: Remove opcodes instead of noping them out
tcg: Implement insert_op_before
tcg: Remove unused opcodes

 Makefile.target               |    2 +-
 include/exec/gen-icount.h     |   22 +-
 target-alpha/translate.c      |   16 +-
 target-arm/translate-a64.c    |   10 +-
 target-arm/translate.c        |   10 +-
 target-cris/translate.c       |   15 +-
 target-i386/translate.c       |   11 +-
 target-lm32/translate.c       |   16 +-
 target-m68k/translate.c       |   10 +-
 target-microblaze/translate.c |   22 +-
 target-mips/translate.c       |   10 +-
 target-moxie/translate.c      |   10 +-
 target-openrisc/translate.c   |   15 +-
 target-ppc/translate.c        |   11 +-
 target-s390x/translate.c      |   11 +-
 target-sh4/translate.c        |   10 +-
 target-sparc/translate.c      |   10 +-
 target-tricore/translate.c    |    5 +-
 target-unicore32/translate.c  |   10 +-
 target-xtensa/translate.c     |    8 +-
 tcg/optimize.c                |  307 +++--
 tcg/tcg-op.c                  | 1934 ++++++++++++++++++++++++++++++++
 tcg/tcg-op.h                  | 2487 ++++++-----------------------------------
 tcg/tcg-opc.h                 |    9 -
 tcg/tcg.c                     |  532 +++------
 tcg/tcg.h                     |   72 +-
 tci.c                         |   13 -
 27 files changed, 2751 insertions(+), 2837 deletions(-)
 create mode 100644 tcg/tcg-op.c
Signature · 1 line
2.1.0