This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Allow case-insensitive comparisons of register names by implementing CASE_INSENSITIVE_REGISTER_NAMES PR target/70320


On Fri, 19 Jul 2019 11:54:43 +0200
Jakub Jelinek <jakub@redhat.com> wrote:

> On Fri, Jul 19, 2019 at 10:39:52AM +0100, Jozef Lawrynowicz wrote:
> > > > 2019-07-18  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> > > >
> > > > 	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
> just
> #define ADDITIONAL_REGISTER_NAMES macro and add those 16 "rN" register name
> aliases to the current REGISTER_NAMES "RN" names?
> 
> 	Jakub

That is something I considered in previous discussion here:
https://gcc.gnu.org/ml/gcc-patches/2019-07/msg00372.html

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
flexibility.

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
don't either.

Jozef


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]