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] replace sibcall.c take 3


> On Tue, Nov 18, 2003 at 03:13:54AM +0100, Jan Hubicka wrote:
> > 	* Makefile.in (sibcall.o): Kill.
> > 	(tree-tailcall.o): Add except.h dependency
> > 	* sibcall.c: Kill.
> > 	(purge_reg_equiv_notes, purge_mem_unchanging_flag): Move to ...
> > 	* calls.c (purge_reg_equiv_notes, purge_mem_unchanging_flag) ... here.
> > 	(expand_call): Do not produce placeholders; do not deal with tail
> > 	recursion; update equivalencies after sibcall production.
> > 	* toplev.c (rest_of_handle_sibling_calls): Kill.
> > 	(rest_of_compialtion): Do not use rest_of_handle_sibling_calls.
> > 	* tree-dump.c (dump_files): Add tail2
> > 	* tree-flow.h (tree_optimize_tail_calls): Update prototype.
> > 	* tree-optimize.c (optimize_function_tree): Do tail optimization twice.
> > 	* tree-tailcall.c: Inlucde except.h
> > 	(suitable_for_tail_call_opt_p): New.
> > 	(optimize_tail_call): Add opt_tailcalls argument; optimize tailcalls.
> > 	(tree_optimize_tail_calls): Add opt_tailcalls/pass arguments.
> > 	* tree.h (CALL_EXPR_TAILCALL): New.
> > 	(tree_dump_index): Add tail2
> > 
> > 	* gcc.dg/tree-ssa/tailcall-1.c: New.
> > 	* gcc.dg/tree-ssa/tailrecursion-?.c: Rename dump
> 
> Ok for now.
> 
> > !   /* If tail call production suceeded, we need to remove REG_EQUIV notes on
> > !      arguments too, as argument area is now clobbered by the call.  */
> > !   if (tail_call_insns)
> >       {
> ...
> > !       purge_reg_equiv_notes ();
> ...
> > !       /* A sibling call sequence also may invalidate RTX_UNCHANGING_P
> > ! 	 flag of some incoming arguments MEM RTLs, because it can write into
> > ! 	 those slots.  We clear all those bits now.
> > ! 
> > ! 	 This is (slight) overkill, we could keep track of which arguments
> > ! 	 we actually write into.  */
> > !       for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
> > ! 	{
> > ! 	  if (INSN_P (insn))
> > ! 	    purge_mem_unchanging_flag (PATTERN (insn));
> > ! 	}
> 
> One of the first things I'd like you to clean up is to do this
> only once per function, rather than once per sibcall.

Yes, I want to do that next.  But in fact I originally wanted to ask
here and forgot about that...
> 
> Better yet, notice if any sibcalls exist in the statement stream
> (either via .tail2 or front-end setting the bit) and don't emit
> the notes and /u flag in the first place.
It seems to me that the notes really needs to be removed only for
sibcalls actually using memory argument.
So perhaps I can collect the information about how large portion
of argument area is clobbered and remove the flags more curefully?

Honza
> 
> 
> r~


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