This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: demand_empty_rest_of_line and ignore_rest_of_line
On Mon, Apr 26, 2004 at 05:51:44PM -0700, Zack Weinberg wrote:
> Uh, when I said "collapse the parsing logic together" I meant "think
> of a way to get rid of the machine-dependent parsers to the maximum
> extent possible." While thinking very carefully about how to make the
> parser go blazingly fast *without* special tricks. I'm quite
> confident this is possible. Assembly syntax - with or without extra
> added whitespace - is not complicated, nor does it vary that much
> across architectures supported by GAS.
One thing that complicates do_scrub_chars in gas, for very little gain,
is trying to remove all unneeded whitespace. For example,
foo: mov %eax, $2 + 3 + 4
is turned into
foo: mov %eax,$2+3+4
The aim being to render whitespace removal unnecessary in target
dependent code. That's a good idea until you encounter constructs like:
foo: addr16 mov %eax,0
where the "opcode" part of the instruction itself has whitespace.
Without various hacks, do_scrub_chars would turn the above into
foo: addr16 mov%eax,0
Other architectures have similar assembly constructs. So I think you
underestimate the complexity in a general parser design. Just
separating an assembly line into label, opcode, operands isn't so easy!
--
Alan Modra
IBM OzLabs - Linux Technology Centre