diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2014-06-24 13:21:35 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2014-06-24 13:21:35 +0000 |
commit | c203e8a73b2f12a1da52a16a0c4a50e62b42445b (patch) | |
tree | b8d7f5b21a14b16949ddbc5dcaeb5f2b2654d63a /gcc/tree-ssa-phiopt.c | |
parent | fbc2a724d481bb5c205baeaaa955533451226d01 (diff) | |
download | gcc-c203e8a73b2f12a1da52a16a0c4a50e62b42445b.zip gcc-c203e8a73b2f12a1da52a16a0c4a50e62b42445b.tar.gz gcc-c203e8a73b2f12a1da52a16a0c4a50e62b42445b.tar.bz2 |
Remove a layer of indirection from hash_table
gcc/
* hash-table.h: Remove a layer of indirection from hash_table so that
it contains the hash table's data instead of a pointer to the data.
* alloc-pool.c, asan.c, attribs.c, bitmap.c, cfg.c,
config/arm/arm.c, config/i386/winnt.c, config/ia64/ia64.c,
config/mips/mips.c, config/sol2.c, coverage.c, cselib.c,
data-streamer-out.c, dse.c, dwarf2cfi.c, dwarf2out.c, except.c,
fold-const.c, gcse.c, ggc-common.c,
gimple-ssa-strength-reduction.c, gimplify.c,
graphite-clast-to-gimple.c, graphite-dependences.c,
graphite-htab.h, graphite.c, haifa-sched.c, ipa-devirt.c,
ipa-profile.c, ira-color.c, ira-costs.c, loop-invariant.c,
loop-iv.c, loop-unroll.c, lto-streamer-in.c, lto-streamer-out.c,
lto-streamer.c, lto-streamer.h, passes.c, plugin.c,
postreload-gcse.c, sese.c, statistics.c, store-motion.c,
trans-mem.c, tree-browser.c, tree-cfg.c, tree-complex.c,
tree-eh.c, tree-into-ssa.c, tree-parloops.c, tree-sra.c,
tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-dom.c,
tree-ssa-live.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivopts.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-strlen.c,
tree-ssa-structalias.c, tree-ssa-tail-merge.c,
tree-ssa-threadupdate.c, tree-ssa-uncprop.c,
tree-vect-data-refs.c, tree-vect-loop.c, tree-vectorizer.c,
tree-vectorizer.h, valtrack.c, valtrack.h, var-tracking.c,
vtable-verify.c, vtable-verify.h: Adjust.
gcc/c/
* c-decl.c: Adjust.
gcc/cp/
* class.c, semantics.c, tree.c, vtable-class-hierarchy.c:
Adjust.
gcc/java/
* jcf-io.c: Adjust.
gcc/lto/
* lto.c: Adjust.
gcc/objc/
* objc-act.c: Adjust.
From-SVN: r211936
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 134 |
1 files changed, 69 insertions, 65 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 5400299..5c11000 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -1466,17 +1466,79 @@ ssa_names_hasher::equal (const value_type *n1, const compare_type *n2) && n1->size == n2->size; } -/* The hash table for remembering what we've seen. */ -static hash_table <ssa_names_hasher> seen_ssa_names; +class nontrapping_dom_walker : public dom_walker +{ +public: + nontrapping_dom_walker (cdi_direction direction, pointer_set_t *ps) + : dom_walker (direction), m_nontrapping (ps), m_seen_ssa_names (128) {} + + virtual void before_dom_children (basic_block); + virtual void after_dom_children (basic_block); + +private: + + /* We see the expression EXP in basic block BB. If it's an interesting + expression (an MEM_REF through an SSA_NAME) possibly insert the + expression into the set NONTRAP or the hash table of seen expressions. + STORE is true if this expression is on the LHS, otherwise it's on + the RHS. */ + void add_or_mark_expr (basic_block, tree, bool); + + pointer_set_t *m_nontrapping; + + /* The hash table for remembering what we've seen. */ + hash_table<ssa_names_hasher> m_seen_ssa_names; +}; + +/* Called by walk_dominator_tree, when entering the block BB. */ +void +nontrapping_dom_walker::before_dom_children (basic_block bb) +{ + edge e; + edge_iterator ei; + gimple_stmt_iterator gsi; + + /* If we haven't seen all our predecessors, clear the hash-table. */ + FOR_EACH_EDGE (e, ei, bb->preds) + if ((((size_t)e->src->aux) & 2) == 0) + { + nt_call_phase++; + break; + } + + /* Mark this BB as being on the path to dominator root and as visited. */ + bb->aux = (void*)(1 | 2); + + /* And walk the statements in order. */ + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + + if (is_gimple_call (stmt) && !nonfreeing_call_p (stmt)) + nt_call_phase++; + else if (gimple_assign_single_p (stmt) && !gimple_has_volatile_ops (stmt)) + { + add_or_mark_expr (bb, gimple_assign_lhs (stmt), true); + add_or_mark_expr (bb, gimple_assign_rhs1 (stmt), false); + } + } +} + +/* Called by walk_dominator_tree, when basic block BB is exited. */ +void +nontrapping_dom_walker::after_dom_children (basic_block bb) +{ + /* This BB isn't on the path to dominator root anymore. */ + bb->aux = (void*)2; +} /* We see the expression EXP in basic block BB. If it's an interesting expression (an MEM_REF through an SSA_NAME) possibly insert the expression into the set NONTRAP or the hash table of seen expressions. STORE is true if this expression is on the LHS, otherwise it's on the RHS. */ -static void -add_or_mark_expr (basic_block bb, tree exp, - struct pointer_set_t *nontrap, bool store) +void +nontrapping_dom_walker::add_or_mark_expr (basic_block bb, tree exp, bool store) { HOST_WIDE_INT size; @@ -1500,7 +1562,7 @@ add_or_mark_expr (basic_block bb, tree exp, map.offset = tree_to_shwi (TREE_OPERAND (exp, 1)); map.size = size; - slot = seen_ssa_names.find_slot (&map, INSERT); + slot = m_seen_ssa_names.find_slot (&map, INSERT); n2bb = *slot; if (n2bb && n2bb->phase >= nt_call_phase) found_bb = n2bb->bb; @@ -1510,7 +1572,7 @@ add_or_mark_expr (basic_block bb, tree exp, then we can't trap. */ if (found_bb && (((size_t)found_bb->aux) & 1) == 1) { - pointer_set_insert (nontrap, exp); + pointer_set_insert (m_nontrapping, exp); } else { @@ -1535,61 +1597,6 @@ add_or_mark_expr (basic_block bb, tree exp, } } -class nontrapping_dom_walker : public dom_walker -{ -public: - nontrapping_dom_walker (cdi_direction direction, pointer_set_t *ps) - : dom_walker (direction), m_nontrapping (ps) {} - - virtual void before_dom_children (basic_block); - virtual void after_dom_children (basic_block); - -private: - pointer_set_t *m_nontrapping; -}; - -/* Called by walk_dominator_tree, when entering the block BB. */ -void -nontrapping_dom_walker::before_dom_children (basic_block bb) -{ - edge e; - edge_iterator ei; - gimple_stmt_iterator gsi; - - /* If we haven't seen all our predecessors, clear the hash-table. */ - FOR_EACH_EDGE (e, ei, bb->preds) - if ((((size_t)e->src->aux) & 2) == 0) - { - nt_call_phase++; - break; - } - - /* Mark this BB as being on the path to dominator root and as visited. */ - bb->aux = (void*)(1 | 2); - - /* And walk the statements in order. */ - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - - if (is_gimple_call (stmt) && !nonfreeing_call_p (stmt)) - nt_call_phase++; - else if (gimple_assign_single_p (stmt) && !gimple_has_volatile_ops (stmt)) - { - add_or_mark_expr (bb, gimple_assign_lhs (stmt), m_nontrapping, true); - add_or_mark_expr (bb, gimple_assign_rhs1 (stmt), m_nontrapping, false); - } - } -} - -/* Called by walk_dominator_tree, when basic block BB is exited. */ -void -nontrapping_dom_walker::after_dom_children (basic_block bb) -{ - /* This BB isn't on the path to dominator root anymore. */ - bb->aux = (void*)2; -} - /* This is the entry point of gathering non trapping memory accesses. It will do a dominator walk over the whole function, and it will make use of the bb->aux pointers. It returns a set of trees @@ -1599,7 +1606,6 @@ get_non_trapping (void) { nt_call_phase = 0; pointer_set_t *nontrap = pointer_set_create (); - seen_ssa_names.create (128); /* We're going to do a dominator walk, so ensure that we have dominance information. */ calculate_dominance_info (CDI_DOMINATORS); @@ -1607,8 +1613,6 @@ get_non_trapping (void) nontrapping_dom_walker (CDI_DOMINATORS, nontrap) .walk (cfun->cfg->x_entry_block_ptr); - seen_ssa_names.dispose (); - clear_aux_for_blocks (); return nontrap; } |