diff mbox series

[02/10] target/hexagon: Declare hexagon_regnames[] in "cpu.h"

Message ID 20221216220539.7065-3-philmd@linaro.org
State New
Headers show
Series target/misc: Header cleanups around "cpu.h" | expand

Commit Message

Philippe Mathieu-Daudé Dec. 16, 2022, 10:05 p.m. UTC
The hexagon_regnames array has TOTAL_PER_THREAD_REGS elements.
TOTAL_PER_THREAD_REGS is defined in "cpu.h". Instead of pulling
"cpu.h" in "internal.h", move the hexagon_regnames[] declaration
to "cpu.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/hexagon/cpu.h      | 2 ++
 target/hexagon/internal.h | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Taylor Simpson Dec. 16, 2022, 10:48 p.m. UTC | #1
> -----Original Message-----
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Sent: Friday, December 16, 2022 4:06 PM
> To: qemu-devel@nongnu.org
> Cc: Daniel Henrique Barboza <danielhb413@gmail.com>; David Gibson
> <david@gibson.dropbear.id.au>; Xiaojuan Yang
> <yangxiaojuan@loongson.cn>; Mark Cave-Ayland <mark.cave-
> ayland@ilande.co.uk>; Bin Meng <bin.meng@windriver.com>; Richard
> Henderson <richard.henderson@linaro.org>; Artyom Tarasenko
> <atar4qemu@gmail.com>; Cédric Le Goater <clg@kaod.org>; Song Gao
> <gaosong@loongson.cn>; Alistair Francis <alistair.francis@wdc.com>; qemu-
> ppc@nongnu.org; Laurent Vivier <laurent@vivier.eu>; Palmer Dabbelt
> <palmer@dabbelt.com>; Taylor Simpson <tsimpson@quicinc.com>; Greg
> Kurz <groug@kaod.org>; qemu-riscv@nongnu.org; Max Filippov
> <jcmvbkbc@gmail.com>; Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 02/10] target/hexagon: Declare hexagon_regnames[] in
> "cpu.h"
> 
> The hexagon_regnames array has TOTAL_PER_THREAD_REGS elements.
> TOTAL_PER_THREAD_REGS is defined in "cpu.h". Instead of pulling "cpu.h" in
> "internal.h", move the hexagon_regnames[] declaration to "cpu.h".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  target/hexagon/cpu.h      | 2 ++
>  target/hexagon/internal.h | 2 --
>  2 files changed, 2 insertions(+), 2 deletions(-)

Why is this needed?  internal.h doesn't directly include cpu.h.

If the goal is to reduce the number of places where internal.h is included, then there would be additional changes.

If the concern is the dependence on TOTAL_PER_THREAD_REGS in internal.h, just change it to
extern const char * const hexagon_regnames[];

Thanks,
Taylor
Richard Henderson Dec. 17, 2022, 12:33 a.m. UTC | #2
On 12/16/22 14:05, Philippe Mathieu-Daudé wrote:
> The hexagon_regnames array has TOTAL_PER_THREAD_REGS elements.
> TOTAL_PER_THREAD_REGS is defined in "cpu.h". Instead of pulling
> "cpu.h" in "internal.h", move the hexagon_regnames[] declaration
> to "cpu.h".

I don't think this is correct.
I would have expected cpu.h to already be included by all users of internal.h, thus any 
formal re-inclusion of cpu.h at the top of internal.h should be a no-op.


r~
diff mbox series

Patch

diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
index 2a65a57bab..9e8cd5a257 100644
--- a/target/hexagon/cpu.h
+++ b/target/hexagon/cpu.h
@@ -178,6 +178,8 @@  typedef HexagonCPU ArchCPU;
 
 void hexagon_translate_init(void);
 
+extern const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS];
+
 #include "exec/cpu-all.h"
 
 #endif /* HEXAGON_CPU_H */
diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h
index b1bfadc3f5..1a6386e0ac 100644
--- a/target/hexagon/internal.h
+++ b/target/hexagon/internal.h
@@ -38,6 +38,4 @@  void hexagon_debug_vreg(CPUHexagonState *env, int regnum);
 void hexagon_debug_qreg(CPUHexagonState *env, int regnum);
 void hexagon_debug(CPUHexagonState *env);
 
-extern const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS];
-
 #endif