[PATCH v2 31/65] MIPS: use is_whitespace()
Maciej W. Rozycki
macro@orcam.me.uk
Mon Feb 10 22:17:09 GMT 2025
On Mon, 3 Feb 2025, Maciej W. Rozycki wrote:
> > > I think this only causes obfuscation to this already messed up statement.
> > > Since there are only two cases here really ('\0' does nothing and is the
> > > only remaining possibility here, guaranteed by the loop right above) can
> > > you please rewrite this as:
> > >
> > > if (c == '.')
> > > {
> > > ...
> > > }
> > > else if (is_whitespace (c))
> > > s++;
> > >
> > > or suchlike?
> >
> > Possibly. On a similar question from Richard on aarch64 I indicated that
> > from other projects I'm working on I'm used to using switch() in such
> > cases, even if at a certain point there may be just a single case label.
> > This is to ease future addition of new further labels.
>
> This is generic MIPS assembly language syntax, which is unlikely to ever
> change, and then for the MIPS16 intruction set, which has been effectively
> a dead end for decades now, even the MIPS16e2 extension ~10 years ago was
> a huge surprise and a one-off effort due to a specific customer request,
> so we can safely assume nothing else will ever happen again here. So I
> think we need to optimise for code clarity rather than minimising highly
> unlikely future changes. Yes, you need the backend maintainer's knowledge
> to decide here.
I have made and committed this cleanup myself now.
As an upside this has let me discover and deal with a regression from my
fix in this area made years ago that caused invalid instruction mnemonics
ending with a dot to be assembled successfully as if the dot wasn't there.
I've left any conversion to `is_end_of_stmt' to a future update. At this
point I've concluded that since it wasn't made with your original commit
it makes no sense to me to do it piecemeal, so it'll be best made through
tc-mips.c in one go.
Maciej
More information about the Binutils
mailing list