This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Subcodes for OMP_CLAUSE_*. Fortran version.


I will need this after merging mainline into gomp.  This adapts the
Fortran bits to use the new OMP_CLAUSE_* subcodes.

Jakub, is it safe to do what I suggested in the FIXME note I'm adding
with the patch?  gfc_trans_omp_reduction_list does not seem to need the
CODE parameter.  It always builds an OMP_CLAUSE_REDUCTION.

Tested on x86.  OK for gomp?
2006-01-26  Diego Novillo  <dnovillo@redhat.com>

	* trans-openmp.c: Use OMP_CLAUSE_CODE and OMP_CLAUSE_OPERAND
	instead of TREE_CODE/TREE_OPERAND.

Index: fortran/trans-openmp.c
===================================================================
--- fortran/trans-openmp.c	(revision 110205)
+++ fortran/trans-openmp.c	(working copy)
@@ -218,7 +218,7 @@ gfc_trans_omp_variable (gfc_symbol *sym)
 }
 
 static tree
-gfc_trans_omp_variable_list (enum tree_code code, gfc_namelist *namelist,
+gfc_trans_omp_variable_list (enum omp_clause_code code, gfc_namelist *namelist,
 			     tree list)
 {
   for (; namelist != NULL; namelist = namelist->next)
@@ -227,7 +227,7 @@ gfc_trans_omp_variable_list (enum tree_c
 	tree t = gfc_trans_omp_variable (namelist->sym);
 	if (t != error_mark_node)
 	  {
-	    tree node = make_node (code);
+	    tree node = build_omp_clause (code);
 	    OMP_CLAUSE_DECL (node) = t;
 	    list = gfc_trans_add_clause (node, list);
 	  }
@@ -404,17 +404,21 @@ gfc_trans_omp_array_reduction (tree c, g
 }
 
 static tree
-gfc_trans_omp_reduction_list (enum tree_code code, gfc_namelist *namelist,
+gfc_trans_omp_reduction_list (enum omp_clause_code code, gfc_namelist *namelist,
 			      tree list, enum tree_code reduction_code,
 			      locus where)
 {
+  /* FIXME.  Why is CODE needed at all?  We only ever call this with
+     OMP_CLAUSE_REDUCTION.  */
+  gcc_assert (code == OMP_CLAUSE_REDUCTION);
+
   for (; namelist != NULL; namelist = namelist->next)
     if (namelist->sym->attr.referenced)
       {
 	tree t = gfc_trans_omp_variable (namelist->sym);
 	if (t != error_mark_node)
 	  {
-	    tree node = make_node (code);
+	    tree node = build_omp_clause (code);
 	    OMP_CLAUSE_DECL (node) = t;
 	    OMP_CLAUSE_REDUCTION_CODE (node) = reduction_code;
 	    if (namelist->sym->attr.dimension)
@@ -431,7 +435,7 @@ gfc_trans_omp_clauses (stmtblock_t *bloc
 {
   tree omp_clauses = NULL_TREE, chunk_size, c, old_clauses;
   int list;
-  enum tree_code clause_code;
+  enum omp_clause_code clause_code;
   gfc_se se;
 
   if (clauses == NULL)
@@ -534,7 +538,7 @@ gfc_trans_omp_clauses (stmtblock_t *bloc
       if_var = gfc_evaluate_now (se.expr, block);
       gfc_add_block_to_block (block, &se.post);
 
-      c = make_node (OMP_CLAUSE_IF);
+      c = build_omp_clause (OMP_CLAUSE_IF);
       OMP_CLAUSE_IF_EXPR (c) = if_var;
       omp_clauses = gfc_trans_add_clause (c, omp_clauses);
     }
@@ -549,7 +553,7 @@ gfc_trans_omp_clauses (stmtblock_t *bloc
       num_threads = gfc_evaluate_now (se.expr, block);
       gfc_add_block_to_block (block, &se.post);
 
-      c = make_node (OMP_CLAUSE_NUM_THREADS);
+      c = build_omp_clause (OMP_CLAUSE_NUM_THREADS);
       OMP_CLAUSE_NUM_THREADS_EXPR (c) = num_threads;
       omp_clauses = gfc_trans_add_clause (c, omp_clauses);
     }
@@ -566,7 +570,7 @@ gfc_trans_omp_clauses (stmtblock_t *bloc
 
   if (clauses->sched_kind != OMP_SCHED_NONE)
     {
-      c = make_node (OMP_CLAUSE_SCHEDULE);
+      c = build_omp_clause (OMP_CLAUSE_SCHEDULE);
       OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = chunk_size;
       switch (clauses->sched_kind)
 	{
@@ -590,7 +594,7 @@ gfc_trans_omp_clauses (stmtblock_t *bloc
 
   if (clauses->default_sharing != OMP_DEFAULT_UNKNOWN)
     {
-      c = make_node (OMP_CLAUSE_DEFAULT);
+      c = build_omp_clause (OMP_CLAUSE_DEFAULT);
       switch (clauses->default_sharing)
 	{
 	case OMP_DEFAULT_NONE:
@@ -610,13 +614,13 @@ gfc_trans_omp_clauses (stmtblock_t *bloc
 
   if (clauses->nowait)
     {
-      c = make_node (OMP_CLAUSE_NOWAIT);
+      c = build_omp_clause (OMP_CLAUSE_NOWAIT);
       omp_clauses = gfc_trans_add_clause (c, omp_clauses);
     }
 
   if (clauses->ordered)
     {
-      c = make_node (OMP_CLAUSE_ORDERED);
+      c = build_omp_clause (OMP_CLAUSE_ORDERED);
       omp_clauses = gfc_trans_add_clause (c, omp_clauses);
     }
 
@@ -948,13 +952,13 @@ gfc_trans_omp_do (gfc_code *code, stmtbl
 
   if (!dovar_found)
     {
-      tmp = make_node (OMP_CLAUSE_PRIVATE);
+      tmp = build_omp_clause (OMP_CLAUSE_PRIVATE);
       OMP_CLAUSE_DECL (tmp) = dovar;
       omp_clauses = gfc_trans_add_clause (tmp, omp_clauses);
     }
   if (!simple)
     {
-      tmp = make_node (OMP_CLAUSE_PRIVATE);
+      tmp = build_omp_clause (OMP_CLAUSE_PRIVATE);
       OMP_CLAUSE_DECL (tmp) = count;
       omp_clauses = gfc_trans_add_clause (tmp, omp_clauses);
     }

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