The TranslationBlock flags are defined in 'exec/translation-block.h'.
tcg_cflags_has/set() and curr_cflags() use them, it is more logical
to declare them in the same place. Move them there too.
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/exec/cpu-common.h | 6 ------
include/exec/translation-block.h | 6 ++++++
accel/tcg/cpu-exec.c | 1 +
accel/tcg/tcg-accel-ops.c | 1 +
accel/tcg/watchpoint.c | 1 +
linux-user/mmap.c | 1 +
linux-user/syscall.c | 1 +
target/arm/cpu.c | 1 +
target/avr/cpu.c | 1 +
target/hexagon/cpu.c | 1 +
target/hppa/cpu.c | 1 +
target/i386/cpu.c | 1 +
target/i386/helper.c | 1 +
target/loongarch/cpu.c | 1 +
target/microblaze/cpu.c | 1 +
target/mips/tcg/exception.c | 1 +
target/mips/tcg/sysemu/special_helper.c | 1 +
target/openrisc/cpu.c | 1 +
target/riscv/tcg/tcg-cpu.c | 1 +
target/rx/cpu.c | 1 +
target/sh4/cpu.c | 1 +
target/sparc/cpu.c | 1 +
target/tricore/cpu.c | 1 +
23 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index 638dc806a5f..bdeb9d68f32 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -187,12 +187,6 @@ void list_cpus(void);
#ifdef CONFIG_TCG
-bool tcg_cflags_has(CPUState *cpu, uint32_t flags);
-void tcg_cflags_set(CPUState *cpu, uint32_t flags);
-
-/* current cflags for hashing/comparison */
-uint32_t curr_cflags(CPUState *cpu);
-
/**
* cpu_unwind_state_data:
* @cpu: the cpu context
diff --git a/include/exec/translation-block.h b/include/exec/translation-block.h
index b99afb00779..c1e48a48aab 100644
--- a/include/exec/translation-block.h
+++ b/include/exec/translation-block.h
@@ -153,4 +153,10 @@ static inline uint32_t tb_cflags(const TranslationBlock *tb)
return qatomic_read(&tb->cflags);
}
+bool tcg_cflags_has(CPUState *cpu, uint32_t flags);
+void tcg_cflags_set(CPUState *cpu, uint32_t flags);
+
+/* current cflags for hashing/comparison */
+uint32_t curr_cflags(CPUState *cpu);
+
#endif /* EXEC_TRANSLATION_BLOCK_H */
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index c13f4a7cbbf..91e742933fa 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -25,6 +25,7 @@
#include "trace.h"
#include "disas/disas.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "tcg/tcg.h"
#include "qemu/atomic.h"
#include "qemu/rcu.h"
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index d9a35b7667c..6e3f1fa92b2 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -35,6 +35,7 @@
#include "exec/exec-all.h"
#include "exec/hwaddr.h"
#include "exec/tb-flush.h"
+#include "exec/translation-block.h"
#include "gdbstub/enums.h"
#include "hw/core/cpu.h"
diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c
index ca641eb95cf..facff4175a8 100644
--- a/accel/tcg/watchpoint.c
+++ b/accel/tcg/watchpoint.c
@@ -22,6 +22,7 @@
#include "qemu/error-report.h"
#include "exec/exec-all.h"
#include "exec/translate-all.h"
+#include "exec/translation-block.h"
#include "system/tcg.h"
#include "system/replay.h"
#include "hw/core/tcg-cpu-ops.h"
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index e4bf5d5f39c..a2f8766b5c6 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -21,6 +21,7 @@
#include "trace.h"
#include "exec/log.h"
#include "exec/page-protection.h"
+#include "exec/translation-block.h"
#include "qemu.h"
#include "user-internals.h"
#include "user-mmap.h"
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1ce4c79784f..5830014b657 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -26,6 +26,7 @@
#include "tcg/startup.h"
#include "target_mman.h"
#include "exec/page-protection.h"
+#include "exec/translation-block.h"
#include <elf.h>
#include <endian.h>
#include <grp.h>
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 237f35c861a..e5be73d420a 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -28,6 +28,7 @@
#include "qapi/error.h"
#include "cpu.h"
#ifdef CONFIG_TCG
+#include "exec/translation-block.h"
#include "hw/core/tcg-cpu-ops.h"
#endif /* CONFIG_TCG */
#include "internals.h"
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
index 3132842d565..dda63f913ca 100644
--- a/target/avr/cpu.c
+++ b/target/avr/cpu.c
@@ -22,6 +22,7 @@
#include "qapi/error.h"
#include "qemu/qemu-print.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "cpu.h"
#include "disas/dis-asm.h"
#include "tcg/debug-assert.h"
diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
index 020038fc490..489d68dc50e 100644
--- a/target/hexagon/cpu.c
+++ b/target/hexagon/cpu.c
@@ -20,6 +20,7 @@
#include "cpu.h"
#include "internal.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "qapi/error.h"
#include "hw/qdev-properties.h"
#include "fpu/softfloat-helpers.h"
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index c38439c1800..c9062e60b67 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -25,6 +25,7 @@
#include "cpu.h"
#include "qemu/module.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "fpu/softfloat.h"
#include "tcg/tcg.h"
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index c5edf58421d..8bbf914c579 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -24,6 +24,7 @@
#include "qemu/hw-version.h"
#include "cpu.h"
#include "tcg/helper-tcg.h"
+#include "exec/translation-block.h"
#include "system/hvf.h"
#include "hvf/hvf-i386.h"
#include "kvm/kvm_i386.h"
diff --git a/target/i386/helper.c b/target/i386/helper.c
index a78d06c95ba..3bc15fba6ee 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -21,6 +21,7 @@
#include "qapi/qapi-events-run-state.h"
#include "cpu.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "system/runstate.h"
#ifndef CONFIG_USER_ONLY
#include "system/hw_accel.h"
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index 078766feafc..dfdd1f78602 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -15,6 +15,7 @@
#include "system/kvm.h"
#include "kvm/kvm_loongarch.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "cpu.h"
#include "internals.h"
#include "fpu/softfloat-helpers.h"
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index 710eb1146c1..a5658f1aae0 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -30,6 +30,7 @@
#include "exec/exec-all.h"
#include "exec/cpu_ldst.h"
#include "exec/gdbstub.h"
+#include "exec/translation-block.h"
#include "fpu/softfloat-helpers.h"
#include "tcg/tcg.h"
diff --git a/target/mips/tcg/exception.c b/target/mips/tcg/exception.c
index 4886d087b2e..1a8902ea1bc 100644
--- a/target/mips/tcg/exception.c
+++ b/target/mips/tcg/exception.c
@@ -24,6 +24,7 @@
#include "internal.h"
#include "exec/helper-proto.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
target_ulong exception_resume_pc(CPUMIPSState *env)
{
diff --git a/target/mips/tcg/sysemu/special_helper.c b/target/mips/tcg/sysemu/special_helper.c
index 9ce5e2ceac5..3ce3ae1e124 100644
--- a/target/mips/tcg/sysemu/special_helper.c
+++ b/target/mips/tcg/sysemu/special_helper.c
@@ -23,6 +23,7 @@
#include "cpu.h"
#include "exec/helper-proto.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "internal.h"
/* Specials */
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
index b96561d1f26..c11a09cd062 100644
--- a/target/openrisc/cpu.c
+++ b/target/openrisc/cpu.c
@@ -22,6 +22,7 @@
#include "qemu/qemu-print.h"
#include "cpu.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "fpu/softfloat-helpers.h"
#include "tcg/tcg.h"
diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
index c62c2216961..958b8c89cbf 100644
--- a/target/riscv/tcg/tcg-cpu.c
+++ b/target/riscv/tcg/tcg-cpu.c
@@ -19,6 +19,7 @@
#include "qemu/osdep.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "tcg-cpu.h"
#include "cpu.h"
#include "internals.h"
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
index 65a74ce720f..945ae6e9e50 100644
--- a/target/rx/cpu.c
+++ b/target/rx/cpu.c
@@ -23,6 +23,7 @@
#include "migration/vmstate.h"
#include "exec/exec-all.h"
#include "exec/page-protection.h"
+#include "exec/translation-block.h"
#include "hw/loader.h"
#include "fpu/softfloat.h"
#include "tcg/debug-assert.h"
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
index 8f07261dcfd..2a51d9e35c7 100644
--- a/target/sh4/cpu.c
+++ b/target/sh4/cpu.c
@@ -25,6 +25,7 @@
#include "cpu.h"
#include "migration/vmstate.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "fpu/softfloat-helpers.h"
#include "tcg/tcg.h"
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index dd7af86de73..1480571a1bf 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -23,6 +23,7 @@
#include "qemu/module.h"
#include "qemu/qemu-print.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "hw/qdev-properties.h"
#include "qapi/visitor.h"
#include "tcg/tcg.h"
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index 1a261715907..95fb546666f 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -21,6 +21,7 @@
#include "qapi/error.h"
#include "cpu.h"
#include "exec/exec-all.h"
+#include "exec/translation-block.h"
#include "qemu/error-report.h"
#include "tcg/debug-assert.h"
--
2.45.2
On 12/12/24 15:44, Philippe Mathieu-Daudé wrote: > The TranslationBlock flags are defined in 'exec/translation-block.h'. > tcg_cflags_has/set() and curr_cflags() use them, it is more logical > to declare them in the same place. Move them there too. > > Suggested-by: Richard Henderson <richard.henderson@linaro.org> > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > include/exec/cpu-common.h | 6 ------ > include/exec/translation-block.h | 6 ++++++ > accel/tcg/cpu-exec.c | 1 + > accel/tcg/tcg-accel-ops.c | 1 + > accel/tcg/watchpoint.c | 1 + > linux-user/mmap.c | 1 + > linux-user/syscall.c | 1 + > target/arm/cpu.c | 1 + > target/avr/cpu.c | 1 + > target/hexagon/cpu.c | 1 + > target/hppa/cpu.c | 1 + > target/i386/cpu.c | 1 + > target/i386/helper.c | 1 + > target/loongarch/cpu.c | 1 + > target/microblaze/cpu.c | 1 + > target/mips/tcg/exception.c | 1 + > target/mips/tcg/sysemu/special_helper.c | 1 + > target/openrisc/cpu.c | 1 + > target/riscv/tcg/tcg-cpu.c | 1 + > target/rx/cpu.c | 1 + > target/sh4/cpu.c | 1 + > target/sparc/cpu.c | 1 + > target/tricore/cpu.c | 1 + > 23 files changed, 27 insertions(+), 6 deletions(-) > > diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h > index 638dc806a5f..bdeb9d68f32 100644 > --- a/include/exec/cpu-common.h > +++ b/include/exec/cpu-common.h > @@ -187,12 +187,6 @@ void list_cpus(void); > > #ifdef CONFIG_TCG > > -bool tcg_cflags_has(CPUState *cpu, uint32_t flags); > -void tcg_cflags_set(CPUState *cpu, uint32_t flags); > - > -/* current cflags for hashing/comparison */ > -uint32_t curr_cflags(CPUState *cpu); > - > /** > * cpu_unwind_state_data: > * @cpu: the cpu context > diff --git a/include/exec/translation-block.h b/include/exec/translation-block.h > index b99afb00779..c1e48a48aab 100644 > --- a/include/exec/translation-block.h > +++ b/include/exec/translation-block.h > @@ -153,4 +153,10 @@ static inline uint32_t tb_cflags(const TranslationBlock *tb) > return qatomic_read(&tb->cflags); > } > > +bool tcg_cflags_has(CPUState *cpu, uint32_t flags); > +void tcg_cflags_set(CPUState *cpu, uint32_t flags); > + > +/* current cflags for hashing/comparison */ > +uint32_t curr_cflags(CPUState *cpu); Per this comment I suppose accel/tcg/tb-hash.h is better for curr_cflags(). Also because it is internal to accel/tcg/. > + > #endif /* EXEC_TRANSLATION_BLOCK_H */
On 12/12/24 09:00, Philippe Mathieu-Daudé wrote: > On 12/12/24 15:44, Philippe Mathieu-Daudé wrote: >> The TranslationBlock flags are defined in 'exec/translation-block.h'. >> tcg_cflags_has/set() and curr_cflags() use them, it is more logical >> to declare them in the same place. Move them there too. >> >> Suggested-by: Richard Henderson <richard.henderson@linaro.org> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> include/exec/cpu-common.h | 6 ------ >> include/exec/translation-block.h | 6 ++++++ >> accel/tcg/cpu-exec.c | 1 + >> accel/tcg/tcg-accel-ops.c | 1 + >> accel/tcg/watchpoint.c | 1 + >> linux-user/mmap.c | 1 + >> linux-user/syscall.c | 1 + >> target/arm/cpu.c | 1 + >> target/avr/cpu.c | 1 + >> target/hexagon/cpu.c | 1 + >> target/hppa/cpu.c | 1 + >> target/i386/cpu.c | 1 + >> target/i386/helper.c | 1 + >> target/loongarch/cpu.c | 1 + >> target/microblaze/cpu.c | 1 + >> target/mips/tcg/exception.c | 1 + >> target/mips/tcg/sysemu/special_helper.c | 1 + >> target/openrisc/cpu.c | 1 + >> target/riscv/tcg/tcg-cpu.c | 1 + >> target/rx/cpu.c | 1 + >> target/sh4/cpu.c | 1 + >> target/sparc/cpu.c | 1 + >> target/tricore/cpu.c | 1 + >> 23 files changed, 27 insertions(+), 6 deletions(-) >> >> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h >> index 638dc806a5f..bdeb9d68f32 100644 >> --- a/include/exec/cpu-common.h >> +++ b/include/exec/cpu-common.h >> @@ -187,12 +187,6 @@ void list_cpus(void); >> #ifdef CONFIG_TCG >> -bool tcg_cflags_has(CPUState *cpu, uint32_t flags); >> -void tcg_cflags_set(CPUState *cpu, uint32_t flags); >> - >> -/* current cflags for hashing/comparison */ >> -uint32_t curr_cflags(CPUState *cpu); >> - >> /** >> * cpu_unwind_state_data: >> * @cpu: the cpu context >> diff --git a/include/exec/translation-block.h b/include/exec/translation-block.h >> index b99afb00779..c1e48a48aab 100644 >> --- a/include/exec/translation-block.h >> +++ b/include/exec/translation-block.h >> @@ -153,4 +153,10 @@ static inline uint32_t tb_cflags(const TranslationBlock *tb) >> return qatomic_read(&tb->cflags); >> } >> +bool tcg_cflags_has(CPUState *cpu, uint32_t flags); >> +void tcg_cflags_set(CPUState *cpu, uint32_t flags); >> + >> +/* current cflags for hashing/comparison */ >> +uint32_t curr_cflags(CPUState *cpu); > > Per this comment I suppose accel/tcg/tb-hash.h is better for > curr_cflags(). Also because it is internal to accel/tcg/. Given the usage of curr_cflags() in accel/tcg/watchpoint.c, accel/tcg/internal-common.h would be the place. tb-hash.h strictly concerns the hashing itself. With that, Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
© 2016 - 2025 Red Hat, Inc.