[m-dev.] SPARC register windows & gcc -mflat

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Oct 17 03:52:42 AEST 1999


Hi,

Currently on SPARCs we make use of registers which are part of the SPARC
sliding register window set.  This complicates things a fair bit,
necessitating the use of the save_transient_registers() and
restore_transient_registers() macros in many places.

In order to avoid this, I had hoped to be able to to use the `-mflat'
option of gcc, which causes gcc to generate code which does not make
use of register window sliding, but which is still compatible with
the usual SPARC calling conventions.

I tested this out, and my preliminary tests worked fine; I built a
working version of the mercury compiler compiled with `-mflat'.
Unfortunately, however, although `-mflat' on its own works fine, it
turns out that gcc versions up to and including 2.95.1 have a bug where
`gcc -mflat -fpic' generates code that is NOT compatible with the usual
SPARC calling conventions; the generated code clobbers l7, which is
supposed to be a callee-save register.  This causes problems if you try
to mix code compiled with `-fpic' and that not compiled with `-fpic',
or code compiled with `-mflat' and that not compiled with `-mflat', or
code compiled with `gcc -mflat -fpic' and code compiled with `cc',
etc.

I have reported this bug to the gcc maintainers.  But until it is
fixed, I guess we will have to continue with the current scheme
where we do not use `-mflat'.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list