[PATCH] opcodes/aarch64: make aarch64_ext_ldst_reglist()'s data[] static const

Richard Earnshaw (lists) Richard.Earnshaw@arm.com
Mon Jul 28 16:10:13 GMT 2025


On 28/07/2025 16:58, Jan Beulich wrote:
> There's no reason to have the compiler materialize such an object onto the
> stack. And there's also no reason to allow the array to be modifiable.

OK.

> ---
> I further wonder whether the struct fields being unsigned int isn't
> wasteful - unsigned char (or bool for "is_reserved") would appear to
> suffice, without negatively affecting generated code (except on
> architectures where byte loads are more expensive).

uint8_t would be fine and preferable to (unsigned) char since it's a value not a character.

I guess on some platforms sizeof(bool) could be larger than a char, but it's probably unusual.

R.

> 
> --- a/opcodes/aarch64-dis.c
> +++ b/opcodes/aarch64-dis.c
> @@ -501,7 +501,7 @@ aarch64_ext_ldst_reglist (const aarch64_
>    /* Number of elements in each structure to be loaded/stored.  */
>    unsigned expected_num = get_opcode_dependent_value (inst->opcode);
>  
> -  struct
> +  static const struct
>      {
>        unsigned is_reserved;
>        unsigned num_regs;



More information about the Binutils mailing list