This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Allow case-insensitive comparisons of register names by implementing CASE_INSENSITIVE_REGISTER_NAMES PR target/70320
- From: Jozef Lawrynowicz <jozef dot l at mittosystems dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Sandiford <richard dot sandiford at arm dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, segher at kernel dot crashing dot org
- Date: Fri, 19 Jul 2019 11:17:51 +0100
- Subject: Re: [PATCH] Allow case-insensitive comparisons of register names by implementing CASE_INSENSITIVE_REGISTER_NAMES PR target/70320
- References: <20190718204538.63c2260f@jozef-kubuntu> <firstname.lastname@example.org> <20190719103952.02de67cf@jozef-kubuntu> <20190719095443.GU2125@tucnak>
On Fri, 19 Jul 2019 11:54:43 +0200
Jakub Jelinek <email@example.com> wrote:
> On Fri, Jul 19, 2019 at 10:39:52AM +0100, Jozef Lawrynowicz wrote:
> > > > 2019-07-18 Jozef Lawrynowicz <firstname.lastname@example.org>
> > > >
> > > > PR target/70320
> > > > * doc/tm.texi.in: Document new macro CASE_INSENSITIVE_REGISTER_NAMES.
> > > > * doc/tm.texi: Likewise.
> > > > * defaults.h: Define CASE_INSENSITIVE_REGISTER_NAMES to 0.
> > > > * config/msp430/msp430.h: Define CASE_INSENSITIVE_REGISTER_NAMES to 1.
> > > > * varasm.c (decode_reg_name_and_count): Use strcasecmp instead of
> > > > strcmp for comparisons of asmspec with a register name if
> > > > CASE_INSENSITIVE_REGISTER_NAMES is defined to 1.
> Ugh, do we really need this? If it is just for msp430, can't it instead
> #define ADDITIONAL_REGISTER_NAMES macro and add those 16 "rN" register name
> aliases to the current REGISTER_NAMES "RN" names?
That is something I considered in previous discussion here:
But it seemed like this could potentially be a useful feature for other targets
that wish to enable it. It doesn't appear necessary to restrict the case of
register names, unless a target exists that has different registers that differ
only by case.
It makes the programmer's life easier IMO and gives them more choice as to how
they style their code. You can already use the register number alone without a
prefix (i.e. "9" instead of "r9"), this seems like a natural extension to that
As far as I can tell the exact register names for the different targets aren't
documented anywhere either. The MSP430 ABI, at least, doesn't explicitly
enforce a case for the register names. I would imagine there are others that