@@ -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
// ===----------------------------------------------------------------------===//
@@ -3723,8 +3717,8 @@ genSingleOp(Fortran::lower::AbstractConverter &converter,
3723
3717
3724
3718
ClauseProcessor cp (converter, semaCtx, beginClauseList);
3725
3719
cp.processAllocate (allocatorOperands, allocateOperands);
3726
- cp.processTODO <Fortran::parser::OmpClause:: Copyprivate>(
3727
- currentLocation, llvm::omp::Directive::OMPD_single);
3720
+ cp.processTODO <omp::clause:: Copyprivate>(currentLocation,
3721
+ llvm::omp::Directive::OMPD_single);
3728
3722
3729
3723
ClauseProcessor (converter, semaCtx, endClauseList).processNowait (nowaitAttr);
3730
3724
@@ -3757,10 +3751,9 @@ genTaskOp(Fortran::lower::AbstractConverter &converter,
3757
3751
cp.processMergeable (mergeableAttr);
3758
3752
cp.processPriority (stmtCtx, priorityClauseOperand);
3759
3753
cp.processDepend (dependTypeOperands, dependOperands);
3760
- cp.processTODO <Fortran::parser::OmpClause::InReduction,
3761
- Fortran::parser::OmpClause::Detach,
3762
- Fortran::parser::OmpClause::Affinity>(
3763
- currentLocation, llvm::omp::Directive::OMPD_task);
3754
+ cp.processTODO <omp::clause::InReduction, omp::clause::Detach,
3755
+ omp::clause::Affinity>(currentLocation,
3756
+ llvm::omp::Directive::OMPD_task);
3764
3757
3765
3758
return genOpWithBody<mlir::omp::TaskOp>(
3766
3759
OpWithBodyGenInfo (converter, semaCtx, currentLocation, eval)
@@ -3785,7 +3778,7 @@ genTaskGroupOp(Fortran::lower::AbstractConverter &converter,
3785
3778
llvm::SmallVector<mlir::Value> allocateOperands, allocatorOperands;
3786
3779
ClauseProcessor cp (converter, semaCtx, clauseList);
3787
3780
cp.processAllocate (allocatorOperands, allocateOperands);
3788
- cp.processTODO <Fortran::parser::OmpClause ::TaskReduction>(
3781
+ cp.processTODO <omp::clause ::TaskReduction>(
3789
3782
currentLocation, llvm::omp::Directive::OMPD_taskgroup);
3790
3783
return genOpWithBody<mlir::omp::TaskGroupOp>(
3791
3784
OpWithBodyGenInfo (converter, semaCtx, currentLocation, eval)
@@ -3869,8 +3862,7 @@ genEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter,
3869
3862
cp.processMap (currentLocation, directive, stmtCtx, mapOperands);
3870
3863
}
3871
3864
3872
- cp.processTODO <Fortran::parser::OmpClause::Depend>(currentLocation,
3873
- directive);
3865
+ cp.processTODO <omp::clause::Depend>(currentLocation, directive);
3874
3866
3875
3867
return firOpBuilder.create <OpTy>(currentLocation, ifClauseOperand,
3876
3868
deviceOperand, nullptr , mlir::ValueRange (),
@@ -4053,16 +4045,11 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
4053
4045
cp.processNowait (nowaitAttr);
4054
4046
cp.processMap (currentLocation, directive, stmtCtx, mapOperands, &mapSymTypes,
4055
4047
&mapSymLocs, &mapSymbols);
4056
- cp.processTODO <Fortran::parser::OmpClause::Private,
4057
- Fortran::parser::OmpClause::Depend,
4058
- Fortran::parser::OmpClause::Firstprivate,
4059
- Fortran::parser::OmpClause::IsDevicePtr,
4060
- Fortran::parser::OmpClause::HasDeviceAddr,
4061
- Fortran::parser::OmpClause::Reduction,
4062
- Fortran::parser::OmpClause::InReduction,
4063
- Fortran::parser::OmpClause::Allocate,
4064
- Fortran::parser::OmpClause::UsesAllocators,
4065
- Fortran::parser::OmpClause::Defaultmap>(
4048
+ cp.processTODO <omp::clause::Private, omp::clause::Depend,
4049
+ omp::clause::Firstprivate, omp::clause::IsDevicePtr,
4050
+ omp::clause::HasDeviceAddr, omp::clause::Reduction,
4051
+ omp::clause::InReduction, omp::clause::Allocate,
4052
+ omp::clause::UsesAllocators, omp::clause::Defaultmap>(
4066
4053
currentLocation, llvm::omp::Directive::OMPD_target);
4067
4054
4068
4055
// 5.8.1 Implicit Data-Mapping Attribute Rules
@@ -4165,8 +4152,8 @@ genTeamsOp(Fortran::lower::AbstractConverter &converter,
4165
4152
cp.processDefault ();
4166
4153
cp.processNumTeams (stmtCtx, numTeamsClauseOperand);
4167
4154
cp.processThreadLimit (stmtCtx, threadLimitClauseOperand);
4168
- cp.processTODO <Fortran::parser::OmpClause:: Reduction>(
4169
- currentLocation, llvm::omp::Directive::OMPD_teams);
4155
+ cp.processTODO <omp::clause:: Reduction>(currentLocation,
4156
+ llvm::omp::Directive::OMPD_teams);
4170
4157
4171
4158
return genOpWithBody<mlir::omp::TeamsOp>(
4172
4159
OpWithBodyGenInfo (converter, semaCtx, currentLocation, eval)
@@ -4218,7 +4205,7 @@ static mlir::omp::DeclareTargetDeviceType getDeclareTargetInfo(
4218
4205
cp.processEnter (symbolAndClause);
4219
4206
cp.processLink (symbolAndClause);
4220
4207
cp.processDeviceType (deviceType);
4221
- cp.processTODO <Fortran::parser::OmpClause ::Indirect>(
4208
+ cp.processTODO <omp::clause ::Indirect>(
4222
4209
converter.getCurrentLocation (),
4223
4210
llvm::omp::Directive::OMPD_declare_target);
4224
4211
}
@@ -4277,8 +4264,7 @@ genOmpSimpleStandalone(Fortran::lower::AbstractConverter &converter,
4277
4264
break ;
4278
4265
case llvm::omp::Directive::OMPD_taskwait:
4279
4266
ClauseProcessor (converter, semaCtx, opClauseList)
4280
- .processTODO <Fortran::parser::OmpClause::Depend,
4281
- Fortran::parser::OmpClause::Nowait>(
4267
+ .processTODO <omp::clause::Depend, omp::clause::Nowait>(
4282
4268
currentLocation, llvm::omp::Directive::OMPD_taskwait);
4283
4269
firOpBuilder.create <mlir::omp::TaskwaitOp>(currentLocation);
4284
4270
break ;
@@ -4428,11 +4414,9 @@ createSimdLoop(Fortran::lower::AbstractConverter &converter,
4428
4414
cp.processIf (omp::clause::If::DirectiveNameModifier::Simd, ifClauseOperand);
4429
4415
cp.processSimdlen (simdlenClauseOperand);
4430
4416
cp.processSafelen (safelenClauseOperand);
4431
- cp.processTODO <Fortran::parser::OmpClause::Aligned,
4432
- Fortran::parser::OmpClause::Allocate,
4433
- Fortran::parser::OmpClause::Linear,
4434
- Fortran::parser::OmpClause::Nontemporal,
4435
- Fortran::parser::OmpClause::Order>(loc, ompDirective);
4417
+ cp.processTODO <omp::clause::Aligned, omp::clause::Allocate,
4418
+ omp::clause::Linear, omp::clause::Nontemporal,
4419
+ omp::clause::Order>(loc, ompDirective);
4436
4420
4437
4421
convertLoopBounds (converter, loc, lowerBound, upperBound, step,
4438
4422
loopVarTypeSize);
@@ -4487,8 +4471,7 @@ static void createWsLoop(Fortran::lower::AbstractConverter &converter,
4487
4471
loopVarTypeSize);
4488
4472
cp.processScheduleChunk (stmtCtx, scheduleChunkClauseOperand);
4489
4473
cp.processReduction (loc, reductionVars, reductionDeclSymbols);
4490
- cp.processTODO <Fortran::parser::OmpClause::Linear,
4491
- Fortran::parser::OmpClause::Order>(loc, ompDirective);
4474
+ cp.processTODO <omp::clause::Linear, omp::clause::Order>(loc, ompDirective);
4492
4475
4493
4476
convertLoopBounds (converter, loc, lowerBound, upperBound, step,
4494
4477
loopVarTypeSize);
@@ -4548,11 +4531,9 @@ static void createSimdWsLoop(
4548
4531
const Fortran::parser::OmpClauseList &beginClauseList,
4549
4532
const Fortran::parser::OmpClauseList *endClauseList, mlir::Location loc) {
4550
4533
ClauseProcessor cp (converter, semaCtx, beginClauseList);
4551
- cp.processTODO <
4552
- Fortran::parser::OmpClause::Aligned, Fortran::parser::OmpClause::Allocate,
4553
- Fortran::parser::OmpClause::Linear, Fortran::parser::OmpClause::Safelen,
4554
- Fortran::parser::OmpClause::Simdlen, Fortran::parser::OmpClause::Order>(
4555
- loc, ompDirective);
4534
+ cp.processTODO <omp::clause::Aligned, omp::clause::Allocate,
4535
+ omp::clause::Linear, omp::clause::Safelen,
4536
+ omp::clause::Simdlen, omp::clause::Order>(loc, ompDirective);
4556
4537
// TODO: Add support for vectorization - add vectorization hints inside loop
4557
4538
// body.
4558
4539
// OpenMP standard does not specify the length of vector instructions.
0 commit comments