This is the mail archive of the 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: [PATCH] Disable tree-stdarg on a per-target basis

On Thu, May 26, 2005 at 12:03:49PM +0200, Eric Botcazou wrote:
> Hi,
> This patch adds a new target flag, TARGET_STDARG_OPTIMIZE_DISABLE, to make it 
> possible to disable the tree-level stdarg optimization pass, and defines it to 
> true on SPARC (I think the RTL CSE + DCE passes already eliminate as much 
> stdarg overhead as tree-stdarg would there).
> Tested on sparc-sun-solaris2.10.  OK for mainline?

I don't think extra hook is needed.

For targets which have structure type va_list, if they are interested
in the optimization, they set va_list_gpr_counter_field
or va_list_fpr_counter_field, otherwise they don't.

So the:
  /* For struct * va_list, if the backend didn't tell us what the counter fields
     are, there is nothing more we can do.  */
  if (!va_list_simple_ptr
      && va_list_gpr_counter_field == NULL_TREE
      && va_list_fpr_counter_field == NULL_TREE)
    return false;
plus copy of
  va_list_simple_ptr = POINTER_TYPE_P (va_list_type_node)
                       && (TREE_TYPE (va_list_type_node) == void_type_node
                           || TREE_TYPE (va_list_type_node) == char_type_node);
could move to gate.
Now, for the char */void * type va_list, perhaps the backend could signal
that it is going to make use of the optimization by setting
targetm.stdarg_optimize_hook to something, even if that is just
a dummy routine that returns false; unconditionally.

The only problem with doing this is that current stdarg tests contain data
even for ports that really don't make any use of this optimization
and therefore it could be disabled there (i386) or targets where it
is useful, but not implemented yet (ia64).  And it would be good if
the tests covered at least 2 different arches that have char */void *
style va_list.

> 2005-05-26  Eric Botcazou  <>
> 	* target.h (gcc_target): New field stdarg_optimize_disable.
> 	hook defaulting to false.
> 	* doc/tm.texi (Varargs): Document it.
> 	* tree-stdarg.c (gate_optimize_stdarg): Unconditionally return
> 	* config/sparc/sparc.c (TARGET_STDARG_OPTIMIZE_DISABLE): Define
> 	to true.


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