diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-02-01 21:27:41 -1000 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-06-19 11:07:56 -0700 |
commit | 650898891837a9772a5410e73c637a55d99e1e50 (patch) | |
tree | 005d15fa17d8b7678dc0d7585929340c719b8926 /tcg/tci/tcg-target.h | |
parent | 7e00a0800051655e6fdd85ad5dd6fcadafc2dc47 (diff) | |
download | qemu-650898891837a9772a5410e73c637a55d99e1e50.zip qemu-650898891837a9772a5410e73c637a55d99e1e50.tar.gz qemu-650898891837a9772a5410e73c637a55d99e1e50.tar.bz2 |
tcg/tci: Change encoding to uint32_t units
This removes all of the problems with unaligned accesses
to the bytecode stream.
With an 8-bit opcode at the bottom, we have 24 bits remaining,
which are generally split into 6 4-bit slots. This fits well
with the maximum length opcodes, e.g. INDEX_op_add2_i32, which
have 6 register operands.
We have, in previous patches, rearranged things such that there
are no operations with a label which have more than one other
operand. Which leaves us with a 20-bit field in which to encode
a label, giving us a maximum TB size of 512k -- easily large.
Change the INDEX_op_tci_movi_{i32,i64} opcodes to tci_mov[il].
The former puts the immediate in the upper 20 bits of the insn,
like we do for the label displacement. The later uses a label
to reference an entry in the constant pool. Thus, in the worst
case we still have a single memory reference for any constant,
but now the constants are out-of-line of the bytecode and can
be shared between different moves saving space.
Change INDEX_op_call to use a label to reference a pair of
pointers in the constant pool. This removes the only slightly
dodgy link with the layout of struct TCGHelperInfo.
The re-encode cannot be done in pieces.
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/tci/tcg-target.h')
-rw-r--r-- | tcg/tci/tcg-target.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 80cafb7..c9cbe50 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -41,7 +41,7 @@ #define TCG_TARGET_H #define TCG_TARGET_INTERPRETER 1 -#define TCG_TARGET_INSN_UNIT_SIZE 1 +#define TCG_TARGET_INSN_UNIT_SIZE 4 #define TCG_TARGET_TLB_DISPLACEMENT_BITS 32 #define MAX_CODE_GEN_BUFFER_SIZE ((size_t)-1) @@ -166,6 +166,7 @@ typedef enum { #define TCG_TARGET_STACK_ALIGN 8 #define HAVE_TCG_QEMU_TB_EXEC +#define TCG_TARGET_NEED_POOL_LABELS /* We could notice __i386__ or __s390x__ and reduce the barriers depending on the host. But if you want performance, you use the normal backend. |