This is the mail archive of the gcc@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]

Re: G++ OpenMP implementation uses TREE_COMPLEXITY?!?!



You know (or so I assume) this was a very Very VERY BAD thing to do

are not helpful. Of course, if RTH had thought it was a bad thing, he wouldn't have done it.

Well, I must agree that there is probably no justification other than the quote that Richard posted. :-P Still, I agree with you on the tone of Steven's email, and I don't see the need to Cc Jakub and Diego too, either.


I hope Steven accepts a little deal: he exits angry-stevenb-mode, and I donate him this untested patch to remove TREE_COMPLEXITY from C++.

Paolo
Index: cp-tree.h
===================================================================
--- cp-tree.h	(revision 120669)
+++ cp-tree.h	(working copy)
@@ -3040,13 +3040,9 @@ extern void decl_shadowed_for_var_insert
   (TREE_LANG_FLAG_0 (SCOPE_REF_CHECK (NODE)))
 
 /* True for an OMP_ATOMIC that has dependent parameters.  These are stored
-   as bare LHS/RHS, and not as ADDR/RHS, as in the generic statement.  */
+   as an expr in operand 1.  */
 #define OMP_ATOMIC_DEPENDENT_P(NODE) \
-  (TREE_LANG_FLAG_0 (OMP_ATOMIC_CHECK (NODE)))
-
-/* Used to store the operation code when OMP_ATOMIC_DEPENDENT_P is set.  */
-#define OMP_ATOMIC_CODE(NODE) \
-  (OMP_ATOMIC_CHECK (NODE)->exp.complexity)
+  (TREE_CODE (TREE_OPERAND (OMP_ATOMIC_CHECK (NODE), 0)) == INTEGER_CST)
 
 /* Used while gimplifying continue statements bound to OMP_FOR nodes.  */
 #define OMP_FOR_GIMPLIFYING_P(NODE) \
Index: pt.c
===================================================================
--- pt.c	(revision 120669)
+++ pt.c	(working copy)
@@ -8917,12 +8917,13 @@ tsubst_expr (tree t, tree args, tsubst_f
       break;
 
     case OMP_ATOMIC:
-      {
-	tree op0, op1;
-	op0 = RECUR (TREE_OPERAND (t, 0));
-	op1 = RECUR (TREE_OPERAND (t, 1));
-	finish_omp_atomic (OMP_ATOMIC_CODE (t), op0, op1);
-      }
+      if (OMP_ATOMIC_DEPENDENT_P (t))
+        {
+	  tree op1 = RECUR (TREE_OPERAND (t, 1));
+	  tree lhs = RECUR (TREE_OPERAND (op1, 0));
+	  tree rhs = RECUR (TREE_OPERAND (op1, 1));
+	  finish_omp_atomic (TREE_CODE (op1), lhs, rhs);
+        }
       break;
 
     default:
Index: semantics.c
===================================================================
--- semantics.c	(revision 120669)
+++ semantics.c	(working copy)
@@ -3890,9 +3890,8 @@ finish_omp_atomic (enum tree_code code, 
     }
   if (processing_template_decl)
     {
-      stmt = build2 (OMP_ATOMIC, void_type_node, orig_lhs, orig_rhs);
-      OMP_ATOMIC_DEPENDENT_P (stmt) = 1;
-      OMP_ATOMIC_CODE (stmt) = code;
+      stmt = build2 (OMP_ATOMIC, void_type_node, integer_zero_node,
+		     build2 (code, void_type_node, orig_lhs, orig_rhs));
     }
   add_stmt (stmt);
 }

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