diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2014-08-02 11:23:49 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2014-08-02 11:23:49 +0000 |
commit | 6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2 (patch) | |
tree | f0fb192e856fa98b7d91e225ff958dfcc1f602df /gcc/tree-ssa-phiopt.c | |
parent | 2df06cec0a2fe611c5487bf54c4ef8e3b2b30543 (diff) | |
download | gcc-6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2.zip gcc-6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2.tar.gz gcc-6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2.tar.bz2 |
add a hash_set based on hash_table
This allows us to replace the usage of pointer_set outside of
pointer_map with a nicer interface.
gcc/ada/
* gcc-interface/trans.c: Use hash_set instead of pointer_set.
gcc/c-family/
* c-gimplify.c: Use hash_set instead of pointer_set.
gcc/c/
* c-decl.c: Use hash_set instead of pointer_set.
gcc/cp/
* class.c, cp-gimplify.c, cp-tree.h, decl.c, decl2.c, error.c,
method.c, name-lookup.c, pt.c, semantics.c, tree.c: Use hash_set
instead of pointer_set.
gcc/fortran/
* openmp.c, trans-decl.c: Use hash_set instead of pointer_set.
gcc/
* hash-set.h: new File.
* cfgexpand.c, cfgloop.c, cgraph.c, cgraphbuild.c, cgraphunit.c,
cprop.c, cse.c, gimple-walk.c, gimple-walk.h, gimplify.c, godump.c,
ipa-devirt.c, ipa-pure-const.c, ipa-visibility.c, ipa.c, lto-cgraph.c,
lto-streamer-out.c, stmt.c, tree-cfg.c, tree-core.h, tree-eh.c,
tree-inline.c, tree-inline.h, tree-nested.c, tree-pretty-print.c,
tree-ssa-loop-niter.c, tree-ssa-phiopt.c, tree-ssa-threadedge.c,
tree-ssa-uninit.c, tree.c, tree.h, value-prof.c, varasm.c,
varpool.c: Use hash_set instead of pointer_set.
gcc/lto/
* lto-partition.c, lto-partition.h: Use hash_set instead of
pointer_set.
From-SVN: r213516
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index 052d760..3185d9a 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "tm_p.h" #include "basic-block.h" +#include "hash-set.h" #include "pointer-set.h" #include "tree-ssa-alias.h" #include "internal-fn.h" @@ -72,9 +73,9 @@ static bool abs_replacement (basic_block, basic_block, static bool neg_replacement (basic_block, basic_block, edge, edge, gimple, tree, tree); static bool cond_store_replacement (basic_block, basic_block, edge, edge, - struct pointer_set_t *); + hash_set<tree> *); static bool cond_if_else_store_replacement (basic_block, basic_block, basic_block); -static struct pointer_set_t * get_non_trapping (void); +static hash_set<tree> * get_non_trapping (); static void replace_phi_edge_with_variable (basic_block, edge, gimple, tree); static void hoist_adjacent_loads (basic_block, basic_block, basic_block, basic_block); @@ -176,7 +177,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads) basic_block *bb_order; unsigned n, i; bool cfgchanged = false; - struct pointer_set_t *nontrap = 0; + hash_set<tree> *nontrap = 0; if (do_store_elim) /* Calculate the set of non-trapping memory accesses. */ @@ -363,7 +364,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads) free (bb_order); if (do_store_elim) - pointer_set_destroy (nontrap); + delete nontrap; /* If the CFG has changed, we should cleanup the CFG. */ if (cfgchanged && do_store_elim) { @@ -1469,7 +1470,7 @@ ssa_names_hasher::equal (const value_type *n1, const compare_type *n2) class nontrapping_dom_walker : public dom_walker { public: - nontrapping_dom_walker (cdi_direction direction, pointer_set_t *ps) + nontrapping_dom_walker (cdi_direction direction, hash_set<tree> *ps) : dom_walker (direction), m_nontrapping (ps), m_seen_ssa_names (128) {} virtual void before_dom_children (basic_block); @@ -1484,7 +1485,7 @@ private: the RHS. */ void add_or_mark_expr (basic_block, tree, bool); - pointer_set_t *m_nontrapping; + hash_set<tree> *m_nontrapping; /* The hash table for remembering what we've seen. */ hash_table<ssa_names_hasher> m_seen_ssa_names; @@ -1572,7 +1573,7 @@ nontrapping_dom_walker::add_or_mark_expr (basic_block bb, tree exp, bool store) then we can't trap. */ if (found_bb && (((size_t)found_bb->aux) & 1) == 1) { - pointer_set_insert (m_nontrapping, exp); + m_nontrapping->add (exp); } else { @@ -1601,11 +1602,11 @@ nontrapping_dom_walker::add_or_mark_expr (basic_block bb, tree exp, bool store) 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 (the MEM_REFs itself) which can't trap. */ -static struct pointer_set_t * +static hash_set<tree> * get_non_trapping (void) { nt_call_phase = 0; - pointer_set_t *nontrap = pointer_set_create (); + hash_set<tree> *nontrap = new hash_set<tree>; /* We're going to do a dominator walk, so ensure that we have dominance information. */ calculate_dominance_info (CDI_DOMINATORS); @@ -1634,7 +1635,7 @@ get_non_trapping (void) static bool cond_store_replacement (basic_block middle_bb, basic_block join_bb, - edge e0, edge e1, struct pointer_set_t *nontrap) + edge e0, edge e1, hash_set<tree> *nontrap) { gimple assign = last_and_only_stmt (middle_bb); tree lhs, rhs, name, name2; @@ -1659,7 +1660,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, /* Prove that we can move the store down. We could also check TREE_THIS_NOTRAP here, but in that case we also could move stores, whose value is not available readily, which we want to avoid. */ - if (!pointer_set_contains (nontrap, lhs)) + if (!nontrap->contains (lhs)) return false; /* Now we've checked the constraints, so do the transformation: |