aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2015-04-17 09:26:41 +0000
committerTom de Vries <vries@gcc.gnu.org>2015-04-17 09:26:41 +0000
commit302f08072ff5559a762baed4bde399852c0960be (patch)
treec78f6cb511fc19ef5de2fa51821043677881c108 /gcc
parent8926e325dbd81f525a05e02cfad022b60a634590 (diff)
downloadgcc-302f08072ff5559a762baed4bde399852c0960be.zip
gcc-302f08072ff5559a762baed4bde399852c0960be.tar.gz
gcc-302f08072ff5559a762baed4bde399852c0960be.tar.bz2
Factor optimize_va_list_gpr_fpr_size out of pass_stdarg::execute
2015-04-17 Tom de Vries <tom@codesourcery.com> * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Factor out of ... (pass_stdarg::execute): ... here. From-SVN: r222171
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-stdarg.c94
2 files changed, 56 insertions, 43 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3642985..b653b58 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,9 @@
2015-04-17 Tom de Vries <tom@codesourcery.com>
+
+ * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Factor out of ...
+ (pass_stdarg::execute): ... here.
+
+2015-04-17 Tom de Vries <tom@codesourcery.com>
Michael Matz <matz@suse.de>
* tree-cfg.c (make_blocks_1): Factor out of ...
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 0c70790..8d221a4 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -678,50 +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
-#ifdef ACCEL_COMPILER
- /* Disable for GCC5 in the offloading compilers, as
- va_list and gpr/fpr counter fields are not merged.
- In GCC6 when stdarg is lowered late this shouldn't be
- an issue. */
- && !in_lto_p
-#endif
- /* 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;
@@ -1054,6 +1014,54 @@ 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
+#ifdef ACCEL_COMPILER
+ /* Disable for GCC5 in the offloading compilers, as
+ va_list and gpr/fpr counter fields are not merged.
+ In GCC6 when stdarg is lowered late this shouldn't be
+ an issue. */
+ && !in_lto_p
+#endif
+ /* 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;
}