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
This commit is contained in:
Tom de Vries 2015-04-17 09:26:41 +00:00 committed by Tom de Vries
parent 8926e325db
commit 302f08072f
2 changed files with 56 additions and 43 deletions

View File

@ -1,3 +1,8 @@
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>

View File

@ -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;
}