aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-openmp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/trans-openmp.cc')
-rw-r--r--gcc/fortran/trans-openmp.cc59
1 files changed, 57 insertions, 2 deletions
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 6c2c7482..4f4b408 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -2775,12 +2775,56 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
case OMP_LIST_SCAN_EX:
clause_code = OMP_CLAUSE_EXCLUSIVE;
goto add_clause;
+ case OMP_LIST_USE:
+ clause_code = OMP_CLAUSE_USE;
+ goto add_clause;
+ case OMP_LIST_DESTROY:
+ clause_code = OMP_CLAUSE_DESTROY;
+ goto add_clause;
add_clause:
omp_clauses
= gfc_trans_omp_variable_list (clause_code, n, omp_clauses,
declare_simd);
break;
+
+ case OMP_LIST_INIT:
+ {
+ tree pref_type = NULL_TREE;
+ const char *last = NULL;
+ for (; n != NULL; n = n->next)
+ if (n->sym->attr.referenced)
+ {
+ tree t = gfc_trans_omp_variable (n->sym, false);
+ if (t == error_mark_node)
+ continue;
+ tree node = build_omp_clause (input_location,
+ OMP_CLAUSE_INIT);
+ OMP_CLAUSE_DECL (node) = t;
+ if (n->u.init.target)
+ OMP_CLAUSE_INIT_TARGET (node) = 1;
+ if (n->u.init.targetsync)
+ OMP_CLAUSE_INIT_TARGETSYNC (node) = 1;
+ if (last != n->u2.init_interop)
+ {
+ last = n->u2.init_interop;
+ if (n->u2.init_interop == NULL)
+ pref_type = NULL_TREE;
+ else
+ {
+ pref_type = build_string (n->u.init.len,
+ n->u2.init_interop);
+ TREE_TYPE (pref_type)
+ = build_array_type_nelts (unsigned_char_type_node,
+ n->u.init.len);
+ }
+ }
+ OMP_CLAUSE_INIT_PREFER_TYPE (node) = pref_type;
+ omp_clauses = gfc_trans_add_clause (node, omp_clauses);
+ }
+ break;
+ }
+
case OMP_LIST_ALIGNED:
for (; n != NULL; n = n->next)
if (n->sym->attr.referenced || declare_simd)
@@ -8028,6 +8072,18 @@ gfc_trans_omp_target_update (gfc_code *code)
}
static tree
+gfc_trans_openmp_interop (gfc_code *code, gfc_omp_clauses *clauses)
+{
+ stmtblock_t block;
+ gfc_start_block (&block);
+ tree omp_clauses = gfc_trans_omp_clauses (&block, clauses, code->loc);
+ tree stmt = build1_loc (input_location, OMP_INTEROP, void_type_node,
+ omp_clauses);
+ gfc_add_expr_to_block (&block, stmt);
+ return gfc_finish_block (&block);
+}
+
+static tree
gfc_trans_omp_workshare (gfc_code *code, gfc_omp_clauses *clauses)
{
tree res, tmp, stmt;
@@ -8365,8 +8421,7 @@ gfc_trans_omp_directive (gfc_code *code)
case EXEC_OMP_WORKSHARE:
return gfc_trans_omp_workshare (code, code->ext.omp_clauses);
case EXEC_OMP_INTEROP:
- sorry ("%<!$OMP INTEROP%>");
- return build_empty_stmt (input_location);
+ return gfc_trans_openmp_interop (code, code->ext.omp_clauses);
default:
gcc_unreachable ();
}