From: Tom de Vries Date: Fri, 17 Apr 2015 09:26:41 +0000 (+0000) Subject: Factor optimize_va_list_gpr_fpr_size out of pass_stdarg::execute X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=302f08072ff5559a762baed4bde399852c0960be;p=gcc.git Factor optimize_va_list_gpr_fpr_size out of pass_stdarg::execute 2015-04-17 Tom de Vries * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Factor out of ... (pass_stdarg::execute): ... here. From-SVN: r222171 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36429850c23..b653b58c385 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-04-17 Tom de Vries + + * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Factor out of ... + (pass_stdarg::execute): ... here. + 2015-04-17 Tom de Vries Michael Matz diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index 0c70790f3eb..8d221a4b3a5 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; }