@samitouri / QOSamiQemu / commits / 9085154835

tcg: move tcg_use_softmmu to tcg/tcg-internal.h

In next commit, we'll apply same helper pattern for base helpers remaining. Our new helper pattern always include helper-*-common.h, which ends up including include/tcg/tcg.h, which contains one occurrence of CONFIG_USER_ONLY. Thus, common files not being duplicated between system and target relying on helpers will fail to compile. Existing occurrences are: - target/arm/tcg/arith_helper.c - target/arm/tcg/crypto_helper.c This occurrence of CONFIG_USER_ONLY is for defining variable tcg_use_softmmu, and we rely on dead code elimination with it in various tcg-target.c.inc. Thus, move its definition to tcg/tcg-internal.h, so helpers can be included by common files. Also, change it to a define, as it has fixed values for now. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-id: 20260219040150.2098396-8-pierrick.bouvier@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Pierrick Bouvier committed Feb 18, 2026 at 20:01 UTC 9085154835063f13a9084eea7599f25ea5f5143f
3 files changed +6 -10
include/tcg/tcg.h
-6
@@ -445,12 +445,6 @@ static inline bool temp_readonly(TCGTemp *ts)
445 return ts->kind >= TEMP_FIXED;
446 }
447
448 -#ifdef CONFIG_USER_ONLY
449 -extern bool tcg_use_softmmu;
450 -#else
451 -#define tcg_use_softmmu true
452 -#endif
453 -
448 extern __thread TCGContext *tcg_ctx;
449 extern const void *tcg_code_gen_epilogue;
450 extern uintptr_t tcg_splitwx_diff;
tcg/tcg-internal.h
+6
@@ -34,6 +34,12 @@ extern TCGContext **tcg_ctxs;
34 extern unsigned int tcg_cur_ctxs;
35 extern unsigned int tcg_max_ctxs;
36
37 +#ifdef CONFIG_USER_ONLY
38 +#define tcg_use_softmmu false
39 +#else
40 +#define tcg_use_softmmu true
41 +#endif
42 +
43 void tcg_region_init(size_t tb_size, int splitwx, unsigned max_threads);
44 bool tcg_region_alloc(TCGContext *s);
45 void tcg_region_initial_alloc(TCGContext *s);
tcg/tcg.c
-4
@@ -236,10 +236,6 @@ static TCGAtomAlign atom_and_align_for_opc(TCGContext *s, MemOp opc,
236 MemOp host_atom, bool allow_two_ops)
237 __attribute__((unused));
238
239 -#ifdef CONFIG_USER_ONLY
240 -bool tcg_use_softmmu;
241 -#endif
242 -
239 TCGContext tcg_init_ctx;
240 __thread TCGContext *tcg_ctx;
241