OSDN Git Service

* tree.h (struct tree_decl_map): New type.
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Jun 2010 19:49:21 +0000 (19:49 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 2 Jun 2010 19:49:21 +0000 (19:49 +0000)
(tree_decl_map_eq, tree_decl_map_marked_p): Define.
(tree_decl_map_hash): New prototype.
(debug_expr_for_decl, value_expr_for_decl): Change into
tree_decl_map hashtab from tree_map.
(init_ttree): Adjust initialization.
(tree_decl_map_hash): New function.
(decl_debug_expr_lookup, decl_debug_expr_insert,
decl_value_expr_lookup, decl_value_expr_insert): Adjust.
cp/
* cp-objcp-common.c (shadowed_var_for_decl): Change into
tree_decl_map hashtab from tree_map.
(decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Adjust.
(init_shadowed_var_for_decl): Adjust initialization.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160185 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-objcp-common.c
gcc/tree.c
gcc/tree.h

index 3fb2eec..fa3806c 100644 (file)
@@ -1,3 +1,15 @@
+2010-06-02  Jakub Jelinek  <jakub@redhat.com>
+
+       * tree.h (struct tree_decl_map): New type.
+       (tree_decl_map_eq, tree_decl_map_marked_p): Define.
+       (tree_decl_map_hash): New prototype.
+       (debug_expr_for_decl, value_expr_for_decl): Change into
+       tree_decl_map hashtab from tree_map.
+       (init_ttree): Adjust initialization.
+       (tree_decl_map_hash): New function.
+       (decl_debug_expr_lookup, decl_debug_expr_insert,
+       decl_value_expr_lookup, decl_value_expr_insert): Adjust.
+
 2010-06-02  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * configure.ac (gcc_cv_ld_sol2_emulation): Test for GNU ld *_sol2
index 09bbe68..1dabc4c 100644 (file)
@@ -1,3 +1,10 @@
+2010-06-02  Jakub Jelinek  <jakub@redhat.com>
+
+       * cp-objcp-common.c (shadowed_var_for_decl): Change into
+       tree_decl_map hashtab from tree_map.
+       (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Adjust.
+       (init_shadowed_var_for_decl): Adjust initialization.
+
 2010-06-02  Jason Merrill  <jason@redhat.com>
 
        * error.c (dump_type): Improve typedef handling.
index 460f32f..35654c5 100644 (file)
@@ -1,5 +1,5 @@
 /* Some code common to C++ and ObjC++ front ends.
-   Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
    Contributed by Ziemowit Laski  <zlaski@apple.com>
 
 This file is part of GCC.
@@ -177,7 +177,7 @@ has_c_linkage (const_tree decl)
   return DECL_EXTERN_C_P (decl);
 }
 
-static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
+static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_map)))
      htab_t shadowed_var_for_decl;
 
 /* Lookup a shadowed var for FROM, and return it if we find one.  */
@@ -185,11 +185,11 @@ static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
 tree
 decl_shadowed_for_var_lookup (tree from)
 {
-  struct tree_map *h, in;
+  struct tree_decl_map *h, in;
   in.base.from = from;
 
-  h = (struct tree_map *) htab_find_with_hash (shadowed_var_for_decl, &in,
-                                              htab_hash_pointer (from));
+  h = (struct tree_decl_map *)
+      htab_find_with_hash (shadowed_var_for_decl, &in, DECL_UID (from));
   if (h)
     return h->to;
   return NULL_TREE;
@@ -200,22 +200,22 @@ decl_shadowed_for_var_lookup (tree from)
 void
 decl_shadowed_for_var_insert (tree from, tree to)
 {
-  struct tree_map *h;
+  struct tree_decl_map *h;
   void **loc;
 
-  h = GGC_NEW (struct tree_map);
-  h->hash = htab_hash_pointer (from);
+  h = GGC_NEW (struct tree_decl_map);
   h->base.from = from;
   h->to = to;
-  loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, h->hash, INSERT);
-  *(struct tree_map **) loc = h;
+  loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, DECL_UID (from),
+                                 INSERT);
+  *(struct tree_decl_map **) loc = h;
 }
 
 void
 init_shadowed_var_for_decl (void)
 {
-  shadowed_var_for_decl = htab_create_ggc (512, tree_map_hash,
-                                          tree_map_eq, 0);
+  shadowed_var_for_decl = htab_create_ggc (512, tree_decl_map_hash,
+                                          tree_decl_map_eq, 0);
 }
 
 
index 81ea666..67e2f41 100644 (file)
@@ -196,10 +196,10 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node)))
 /* General tree->tree mapping  structure for use in hash tables.  */
 
 
-static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
+static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_map)))
      htab_t debug_expr_for_decl;
 
