gcc-patches@gcc.gnu.org
[Top] [All Lists]

[gomp] walk_tree and OMP_CLAUSE_*

Subject: [gomp] walk_tree and OMP_CLAUSE_*
From: Jakub Jelinek
Date: Sat, 5 Nov 2005 15:36:12 -0500
Hi!

I'm posting this just for completeness, this is the last of the
5 patches I have in my tree with which everything but vla-3.c and vla3.f90
pass.
Richard has a different patch (putting the switch in walk_tree first
and handling IS_EXPR_CODE trees and TYPE_P ones in its default: clause)
and I have another idea too, but I haven't found time yet for doing
proper benchmarking.
But this patch is certainly shortest.

2005-11-05  Jakub Jelinek  <jakub@xxxxxxxxxx>

        * tree.c (walk_tree): Walk OMP_CLAUSE_CHAIN for OMP_CLAUSE_*.
        Remove useless check for BIND_EXPR, use WALK_SUBTREE_TAIL
        even if TREE_CHAIN is not NULL.

--- gcc/tree.c.jj       2005-11-03 21:50:46.000000000 +0100
+++ gcc/tree.c  2005-11-05 14:00:09.000000000 +0100
@@ -7166,9 +7166,11 @@ walk_tree (tree *tp, walk_tree_fn func, 
      interesting below this point in the tree.  */
   if (!walk_subtrees)
     {
+      /* But we still need to check our siblings.  */
       if (code == TREE_LIST)
-       /* But we still need to check our siblings.  */
        WALK_SUBTREE_TAIL (TREE_CHAIN (*tp));
+      else if (code >= OMP_CLAUSE_PRIVATE && code <= OMP_CLAUSE_DEFAULT)
+       WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
       else
        return NULL_TREE;
     }
@@ -7255,12 +7257,13 @@ walk_tree (tree *tp, walk_tree_fn func, 
 
       if (len)
        {
-         /* The common case is that we may tail recurse here.  */
-         if (code != BIND_EXPR
-             && !TREE_CHAIN (*tp))
-           WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, len - 1));
+         if (code >= OMP_CLAUSE_PRIVATE && code <= OMP_CLAUSE_DEFAULT)
+           {
+             WALK_SUBTREE (TREE_OPERAND (*tp, len - 1));
+             WALK_SUBTREE_TAIL (OMP_CLAUSE_CHAIN (*tp));
+           }
          else
-           WALK_SUBTREE (TREE_OPERAND (*tp, len - 1));
+           WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, len - 1));
        }
 #endif
     }

        Jakub

<Prev in Thread] Current Thread [Next in Thread>