-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[flang][OpenMP] Parsing support for map type modifiers #111860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
424475c
4e3c975
0d20947
2c74157
3447262
abf8e6e
254b3d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2073,11 +2073,24 @@ class UnparseVisitor { | |
":"); | ||
Walk(std::get<OmpObjectList>(x.t)); | ||
} | ||
void Unparse(const OmpMapType::Always &) { Word("ALWAYS,"); } | ||
void Unparse(const OmpMapClause &x) { | ||
Walk(std::get<std::optional<OmpMapType>>(x.t), ":"); | ||
auto &typeMod = | ||
std::get<std::optional<std::list<OmpMapClause::TypeModifier>>>(x.t); | ||
auto &type = std::get<std::optional<OmpMapClause::Type>>(x.t); | ||
Walk(typeMod); | ||
if (typeMod.has_value() && type.has_value()) | ||
Put(", "); | ||
Walk(type); | ||
if (typeMod.has_value() || type.has_value()) | ||
Put(": "); | ||
Walk(std::get<OmpObjectList>(x.t)); | ||
} | ||
void Unparse(const OmpMapClause::TypeModifier &x) { | ||
if (x == OmpMapClause::TypeModifier::OmpxHold) | ||
Word("OMPX_HOLD"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this a special case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the enum name is "OmpxHold". The EnumToString returns "OMPXHOLD" for it, but it needs the underscore. |
||
else | ||
Word(OmpMapClause::EnumToString(x)); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Frontend code has braces almost always. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
void Unparse(const OmpScheduleModifier &x) { | ||
Walk(std::get<OmpScheduleModifier::Modifier1>(x.t)); | ||
Walk(",", std::get<std::optional<OmpScheduleModifier::Modifier2>>(x.t)); | ||
|
@@ -2775,7 +2788,6 @@ class UnparseVisitor { | |
WALK_NESTED_ENUM(OmpScheduleModifierType, ModType) // OMP schedule-modifier | ||
WALK_NESTED_ENUM(OmpLinearModifier, Type) // OMP linear-modifier | ||
WALK_NESTED_ENUM(OmpDependenceType, Type) // OMP dependence-type | ||
WALK_NESTED_ENUM(OmpMapType, Type) // OMP map-type | ||
WALK_NESTED_ENUM(OmpScheduleClause, ScheduleType) // OMP schedule-type | ||
WALK_NESTED_ENUM(OmpDeviceClause, DeviceModifier) // OMP device modifier | ||
WALK_NESTED_ENUM(OmpDeviceTypeClause, Type) // OMP DEVICE_TYPE | ||
|
@@ -2785,6 +2797,7 @@ class UnparseVisitor { | |
WALK_NESTED_ENUM(OmpCancelType, Type) // OMP cancel-type | ||
WALK_NESTED_ENUM(OmpOrderClause, Type) // OMP order-type | ||
WALK_NESTED_ENUM(OmpOrderModifier, Kind) // OMP order-modifier | ||
WALK_NESTED_ENUM(OmpMapClause, Type) // OMP map-type | ||
#undef WALK_NESTED_ENUM | ||
void Unparse(const ReductionOperator::Operator x) { | ||
switch (x) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for the TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done