[PATCH 2/2] target/ppc: Reduce the size of ppc_spr_t

Richard Henderson posted 2 patches 4 years, 9 months ago
Maintainers: Greg Kurz <groug@kaod.org>, David Gibson <david@gibson.dropbear.id.au>
[PATCH 2/2] target/ppc: Reduce the size of ppc_spr_t
Posted by Richard Henderson 4 years, 9 months ago
We elide values when registering sprs, we might as well
save space in the array as well.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/ppc/cpu.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index e73416da68..b704261b49 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -192,17 +192,21 @@ typedef struct ppc_hash_pte64 ppc_hash_pte64_t;
 
 /* SPR access micro-ops generations callbacks */
 struct ppc_spr_t {
+    const char *name;
+    target_ulong default_value;
+#ifndef CONFIG_USER_ONLY
+    unsigned int gdb_id;
+#endif
+#ifdef CONFIG_TCG
     void (*uea_read)(DisasContext *ctx, int gpr_num, int spr_num);
     void (*uea_write)(DisasContext *ctx, int spr_num, int gpr_num);
-#if !defined(CONFIG_USER_ONLY)
+# ifndef CONFIG_USER_ONLY
     void (*oea_read)(DisasContext *ctx, int gpr_num, int spr_num);
     void (*oea_write)(DisasContext *ctx, int spr_num, int gpr_num);
     void (*hea_read)(DisasContext *ctx, int gpr_num, int spr_num);
     void (*hea_write)(DisasContext *ctx, int spr_num, int gpr_num);
-    unsigned int gdb_id;
+# endif
 #endif
-    const char *name;
-    target_ulong default_value;
 #ifdef CONFIG_KVM
     /*
      * We (ab)use the fact that all the SPRs will have ids for the
-- 
2.25.1


Re: [PATCH 2/2] target/ppc: Reduce the size of ppc_spr_t
Posted by David Gibson 4 years, 9 months ago
On Fri, Apr 30, 2021 at 07:29:23PM -0700, Richard Henderson wrote:
> We elide values when registering sprs, we might as well
> save space in the array as well.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Applied to ppc-for-6.1, thanks.

> ---
>  target/ppc/cpu.h | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index e73416da68..b704261b49 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -192,17 +192,21 @@ typedef struct ppc_hash_pte64 ppc_hash_pte64_t;
>  
>  /* SPR access micro-ops generations callbacks */
>  struct ppc_spr_t {
> +    const char *name;
> +    target_ulong default_value;
> +#ifndef CONFIG_USER_ONLY
> +    unsigned int gdb_id;
> +#endif
> +#ifdef CONFIG_TCG
>      void (*uea_read)(DisasContext *ctx, int gpr_num, int spr_num);
>      void (*uea_write)(DisasContext *ctx, int spr_num, int gpr_num);
> -#if !defined(CONFIG_USER_ONLY)
> +# ifndef CONFIG_USER_ONLY
>      void (*oea_read)(DisasContext *ctx, int gpr_num, int spr_num);
>      void (*oea_write)(DisasContext *ctx, int spr_num, int gpr_num);
>      void (*hea_read)(DisasContext *ctx, int gpr_num, int spr_num);
>      void (*hea_write)(DisasContext *ctx, int spr_num, int gpr_num);
> -    unsigned int gdb_id;
> +# endif
>  #endif
> -    const char *name;
> -    target_ulong default_value;
>  #ifdef CONFIG_KVM
>      /*
>       * We (ab)use the fact that all the SPRs will have ids for the

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson