Teaching expression() to treat some operations specially
Jan Beulich
jbeulich@suse.com
Tue Jul 12 10:44:16 GMT 2022
On 12.07.2022 10:50, Dmitry Selyutin wrote:
> On Tue, Jul 12, 2022 at 9:57 AM Jan Beulich <jbeulich@suse.com> wrote:
>> x86 uses it only for identifier-like unary operators. So it may
>> indeed be that * doesn't presently have a way to make it to
>> md_operator() when used in unary way.
>
> Frankly speaking, md_operator is somewhat confusing. What kind of
> arguments does it expect?
> I tried defining both -- ppc_parse_name, ppc_operand and ppc_operator.
> The exact sequence of how these are called depends on many conditions.
> Let's consider this code:
>
> .set REG, %r0
> extsw REG, 2
>
> By default, I don't see any calls to ppc_operator at all, only calls
> to ppc_operand.
> If I update tc-ppc.h with `#define LEX_PCT (LEX_BEGIN_NAME)`,
> ppc_operator is called before ppc_operand.
> internals.texi lacks any information on ppc_operator, so I'm unsure
> how to use it.
> Also, it's especially confusing to see this call: `md_operator (NULL, 2, NULL)`.
>
> Is there any documentation on how md_operator works? i386_operator
> doesn't really explain it.
I don't think there's any documentation.
> I think that, to make it work, lex_type must be updated with
> LEX_BEGIN_NAME with % and * symbols.
That might be an approach, but I'd suggest trying to avoid it. Instead
I think there's another place missing where md_operator() should be
called - when an otherwise binary operator char is used as a unary
operator. I think it is wrong to call md_operand() in that case, or at
least md_operator() may want trying first. Or wait - that's actually
the only call site of md_operand(), so why again can't you deal with *
there (converting the thing to an X_md<N> expression)?
Jan
More information about the Binutils
mailing list