@@ -47,44 +47,43 @@ namespace omp {
47
47
// / construct.
48
48
class ClauseProcessor {
49
49
public:
50
- ClauseProcessor (Fortran:: lower::AbstractConverter &converter,
51
- Fortran:: semantics::SemanticsContext &semaCtx,
50
+ ClauseProcessor (lower::AbstractConverter &converter,
51
+ semantics::SemanticsContext &semaCtx,
52
52
const List<Clause> &clauses)
53
53
: converter(converter), semaCtx(semaCtx), clauses(clauses) {}
54
54
55
55
// 'Unique' clauses: They can appear at most once in the clause list.
56
- bool processCollapse (
57
- mlir::Location currentLocation, Fortran:: lower::pft::Evaluation &eval,
58
- mlir::omp::CollapseClauseOps &result,
59
- llvm::SmallVectorImpl<const Fortran:: semantics::Symbol *> &iv) const ;
56
+ bool
57
+ processCollapse ( mlir::Location currentLocation, lower::pft::Evaluation &eval,
58
+ mlir::omp::CollapseClauseOps &result,
59
+ llvm::SmallVectorImpl<const semantics::Symbol *> &iv) const ;
60
60
bool processDefault () const ;
61
- bool processDevice (Fortran:: lower::StatementContext &stmtCtx,
61
+ bool processDevice (lower::StatementContext &stmtCtx,
62
62
mlir::omp::DeviceClauseOps &result) const ;
63
63
bool processDeviceType (mlir::omp::DeviceTypeClauseOps &result) const ;
64
- bool processFinal (Fortran:: lower::StatementContext &stmtCtx,
64
+ bool processFinal (lower::StatementContext &stmtCtx,
65
65
mlir::omp::FinalClauseOps &result) const ;
66
- bool
67
- processHasDeviceAddr (mlir::omp::HasDeviceAddrClauseOps &result,
68
- llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
69
- llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
70
- llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
71
- &isDeviceSymbols) const ;
66
+ bool processHasDeviceAddr (
67
+ mlir::omp::HasDeviceAddrClauseOps &result,
68
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
69
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
70
+ llvm::SmallVectorImpl<const semantics::Symbol *> &isDeviceSymbols) const ;
72
71
bool processHint (mlir::omp::HintClauseOps &result) const ;
73
72
bool processMergeable (mlir::omp::MergeableClauseOps &result) const ;
74
73
bool processNowait (mlir::omp::NowaitClauseOps &result) const ;
75
- bool processNumTeams (Fortran:: lower::StatementContext &stmtCtx,
74
+ bool processNumTeams (lower::StatementContext &stmtCtx,
76
75
mlir::omp::NumTeamsClauseOps &result) const ;
77
- bool processNumThreads (Fortran:: lower::StatementContext &stmtCtx,
76
+ bool processNumThreads (lower::StatementContext &stmtCtx,
78
77
mlir::omp::NumThreadsClauseOps &result) const ;
79
78
bool processOrdered (mlir::omp::OrderedClauseOps &result) const ;
80
- bool processPriority (Fortran:: lower::StatementContext &stmtCtx,
79
+ bool processPriority (lower::StatementContext &stmtCtx,
81
80
mlir::omp::PriorityClauseOps &result) const ;
82
81
bool processProcBind (mlir::omp::ProcBindClauseOps &result) const ;
83
82
bool processSafelen (mlir::omp::SafelenClauseOps &result) const ;
84
- bool processSchedule (Fortran:: lower::StatementContext &stmtCtx,
83
+ bool processSchedule (lower::StatementContext &stmtCtx,
85
84
mlir::omp::ScheduleClauseOps &result) const ;
86
85
bool processSimdlen (mlir::omp::SimdlenClauseOps &result) const ;
87
- bool processThreadLimit (Fortran:: lower::StatementContext &stmtCtx,
86
+ bool processThreadLimit (lower::StatementContext &stmtCtx,
88
87
mlir::omp::ThreadLimitClauseOps &result) const ;
89
88
bool processUntied (mlir::omp::UntiedClauseOps &result) const ;
90
89
@@ -98,12 +97,11 @@ class ClauseProcessor {
98
97
processEnter (llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const ;
99
98
bool processIf (omp::clause::If::DirectiveNameModifier directiveName,
100
99
mlir::omp::IfClauseOps &result) const ;
101
- bool
102
- processIsDevicePtr (mlir::omp::IsDevicePtrClauseOps &result,
103
- llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
104
- llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
105
- llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
106
- &isDeviceSymbols) const ;
100
+ bool processIsDevicePtr (
101
+ mlir::omp::IsDevicePtrClauseOps &result,
102
+ llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
103
+ llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
104
+ llvm::SmallVectorImpl<const semantics::Symbol *> &isDeviceSymbols) const ;
107
105
bool
108
106
processLink (llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const ;
109
107
@@ -113,35 +111,32 @@ class ClauseProcessor {
113
111
// They may be used later on to create the block_arguments for some of the
114
112
// target directives that require it.
115
113
bool processMap (
116
- mlir::Location currentLocation, Fortran:: lower::StatementContext &stmtCtx,
114
+ mlir::Location currentLocation, lower::StatementContext &stmtCtx,
117
115
mlir::omp::MapClauseOps &result,
118
- llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> *mapSyms =
119
- nullptr ,
116
+ llvm::SmallVectorImpl<const semantics::Symbol *> *mapSyms = nullptr ,
120
117
llvm::SmallVectorImpl<mlir::Location> *mapSymLocs = nullptr ,
121
118
llvm::SmallVectorImpl<mlir::Type> *mapSymTypes = nullptr ) const ;
122
119
bool processReduction (
123
120
mlir::Location currentLocation, mlir::omp::ReductionClauseOps &result,
124
121
llvm::SmallVectorImpl<mlir::Type> *reductionTypes = nullptr ,
125
- llvm::SmallVectorImpl<const Fortran:: semantics::Symbol *> *reductionSyms =
122
+ llvm::SmallVectorImpl<const semantics::Symbol *> *reductionSyms =
126
123
nullptr ) const ;
127
124
bool processSectionsReduction (mlir::Location currentLocation,
128
125
mlir::omp::ReductionClauseOps &result) const ;
129
126
bool processTo (llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const ;
130
- bool
131
- processUseDeviceAddr (mlir::omp::UseDeviceClauseOps &result,
132
- llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
133
- llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
134
- llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
135
- &useDeviceSyms) const ;
136
- bool
137
- processUseDevicePtr (mlir::omp::UseDeviceClauseOps &result,
138
- llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
139
- llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
140
- llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
141
- &useDeviceSyms) const ;
127
+ bool processUseDeviceAddr (
128
+ mlir::omp::UseDeviceClauseOps &result,
129
+ llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
130
+ llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
131
+ llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const ;
132
+ bool processUseDevicePtr (
133
+ mlir::omp::UseDeviceClauseOps &result,
134
+ llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
135
+ llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
136
+ llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const ;
142
137
143
138
template <typename T>
144
- bool processMotionClauses (Fortran:: lower::StatementContext &stmtCtx,
139
+ bool processMotionClauses (lower::StatementContext &stmtCtx,
145
140
mlir::omp::MapClauseOps &result);
146
141
147
142
// Call this method for these clauses that should be supported but are not
@@ -162,36 +157,34 @@ class ClauseProcessor {
162
157
// / `nullptr` if not present. If more than one instance is expected, use
163
158
// / `findRepeatableClause` instead.
164
159
template <typename T>
165
- const T *
166
- findUniqueClause (const Fortran::parser::CharBlock **source = nullptr ) const ;
160
+ const T *findUniqueClause (const parser::CharBlock **source = nullptr ) const ;
167
161
168
162
// / Call `callbackFn` for each occurrence of the given clause. Return `true`
169
163
// / if at least one instance was found.
170
164
template <typename T>
171
165
bool findRepeatableClause (
172
- std::function<void (const T &, const Fortran:: parser::CharBlock &source)>
166
+ std::function<void (const T &, const parser::CharBlock &source)>
173
167
callbackFn) const ;
174
168
175
169
// / Set the `result` to a new `mlir::UnitAttr` if the clause is present.
176
170
template <typename T>
177
171
bool markClauseOccurrence (mlir::UnitAttr &result) const ;
178
172
179
- Fortran:: lower::AbstractConverter &converter;
180
- Fortran:: semantics::SemanticsContext &semaCtx;
173
+ lower::AbstractConverter &converter;
174
+ semantics::SemanticsContext &semaCtx;
181
175
List<Clause> clauses;
182
176
};
183
177
184
178
template <typename T>
185
- bool ClauseProcessor::processMotionClauses (
186
- Fortran::lower::StatementContext &stmtCtx,
187
- mlir::omp::MapClauseOps &result) {
188
- std::map<const Fortran::semantics::Symbol *,
179
+ bool ClauseProcessor::processMotionClauses (lower::StatementContext &stmtCtx,
180
+ mlir::omp::MapClauseOps &result) {
181
+ std::map<const semantics::Symbol *,
189
182
llvm::SmallVector<OmpMapMemberIndicesData>>
190
183
parentMemberIndices;
191
- llvm::SmallVector<const Fortran:: semantics::Symbol *> mapSymbols;
184
+ llvm::SmallVector<const semantics::Symbol *> mapSymbols;
192
185
193
186
bool clauseFound = findRepeatableClause<T>(
194
- [&](const T &clause, const Fortran:: parser::CharBlock &source) {
187
+ [&](const T &clause, const parser::CharBlock &source) {
195
188
mlir::Location clauseLocation = converter.genLocation (source);
196
189
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder ();
197
190
@@ -209,9 +202,9 @@ bool ClauseProcessor::processMotionClauses(
209
202
llvm::SmallVector<mlir::Value> bounds;
210
203
std::stringstream asFortran;
211
204
212
- Fortran:: lower::AddrAndBoundsInfo info =
213
- Fortran:: lower::gatherDataOperandAddrAndBounds<
214
- mlir::omp::MapBoundsOp, mlir::omp::MapBoundsType>(
205
+ lower::AddrAndBoundsInfo info =
206
+ lower::gatherDataOperandAddrAndBounds<mlir::omp::MapBoundsOp,
207
+ mlir::omp::MapBoundsType>(
215
208
converter, firOpBuilder, semaCtx, stmtCtx, *object.id (),
216
209
object.ref (), clauseLocation, asFortran, bounds,
217
210
treatIndexAsSection);
@@ -277,8 +270,8 @@ ClauseProcessor::findClause(ClauseIterator begin, ClauseIterator end) {
277
270
}
278
271
279
272
template <typename T>
280
- const T *ClauseProcessor::findUniqueClause (
281
- const Fortran:: parser::CharBlock **source) const {
273
+ const T *
274
+ ClauseProcessor::findUniqueClause ( const parser::CharBlock **source) const {
282
275
ClauseIterator it = findClause<T>(clauses.begin (), clauses.end ());
283
276
if (it != clauses.end ()) {
284
277
if (source)
@@ -290,8 +283,8 @@ const T *ClauseProcessor::findUniqueClause(
290
283
291
284
template <typename T>
292
285
bool ClauseProcessor::findRepeatableClause (
293
- std::function<void (const T &, const Fortran:: parser::CharBlock &source)>
294
- callbackFn) const {
286
+ std::function<void (const T &, const parser::CharBlock &source)> callbackFn)
287
+ const {
295
288
bool found = false ;
296
289
ClauseIterator nextIt, endIt = clauses.end ();
297
290
for (ClauseIterator it = clauses.begin (); it != endIt; it = nextIt) {
0 commit comments