@@ -1669,13 +1669,11 @@ void DataSharingProcessor::defaultPrivatize() {
1669
1669
// / methods that relate to clauses that can impact the lowering of that
1670
1670
// / construct.
1671
1671
class ClauseProcessor {
1672
- using ClauseTy = Fortran::parser::OmpClause;
1673
-
1674
1672
public:
1675
1673
ClauseProcessor (Fortran::lower::AbstractConverter &converter,
1676
1674
Fortran::semantics::SemanticsContext &semaCtx,
1677
1675
const Fortran::parser::OmpClauseList &clauses)
1678
- : converter(converter), semaCtx(semaCtx), clauses2(clauses),
1676
+ : converter(converter), semaCtx(semaCtx),
1679
1677
clauses (omp::makeList(clauses, semaCtx)) {}
1680
1678
1681
1679
// 'Unique' clauses: They can appear at most once in the clause list.
@@ -1776,7 +1774,6 @@ class ClauseProcessor {
1776
1774
1777
1775
private:
1778
1776
using ClauseIterator = omp::List<omp::Clause>::const_iterator;
1779
- using ClauseIterator2 = std::list<ClauseTy>::const_iterator;
1780
1777
1781
1778
// / Utility to find a clause within a range in the clause list.
1782
1779
template <typename T>
@@ -1836,7 +1833,6 @@ class ClauseProcessor {
1836
1833
1837
1834
Fortran::lower::AbstractConverter &converter;
1838
1835
Fortran::semantics::SemanticsContext &semaCtx;
1839
- const Fortran::parser::OmpClauseList &clauses2;
1840
1836
omp::List<omp::Clause> clauses;
1841
1837
};
1842
1838
@@ -3132,19 +3128,17 @@ bool ClauseProcessor::processMotionClauses(
3132
3128
template <typename ... Ts>
3133
3129
void ClauseProcessor::processTODO (mlir::Location currentLocation,
3134
3130
llvm::omp::Directive directive) const {
3135
- auto checkUnhandledClause = [&](const auto *x) {
3131
+ auto checkUnhandledClause = [&](llvm::omp::Clause id, const auto *x) {
3136
3132
if (!x)
3137
3133
return ;
3138
3134
TODO (currentLocation,
3139
- " Unhandled clause " +
3140
- llvm::StringRef (Fortran::parser::ParseTreeDumper::GetNodeName (*x))
3141
- .upper () +
3135
+ " Unhandled clause " + llvm::omp::getOpenMPClauseName (id).upper () +
3142
3136
" in " + llvm::omp::getOpenMPDirectiveName (directive).upper () +
3143
3137
" construct" );
3144
3138
};
3145
3139
3146
- for (ClauseIterator2 it = clauses2. v . begin (); it != clauses2. v .end (); ++it)
3147
- (checkUnhandledClause (std::get_if<Ts>(&it->u )), ...);
3140
+ for (ClauseIterator it = clauses. begin (); it != clauses .end (); ++it)
3141
+ (checkUnhandledClause (it-> id , std::get_if<Ts>(&it->u )), ...);
3148
3142
}
3149
3143
3150
3144
// ===----------------------------------------------------------------------===//
@@ -3725,8 +3719,8 @@ genSingleOp(Fortran::lower::AbstractConverter &converter,
3725
3719
3726
3720
ClauseProcessor cp (converter, semaCtx, beginClauseList);
3727
3721
cp.processAllocate (allocatorOperands, allocateOperands);
3728
- cp.processTODO <Fortran::parser::OmpClause:: Copyprivate>(
3729
- currentLocation, llvm::omp::Directive::OMPD_single);
3722
+ cp.processTODO <omp::clause:: Copyprivate>(currentLocation,
3723
+ llvm::omp::Directive::OMPD_single);
3730
3724
3731
3725
ClauseProcessor (converter, semaCtx, endClauseList).processNowait (nowaitAttr);
3732
3726
@@ -3760,10 +3754,9 @@ genTaskOp(Fortran::lower::AbstractConverter &converter,
3760
3754
cp.processMergeable (mergeableAttr);
3761
3755
cp.processPriority (stmtCtx, priorityClauseOperand);
3762
3756
cp.processDepend (dependTypeOperands, dependOperands);
3763
- cp.processTODO <Fortran::parser::OmpClause::InReduction,
3764
- Fortran::parser::OmpClause::Detach,
3765
- Fortran::parser::OmpClause::Affinity>(
3766
- currentLocation, llvm::omp::Directive::OMPD_task);
3757
+ cp.processTODO <omp::clause::InReduction, omp::clause::Detach,
3758
+ omp::clause::Affinity>(currentLocation,
3759
+ llvm::omp::Directive::OMPD_task);
3767
3760
3768
3761
return genOpWithBody<mlir::omp::TaskOp>(
3769
3762
OpWithBodyGenInfo (converter, semaCtx, currentLocation, eval)
@@ -3788,7 +3781,7 @@ genTaskGroupOp(Fortran::lower::AbstractConverter &converter,
3788
3781
llvm::SmallVector<mlir::Value> allocateOperands, allocatorOperands;
3789
3782
ClauseProcessor cp (converter, semaCtx, clauseList);
3790
3783
cp.processAllocate (allocatorOperands, allocateOperands);
3791
- cp.processTODO <Fortran::parser::OmpClause ::TaskReduction>(
3784
+ cp.processTODO <omp::clause ::TaskReduction>(
3792
3785
currentLocation, llvm::omp::Directive::OMPD_taskgroup);
3793
3786
return genOpWithBody<mlir::omp::TaskGroupOp>(
3794
3787
OpWithBodyGenInfo (converter, semaCtx, currentLocation, eval)
@@ -3872,8 +3865,7 @@ genEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter,
3872
3865
cp.processMap (currentLocation, directive, stmtCtx, mapOperands);
3873
3866
}
3874
3867
3875
- cp.processTODO <Fortran::parser::OmpClause::Depend>(currentLocation,
3876
- directive);
3868
+ cp.processTODO <omp::clause::Depend>(currentLocation, directive);
3877
3869
3878
3870
return firOpBuilder.create <OpTy>(currentLocation, ifClauseOperand,
3879
3871
deviceOperand, nullptr , mlir::ValueRange (),
@@ -4056,16 +4048,11 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
4056
4048
cp.processNowait (nowaitAttr);
4057
4049
cp.processMap (currentLocation, directive, stmtCtx, mapOperands, &mapSymTypes,
4058
4050
&mapSymLocs, &mapSymbols);
4059
- cp.processTODO <Fortran::parser::OmpClause::Private,
4060
- Fortran::parser::OmpClause::Depend,
4061
- Fortran::parser::OmpClause::Firstprivate,
4062
- Fortran::parser::OmpClause::IsDevicePtr,
4063
- Fortran::parser::OmpClause::HasDeviceAddr,
4064
- Fortran::parser::OmpClause::Reduction,
4065
- Fortran::parser::OmpClause::InReduction,
4066
- Fortran::parser::OmpClause::Allocate,
4067
- Fortran::parser::OmpClause::UsesAllocators,
4068
- Fortran::parser::OmpClause::Defaultmap>(
4051
+ cp.processTODO <omp::clause::Private, omp::clause::Depend,
4052
+ omp::clause::Firstprivate, omp::clause::IsDevicePtr,
4053
+ omp::clause::HasDeviceAddr, omp::clause::Reduction,
4054
+ omp::clause::InReduction, omp::clause::Allocate,
4055
+ omp::clause::UsesAllocators, omp::clause::Defaultmap>(
4069
4056
currentLocation, llvm::omp::Directive::OMPD_target);
4070
4057
4071
4058
// 5.8.1 Implicit Data-Mapping Attribute Rules
@@ -4168,8 +4155,8 @@ genTeamsOp(Fortran::lower::AbstractConverter &converter,
4168
4155
cp.processDefault ();
4169
4156
cp.processNumTeams (stmtCtx, numTeamsClauseOperand);
4170
4157
cp.processThreadLimit (stmtCtx, threadLimitClauseOperand);
4171
- cp.processTODO <Fortran::parser::OmpClause:: Reduction>(
4172
- currentLocation, llvm::omp::Directive::OMPD_teams);
4158
+ cp.processTODO <omp::clause:: Reduction>(currentLocation,
4159
+ llvm::omp::Directive::OMPD_teams);
4173
4160
4174
4161
return genOpWithBody<mlir::omp::TeamsOp>(
4175
4162
OpWithBodyGenInfo (converter, semaCtx, currentLocation, eval)
@@ -4221,7 +4208,7 @@ static mlir::omp::DeclareTargetDeviceType getDeclareTargetInfo(
4221
4208
cp.processEnter (symbolAndClause);
4222
4209
cp.processLink (symbolAndClause);
4223
4210
cp.processDeviceType (deviceType);
4224
- cp.processTODO <Fortran::parser::OmpClause ::Indirect>(
4211
+ cp.processTODO <omp::clause ::Indirect>(
4225
4212
converter.getCurrentLocation (),
4226
4213
llvm::omp::Directive::OMPD_declare_target);
4227
4214
}
@@ -4280,8 +4267,7 @@ genOmpSimpleStandalone(Fortran::lower::AbstractConverter &converter,
4280
4267
break ;
4281
4268
case llvm::omp::Directive::OMPD_taskwait:
4282
4269
ClauseProcessor (converter, semaCtx, opClauseList)
4283
- .processTODO <Fortran::parser::OmpClause::Depend,
4284
- Fortran::parser::OmpClause::Nowait>(
4270
+ .processTODO <omp::clause::Depend, omp::clause::Nowait>(
4285
4271
currentLocation, llvm::omp::Directive::OMPD_taskwait);
4286
4272
firOpBuilder.create <mlir::omp::TaskwaitOp>(currentLocation);
4287
4273
break ;
@@ -4483,11 +4469,9 @@ createSimdLoop(Fortran::lower::AbstractConverter &converter,
4483
4469
cp.processIf (omp::clause::If::DirectiveNameModifier::Simd, ifClauseOperand);
4484
4470
cp.processSimdlen (simdlenClauseOperand);
4485
4471
cp.processSafelen (safelenClauseOperand);
4486
- cp.processTODO <Fortran::parser::OmpClause::Aligned,
4487
- Fortran::parser::OmpClause::Allocate,
4488
- Fortran::parser::OmpClause::Linear,
4489
- Fortran::parser::OmpClause::Nontemporal,
4490
- Fortran::parser::OmpClause::Order>(loc, ompDirective);
4472
+ cp.processTODO <omp::clause::Aligned, omp::clause::Allocate,
4473
+ omp::clause::Linear, omp::clause::Nontemporal,
4474
+ omp::clause::Order>(loc, ompDirective);
4491
4475
4492
4476
convertLoopBounds (converter, loc, lowerBound, upperBound, step,
4493
4477
loopVarTypeSize);
@@ -4544,8 +4528,7 @@ static void createWsLoop(Fortran::lower::AbstractConverter &converter,
4544
4528
cp.processScheduleChunk (stmtCtx, scheduleChunkClauseOperand);
4545
4529
cp.processReduction (loc, reductionVars, reductionDeclSymbols,
4546
4530
&reductionSymbols);
4547
- cp.processTODO <Fortran::parser::OmpClause::Linear,
4548
- Fortran::parser::OmpClause::Order>(loc, ompDirective);
4531
+ cp.processTODO <omp::clause::Linear, omp::clause::Order>(loc, ompDirective);
4549
4532
4550
4533
convertLoopBounds (converter, loc, lowerBound, upperBound, step,
4551
4534
loopVarTypeSize);
@@ -4612,11 +4595,9 @@ static void createSimdWsLoop(
4612
4595
const Fortran::parser::OmpClauseList &beginClauseList,
4613
4596
const Fortran::parser::OmpClauseList *endClauseList, mlir::Location loc) {
4614
4597
ClauseProcessor cp (converter, semaCtx, beginClauseList);
4615
- cp.processTODO <
4616
- Fortran::parser::OmpClause::Aligned, Fortran::parser::OmpClause::Allocate,
4617
- Fortran::parser::OmpClause::Linear, Fortran::parser::OmpClause::Safelen,
4618
- Fortran::parser::OmpClause::Simdlen, Fortran::parser::OmpClause::Order>(
4619
- loc, ompDirective);
4598
+ cp.processTODO <omp::clause::Aligned, omp::clause::Allocate,
4599
+ omp::clause::Linear, omp::clause::Safelen,
4600
+ omp::clause::Simdlen, omp::clause::Order>(loc, ompDirective);
4620
4601
// TODO: Add support for vectorization - add vectorization hints inside loop
4621
4602
// body.
4622
4603
// OpenMP standard does not specify the length of vector instructions.
0 commit comments