guile-devel-internal
[Top][All Lists]
Advanced

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

Re: proper tail recursion for gcc


From: Richard Stallman
Subject: Re: proper tail recursion for gcc
Date: Fri, 1 Sep 2000 21:39:27 -0600 (MDT)

    When planning the support for tail-recursion in GCC, we should
    probably at the same time think about support for multiple return
    values.

This is a reasonable idea.  The obvious way to handle multiple values
is to pass a structure pointer argument to the function and have it
store values into the structure.  But if multiple values are common,
it is worth doing something to make them faster.  On machines that
pass arguments in registers, the first several values could be
returned in the same registers.

But on most machines, where args are passed on the stack, it is
probably only possible to return one or two args in registers anyway.
The rest would have to be handled in memory, which probably means
there is no way to do much better than the straightforward method.

The most important platform, the x86, has 3 registers which could
perhaps be used for return values.  Is it worth implementing the code
to optimize them, if it will only optimize the first 3 values for most
users?

Maybe it would be better to get the compiler working first, and then
optimize multiple values if that is worth while.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]