+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>
* config/mips/mips.c (mips_dwarf_register_span): New.
tree
referenced_var_lookup (unsigned int uid)
{
- struct int_tree_map *h, in;
+ tree h;
+ struct tree_decl_minimal in;
in.uid = uid;
- h = (struct int_tree_map *)
- htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
+ h = (tree) htab_find_with_hash (gimple_referenced_vars (cfun), &in, uid);
gcc_assert (h || uid == 0);
- if (h)
- return h->to;
- return NULL_TREE;
+ return h;
}
/* Check if TO is in the referenced_vars hash table and insert it if not.
bool
referenced_var_check_and_insert (tree to)
{
- struct int_tree_map *h, in;
- void **loc;
+ tree h, *loc;
+ struct tree_decl_minimal in;
unsigned int uid = DECL_UID (to);
in.uid = uid;
- in.to = to;
- h = (struct int_tree_map *) htab_find_with_hash (gimple_referenced_vars (cfun),
- &in, 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 == to);
+ gcc_assert (h == to);
return false;
}
- h = GGC_NEW (struct int_tree_map);
- h->uid = uid;
- h->to = to;
- loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun),
- h, uid, INSERT);
- *(struct int_tree_map **) loc = h;
+ loc = (tree *) htab_find_slot_with_hash (gimple_referenced_vars (cfun),
+ &in, uid, INSERT);
+ *loc = to;
return true;
}
remove_referenced_var (tree var)
{
var_ann_t v_ann;
- struct int_tree_map in;
+ struct tree_decl_minimal in;
void **loc;
unsigned int uid = DECL_UID (var);
var->base.ann = NULL;
gcc_assert (DECL_P (var));
in.uid = uid;
- in.to = var;
loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid,
NO_INSERT);
- ggc_free (*loc);
htab_clear_slot (gimple_referenced_vars (cfun), loc);
}
static inline tree
first_referenced_var (referenced_var_iterator *iter)
{
- struct int_tree_map *itm;
- itm = (struct int_tree_map *) first_htab_element (&iter->hti,
- gimple_referenced_vars
- (cfun));
- if (!itm)
- return NULL;
- return itm->to;
+ 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
static inline tree
next_referenced_var (referenced_var_iterator *iter)
{
- struct int_tree_map *itm;
- itm = (struct int_tree_map *) next_htab_element (&iter->hti);
- if (!itm)
- return NULL;
- return itm->to;
+ return (tree) next_htab_element (&iter->hti);
}
/* Fill up VEC with the variables in the referenced vars hashtable. */
struct gimple_df GTY(())
{
/* 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.
cleanup_control_flow uses it to detect cases where a mid-block
extern unsigned int int_tree_map_hash (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
{
htab_iterator hti;
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. */
static int
init_tree_ssa (void)
{
cfun->gimple_df = GGC_CNEW (struct gimple_df);
- cfun->gimple_df->referenced_vars = htab_create_ggc (20, int_tree_map_hash,
- int_tree_map_eq, NULL);
+ 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, int_tree_map_hash,
int_tree_map_eq, NULL);
cfun->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash,