summaryrefslogtreecommitdiff
path: root/gcc/tree-dfa.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-26 14:05:42 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-26 14:05:42 +0000
commit203084040858afd222f51667c307734d8375fc81 (patch)
treec6179ebc6a0c7f02b38b3b4e1c4c608287174ea1 /gcc/tree-dfa.c
parent75130fc7fcd6a514720a59205f3c58c26c29940a (diff)
downloadgcc-203084040858afd222f51667c307734d8375fc81.tar.gz
2008-02-26 Richard Guenther <rguenther@suse.de>
* tree-flow.h (uid_decl_map_hash, uid_decl_map_eq): Move ... * tree.h (uid_decl_map_hash, uid_decl_map_eq): ... here. (lookup_decl_from_uid): Declare. (remove_decl_from_map): Likewise. * tree-ssa.c (uid_decl_map_eq, uid_decl_map_hash): Move ... * tree.c (uid_decl_map_eq, uid_decl_map_hash): ... here. (decl_for_uid_map): New global hashtable mapping DECL_UID to the decl tree. (init_ttree): Allocate it. (insert_decl_to_uid_decl_map): New helper function. (make_node_stat): Insert new decls into the map. (copy_node_stat): Likewise. (lookup_decl_from_uid): New function. (remove_decl_from_map): Likewise. (print_decl_for_uid_map_statistics): New helper. (dump_tree_statistics): Call it. cp/ * decl.c (duplicate_decls): Remove decl from global mapping before ggc_freeing it. * tree-flow.h (struct gimple_df): Make referenced_vars a bitmap. (referenced_var_iterator): Adjust. (FOR_EACH_REFERENCED_VAR): Adjust. (FOR_EACH_REFERENCED_VAR_IN_BITMAP): New iterator. (num_referenced_vars): Adjust. * tree-flow-inline.h (gimple_referenced_vars): Adjust. (first_referenced_var): Remove. (end_referenced_vars_p): Likewise. (next_referenced_var): Likewise. (referenced_var_iterator_set): New helper function. * tree-dfa.c (referenced_var_lookup): Adjust. (referenced_var_check_and_insert): Likewise. (remove_referenced_var): Likewise. * tree-ssa.c (verify_flow_insensitive_alias_info): Use FOR_EACH_REFERENCED_VAR_IN_BITMAP. (verify_call_clobbering): Likewise. (verify_memory_partitions): Likewise. (init_tree_ssa): Allocate bitmap instead of hashtable for referenced_vars. (delete_tree_ssa): Adjust. * tree-ssa-alias.c (mark_aliases_call_clobbered): Use FOR_EACH_REFERENCED_VAR_IN_BITMAP. (compute_tag_properties): Likewise. (set_initial_properties): Likewise. (find_partition_for): Likewise. (update_reference_counts): Likewise. (dump_may_aliases_for): Likewise. * tree-ssa-operands.c (add_virtual_operand): Likewise. (add_call_clobber_ops): Likewise. (add_call_read_ops): Likewise. (get_asm_expr_operands): Likewise. * tree-into-ssa.c (dump_decl_set): Likewise. (update_ssa): Likewise. * tree-sra.c (scan_function): Likewise. (decide_instantiations): Likewise. (scalarize_parms): Likewise. * tree-ssa-alias-warnings.c (build_reference_table): Likewise. (dsa_named_for): Likewise. * tree-ssa-structalias.c (update_alias_info): Likewise. (merge_smts_into): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132676 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r--gcc/tree-dfa.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 346f6f3803c..f66a50c5a65 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -641,12 +641,16 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
tree
referenced_var_lookup (unsigned int uid)
{
- tree h;
- struct tree_decl_minimal in;
- in.uid = uid;
- h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
- gcc_assert (h || uid == 0);
- return h;
+ tree var;
+
+ gcc_assert (bitmap_bit_p (gimple_referenced_vars (cfun), uid));
+
+ /* For now also assert that the variable is really referenced.
+ Otherwise callers need to deal with the result from this function
+ being NULL. */
+ var = lookup_decl_from_uid (uid);
+ gcc_assert (var);
+ return var;
}
/* Check if TO is in the referenced_vars hash table and insert it if not.
@@ -655,23 +659,13 @@ referenced_var_lookup (unsigned int uid)
bool
referenced_var_check_and_insert (tree to)
{
- tree h, *loc;
- struct tree_decl_minimal in;
unsigned int uid = DECL_UID (to);
- in.uid = uid;
- h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
- if (h)
- {
- /* DECL_UID has already been entered in the table. Verify that it is
- the same entry as TO. See PR 27793. */
- gcc_assert (h == to);
- return false;
- }
+ if (bitmap_bit_p (gimple_referenced_vars (cfun), uid))
+ return false;
+
+ bitmap_set_bit (gimple_referenced_vars (cfun), uid);
- loc = (tree *) htab_find_slot_with_hash (gimple_referenced_vars (cfun),
- &in, uid, INSERT);
- *loc = to;
return true;
}
@@ -761,8 +755,6 @@ void
remove_referenced_var (tree var)
{
var_ann_t v_ann;
- struct tree_decl_minimal in;
- void **loc;
unsigned int uid = DECL_UID (var);
subvar_t sv;
@@ -782,10 +774,7 @@ remove_referenced_var (tree var)
ggc_free (v_ann);
var->base.ann = NULL;
gcc_assert (DECL_P (var));
- in.uid = uid;
- loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid,
- NO_INSERT);
- htab_clear_slot (gimple_referenced_vars (cfun), loc);
+ bitmap_clear_bit (gimple_referenced_vars (cfun), uid);
}