[flang] Add missing IS_DEVICE_PTR and LINK clauses for OpenMP parsing

Original-commit: flang-compiler/f18@541d4031e0
Reviewed-on: https://github.com/flang-compiler/f18/pull/501
This commit is contained in:
Jinxin Yang
2019-06-13 15:33:15 -07:00
parent 55abea96dd
commit 1e33dfb431
4 changed files with 22 additions and 3 deletions

View File

@@ -473,9 +473,11 @@ public:
NODE(parser::OmpClause, Simdlen)
NODE(parser::OmpClause, ThreadLimit)
NODE(parser::OmpClause, To)
NODE(parser::OmpClause, Link)
NODE(parser::OmpClause, Uniform)
NODE(parser::OmpClause, Untied)
NODE(parser::OmpClause, UseDevicePtr)
NODE(parser::OmpClause, IsDevicePtr)
NODE(parser, OmpDefaultClause)
NODE_ENUM(parser::OmpDefaultClause, Type)
NODE(parser, OmpDependClause)

View File

@@ -211,10 +211,14 @@ TYPE_PARSER("DEFAULTMAP" >>
parenthesized(scalarIntExpr))) ||
"TO" >> construct<OmpClause>(construct<OmpClause::To>(
parenthesized(nonemptyList(designator)))) ||
"LINK" >> construct<OmpClause>(construct<OmpClause::Link>(
parenthesized(nonemptyList(designator)))) ||
"UNIFORM" >> construct<OmpClause>(construct<OmpClause::Uniform>(
parenthesized(nonemptyList(name)))) ||
"USE_DEVICE_PTR" >> construct<OmpClause>(construct<OmpClause::UseDevicePtr>(
parenthesized(nonemptyList(name)))) ||
"IS_DEVICE_PTR" >> construct<OmpClause>(construct<OmpClause::IsDevicePtr>(
parenthesized(nonemptyList(name)))) ||
"ALIGNED" >>
construct<OmpClause>(parenthesized(Parser<OmpAlignedClause>{})) ||
"DEFAULT" >>

View File

@@ -3441,15 +3441,18 @@ struct OmpClause {
WRAPPER_CLASS(Simdlen, ScalarIntConstantExpr);
WRAPPER_CLASS(ThreadLimit, ScalarIntExpr);
WRAPPER_CLASS(To, std::list<Designator>);
WRAPPER_CLASS(Link, std::list<Designator>);
WRAPPER_CLASS(Uniform, std::list<Name>);
WRAPPER_CLASS(UseDevicePtr, std::list<Name>);
WRAPPER_CLASS(IsDevicePtr, std::list<Name>);
std::variant<Defaultmap, Inbranch, Mergeable, Nogroup, Notinbranch, OmpNowait,
Untied, Collapse, Copyin, Copyprivate, Device, DistSchedule, Final,
Firstprivate, From, Grainsize, Lastprivate, NumTasks, NumTeams,
NumThreads, Ordered, Priority, Private, Safelen, Shared, Simdlen,
ThreadLimit, To, Uniform, UseDevicePtr, OmpAlignedClause,
OmpDefaultClause, OmpDependClause, OmpIfClause, OmpLinearClause,
OmpMapClause, OmpProcBindClause, OmpReductionClause, OmpScheduleClause>
ThreadLimit, To, Link, Uniform, UseDevicePtr, IsDevicePtr,
OmpAlignedClause, OmpDefaultClause, OmpDependClause, OmpIfClause,
OmpLinearClause, OmpMapClause, OmpProcBindClause, OmpReductionClause,
OmpScheduleClause>
u;
};

View File

@@ -1992,6 +1992,11 @@ public:
Walk(x.v, ",");
Put(")");
}
void Unparse(const OmpClause::Link &x) {
Word("LINK(");
Walk(x.v, ",");
Put(")");
}
void Unparse(const OmpClause::Uniform &x) {
Word("UNIFORM(");
Walk(x.v, ",");
@@ -2002,6 +2007,11 @@ public:
Walk(x.v, ",");
Put(")");
}
void Unparse(const OmpClause::IsDevicePtr &x) {
Word("IS_DEVICE_PTR(");
Walk(x.v, ",");
Put(")");
}
void Unparse(const OmpLoopDirective &x) {
std::visit(
common::visitors{