Commit 9fc5a389 by Richard Guenther Committed by Richard Biener

tree-flow.h (struct gimple_df): Make referenced_vars a uid_decl_map.

2007-10-18  Richard Guenther  <rguenther@suse.de>

	* tree-flow.h (struct gimple_df): Make referenced_vars
	a uid_decl_map.
	(uid_decl_map_eq): Declare.
	(uid_decl_map_hash): Likewise.
	* tree-ssa.c (uid_decl_map_eq): New function.
	(uid_decl_map_hash): Likewise.
	(init_tree_ssa): Make referenced_vars a uid_decl_map.
	* tree-flow-inline.h (first_referenced_var): Deal with
	the referenced_vars representation change.
	(next_referenced_var): Likewise.
	* tree-dfa.c (referenced_var_lookup): Likewise.
	(referenced_var_check_and_insert): Likewise.
	(remove_referenced_var): Likewise.

From-SVN: r129440
parent 076a5ce6
2007-10-18 Richard Guenther <rguenther@suse.de>
* tree-flow.h (struct gimple_df): Make referenced_vars
a uid_decl_map.
(uid_decl_map_eq): Declare.
(uid_decl_map_hash): Likewise.
* tree-ssa.c (uid_decl_map_eq): New function.
(uid_decl_map_hash): Likewise.
(init_tree_ssa): Make referenced_vars a uid_decl_map.
* tree-flow-inline.h (first_referenced_var): Deal with
the referenced_vars representation change.
(next_referenced_var): Likewise.
* tree-dfa.c (referenced_var_lookup): Likewise.
(referenced_var_check_and_insert): Likewise.
(remove_referenced_var): Likewise.
2007-10-18 Daniel Jacobowitz <dan@codesourcery.com> 2007-10-18 Daniel Jacobowitz <dan@codesourcery.com>
* config/mips/mips.c (mips_dwarf_register_span): New. * config/mips/mips.c (mips_dwarf_register_span): New.
...@@ -635,14 +635,12 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) ...@@ -635,14 +635,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)
{ {
struct int_tree_map *h, in; tree h;
struct tree_decl_minimal in;
in.uid = uid; in.uid = uid;
h = (struct int_tree_map *) h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
gcc_assert (h || uid == 0); gcc_assert (h || uid == 0);
if (h) return h;
return h->to;
return NULL_TREE;
} }
/* 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.
...@@ -651,29 +649,23 @@ referenced_var_lookup (unsigned int uid) ...@@ -651,29 +649,23 @@ referenced_var_lookup (unsigned int uid)
bool bool
referenced_var_check_and_insert (tree to) referenced_var_check_and_insert (tree to)
{ {
struct int_tree_map *h, in; tree h, *loc;
void **loc; struct tree_decl_minimal in;
unsigned int uid = DECL_UID (to); unsigned int uid = DECL_UID (to);
in.uid = uid; in.uid = uid;
in.to = to; h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
h = (struct int_tree_map *) htab_find_with_hash (gimple_referenced_vars (cfun),
&in, uid);
if (h) if (h)
{ {
/* DECL_UID has already been entered in the table. Verify that it is /* DECL_UID has already been entered in the table. Verify that it is
the same entry as TO. See PR 27793. */ the same entry as TO. See PR 27793. */
gcc_assert (h->to == to); gcc_assert (h == to);
return false; return false;
} }
h = GGC_NEW (struct int_tree_map); loc = (tree *) htab_find_slot_with_hash (gimple_referenced_vars (cfun),
h->uid = uid; &in, uid, INSERT);
h->to = to; *loc = to;
loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun),
h, uid, INSERT);
*(struct int_tree_map **) loc = h;
return true; return true;
} }
...@@ -774,7 +766,7 @@ void ...@@ -774,7 +766,7 @@ void
remove_referenced_var (tree var) remove_referenced_var (tree var)
{ {
var_ann_t v_ann; var_ann_t v_ann;
struct int_tree_map in; struct tree_decl_minimal in;
void **loc; void **loc;
unsigned int uid = DECL_UID (var); unsigned int uid = DECL_UID (var);
...@@ -784,10 +776,8 @@ remove_referenced_var (tree var) ...@@ -784,10 +776,8 @@ remove_referenced_var (tree var)
var->base.ann = NULL; var->base.ann = NULL;
gcc_assert (DECL_P (var)); gcc_assert (DECL_P (var));
in.uid = uid; in.uid = uid;
in.to = var;
loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid, loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid,
NO_INSERT); NO_INSERT);
ggc_free (*loc);
htab_clear_slot (gimple_referenced_vars (cfun), loc); htab_clear_slot (gimple_referenced_vars (cfun), loc);
} }
......
...@@ -151,13 +151,8 @@ next_htab_element (htab_iterator *hti) ...@@ -151,13 +151,8 @@ next_htab_element (htab_iterator *hti)
static inline tree static inline tree
first_referenced_var (referenced_var_iterator *iter) first_referenced_var (referenced_var_iterator *iter)
{ {
struct int_tree_map *itm; return (tree) first_htab_element (&iter->hti,
itm = (struct int_tree_map *) first_htab_element (&iter->hti, gimple_referenced_vars (cfun));
gimple_referenced_vars
(cfun));
if (!itm)
return NULL;
return itm->to;
} }
/* Return true if we have hit the end of the referenced variables ITER is /* Return true if we have hit the end of the referenced variables ITER is
...@@ -175,11 +170,7 @@ end_referenced_vars_p (const referenced_var_iterator *iter) ...@@ -175,11 +170,7 @@ end_referenced_vars_p (const referenced_var_iterator *iter)
static inline tree static inline tree
next_referenced_var (referenced_var_iterator *iter) next_referenced_var (referenced_var_iterator *iter)
{ {
struct int_tree_map *itm; return (tree) next_htab_element (&iter->hti);
itm = (struct int_tree_map *) next_htab_element (&iter->hti);
if (!itm)
return NULL;
return itm->to;
} }
/* Fill up VEC with the variables in the referenced vars hashtable. */ /* Fill up VEC with the variables in the referenced vars hashtable. */
......
...@@ -120,7 +120,7 @@ struct mem_ref_stats_d GTY(()) ...@@ -120,7 +120,7 @@ struct mem_ref_stats_d GTY(())
struct gimple_df GTY(()) struct gimple_df GTY(())
{ {
/* Array of all variables referenced in the function. */ /* Array of all variables referenced in the function. */
htab_t GTY((param_is (struct int_tree_map))) 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
...@@ -561,6 +561,9 @@ struct int_tree_map GTY(()) ...@@ -561,6 +561,9 @@ 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
{ {
htab_iterator hti; htab_iterator hti;
......
...@@ -774,6 +774,24 @@ int_tree_map_hash (const void *item) ...@@ -774,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
...@@ -799,8 +817,8 @@ void ...@@ -799,8 +817,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 = htab_create_ggc (20, int_tree_map_hash, cfun->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash,
int_tree_map_eq, NULL); uid_decl_map_eq, NULL);
cfun->gimple_df->default_defs = htab_create_ggc (20, int_tree_map_hash, cfun->gimple_df->default_defs = htab_create_ggc (20, int_tree_map_hash,
int_tree_map_eq, NULL); int_tree_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,
......
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