]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-flow.h (struct gimple_df): Make referenced_vars a uid_decl_map.
authorRichard Guenther <rguenther@suse.de>
Thu, 18 Oct 2007 14:51:54 +0000 (14:51 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 18 Oct 2007 14:51:54 +0000 (14:51 +0000)
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

gcc/ChangeLog
gcc/tree-dfa.c
gcc/tree-flow-inline.h
gcc/tree-flow.h
gcc/tree-ssa.c

index c8b1e2f146ec08b19a8d300f29015ca9124f19a0..976022755d87f4d89e536eea135827c89b1bc47a 100644 (file)
@@ -1,3 +1,19 @@
+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.
index e6b593e7214452f7d967482615fcdf82bab560c4..26e87c173b4cd834367d7da09b266dd4848889ab 100644 (file)
@@ -635,14 +635,12 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
 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.  
@@ -651,29 +649,23 @@ referenced_var_lookup (unsigned int uid)
 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;
 }
 
@@ -774,7 +766,7 @@ void
 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);
 
@@ -784,10 +776,8 @@ remove_referenced_var (tree 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);
 }
 
index 71e607bddce0d4cb2e5bfabfa369939584bddf9a..7f47bba4c7d794928845a64f8fda1a27fd6b21f9 100644 (file)
@@ -151,13 +151,8 @@ next_htab_element (htab_iterator *hti)
 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
@@ -175,11 +170,7 @@ end_referenced_vars_p (const referenced_var_iterator *iter)
 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.  */
index 518e4f2236ef09b13fe130b2289c8e052a70171a..b004ad9b3b6253b6c316b659c7c77d1e218b79e5 100644 (file)
@@ -120,7 +120,7 @@ struct mem_ref_stats_d GTY(())
 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
@@ -561,6 +561,9 @@ struct int_tree_map GTY(())
 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;
index 9723afb0eec3d19232717528ef2efc07af10b3eb..e325953884cb09e089bc3db18f3b61cfc92a8927 100644 (file)
@@ -774,6 +774,24 @@ int_tree_map_hash (const void *item)
   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
@@ -799,8 +817,8 @@ void
 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,