Subject: Re: mac68k and gcc 4
To: None <port-mac68k@NetBSD.org>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: port-mac68k
Date: 09/04/2006 14:23:12
On Mon, 4 Sep 2006, Hauke Fath wrote:

> Just a few uninformed comments...
...
> >I don't know why the clobber register spec is "fp" for ELF and "a6"
> >otherwise...
>
> The pre-ELF as(1) was considerably older (and had changes not fed back to
> GNU as) than the ELF as(1) from binutils that replaced it. What does the
> netbsd-4 info page for as(1) say?

  From what it looked like to me is that when NetBSD switched m68k to ELF,
a netbsd-specific m68kelf file was added, and someone "took the
chance" to convert "a6" to "fp".  The gcc4 compiler uses the m68kelf.h
file provided, which still used "a6".

>
> >isn't "fp" just an alias for "a6"? I tried changing it to
> >use "a6" unconditionally, but that doesn't work either:
> >
> >/usr/src.local/sys/arch/mac68k/mac68k/macrom.c: In function 'mrg_aline_super':
> >/usr/src.local/sys/arch/mac68k/mac68k/macrom.c:763: error: %a6 cannot be
> >used in asm here

  I suspect that gcc3 may never have done anything with a6/fp if present,
but gcc4, being more strict, generates an error.  I looked at the code
generated by a gcc3 compiler, and it doesn't appear to do anything
different, so I suspect that removing the a6/fp from the clobber list
won't really change anything.

> >
> >The comments say "save a6" and "restore a6", but I don't see where
> >that happens.
>
> Nor do I. Ask Allen Briggs, since according to 'cvs annotate' he added the
> comments.  ;)
>
> > They also say that it'll possibly change A6, but I don't
> >see when that would happen either.
>
> Ask Scott Reynolds, since... see above. Although Allen may be easier to reach.

  The aline traps are either routines provided by the NetBSD code, or
MacROM routines.  It's quite possible the MacROM routines could clobber
a6.  Since the old gcc3 generated code doesn't appear to have saved a6, I
suspect that nothing currently used does.  The comment about "save a6" and
"restore a6" are offset from the other comments, which leads me to suspect
the intent was to document the possible need to save/restore a6, but not
actually do it unless a need to do it showed up.

  My inclination would be to just remove the a6/fp from the clobber list,
since it doesn't seem to have actually done anything before.

--
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA