This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Better support for tailcalls
- To: dstarner98 at aasaa dot ofe dot org
- Subject: Re: Better support for tailcalls
- From: Markus Pizka <pizka at biretta dot cam dot uk dot eu dot microsoft dot com>
- Date: Tue, 08 Feb 2000 15:27:26 +0000
- CC: gcc at gcc dot gnu dot org
- Organization: Microsoft Research
- References: <3899FB60.6DB664C6@biretta.cam.uk.eu.microsoft.com> <20000206125814.A4752@x8b4e53cd.dhcp.okstate.edu>
- Reply-To: pizka at in dot tum dot de
David Starner wrote:
> On Thu, Feb 03, 2000 at 10:04:16PM +0000, Markus Pizka wrote:
> > Hello,
> >
> > to support the implementation of new front ends for gcc (especially
> > functional languages) I am highly
> > interested in integrating a fully general tailcall feature into gcc.
>
> Cool. Considering my grant proposal for adding a Scheme frontend to
> GCC, this could come in very useful.
there are a quite a lot of people feeling the same way ... but hardly any
progress
> > I wonder, has anyone succeeded, yet or is there a partial implementation
> > that could be used as a starting point?
> fgrep -ir recursive gcc-cvs | fgrep -i tail | wc
> 10 97 766
> Look in flow.c and stmt.c.
the current support for tailcall elimination is very limited as it is
restricted to
self-recursion of non-void functions only!
(correct me if I am wrong)
> > As a first step, I think it would be sufficient if the gcc back end
> > would not automatically detect
> > tailcalls but only provide a mechanism to transform a tail call
> > specified by the front end
>
> Why? Personally, I was planning on doing it (if I had to) in tree,
> as that should have all the information necessary. I don't see
> what you'd gain by having each frontend try to interpret it.
agreed. As I said, this would be a first step. Automatic detection could
be added later. The reason is, that there are languages (such as C--)
which provide and explicit tail call concept. That is a tail call - let's
say a non-local goto with arguments - is specified in the program.
To implement this concept it would be helpful to be able to explicitly
specify
a tailcall instead of a call expression which is (hopefully) optimized into
a tail call. To me, the automatic detection and application of the tail call
mechanism is an additional feature build on top of the pure mechanism.
Markus