[m68k] asm regression with 3.3/3.4/3.5

Dave Korn dk@artimi.com
Thu May 13 11:25:00 GMT 2004

> -----Original Message-----
> From: gcc-owner On Behalf Of Andreas Schwab
> Sent: 12 May 2004 21:10

> Ian Lance Taylor writes:
> > Specifying register asm() only means that any reference to that
> > variable will use the specified register.  It doesn't mean that gcc
> > can't eliminate use of that variable.  Read the documentation about
> > local register variables.  In particular, note this:
> >     This option does not guarantee that GCC will generate code that
> >     has this variable in the register you specify at all times.  You
> >     may not code an explicit reference to this register in an `asm'
> >     statement and assume it will always refer to this variable.
> Glibc depends heavily on being able to force a specific register to be
> able to do inline syscalls.

  Hmm.  I think two orthogonal concepts are colliding here.

  'Forcing a value into a certain register at a particular time' isn't quite
the same thing as 'Ensuring a (hard asm register) variable is never spilled
during its lifetime'.

  My reading of the documentation quoted above is that although gcc will
assign a particular hard reg to a variable when that variable is live,
there's no promise that it won't be spilled and reloaded at unpredictable
moments, in between which the value won't be in the register any more and
gcc might reallocate that register (temporarily) for other purposes.

  OTOH the problem of getting a value forced into the right register in an
inline asm is one which I think can indeed most easily be solved by having
specialized constraint letters for individual registers and leaving reload
to take care of the details.

  Note that it's not quite as bad as Peter and Gabriel suggest (elsewhere in
this thread), since there probably isn't a need to allow every single
register to be specified.  Frex, with the Amiga ABI (case in hand), you'd
only need constraint letters to specify d0, d1, a0, a1 and a6, I think.

Can't think of a witty .sigline today....

More information about the Gcc mailing list