diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2025-07-11 18:20:26 -0600 |
|---|---|---|
| committer | Richard Henderson <richard.henderson@linaro.org> | 2025-09-23 16:55:32 -0700 |
| commit | 33ea495cd3bfb21db920b6928af7eda39ced5c20 (patch) | |
| tree | bb8c5a9c8634db4ea0bbd096ccbdd4a54c89e3fc /tcg/tcg.c | |
| parent | 3c58ddc9d784cd65af3d5810d9d66e57900e280a (diff) | |
| download | focaccia-qemu-33ea495cd3bfb21db920b6928af7eda39ced5c20.tar.gz focaccia-qemu-33ea495cd3bfb21db920b6928af7eda39ced5c20.zip | |
include/hw/core/cpu: Invert the indexing into CPUTLBDescFast
This array is within CPUNegativeOffsetState, which means the last element of the array has an offset from env with the smallest magnitude. This can be encoded into fewer bits when generating TCG fast path memory references. When we changed the NB_MMU_MODES to be a global constant, rather than a per-target value, we pessimized the code generated for targets which use only a few mmu indexes. By inverting the array index, we counteract that. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/tcg.c')
| -rw-r--r-- | tcg/tcg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c index afac55a203..294762c283 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -425,7 +425,8 @@ static uintptr_t G_GNUC_UNUSED get_jmp_target_addr(TCGContext *s, int which) static int __attribute__((unused)) tlb_mask_table_ofs(TCGContext *s, int which) { - return (offsetof(CPUNegativeOffsetState, tlb.f[which]) - + int fi = mmuidx_to_fast_index(which); + return (offsetof(CPUNegativeOffsetState, tlb.f[fi]) - sizeof(CPUNegativeOffsetState)); } |