This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
GCC and SPARC leaf procedures
- From: Jorge PEREZ <jorge dot perez at invia dot fr>
- To: gcc-help at gcc dot gnu dot org
- Cc: josef_ahm at yahoo dot com
- Date: Fri, 22 Oct 2010 12:03:52 +0200
- Subject: GCC and SPARC leaf procedures
Hello Josef
I was intrigued by your email since I actually think that GCC performs
the leaf procedure optimization as indicated by the SPARC V8 manual (
www.*sparc*.org/standards/*V8*.pdf p. 194)
However, note that there are certain conditions that must be met in
order to allow such optimizations, quoting the above referenced manual:
Some leaf procedures can be made to operate without their own register
window
or stack frame, using their caller’s instead. This can be done when the
candidate
leaf procedure meets all of the following conditions13:
Contains no references to %sp, except in its SAVE instruction
Contains no references to %fp
Refers to (or can be made to refer to) no more than 8 of the 32 integer
regis-
ters14, inclusive of %o7 (the “return address”).
Actually there is a good example in a recent thread
http://gcc.gnu.org/ml/gcc-help/2010-10/msg00249.html
where you can see that in the function "somme", which I think is a leaf
procedure, the SAVE and RESTORE instructions have been removed. What do
you think?
Otherwise, which GCC version are you using? I don't think that can be
related to that, but just to be sure.
Cheers,
George