[PATCH] Optimize stdarg functions

Jakub Jelinek jakub@redhat.com
Tue Sep 28 00:38:00 GMT 2004


On Mon, Sep 27, 2004 at 04:24:43PM -0700, Richard Henderson wrote:
> On Mon, Sep 27, 2004 at 06:50:32PM -0400, Jakub Jelinek wrote:
> > 	* config/i386/i386.c (ix86_build_builtin_va_list): Initialize
> > 	va_list_{g,f}pr_counter_name.
> > 	(ix86_setup_incoming_varargs): Don't do anything if reg_save
> > 	area will not be used.  Only save registers that tree-stdarg.c
> > 	detected they need saving.
> 
> I think that you should do either
> 
>   (1) Ignore va_list_[fg]pr_size if va_list_escapes is true
>   (2) Remove va_list_escapes and set va_list_[fg]pr_size to UINT_MAX.
> 
> as it is, it seems like we've got redundant data, and it isn't clear
> when to use which.

I'll change va_list_escapes into an variable internal to
execute_optimize_stdarg (so that e.g. in the dump there is difference
between va_list escaping and va_arg needing all float/gpr regs).
Nothing outside of that file needs va_list_escapes, so it can be killed.
So (2).

> > +	  va_start_bb = bb;
> 
> You're not properly handling more than one va_start per function.

va_start_bb is only used if there is just one va_start:

+                     if (va_start_count == 1
+                         && reachable_at_most_once (bb, va_start_bb))
+                       compute_sizes = 1;

That one va_start () can very well be inside some loop, but has to be
just one.

> 
> The escape analysis and [fg]pr counting code is kinda messy.  Can
> you split that out into more functions?

Will try tomorrow.

	Jakub



More information about the Gcc-patches mailing list