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]

PATCH to remove redundant tree_find_value


tree_find_value, added by

2009-03-30 Steve Ellcey <sje@cup.hp.com>

        PR middle-end/38237
        * tree.h (tree_find_value): New declaration.
        * tree.c (tree_find_value): New function.
        * varasm.c (assemble_external): Avoid duplicate entries on lists.

does the same thing as value_member, just with the parms reversed. So I've removed it and changed the calls to use value_member.

Tested x86_64-pc-linux-gnu, committed as obvious on trunk.
commit ef8a9a2ffba3453147c5eb309448a5bcc80f8ab5
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Sep 4 16:09:36 2009 -0400

    	* tree.c (tree_find_value): Remove.
    	* tree.h: Remove prototype.
    	* varasm.c (assemble_external): Use value_member instead.

diff --git a/gcc/tree.c b/gcc/tree.c
index a036439..010aeff 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2003,18 +2003,6 @@ tree_last (tree chain)
   return chain;
 }
 
-/* Return the node in a chain of nodes whose value is x, NULL if not found.  */
-
-tree
-tree_find_value (tree chain, tree x)
-{
-  tree list;
-  for (list = chain; list; list = TREE_CHAIN (list))
-    if (TREE_VALUE (list) == x)
-	return list;
-  return NULL;
-}
-
 /* Reverse the order of elements in the chain T,
    and return the new head of the chain (old last element).  */
 
diff --git a/gcc/tree.h b/gcc/tree.h
index 880f71d..59251b5 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4278,10 +4278,6 @@ extern tree tree_cons_stat (tree, tree, tree MEM_STAT_DECL);
 
 extern tree tree_last (tree);
 
-/* Return the node in a chain whose TREE_VALUE is x, NULL if not found.  */
-
-extern tree tree_find_value (tree, tree);
-
 /* Reverse the order of elements in a chain, and return the new head.  */
 
 extern tree nreverse (tree);
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 864ab16..a7fa83f 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2328,11 +2328,11 @@ assemble_external (tree decl ATTRIBUTE_UNUSED)
 	 for declarations that can be weak, it happens to be
 	 match.  */
       && !TREE_STATIC (decl)
-      && tree_find_value (weak_decls, decl) == NULL_TREE)
-      weak_decls = tree_cons (NULL, decl, weak_decls);
+      && value_member (decl, weak_decls) == NULL_TREE)
+    weak_decls = tree_cons (NULL, decl, weak_decls);
 
 #ifdef ASM_OUTPUT_EXTERNAL
-  if (tree_find_value (pending_assemble_externals, decl) == NULL_TREE)
+  if (value_member (decl, pending_assemble_externals) == NULL_TREE)
     pending_assemble_externals = tree_cons (NULL, decl,
 					    pending_assemble_externals);
 #endif

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