Leaf optimization/call stuff?

Richard Henderson rth@cygnus.com
Fri Apr 30 22:47:00 GMT 1999


On Thu, Apr 29, 1999 at 01:41:41PM -0700, Mark Mitchell wrote:
> Would you mind explaining what the deal is with the NO_DEFER_POP bit?
> It doesn't appear in the GCC manual, as far as I can tell, and I see
> that these macros are utterly undocumented in expr.h.  If you give me
> a bit of information, I'll at least add a commment to expr.h.

They control whether the compiler will attempt to delay the popping
of operands on targets for which this is an issue.  This would e.g.
convert

	push $0
	call foo
	addl $4, %esp
	push $0
	call foo
	addl $4, %esp

to 

	push $0
	call foo
	push $0
	call foo
	addl $8, %esp

This is something that should be possible to do much more thouroughly
on a global basis.  But it isn't trivial.  Instead, this simple
implementation has been present in the compiler since forever.

Alternately, you could call do_pending_stack_adjust before ending
the sequence.  That would probably work out slightly better in the
case you emit more than one function call.


r~



More information about the Gcc-patches mailing list