[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] New suggestion about call convention

On Thu, Nov 07, 2002 at 01:14:41AM +0100, Antoine wrote:
> > As I said, recursive functions will be handled separately (e.g. by always
> > saving all registers used internally). Note that this does not apply to
> > tail-recursive functions (which will be translated to ordinary loops by
> > the compiler).
> Maybe I wasn't very clear. There are not only recursive fonctions. There
> can be non-trivial loops in the function call graph (e.g. A calls B 
> calls C calls A). And lots of funky stuff. Usually when you code
> something there is no requirement about "keeping the function call 
> graph clean" ;-)) So people don't bother about it...
> So you may end up with a program where lots of functions won't be
> optimized at all because of that.

No problem, there is a solution for that. If A, B and C form a loop,
you can put a `save-all' wrapper around one of them, and the loop will
be broken.

The only thing that matters is the register set of the callee; if
that set is empty, you can delete the (caller; callee) edge from the
graph, the loop vanishes, and you can handle the rest like any other
non-recursive function. Inserting a `save-all' wrapper by definition
empties the register set, so...

 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/