[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 15/27] tcg/tci: Change encoding to uint32_t units
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v7 15/27] tcg/tci: Change encoding to uint32_t units |
Date: |
Sat, 19 Jun 2021 19:48:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
On 6/1/21 5:00 PM, Richard Henderson wrote:
> 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>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> include/tcg/tcg-opc.h | 4 +-
> tcg/tci/tcg-target.h | 3 +-
> tcg/tci.c | 541 +++++++++++++++------------------------
> tcg/tci/tcg-target.c.inc | 379 ++++++++++++---------------
> tcg/tci/README | 20 +-
> 5 files changed, 384 insertions(+), 563 deletions(-)
> @@ -1082,87 +961,69 @@ static const char *str_c(TCGCond c)
> /* Disassemble TCI bytecode. */
> int print_insn_tci(bfd_vma addr, disassemble_info *info)
> {
> case INDEX_op_setcond_i32:
> case INDEX_op_setcond_i64:
> - tci_args_rrrc(&tb_ptr, &r0, &r1, &r2, &c);
> + tci_args_rrrc(insn, &r0, &r1, &r2, &c);
> info->fprintf_func(info->stream, "%-12s %s, %s, %s, %s",
> op_name, str_r(r0), str_r(r1), str_r(r2),
> str_c(c));
> break;
>
> - case INDEX_op_tci_movi_i32:
> - tci_args_ri(&tb_ptr, &r0, &i1);
> - info->fprintf_func(info->stream, "%-12s %s, 0x%" TCG_PRIlx,
> + case INDEX_op_tci_movi:
> + tci_args_ri(insn, &r0, &i1);
> + info->fprintf_func(info->stream, "%-12s %s,0x%" TCG_PRIlx "",
Missing space in format: "%s, 0x%"
> op_name, str_r(r0), i1);
> break;
>
> -#if TCG_TARGET_REG_BITS == 64
> - case INDEX_op_tci_movi_i64:
> - tci_args_rI(&tb_ptr, &r0, &i1);
> - info->fprintf_func(info->stream, "%-12s %s, 0x%" TCG_PRIlx,
> - op_name, str_r(r0), i1);
> + case INDEX_op_tci_movl:
> + tci_args_rl(insn, tb_ptr, &r0, &ptr);
> + info->fprintf_func(info->stream, "%-12s %s, %p",
> + op_name, str_r(r0), ptr);
> break;
> -#endif
- [PATCH v7 05/27] accel/tcg: Add tcg call flags to plugins helpers, (continued)
- [PATCH v7 05/27] accel/tcg: Add tcg call flags to plugins helpers, Richard Henderson, 2021/06/01
- [PATCH v7 06/27] tcg: Store the TCGHelperInfo in the TCGOp for call, Richard Henderson, 2021/06/01
- [PATCH v7 09/27] tcg/tci: Improve tcg_target_call_clobber_regs, Richard Henderson, 2021/06/01
- [PATCH v7 10/27] tcg/tci: Move call-return regs to end of tcg_target_reg_alloc_order, Richard Henderson, 2021/06/01
- [PATCH v7 13/27] tcg/tci: Emit setcond before brcond, Richard Henderson, 2021/06/01
- [PATCH v7 15/27] tcg/tci: Change encoding to uint32_t units, Richard Henderson, 2021/06/01
- [PATCH v7 08/27] tcg: Build ffi data structures for helpers, Richard Henderson, 2021/06/01
- [PATCH v7 25/27] tcg/tci: Remove the qemu_ld/st_type macros, Richard Henderson, 2021/06/01
- [PATCH v7 22/27] tcg/tci: Implement add2, sub2, Richard Henderson, 2021/06/01
- [PATCH v7 27/27] tests/tcg: Increase timeout for TCI, Richard Henderson, 2021/06/01
- [PATCH v7 16/27] tcg/tci: Implement goto_ptr, Richard Henderson, 2021/06/01