@@ -1,3 +1,7 @@
+2014-11-11 Thomas Schwinge <thomas@codesourcery.com>
+
+ * omp-low.c (lower_omp_target): Restore two gcc_asserts.
+
2014-11-06 Thomas Schwinge <thomas@codesourcery.com>
* gimple.h (is_gimple_omp_oacc_specifically): Return true for
@@ -1,3 +1,12 @@
+2014-11-11 Thomas Schwinge <thomas@codesourcery.com>
+
+ * gfortran.h (OMP_LIST_DEVICEPTR): Remove, and instead...
+ (enum gfc_omp_map_op): ... add OMP_MAP_FORCE_DEVICEPTR here.
+ * dump-parse-tree.c (show_omp_clauses): Update.
+ * openmp.c (gfc_match_omp_clauses, resolve_omp_clauses)
+ (gfc_resolve_oacc_declare): Likewise.
+ * trans-openmp.c (gfc_trans_omp_clauses): Likewise.
+
2014-11-05 Thomas Schwinge <thomas@codesourcery.com>
* openmp.c (OMP_CLAUSE_HOST, OMP_CLAUSE_SELF): Merge into the new
@@ -1252,7 +1252,6 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses)
switch (list_type)
{
case OMP_LIST_COPY: type = "COPY"; break;
- case OMP_LIST_DEVICEPTR: type = "DEVICEPTR"; break;
case OMP_LIST_USE_DEVICE: type = "USE_DEVICE"; break;
case OMP_LIST_DEVICE_RESIDENT: type = "USE_DEVICE"; break;
case OMP_LIST_CACHE: type = ""; break;
@@ -1141,7 +1141,8 @@ typedef enum
OMP_MAP_FORCE_TO,
OMP_MAP_FORCE_FROM,
OMP_MAP_FORCE_TOFROM,
- OMP_MAP_FORCE_PRESENT
+ OMP_MAP_FORCE_PRESENT,
+ OMP_MAP_FORCE_DEVICEPTR
}
gfc_omp_map_op;
@@ -1184,8 +1185,7 @@ enum
OMP_LIST_REDUCTION,
OMP_LIST_COPY,
OMP_LIST_DATA_CLAUSE_FIRST = OMP_LIST_COPY,
- OMP_LIST_DEVICEPTR,
- OMP_LIST_DATA_CLAUSE_LAST = OMP_LIST_DEVICEPTR,
+ OMP_LIST_DATA_CLAUSE_LAST = OMP_LIST_DATA_CLAUSE_FIRST,
OMP_LIST_DEVICE_RESIDENT,
OMP_LIST_USE_DEVICE,
OMP_LIST_CACHE,
@@ -666,10 +666,19 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, unsigned long long mask,
OMP_MAP_ALLOC))
continue;
if ((mask & OMP_CLAUSE_DEVICEPTR)
- && gfc_match_omp_variable_list ("deviceptr (",
- &c->lists[OMP_LIST_DEVICEPTR], true)
- == MATCH_YES)
- continue;
+ && gfc_match ("deviceptr ( ") == MATCH_YES)
+ {
+ gfc_omp_namelist **list = &c->lists[OMP_LIST_MAP];
+ gfc_omp_namelist **head = NULL;
+ if (gfc_match_omp_variable_list ("", list, true, NULL, &head, false)
+ == MATCH_YES)
+ {
+ gfc_omp_namelist *n;
+ for (n = *head; n; n = n->next)
+ n->u.map_op = OMP_MAP_FORCE_DEVICEPTR;
+ continue;
+ }
+ }
if ((mask & OMP_CLAUSE_USE_DEVICE)
&& gfc_match_omp_variable_list ("use_device (",
&c->lists[OMP_LIST_USE_DEVICE], true)
@@ -2864,7 +2873,7 @@ resolve_omp_clauses (gfc_code *code, locus *where,
"TO", "FROM", "REDUCTION",
"COPY", "COPYIN", "COPYOUT", "CREATE", "DELETE", "PRESENT",
"PRESENT_OR_COPY", "PRESENT_OR_COPYIN", "PRESENT_OR_COPYOUT",
- "PRESENT_OR_CREATE", "DEVICEPTR", "DEVICE_RESIDENT", "USE_DEVICE",
+ "PRESENT_OR_CREATE", "DEVICE_RESIDENT", "USE_DEVICE",
"HOST", "DEVICE", "CACHE" };
if (omp_clauses == NULL)
@@ -3152,8 +3161,13 @@ resolve_omp_clauses (gfc_code *code, locus *where,
}
}
else if (openacc)
- resolve_oacc_data_clauses (n->sym, *where,
- clause_names[list]);
+ {
+ if (list == OMP_LIST_MAP
+ && n->u.map_op == OMP_MAP_FORCE_DEVICEPTR)
+ resolve_oacc_deviceptr_clause (n->sym, *where, name);
+ else
+ resolve_oacc_data_clauses (n->sym, *where, name);
+ }
}
if (list != OMP_LIST_DEPEND)
@@ -3360,9 +3374,6 @@ resolve_omp_clauses (gfc_code *code, locus *where,
case OMP_LIST_PRIVATE:
gcc_assert (code && code->op != EXEC_NOP);
break;
- case OMP_LIST_DEVICEPTR:
- resolve_oacc_deviceptr_clause (n->sym, *where, name);
- break;
case OMP_LIST_USE_DEVICE:
if (n->sym->attr.allocatable
|| (n->sym->ts.type == BT_CLASS && CLASS_DATA (n->sym)
@@ -4609,7 +4620,7 @@ gfc_resolve_oacc_declare (gfc_namespace *ns)
locus loc;
static const char *clause_names[] = {"COPY", "COPYIN", "COPYOUT", "CREATE",
"DELETE", "PRESENT", "PRESENT_OR_COPY", "PRESENT_OR_COPYIN",
- "PRESENT_OR_COPYOUT", "PRESENT_OR_CREATE", "DEVICEPTR",
+ "PRESENT_OR_COPYOUT", "PRESENT_OR_CREATE",
"DEVICE_RESIDENT"};
if (ns->oacc_declare_clauses == NULL)
@@ -4647,11 +4658,6 @@ gfc_resolve_oacc_declare (gfc_namespace *ns)
resolve_oacc_data_clauses (n->sym, loc, name);
}
- for (n = ns->oacc_declare_clauses->lists[OMP_LIST_DEVICEPTR]; n; n = n->next)
- resolve_oacc_deviceptr_clause (n->sym, loc,
- clause_names[OMP_LIST_DEVICEPTR -
- OMP_LIST_DATA_CLAUSE_FIRST]);
-
for (n = ns->oacc_declare_clauses->lists[OMP_LIST_DEVICE_RESIDENT]; n;
n = n->next)
check_array_not_assumed (n->sym, loc,
@@ -1765,9 +1765,6 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
enum omp_clause_map_kind kind;
switch (list)
{
- case OMP_LIST_DEVICEPTR:
- kind = OMP_CLAUSE_MAP_FORCE_DEVICEPTR;
- break;
default:
gcc_unreachable ();
}
@@ -2164,6 +2161,9 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses,
case OMP_MAP_FORCE_PRESENT:
OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_PRESENT;
break;
+ case OMP_MAP_FORCE_DEVICEPTR:
+ OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_DEVICEPTR;
+ break;
default:
gcc_unreachable ();
}
@@ -12044,6 +12044,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
&& !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c)
&& TREE_CODE (TREE_TYPE (ovar)) == ARRAY_TYPE)
{
+ gcc_assert (kind == GF_OMP_TARGET_KIND_REGION);
tree avar
= create_tmp_var (TREE_TYPE (TREE_TYPE (x)), NULL);
mark_addressable (avar);
@@ -12054,6 +12055,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
}
else if (is_gimple_reg (var))
{
+ gcc_assert (kind == GF_OMP_TARGET_KIND_REGION);
tree avar = create_tmp_var (TREE_TYPE (var), NULL);
mark_addressable (avar);
enum omp_clause_map_kind map_kind