This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch] Add option ftree-stdarg-opt
- From: Tom de Vries <Tom_deVries at mentor dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 17 Feb 2015 13:12:12 +0100
- Subject: [Patch] Add option ftree-stdarg-opt
- Authentication-results: sourceware.org; auth=none
Hi,
this patch adds option ftree-stdarg-opt, which switches pass_stdarg on or off.
Pass_stdarg does an optimization on cfun->va_list_gpr/fpr_size, and since it's
an optimization, it's useful to be able to switch it off in case of a problem
with the pass.
This is not a regression or documentation fix, so it doesn't classify as a stage
4 patch. I could imagine it still being included in stage4 because it adds the
possibility for a workaround in case of problems.
Bootstrapped and reg-tested on x86_64.
OK for stage1 (or even stage 4)?
Thanks,
- Tom
2015-02-17 Tom de Vries <tom@codesourcery.com>
* common.opt (ftree-stdarg-opt): New option.
* tree-stdarg.c (pass_stdarg::gate): Use flag_tree_stdarg_opt.
---
gcc/common.opt | 4 ++++
gcc/tree-stdarg.c | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index 0c60e84..ed14b40 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2065,6 +2065,10 @@ fssa-phiopt
Common Report Var(flag_ssa_phiopt) Optimization
Optimize conditional patterns using SSA PHI nodes
+ftree-stdarg-opt
+Common Report Var(flag_tree_stdarg_opt) Init(1) Optimization
+Optimize amount of stdarg registers saved to stack at start of function
+
fvariable-expansion-in-unroller
Common Report Var(flag_variable_expansion_in_unroller) Optimization
Apply variable expansion when loops are unrolled
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 2cf0ca3..975ff97 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -704,8 +704,9 @@ public:
/* opt_pass methods: */
virtual bool gate (function *fun)
{
- /* This optimization is only for stdarg functions. */
- return fun->stdarg != 0;
+ return (flag_tree_stdarg_opt
+ /* This optimization is only for stdarg functions. */
+ && fun->stdarg != 0);
}
virtual unsigned int execute (function *);
--
1.9.1