[PATCH-for-8.0 0/3] tcg: Replace tcg_target_[u]long -> [u]intptr_t

Philippe Mathieu-Daudé posted 3 patches 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221130132654.76369-1-philmd@linaro.org
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, WANG Xuerui <git@xen0n.name>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Huacai Chen <chenhuacai@kernel.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <Alistair.Francis@wdc.com>, Stefan Weil <sw@weilnetz.de>, Thomas Huth <thuth@redhat.com>
accel/tcg/cputlb.c                    | 44 +++++++++----------
accel/tcg/translate-all.c             | 12 +++---
docs/devel/control-flow-integrity.rst |  2 +-
include/tcg/tcg-ldst.h                | 40 ++++++++---------
include/tcg/tcg-op.h                  | 62 +++++++++++++--------------
include/tcg/tcg.h                     | 18 ++------
tcg/aarch64/tcg-target.c.inc          | 16 +++----
tcg/arm/tcg-target.c.inc              |  4 +-
tcg/i386/tcg-target.c.inc             | 16 +++----
tcg/loongarch64/tcg-target.c.inc      | 30 ++++++-------
tcg/mips/tcg-target.c.inc             |  4 +-
tcg/optimize.c                        |  8 ++--
tcg/ppc/tcg-target.c.inc              | 16 +++----
tcg/riscv/tcg-target.c.inc            | 18 ++++----
tcg/s390x/tcg-target.c.inc            | 42 +++++++++---------
tcg/sparc64/tcg-target.c.inc          | 14 +++---
tcg/tcg-op-vec.c                      |  2 +-
tcg/tcg-op.c                          | 16 +++----
tcg/tcg-pool.c.inc                    | 32 +++++++-------
tcg/tcg.c                             | 24 +++++------
tcg/tci.c                             | 18 ++++----
tcg/tci/tcg-target.c.inc              |  2 +-
22 files changed, 214 insertions(+), 226 deletions(-)
[PATCH-for-8.0 0/3] tcg: Replace tcg_target_[u]long -> [u]intptr_t
Posted by Philippe Mathieu-Daudé 1 year, 4 months ago
Trivial cleanup (99% mechanical) suggested by rth:
the tcg_target_[u]long type is redundant with [u]intptr_t.

Philippe Mathieu-Daudé (3):
  tcg/s390x: Fix coding style
  tcg: Replace tcg_target_long -> intptr_t
  tcg: Replace tcg_target_ulong -> uintptr_t

 accel/tcg/cputlb.c                    | 44 +++++++++----------
 accel/tcg/translate-all.c             | 12 +++---
 docs/devel/control-flow-integrity.rst |  2 +-
 include/tcg/tcg-ldst.h                | 40 ++++++++---------
 include/tcg/tcg-op.h                  | 62 +++++++++++++--------------
 include/tcg/tcg.h                     | 18 ++------
 tcg/aarch64/tcg-target.c.inc          | 16 +++----
 tcg/arm/tcg-target.c.inc              |  4 +-
 tcg/i386/tcg-target.c.inc             | 16 +++----
 tcg/loongarch64/tcg-target.c.inc      | 30 ++++++-------
 tcg/mips/tcg-target.c.inc             |  4 +-
 tcg/optimize.c                        |  8 ++--
 tcg/ppc/tcg-target.c.inc              | 16 +++----
 tcg/riscv/tcg-target.c.inc            | 18 ++++----
 tcg/s390x/tcg-target.c.inc            | 42 +++++++++---------
 tcg/sparc64/tcg-target.c.inc          | 14 +++---
 tcg/tcg-op-vec.c                      |  2 +-
 tcg/tcg-op.c                          | 16 +++----
 tcg/tcg-pool.c.inc                    | 32 +++++++-------
 tcg/tcg.c                             | 24 +++++------
 tcg/tci.c                             | 18 ++++----
 tcg/tci/tcg-target.c.inc              |  2 +-
 22 files changed, 214 insertions(+), 226 deletions(-)

-- 
2.38.1


Re: [PATCH-for-8.0 0/3] tcg: Replace tcg_target_[u]long -> [u]intptr_t
Posted by Richard Henderson 1 year, 4 months ago
On 11/30/22 05:26, Philippe Mathieu-Daudé wrote:
> Trivial cleanup (99% mechanical) suggested by rth:
> the tcg_target_[u]long type is redundant with [u]intptr_t.

Ah, no, what I said was that much of the usage in tcg-op.h should be either ptrdiff_t or 
intptr_t. In particular, e.g.

static inline void tcg_gen_ld_i32(TCGv_i32 ret, TCGv_ptr arg2,
                                   tcg_target_long offset)

should change, because @offset is an addend to a host pointer.  In this case ptrdiff_t 
seems more descriptive than intptr_t.

Generalized replacement is wrong.  In particular it would break x32 (ilp32 on x86_64)... 
not that I've done any testing of that in the past few releases, and qemu is exactly the 
wrong sort of application to be skimping on host pointer width.


r~