From 9914f221bd980bcba3fa85d823e78173ae4a2354 Mon Sep 17 00:00:00 2001 From: Hongyon Suauthai Date: Fri, 1 Jun 2018 11:15:32 -0700 Subject: [PATCH] [flang] update unparsing openmp directives and clauses. Original-commit: flang-compiler/f18@76121cda6c29404c232453f7302ac39eb0f9dbce Reviewed-on: https://github.com/flang-compiler/f18/pull/96 Tree-same-pre-rewrite: false --- flang/lib/parser/openmp-grammar.h | 134 ++++++----- flang/lib/parser/parse-tree.h | 27 ++- flang/lib/parser/unparse.cc | 459 +++++++++++++++++++++----------------- 3 files changed, 348 insertions(+), 272 deletions(-) diff --git a/flang/lib/parser/openmp-grammar.h b/flang/lib/parser/openmp-grammar.h index ee8fb671..2921aee 100644 --- a/flang/lib/parser/openmp-grammar.h +++ b/flang/lib/parser/openmp-grammar.h @@ -81,10 +81,10 @@ TYPE_PARSER(construct( "NONMONOTONIC" >> pure(OmpScheduleModifierType::ModType::Nonmonotonic) || "SIMD" >> pure(OmpScheduleModifierType::ModType::Simd))) -TYPE_PARSER(construct(Parser{}, maybe(","_ch >> Parser{}))) +TYPE_PARSER(construct(Parser{}, + maybe(","_ch >> Parser{}))) -TYPE_PARSER(construct( - maybe(Parser{}), +TYPE_PARSER(construct(maybe(Parser{}), "STATIC" >> pure(OmpScheduleClause::ScheduleType::Static) || "DYNAMIC" >> pure(OmpScheduleClause::ScheduleType::Dynamic) || "GUIDED" >> pure(OmpScheduleClause::ScheduleType::Guided) || @@ -161,8 +161,7 @@ TYPE_PARSER(construct( TYPE_CONTEXT_PARSER("Omp LINEAR clause"_en_US, construct( construct(construct( - Parser{}, - parenthesized(nonemptyList(name)), + Parser{}, parenthesized(nonemptyList(name)), maybe(":"_ch >> scalarIntConstantExpr))) || construct(construct( nonemptyList(name), maybe(":"_ch >> scalarIntConstantExpr))))) @@ -175,47 +174,81 @@ TYPE_PARSER(construct(pure(OmpNameList::Kind::Object), name) || construct("/" >> pure(OmpNameList::Kind::Common), name / "/")) TYPE_PARSER( -construct(construct("DEFAULTMAP"_tok >> parenthesized("TOFROM"_tok >> ":"_ch >> "SCALAR"_tok))) || -construct(construct("INBRANCH"_tok)) || -construct(construct("MERGEABLE"_tok)) || -construct(construct("NOGROUP"_tok)) || -construct(construct("NOTINBRANCH"_tok)) || -construct(construct("NOWAIT"_tok)) || -construct(construct("UNTIED"_tok)) || -construct(construct("COLLAPSE"_tok >> parenthesized(scalarIntConstantExpr))) || -construct(construct("COPYIN"_tok >> parenthesized(nonemptyList(Parser{})))) || -construct(construct("COPYPRIVATE"_tok >> parenthesized(nonemptyList(Parser{})))) || -construct(construct("DEVICE"_tok >> parenthesized(scalarIntExpr))) || -construct(construct("DIST_SCHEDULE"_tok >> parenthesized("STATIC"_tok >> ","_ch >> scalarIntExpr))) || -construct(construct("FINAL"_tok >> parenthesized(scalarIntExpr))) || -construct(construct("FIRSTPRIVATE"_tok >> parenthesized(nonemptyList(Parser{})))) || -construct(construct("FROM"_tok >> parenthesized(nonemptyList(designator)))) || -construct(construct("GRAINSIZE"_tok >> parenthesized(scalarIntExpr))) || -construct(construct("LASTPRIVATE"_tok >> parenthesized(nonemptyList(Parser{})))) || -construct(construct("LINK"_tok >> parenthesized(nonemptyList(name)))) || -construct(construct("NUM_TASKS"_tok >> parenthesized(scalarIntExpr))) || -construct(construct( "NUM_TEAMS"_tok >> parenthesized(scalarIntExpr))) || -construct(construct("NUM_THREADS"_tok >> parenthesized(scalarIntExpr))) || -construct(construct("ORDERED"_tok >> maybe(parenthesized(scalarIntConstantExpr)))) || -construct(construct("PRIORITY"_tok >> parenthesized(scalarIntExpr))) || -construct(construct("PRIVATE"_tok >> parenthesized(nonemptyList(Parser{})))) || -construct(construct("SAFELEN"_tok >> parenthesized(scalarIntConstantExpr))) || -construct(construct("SHARED"_tok >> parenthesized(nonemptyList(Parser{})))) || -construct(construct("SIMDLEN"_tok >> parenthesized(scalarIntConstantExpr))) || -construct(construct("THREAD_LIMIT"_tok >> parenthesized(scalarIntExpr))) || -construct(construct("TO"_tok >> parenthesized(nonemptyList(designator)))) || -construct(construct("UNIFORM"_tok >> parenthesized(nonemptyList(name)))) || -construct(construct("USE_DEVICE_PTR"_tok >> parenthesized(nonemptyList(name)))) || -construct("ALIGNED"_tok >> parenthesized(Parser{})) || -construct("DEFAULT"_tok >> parenthesized(Parser{})) || -construct("DEPEND"_tok >> parenthesized(Parser{})) || -construct("IF"_tok >> parenthesized(Parser{})) || -construct("LINEAR"_tok >> parenthesized(Parser{})) || -construct("MAP"_tok >> parenthesized(Parser{})) || -construct("PROC_BIND"_tok >> parenthesized(Parser{})) || -construct("REDUCTION"_tok >> parenthesized(Parser{})) || -construct("SCHEDULE"_tok >> parenthesized(Parser{})) -) + construct(construct("DEFAULTMAP"_tok >> + parenthesized("TOFROM"_tok >> ":"_ch >> "SCALAR"_tok))) || + construct(construct("INBRANCH"_tok)) || + construct(construct("MERGEABLE"_tok)) || + construct(construct("NOGROUP"_tok)) || + construct( + construct("NOTINBRANCH"_tok)) || + construct(construct("NOWAIT"_tok)) || + construct(construct("UNTIED"_tok)) || + construct(construct( + "COLLAPSE"_tok >> parenthesized(scalarIntConstantExpr))) || + construct(construct( + "COPYIN"_tok >> parenthesized(nonemptyList(Parser{})))) || + construct(construct("COPYPRIVATE"_tok >> + parenthesized(nonemptyList(Parser{})))) || + construct(construct( + "DEVICE"_tok >> parenthesized(scalarIntExpr))) || + construct( + construct("DIST_SCHEDULE"_tok >> + parenthesized("STATIC"_tok >> ","_ch >> scalarIntExpr))) || + construct(construct( + "FINAL"_tok >> parenthesized(scalarIntExpr))) || + construct( + construct("FIRSTPRIVATE"_tok >> + parenthesized(nonemptyList(Parser{})))) || + construct(construct( + "FROM"_tok >> parenthesized(nonemptyList(designator)))) || + construct(construct( + "GRAINSIZE"_tok >> parenthesized(scalarIntExpr))) || + construct(construct("LASTPRIVATE"_tok >> + parenthesized(nonemptyList(Parser{})))) || + construct(construct( + "LINK"_tok >> parenthesized(nonemptyList(name)))) || + construct(construct( + "NUM_TASKS"_tok >> parenthesized(scalarIntExpr))) || + construct(construct( + "NUM_TEAMS"_tok >> parenthesized(scalarIntExpr))) || + construct(construct( + "NUM_THREADS"_tok >> parenthesized(scalarIntExpr))) || + construct(construct( + "ORDERED"_tok >> maybe(parenthesized(scalarIntConstantExpr)))) || + construct(construct( + "PRIORITY"_tok >> parenthesized(scalarIntExpr))) || + construct(construct( + "PRIVATE"_tok >> parenthesized(nonemptyList(Parser{})))) || + construct(construct( + "SAFELEN"_tok >> parenthesized(scalarIntConstantExpr))) || + construct(construct( + "SHARED"_tok >> parenthesized(nonemptyList(Parser{})))) || + construct(construct( + "SIMDLEN"_tok >> parenthesized(scalarIntConstantExpr))) || + construct(construct( + "THREAD_LIMIT"_tok >> parenthesized(scalarIntExpr))) || + construct(construct( + "TO"_tok >> parenthesized(nonemptyList(designator)))) || + construct(construct( + "UNIFORM"_tok >> parenthesized(nonemptyList(name)))) || + construct(construct( + "USE_DEVICE_PTR"_tok >> parenthesized(nonemptyList(name)))) || + construct( + "ALIGNED"_tok >> parenthesized(Parser{})) || + construct( + "DEFAULT"_tok >> parenthesized(Parser{})) || + construct( + "DEPEND"_tok >> parenthesized(Parser{})) || + construct("IF"_tok >> parenthesized(Parser{})) || + construct( + "LINEAR"_tok >> parenthesized(Parser{})) || + construct("MAP"_tok >> parenthesized(Parser{})) || + construct( + "PROC_BIND"_tok >> parenthesized(Parser{})) || + construct( + "REDUCTION"_tok >> parenthesized(Parser{})) || + construct( + "SCHEDULE"_tok >> parenthesized(Parser{}))) TYPE_PARSER(skipEmptyLines >> space >> "!$OMP END"_sptok >> (construct(Parser{}))) @@ -314,11 +347,10 @@ TYPE_PARSER(construct( statement(Parser{}))) TYPE_CONTEXT_PARSER("OpenMP construct"_en_US, - beginOmpDirective >> - (construct( - indirect(Parser{})) || - construct( - indirect(Parser{})))) + beginOmpDirective >> (construct( + indirect(Parser{})) || + construct( + indirect(Parser{})))) } // namespace Fortran::parser #endif // OPENMP_PARSER_GRAMMAR_H_ diff --git a/flang/lib/parser/parse-tree.h b/flang/lib/parser/parse-tree.h index 071da8e..5ee5156 100644 --- a/flang/lib/parser/parse-tree.h +++ b/flang/lib/parser/parse-tree.h @@ -3233,11 +3233,14 @@ struct OmpScheduleModifier { std::tuple> t; }; -// SCHEDULE([schedule-modifier [,schedule-modifier]] schedule-type [, chunksize]) +// SCHEDULE([schedule-modifier [,schedule-modifier]] schedule-type [, +// chunksize]) struct OmpScheduleClause { TUPLE_CLASS_BOILERPLATE(OmpScheduleClause); ENUM_CLASS(ScheduleType, Static, Dynamic, Guided, Auto, Runtime) - std::tuple, ScheduleType, std::optional> t; + std::tuple, ScheduleType, + std::optional> + t; }; // IF(DirectiveNameModifier: scalar-logical-expr) @@ -3283,7 +3286,8 @@ struct OmpLinearClause { std::variant u; }; -// reduction-identifier -> Add, Subtract, Multiply, .and., .or., .eqv., .neqg., min, max, iand, ior, ieor +// reduction-identifier -> Add, Subtract, Multiply, .and., .or., .eqv., .neqg., +// min, max, iand, ior, ieor struct OmpReductionOperator { UNION_CLASS_BOILERPLATE(OmpReductionOperator); ENUM_CLASS(ProcedureOperator, MIN, MAX, IAND, IOR, IEOR) @@ -3363,13 +3367,13 @@ struct OmpClause { WRAPPER_CLASS(Uniform, std::list); WRAPPER_CLASS(UseDevicePtr, std::list); std::variant u; + Untied, Collapse, Copyin, Copyprivate, Device, DistSchedule, Final, + Firstprivate, From, Grainsize, Lastprivate, Link, NumTasks, NumTeams, + NumThreads, Ordered, Priority, Private, Safelen, Shared, Simdlen, + ThreadLimit, To, Uniform, UseDevicePtr, OmpAlignedClause, + OmpDefaultClause, OmpDependClause, OmpIfClause, OmpLinearClause, + OmpMapClause, OmpProcBindClause, OmpReductionClause, OmpScheduleClause> + u; }; struct OmpLoopDirective { @@ -3439,7 +3443,8 @@ WRAPPER_CLASS(OpenMPStandaloneConstruct, Statement); struct OpenMPConstruct { UNION_CLASS_BOILERPLATE(OpenMPConstruct); std::variant, - Indirection> u; + Indirection> + u; }; } // namespace parser diff --git a/flang/lib/parser/unparse.cc b/flang/lib/parser/unparse.cc index 024833d..3320505 100644 --- a/flang/lib/parser/unparse.cc +++ b/flang/lib/parser/unparse.cc @@ -1650,7 +1650,8 @@ public: } // OpenMP Clauses & Directives void Unparse(const OmpNameList &x) { - bool isCommon{std::get(x.t) == OmpNameList::Kind::Common}; + bool isCommon{ + std::get(x.t) == OmpNameList::Kind::Common}; const char *slash{isCommon ? "/" : ""}; Put(slash), Walk(std::get(x.t)), Put(slash); } @@ -1664,7 +1665,7 @@ public: Walk(",", std::get>(x.t)); } void Unparse(const OmpScheduleClause &x) { - Word(" SCHEDULE("); + Word(" SCHEDULE("); Walk(std::get>(x.t)); Walk(std::get(x.t)); Walk(std::get>(x.t)); @@ -1676,7 +1677,9 @@ public: Put(") "); } void Unparse(const OmpIfClause &x) { - Word(" IF("), Walk(std::get>(x.t), ":"); + Word(" IF("), + Walk(std::get>(x.t), + ":"); Walk(std::get(x.t)); Put(") "); } @@ -1691,7 +1694,7 @@ public: Put(")"); } void Unparse(const OmpReductionClause &x) { - Word(" REDUCTION("); + Word(" REDUCTION("); Walk(std::get(x.t)); Put(":"); Walk(std::get>(x.t), ","); @@ -1711,109 +1714,143 @@ public: Walk(std::get>(x.t), ","); } void Unparse(const OmpDependClause &x) { - std::visit( - visitors{[&](const OmpDependClause::Source &y) { - Word(" DEPEND(SOURCE)"); - }, - [&](const OmpDependClause::Sink &y) { - Word(" DEPEND(SINK:"); - Walk(y.v); - Put(")"); - }, - [&](const OmpDependClause::InOut &y) { - Word(" DEPEND("); Walk(y.t); Put(")"); - }}, + std::visit(visitors{[&](const OmpDependClause::Source &y) { + Word(" DEPEND(SOURCE)"); + }, + [&](const OmpDependClause::Sink &y) { + Word(" DEPEND(SINK:"); + Walk(y.v); + Put(")"); + }, + [&](const OmpDependClause::InOut &y) { + Word(" DEPEND("); + Walk(y.t); + Put(")"); + }}, x.u); } void Before(const OmpClause::Defaultmap &x) { - Word(" DEFAULTMAP(TOFROM:SCALAR)"); - } - void Before(const OmpClause::Inbranch &x) { - Word(" INBRANCH"); - } - void Before(const OmpClause::Mergeable &x) { - Word(" MERGEABLE"); - } - void Before(const OmpClause::Nogroup &x) { - Word(" NOGROUP"); - } - void Before(const OmpClause::Notinbranch &x) { - Word(" NOTINBRANCH"); - } - void Before(const OmpClause::Nowait &x) { - Word(" NOWAIT"); - } - void Before(const OmpClause::Untied &x) { - Word(" UNTIED"); - } - void Unparse(const OmpClause::Collapse &x) { - Word(" COLLAPSE("); Walk(x.v); Put(")"); + Word(" DEFAULTMAP(TOFROM:SCALAR)"); + } + void Before(const OmpClause::Inbranch &x) { Word(" INBRANCH"); } + void Before(const OmpClause::Mergeable &x) { Word(" MERGEABLE"); } + void Before(const OmpClause::Nogroup &x) { Word(" NOGROUP"); } + void Before(const OmpClause::Notinbranch &x) { Word(" NOTINBRANCH"); } + void Before(const OmpClause::Nowait &x) { Word(" NOWAIT"); } + void Before(const OmpClause::Untied &x) { Word(" UNTIED"); } + void Unparse(const OmpClause::Collapse &x) { + Word(" COLLAPSE("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::Copyin &x) { - Word(" COPYIN("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::Copyin &x) { + Word(" COPYIN("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::Copyprivate &x) { - Word(" COPYPRIVATE("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::Copyprivate &x) { + Word(" COPYPRIVATE("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::Device &x) { - Word(" DEVICE("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::Device &x) { + Word(" DEVICE("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::DistSchedule &x) { - Word(" DIST_SCHEDULE(STATIC,"); Walk(x.v); Put(")"); + void Unparse(const OmpClause::DistSchedule &x) { + Word(" DIST_SCHEDULE(STATIC,"); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::Final &x) { - Word(" FINAL("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::Final &x) { + Word(" FINAL("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::Firstprivate &x) { - Word(" FIRSTPRIVATE("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::Firstprivate &x) { + Word(" FIRSTPRIVATE("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::From &x) { - Word(" FROM("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::From &x) { + Word(" FROM("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::Grainsize &x) { - Word(" GRAINSIZE("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::Grainsize &x) { + Word(" GRAINSIZE("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::Lastprivate &x) { - Word(" LASTPRIVATE("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::Lastprivate &x) { + Word(" LASTPRIVATE("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::Link &x) { - Word(" LINK("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::Link &x) { + Word(" LINK("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::NumTasks &x) { - Word(" NUM_TASKS("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::NumTasks &x) { + Word(" NUM_TASKS("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::NumTeams &x) { - Word(" NUM_TEAMS("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::NumTeams &x) { + Word(" NUM_TEAMS("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::NumThreads &x) { - Word(" NUM_THREADS("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::NumThreads &x) { + Word(" NUM_THREADS("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::Ordered &x) { - Word(" ORDERED"); Walk("(", x.v, ")"); + void Unparse(const OmpClause::Ordered &x) { + Word(" ORDERED"); + Walk("(", x.v, ")"); } - void Unparse(const OmpClause::Priority &x) { - Word(" PRIORITY("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::Priority &x) { + Word(" PRIORITY("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::Private &x) { - Word(" PRIVATE("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::Private &x) { + Word(" PRIVATE("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::Safelen &x) { - Word(" SAFELEN("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::Safelen &x) { + Word(" SAFELEN("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::ThreadLimit &x) { - Word(" THREADLIMIT("); Walk(x.v); Put(")"); + void Unparse(const OmpClause::ThreadLimit &x) { + Word(" THREADLIMIT("); + Walk(x.v); + Put(")"); } - void Unparse(const OmpClause::Shared &x) { - Word(" SHARED("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::Shared &x) { + Word(" SHARED("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::To &x) { - Word(" TO("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::To &x) { + Word(" TO("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::Uniform &x) { - Word(" UNIFORM("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::Uniform &x) { + Word(" UNIFORM("); + Walk(x.v, ","); + Put(")"); } - void Unparse(const OmpClause::UseDevicePtr &x) { - Word(" USE_DEVICE_PTR("); Walk(x.v, ","); Put(")"); + void Unparse(const OmpClause::UseDevicePtr &x) { + Word(" USE_DEVICE_PTR("); + Walk(x.v, ","); + Put(")"); } void Unparse(const OmpLoopDirective &x) { std::visit( @@ -1821,143 +1858,142 @@ public: Word("DISTRIBUTE PARALLEL DO SIMD"); Walk(y.v); }, - [&](const OmpLoopDirective::DistributeParallelDo &y) { - Word("DISTRIBUTE PARALLEL DO"); - Walk(y.v); - }, - [&](const OmpLoopDirective::DistributeSimd &y) { - Word("DISTRIBUTE SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::Distribute &y) { - Word("DISTRIBUTE"); - Walk(y.v); - }, - [&](const OmpLoopDirective::DoSimd &y) { - Word("DO SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::Do &y) { - Word("DO"); - Walk(y.v); - }, - [&](const OmpLoopDirective::ParallelDoSimd &y) { - Word("PARALLEL DO SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::ParallelDo &y) { - Word("PARALLEL DO"); - Walk(y.v); - }, - [&](const OmpLoopDirective::Simd &y) { - Word("SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TargetParallelDoSimd &y) { - Word("TARGET PARALLEL DO SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TargetParallelDo &y) { - Word("TARGET PARALLEL DO"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TargetTeamsDistributeParallelDoSimd &y) { - Word("TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TargetTeamsDistributeParallelDo &y) { - Word("TARGET TEAMS DISTRIBUTE PARALLEL DO"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TargetTeamsDistributeSimd &y) { - Word("TARGET TEAMS DISTRIBUTE SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TargetTeamsDistribute &y) { - Word("TARGET TEAMS DISTRIBUTE"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TargetSimd &y) { - Word("TARGET SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TaskloopSimd &y) { - Word("TASKLOOP SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::Taskloop &y) { - Word("TASKLOOP"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TeamsDistributeParallelDoSimd &y) { - Word("TEAMS DISTRIBUTE PARALLEL DO SIMD"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TeamsDistributeParallelDo &y) { - Word("TEAMS DISTRIBUTE PARALLEL DO"); - Walk(y.v); - }, - [&](const OmpLoopDirective::TeamsDistributeSimd &y) { - Word("TEAMS DISTRIBUTE SIMD"); - Walk(y.v); - }, + [&](const OmpLoopDirective::DistributeParallelDo &y) { + Word("DISTRIBUTE PARALLEL DO"); + Walk(y.v); + }, + [&](const OmpLoopDirective::DistributeSimd &y) { + Word("DISTRIBUTE SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::Distribute &y) { + Word("DISTRIBUTE"); + Walk(y.v); + }, + [&](const OmpLoopDirective::DoSimd &y) { + Word("DO SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::Do &y) { + Word("DO"); + Walk(y.v); + }, + [&](const OmpLoopDirective::ParallelDoSimd &y) { + Word("PARALLEL DO SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::ParallelDo &y) { + Word("PARALLEL DO"); + Walk(y.v); + }, + [&](const OmpLoopDirective::Simd &y) { + Word("SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TargetParallelDoSimd &y) { + Word("TARGET PARALLEL DO SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TargetParallelDo &y) { + Word("TARGET PARALLEL DO"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TargetTeamsDistributeParallelDoSimd + &y) { + Word("TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TargetTeamsDistributeParallelDo &y) { + Word("TARGET TEAMS DISTRIBUTE PARALLEL DO"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TargetTeamsDistributeSimd &y) { + Word("TARGET TEAMS DISTRIBUTE SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TargetTeamsDistribute &y) { + Word("TARGET TEAMS DISTRIBUTE"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TargetSimd &y) { + Word("TARGET SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TaskloopSimd &y) { + Word("TASKLOOP SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::Taskloop &y) { + Word("TASKLOOP"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TeamsDistributeParallelDoSimd &y) { + Word("TEAMS DISTRIBUTE PARALLEL DO SIMD"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TeamsDistributeParallelDo &y) { + Word("TEAMS DISTRIBUTE PARALLEL DO"); + Walk(y.v); + }, + [&](const OmpLoopDirective::TeamsDistributeSimd &y) { + Word("TEAMS DISTRIBUTE SIMD"); + Walk(y.v); + }, [&](const OmpLoopDirective::TeamsDistribute &y) { - Word("TEAMS DISTRIBUTE"); - Walk(y.v); - }}, + Word("TEAMS DISTRIBUTE"); + Walk(y.v); + }}, x.u); Put("\n"); Indent(); } void Unparse(const OmpStandaloneDirective &x) { - std::visit( - visitors{[&](const OmpStandaloneDirective::Barrier &y) { - Word("BARRIER"); - Walk(y.v); - }, - [&](const OmpStandaloneDirective::CancellationPoint &y) { - Word("CANCELLATION POINT"); - Walk(y.v); - }, - [&](const OmpStandaloneDirective::Cancel &y) { - Word("CANCEL"); - Walk(y.v); - }, - [&](const OmpStandaloneDirective::Flush &y) { - Word("FLUSH"); - Walk(y.v); - }, - [&](const OmpStandaloneDirective::TargetEnterData &y) { - Word("TARGET ENTER DATA"); - Walk(y.v); - }, - [&](const OmpStandaloneDirective::TargetExitData &y) { - Word("TARGET EXIT DATA"); - Walk(y.v); - }, - [&](const OmpStandaloneDirective::TargetUpdate &y) { - Word("TARGET UPDATE"); - Walk(y.v); - }, - [&](const OmpStandaloneDirective::Taskwait &y) { - Word("TASKWAIT"); - Walk(y.v); - }, - [&](const OmpStandaloneDirective::Taskyield &y) { - Word("TASKYIELD"); - Walk(y.v); - }}, + std::visit(visitors{[&](const OmpStandaloneDirective::Barrier &y) { + Word("BARRIER"); + Walk(y.v); + }, + [&](const OmpStandaloneDirective::CancellationPoint &y) { + Word("CANCELLATION POINT"); + Walk(y.v); + }, + [&](const OmpStandaloneDirective::Cancel &y) { + Word("CANCEL"); + Walk(y.v); + }, + [&](const OmpStandaloneDirective::Flush &y) { + Word("FLUSH"); + Walk(y.v); + }, + [&](const OmpStandaloneDirective::TargetEnterData &y) { + Word("TARGET ENTER DATA"); + Walk(y.v); + }, + [&](const OmpStandaloneDirective::TargetExitData &y) { + Word("TARGET EXIT DATA"); + Walk(y.v); + }, + [&](const OmpStandaloneDirective::TargetUpdate &y) { + Word("TARGET UPDATE"); + Walk(y.v); + }, + [&](const OmpStandaloneDirective::Taskwait &y) { + Word("TASKWAIT"); + Walk(y.v); + }, + [&](const OmpStandaloneDirective::Taskyield &y) { + Word("TASKYIELD"); + Walk(y.v); + }}, x.u); Put("\n"); Indent(); } void Unparse(const OmpEndDirective &x) { Outdent(); - std::visit( - visitors{[&](const OmpLoopDirective &y) { - Word("!$OMP END "); - Walk(y); - }}, + std::visit(visitors{[&](const OmpLoopDirective &y) { + Word("!$OMP END "); + Walk(y); + }}, x.u); } void Unparse(const OpenMPStandaloneConstruct &x) { @@ -2038,12 +2074,15 @@ public: WALK_NESTED_ENUM(OmpDefaultClause, Type) // OMP DEFAULT WALK_NESTED_ENUM(OmpScheduleModifierType, ModType) // OMP schedule-modifier WALK_NESTED_ENUM(OmpLinearModifier, Type) // OMP linear-modifier - WALK_NESTED_ENUM(OmpReductionOperator, ProcedureOperator) // OMP reduction-identifier - WALK_NESTED_ENUM(OmpReductionOperator, BinaryOperator) // OMP reduction-identifier + WALK_NESTED_ENUM( + OmpReductionOperator, ProcedureOperator) // OMP reduction-identifier + WALK_NESTED_ENUM( + OmpReductionOperator, BinaryOperator) // OMP reduction-identifier WALK_NESTED_ENUM(OmpDependenceType, Type) // OMP dependence-type WALK_NESTED_ENUM(OmpMapClause, Type) // OMP map-type WALK_NESTED_ENUM(OmpScheduleClause, ScheduleType) // OMP schedule-type - WALK_NESTED_ENUM(OmpIfClause, DirectiveNameModifier) // OMP directive-modifier + WALK_NESTED_ENUM( + OmpIfClause, DirectiveNameModifier) // OMP directive-modifier #undef WALK_NESTED_ENUM void Done() const { CHECK(indent_ == 0); } -- 2.7.4