@samitouri / QOSamiQemu / commits / f0d4cbf228

accel/tcg: Remove non-explicit endian cpu_ld*_code() wrappers

All uses were converted to the cpu_ld*_code_mmu() helpers: remove them. Update the documentation. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260320074555.33974-3-philmd@linaro.org>

Philippe Mathieu-Daudé committed Nov 27, 2025 at 05:19 UTC f0d4cbf2289aa9ff65ebe21a78217b8dba017ce5
2 files changed +11 -43
docs/devel/loads-stores.rst
+9 -12
@@ -235,16 +235,13 @@ Regexes for git grep:
235 - ``\<cpu_ld[us]\?[bwlq]\(_[bl]e\)\?_data\>``
236 - ``\<cpu_st[bwlq]\(_[bl]e\)\?_data\+\>``
237
238 -``cpu_ld*_code``
239 -~~~~~~~~~~~~~~~~
238 +``cpu_ld*_code_mmu``
239 +~~~~~~~~~~~~~~~~~~~~
240
241 -These functions perform a read for instruction execution. The ``mmuidx``
242 -parameter is taken from the current mode of the guest CPU, as determined
243 -by ``cpu_mmu_index(env, true)``. The ``retaddr`` parameter is 0, and
244 -thus does not unwind guest CPU state, because CPU state is always
245 -synchronized while translating instructions. Any guest CPU exception
246 -that is raised will indicate an instruction execution fault rather than
247 -a data read fault.
241 +These functions work like the ``cpu_{ld,st}*_mmu`` functions
242 +except that they perform a read for instruction execution.
243 +Any guest CPU exception that is raised will indicate an instruction
244 +execution fault rather than a data read fault.
245
246 In general these functions should not be used directly during translation.
247 There are wrapper functions that are to be used which also take care of
@@ -252,7 +249,7 @@ plugins for tracing.
249
250 Function names follow the pattern:
251
255 -load: ``cpu_ld{sign}{size}_code(env, ptr)``
252 +load: ``cpu_ld{sign}{size}_code_mmu(env, addr, oi, retaddr)``
253
254 ``sign``
255 - (empty) : for 32 or 64 bit sizes
@@ -266,12 +263,12 @@ load: ``cpu_ld{sign}{size}_code(env, ptr)``
263 - ``q`` : 64 bits
264
265 Regexes for git grep:
269 - - ``\<cpu_ld[us]\?[bwlq]_code\>``
266 + - ``\<cpu_ld[us]\?[bwlq]_code_mmu\>``
267
268 ``translator_ld*``
269 ~~~~~~~~~~~~~~~~~~
270
274 -These functions are a wrapper for ``cpu_ld*_code`` which also perform
271 +These functions are a wrapper for ``cpu_ld*_code_mmu`` which also perform
272 any actions required by any tracing plugins. They are only to be
273 called during the translator callback ``translate_insn``.
274
include/accel/tcg/cpu-ldst.h
+2 -31
@@ -51,10 +51,9 @@
51 * _be: for forced big endian
52 * _le: for forced little endian
53 *
54 - * mmusuffix is one of the generic suffixes "data" or "code", or "mmuidx".
54 + * mmusuffix is one of the generic suffixes "data" or "mmuidx".
55 * The "mmuidx" suffix carries an extra mmu_idx argument that specifies
56 - * the index to use; the "data" and "code" suffixes take the index from
57 - * cpu_mmu_index().
56 + * the index to use; the "data" suffix take the index from cpu_mmu_index().
57 *
58 * The "mmu" suffix carries the full MemOpIdx, with both mmu_idx and the
59 * MemOp including alignment requirements. The alignment will be enforced.
@@ -470,34 +469,6 @@ cpu_stq_le_data(CPUArchState *env, abi_ptr addr, uint64_t val)
469 # define cpu_stl_mmuidx_ra cpu_stl_le_mmuidx_ra
470 # define cpu_stq_mmuidx_ra cpu_stq_le_mmuidx_ra
471 #endif
473 -
474 -static inline uint32_t cpu_ldub_code(CPUArchState *env, abi_ptr addr)
475 -{
476 - CPUState *cs = env_cpu(env);
477 - MemOpIdx oi = make_memop_idx(MO_UB, cpu_mmu_index(cs, true));
478 - return cpu_ldb_code_mmu(env, addr, oi, 0);
479 -}
480 -
481 -static inline uint32_t cpu_lduw_code(CPUArchState *env, abi_ptr addr)
482 -{
483 - CPUState *cs = env_cpu(env);
484 - MemOpIdx oi = make_memop_idx(MO_TEUW, cpu_mmu_index(cs, true));
485 - return cpu_ldw_code_mmu(env, addr, oi, 0);
486 -}
487 -
488 -static inline uint32_t cpu_ldl_code(CPUArchState *env, abi_ptr addr)
489 -{
490 - CPUState *cs = env_cpu(env);
491 - MemOpIdx oi = make_memop_idx(MO_TEUL, cpu_mmu_index(cs, true));
492 - return cpu_ldl_code_mmu(env, addr, oi, 0);
493 -}
494 -
495 -static inline uint64_t cpu_ldq_code(CPUArchState *env, abi_ptr addr)
496 -{
497 - CPUState *cs = env_cpu(env);
498 - MemOpIdx oi = make_memop_idx(MO_TEUQ, cpu_mmu_index(cs, true));
499 - return cpu_ldq_code_mmu(env, addr, oi, 0);
500 -}
472 #endif /* TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API */
473
474 #endif /* ACCEL_TCG_CPU_LDST_H */