Commit 381a258b by Richard Guenther Committed by Richard Biener

revert: tree-flow.h (uid_decl_map_hash, [...]): Move ...

2008-02-25  Richard Guenther  <rguenther@suse.de>

	Revert:
	2008-02-25  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.
	* 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.
	(print_decl_for_uid_map_statistics): New helper.
	(dump_tree_statistics): Call 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.

From-SVN: r132643
parent 8dd07840
2008-02-25 Richard Guenther <rguenther@suse.de>
Revert:
2008-02-25 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.
* 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.
(print_decl_for_uid_map_statistics): New helper.
(dump_tree_statistics): Call 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.
2008-02-25 Janne Blomqvist <jb@gcc.gnu.org> 2008-02-25 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/29549 PR fortran/29549
......
...@@ -641,16 +641,12 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) ...@@ -641,16 +641,12 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
tree tree
referenced_var_lookup (unsigned int uid) referenced_var_lookup (unsigned int uid)
{ {
tree var; tree h;
struct tree_decl_minimal in;
gcc_assert (bitmap_bit_p (gimple_referenced_vars (cfun), uid)); in.uid = uid;
h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
/* For now also assert that the variable is really referenced. gcc_assert (h || uid == 0);
Otherwise callers need to deal with the result from this function return h;
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. /* Check if TO is in the referenced_vars hash table and insert it if not.
...@@ -659,13 +655,23 @@ referenced_var_lookup (unsigned int uid) ...@@ -659,13 +655,23 @@ referenced_var_lookup (unsigned int uid)
bool bool
referenced_var_check_and_insert (tree to) referenced_var_check_and_insert (tree to)
{ {
tree h, *loc;
struct tree_decl_minimal in;
unsigned int uid = DECL_UID (to); unsigned int uid = DECL_UID (to);
if (bitmap_bit_p (gimple_referenced_vars (cfun), uid)) in.uid = uid;
return false; h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
if (h)
bitmap_set_bit (gimple_referenced_vars (cfun), uid); {
/* 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;
}
loc = (tree *) htab_find_slot_with_hash (gimple_referenced_vars (cfun),
&in, uid, INSERT);
*loc = to;
return true; return true;
} }
...@@ -755,6 +761,8 @@ void ...@@ -755,6 +761,8 @@ void
remove_referenced_var (tree var) remove_referenced_var (tree var)
{ {
var_ann_t v_ann; var_ann_t v_ann;
struct tree_decl_minimal in;
void **loc;
unsigned int uid = DECL_UID (var); unsigned int uid = DECL_UID (var);
subvar_t sv; subvar_t sv;
...@@ -774,7 +782,10 @@ remove_referenced_var (tree var) ...@@ -774,7 +782,10 @@ remove_referenced_var (tree var)
ggc_free (v_ann); ggc_free (v_ann);
var->base.ann = NULL; var->base.ann = NULL;
gcc_assert (DECL_P (var)); gcc_assert (DECL_P (var));
bitmap_clear_bit (gimple_referenced_vars (cfun), uid); 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);
} }
......
...@@ -66,7 +66,7 @@ gimple_call_clobbered_vars (const struct function *fun) ...@@ -66,7 +66,7 @@ gimple_call_clobbered_vars (const struct function *fun)
} }
/* Array of all variables referenced in the function. */ /* Array of all variables referenced in the function. */
static inline bitmap static inline htab_t
gimple_referenced_vars (const struct function *fun) gimple_referenced_vars (const struct function *fun)
{ {
if (!fun->gimple_df) if (!fun->gimple_df)
...@@ -145,23 +145,34 @@ next_htab_element (htab_iterator *hti) ...@@ -145,23 +145,34 @@ next_htab_element (htab_iterator *hti)
return NULL; return NULL;
} }
/* Helper for FOR_EACH_REFERENCED_VAR. Needed unless iterator /* Initialize ITER to point to the first referenced variable in the
bodies deal with NULL elements. */ referenced_vars hashtable, and return that variable. */
static inline tree
first_referenced_var (referenced_var_iterator *iter)
{
return (tree) first_htab_element (&iter->hti,
gimple_referenced_vars (cfun));
}
/* Return true if we have hit the end of the referenced variables ITER is
iterating through. */
static inline bool static inline bool
referenced_var_iterator_set (referenced_var_iterator *ri, tree *var) end_referenced_vars_p (const referenced_var_iterator *iter)
{ {
while (1) return end_htab_p (&iter->hti);
{
if (!bmp_iter_set (&ri->bi, &ri->i))
return false;
*var = lookup_decl_from_uid (ri->i);
if (*var)
return true;
bmp_iter_next (&ri->bi, &ri->i);
}
} }
/* Make ITER point to the next referenced_var in the referenced_var hashtable,
and return that variable. */
static inline tree
next_referenced_var (referenced_var_iterator *iter)
{
return (tree) next_htab_element (&iter->hti);
}
/* Fill up VEC with the variables in the referenced vars hashtable. */ /* Fill up VEC with the variables in the referenced vars hashtable. */
static inline void static inline void
......
...@@ -138,8 +138,8 @@ struct mem_ref_stats_d GTY(()) ...@@ -138,8 +138,8 @@ struct mem_ref_stats_d GTY(())
fields should have gimple_set accessor. */ fields should have gimple_set accessor. */
struct gimple_df GTY(()) struct gimple_df GTY(())
{ {
/* Bitmap of all variables referenced in the function. */ /* Array of all variables referenced in the function. */
bitmap referenced_vars; htab_t GTY((param_is (union tree_node))) referenced_vars;
/* A list of all the noreturn calls passed to modify_stmt. /* A list of all the noreturn calls passed to modify_stmt.
cleanup_control_flow uses it to detect cases where a mid-block cleanup_control_flow uses it to detect cases where a mid-block
...@@ -569,29 +569,25 @@ struct int_tree_map GTY(()) ...@@ -569,29 +569,25 @@ struct int_tree_map GTY(())
extern unsigned int int_tree_map_hash (const void *); extern unsigned int int_tree_map_hash (const void *);
extern int int_tree_map_eq (const void *, const void *); extern int int_tree_map_eq (const void *, const void *);
extern unsigned int uid_decl_map_hash (const void *);
extern int uid_decl_map_eq (const void *, const void *);
typedef struct typedef struct
{ {
bitmap_iterator bi; htab_iterator hti;
unsigned int i;
} referenced_var_iterator; } referenced_var_iterator;
/* This macro loops over all the referenced vars, one at a time, putting the /* This macro loops over all the referenced vars, one at a time, putting the
current var in VAR. Note: It is undefined whether referenced variables current var in VAR. Note: You are not allowed to add referenced variables
you add or remove during the iteration show up or not. */ to the hashtable while using this macro. Doing so may cause it to behave
erratically. */
#define FOR_EACH_REFERENCED_VAR(VAR, ITER) \ #define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
for (bmp_iter_set_init (&(ITER).bi, gimple_referenced_vars (cfun), 0, &(ITER).i); \ for ((VAR) = first_referenced_var (&(ITER)); \
referenced_var_iterator_set (&(ITER), &(VAR)); \ !end_referenced_vars_p (&(ITER)); \
bmp_iter_next (&(ITER).bi, &(ITER).i)) (VAR) = next_referenced_var (&(ITER)))
/* Iterate over all variables whose UID is set in the bitmap BM, putting the
current var in VAR. Note: It is undefined whether variables you add or
remove during the iteration show up or not. */
#define FOR_EACH_REFERENCED_VAR_IN_BITMAP(BM, VAR, ITER) \
for (bmp_iter_set_init (&(ITER).bi, (BM), 0, &(ITER).i); \
referenced_var_iterator_set (&(ITER), &(VAR)); \
bmp_iter_next (&(ITER).bi, &(ITER).i))
typedef struct typedef struct
{ {
...@@ -613,7 +609,7 @@ typedef struct ...@@ -613,7 +609,7 @@ typedef struct
extern tree referenced_var_lookup (unsigned int); extern tree referenced_var_lookup (unsigned int);
extern bool referenced_var_check_and_insert (tree); extern bool referenced_var_check_and_insert (tree);
#define num_referenced_vars bitmap_count_bits (gimple_referenced_vars (cfun)) #define num_referenced_vars htab_elements (gimple_referenced_vars (cfun))
#define referenced_var(i) referenced_var_lookup (i) #define referenced_var(i) referenced_var_lookup (i)
#define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names)) #define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names))
......
...@@ -1463,14 +1463,14 @@ dump_decl_set (FILE *file, bitmap set) ...@@ -1463,14 +1463,14 @@ dump_decl_set (FILE *file, bitmap set)
{ {
if (set) if (set)
{ {
referenced_var_iterator ri; bitmap_iterator bi;
tree var; unsigned i;
fprintf (file, "{ "); fprintf (file, "{ ");
FOR_EACH_REFERENCED_VAR_IN_BITMAP (set, var, ri) EXECUTE_IF_SET_IN_BITMAP (set, 0, i, bi)
{ {
print_generic_expr (file, var, 0); print_generic_expr (file, referenced_var (i), 0);
fprintf (file, " "); fprintf (file, " ");
} }
...@@ -3201,11 +3201,12 @@ update_ssa (unsigned update_flags) ...@@ -3201,11 +3201,12 @@ update_ssa (unsigned update_flags)
memory symbols into the set MEM_SYMS_TO_RENAME. */ memory symbols into the set MEM_SYMS_TO_RENAME. */
if (!bitmap_empty_p (syms_to_rename)) if (!bitmap_empty_p (syms_to_rename))
{ {
referenced_var_iterator ri; unsigned i;
tree sym; bitmap_iterator bi;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (syms_to_rename, sym, ri) EXECUTE_IF_SET_IN_BITMAP (syms_to_rename, 0, i, bi)
{ {
tree sym = referenced_var (i);
if (is_gimple_reg (sym)) if (is_gimple_reg (sym))
bitmap_set_bit (regs_to_rename, i); bitmap_set_bit (regs_to_rename, i);
else else
......
...@@ -1162,17 +1162,18 @@ scan_function (void) ...@@ -1162,17 +1162,18 @@ scan_function (void)
static const struct sra_walk_fns fns = { static const struct sra_walk_fns fns = {
scan_use, scan_copy, scan_init, scan_ldst, true scan_use, scan_copy, scan_init, scan_ldst, true
}; };
bitmap_iterator bi;
sra_walk_function (&fns); sra_walk_function (&fns);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
referenced_var_iterator ri; unsigned i;
tree var;
fputs ("\nScan results:\n", dump_file); fputs ("\nScan results:\n", dump_file);
FOR_EACH_REFERENCED_VAR_IN_BITMAP (sra_candidates, var, ri) EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
{ {
tree var = referenced_var (i);
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT); struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
if (elt) if (elt)
scan_dump (elt); scan_dump (elt);
...@@ -1949,18 +1950,19 @@ decide_block_copy (struct sra_elt *elt) ...@@ -1949,18 +1950,19 @@ decide_block_copy (struct sra_elt *elt)
static void static void
decide_instantiations (void) decide_instantiations (void)
{ {
unsigned int i;
bool cleared_any; bool cleared_any;
bitmap_head done_head; bitmap_head done_head;
referenced_var_iterator ri; bitmap_iterator bi;
tree var;
/* We cannot clear bits from a bitmap we're iterating over, /* We cannot clear bits from a bitmap we're iterating over,
so save up all the bits to clear until the end. */ so save up all the bits to clear until the end. */
bitmap_initialize (&done_head, &bitmap_default_obstack); bitmap_initialize (&done_head, &bitmap_default_obstack);
cleared_any = false; cleared_any = false;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (sra_candidates, var, ri) EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
{ {
tree var = referenced_var (i);
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT); struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
if (elt) if (elt)
{ {
...@@ -1970,7 +1972,7 @@ decide_instantiations (void) ...@@ -1970,7 +1972,7 @@ decide_instantiations (void)
} }
if (!elt) if (!elt)
{ {
bitmap_set_bit (&done_head, DECL_UID (var)); bitmap_set_bit (&done_head, i);
cleared_any = true; cleared_any = true;
} }
} }
...@@ -3530,11 +3532,12 @@ static void ...@@ -3530,11 +3532,12 @@ static void
scalarize_parms (void) scalarize_parms (void)
{ {
tree list = NULL; tree list = NULL;
referenced_var_iterator ri; unsigned i;
tree var; bitmap_iterator bi;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (needs_copy_in, var, ri) EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, bi)
{ {
tree var = referenced_var (i);
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT); struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
generate_copy_inout (elt, true, var, &list); generate_copy_inout (elt, true, var, &list);
} }
......
...@@ -452,11 +452,14 @@ build_reference_table (void) ...@@ -452,11 +452,14 @@ build_reference_table (void)
/* Add all aliased names to the interesting reference list. */ /* Add all aliased names to the interesting reference list. */
if (pi->pt_vars) if (pi->pt_vars)
{ {
referenced_var_iterator ri; unsigned ix;
tree alias; bitmap_iterator bi;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (pi->pt_vars, alias, ri) EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, ix, bi)
add_key (ref_table->objs, alias, references_pool); {
tree alias = referenced_var (ix);
add_key (ref_table->objs, alias, references_pool);
}
} }
} }
} }
...@@ -911,13 +914,17 @@ dsa_named_for (tree ptr) ...@@ -911,13 +914,17 @@ dsa_named_for (tree ptr)
/* For all the variables it could be aliased to. */ /* For all the variables it could be aliased to. */
if (pi->pt_vars) if (pi->pt_vars)
{ {
referenced_var_iterator ri; unsigned ix;
tree alias; bitmap_iterator bi;
EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, ix, bi)
{
tree alias = referenced_var (ix);
FOR_EACH_REFERENCED_VAR_IN_BITMAP (pi->pt_vars, alias, ri) if (nonstandard_alias_p (ptr, alias, false))
if (nonstandard_alias_p (ptr, alias, false)) strict_aliasing_warn (SSA_NAME_DEF_STMT (ptr),
strict_aliasing_warn (SSA_NAME_DEF_STMT (ptr), ptr, true, alias, false, true);
ptr, true, alias, false, true); }
} }
} }
} }
......
...@@ -390,7 +390,8 @@ mark_aliases_call_clobbered (tree tag, VEC (tree, heap) **worklist, ...@@ -390,7 +390,8 @@ mark_aliases_call_clobbered (tree tag, VEC (tree, heap) **worklist,
bitmap on_worklist, bitmap queued) bitmap on_worklist, bitmap queued)
{ {
bitmap aliases; bitmap aliases;
referenced_var_iterator ri; bitmap_iterator bi;
unsigned int i;
tree entry; tree entry;
var_ann_t ta = var_ann (tag); var_ann_t ta = var_ann (tag);
...@@ -400,8 +401,9 @@ mark_aliases_call_clobbered (tree tag, VEC (tree, heap) **worklist, ...@@ -400,8 +401,9 @@ mark_aliases_call_clobbered (tree tag, VEC (tree, heap) **worklist,
if (!aliases) if (!aliases)
return; return;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (aliases, entry, ri) EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
{ {
entry = referenced_var (i);
/* If you clobber one part of a structure, you /* If you clobber one part of a structure, you
clobber the entire thing. While this does not make clobber the entire thing. While this does not make
the world a particularly nice place, it is necessary the world a particularly nice place, it is necessary
...@@ -418,9 +420,9 @@ mark_aliases_call_clobbered (tree tag, VEC (tree, heap) **worklist, ...@@ -418,9 +420,9 @@ mark_aliases_call_clobbered (tree tag, VEC (tree, heap) **worklist,
} }
if (!bitmap_empty_p (queued)) if (!bitmap_empty_p (queued))
{ {
FOR_EACH_REFERENCED_VAR_IN_BITMAP (queued, entry, ri) EXECUTE_IF_SET_IN_BITMAP (queued, 0, i, bi)
{ {
subvar_t svars = get_subvars_for_var (entry); subvar_t svars = get_subvars_for_var (referenced_var (i));
unsigned int i; unsigned int i;
tree subvar; tree subvar;
...@@ -482,7 +484,8 @@ compute_tag_properties (void) ...@@ -482,7 +484,8 @@ compute_tag_properties (void)
for (k = 0; VEC_iterate (tree, taglist, k, tag); k++) for (k = 0; VEC_iterate (tree, taglist, k, tag); k++)
{ {
bitmap ma; bitmap ma;
referenced_var_iterator ri; bitmap_iterator bi;
unsigned int i;
tree entry; tree entry;
bool tagcc = is_call_clobbered (tag); bool tagcc = is_call_clobbered (tag);
bool tagglobal = MTAG_GLOBAL (tag); bool tagglobal = MTAG_GLOBAL (tag);
...@@ -494,8 +497,9 @@ compute_tag_properties (void) ...@@ -494,8 +497,9 @@ compute_tag_properties (void)
if (!ma) if (!ma)
continue; continue;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (ma, entry, ri) EXECUTE_IF_SET_IN_BITMAP (ma, 0, i, bi)
{ {
entry = referenced_var (i);
/* Call clobbered entries cause the tag to be marked /* Call clobbered entries cause the tag to be marked
call clobbered. */ call clobbered. */
if (!tagcc && is_call_clobbered (entry)) if (!tagcc && is_call_clobbered (entry))
...@@ -577,10 +581,12 @@ set_initial_properties (struct alias_info *ai) ...@@ -577,10 +581,12 @@ set_initial_properties (struct alias_info *ai)
if (pi->pt_vars) if (pi->pt_vars)
{ {
referenced_var_iterator ri; bitmap_iterator bi;
tree alias; unsigned int j;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (pi->pt_vars, alias, ri) EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi)
{ {
tree alias = referenced_var (j);
/* If you clobber one part of a structure, you /* If you clobber one part of a structure, you
clobber the entire thing. While this does not make clobber the entire thing. While this does not make
the world a particularly nice place, it is necessary the world a particularly nice place, it is necessary
...@@ -594,9 +600,9 @@ set_initial_properties (struct alias_info *ai) ...@@ -594,9 +600,9 @@ set_initial_properties (struct alias_info *ai)
/* Process variables we need to clobber all parts of. */ /* Process variables we need to clobber all parts of. */
if (!bitmap_empty_p (queued)) if (!bitmap_empty_p (queued))
{ {
FOR_EACH_REFERENCED_VAR_IN_BITMAP (queued, alias, ri) EXECUTE_IF_SET_IN_BITMAP (queued, 0, j, bi)
{ {
subvar_t svars = get_subvars_for_var (alias); subvar_t svars = get_subvars_for_var (referenced_var (j));
unsigned int i; unsigned int i;
tree subvar; tree subvar;
...@@ -1182,11 +1188,13 @@ find_partition_for (mem_sym_stats_t mp_p) ...@@ -1182,11 +1188,13 @@ find_partition_for (mem_sym_stats_t mp_p)
static void static void
rewrite_alias_set_for (tree tag, bitmap new_aliases) rewrite_alias_set_for (tree tag, bitmap new_aliases)
{ {
referenced_var_iterator ri; bitmap_iterator bi;
unsigned i;
tree mpt, sym; tree mpt, sym;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (MTAG_ALIASES (tag), sym, ri) EXECUTE_IF_SET_IN_BITMAP (MTAG_ALIASES (tag), 0, i, bi)
{ {
sym = referenced_var (i);
mpt = memory_partition (sym); mpt = memory_partition (sym);
if (mpt) if (mpt)
bitmap_set_bit (new_aliases, DECL_UID (mpt)); bitmap_set_bit (new_aliases, DECL_UID (mpt));
...@@ -1297,10 +1305,9 @@ estimate_vop_reduction (struct mem_ref_stats_d *mem_ref_stats, ...@@ -1297,10 +1305,9 @@ estimate_vop_reduction (struct mem_ref_stats_d *mem_ref_stats,
static void static void
update_reference_counts (struct mem_ref_stats_d *mem_ref_stats) update_reference_counts (struct mem_ref_stats_d *mem_ref_stats)
{ {
referenced_var_iterator ri; unsigned i;
bitmap_iterator bi;
mem_sym_stats_t sym_stats; mem_sym_stats_t sym_stats;
unsigned int i;
tree sym;
for (i = 1; i < num_ssa_names; i++) for (i = 1; i < num_ssa_names; i++)
{ {
...@@ -1313,7 +1320,9 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats) ...@@ -1313,7 +1320,9 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats)
&& (pi = SSA_NAME_PTR_INFO (ptr)) != NULL && (pi = SSA_NAME_PTR_INFO (ptr)) != NULL
&& pi->is_dereferenced) && pi->is_dereferenced)
{ {
tree tag, alias; unsigned j;
bitmap_iterator bj;
tree tag;
mem_sym_stats_t ptr_stats, tag_stats; mem_sym_stats_t ptr_stats, tag_stats;
/* If PTR has flow-sensitive points-to information, use /* If PTR has flow-sensitive points-to information, use
...@@ -1339,8 +1348,9 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats) ...@@ -1339,8 +1348,9 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats)
TAG's alias set, add as many indirect references to ALIAS TAG's alias set, add as many indirect references to ALIAS
as direct references there are for TAG. */ as direct references there are for TAG. */
if (MTAG_ALIASES (tag)) if (MTAG_ALIASES (tag))
FOR_EACH_REFERENCED_VAR_IN_BITMAP (MTAG_ALIASES (tag), alias, ri) EXECUTE_IF_SET_IN_BITMAP (MTAG_ALIASES (tag), 0, j, bj)
{ {
tree alias = referenced_var (j);
sym_stats = get_mem_sym_stats_for (alias); sym_stats = get_mem_sym_stats_for (alias);
/* All the direct references to TAG are indirect references /* All the direct references to TAG are indirect references
...@@ -1360,8 +1370,9 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats) ...@@ -1360,8 +1370,9 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats)
/* Call-clobbered symbols are indirectly written at every /* Call-clobbered symbols are indirectly written at every
call/asm site. */ call/asm site. */
FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun), sym, ri) EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
{ {
tree sym = referenced_var (i);
sym_stats = get_mem_sym_stats_for (sym); sym_stats = get_mem_sym_stats_for (sym);
sym_stats->num_indirect_writes += mem_ref_stats->num_call_sites sym_stats->num_indirect_writes += mem_ref_stats->num_call_sites
+ mem_ref_stats->num_asm_sites; + mem_ref_stats->num_asm_sites;
...@@ -1370,8 +1381,9 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats) ...@@ -1370,8 +1381,9 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats)
/* Addressable symbols are indirectly written at some ASM sites. /* Addressable symbols are indirectly written at some ASM sites.
Since only ASM sites that clobber memory actually affect Since only ASM sites that clobber memory actually affect
addressable symbols, this is an over-estimation. */ addressable symbols, this is an over-estimation. */
FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_addressable_vars (cfun), sym, ri) EXECUTE_IF_SET_IN_BITMAP (gimple_addressable_vars (cfun), 0, i, bi)
{ {
tree sym = referenced_var (i);
sym_stats = get_mem_sym_stats_for (sym); sym_stats = get_mem_sym_stats_for (sym);
sym_stats->num_indirect_writes += mem_ref_stats->num_asm_sites; sym_stats->num_indirect_writes += mem_ref_stats->num_asm_sites;
} }
...@@ -3470,12 +3482,14 @@ dump_may_aliases_for (FILE *file, tree var) ...@@ -3470,12 +3482,14 @@ dump_may_aliases_for (FILE *file, tree var)
aliases = MTAG_ALIASES (var); aliases = MTAG_ALIASES (var);
if (aliases) if (aliases)
{ {
referenced_var_iterator ri; bitmap_iterator bi;
unsigned int i;
tree al; tree al;
fprintf (file, "{ "); fprintf (file, "{ ");
FOR_EACH_REFERENCED_VAR_IN_BITMAP (aliases, al, ri) EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
{ {
al = referenced_var (i);
print_generic_expr (file, al, dump_flags); print_generic_expr (file, al, dump_flags);
fprintf (file, " "); fprintf (file, " ");
} }
......
...@@ -1469,9 +1469,7 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags, ...@@ -1469,9 +1469,7 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
if (MTAG_P (var)) if (MTAG_P (var))
aliases = MTAG_ALIASES (var); aliases = MTAG_ALIASES (var);
if (aliases == NULL if (aliases == NULL)
/* ??? We should not have created an empty aliases bitmap. */
|| bitmap_empty_p (aliases))
{ {
if (!gimple_aliases_computed_p (cfun) if (!gimple_aliases_computed_p (cfun)
&& (flags & opf_def)) && (flags & opf_def))
...@@ -1485,16 +1483,18 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags, ...@@ -1485,16 +1483,18 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
} }
else else
{ {
referenced_var_iterator ri; bitmap_iterator bi;
unsigned int i;
bool none_added = true; bool none_added = true;
tree al;
/* The variable is aliased. Add its aliases to the virtual /* The variable is aliased. Add its aliases to the virtual
operands. */ operands. */
gcc_assert (!bitmap_empty_p (aliases)); gcc_assert (!bitmap_empty_p (aliases));
FOR_EACH_REFERENCED_VAR_IN_BITMAP (aliases, al, ri) EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
{ {
tree al = referenced_var (i);
/* For SFTs we have to consider all subvariables of the parent var /* For SFTs we have to consider all subvariables of the parent var
if it is a potential points-to location. */ if it is a potential points-to location. */
if (TREE_CODE (al) == STRUCT_FIELD_TAG if (TREE_CODE (al) == STRUCT_FIELD_TAG
...@@ -1779,10 +1779,10 @@ get_tmr_operands (tree stmt, tree expr, int flags) ...@@ -1779,10 +1779,10 @@ get_tmr_operands (tree stmt, tree expr, int flags)
static void static void
add_call_clobber_ops (tree stmt, tree callee) add_call_clobber_ops (tree stmt, tree callee)
{ {
referenced_var_iterator ri; unsigned u;
bitmap_iterator bi;
stmt_ann_t s_ann = stmt_ann (stmt); stmt_ann_t s_ann = stmt_ann (stmt);
bitmap not_read_b, not_written_b; bitmap not_read_b, not_written_b;
tree var;
/* If we created .GLOBAL_VAR earlier, just use it. */ /* If we created .GLOBAL_VAR earlier, just use it. */
if (gimple_global_var (cfun)) if (gimple_global_var (cfun))
...@@ -1796,18 +1796,17 @@ add_call_clobber_ops (tree stmt, tree callee) ...@@ -1796,18 +1796,17 @@ add_call_clobber_ops (tree stmt, tree callee)
set for each static if the call being processed does not read set for each static if the call being processed does not read
or write that variable. */ or write that variable. */
not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL;
not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL; not_written_b = callee ? ipa_reference_get_not_written_global (callee) : NULL;
/* Add a VDEF operand for every call clobbered variable. */ /* Add a VDEF operand for every call clobbered variable. */
FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun), var, ri) EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi)
{ {
unsigned int escape_mask; tree var = referenced_var_lookup (u);
unsigned int escape_mask = var_ann (var)->escape_mask;
tree real_var = var; tree real_var = var;
bool not_read; bool not_read;
bool not_written; bool not_written;
escape_mask = var_ann (var)->escape_mask;
/* Not read and not written are computed on regular vars, not /* Not read and not written are computed on regular vars, not
subvars, so look at the parent var if this is an SFT. */ subvars, so look at the parent var if this is an SFT. */
if (TREE_CODE (var) == STRUCT_FIELD_TAG) if (TREE_CODE (var) == STRUCT_FIELD_TAG)
...@@ -1864,10 +1863,10 @@ add_call_clobber_ops (tree stmt, tree callee) ...@@ -1864,10 +1863,10 @@ add_call_clobber_ops (tree stmt, tree callee)
static void static void
add_call_read_ops (tree stmt, tree callee) add_call_read_ops (tree stmt, tree callee)
{ {
referenced_var_iterator ri; unsigned u;
bitmap_iterator bi;
stmt_ann_t s_ann = stmt_ann (stmt); stmt_ann_t s_ann = stmt_ann (stmt);
bitmap not_read_b; bitmap not_read_b;
tree var;
/* if the function is not pure, it may reference memory. Add /* if the function is not pure, it may reference memory. Add
a VUSE for .GLOBAL_VAR if it has been created. See add_referenced_var a VUSE for .GLOBAL_VAR if it has been created. See add_referenced_var
...@@ -1882,11 +1881,12 @@ add_call_read_ops (tree stmt, tree callee) ...@@ -1882,11 +1881,12 @@ add_call_read_ops (tree stmt, tree callee)
not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL; not_read_b = callee ? ipa_reference_get_not_read_global (callee) : NULL;
/* Add a VUSE for each call-clobbered variable. */ /* Add a VUSE for each call-clobbered variable. */
FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun), var, ri) EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi)
{ {
tree var = referenced_var (u);
tree real_var = var; tree real_var = var;
bool not_read; bool not_read;
clobber_stats.readonly_clobbers++; clobber_stats.readonly_clobbers++;
/* Not read and not written are computed on regular vars, not /* Not read and not written are computed on regular vars, not
...@@ -2008,18 +2008,21 @@ get_asm_expr_operands (tree stmt) ...@@ -2008,18 +2008,21 @@ get_asm_expr_operands (tree stmt)
for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link)) for (link = ASM_CLOBBERS (stmt); link; link = TREE_CHAIN (link))
if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0) if (strcmp (TREE_STRING_POINTER (TREE_VALUE (link)), "memory") == 0)
{ {
referenced_var_iterator ri; unsigned i;
tree var; bitmap_iterator bi;
s_ann->references_memory = true; s_ann->references_memory = true;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun), EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
var, ri) {
add_stmt_operand (&var, s_ann, opf_def | opf_implicit); tree var = referenced_var (i);
add_stmt_operand (&var, s_ann, opf_def | opf_implicit);
}
FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_addressable_vars (cfun), EXECUTE_IF_SET_IN_BITMAP (gimple_addressable_vars (cfun), 0, i, bi)
var, ri)
{ {
tree var = referenced_var (i);
/* Subvars are explicitly represented in this list, so we /* Subvars are explicitly represented in this list, so we
don't need the original to be added to the clobber ops, don't need the original to be added to the clobber ops,
but the original *will* be in this list because we keep but the original *will* be in this list because we keep
......
...@@ -3313,11 +3313,12 @@ update_alias_info (tree stmt, struct alias_info *ai) ...@@ -3313,11 +3313,12 @@ update_alias_info (tree stmt, struct alias_info *ai)
call-clobbered. */ call-clobbered. */
if (stmt_escape_type != NO_ESCAPE) if (stmt_escape_type != NO_ESCAPE)
{ {
referenced_var_iterator ri; bitmap_iterator bi;
tree rvar; unsigned i;
FOR_EACH_REFERENCED_VAR_IN_BITMAP (addr_taken, rvar, ri) EXECUTE_IF_SET_IN_BITMAP (addr_taken, 0, i, bi)
{ {
tree rvar = referenced_var (i);
if (!unmodifiable_var_p (rvar)) if (!unmodifiable_var_p (rvar))
mark_call_clobbered (rvar, stmt_escape_type); mark_call_clobbered (rvar, stmt_escape_type);
} }
...@@ -3475,8 +3476,8 @@ update_alias_info (tree stmt, struct alias_info *ai) ...@@ -3475,8 +3476,8 @@ update_alias_info (tree stmt, struct alias_info *ai)
memory reference stats for all memory symbols referenced by STMT. */ memory reference stats for all memory symbols referenced by STMT. */
if (stmt_references_memory_p (stmt)) if (stmt_references_memory_p (stmt))
{ {
referenced_var_iterator ri; unsigned i;
tree sym; bitmap_iterator bi;
mem_ref_stats->num_mem_stmts++; mem_ref_stats->num_mem_stmts++;
...@@ -3503,8 +3504,9 @@ update_alias_info (tree stmt, struct alias_info *ai) ...@@ -3503,8 +3504,9 @@ update_alias_info (tree stmt, struct alias_info *ai)
memory symbols in its argument list, but these cases do not memory symbols in its argument list, but these cases do not
occur so frequently as to constitute a serious problem. */ occur so frequently as to constitute a serious problem. */
if (STORED_SYMS (stmt)) if (STORED_SYMS (stmt))
FOR_EACH_REFERENCED_VAR_IN_BITMAP (STORED_SYMS (stmt), sym, ri) EXECUTE_IF_SET_IN_BITMAP (STORED_SYMS (stmt), 0, i, bi)
{ {
tree sym = referenced_var (i);
pointer_set_insert (ai->written_vars, sym); pointer_set_insert (ai->written_vars, sym);
if (!stmt_dereferences_ptr_p if (!stmt_dereferences_ptr_p
&& stmt_escape_type != ESCAPE_TO_CALL && stmt_escape_type != ESCAPE_TO_CALL
...@@ -3518,8 +3520,8 @@ update_alias_info (tree stmt, struct alias_info *ai) ...@@ -3518,8 +3520,8 @@ update_alias_info (tree stmt, struct alias_info *ai)
&& stmt_escape_type != ESCAPE_TO_CALL && stmt_escape_type != ESCAPE_TO_CALL
&& stmt_escape_type != ESCAPE_TO_PURE_CONST && stmt_escape_type != ESCAPE_TO_PURE_CONST
&& stmt_escape_type != ESCAPE_TO_ASM) && stmt_escape_type != ESCAPE_TO_ASM)
FOR_EACH_REFERENCED_VAR_IN_BITMAP (LOADED_SYMS (stmt), sym, ri) EXECUTE_IF_SET_IN_BITMAP (LOADED_SYMS (stmt), 0, i, bi)
update_mem_sym_stats_from_stmt (sym, stmt, 1, 0); update_mem_sym_stats_from_stmt (referenced_var (i), stmt, 1, 0);
} }
} }
...@@ -4879,6 +4881,8 @@ set_used_smts (void) ...@@ -4879,6 +4881,8 @@ set_used_smts (void)
static void static void
merge_smts_into (tree p, bitmap solution) merge_smts_into (tree p, bitmap solution)
{ {
unsigned int i;
bitmap_iterator bi;
tree smt; tree smt;
bitmap aliases; bitmap aliases;
tree var = p; tree var = p;
...@@ -4890,19 +4894,18 @@ merge_smts_into (tree p, bitmap solution) ...@@ -4890,19 +4894,18 @@ merge_smts_into (tree p, bitmap solution)
if (smt) if (smt)
{ {
alias_set_type smtset = get_alias_set (TREE_TYPE (smt)); alias_set_type smtset = get_alias_set (TREE_TYPE (smt));
referenced_var_iterator ri;
tree newsmt;
/* Need to set the SMT subsets first before this /* Need to set the SMT subsets first before this
will work properly. */ will work properly. */
bitmap_set_bit (solution, DECL_UID (smt)); bitmap_set_bit (solution, DECL_UID (smt));
FOR_EACH_REFERENCED_VAR_IN_BITMAP (used_smts, newsmt, ri) EXECUTE_IF_SET_IN_BITMAP (used_smts, 0, i, bi)
{ {
tree newsmt = referenced_var (i);
tree newsmttype = TREE_TYPE (newsmt); tree newsmttype = TREE_TYPE (newsmt);
if (alias_set_subset_of (get_alias_set (newsmttype), if (alias_set_subset_of (get_alias_set (newsmttype),
smtset)) smtset))
bitmap_set_bit (solution, DECL_UID (newsmt)); bitmap_set_bit (solution, i);
} }
aliases = MTAG_ALIASES (smt); aliases = MTAG_ALIASES (smt);
......
...@@ -378,23 +378,28 @@ verify_flow_insensitive_alias_info (void) ...@@ -378,23 +378,28 @@ verify_flow_insensitive_alias_info (void)
FOR_EACH_REFERENCED_VAR (var, rvi) FOR_EACH_REFERENCED_VAR (var, rvi)
{ {
unsigned int j;
bitmap aliases; bitmap aliases;
tree alias; tree alias;
referenced_var_iterator ri; bitmap_iterator bi;
if (!MTAG_P (var) || !MTAG_ALIASES (var)) if (!MTAG_P (var) || !MTAG_ALIASES (var))
continue; continue;
aliases = MTAG_ALIASES (var); aliases = MTAG_ALIASES (var);
FOR_EACH_REFERENCED_VAR_IN_BITMAP (aliases, alias, ri) EXECUTE_IF_SET_IN_BITMAP (aliases, 0, j, bi)
if (TREE_CODE (alias) != MEMORY_PARTITION_TAG {
&& !may_be_aliased (alias)) alias = referenced_var (j);
{
error ("non-addressable variable inside an alias set"); if (TREE_CODE (alias) != MEMORY_PARTITION_TAG
debug_variable (alias); && !may_be_aliased (alias))
goto err; {
} error ("non-addressable variable inside an alias set");
debug_variable (alias);
goto err;
}
}
} }
return; return;
...@@ -481,17 +486,20 @@ err: ...@@ -481,17 +486,20 @@ err:
static void static void
verify_call_clobbering (void) verify_call_clobbering (void)
{ {
referenced_var_iterator rvi; unsigned int i;
bitmap_iterator bi;
tree var; tree var;
referenced_var_iterator rvi;
/* At all times, the result of the call_clobbered flag should /* At all times, the result of the call_clobbered flag should
match the result of the call_clobbered_vars bitmap. Verify both match the result of the call_clobbered_vars bitmap. Verify both
that everything in call_clobbered_vars is marked that everything in call_clobbered_vars is marked
call_clobbered, and that everything marked call_clobbered, and that everything marked
call_clobbered is in call_clobbered_vars. */ call_clobbered is in call_clobbered_vars. */
FOR_EACH_REFERENCED_VAR_IN_BITMAP (gimple_call_clobbered_vars (cfun), EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, i, bi)
var, rvi)
{ {
var = referenced_var (i);
if (memory_partition (var)) if (memory_partition (var))
var = memory_partition (var); var = memory_partition (var);
...@@ -542,8 +550,8 @@ verify_memory_partitions (void) ...@@ -542,8 +550,8 @@ verify_memory_partitions (void)
for (i = 0; VEC_iterate (tree, mpt_table, i, mpt); i++) for (i = 0; VEC_iterate (tree, mpt_table, i, mpt); i++)
{ {
referenced_var_iterator ri; unsigned j;
tree var; bitmap_iterator bj;
if (MPT_SYMBOLS (mpt) == NULL) if (MPT_SYMBOLS (mpt) == NULL)
{ {
...@@ -552,14 +560,17 @@ verify_memory_partitions (void) ...@@ -552,14 +560,17 @@ verify_memory_partitions (void)
goto err; goto err;
} }
FOR_EACH_REFERENCED_VAR_IN_BITMAP (MPT_SYMBOLS (mpt), var, ri) EXECUTE_IF_SET_IN_BITMAP (MPT_SYMBOLS (mpt), 0, j, bj)
if (pointer_set_insert (partitioned_syms, var)) {
{ tree var = referenced_var (j);
error ("Partitioned symbols should belong to exactly one " if (pointer_set_insert (partitioned_syms, var))
"partition"); {
debug_variable (var); error ("Partitioned symbols should belong to exactly one "
goto err; "partition");
} debug_variable (var);
goto err;
}
}
} }
pointer_set_destroy (partitioned_syms); pointer_set_destroy (partitioned_syms);
...@@ -763,6 +774,24 @@ int_tree_map_hash (const void *item) ...@@ -763,6 +774,24 @@ int_tree_map_hash (const void *item)
return ((const struct int_tree_map *)item)->uid; return ((const struct int_tree_map *)item)->uid;
} }
/* Return true if the DECL_UID in both trees are equal. */
int
uid_decl_map_eq (const void *va, const void *vb)
{
const_tree a = (const_tree) va;
const_tree b = (const_tree) vb;
return (a->decl_minimal.uid == b->decl_minimal.uid);
}
/* Hash a tree in a uid_decl_map. */
unsigned int
uid_decl_map_hash (const void *item)
{
return ((const_tree)item)->decl_minimal.uid;
}
/* Return true if the uid in both int tree maps are equal. */ /* Return true if the uid in both int tree maps are equal. */
static int static int
...@@ -806,7 +835,8 @@ void ...@@ -806,7 +835,8 @@ void
init_tree_ssa (void) init_tree_ssa (void)
{ {
cfun->gimple_df = GGC_CNEW (struct gimple_df); cfun->gimple_df = GGC_CNEW (struct gimple_df);
cfun->gimple_df->referenced_vars = BITMAP_GGC_ALLOC (); cfun->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash,
uid_decl_map_eq, NULL);
cfun->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, cfun->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash,
uid_ssaname_map_eq, NULL); uid_ssaname_map_eq, NULL);
cfun->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash, cfun->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash,
...@@ -863,6 +893,7 @@ delete_tree_ssa (void) ...@@ -863,6 +893,7 @@ delete_tree_ssa (void)
ggc_free (var->base.ann); ggc_free (var->base.ann);
var->base.ann = NULL; var->base.ann = NULL;
} }
htab_delete (gimple_referenced_vars (cfun));
cfun->gimple_df->referenced_vars = NULL; cfun->gimple_df->referenced_vars = NULL;
fini_ssanames (); fini_ssanames ();
......
...@@ -110,12 +110,6 @@ static GTY(()) int next_decl_uid; ...@@ -110,12 +110,6 @@ static GTY(()) int next_decl_uid;
/* Unique id for next type created. */ /* Unique id for next type created. */
static GTY(()) int next_type_uid = 1; static GTY(()) int next_type_uid = 1;
/* Mapping from unique DECL_UID to the decl tree node. */
static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node)))
htab_t decl_for_uid_map;
static void insert_decl_to_uid_decl_map (tree);
/* Since we cannot rehash a type after it is in the table, we have to /* Since we cannot rehash a type after it is in the table, we have to
keep the hash code. */ keep the hash code. */
...@@ -237,9 +231,6 @@ init_ttree (void) ...@@ -237,9 +231,6 @@ init_ttree (void)
int_cst_node = make_node (INTEGER_CST); int_cst_node = make_node (INTEGER_CST);
decl_for_uid_map = htab_create_ggc (4093, uid_decl_map_hash,
uid_decl_map_eq, NULL);
tree_contains_struct[FUNCTION_DECL][TS_DECL_NON_COMMON] = 1; tree_contains_struct[FUNCTION_DECL][TS_DECL_NON_COMMON] = 1;
tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_NON_COMMON] = 1; tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_NON_COMMON] = 1;
tree_contains_struct[TYPE_DECL][TS_DECL_NON_COMMON] = 1; tree_contains_struct[TYPE_DECL][TS_DECL_NON_COMMON] = 1;
...@@ -610,7 +601,6 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) ...@@ -610,7 +601,6 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
} }
DECL_SOURCE_LOCATION (t) = input_location; DECL_SOURCE_LOCATION (t) = input_location;
DECL_UID (t) = next_decl_uid++; DECL_UID (t) = next_decl_uid++;
insert_decl_to_uid_decl_map (t);
break; break;
...@@ -714,7 +704,6 @@ copy_node_stat (tree node MEM_STAT_DECL) ...@@ -714,7 +704,6 @@ copy_node_stat (tree node MEM_STAT_DECL)
SET_DECL_RESTRICT_BASE (t, DECL_GET_RESTRICT_BASE (node)); SET_DECL_RESTRICT_BASE (t, DECL_GET_RESTRICT_BASE (node));
DECL_BASED_ON_RESTRICT_P (t) = 1; DECL_BASED_ON_RESTRICT_P (t) = 1;
} }
insert_decl_to_uid_decl_map (t);
} }
else if (TREE_CODE_CLASS (code) == tcc_type) else if (TREE_CODE_CLASS (code) == tcc_type)
{ {
...@@ -3336,70 +3325,6 @@ build_nt_call_list (tree fn, tree arglist) ...@@ -3336,70 +3325,6 @@ build_nt_call_list (tree fn, tree arglist)
return t; return t;
} }
/* Return true if the DECL_UID in both trees are equal. */
int
uid_decl_map_eq (const void *va, const void *vb)
{
const_tree a = (const_tree) va;
const_tree b = (const_tree) vb;
return (a->decl_minimal.uid == b->decl_minimal.uid);
}
/* Hash a tree in a uid_decl_map. */
unsigned int
uid_decl_map_hash (const void *item)
{
return ((const_tree)item)->decl_minimal.uid;
}
/* Insert the declaration NODE into the map mapping its unique uid
back to the tree. */
static void
insert_decl_to_uid_decl_map (tree node)
{
void **slot;
struct tree_decl_minimal key;
key.uid = DECL_UID (node);
slot = htab_find_slot_with_hash (decl_for_uid_map,
&key, DECL_UID (node), INSERT);
/* We should never try to re-insert a decl with the same uid.
??? The C++ frontend breaks this invariant. Hopefully in a
non-fatal way, so just overwrite the slot in this case. */
#if 0
gcc_assert (!*slot);
#endif
*(tree *)slot = node;
}
/* Lookup the declaration tree from its unique DECL_UID UID. Returns
the tree node with DECL_UID UID or NULL, if this node was collected. */
tree
lookup_decl_from_uid (int uid)
{
struct tree_decl_minimal key;
key.uid = uid;
return (tree) htab_find_with_hash (decl_for_uid_map, &key, uid);
}
/* Print out the statistics for the decl_for_uid_map hash table. */
static void
print_decl_for_uid_map_statistics (void)
{
fprintf (stderr, "DECL_FOR_UID_MAP hash: size %ld, %ld elements, %f collisions\n",
(long) htab_size (decl_for_uid_map),
(long) htab_elements (decl_for_uid_map),
htab_collisions (decl_for_uid_map));
}
/* Create a DECL_... node of code CODE, name NAME and data type TYPE. /* Create a DECL_... node of code CODE, name NAME and data type TYPE.
We do NOT enter this node in any sort of symbol table. We do NOT enter this node in any sort of symbol table.
...@@ -6729,7 +6654,6 @@ dump_tree_statistics (void) ...@@ -6729,7 +6654,6 @@ dump_tree_statistics (void)
print_debug_expr_statistics (); print_debug_expr_statistics ();
print_value_expr_statistics (); print_value_expr_statistics ();
print_restrict_base_statistics (); print_restrict_base_statistics ();
print_decl_for_uid_map_statistics ();
lang_hooks.print_statistics (); lang_hooks.print_statistics ();
} }
......
...@@ -5233,12 +5233,6 @@ struct tree_int_map GTY(()) ...@@ -5233,12 +5233,6 @@ struct tree_int_map GTY(())
#define tree_int_map_hash tree_map_base_hash #define tree_int_map_hash tree_map_base_hash
#define tree_int_map_marked_p tree_map_base_marked_p #define tree_int_map_marked_p tree_map_base_marked_p
/* Map from a DECL_UID to the decl tree. */
extern unsigned int uid_decl_map_hash (const void *);
extern int uid_decl_map_eq (const void *, const void *);
extern tree lookup_decl_from_uid (int);
/* Map from a tree to initialization/finalization priorities. */ /* Map from a tree to initialization/finalization priorities. */
struct tree_priority_map GTY(()) struct tree_priority_map GTY(())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment