diff options
author | Trevor Saunders <tsaunders@mozilla.com> | 2014-08-02 11:34:54 +0000 |
---|---|---|
committer | Trevor Saunders <tbsaunde@gcc.gnu.org> | 2014-08-02 11:34:54 +0000 |
commit | b787e7a2c2c9be2f548d4c76ec324b71859851a4 (patch) | |
tree | b20f9df1d7e2cb3a642d2fab604f827c7d23712a /gcc/gimple-ssa-strength-reduction.c | |
parent | 6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2 (diff) | |
download | gcc-b787e7a2c2c9be2f548d4c76ec324b71859851a4.zip gcc-b787e7a2c2c9be2f548d4c76ec324b71859851a4.tar.gz gcc-b787e7a2c2c9be2f548d4c76ec324b71859851a4.tar.bz2 |
convert many uses of pointer_map to hash_map
gcc/c-family/
* cilk.c: Use hash_map instead of pointer_map.
gcc/c/
* c-typeck.c: Use hash_map instead of pointer_map.
gcc/cp/
* optimize.c, semantics.c: Use hash_map instead of pointer_map.
gcc/
* hash-map.h (default_hashmap_traits::mark_key_deleted):
Fix cast.
(hash_map::remove): New method.
(hash_map::traverse): New method.
* cgraph.h, except.c, except.h, gimple-ssa-strength-reduction.c,
ipa-utils.c, lto-cgraph.c, lto-streamer.h, omp-low.c, predict.c,
tree-cfg.c, tree-cfgcleanup.c, tree-eh.c, tree-eh.h, tree-inline.c,
tree-inline.h, tree-nested.c, tree-sra.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivopts.c, tree-ssa-reassoc.c, tree-ssa-structalias.c,
tree-ssa.c, tree-ssa.h, var-tracking.c: Use hash_map instead of
pointer_map.
From-SVN: r213517
Diffstat (limited to 'gcc/gimple-ssa-strength-reduction.c')
-rw-r--r-- | gcc/gimple-ssa-strength-reduction.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index d7c5db5..b13b7f7 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tree.h" #include "pointer-set.h" +#include "hash-map.h" #include "hash-table.h" #include "basic-block.h" #include "tree-ssa-alias.h" @@ -373,7 +374,7 @@ enum count_phis_status }; /* Pointer map embodying a mapping from statements to candidates. */ -static struct pointer_map_t *stmt_cand_map; +static hash_map<gimple, slsr_cand_t> *stmt_cand_map; /* Obstack for candidates. */ static struct obstack cand_obstack; @@ -435,7 +436,7 @@ static hash_table<cand_chain_hasher> *base_cand_map; /* Pointer map used by tree_to_aff_combination_expand. */ static struct pointer_map_t *name_expansions; /* Pointer map embodying a mapping from bases to alternative bases. */ -static struct pointer_map_t *alt_base_map; +static hash_map<tree, tree> *alt_base_map; /* Given BASE, use the tree affine combiniation facilities to find the underlying tree expression for BASE, with any @@ -447,7 +448,7 @@ static struct pointer_map_t *alt_base_map; static tree get_alternative_base (tree base) { - tree *result = (tree *) pointer_map_contains (alt_base_map, base); + tree *result = alt_base_map->get (base); if (result == NULL) { @@ -459,13 +460,9 @@ get_alternative_base (tree base) aff.offset = 0; expr = aff_combination_to_tree (&aff); - result = (tree *) pointer_map_insert (alt_base_map, base); - gcc_assert (!*result); + gcc_assert (!alt_base_map->put (base, base == expr ? NULL : expr)); - if (expr == base) - *result = NULL; - else - *result = expr; + return expr == base ? NULL : expr; } return *result; @@ -724,7 +721,7 @@ base_cand_from_table (tree base_in) if (!def) return (slsr_cand_t) NULL; - result = (slsr_cand_t *) pointer_map_contains (stmt_cand_map, def); + result = stmt_cand_map->get (def); if (result && (*result)->kind != CAND_REF) return *result; @@ -737,9 +734,7 @@ base_cand_from_table (tree base_in) static void add_cand_for_stmt (gimple gs, slsr_cand_t c) { - void **slot = pointer_map_insert (stmt_cand_map, gs); - gcc_assert (!*slot); - *slot = c; + gcc_assert (!stmt_cand_map->put (gs, c)); } /* Given PHI which contains a phi statement, determine whether it @@ -3628,7 +3623,7 @@ pass_strength_reduction::execute (function *fun) cand_vec.create (128); /* Allocate the mapping from statements to candidate indices. */ - stmt_cand_map = pointer_map_create (); + stmt_cand_map = new hash_map<gimple, slsr_cand_t>; /* Create the obstack where candidate chains will reside. */ gcc_obstack_init (&chain_obstack); @@ -3637,7 +3632,7 @@ pass_strength_reduction::execute (function *fun) base_cand_map = new hash_table<cand_chain_hasher> (500); /* Allocate the mapping from bases to alternative bases. */ - alt_base_map = pointer_map_create (); + alt_base_map = new hash_map<tree, tree>; /* Initialize the loop optimizer. We need to detect flow across back edges, and this gives us dominator information as well. */ @@ -3654,7 +3649,7 @@ pass_strength_reduction::execute (function *fun) dump_cand_chains (); } - pointer_map_destroy (alt_base_map); + delete alt_base_map; free_affine_expand_cache (&name_expansions); /* Analyze costs and make appropriate replacements. */ @@ -3664,7 +3659,7 @@ pass_strength_reduction::execute (function *fun) delete base_cand_map; base_cand_map = NULL; obstack_free (&chain_obstack, NULL); - pointer_map_destroy (stmt_cand_map); + delete stmt_cand_map; cand_vec.release (); obstack_free (&cand_obstack, NULL); |