This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto] Re-implement pass_ipa_free_lang_specifics [2/3]


This part removes the hash tables uid2type_map and
decl_for_uid_map.


Diego.

	* tree.c (uid2type_map): Remove.  Update all users.
	(decl_for_uid_map): Remove.  Update all users.
	(insert_decl_to_uid_decl_map): Remove.  Update all users.
	(insert_type_to_uid_type_map): Remove.  Update all users.
	(uid_type_map_eq): Remove.  Update all users.
	(uid_type_map_hash): Remove.  Update all users.
	(insert_decl_to_uid_decl_map): Remove.  Update all users.
	(remove_decl_from_map): Remove.  Update all users.

Index: tree.c
===================================================================
--- tree.c	(revision 143495)
+++ tree.c	(working copy)
@@ -147,15 +150,6 @@ static GTY(()) int next_decl_uid;
 /* Unique id for next type created.  */
 static GTY(()) int next_type_uid = 1;
 
-static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node)))
-     htab_t uid2type_map;
-
-/* 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
    keep the hash code.  */
 
@@ -271,41 +265,6 @@ const char * const omp_clause_code_name[
 
 /* Init tree.c.  */
 
-/* Add tree NODE into the UID2TYPE_MAP hash table. */
-
-static void
-insert_type_to_uid_type_map (tree node)
-{
-  void **slot;
-  struct tree_type key;
-
-  key.uid = TYPE_UID (node);
-  slot = htab_find_slot_with_hash (uid2type_map,
-				   &key, TYPE_UID (node), INSERT);
-
-  gcc_assert (!*slot);
-
-  *(tree *)slot = node;
-}
-
-/* Compares tree VA and tree VB.  */
-
-static int
-uid_type_map_eq (const void *va, const void *vb)
-{
-  const_tree a = (const_tree) va;
-  const_tree b = (const_tree) vb;
-  return (a->type.uid == b->type.uid);
-}
-
-/* Hash the tree ITEM. */
-
-static unsigned int
-uid_type_map_hash (const void *item)
-{
-  return ((const_tree)item)->type.uid;
-}
-
 void
 init_ttree (void)
 {
@@ -328,12 +287,6 @@ init_ttree (void)
   
   int_cst_node = make_node (INTEGER_CST);
 
-  decl_for_uid_map = htab_create_ggc (4093, uid_decl_map_hash,
-				      uid_decl_map_eq, NULL);
-
-  uid2type_map = htab_create_ggc (4093, uid_type_map_hash,
-				  uid_type_map_eq, NULL);
-
   cl_option_hash_table = htab_create_ggc (64, cl_option_hash_hash,
 					  cl_option_hash_eq, NULL);
 
@@ -735,8 +688,6 @@ make_node_stat (enum tree_code code MEM_
 	}
       DECL_SOURCE_LOCATION (t) = input_location;
       DECL_UID (t) = next_decl_uid++;
-      insert_decl_to_uid_decl_map (t);
-
       break;
 
     case tcc_type:
@@ -752,7 +703,6 @@ make_node_stat (enum tree_code code MEM_
 
       /* We have not yet computed the alias set for this type.  */
       TYPE_ALIAS_SET (t) = -1;
-      insert_type_to_uid_type_map (t);
       break;
 
     case tcc_constant:
@@ -827,7 +777,6 @@ copy_node_stat (tree node MEM_STAT_DECL)
 	  SET_DECL_RESTRICT_BASE (t, DECL_GET_RESTRICT_BASE (node));
 	  DECL_BASED_ON_RESTRICT_P (t) = 1;
 	}
-      insert_decl_to_uid_decl_map (t);
     }
   else if (TREE_CODE_CLASS (code) == tcc_type)
     {
@@ -846,7 +795,6 @@ copy_node_stat (tree node MEM_STAT_DECL)
 	  TYPE_CACHED_VALUES_P (t) = 0;
 	  TYPE_CACHED_VALUES (t) = NULL_TREE;
 	}
-      insert_type_to_uid_type_map (t);
     }
 
   return t;
@@ -3559,45 +3507,6 @@ build_nt_call_list (tree fn, tree arglis
   return t;
 }
 
-/* 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;
-}
-
-/* Remove the declaration tree DECL from the global UID to decl map.
-   This needs to be called if you ggc_free a decl tree, otherwise
-   garbage collection will take care of it.  */
-
-void
-remove_decl_from_map (tree decl)
-{
-    struct tree_decl_minimal key;
-
-    key.uid = DECL_UID (decl);
-#if ENABLE_CHECKING
-    gcc_assert (decl == htab_find_with_hash (decl_for_uid_map, &key, key.uid));
-#endif
-    htab_remove_elt_with_hash (decl_for_uid_map, &key, key.uid);
-}
-
 
 /* 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.
Index: tree.h
===================================================================
--- tree.h	(revision 143495)
+++ tree.h	(working copy)
@@ -5255,10 +5257,6 @@ struct tree_int_map GTY(())
 #define tree_int_map_hash tree_map_base_hash
 #define tree_int_map_marked_p tree_map_base_marked_p
 
-/* Map from a DECL_UID to the decl tree.  */
-
-extern void remove_decl_from_map (tree);
-
 /* Map from a tree to initialization/finalization priorities.  */
 
 struct tree_priority_map GTY(())
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 143495)
+++ cp/decl.c	(working copy)
@@ -2156,7 +2156,6 @@ duplicate_decls (tree newdecl, tree oldd
   /* The NEWDECL will no longer be needed.  Because every out-of-class
      declaration of a member results in a call to duplicate_decls,
      freeing these nodes represents in a significant savings.  */
-  remove_decl_from_map (newdecl);
   ggc_free (newdecl);
 
   return olddecl;
Index: lto/lto.c
===================================================================
--- lto/lto.c	(revision 143495)
+++ lto/lto.c	(working copy)
@@ -1308,7 +1308,6 @@ free_decl (const void *p, void *data ATT
   const_tree ct = (const_tree) p;
   tree t = CONST_CAST_TREE (ct);
 
-  remove_decl_from_map (t);
   lto_symtab_clear_resolution (t);
   ggc_free (t);
   return true;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]