[PATCH 8/8] x86: derive opcode length from opcode value
H.J. Lu
hjl.tools@gmail.com
Mon Mar 22 18:02:45 GMT 2021
On Mon, Mar 22, 2021 at 05:47:11PM +0100, Jan Beulich wrote:
> In the majority of cases we can easily determine the length from the
> encoding, irrespective of whether a prefix is specified there as well.
> We further don't even need to record the value in the table entries, as
> it's easy enough to determine it (without any guesswork, unless an insn
> with major opcode 00 appeared that requires a 2nd opcode byte to be
> specified explicitly) when installing the chosen template for further
> processing.
>
> Should an encoding appear which
> - has a major opcode byte of 66, F3, or F2,
> - requires a 2nd opcode byte to be specified explicitly,
> - doesn't have a mandatory prefix
> we'd need to convert all templates presently encoding a mandatory prefix
> this way to the Prefix_0X<nn> model to eliminate the respective guessing
> i386-gen does.
>
> gas/
> 2021-03-XX Jan Beulich <jbeulich@suse.com>
>
> * config/tc-i386.c (struct _i386_insn): New field
> opcode_length.
> (md_begin): Drop assertion.
> (install_template): New.
> (build_vex_prefix): Call install_template.
> (match_template): Likewise.
> (process_operands): Use new opcode_length field.
> (output_jump): Likewise.
> (output_insn): Likewise. Adjust psedo prefix check.
>
> opcodes/
> 2021-03-XX Jan Beulich <jbeulich@suse.com>
>
> * i386-gen.c (output_i386_opcode): Drop processing of
> opcode_length. Calculate length from base_opcode. Adjust prefix
> encoding determination.
> (process_i386_opcodes): Drop output of fake opcode_length.
> * i386-opc.h (struct insn_template): Drop opcode_length field.
> * i386-opc.tbl: Drop opcode length field from all templates.
> * i386-tbl.h: Re-generate.
>
OK. Thanks.
H.J.
More information about the Binutils
mailing list