This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH 02/13] x86: drop ShortForm attribute
- From: Michael Matz <matz at suse dot de>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Jan Beulich <jbeulich at suse dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Tue, 5 Nov 2019 14:58:29 +0000 (UTC)
- Subject: Re: [PATCH 02/13] x86: drop ShortForm attribute
- References: <773baa32-a12c-5da3-32a4-3db5a424d102@suse.com> <da5eab10-c2c1-9f05-2050-cab7e7b9d9e6@suse.com> <CAMe9rOpv=DsvmY_SkXHKD+TwQB+1pE6VmxNByhy6-9FWhJJ1eA@mail.gmail.com> <162fc3af-785f-9986-88d1-bf46f8038b18@suse.com> <CAMe9rOo456u5vaTS61aa2jsHvcwmJmmgh3Jn7LObsfESbpDn5Q@mail.gmail.com>
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.