diff mbox series

[v2,24/26] target/arm/tcg: Inline 'exec/helper-proto.h'

Message ID 20230611085846.21415-25-philmd@linaro.org
State New
Headers show
Series target/arm/tcg: Remove inclusions of 'exec/helper-[proto/gen].h' | expand

Commit Message

Philippe Mathieu-Daudé June 11, 2023, 8:58 a.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
This mean we can extract more tcg/helper-foo.h.inc, maybe:
- gvec / simd / crypto
- exception / wfi
---
 target/arm/debug_helper.c      | 6 +++++-
 target/arm/helper.c            | 2 +-
 target/arm/tcg/crypto_helper.c | 5 ++++-
 target/arm/tcg/helper-a64.c    | 5 ++++-
 target/arm/tcg/hflags.c        | 5 ++++-
 target/arm/tcg/m_helper.c      | 5 ++++-
 target/arm/tcg/op_helper.c     | 5 ++++-
 target/arm/tcg/psci.c          | 5 ++++-
 target/arm/tcg/tlb_helper.c    | 4 +++-
 target/arm/tcg/translate.c     | 2 +-
 target/arm/tcg/vec_helper.c    | 5 ++++-
 target/arm/vfp_helper.c        | 5 ++++-
 12 files changed, 42 insertions(+), 12 deletions(-)

Comments

Richard Henderson June 14, 2023, 5:03 a.m. UTC | #1
On 6/11/23 10:58, Philippe Mathieu-Daudé wrote:
> +++ b/target/arm/tcg/vec_helper.c
> @@ -19,12 +19,15 @@
>   
>   #include "qemu/osdep.h"
>   #include "cpu.h"
> -#include "exec/helper-proto.h"
>   #include "tcg/tcg-gvec-desc.h"
>   #include "fpu/softfloat.h"
>   #include "qemu/int128.h"
>   #include "vec_internal.h"
>   
> +#define HELPER_H "helper.h"
> +#include "exec/helper-proto.h.inc"
> +#undef  HELPER_H
> +
>   #define HELPER_H "tcg/helper-vfp.h.inc"
>   #include "exec/helper-proto.h.inc"
>   #undef  HELPER_H
> diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
> index cbd78cc810..51f8e92ff7 100644
> --- a/target/arm/vfp_helper.c
> +++ b/target/arm/vfp_helper.c
> @@ -19,7 +19,6 @@
>   
>   #include "qemu/osdep.h"
>   #include "cpu.h"
> -#include "exec/helper-proto.h"
>   #include "internals.h"
>   #ifdef CONFIG_TCG
>   #include "qemu/log.h"
> @@ -32,6 +31,10 @@
>   
>   #ifdef CONFIG_TCG
>   
> +#define HELPER_H "helper.h"
> +#include "exec/helper-proto.h.inc"
> +#undef  HELPER_H
> +
>   #define HELPER_H "tcg/helper-vfp.h.inc"
>   #include "exec/helper-proto.h.inc"
>   #undef  HELPER_H

Are these really required, or are you simply replacing what you removed?

