On Mon, Jul 08, 2019 at 10:21:29PM +0100, Jozef Lawrynowicz wrote:
> On Mon, 08 Jul 2019 21:14:36 +0100
> Richard Sandiford <[email protected]> wrote:
>
> > Segher Boessenkool <[email protected]> writes:
> > > 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 :-)
>
> Indeed, I did have a read through all the definitions of REGISTER_NAMES in the
> gcc/config and could not spot any cases where different register nanes
> differed
> only in their case. I didn't check it programmatically though, so it's
> not impossible I missed something..
You also haven't checked future GCC versions, for future processors ;-)
And, not all out-of-tree ports, either. Gratuitously breaking those
isn't ideal.
> > >> --- 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?
>
> It appears to be used for only two purposes (mostly via the
> "decode_reg_name" wrapper):
> - Decoding the register name in an asm spec and reporting any misuse
> - Decoding parameters passed to command line options
> Generic options using it are -fcall-used/saved-REG and -ffixed-REG
> -fstack-limit-register.
> Backends use it for target specific options such as -mfixed-range= for SPU.
> Apart from that there appears to be a single other use of it in make_decl_rtl
> to report when "register name given for non-register variable", although I
> could not immediately reproduce this myself to understand this specific case
> it
> is triggered for.
It is used for register asm, yes. This is e.g.
void f(int x)
{
int y asm("r10");
y = x;
asm ("# %0" :: "r"(y));
}
which complains
warning: ignoring 'asm' specifier for non-static local variable 'y'
(Making the declaration of y static does nothing, doesn't make it use r10
that is; adding "register" does though).
> Ok, yes a DEFHOOKPOD or similar sounds like a good idea, I'll look into this
> alternative.
What is that, like target macros? But with some indirection?
Making this target-specific sounds good, thanks Jozef.
Segher