This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Perform case-insensitive comparison when decoding register names (PR target/70320)
- From: Richard Sandiford <richard dot sandiford at arm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: Jozef Lawrynowicz <jozef dot l at mittosystems dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 08 Jul 2019 21:14:36 +0100
- Subject: Re: [PATCH] Perform case-insensitive comparison when decoding register names (PR target/70320)
- References: <20190704133259.3a063d91@jozef-kubuntu> <20190704224416.GG18316@gate.crashing.org>
Segher Boessenkool <email@example.com> writes:
> On Thu, Jul 04, 2019 at 01:32:59PM +0100, Jozef Lawrynowicz wrote:
>> The attached patch allows the case of register names used in an asm statement
>> clobber list to be disregarded when checking the validity of the register names.
>> Currently, the register name used in asm statement clobber list must exactly
>> match those defined in the targets REGISTER_NAMES macro.
>> All the register names defined in the msp430 REGISTER_NAMES macro use an
>> upper case 'R', so use of lower case 'r' gets rejected.
>> I guess this could also be fixed by defining all the registers in
>> ADDITIONAL_REGISTER_NAMES using a lower case r, but I prefer this generic
>> solution and I cannot think of any negative side effects to what is proposed.
> It isn't obviously safe either. Are there any targets that have names
> for different registers that differ only in case? You could say that
> such a design deserves what is coming for it, but :-)
>> --- a/gcc/varasm.c
>> +++ b/gcc/varasm.c
>> @@ -947,7 +947,7 @@ decode_reg_name_and_count (const char *asmspec, int *pnregs)
> This is used for more than just clobber lists. Is this change safe, and
> a good thing, in the other contexts where it changes things?
>> - if (!strcmp (asmspec, "memory"))
>> + if (!strcasecmp (asmspec, "memory"))
>> return -4;
>> - if (!strcmp (asmspec, "cc"))
>> + if (!strcasecmp (asmspec, "cc"))
>> return -3;
> You don't need to change these.
Agreed. There's also the problem that if we make this available for
all targets now, people might start using it without realising that
it implicitly requires GCC 10+.
But having the feature opt-in (by a DEFHOOKPOD?) sounds good, and
definitely more maintainable than having to add aliases in the