[PATCH 23/29] target/arm/tcg/translate: extract helper64 info in translate-a64

Pierrick Bouvier posted 29 patches 1 month ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, Brian Cain <brian.cain@oss.qualcomm.com>, Helge Deller <deller@gmx.de>, Zhao Liu <zhao1.liu@intel.com>, Eduardo Habkost <eduardo@habkost.net>, Song Gao <gaosong@loongson.cn>, Laurent Vivier <laurent@vivier.eu>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <arikalo@gmail.com>, Stafford Horne <shorne@gmail.com>, Nicholas Piggin <npiggin@gmail.com>, Chinmay Rath <rathc@linux.ibm.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <yoshinori.sato@nifty.com>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@rumtueddeln.de>, Max Filippov <jcmvbkbc@gmail.com>
There is a newer version of this series
[PATCH 23/29] target/arm/tcg/translate: extract helper64 info in translate-a64
Posted by Pierrick Bouvier 1 month ago
Thanks to HAS_HELPER64 mechanism, we can now move helper info generation
to a translate-a64 for 64 bits helper.
This allows to get rid of TARGET_AARCH64 in translate.c.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 target/arm/tcg/translate-a64.c | 7 +++++++
 target/arm/tcg/translate.c     | 9 ---------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index b7a8e94b937..fed2eb18f13 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -26,6 +26,13 @@
 #include "semihosting/semihost.h"
 #include "cpregs.h"
 
+#define HAS_HELPER64
+#include "exec/helper-proto.h"
+
+#define HELPER_H "helper64.h"
+#include "exec/helper-info.c.inc"
+#undef  HELPER_H
+
 static TCGv_i64 cpu_X[32];
 static TCGv_i64 cpu_gcspr[4];
 static TCGv_i64 cpu_pc;
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index 5c496f42c55..ec4358ba402 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -26,9 +26,6 @@
 #include "arm_ldst.h"
 #include "semihosting/semihost.h"
 #include "cpregs.h"
-#ifdef TARGET_AARCH64
-#define HAS_HELPER64
-#endif
 #include "exec/helper-proto.h"
 #include "exec/target_page.h"
 
@@ -36,12 +33,6 @@
 #include "exec/helper-info.c.inc"
 #undef  HELPER_H
 
-#ifdef TARGET_AARCH64
-#define HELPER_H "helper64.h"
-#include "exec/helper-info.c.inc"
-#undef  HELPER_H
-#endif
-
 #define ENABLE_ARCH_4T    arm_dc_feature(s, ARM_FEATURE_V4T)
 #define ENABLE_ARCH_5     arm_dc_feature(s, ARM_FEATURE_V5)
 /* currently all emulated v5 cores are also v5TE, so don't bother */
-- 
2.47.3
Re: [PATCH 23/29] target/arm/tcg/translate: extract helper64 info in translate-a64
Posted by Richard Henderson 1 month ago
On 1/9/26 16:31, Pierrick Bouvier wrote:
> Thanks to HAS_HELPER64 mechanism, we can now move helper info generation
> to a translate-a64 for 64 bits helper.
> This allows to get rid of TARGET_AARCH64 in translate.c.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   target/arm/tcg/translate-a64.c | 7 +++++++
>   target/arm/tcg/translate.c     | 9 ---------
>   2 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
> index b7a8e94b937..fed2eb18f13 100644
> --- a/target/arm/tcg/translate-a64.c
> +++ b/target/arm/tcg/translate-a64.c
> @@ -26,6 +26,13 @@
>   #include "semihosting/semihost.h"
>   #include "cpregs.h"
>   
> +#define HAS_HELPER64
> +#include "exec/helper-proto.h"
> +
> +#define HELPER_H "helper64.h"
> +#include "exec/helper-info.c.inc"
> +#undef  HELPER_H
> +
>   static TCGv_i64 cpu_X[32];
>   static TCGv_i64 cpu_gcspr[4];
>   static TCGv_i64 cpu_pc;
> diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
> index 5c496f42c55..ec4358ba402 100644
> --- a/target/arm/tcg/translate.c
> +++ b/target/arm/tcg/translate.c
> @@ -26,9 +26,6 @@
>   #include "arm_ldst.h"
>   #include "semihosting/semihost.h"
>   #include "cpregs.h"
> -#ifdef TARGET_AARCH64
> -#define HAS_HELPER64
> -#endif
>   #include "exec/helper-proto.h"
>   #include "exec/target_page.h"
>   
> @@ -36,12 +33,6 @@
>   #include "exec/helper-info.c.inc"
>   #undef  HELPER_H
>   
> -#ifdef TARGET_AARCH64
> -#define HELPER_H "helper64.h"
> -#include "exec/helper-info.c.inc"
> -#undef  HELPER_H
> -#endif
> -
>   #define ENABLE_ARCH_4T    arm_dc_feature(s, ARM_FEATURE_V4T)
>   #define ENABLE_ARCH_5     arm_dc_feature(s, ARM_FEATURE_V5)
>   /* currently all emulated v5 cores are also v5TE, so don't bother */

This is the sort of thing I envisioned for HELPER_H way back when.
The patch set could be improved by placing the helper64.h usage into translate-a64.c in 
the first place, rather than moving it here.


r~