This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Tail recursion optimisation


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]