Teaching expression() to treat some operations specially

Dmitry Selyutin ghostmansd@gmail.com
Tue Jul 12 08:50:06 GMT 2022


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 think that, to make it work, lex_type must be updated with
LEX_BEGIN_NAME with % and * symbols.
But, considering the current depths of my knowledge for this code,
these are mostly guesses.


-- 
Best regards,
Dmitry Selyutin


More information about the Binutils mailing list