On 19-02-15 11:29, Tom de Vries wrote:
Hi,
I'm posting this patch series for stage1:
- 0001-Disable-lang_hooks.gimplify_expr-in-free_lang_data.patch
- 0002-Add-gimple_find_sub_bbs.patch
- 0003-Factor-optimize_va_list_gpr_fpr_size-out-of-pass_std.patch
- 0004-Handle-internal_fn-in-operand_equal_p.patch
- 0005-Postpone-expanding-va_arg-until-pass_stdarg.patch
The patch series - based on Michael's initial patch - postpones expanding va_arg
until pass_stdarg, which makes pass_stdarg more robust.
Bootstrapped and reg-tested on x86_64 using all languages, with unix/ and
unix/-m32 testing.
I'll post the patches in reply to this email.
This patch factors optimize_va_list_gpr_fpr_size out of pass_stdarg::execute.
Now that we're adding more functionality in pass_stdarg, it's cleaner and
clearer to move the optimization to its own function.
OK for stage1?
Thanks,
- Tom
2015-02-17 Tom de Vries <t...@codesourcery.com>
* tree-stdarg.c (optimize_va_list_gpr_fpr_size): Factor out of ...
(pass_stdarg::execute): ... here.
---
gcc/tree-stdarg.c | 80 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 44 insertions(+), 36 deletions(-)
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 17d51a2..5eac56a 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -678,43 +678,10 @@ check_all_va_list_escapes (struct stdarg_info *si)
return false;
}
+/* Optimize FUN->va_list_gpr_size and FUN->va_list_fpr_size. */
-namespace {
-
-const pass_data pass_data_stdarg =
-{
- GIMPLE_PASS, /* type */
- "stdarg", /* name */
- OPTGROUP_NONE, /* optinfo_flags */
- TV_NONE, /* tv_id */
- ( PROP_cfg | PROP_ssa ), /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0, /* todo_flags_finish */
-};
-
-class pass_stdarg : public gimple_opt_pass
-{
-public:
- pass_stdarg (gcc::context *ctxt)
- : gimple_opt_pass (pass_data_stdarg, ctxt)
- {}
-
- /* opt_pass methods: */
- virtual bool gate (function *fun)
- {
- return (flag_stdarg_opt
- /* This optimization is only for stdarg functions. */
- && fun->stdarg != 0);
- }
-
- virtual unsigned int execute (function *);
-
-}; // class pass_stdarg
-
-unsigned int
-pass_stdarg::execute (function *fun)
+static void
+optimize_va_list_gpr_fpr_size (function *fun)
{
basic_block bb;
bool va_list_escapes = false;
@@ -1047,6 +1014,47 @@ finish:
fprintf (dump_file, "%d", cfun->va_list_fpr_size);
fputs (" FPR units.\n", dump_file);
}
+}
+
+namespace {
+
+const pass_data pass_data_stdarg =
+{
+ GIMPLE_PASS, /* type */
+ "stdarg", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
+ TV_NONE, /* tv_id */
+ ( PROP_cfg | PROP_ssa ), /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+};
+
+class pass_stdarg : public gimple_opt_pass
+{
+public:
+ pass_stdarg (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_stdarg, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ virtual bool gate (function *fun)
+ {
+ return (flag_stdarg_opt
+ /* This optimization is only for stdarg functions. */
+ && fun->stdarg != 0);
+ }
+
+ virtual unsigned int execute (function *);
+
+}; // class pass_stdarg
+
+unsigned int
+pass_stdarg::execute (function *fun)
+{
+ optimize_va_list_gpr_fpr_size (fun);
+
return 0;
}
--
1.9.1