diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2014-04-17 12:37:34 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2014-04-17 12:37:34 +0000 |
commit | be55bfe6cf456943b12fe128f8a445b583ace36f (patch) | |
tree | 2c7de59d1f6572c580defbe0ccac2d0b83cd1eb3 /gcc/tree-eh.c | |
parent | 1a3d085cf2a0caa5daef7c0443b1d280bcef295e (diff) | |
download | gcc-be55bfe6cf456943b12fe128f8a445b583ace36f.zip gcc-be55bfe6cf456943b12fe128f8a445b583ace36f.tar.gz gcc-be55bfe6cf456943b12fe128f8a445b583ace36f.tar.bz2 |
pass cfun to pass::execute
gcc/
* passes.c (opt_pass::execute): Adjust.
(pass_manager::execute_pass_mode_switching): Likewise.
(early_local_passes::execute): Likewise.
(execute_one_pass): Pass cfun to the pass's execute method.
* tree-pass.h (opt_pass::execute): Add function * argument.
* asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c, cfgcleanup.c,
cfgexpand.c, cfgrtl.c, cgraphbuild.c, combine-stack-adj.c, combine.c,
compare-elim.c, config/arc/arc.c, config/epiphany/mode-switch-use.c,
config/epiphany/resolve-sw-modes.c, config/i386/i386.c,
config/mips/mips.c, config/rl78/rl78.c, config/s390/s390.c,
config/sparc/sparc.c, cprop.c, dce.c, df-core.c, dse.c, dwarf2cfi.c,
except.c, final.c, function.c, fwprop.c, gcse.c, gimple-low.c,
gimple-ssa-isolate-paths.c, gimple-ssa-strength-reduction.c,
graphite.c, ifcvt.c, init-regs.c, ipa-cp.c, ipa-devirt.c,
ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c,
ipa-reference.c, ipa-split.c, ipa.c, ira.c, jump.c, loop-init.c,
lower-subreg.c, mode-switching.c, omp-low.c, postreload-gcse.c,
postreload.c, predict.c, recog.c, ree.c, reg-stack.c, regcprop.c,
reginfo.c, regrename.c, reorg.c, sched-rgn.c, stack-ptr-mod.c,
store-motion.c, tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c,
tree-cfgcleanup.c, tree-complex.c, tree-eh.c, tree-emutls.c,
tree-if-conv.c, tree-into-ssa.c, tree-loop-distribution.c, tree-nrv.c,
tree-object-size.c, tree-parloops.c, tree-predcom.c, tree-ssa-ccp.c,
tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c,
tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
tree-ssa-ifcombine.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-prefetch.c,
tree-ssa-loop-unswitch.c, tree-ssa-loop.c, tree-ssa-math-opts.c,
tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c,
tree-tailcall.c, tree-vect-generic.c, tree-vectorizer.c, tree-vrp.c,
tree.c, tsan.c, ubsan.c, var-tracking.c, vtable-verify.c, web.c:
Adjust.
From-SVN: r209482
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r-- | gcc/tree-eh.c | 236 |
1 files changed, 116 insertions, 120 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 41f96c4..960c04a 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -2121,8 +2121,36 @@ lower_eh_constructs_1 (struct leh_state *state, gimple_seq *pseq) lower_eh_constructs_2 (state, &gsi); } -static unsigned int -lower_eh_constructs (void) +namespace { + +const pass_data pass_data_lower_eh = +{ + GIMPLE_PASS, /* type */ + "eh", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + true, /* has_execute */ + TV_TREE_EH, /* tv_id */ + PROP_gimple_lcf, /* properties_required */ + PROP_gimple_leh, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ +}; + +class pass_lower_eh : public gimple_opt_pass +{ +public: + pass_lower_eh (gcc::context *ctxt) + : gimple_opt_pass (pass_data_lower_eh, ctxt) + {} + + /* opt_pass methods: */ + virtual unsigned int execute (function *); + +}; // class pass_lower_eh + +unsigned int +pass_lower_eh::execute (function *fun) { struct leh_state null_state; gimple_seq bodyp; @@ -2155,7 +2183,7 @@ lower_eh_constructs (void) /* If this function needs a language specific EH personality routine and the frontend didn't already set one do so now. */ - if (function_needs_eh_personality (cfun) == eh_personality_lang + if (function_needs_eh_personality (fun) == eh_personality_lang && !DECL_FUNCTION_PERSONALITY (current_function_decl)) DECL_FUNCTION_PERSONALITY (current_function_decl) = lang_hooks.eh_personality (); @@ -2163,34 +2191,6 @@ lower_eh_constructs (void) return 0; } -namespace { - -const pass_data pass_data_lower_eh = -{ - GIMPLE_PASS, /* type */ - "eh", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - true, /* has_execute */ - TV_TREE_EH, /* tv_id */ - PROP_gimple_lcf, /* properties_required */ - PROP_gimple_leh, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ -}; - -class pass_lower_eh : public gimple_opt_pass -{ -public: - pass_lower_eh (gcc::context *ctxt) - : gimple_opt_pass (pass_data_lower_eh, ctxt) - {} - - /* opt_pass methods: */ - unsigned int execute () { return lower_eh_constructs (); } - -}; // class pass_lower_eh - } // anon namespace gimple_opt_pass * @@ -3108,13 +3108,6 @@ refactor_eh_r (gimple_seq seq) } } -static unsigned -refactor_eh (void) -{ - refactor_eh_r (gimple_body (current_function_decl)); - return 0; -} - namespace { const pass_data pass_data_refactor_eh = @@ -3140,7 +3133,11 @@ public: /* opt_pass methods: */ virtual bool gate (function *) { return flag_exceptions != 0; } - unsigned int execute () { return refactor_eh (); } + virtual unsigned int execute (function *) + { + refactor_eh_r (gimple_body (current_function_decl)); + return 0; + } }; // class pass_refactor_eh @@ -3304,37 +3301,6 @@ lower_resx (basic_block bb, gimple stmt, struct pointer_map_t *mnt_map) return ret; } -static unsigned -execute_lower_resx (void) -{ - basic_block bb; - struct pointer_map_t *mnt_map; - bool dominance_invalidated = false; - bool any_rewritten = false; - - mnt_map = pointer_map_create (); - - FOR_EACH_BB_FN (bb, cfun) - { - gimple last = last_stmt (bb); - if (last && is_gimple_resx (last)) - { - dominance_invalidated |= lower_resx (bb, last, mnt_map); - any_rewritten = true; - } - } - - pointer_map_destroy (mnt_map); - - if (dominance_invalidated) - { - free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); - } - - return any_rewritten ? TODO_update_ssa_only_virtuals : 0; -} - namespace { const pass_data pass_data_lower_resx = @@ -3360,10 +3326,41 @@ public: /* opt_pass methods: */ virtual bool gate (function *) { return flag_exceptions != 0; } - unsigned int execute () { return execute_lower_resx (); } + virtual unsigned int execute (function *); }; // class pass_lower_resx +unsigned +pass_lower_resx::execute (function *fun) +{ + basic_block bb; + struct pointer_map_t *mnt_map; + bool dominance_invalidated = false; + bool any_rewritten = false; + + mnt_map = pointer_map_create (); + + FOR_EACH_BB_FN (bb, fun) + { + gimple last = last_stmt (bb); + if (last && is_gimple_resx (last)) + { + dominance_invalidated |= lower_resx (bb, last, mnt_map); + any_rewritten = true; + } + } + + pointer_map_destroy (mnt_map); + + if (dominance_invalidated) + { + free_dominance_info (CDI_DOMINATORS); + free_dominance_info (CDI_POST_DOMINATORS); + } + + return any_rewritten ? TODO_update_ssa_only_virtuals : 0; +} + } // anon namespace gimple_opt_pass * @@ -3704,8 +3701,37 @@ lower_eh_dispatch (basic_block src, gimple stmt) return redirected; } -static unsigned -execute_lower_eh_dispatch (void) +namespace { + +const pass_data pass_data_lower_eh_dispatch = +{ + GIMPLE_PASS, /* type */ + "ehdisp", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + true, /* has_execute */ + TV_TREE_EH, /* tv_id */ + PROP_gimple_lcf, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_verify_flow, /* todo_flags_finish */ +}; + +class pass_lower_eh_dispatch : public gimple_opt_pass +{ +public: + pass_lower_eh_dispatch (gcc::context *ctxt) + : gimple_opt_pass (pass_data_lower_eh_dispatch, ctxt) + {} + + /* opt_pass methods: */ + virtual bool gate (function *fun) { return fun->eh->region_tree != NULL; } + virtual unsigned int execute (function *); + +}; // class pass_lower_eh_dispatch + +unsigned +pass_lower_eh_dispatch::execute (function *fun) { basic_block bb; int flags = 0; @@ -3713,7 +3739,7 @@ execute_lower_eh_dispatch (void) assign_filter_values (); - FOR_EACH_BB_FN (bb, cfun) + FOR_EACH_BB_FN (bb, fun) { gimple last = last_stmt (bb); if (last == NULL) @@ -3737,36 +3763,6 @@ execute_lower_eh_dispatch (void) return flags; } -namespace { - -const pass_data pass_data_lower_eh_dispatch = -{ - GIMPLE_PASS, /* type */ - "ehdisp", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - true, /* has_execute */ - TV_TREE_EH, /* tv_id */ - PROP_gimple_lcf, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_verify_flow, /* todo_flags_finish */ -}; - -class pass_lower_eh_dispatch : public gimple_opt_pass -{ -public: - pass_lower_eh_dispatch (gcc::context *ctxt) - : gimple_opt_pass (pass_data_lower_eh_dispatch, ctxt) - {} - - /* opt_pass methods: */ - virtual bool gate (function *fun) { return fun->eh->region_tree != NULL; } - - unsigned int execute () { return execute_lower_eh_dispatch (); } - -}; // class pass_lower_eh_dispatch - } // anon namespace gimple_opt_pass * @@ -4564,21 +4560,6 @@ execute_cleanup_eh_1 (void) return 0; } -static unsigned int -execute_cleanup_eh (void) -{ - int ret = execute_cleanup_eh_1 (); - - /* If the function no longer needs an EH personality routine - clear it. This exposes cross-language inlining opportunities - and avoids references to a never defined personality routine. */ - if (DECL_FUNCTION_PERSONALITY (current_function_decl) - && function_needs_eh_personality (cfun) != eh_personality_lang) - DECL_FUNCTION_PERSONALITY (current_function_decl) = NULL_TREE; - - return ret; -} - namespace { const pass_data pass_data_cleanup_eh = @@ -4609,10 +4590,25 @@ public: return fun->eh != NULL && fun->eh->region_tree != NULL; } - unsigned int execute () { return execute_cleanup_eh (); } + virtual unsigned int execute (function *); }; // class pass_cleanup_eh +unsigned int +pass_cleanup_eh::execute (function *fun) +{ + int ret = execute_cleanup_eh_1 (); + + /* If the function no longer needs an EH personality routine + clear it. This exposes cross-language inlining opportunities + and avoids references to a never defined personality routine. */ + if (DECL_FUNCTION_PERSONALITY (current_function_decl) + && function_needs_eh_personality (fun) != eh_personality_lang) + DECL_FUNCTION_PERSONALITY (current_function_decl) = NULL_TREE; + + return ret; +} + } // anon namespace gimple_opt_pass * |