This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Disable tree-stdarg on a per-target basis
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 26 May 2005 12:03:49 +0200
- Subject: [PATCH] Disable tree-stdarg on a per-target basis
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?
2005-05-26 Eric Botcazou <ebotcazou@libertysurf.fr>
* target.h (gcc_target): New field stdarg_optimize_disable.
* target-def.h (TARGET_STDARG_OPTIMIZE_DISABLE): New
hook defaulting to false.
(TARGET_INITIALIZER): Add it.
* doc/tm.texi (Varargs): Document it.
* tree-stdarg.c (gate_optimize_stdarg): Unconditionally return
false if TARGET_STDARG_OPTIMIZE_DISABLE.
* config/sparc/sparc.c (TARGET_STDARG_OPTIMIZE_DISABLE): Define
to true.
--
Eric Botcazou
Index: target-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target-def.h,v
retrieving revision 1.121
diff -u -p -r1.121 target-def.h
--- target-def.h 2 May 2005 16:02:22 -0000 1.121
+++ target-def.h 26 May 2005 08:56:57 -0000
@@ -386,6 +386,7 @@ Foundation, 59 Temple Place - Suite 330,
#define TARGET_DWARF_HANDLE_FRAME_UNSPEC 0
+#define TARGET_STDARG_OPTIMIZE_DISABLE false
#define TARGET_STDARG_OPTIMIZE_HOOK 0
#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_false
@@ -565,6 +566,7 @@ Foundation, 59 Temple Place - Suite 330,
TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME, \
TARGET_HANDLE_PRAGMA_EXTERN_PREFIX, \
TARGET_RELAXED_ORDERING, \
+ TARGET_STDARG_OPTIMIZE_DISABLE, \
}
#include "hooks.h"
Index: target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target.h,v
retrieving revision 1.133
diff -u -p -r1.133 target.h
--- target.h 2 May 2005 16:02:23 -0000 1.133
+++ target.h 26 May 2005 08:56:57 -0000
@@ -650,6 +650,9 @@ struct gcc_target
synchronization is explicitly requested. */
bool relaxed_ordering;
+ /* True if the tree-stdarg pass need no be run. */
+ bool stdarg_optimize_disable;
+
/* Leave the boolean fields at the end. */
};
Index: tree-stdarg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-stdarg.c,v
retrieving revision 2.4
diff -u -p -r2.4 tree-stdarg.c
--- tree-stdarg.c 28 Apr 2005 02:25:22 -0000 2.4
+++ tree-stdarg.c 26 May 2005 08:56:57 -0000
@@ -596,6 +596,9 @@ check_all_va_list_escapes (struct stdarg
static bool
gate_optimize_stdarg (void)
{
+ if (targetm.stdarg_optimize_disable)
+ return false;
+
/* This optimization is only for stdarg functions. */
return current_function_stdarg != 0;
}
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.427
diff -u -p -r1.427 tm.texi
--- doc/tm.texi 4 May 2005 16:27:21 -0000 1.427
+++ doc/tm.texi 26 May 2005 08:57:01 -0000
@@ -4685,6 +4685,11 @@ defined, then define this hook to return
Otherwise, you should not define this hook.
@end deftypefn
+@deftypefn {Target Hook} bool TARGET_STDARG_OPTIMIZE_DISABLE
+If the tree-level stdarg optimization pass need not be run, define this
+flag to @code{true}.
+@end deftypefn
+
@node Trampolines
@section Trampolines for Nested Functions
@cindex trampolines for nested functions
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.373
diff -u -p -r1.373 sparc.c
--- config/sparc/sparc.c 25 May 2005 07:03:59 -0000 1.373
+++ config/sparc/sparc.c 26 May 2005 08:57:02 -0000
@@ -518,6 +518,9 @@ static bool fpu_option_set = false;
#undef TARGET_ASM_FILE_END
#define TARGET_ASM_FILE_END sparc_file_end
+#undef TARGET_STDARG_OPTIMIZE_DISABLE
+#define TARGET_STDARG_OPTIMIZE_DISABLE true
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */