forcing tail/sibling call optimization

Travis Moulton Travis.Moulton@motorola.com
Mon Nov 27 13:02:00 GMT 2000


Harvey,
> The caller of xyz (call it f) would have to jump to xyz.  The caller
> of f is going to pop f's args when f returns.  How is the caller
> going to pop off the right amount of space after f's effectively
> changed the amount of space that it's using?  If xyz uses the same
> amount of stack space as f, then it's possible.  The nature of the
> specific instructions used for manipulating the stack could make it
> possible.  But I don't see how it can work in general.

The standard method when hand-coding asm is if f takes as many or more 
arguments than xyz, then f overwrites it's arguments.  f may leave 
some of its arguments untouched if xyz takes fewer args.  In the event 
that xyz takes more arguments than f, you're best to make a normal 
call not a tail call.  I assume the same is applicable to the gcc.

	-Travis Moulton





More information about the Gcc mailing list