r~
Philippe Mathieu-Daudé June 14, 2023, 12:50 p.m. UTC | #2
On 14/6/23 07:03, Richard Henderson wrote:
> On 6/11/23 10:58, Philippe Mathieu-Daudé wrote:
>> +++ b/target/arm/tcg/vec_helper.c
>> @@ -19,12 +19,15 @@
>>   #include "qemu/osdep.h"
>>   #include "cpu.h"
>> -#include "exec/helper-proto.h"
>>   #include "tcg/tcg-gvec-desc.h"
>>   #include "fpu/softfloat.h"
>>   #include "qemu/int128.h"
>>   #include "vec_internal.h"
>> +#define HELPER_H "helper.h"
>> +#include "exec/helper-proto.h.inc"
>> +#undef  HELPER_H
>> +
>>   #define HELPER_H "tcg/helper-vfp.h.inc"
>>   #include "exec/helper-proto.h.inc"
>>   #undef  HELPER_H
>> diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
>> index cbd78cc810..51f8e92ff7 100644
>> --- a/target/arm/vfp_helper.c
>> +++ b/target/arm/vfp_helper.c
>> @@ -19,7 +19,6 @@
>>   #include "qemu/osdep.h"
>>   #include "cpu.h"
>> -#include "exec/helper-proto.h"
>>   #include "internals.h"
>>   #ifdef CONFIG_TCG
>>   #include "qemu/log.h"
>> @@ -32,6 +31,10 @@
>>   #ifdef CONFIG_TCG
>> +#define HELPER_H "helper.h"
>> +#include "exec/helper-proto.h.inc"
>> +#undef  HELPER_H
>> +
>>   #define HELPER_H "tcg/helper-vfp.h.inc"
>>   #include "exec/helper-proto.h.inc"
>>   #undef  HELPER_H
> 
> Are these really required, or are you simply replacing what you removed?

We get:

../../target/arm/tcg/vec_helper.c:268:6: error: no previous prototype 
for function 'helper_gvec_qrdmlah_s16' [-Werror,-Wmissing-prototypes]
../../target/arm/tcg/vec_helper.c:293:6: error: no previous prototype 
for function 'helper_gvec_qrdmlsh_s16' [-Werror,-Wmissing-prototypes]
...

../../target/arm/vfp_helper.c:511:10: error: no previous prototype for 
function 'helper_set_rmode' [-Werror,-Wmissing-prototypes]
../../target/arm/vfp_helper.c:1127:10: error: no previous prototype for 
function 'helper_fjcvtzs' [-Werror,-Wmissing-prototypes]
...

../../target/arm/tcg/m_helper.c:581:9: error: call to undeclared 
function 'helper_exception_internal'; ISO C99 and later do not support 
implicit function declarations [-Wimplicit-function-declaration]

../../target/arm/tcg/helper-a64.c:831:9: error: call to undeclared 
function 'helper_rebuild_hflags_a32'; ISO C99 and later do not support 
implicit function declarations [-Wimplicit-function-declaration]

../../target/arm/tcg/psci.c:174:9: error: call to undeclared function 
'helper_wfi'; ISO C99 and later do not support implicit function 
declarations [-Wimplicit-function-declaration]

../../target/arm/tcg/tlb_helper.c:168:6: error: no previous prototype 
for function 'helper_exception_pc_alignment' [-Werror,-Wmissing-prototypes]

../../target/arm/tcg/crypto_helper.c:73:12: error: function cannot 
return function type 'void (void *, void *, void *, uint32_t)' (aka 
'void (void *, void *, void *, unsigned int)')
void HELPER(crypto_aese)(void *vd, void *vn, void *vm, uint32_t desc)

Do we need more tcg/helper-foo.h.inc?
- gvec / simd / crypto
- exception / wfi
Richard Henderson June 14, 2023, 1:34 p.m. UTC | #3
On 6/14/23 14:50, Philippe Mathieu-Daudé wrote:
> We get:
> 
> ../../target/arm/tcg/vec_helper.c:268:6: error: no previous prototype for function 
> 'helper_gvec_qrdmlah_s16' [-Werror,-Wmissing-prototypes]
> ../../target/arm/tcg/vec_helper.c:293:6: error: no previous prototype for function 
> 'helper_gvec_qrdmlsh_s16' [-Werror,-Wmissing-prototypes]
> ...
> 
> ../../target/arm/vfp_helper.c:511:10: error: no previous prototype for function 
> 'helper_set_rmode' [-Werror,-Wmissing-prototypes]
> ../../target/arm/vfp_helper.c:1127:10: error: no previous prototype for function 
> 'helper_fjcvtzs' [-Werror,-Wmissing-prototypes]
> ...
> 
> ../../target/arm/tcg/m_helper.c:581:9: error: call to undeclared function 
> 'helper_exception_internal'; ISO C99 and later do not support implicit function 
> declarations [-Wimplicit-function-declaration]
> 
> ../../target/arm/tcg/helper-a64.c:831:9: error: call to undeclared function 
> 'helper_rebuild_hflags_a32'; ISO C99 and later do not support implicit function 
> declarations [-Wimplicit-function-declaration]
> 
> ../../target/arm/tcg/psci.c:174:9: error: call to undeclared function 'helper_wfi'; ISO 
> C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> 
> ../../target/arm/tcg/tlb_helper.c:168:6: error: no previous prototype for function 
> 'helper_exception_pc_alignment' [-Werror,-Wmissing-prototypes]
> 
> ../../target/arm/tcg/crypto_helper.c:73:12: error: function cannot return function type 
> 'void (void *, void *, void *, uint32_t)' (aka 'void (void *, void *, void *, unsigned int)')
> void HELPER(crypto_aese)(void *vd, void *vn, void *vm, uint32_t desc)
> 
> Do we need more tcg/helper-foo.h.inc?
> - gvec / simd / crypto
> - exception / wfi

