@@ -37,7 +37,7 @@ namespace omp {
37
37
// / corresponding clause if it is present in the clause list. Otherwise, they
38
38
// / will return `false` to signal that the clause was not found.
39
39
// /
40
- // / The intended use is of this class is to move clause processing outside of
40
+ // / The intended use of this class is to move clause processing outside of
41
41
// / construct processing, since the same clauses can appear attached to
42
42
// / different constructs and constructs can be combined, so that code
43
43
// / duplication is minimized.
@@ -56,61 +56,51 @@ class ClauseProcessor {
56
56
// 'Unique' clauses: They can appear at most once in the clause list.
57
57
bool processCollapse (
58
58
mlir::Location currentLocation, Fortran::lower::pft::Evaluation &eval,
59
- llvm::SmallVectorImpl<mlir::Value> &lowerBound,
60
- llvm::SmallVectorImpl<mlir::Value> &upperBound,
61
- llvm::SmallVectorImpl<mlir::Value> &step,
59
+ mlir::omp::CollapseClauseOps &result,
62
60
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> &iv) const ;
63
61
bool processDefault () const ;
64
62
bool processDevice (Fortran::lower::StatementContext &stmtCtx,
65
- mlir::Value &result) const ;
66
- bool processDeviceType (mlir::omp::DeclareTargetDeviceType &result) const ;
63
+ mlir::omp::DeviceClauseOps &result) const ;
64
+ bool processDeviceType (mlir::omp::DeviceTypeClauseOps &result) const ;
67
65
bool processFinal (Fortran::lower::StatementContext &stmtCtx,
68
- mlir::Value &result) const ;
66
+ mlir::omp::FinalClauseOps &result) const ;
69
67
bool
70
- processHasDeviceAddr (llvm::SmallVectorImpl<mlir::Value> &operands ,
68
+ processHasDeviceAddr (mlir::omp::HasDeviceAddrClauseOps &result ,
71
69
llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
72
70
llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
73
71
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
74
72
&isDeviceSymbols) const ;
75
- bool processHint (mlir::IntegerAttr &result) const ;
76
- bool processMergeable (mlir::UnitAttr &result) const ;
77
- bool processNowait (mlir::UnitAttr &result) const ;
73
+ bool processHint (mlir::omp::HintClauseOps &result) const ;
74
+ bool processMergeable (mlir::omp::MergeableClauseOps &result) const ;
75
+ bool processNowait (mlir::omp::NowaitClauseOps &result) const ;
78
76
bool processNumTeams (Fortran::lower::StatementContext &stmtCtx,
79
- mlir::Value &result) const ;
77
+ mlir::omp::NumTeamsClauseOps &result) const ;
80
78
bool processNumThreads (Fortran::lower::StatementContext &stmtCtx,
81
- mlir::Value &result) const ;
82
- bool processOrdered (mlir::IntegerAttr &result) const ;
79
+ mlir::omp::NumThreadsClauseOps &result) const ;
80
+ bool processOrdered (mlir::omp::OrderedClauseOps &result) const ;
83
81
bool processPriority (Fortran::lower::StatementContext &stmtCtx,
84
- mlir::Value &result) const ;
85
- bool processProcBind (mlir::omp::ClauseProcBindKindAttr &result) const ;
86
- bool processSafelen (mlir::IntegerAttr &result) const ;
87
- bool processSchedule (mlir::omp::ClauseScheduleKindAttr &valAttr,
88
- mlir::omp::ScheduleModifierAttr &modifierAttr,
89
- mlir::UnitAttr &simdModifierAttr) const ;
90
- bool processScheduleChunk (Fortran::lower::StatementContext &stmtCtx,
91
- mlir::Value &result) const ;
92
- bool processSimdlen (mlir::IntegerAttr &result) const ;
82
+ mlir::omp::PriorityClauseOps &result) const ;
83
+ bool processProcBind (mlir::omp::ProcBindClauseOps &result) const ;
84
+ bool processSafelen (mlir::omp::SafelenClauseOps &result) const ;
85
+ bool processSchedule (Fortran::lower::StatementContext &stmtCtx,
86
+ mlir::omp::ScheduleClauseOps &result) const ;
87
+ bool processSimdlen (mlir::omp::SimdlenClauseOps &result) const ;
93
88
bool processThreadLimit (Fortran::lower::StatementContext &stmtCtx,
94
- mlir::Value &result) const ;
95
- bool processUntied (mlir::UnitAttr &result) const ;
89
+ mlir::omp::ThreadLimitClauseOps &result) const ;
90
+ bool processUntied (mlir::omp::UntiedClauseOps &result) const ;
96
91
97
92
// 'Repeatable' clauses: They can appear multiple times in the clause list.
98
- bool
99
- processAllocate (llvm::SmallVectorImpl<mlir::Value> &allocatorOperands,
100
- llvm::SmallVectorImpl<mlir::Value> &allocateOperands) const ;
93
+ bool processAllocate (mlir::omp::AllocateClauseOps &result) const ;
101
94
bool processCopyin () const ;
102
- bool processCopyPrivate (
103
- mlir::Location currentLocation,
104
- llvm::SmallVectorImpl<mlir::Value> ©PrivateVars,
105
- llvm::SmallVectorImpl<mlir::Attribute> ©PrivateFuncs) const ;
106
- bool processDepend (llvm::SmallVectorImpl<mlir::Attribute> &dependTypeOperands,
107
- llvm::SmallVectorImpl<mlir::Value> &dependOperands) const ;
95
+ bool processCopyprivate (mlir::Location currentLocation,
96
+ mlir::omp::CopyprivateClauseOps &result) const ;
97
+ bool processDepend (mlir::omp::DependClauseOps &result) const ;
108
98
bool
109
99
processEnter (llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const ;
110
100
bool processIf (omp::clause::If::DirectiveNameModifier directiveName,
111
- mlir::Value &result) const ;
101
+ mlir::omp::IfClauseOps &result) const ;
112
102
bool
113
- processIsDevicePtr (llvm::SmallVectorImpl<mlir::Value> &operands ,
103
+ processIsDevicePtr (mlir::omp::IsDevicePtrClauseOps &result ,
114
104
llvm::SmallVectorImpl<mlir::Type> &isDeviceTypes,
115
105
llvm::SmallVectorImpl<mlir::Location> &isDeviceLocs,
116
106
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
@@ -119,43 +109,42 @@ class ClauseProcessor {
119
109
processLink (llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const ;
120
110
121
111
// This method is used to process a map clause.
122
- // The optional parameters - mapSymTypes, mapSymLocs & mapSymbols are used to
112
+ // The optional parameters - mapSymTypes, mapSymLocs & mapSyms are used to
123
113
// store the original type, location and Fortran symbol for the map operands.
124
114
// They may be used later on to create the block_arguments for some of the
125
115
// target directives that require it.
126
- bool processMap (mlir::Location currentLocation,
127
- const llvm::omp::Directive &directive,
128
- Fortran::lower::StatementContext &stmtCtx,
129
- llvm::SmallVectorImpl<mlir::Value> &mapOperands,
130
- llvm::SmallVectorImpl<mlir::Type> *mapSymTypes = nullptr ,
131
- llvm::SmallVectorImpl<mlir::Location> *mapSymLocs = nullptr ,
132
- llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
133
- *mapSymbols = nullptr ) const ;
134
- bool
135
- processReduction (mlir::Location currentLocation,
136
- llvm::SmallVectorImpl<mlir::Value> &reductionVars,
137
- llvm::SmallVectorImpl<mlir::Type> &reductionTypes,
138
- llvm::SmallVectorImpl<mlir::Attribute> &reductionDeclSymbols,
139
- llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
140
- *reductionSymbols = nullptr ) const ;
141
- bool processSectionsReduction (mlir::Location currentLocation) const ;
116
+ bool processMap (
117
+ mlir::Location currentLocation, const llvm::omp::Directive &directive,
118
+ Fortran::lower::StatementContext &stmtCtx,
119
+ mlir::omp::MapClauseOps &result,
120
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> *mapSyms =
121
+ nullptr ,
122
+ llvm::SmallVectorImpl<mlir::Location> *mapSymLocs = nullptr ,
123
+ llvm::SmallVectorImpl<mlir::Type> *mapSymTypes = nullptr ) const ;
124
+ bool processReduction (
125
+ mlir::Location currentLocation, mlir::omp::ReductionClauseOps &result,
126
+ llvm::SmallVectorImpl<mlir::Type> *reductionTypes = nullptr ,
127
+ llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> *reductionSyms =
128
+ nullptr ) const ;
129
+ bool processSectionsReduction (mlir::Location currentLocation,
130
+ mlir::omp::ReductionClauseOps &result) const ;
142
131
bool processTo (llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const ;
143
132
bool
144
- processUseDeviceAddr (llvm::SmallVectorImpl<mlir::Value> &operands ,
133
+ processUseDeviceAddr (mlir::omp::UseDeviceClauseOps &result ,
145
134
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
146
135
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
147
136
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
148
- &useDeviceSymbols ) const ;
137
+ &useDeviceSyms ) const ;
149
138
bool
150
- processUseDevicePtr (llvm::SmallVectorImpl<mlir::Value> &operands ,
139
+ processUseDevicePtr (mlir::omp::UseDeviceClauseOps &result ,
151
140
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
152
141
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
153
142
llvm::SmallVectorImpl<const Fortran::semantics::Symbol *>
154
- &useDeviceSymbols ) const ;
143
+ &useDeviceSyms ) const ;
155
144
156
145
template <typename T>
157
146
bool processMotionClauses (Fortran::lower::StatementContext &stmtCtx,
158
- llvm::SmallVectorImpl<mlir::Value> &mapOperands );
147
+ mlir::omp::MapClauseOps &result );
159
148
160
149
// Call this method for these clauses that should be supported but are not
161
150
// implemented yet. It triggers a compilation error if any of the given
@@ -197,7 +186,7 @@ class ClauseProcessor {
197
186
template <typename T>
198
187
bool ClauseProcessor::processMotionClauses (
199
188
Fortran::lower::StatementContext &stmtCtx,
200
- llvm::SmallVectorImpl<mlir::Value> &mapOperands ) {
189
+ mlir::omp::MapClauseOps &result ) {
201
190
return findRepeatableClause<T>(
202
191
[&](const T &clause, const Fortran::parser::CharBlock &source) {
203
192
mlir::Location clauseLocation = converter.genLocation (source);
@@ -239,7 +228,7 @@ bool ClauseProcessor::processMotionClauses(
239
228
mapTypeBits),
240
229
mlir::omp::VariableCaptureKind::ByRef, symAddr.getType ());
241
230
242
- mapOperands .push_back (mapOp);
231
+ result. mapVars .push_back (mapOp);
243
232
}
244
233
});
245
234
}
0 commit comments