[PATCH v3 13/19] target/microblaze: Reorg MicroBlazeCPUConfig to minimize holes

Richard Henderson posted 19 patches 5 years, 5 months ago
Maintainers: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
[PATCH v3 13/19] target/microblaze: Reorg MicroBlazeCPUConfig to minimize holes
Posted by Richard Henderson 5 years, 5 months ago
Sort the elements by type and size, removing a number of holes
and reducing the size of the entire struct.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/microblaze/cpu.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h
index 59d2a079c4..4d53345f23 100644
--- a/target/microblaze/cpu.h
+++ b/target/microblaze/cpu.h
@@ -293,13 +293,22 @@ struct CPUMBState {
 
 /*
  * Microblaze Configuration Settings
+ *
+ * Note that the structure is sorted by type and size to minimize holes.
  */
 typedef struct {
-    bool stackprot;
+    char *version;
+
     uint32_t base_vectors;
+    uint32_t pvr_user2;
+
     uint8_t addr_size;
     uint8_t use_fpu;
     uint8_t use_hw_mul;
+    uint8_t pvr_user1;
+    uint8_t pvr;
+
+    bool stackprot;
     bool use_barrel;
     bool use_div;
     bool use_msr_instr;
@@ -313,10 +322,6 @@ typedef struct {
     bool opcode_0_illegal;
     bool div_zero_exception;
     bool unaligned_exceptions;
-    uint8_t pvr_user1;
-    uint32_t pvr_user2;
-    char *version;
-    uint8_t pvr;
 } MicroBlazeCPUConfig;
 
 /**
-- 
2.25.1


Re: [PATCH v3 13/19] target/microblaze: Reorg MicroBlazeCPUConfig to minimize holes
Posted by Philippe Mathieu-Daudé 5 years, 5 months ago
On 9/4/20 9:08 PM, Richard Henderson wrote:
> Sort the elements by type and size, removing a number of holes
> and reducing the size of the entire struct.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  target/microblaze/cpu.h | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h
> index 59d2a079c4..4d53345f23 100644
> --- a/target/microblaze/cpu.h
> +++ b/target/microblaze/cpu.h
> @@ -293,13 +293,22 @@ struct CPUMBState {
>  
>  /*
>   * Microblaze Configuration Settings
> + *
> + * Note that the structure is sorted by type and size to minimize holes.
>   */
>  typedef struct {
> -    bool stackprot;
> +    char *version;
> +
>      uint32_t base_vectors;
> +    uint32_t pvr_user2;
> +
>      uint8_t addr_size;
>      uint8_t use_fpu;
>      uint8_t use_hw_mul;
> +    uint8_t pvr_user1;
> +    uint8_t pvr;
> +
> +    bool stackprot;
>      bool use_barrel;
>      bool use_div;
>      bool use_msr_instr;
> @@ -313,10 +322,6 @@ typedef struct {
>      bool opcode_0_illegal;
>      bool div_zero_exception;
>      bool unaligned_exceptions;
> -    uint8_t pvr_user1;
> -    uint32_t pvr_user2;
> -    char *version;
> -    uint8_t pvr;
>  } MicroBlazeCPUConfig;
>  
>  /**
>