diff options
Diffstat (limited to 'gcc/tree-ssa-uncprop.c')
-rw-r--r-- | gcc/tree-ssa-uncprop.c | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c index e39ce88..52c568a 100644 --- a/gcc/tree-ssa-uncprop.c +++ b/gcc/tree-ssa-uncprop.c @@ -383,47 +383,6 @@ private: auto_vec<tree, 2> m_equiv_stack; }; -/* Main driver for un-cprop. */ - -static unsigned int -tree_ssa_uncprop (void) -{ - basic_block bb; - - associate_equivalences_with_edges (); - - /* Create our global data structures. */ - val_ssa_equiv.create (1024); - - /* We're going to do a dominator walk, so ensure that we have - dominance information. */ - calculate_dominance_info (CDI_DOMINATORS); - - /* Recursively walk the dominator tree undoing unprofitable - constant/copy propagations. */ - uncprop_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr); - - /* we just need to empty elements out of the hash table, and cleanup the - AUX field on the edges. */ - val_ssa_equiv.dispose (); - FOR_EACH_BB_FN (bb, cfun) - { - edge e; - edge_iterator ei; - - FOR_EACH_EDGE (e, ei, bb->succs) - { - if (e->aux) - { - free (e->aux); - e->aux = NULL; - } - } - } - return 0; -} - - /* We have finished processing the dominator children of BB, perform any finalization actions in preparation for leaving this node in the dominator tree. */ @@ -607,10 +566,48 @@ public: /* opt_pass methods: */ opt_pass * clone () { return new pass_uncprop (m_ctxt); } virtual bool gate (function *) { return flag_tree_dom != 0; } - unsigned int execute () { return tree_ssa_uncprop (); } + virtual unsigned int execute (function *); }; // class pass_uncprop +unsigned int +pass_uncprop::execute (function *fun) +{ + basic_block bb; + + associate_equivalences_with_edges (); + + /* Create our global data structures. */ + val_ssa_equiv.create (1024); + + /* We're going to do a dominator walk, so ensure that we have + dominance information. */ + calculate_dominance_info (CDI_DOMINATORS); + + /* Recursively walk the dominator tree undoing unprofitable + constant/copy propagations. */ + uncprop_dom_walker (CDI_DOMINATORS).walk (fun->cfg->x_entry_block_ptr); + + /* we just need to empty elements out of the hash table, and cleanup the + AUX field on the edges. */ + val_ssa_equiv.dispose (); + FOR_EACH_BB_FN (bb, fun) + { + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, bb->succs) + { + if (e->aux) + { + free (e->aux); + e->aux = NULL; + } + } + } + return 0; +} + } // anon namespace gimple_opt_pass * |