mbox series

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

Message ID 20221130132654.76369-1-philmd@linaro.org
Headers show
Series tcg: Replace tcg_target_[u]long -> [u]intptr_t | expand

Message

Philippe Mathieu-Daudé Nov. 30, 2022, 1:26 p.m. UTC
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(-)

Comments

Richard Henderson Nov. 30, 2022, 8:49 p.m. UTC | #1
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~