This patchset introduces the new helper macro MMU_INDEX(). whill will (after applying the last patch) allow to generate smaller code by the tcg.
Patch #1 adds the MMU_INDEX() helper macro, which simply wraps the given value. Patches #2-#23 are trivial patches which convert each target to use the MMU_INDEX() macro. Patch #24 switches MMU_INDEX() to return a new MMU idx which is counts down from (NB_MMU_MODES-1). That change reduces the needed negative offset to access the TLB entry which in turn let the tcg compiler generates smaller instructions. Please review. Helge Helge Deller (23): cpu-defs.h; Add MMU_INDEX() helper target/i386: Use MMU_INDEX() helper target/hppa: Use MMU_INDEX() helper target/alpha: Use MMU_INDEX() helper target/avr: Use MMU_INDEX() helper target/hexagon: Use MMU_INDEX() helper target/loongarch: Use MMU_INDEX() helper target/mips: Use MMU_INDEX() helper target/openrisc: Use MMU_INDEX() helper target/riscv: Use MMU_INDEX() helper target/s390x: Use MMU_INDEX() helper target/sparc: Use MMU_INDEX() helper target/xtensa: Use MMU_INDEX() helper target/arm: Use MMU_INDEX() helper target/cris: Use MMU_INDEX() helper target/m68k: Use MMU_INDEX() helper target/microblaze: Use MMU_INDEX() helper target/m68k: Use MMU_INDEX() helper target/ppc: Use MMU_INDEX() helper target/rx: Use MMU_INDEX() helper target/sh4: Use MMU_INDEX() helper target/tricore: Use MMU_INDEX() helper cpu-defs.h: Reduce generated code size by inverting MMU_INDEX() include/exec/cpu-defs.h | 10 ++++++++++ target/alpha/cpu.h | 6 +++--- target/arm/cpu.h | 4 ++-- target/avr/cpu.h | 4 ++-- target/cris/cpu.h | 4 ++-- target/hexagon/cpu.h | 2 +- target/hppa/cpu.h | 6 +++--- target/i386/cpu.h | 10 +++++----- target/loongarch/cpu.h | 8 ++++---- target/m68k/cpu.h | 6 +++--- target/microblaze/cpu.h | 6 +++--- target/mips/cpu.h | 6 +++--- target/nios2/cpu.h | 4 ++-- target/openrisc/cpu.h | 6 +++--- target/ppc/cpu.h | 5 +++-- target/riscv/cpu.h | 4 ++-- target/riscv/cpu_helper.c | 2 +- target/rx/cpu.h | 2 +- target/s390x/cpu.h | 10 +++++----- target/sh4/cpu.h | 7 ++++--- target/sparc/cpu.h | 20 ++++++++++---------- target/tricore/cpu.h | 4 ++-- target/xtensa/cpu.h | 4 ++-- 23 files changed, 76 insertions(+), 64 deletions(-) -- 2.41.0