-static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map)))
+static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_map)))
      htab_t value_expr_for_decl;
 
 static GTY ((if_marked ("tree_priority_map_marked_p"),
@@ -533,11 +533,11 @@ init_ttree (void)
   type_hash_table = htab_create_ggc (TYPE_HASH_INITIAL_SIZE, type_hash_hash,
                                     type_hash_eq, 0);
 
-  debug_expr_for_decl = htab_create_ggc (512, tree_map_hash,
-                                        tree_map_eq, 0);
+  debug_expr_for_decl = htab_create_ggc (512, tree_decl_map_hash,
+                                        tree_decl_map_eq, 0);
 
-  value_expr_for_decl = htab_create_ggc (512, tree_map_hash,
-                                        tree_map_eq, 0);
+  value_expr_for_decl = htab_create_ggc (512, tree_decl_map_hash,
+                                        tree_decl_map_eq, 0);
   init_priority_for_decl = htab_create_ggc (512, tree_priority_map_hash,
                                            tree_priority_map_eq, 0);
 
@@ -5560,7 +5560,7 @@ tree_map_base_eq (const void *va, const void *vb)
   return (a->from == b->from);
 }
 
-/* Hash a from tree in a tree_map.  */
+/* Hash a from tree in a tree_base_map.  */
 
 unsigned int
 tree_map_base_hash (const void *item)
@@ -5578,12 +5578,22 @@ tree_map_base_marked_p (const void *p)
   return ggc_marked_p (((const struct tree_map_base *) p)->from);
 }
 
+/* Hash a from tree in a tree_map.  */
+
 unsigned int
 tree_map_hash (const void *item)
 {
   return (((const struct tree_map *) item)->hash);
 }
 
+/* Hash a from tree in a tree_decl_map.  */
+
+unsigned int
+tree_decl_map_hash (const void *item)
+{
+  return DECL_UID (((const struct tree_decl_map *) item)->base.from);
+}
+
 /* Return the initialization priority for DECL.  */
 
 priority_type
@@ -5689,11 +5699,11 @@ print_value_expr_statistics (void)
 tree
 decl_debug_expr_lookup (tree from)
 {
-  struct tree_map *h, in;
+  struct tree_decl_map *h, in;
   in.base.from = from;
 
-  h = (struct tree_map *) htab_find_with_hash (debug_expr_for_decl, &in,
-                                              htab_hash_pointer (from));
+  h = (struct tree_decl_map *)
+      htab_find_with_hash (debug_expr_for_decl, &in, DECL_UID (from));
   if (h)
     return h->to;
   return NULL_TREE;
@@ -5704,15 +5714,15 @@ decl_debug_expr_lookup (tree from)
 void
 decl_debug_expr_insert (tree from, tree to)
 {
-  struct tree_map *h;
+  struct tree_decl_map *h;
   void **loc;
 
-  h = GGC_NEW (struct tree_map);
-  h->hash = htab_hash_pointer (from);
+  h = GGC_NEW (struct tree_decl_map);
   h->base.from = from;
   h->to = to;
-  loc = htab_find_slot_with_hash (debug_expr_for_decl, h, h->hash, INSERT);
-  *(struct tree_map **) loc = h;
+  loc = htab_find_slot_with_hash (debug_expr_for_decl, h, DECL_UID (from),
+                                 INSERT);
+  *(struct tree_decl_map **) loc = h;
 }
 
 /* Lookup a value expression for FROM, and return it if we find one.  */
@@ -5720,11 +5730,11 @@ decl_debug_expr_insert (tree from, tree to)
 tree
 decl_value_expr_lookup (tree from)
 {
-  struct tree_map *h, in;
+  struct tree_decl_map *h, in;
   in.base.from = from;
 
-  h = (struct tree_map *) htab_find_with_hash (value_expr_for_decl, &in,
-                                              htab_hash_pointer (from));
+  h = (struct tree_decl_map *)
+      htab_find_with_hash (value_expr_for_decl, &in, DECL_UID (from));
   if (h)
     return h->to;
   return NULL_TREE;
@@ -5735,15 +5745,15 @@ decl_value_expr_lookup (tree from)
 void
 decl_value_expr_insert (tree from, tree to)
 {
-  struct tree_map *h;
+  struct tree_decl_map *h;
   void **loc;
 
-  h = GGC_NEW (struct tree_map);
-  h->hash = htab_hash_pointer (from);
+  h = GGC_NEW (struct tree_decl_map);
   h->base.from = from;
   h->to = to;
-  loc = htab_find_slot_with_hash (value_expr_for_decl, h, h->hash, INSERT);
-  *(struct tree_map **) loc = h;
+  loc = htab_find_slot_with_hash (value_expr_for_decl, h, DECL_UID (from),
+                                 INSERT);
+  *(struct tree_decl_map **) loc = h;
 }
 
 /* Hashing of types so that we don't make duplicates.
index e94bdc8..13c684a 100644 (file)
@@ -5381,6 +5381,17 @@ struct GTY(()) tree_map {
 extern unsigned int tree_map_hash (const void *);
 #define tree_map_marked_p tree_map_base_marked_p
 
+/* Map from a decl tree to another tree.  */
+
+struct GTY(()) tree_decl_map {
+  struct tree_map_base base;
+  tree to;
+};
+
+#define tree_decl_map_eq tree_map_base_eq
+extern unsigned int tree_decl_map_hash (const void *);
+#define tree_decl_map_marked_p tree_map_base_marked_p
+
 /* Map from a tree to an int.  */
 
 struct GTY(()) tree_int_map {