From 8e5eb8e1b0cb2a408008a3e40e571f193917dcc8 Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Thu, 12 May 2022 10:32:11 +0300 Subject: ppc: extend opindex to 16 bits With the upcoming SVP64 extension[0] to PowerPC architecture, it became evident that PowerPC operand indices no longer fit 8 bits. This patch switches the underlying type to uint16_t, also introducing a special typedef so that any future extension goes even smoother. [0] https://libre-soc.org include/ * opcode/ppc.h (ppc_opindex_t): New typedef. (struct powerpc_opcode): Use it. (PPC_OPINDEX_MAX): Define. gas/ * write.h (struct fix): Increase size of fx_pcrel_adjust. Reorganise. * config/tc-ppc.c (insn_validate): Use ppc_opindex_t for operands. (md_assemble): Likewise. (md_apply_fix): Likewise. Mask fx_pcrel_adjust with PPC_OPINDEX_MAX. (ppc_setup_opcodes): Adjust opcode index assertion. opcodes/ * ppc-dis.c (skip_optional_operands): Use ppc_opindex_t for operand pointer. (lookup_powerpc, lookup_prefix, lookup_vle, lookup_spe2): Likewise. (print_insn_powerpc): Likewise. --- gas/write.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'gas/write.h') diff --git a/gas/write.h b/gas/write.h index 501bdd8..3e31342 100644 --- a/gas/write.h +++ b/gas/write.h @@ -52,6 +52,16 @@ struct fix /* These small fields are grouped together for compactness of this structure, and efficiency of access on some architectures. */ + /* pc-relative offset adjust (only used by some CPU specific code). + A 4-bit field would be sufficient for most uses, except for ppc + which pokes an operand table index here. Bits may be stolen + from here should that be necessary, provided PPC_OPINDEX_MAX is + adjusted suitably. */ + int fx_pcrel_adjust : 16; + + /* How many bytes are involved? */ + unsigned fx_size : 8; + /* Is this a pc-relative relocation? */ unsigned fx_pcrel : 1; @@ -73,13 +83,7 @@ struct fix unsigned fx_tcbit2 : 1; /* Spare bits. */ - unsigned fx_unused : 10; - - /* pc-relative offset adjust (only used by some CPU specific code) */ - int fx_pcrel_adjust : 8; - - /* How many bytes are involved? */ - unsigned fx_size : 8; + unsigned fx_unused : 2; bfd_reloc_code_real_type fx_r_type; -- cgit v1.1