aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2007-02-06 14:34:51 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2007-02-06 14:34:51 +0000
commit15814ba0a2c2bbbd8b4617447edb6065da14cb6a (patch)
tree9ee2a06ba9a73c0dbf9a0d7de12bd0049f095cce /gcc/tree-ssa-structalias.c
parent0802f6a2f718f63c240b0f77c319cd94fc9595c9 (diff)
downloadgcc-15814ba0a2c2bbbd8b4617447edb6065da14cb6a.zip
gcc-15814ba0a2c2bbbd8b4617447edb6065da14cb6a.tar.gz
gcc-15814ba0a2c2bbbd8b4617447edb6065da14cb6a.tar.bz2
Makefile.in (tree-ssa-loop-ivopts.o): Add pointer-set.h dependency.
2006-02-06 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (tree-ssa-loop-ivopts.o): Add pointer-set.h dependency. (tree-ssa-reassoc.o): Add pointer-set.h dependency. (tree-cfg.o): Remove hashtab.h dependency. * tree-ssa-loop-ivopts.c: Include pointer-set.h. (struct ivopts_data): Change niters to pointer_map_t. (struct nfe_cache_elt, nfe_hash, nfe_eq): Delete. (niter_for_exit): Create pointer_map on demand. Change for pointer_map API. (tree_ssa_iv_optimize_init): Initialize data->niters to NULL. (free_loop_data): Destroy data->niters if created and reset field. (tree_ssa_iv_optimize_finalize): Don't delete data->niters here. (tree_ssa_iv_optimize_loop): Check for presence of stale data. * tree-ssa-reassoc.c: Include pointer-set.h. (bb_rank): Change to long *. (operand_rank): Change to pointer_map_t. (find_operand_rank): Return long, -1 if not found. Declare as inline. (insert_operand_rank): Accept long. (operand_entry_hash, operand_entry_eq): Remove. (get_rank): Return long. Adjust for changes above. (init_reassoc): Change rank type to long. Adjust creation of bb_rank and operand_rank. (fini_reassoc): Delete operand_rank with pointer_map_destroy. * tree-ssa-structalias.c (vi_for_tree): Change to pointer_map. (struct tree_vi, tree_vi_t, tree_vi_hash, tree_vi_eq): Delete. (insert_vi_for_tree): Rewrite for pointer_map API. Assert argument is not NULL. (lookup_vi_for_tree): Rewrite for pointer_map API. Return varinfo_t directly since it cannot be NULL. (get_vi_for_tree): Rewrite for pointer_map API. (find_what_p_points_to): Adjust for change to lookup_vi_for_tree. (init_alias_vars): Create vi_for_tree as pointer_map. (delete_points_to_sets): Delete vi_for_tree using pointer_map_destroy. * tree-cfg.c: Don't include hashtab.h. (edge_to_cases): Declare as pointer_map. (struct edge_to_cases_elt, edge_to_cases_hash, edge_to_cases_eq): Delete. (edge_to_cases_cleanup): Rewrite as pointer_map_traverse callback. (start_recording_case_labels): Create edge_to_cases as pointer_map. (end_recoding_case_labels): Cleanup edge_to_cases manually before destroying it. (record_switch_edge): Delete. (get_cases_for_edge): Adjust for pointer_map API, inline record_switch_edge (rewritten for new API), remove goto. From-SVN: r121648
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c82
1 files changed, 21 insertions, 61 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 576ae1b..238e7f4 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -2138,67 +2138,31 @@ solve_graph (constraint_graph_t graph)
}
/* Map from trees to variable infos. */
-static htab_t vi_for_tree;
+static struct pointer_map_t *vi_for_tree;
-typedef struct tree_vi
-{
- tree t;
- varinfo_t vi;
-} *tree_vi_t;
-
-/* Hash a tree id structure. */
-
-static hashval_t
-tree_vi_hash (const void *p)
-{
- const tree_vi_t ta = (tree_vi_t) p;
- return htab_hash_pointer (ta->t);
-}
-
-/* Return true if the tree in P1 and the tree in P2 are the same. */
-
-static int
-tree_vi_eq (const void *p1, const void *p2)
-{
- const tree_vi_t ta1 = (tree_vi_t) p1;
- const tree_vi_t ta2 = (tree_vi_t) p2;
- return ta1->t == ta2->t;
-}
-/* Insert ID as the variable id for tree T in the hashtable. */
+/* Insert ID as the variable id for tree T in the vi_for_tree map. */
static void
insert_vi_for_tree (tree t, varinfo_t vi)
{
- void **slot;
- struct tree_vi finder;
- tree_vi_t new_pair;
-
- finder.t = t;
- slot = htab_find_slot (vi_for_tree, &finder, INSERT);
+ void **slot = pointer_map_insert (vi_for_tree, t);
+ gcc_assert (vi);
gcc_assert (*slot == NULL);
- new_pair = XNEW (struct tree_vi);
- new_pair->t = t;
- new_pair->vi = vi;
- *slot = (void *)new_pair;
+ *slot = vi;
}
/* Find the variable info for tree T in VI_FOR_TREE. If T does not
- exist in the hash table, return false, otherwise, return true and
- set *VI to the varinfo we found. */
+ exist in the map, return NULL, otherwise, return the varinfo we found. */
-static bool
-lookup_vi_for_tree (tree t, varinfo_t *vi)
+static varinfo_t
+lookup_vi_for_tree (tree t)
{
- tree_vi_t pair;
- struct tree_vi finder;
+ void **slot = pointer_map_contains (vi_for_tree, t);
+ if (slot == NULL)
+ return NULL;
- finder.t = t;
- pair = htab_find (vi_for_tree, &finder);
- if (pair == NULL)
- return false;
- *vi = pair->vi;
- return true;
+ return (varinfo_t) *slot;
}
/* Return a printable name for DECL */
@@ -2235,21 +2199,17 @@ alias_get_name (tree decl)
return res;
}
-/* Find the variable id for tree T in the hashtable.
- If T doesn't exist in the hash table, create an entry for it. */
+/* Find the variable id for tree T in the map.
+ If T doesn't exist in the map, create an entry for it and return it. */
static varinfo_t
get_vi_for_tree (tree t)
{
- tree_vi_t pair;
- struct tree_vi finder;
-
- finder.t = t;
- pair = htab_find (vi_for_tree, &finder);
- if (pair == NULL)
+ void **slot = pointer_map_contains (vi_for_tree, t);
+ if (slot == NULL)
return get_varinfo (create_variable_info_for (t, alias_get_name (t)));
- return pair->vi;
+ return (varinfo_t) *slot;
}
/* Get a constraint expression from an SSA_VAR_P node. */
@@ -4383,9 +4343,9 @@ find_what_p_points_to (tree p)
&& SSA_NAME_IS_DEFAULT_DEF (p))
lookup_p = SSA_NAME_VAR (p);
- if (lookup_vi_for_tree (lookup_p, &vi))
+ vi = lookup_vi_for_tree (lookup_p);
+ if (vi)
{
-
if (vi->is_artificial_var)
return false;
@@ -4633,7 +4593,7 @@ init_alias_vars (void)
sizeof (struct variable_info), 30);
constraints = VEC_alloc (constraint_t, heap, 8);
varmap = VEC_alloc (varinfo_t, heap, 8);
- vi_for_tree = htab_create (10, tree_vi_hash, tree_vi_eq, free);
+ vi_for_tree = pointer_map_create ();
memset (&stats, 0, sizeof (stats));
@@ -4774,7 +4734,7 @@ delete_points_to_sets (void)
fprintf (dump_file, "Points to sets created:%d\n",
stats.points_to_sets_created);
- htab_delete (vi_for_tree);
+ pointer_map_destroy (vi_for_tree);
bitmap_obstack_release (&pta_obstack);
VEC_free (constraint_t, heap, constraints);