OpenMP/Fortran: Group handling of 'if' clause without and with modifier

The 'if' clause with modifier was introduced in
commit b4c3a85be9 (Subversion r242037)
"Partial OpenMP 4.5 fortran support", but -- in some instances -- didn't place
it next to the existing handling of 'if' clause without modifier.  Unify that;
no change in behavior.

	gcc/fortran/
	* dump-parse-tree.cc (show_omp_clauses): Group handling of 'if'
	clause without and with modifier.
	* frontend-passes.cc (gfc_code_walker): Likewise.
	* gfortran.h (gfc_omp_clauses): Likewise.
	* openmp.cc (gfc_free_omp_clauses): Likewise.
This commit is contained in:
Thomas Schwinge 2023-10-24 10:43:40 +02:00
parent 5e71499275
commit fa68e04e76
4 changed files with 26 additions and 26 deletions

View file

@ -1593,6 +1593,27 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses)
show_expr (omp_clauses->if_expr);
fputc (')', dumpfile);
}
for (i = 0; i < OMP_IF_LAST; i++)
if (omp_clauses->if_exprs[i])
{
static const char *ifs[] = {
"CANCEL",
"PARALLEL",
"SIMD",
"TASK",
"TASKLOOP",
"TARGET",
"TARGET DATA",
"TARGET UPDATE",
"TARGET ENTER DATA",
"TARGET EXIT DATA"
};
fputs (" IF(", dumpfile);
fputs (ifs[i], dumpfile);
fputs (": ", dumpfile);
show_expr (omp_clauses->if_exprs[i]);
fputc (')', dumpfile);
}
if (omp_clauses->final_expr)
{
fputs (" FINAL(", dumpfile);
@ -1999,27 +2020,6 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses)
show_expr (omp_clauses->detach);
fputc (')', dumpfile);
}
for (i = 0; i < OMP_IF_LAST; i++)
if (omp_clauses->if_exprs[i])
{
static const char *ifs[] = {
"CANCEL",
"PARALLEL",
"SIMD",
"TASK",
"TASKLOOP",
"TARGET",
"TARGET DATA",
"TARGET UPDATE",
"TARGET ENTER DATA",
"TARGET EXIT DATA"
};
fputs (" IF(", dumpfile);
fputs (ifs[i], dumpfile);
fputs (": ", dumpfile);
show_expr (omp_clauses->if_exprs[i]);
fputc (')', dumpfile);
}
if (omp_clauses->destroy)
fputs (" DESTROY", dumpfile);
if (omp_clauses->depend_source)

View file

@ -5652,6 +5652,8 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn,
OMP_LIST_MAP, OMP_LIST_TO, OMP_LIST_FROM };
size_t idx;
WALK_SUBEXPR (co->ext.omp_clauses->if_expr);
for (idx = 0; idx < OMP_IF_LAST; idx++)
WALK_SUBEXPR (co->ext.omp_clauses->if_exprs[idx]);
WALK_SUBEXPR (co->ext.omp_clauses->final_expr);
WALK_SUBEXPR (co->ext.omp_clauses->num_threads);
WALK_SUBEXPR (co->ext.omp_clauses->chunk_size);
@ -5667,8 +5669,6 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn,
WALK_SUBEXPR (co->ext.omp_clauses->num_tasks);
WALK_SUBEXPR (co->ext.omp_clauses->priority);
WALK_SUBEXPR (co->ext.omp_clauses->detach);
for (idx = 0; idx < OMP_IF_LAST; idx++)
WALK_SUBEXPR (co->ext.omp_clauses->if_exprs[idx]);
for (idx = 0; idx < ARRAY_SIZE (list_types); idx++)
for (n = co->ext.omp_clauses->lists[list_types[idx]];
n; n = n->next)

View file

@ -1545,6 +1545,7 @@ typedef struct gfc_omp_clauses
{
gfc_omp_namelist *lists[OMP_LIST_NUM];
struct gfc_expr *if_expr;
struct gfc_expr *if_exprs[OMP_IF_LAST];
struct gfc_expr *final_expr;
struct gfc_expr *num_threads;
struct gfc_expr *chunk_size;
@ -1561,7 +1562,6 @@ typedef struct gfc_omp_clauses
struct gfc_expr *priority;
struct gfc_expr *detach;
struct gfc_expr *depobj;
struct gfc_expr *if_exprs[OMP_IF_LAST];
struct gfc_expr *dist_chunk_size;
struct gfc_expr *message;
struct gfc_omp_assumptions *assume;

View file

@ -161,6 +161,8 @@ gfc_free_omp_clauses (gfc_omp_clauses *c)
return;
gfc_free_expr (c->if_expr);
for (i = 0; i < OMP_IF_LAST; i++)
gfc_free_expr (c->if_exprs[i]);
gfc_free_expr (c->final_expr);
gfc_free_expr (c->num_threads);
gfc_free_expr (c->chunk_size);
@ -176,8 +178,6 @@ gfc_free_omp_clauses (gfc_omp_clauses *c)
gfc_free_expr (c->num_tasks);
gfc_free_expr (c->priority);
gfc_free_expr (c->detach);
for (i = 0; i < OMP_IF_LAST; i++)
gfc_free_expr (c->if_exprs[i]);
gfc_free_expr (c->async_expr);
gfc_free_expr (c->gang_num_expr);
gfc_free_expr (c->gang_static_expr);