crypto, pauth, mte, for sure.

gvec could go with vfp.
fjcvtzs is definitely vfp.

I doubt a separate header for exceptions would pay off.


r~
diff mbox series

Patch

diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
index 8362462a07..31165b92a5 100644
--- a/target/arm/debug_helper.c
+++ b/target/arm/debug_helper.c
@@ -11,10 +11,14 @@ 
 #include "internals.h"
 #include "cpregs.h"
 #include "exec/exec-all.h"
-#include "exec/helper-proto.h"
 #include "sysemu/tcg.h"
 
 #ifdef CONFIG_TCG
+
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 /* Return the Exception Level targeted by debug exceptions. */
 static int arm_debug_target_el(CPUARMState *env)
 {
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 89ee68893f..523f7b7765 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11,7 +11,6 @@ 
 #include "trace.h"
 #include "cpu.h"
 #include "internals.h"
-#include "exec/helper-proto.h"
 #include "qemu/main-loop.h"
 #include "qemu/timer.h"
 #include "qemu/bitops.h"
@@ -28,6 +27,7 @@ 
 #ifdef CONFIG_TCG
 
 #define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
 #include "exec/helper-gen.h.inc"
 #undef  HELPER_H
 
diff --git a/target/arm/tcg/crypto_helper.c b/target/arm/tcg/crypto_helper.c
index d28690321f..1b6b105527 100644
--- a/target/arm/tcg/crypto_helper.c
+++ b/target/arm/tcg/crypto_helper.c
@@ -12,12 +12,15 @@ 
 #include "qemu/osdep.h"
 
 #include "cpu.h"
-#include "exec/helper-proto.h"
 #include "tcg/tcg-gvec-desc.h"
 #include "crypto/aes.h"
 #include "crypto/sm4.h"
 #include "vec_internal.h"
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 union CRYPTO_STATE {
     uint8_t    bytes[16];
     uint32_t   words[4];
diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
index 86133c6e0d..56c2f01532 100644
--- a/target/arm/tcg/helper-a64.c
+++ b/target/arm/tcg/helper-a64.c
@@ -21,7 +21,6 @@ 
 #include "qemu/units.h"
 #include "cpu.h"
 #include "gdbstub/helpers.h"
-#include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
@@ -35,6 +34,10 @@ 
 #include "fpu/softfloat.h"
 #include <zlib.h> /* For crc32 */
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 #define HELPER_H "tcg/helper-a64.h.inc"
 #include "exec/helper-proto.h.inc"
 #undef  HELPER_H
diff --git a/target/arm/tcg/hflags.c b/target/arm/tcg/hflags.c
index 616c5fa723..83a1aa08e4 100644
--- a/target/arm/tcg/hflags.c
+++ b/target/arm/tcg/hflags.c
@@ -8,9 +8,12 @@ 
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "internals.h"
-#include "exec/helper-proto.h"
 #include "cpregs.h"
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 static inline bool fgt_svc(CPUARMState *env, int el)
 {
     /*
diff --git a/target/arm/tcg/m_helper.c b/target/arm/tcg/m_helper.c
index 45568d96bb..1991eafe05 100644
--- a/target/arm/tcg/m_helper.c
+++ b/target/arm/tcg/m_helper.c
@@ -10,7 +10,6 @@ 
 #include "cpu.h"
 #include "internals.h"
 #include "gdbstub/helpers.h"
-#include "exec/helper-proto.h"
 #include "qemu/main-loop.h"
 #include "qemu/bitops.h"
 #include "qemu/log.h"
@@ -25,6 +24,10 @@ 
 #include "exec/helper-proto.h.inc"
 #undef  HELPER_H
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
                          uint32_t reg, uint32_t val)
 {
diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c
index 04a90e3e3a..24205074cc 100644
--- a/target/arm/tcg/op_helper.c
+++ b/target/arm/tcg/op_helper.c
@@ -19,12 +19,15 @@ 
 #include "qemu/osdep.h"
 #include "qemu/main-loop.h"
 #include "cpu.h"
-#include "exec/helper-proto.h"
 #include "internals.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "cpregs.h"
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 #define SIGNBIT (uint32_t)0x80000000
 #define SIGNBIT64 ((uint64_t)1 << 63)
 
diff --git a/target/arm/tcg/psci.c b/target/arm/tcg/psci.c
index 6c1239bb96..2822a6b96a 100644
--- a/target/arm/tcg/psci.c
+++ b/target/arm/tcg/psci.c
@@ -18,13 +18,16 @@ 
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "exec/helper-proto.h"
 #include "kvm-consts.h"
 #include "qemu/main-loop.h"
 #include "sysemu/runstate.h"
 #include "internals.h"
 #include "arm-powerctl.h"
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 bool arm_is_psci_call(ARMCPU *cpu, int excp_type)
 {
     /*
diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c
index 8df36c2cbf..e663aef2fd 100644
--- a/target/arm/tcg/tlb_helper.c
+++ b/target/arm/tcg/tlb_helper.c
@@ -9,8 +9,10 @@ 
 #include "cpu.h"
 #include "internals.h"
 #include "exec/exec-all.h"
-#include "exec/helper-proto.h"
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
 
 /*
  * Returns true if the stage 1 translation regime is using LPAE format page
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index 0e692f45f8..fc7a2804f7 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -27,7 +27,6 @@ 
 #include "arm_ldst.h"
 #include "semihosting/semihost.h"
 #include "cpregs.h"
-#include "exec/helper-proto.h"
 
 #define HELPER_H "tcg/helper-neon.h.inc"
 #include "exec/helper-gen.h.inc"
@@ -43,6 +42,7 @@ 
 #undef  HELPER_H
 
 #define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
index 9dd7e0f5e1..325a231de9 100644
--- a/target/arm/tcg/vec_helper.c
+++ b/target/arm/tcg/vec_helper.c
@@ -19,12 +19,15 @@ 
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "exec/helper-proto.h"
 #include "tcg/tcg-gvec-desc.h"
 #include "fpu/softfloat.h"
 #include "qemu/int128.h"
 #include "vec_internal.h"
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 #define HELPER_H "tcg/helper-vfp.h.inc"
 #include "exec/helper-proto.h.inc"
 #undef  HELPER_H
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
index cbd78cc810..51f8e92ff7 100644
--- a/target/arm/vfp_helper.c
+++ b/target/arm/vfp_helper.c
@@ -19,7 +19,6 @@ 
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "exec/helper-proto.h"
 #include "internals.h"
 #ifdef CONFIG_TCG
 #include "qemu/log.h"
@@ -32,6 +31,10 @@ 
 
 #ifdef CONFIG_TCG
 
+#define HELPER_H "helper.h"
+#include "exec/helper-proto.h.inc"
+#undef  HELPER_H
+
 #define HELPER_H "tcg/helper-vfp.h.inc"
 #include "exec/helper-proto.h.inc"
 #undef  HELPER_H