forked from OSchip/llvm-project
[flang] update unparsing openmp directives and clauses.
Original-commit: flang-compiler/f18@76121cda6c Reviewed-on: https://github.com/flang-compiler/f18/pull/96 Tree-same-pre-rewrite: false
This commit is contained in:
parent
1bfb843a29
commit
9914f221bd
|
@ -81,10 +81,10 @@ TYPE_PARSER(construct<OmpScheduleModifierType>(
|
|||
"NONMONOTONIC" >> pure(OmpScheduleModifierType::ModType::Nonmonotonic) ||
|
||||
"SIMD" >> pure(OmpScheduleModifierType::ModType::Simd)))
|
||||
|
||||
TYPE_PARSER(construct<OmpScheduleModifier>(Parser<OmpScheduleModifierType>{}, maybe(","_ch >> Parser<OmpScheduleModifierType>{})))
|
||||
TYPE_PARSER(construct<OmpScheduleModifier>(Parser<OmpScheduleModifierType>{},
|
||||
maybe(","_ch >> Parser<OmpScheduleModifierType>{})))
|
||||
|
||||
TYPE_PARSER(construct<OmpScheduleClause>(
|
||||
maybe(Parser<OmpScheduleModifier>{}),
|
||||
TYPE_PARSER(construct<OmpScheduleClause>(maybe(Parser<OmpScheduleModifier>{}),
|
||||
"STATIC" >> pure(OmpScheduleClause::ScheduleType::Static) ||
|
||||
"DYNAMIC" >> pure(OmpScheduleClause::ScheduleType::Dynamic) ||
|
||||
"GUIDED" >> pure(OmpScheduleClause::ScheduleType::Guided) ||
|
||||
|
@ -161,8 +161,7 @@ TYPE_PARSER(construct<OmpLinearModifier>(
|
|||
TYPE_CONTEXT_PARSER("Omp LINEAR clause"_en_US,
|
||||
construct<OmpLinearClause>(
|
||||
construct<OmpLinearClause>(construct<OmpLinearClause::WithModifier>(
|
||||
Parser<OmpLinearModifier>{},
|
||||
parenthesized(nonemptyList(name)),
|
||||
Parser<OmpLinearModifier>{}, parenthesized(nonemptyList(name)),
|
||||
maybe(":"_ch >> scalarIntConstantExpr))) ||
|
||||
construct<OmpLinearClause>(construct<OmpLinearClause::WithoutModifier>(
|
||||
nonemptyList(name), maybe(":"_ch >> scalarIntConstantExpr)))))
|
||||
|
@ -175,47 +174,81 @@ TYPE_PARSER(construct<OmpNameList>(pure(OmpNameList::Kind::Object), name) ||
|
|||
construct<OmpNameList>("/" >> pure(OmpNameList::Kind::Common), name / "/"))
|
||||
|
||||
TYPE_PARSER(
|
||||
construct<OmpClause>(construct<OmpClause::Defaultmap>("DEFAULTMAP"_tok >> parenthesized("TOFROM"_tok >> ":"_ch >> "SCALAR"_tok))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Inbranch>("INBRANCH"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Mergeable>("MERGEABLE"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Nogroup>("NOGROUP"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Notinbranch>("NOTINBRANCH"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Nowait>("NOWAIT"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Untied>("UNTIED"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Collapse>("COLLAPSE"_tok >> parenthesized(scalarIntConstantExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Copyin>("COPYIN"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Copyprivate>("COPYPRIVATE"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Device>("DEVICE"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::DistSchedule>("DIST_SCHEDULE"_tok >> parenthesized("STATIC"_tok >> ","_ch >> scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Final>("FINAL"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Firstprivate>("FIRSTPRIVATE"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::From>("FROM"_tok >> parenthesized(nonemptyList(designator)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Grainsize>("GRAINSIZE"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Lastprivate>("LASTPRIVATE"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Link>("LINK"_tok >> parenthesized(nonemptyList(name)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::NumTasks>("NUM_TASKS"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::NumTeams>( "NUM_TEAMS"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::NumThreads>("NUM_THREADS"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Ordered>("ORDERED"_tok >> maybe(parenthesized(scalarIntConstantExpr)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Priority>("PRIORITY"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Private>("PRIVATE"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Safelen>("SAFELEN"_tok >> parenthesized(scalarIntConstantExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Shared>("SHARED"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Simdlen>("SIMDLEN"_tok >> parenthesized(scalarIntConstantExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::ThreadLimit>("THREAD_LIMIT"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::To>("TO"_tok >> parenthesized(nonemptyList(designator)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Uniform>("UNIFORM"_tok >> parenthesized(nonemptyList(name)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::UseDevicePtr>("USE_DEVICE_PTR"_tok >> parenthesized(nonemptyList(name)))) ||
|
||||
construct<OmpClause>("ALIGNED"_tok >> parenthesized(Parser<OmpAlignedClause>{})) ||
|
||||
construct<OmpClause>("DEFAULT"_tok >> parenthesized(Parser<OmpDefaultClause>{})) ||
|
||||
construct<OmpClause>("DEPEND"_tok >> parenthesized(Parser<OmpDependClause>{})) ||
|
||||
construct<OmpClause>("IF"_tok >> parenthesized(Parser<OmpIfClause>{})) ||
|
||||
construct<OmpClause>("LINEAR"_tok >> parenthesized(Parser<OmpLinearClause>{})) ||
|
||||
construct<OmpClause>("MAP"_tok >> parenthesized(Parser<OmpMapClause>{})) ||
|
||||
construct<OmpClause>("PROC_BIND"_tok >> parenthesized(Parser<OmpProcBindClause>{})) ||
|
||||
construct<OmpClause>("REDUCTION"_tok >> parenthesized(Parser<OmpReductionClause>{})) ||
|
||||
construct<OmpClause>("SCHEDULE"_tok >> parenthesized(Parser<OmpScheduleClause>{}))
|
||||
)
|
||||
construct<OmpClause>(construct<OmpClause::Defaultmap>("DEFAULTMAP"_tok >>
|
||||
parenthesized("TOFROM"_tok >> ":"_ch >> "SCALAR"_tok))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Inbranch>("INBRANCH"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Mergeable>("MERGEABLE"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Nogroup>("NOGROUP"_tok)) ||
|
||||
construct<OmpClause>(
|
||||
construct<OmpClause::Notinbranch>("NOTINBRANCH"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Nowait>("NOWAIT"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Untied>("UNTIED"_tok)) ||
|
||||
construct<OmpClause>(construct<OmpClause::Collapse>(
|
||||
"COLLAPSE"_tok >> parenthesized(scalarIntConstantExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Copyin>(
|
||||
"COPYIN"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Copyprivate>("COPYPRIVATE"_tok >>
|
||||
parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Device>(
|
||||
"DEVICE"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(
|
||||
construct<OmpClause::DistSchedule>("DIST_SCHEDULE"_tok >>
|
||||
parenthesized("STATIC"_tok >> ","_ch >> scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Final>(
|
||||
"FINAL"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(
|
||||
construct<OmpClause::Firstprivate>("FIRSTPRIVATE"_tok >>
|
||||
parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::From>(
|
||||
"FROM"_tok >> parenthesized(nonemptyList(designator)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Grainsize>(
|
||||
"GRAINSIZE"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Lastprivate>("LASTPRIVATE"_tok >>
|
||||
parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Link>(
|
||||
"LINK"_tok >> parenthesized(nonemptyList(name)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::NumTasks>(
|
||||
"NUM_TASKS"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::NumTeams>(
|
||||
"NUM_TEAMS"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::NumThreads>(
|
||||
"NUM_THREADS"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Ordered>(
|
||||
"ORDERED"_tok >> maybe(parenthesized(scalarIntConstantExpr)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Priority>(
|
||||
"PRIORITY"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Private>(
|
||||
"PRIVATE"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Safelen>(
|
||||
"SAFELEN"_tok >> parenthesized(scalarIntConstantExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Shared>(
|
||||
"SHARED"_tok >> parenthesized(nonemptyList(Parser<OmpNameList>{})))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Simdlen>(
|
||||
"SIMDLEN"_tok >> parenthesized(scalarIntConstantExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::ThreadLimit>(
|
||||
"THREAD_LIMIT"_tok >> parenthesized(scalarIntExpr))) ||
|
||||
construct<OmpClause>(construct<OmpClause::To>(
|
||||
"TO"_tok >> parenthesized(nonemptyList(designator)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::Uniform>(
|
||||
"UNIFORM"_tok >> parenthesized(nonemptyList(name)))) ||
|
||||
construct<OmpClause>(construct<OmpClause::UseDevicePtr>(
|
||||
"USE_DEVICE_PTR"_tok >> parenthesized(nonemptyList(name)))) ||
|
||||
construct<OmpClause>(
|
||||
"ALIGNED"_tok >> parenthesized(Parser<OmpAlignedClause>{})) ||
|
||||
construct<OmpClause>(
|
||||
"DEFAULT"_tok >> parenthesized(Parser<OmpDefaultClause>{})) ||
|
||||
construct<OmpClause>(
|
||||
"DEPEND"_tok >> parenthesized(Parser<OmpDependClause>{})) ||
|
||||
construct<OmpClause>("IF"_tok >> parenthesized(Parser<OmpIfClause>{})) ||
|
||||
construct<OmpClause>(
|
||||
"LINEAR"_tok >> parenthesized(Parser<OmpLinearClause>{})) ||
|
||||
construct<OmpClause>("MAP"_tok >> parenthesized(Parser<OmpMapClause>{})) ||
|
||||
construct<OmpClause>(
|
||||
"PROC_BIND"_tok >> parenthesized(Parser<OmpProcBindClause>{})) ||
|
||||
construct<OmpClause>(
|
||||
"REDUCTION"_tok >> parenthesized(Parser<OmpReductionClause>{})) ||
|
||||
construct<OmpClause>(
|
||||
"SCHEDULE"_tok >> parenthesized(Parser<OmpScheduleClause>{})))
|
||||
|
||||
TYPE_PARSER(skipEmptyLines >> space >> "!$OMP END"_sptok >>
|
||||
(construct<OmpEndDirective>(Parser<OmpLoopDirective>{})))
|
||||
|
@ -314,11 +347,10 @@ TYPE_PARSER(construct<OpenMPStandaloneConstruct>(
|
|||
statement(Parser<OmpStandaloneDirective>{})))
|
||||
|
||||
TYPE_CONTEXT_PARSER("OpenMP construct"_en_US,
|
||||
beginOmpDirective >>
|
||||
(construct<OpenMPConstruct>(
|
||||
indirect(Parser<OpenMPStandaloneConstruct>{})) ||
|
||||
construct<OpenMPConstruct>(
|
||||
indirect(Parser<OpenMPLoopConstruct>{}))))
|
||||
beginOmpDirective >> (construct<OpenMPConstruct>(
|
||||
indirect(Parser<OpenMPStandaloneConstruct>{})) ||
|
||||
construct<OpenMPConstruct>(
|
||||
indirect(Parser<OpenMPLoopConstruct>{}))))
|
||||
|
||||
} // namespace Fortran::parser
|
||||
#endif // OPENMP_PARSER_GRAMMAR_H_
|
||||
|
|
|
@ -3233,11 +3233,14 @@ struct OmpScheduleModifier {
|
|||
std::tuple<Modifier1, std::optional<Modifier2>> 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<std::optional<OmpScheduleModifier>, ScheduleType, std::optional<ScalarIntExpr>> t;
|
||||
std::tuple<std::optional<OmpScheduleModifier>, ScheduleType,
|
||||
std::optional<ScalarIntExpr>>
|
||||
t;
|
||||
};
|
||||
|
||||
// IF(DirectiveNameModifier: scalar-logical-expr)
|
||||
|
@ -3283,7 +3286,8 @@ struct OmpLinearClause {
|
|||
std::variant<WithModifier, WithoutModifier> 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<Name>);
|
||||
WRAPPER_CLASS(UseDevicePtr, std::list<Name>);
|
||||
std::variant<Defaultmap, Inbranch, Mergeable, Nogroup, Notinbranch, Nowait,
|
||||
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;
|
||||
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<OmpStandaloneDirective>);
|
|||
struct OpenMPConstruct {
|
||||
UNION_CLASS_BOILERPLATE(OpenMPConstruct);
|
||||
std::variant<Indirection<OpenMPStandaloneConstruct>,
|
||||
Indirection<OpenMPLoopConstruct>> u;
|
||||
Indirection<OpenMPLoopConstruct>>
|
||||
u;
|
||||
};
|
||||
|
||||
} // namespace parser
|
||||
|
|
|
@ -1650,7 +1650,8 @@ public:
|
|||
}
|
||||
// OpenMP Clauses & Directives
|
||||
void Unparse(const OmpNameList &x) {
|
||||
bool isCommon{std::get<OmpNameList::Kind>(x.t) == OmpNameList::Kind::Common};
|
||||
bool isCommon{
|
||||
std::get<OmpNameList::Kind>(x.t) == OmpNameList::Kind::Common};
|
||||
const char *slash{isCommon ? "/" : ""};
|
||||
Put(slash), Walk(std::get<Name>(x.t)), Put(slash);
|
||||
}
|
||||
|
@ -1664,7 +1665,7 @@ public:
|
|||
Walk(",", std::get<std::optional<OmpScheduleModifier::Modifier2>>(x.t));
|
||||
}
|
||||
void Unparse(const OmpScheduleClause &x) {
|
||||
Word(" SCHEDULE(");
|
||||
Word(" SCHEDULE(");
|
||||
Walk(std::get<std::optional<OmpScheduleModifier>>(x.t));
|
||||
Walk(std::get<OmpScheduleClause::ScheduleType>(x.t));
|
||||
Walk(std::get<std::optional<ScalarIntExpr>>(x.t));
|
||||
|
@ -1676,7 +1677,9 @@ public:
|
|||
Put(") ");
|
||||
}
|
||||
void Unparse(const OmpIfClause &x) {
|
||||
Word(" IF("), Walk(std::get<std::optional<OmpIfClause::DirectiveNameModifier>>(x.t), ":");
|
||||
Word(" IF("),
|
||||
Walk(std::get<std::optional<OmpIfClause::DirectiveNameModifier>>(x.t),
|
||||
":");
|
||||
Walk(std::get<ScalarLogicalExpr>(x.t));
|
||||
Put(") ");
|
||||
}
|
||||
|
@ -1691,7 +1694,7 @@ public:
|
|||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpReductionClause &x) {
|
||||
Word(" REDUCTION(");
|
||||
Word(" REDUCTION(");
|
||||
Walk(std::get<OmpReductionOperator>(x.t));
|
||||
Put(":");
|
||||
Walk(std::get<std::list<Designator>>(x.t), ",");
|
||||
|
@ -1711,109 +1714,143 @@ public:
|
|||
Walk(std::get<std::list<Designator>>(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)");
|
||||
Word(" DEFAULTMAP(TOFROM:SCALAR)");
|
||||
}
|
||||
void Before(const OmpClause::Inbranch &x) {
|
||||
Word(" INBRANCH");
|
||||
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 Before(const OmpClause::Mergeable &x) {
|
||||
Word(" MERGEABLE");
|
||||
void Unparse(const OmpClause::Copyin &x) {
|
||||
Word(" COPYIN(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Before(const OmpClause::Nogroup &x) {
|
||||
Word(" NOGROUP");
|
||||
void Unparse(const OmpClause::Copyprivate &x) {
|
||||
Word(" COPYPRIVATE(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Before(const OmpClause::Notinbranch &x) {
|
||||
Word(" NOTINBRANCH");
|
||||
void Unparse(const OmpClause::Device &x) {
|
||||
Word(" DEVICE(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Before(const OmpClause::Nowait &x) {
|
||||
Word(" NOWAIT");
|
||||
void Unparse(const OmpClause::DistSchedule &x) {
|
||||
Word(" DIST_SCHEDULE(STATIC,");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Before(const OmpClause::Untied &x) {
|
||||
Word(" UNTIED");
|
||||
void Unparse(const OmpClause::Final &x) {
|
||||
Word(" FINAL(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Collapse &x) {
|
||||
Word(" COLLAPSE("); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::Firstprivate &x) {
|
||||
Word(" FIRSTPRIVATE(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Copyin &x) {
|
||||
Word(" COPYIN("); Walk(x.v, ","); Put(")");
|
||||
void Unparse(const OmpClause::From &x) {
|
||||
Word(" FROM(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Copyprivate &x) {
|
||||
Word(" COPYPRIVATE("); Walk(x.v, ","); Put(")");
|
||||
void Unparse(const OmpClause::Grainsize &x) {
|
||||
Word(" GRAINSIZE(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Device &x) {
|
||||
Word(" DEVICE("); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::Lastprivate &x) {
|
||||
Word(" LASTPRIVATE(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::DistSchedule &x) {
|
||||
Word(" DIST_SCHEDULE(STATIC,"); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::Link &x) {
|
||||
Word(" LINK(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Final &x) {
|
||||
Word(" FINAL("); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::NumTasks &x) {
|
||||
Word(" NUM_TASKS(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Firstprivate &x) {
|
||||
Word(" FIRSTPRIVATE("); Walk(x.v, ","); Put(")");
|
||||
void Unparse(const OmpClause::NumTeams &x) {
|
||||
Word(" NUM_TEAMS(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::From &x) {
|
||||
Word(" FROM("); Walk(x.v, ","); Put(")");
|
||||
void Unparse(const OmpClause::NumThreads &x) {
|
||||
Word(" NUM_THREADS(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Grainsize &x) {
|
||||
Word(" GRAINSIZE("); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::Ordered &x) {
|
||||
Word(" ORDERED");
|
||||
Walk("(", x.v, ")");
|
||||
}
|
||||
void Unparse(const OmpClause::Lastprivate &x) {
|
||||
Word(" LASTPRIVATE("); Walk(x.v, ","); Put(")");
|
||||
void Unparse(const OmpClause::Priority &x) {
|
||||
Word(" PRIORITY(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Link &x) {
|
||||
Word(" LINK("); Walk(x.v, ","); Put(")");
|
||||
void Unparse(const OmpClause::Private &x) {
|
||||
Word(" PRIVATE(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::NumTasks &x) {
|
||||
Word(" NUM_TASKS("); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::Safelen &x) {
|
||||
Word(" SAFELEN(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::NumTeams &x) {
|
||||
Word(" NUM_TEAMS("); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::ThreadLimit &x) {
|
||||
Word(" THREADLIMIT(");
|
||||
Walk(x.v);
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::NumThreads &x) {
|
||||
Word(" NUM_THREADS("); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::Shared &x) {
|
||||
Word(" SHARED(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Ordered &x) {
|
||||
Word(" ORDERED"); Walk("(", x.v, ")");
|
||||
void Unparse(const OmpClause::To &x) {
|
||||
Word(" TO(");
|
||||
Walk(x.v, ",");
|
||||
Put(")");
|
||||
}
|
||||
void Unparse(const OmpClause::Priority &x) {
|
||||
Word(" PRIORITY("); Walk(x.v); Put(")");
|
||||
void Unparse(const OmpClause::Uniform &x) {
|
||||
Word(" UNIFORM(");
|
||||
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::ThreadLimit &x) {
|
||||
Word(" THREADLIMIT("); 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::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); }
|
||||
|
|
Loading…
Reference in New Issue