Related articles |
---|
[11 earlier articles] |
Re: backend question thp@cs.ucr.edu (2002-11-24) |
Re: backend question whopkins@alpha2.csd.uwm.edu (Mark) (2002-11-24) |
Re: backend question nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-11-24) |
Re: backend question joachim_d@gmx.de (Joachim Durchholz) (2002-11-24) |
Re: backend question nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-11-26) |
Re: backend question fjh@students.cs.mu.OZ.AU (Fergus Henderson) (2002-12-01) |
Re: backend question fjh@students.cs.mu.OZ.AU (Fergus Henderson) (2002-12-01) |
Re: backend question nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-12-03) |
Re: backend question thp@cs.ucr.edu (2002-12-07) |
Backend Question mansuk@gmail.com (Suman Karumuri) (2005-10-07) |
Re: Backend Question gneuner2@comcast.net (George Neuner) (2005-10-08) |
From: | "Fergus Henderson" <fjh@students.cs.mu.OZ.AU> |
Newsgroups: | comp.compilers |
Date: | 1 Dec 2002 22:41:08 -0500 |
Organization: | Computer Science, University of Melbourne |
References: | 02-11-063 02-11-078 02-11-099 02-11-104 02-11-129 02-11-151 02-11-160 |
Keywords: | optimize, C |
Posted-Date: | 01 Dec 2002 22:41:07 EST |
"Nick Maclaren" <nmm1@cus.cam.ac.uk> writes:
>"Joachim Durchholz" <joachim_d@gmx.de> writes:
>|> felix wrote:
>|> > On the other hand several people seem to work towards providing TCO
>|> > for GCC (I just read one or two papers, though - I don't know what the
>|> > current state of affairs is).
>|>
>|> Last time I heard anything, its state was "it works but the
>|> opportunities for actually applying the optimization are quite rare". It
>|> was a long list of requirements that the C function should fulfill.
>|> The one keyword that stuck with me was setjmp/longjmp, but that was just
>|> one entry in a far-too-long-for-my-taste list of potential TCO inhibitors.
>
>Unless I have missed something fundamental, that restriction is only
>to the use of setjmp in a function being optimised to remove its
>return. Not a big deal. There is a much nastier one to do with never
>passing the address of a local variable to an external function.
At least with that one it is possible to work around it, by changing
the generated C code so that all such local variables are put inside a
local scope, and all tail calls are done by first using a "goto" to
jump outside that scope, and then doing the tail call. But this would
get very messy.
The worst restriction, IMHO, is that GCC's tail call optimization doesn't
work for position independant code.
However, there have been some improvements. For example, Andreas
Bauer has been doing some work on tail calls in GCC; with the support
of other GCC developers he has recently been able to put in place the
infrastructure needed to do tail call optimization for calls via
function pointers, and has implemented this for x86.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.