[PATCH 02/13] x86: drop ShortForm attribute

Michael Matz matz@suse.de
Tue Nov 5 14:58:00 GMT 2019


Hi,

On Mon, 4 Nov 2019, H.J. Lu wrote:

> > >> +static bfd_boolean
> > >> +is_short_form (const insn_template *t)
> > >> +{
> > >> +  unsigned int op, num_reg;
> > >> +
> > >> +  if (t->opcode_modifier.modrm || t->operands > 2)
> > >> +    return FALSE;
> > >> +
> > >> +  for (num_reg = op = 0; op < t->operands; ++op)
> > >> +    if (t->operand_types[op].bitfield.reg)
> > >> +      ++num_reg;
> > >> +
> > >> +  return num_reg == 1;
> > >> +}
> > >> +
> > >
> > > So this replaces a bit check with a function.   What is the real advantage?
> >
> > Space savings - one bit per template, which sums up with the large
> > number of templates there are.
> >
> 
> Is that really necessary?

If I may add an opinion: to me the memory space savings in the tables 
aren't the important part, but rather the savings in textual clutter in 
i386-opc.tbl.  The latter makes it so that it's very easy to overlook 
something (either the attribute missing, or invalidly there for certain 
instructions), so everything that can be instead computed (quickly) from 
other information should be computed.

FWIW, whenever I look at that file and see the usual marvel

  No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf

I cringe, and wonder why it isn't simply No_bwlsqldSuf (or, in this 
specific case 'No_Suf' as these are all No_?Suf flags).  Now, back to 
under my stone :)


Ciao,
Michael.



More information about the Binutils mailing list