This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Tail recursion optimisation
- From: Richard Henderson <rth at redhat dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 Oct 2003 17:40:20 -0700
- Subject: Re: [tree-ssa] Tail recursion optimisation
- References: <20031017000108.GA1882@atrey.karlin.mff.cuni.cz>
On Fri, Oct 17, 2003 at 02:01:08AM +0200, Zdenek Dvorak wrote:
> * tree-cfg.c (eliminate_tail_recursion): New function.
> * tree-dump.c (dump_files): Add .tail dump.
> * tree-flow.h (eliminate_tail_recursion): Declare.
> * tree-optimize.c (optimize_function_tree): Add
> eliminate_tail_recursion call.
> * tree.h (enum tree_dump_index): Add TDI_tail.
I was just this week thinking that it'd be a good idea to try to
move the tail-call code to the tree level. I have several ideas
for how things might be structured...
> + /* Function should not be variadic. */
> + for (t = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl)); t;
> + t = TREE_CHAIN (t))
> + if (VOID_TYPE_P (TREE_VALUE (t)))
> + break;
> + if (!t)
> + return;
I wonder if we should move the setting of current_function_stdarg
from assign_parms to allocate_struct_function.
As far as the rest, I'd like to see
(1) This in a new file. Say tree-tailcall.c.
(2) The function not being named recursion specific, say,
tree_optimize_tail_calls.
(3) This monster function broken up a bit.
r~