diff --git a/flang/lib/Lower/OpenMP/ClauseProcessor.h b/flang/lib/Lower/OpenMP/ClauseProcessor.h index db7a1b8335f818..f4d659b70cfee7 100644 --- a/flang/lib/Lower/OpenMP/ClauseProcessor.h +++ b/flang/lib/Lower/OpenMP/ClauseProcessor.h @@ -49,9 +49,8 @@ class ClauseProcessor { public: ClauseProcessor(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &clauses) - : converter(converter), semaCtx(semaCtx), - clauses(makeClauses(clauses, semaCtx)) {} + const List &clauses) + : converter(converter), semaCtx(semaCtx), clauses(clauses) {} // 'Unique' clauses: They can appear at most once in the clause list. bool processCollapse( diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.h b/flang/lib/Lower/OpenMP/DataSharingProcessor.h index c11ee299c5d085..ef7b14327278e3 100644 --- a/flang/lib/Lower/OpenMP/DataSharingProcessor.h +++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.h @@ -78,13 +78,12 @@ class DataSharingProcessor { public: DataSharingProcessor(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &opClauseList, + const List &clauses, Fortran::lower::pft::Evaluation &eval, bool useDelayedPrivatization = false, Fortran::lower::SymMap *symTable = nullptr) : hasLastPrivateOp(false), converter(converter), - firOpBuilder(converter.getFirOpBuilder()), - clauses(omp::makeClauses(opClauseList, semaCtx)), eval(eval), + firOpBuilder(converter.getFirOpBuilder()), clauses(clauses), eval(eval), useDelayedPrivatization(useDelayedPrivatization), symTable(symTable) {} // Privatisation is split into two steps. diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp index 692d81f9188be3..77d6c8503f0c34 100644 --- a/flang/lib/Lower/OpenMP/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP/OpenMP.cpp @@ -17,6 +17,7 @@ #include "DataSharingProcessor.h" #include "DirectivesCommon.h" #include "ReductionProcessor.h" +#include "Utils.h" #include "flang/Common/idioms.h" #include "flang/Lower/Bridge.h" #include "flang/Lower/ConvertExpr.h" @@ -310,14 +311,15 @@ static void getDeclareTargetInfo( } else if (const auto *clauseList{ Fortran::parser::Unwrap( spec.u)}) { - if (clauseList->v.empty()) { + List clauses = makeClauses(*clauseList, semaCtx); + if (clauses.empty()) { // Case: declare target, implicit capture of function symbolAndClause.emplace_back( mlir::omp::DeclareTargetCaptureClause::to, eval.getOwningProcedure()->getSubprogramSymbol()); } - ClauseProcessor cp(converter, semaCtx, *clauseList); + ClauseProcessor cp(converter, semaCtx, clauses); cp.processDeviceType(clauseOps); cp.processEnter(symbolAndClause); cp.processLink(symbolAndClause); @@ -597,14 +599,11 @@ static void removeStoreOp(mlir::Operation *reductionOp, mlir::Value symVal) { // TODO: Generate the reduction operation during lowering instead of creating // and removing operations since this is not a robust approach. Also, removing // ops in the builder (instead of a rewriter) is probably not the best approach. -static void -genOpenMPReduction(Fortran::lower::AbstractConverter &converter, - Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &clauseList) { +static void genOpenMPReduction(Fortran::lower::AbstractConverter &converter, + Fortran::semantics::SemanticsContext &semaCtx, + const List &clauses) { fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); - List clauses{makeClauses(clauseList, semaCtx)}; - for (const Clause &clause : clauses) { if (const auto &reductionClause = std::get_if(&clause.u)) { @@ -737,7 +736,7 @@ struct OpWithBodyGenInfo { return *this; } - OpWithBodyGenInfo &setClauses(const Fortran::parser::OmpClauseList *value) { + OpWithBodyGenInfo &setClauses(const List *value) { clauses = value; return *this; } @@ -773,7 +772,7 @@ struct OpWithBodyGenInfo { /// [in] is this an outer operation - prevents privatization. bool outerCombined = false; /// [in] list of clauses to process. - const Fortran::parser::OmpClauseList *clauses = nullptr; + const List *clauses = nullptr; /// [in] if provided, processes the construct's data-sharing attributes. DataSharingProcessor *dsp = nullptr; /// [in] if provided, list of reduction symbols @@ -1151,36 +1150,33 @@ static OpTy genOpWithBody(OpWithBodyGenInfo &info, Args &&...args) { // Code generation functions for clauses //===----------------------------------------------------------------------===// -static void genCriticalDeclareClauses( - Fortran::lower::AbstractConverter &converter, - Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &clauses, mlir::Location loc, - mlir::omp::CriticalClauseOps &clauseOps, llvm::StringRef name) { +static void +genCriticalDeclareClauses(Fortran::lower::AbstractConverter &converter, + Fortran::semantics::SemanticsContext &semaCtx, + const List &clauses, mlir::Location loc, + mlir::omp::CriticalClauseOps &clauseOps, + llvm::StringRef name) { ClauseProcessor cp(converter, semaCtx, clauses); cp.processHint(clauseOps); clauseOps.nameAttr = mlir::StringAttr::get(converter.getFirOpBuilder().getContext(), name); } -static void genFlushClauses( - Fortran::lower::AbstractConverter &converter, - Fortran::semantics::SemanticsContext &semaCtx, - const std::optional &objects, - const std::optional> - &clauses, - mlir::Location loc, llvm::SmallVectorImpl &operandRange) { - if (objects) - genObjectList2(*objects, converter, operandRange); - - if (clauses && clauses->size() > 0) +static void genFlushClauses(Fortran::lower::AbstractConverter &converter, + Fortran::semantics::SemanticsContext &semaCtx, + const ObjectList &objects, + const List &clauses, mlir::Location loc, + llvm::SmallVectorImpl &operandRange) { + genObjectList(objects, converter, operandRange); + + if (clauses.size() > 0) TODO(converter.getCurrentLocation(), "Handle OmpMemoryOrderClause"); } static void genOrderedRegionClauses(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &clauses, - mlir::Location loc, + const List &clauses, mlir::Location loc, mlir::omp::OrderedRegionClauseOps &clauseOps) { ClauseProcessor cp(converter, semaCtx, clauses); cp.processTODO(loc, llvm::omp::Directive::OMPD_ordered); @@ -1189,9 +1185,9 @@ genOrderedRegionClauses(Fortran::lower::AbstractConverter &converter, static void genParallelClauses( Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - Fortran::lower::StatementContext &stmtCtx, - const Fortran::parser::OmpClauseList &clauses, mlir::Location loc, - bool processReduction, mlir::omp::ParallelClauseOps &clauseOps, + Fortran::lower::StatementContext &stmtCtx, const List &clauses, + mlir::Location loc, bool processReduction, + mlir::omp::ParallelClauseOps &clauseOps, llvm::SmallVectorImpl &reductionTypes, llvm::SmallVectorImpl &reductionSyms) { ClauseProcessor cp(converter, semaCtx, clauses); @@ -1211,8 +1207,7 @@ static void genParallelClauses( static void genSectionsClauses(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &clauses, - mlir::Location loc, + const List &clauses, mlir::Location loc, bool clausesFromBeginSections, mlir::omp::SectionsClauseOps &clauseOps) { ClauseProcessor cp(converter, semaCtx, clauses); @@ -1229,9 +1224,8 @@ static void genSimdLoopClauses( Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::StatementContext &stmtCtx, - Fortran::lower::pft::Evaluation &eval, - const Fortran::parser::OmpClauseList &clauses, mlir::Location loc, - mlir::omp::SimdLoopClauseOps &clauseOps, + Fortran::lower::pft::Evaluation &eval, const List &clauses, + mlir::Location loc, mlir::omp::SimdLoopClauseOps &clauseOps, llvm::SmallVectorImpl &iv) { ClauseProcessor cp(converter, semaCtx, clauses); cp.processCollapse(loc, eval, clauseOps, iv); @@ -1249,9 +1243,8 @@ static void genSimdLoopClauses( static void genSingleClauses(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &beginClauses, - const Fortran::parser::OmpClauseList &endClauses, - mlir::Location loc, + const List &beginClauses, + const List &endClauses, mlir::Location loc, mlir::omp::SingleClauseOps &clauseOps) { ClauseProcessor bcp(converter, semaCtx, beginClauses); bcp.processAllocate(clauseOps); @@ -1265,9 +1258,8 @@ static void genSingleClauses(Fortran::lower::AbstractConverter &converter, static void genTargetClauses( Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - Fortran::lower::StatementContext &stmtCtx, - const Fortran::parser::OmpClauseList &clauses, mlir::Location loc, - bool processHostOnlyClauses, bool processReduction, + Fortran::lower::StatementContext &stmtCtx, const List &clauses, + mlir::Location loc, bool processHostOnlyClauses, bool processReduction, mlir::omp::TargetClauseOps &clauseOps, llvm::SmallVectorImpl &mapSyms, llvm::SmallVectorImpl &mapSymLocs, @@ -1293,9 +1285,8 @@ static void genTargetClauses( static void genTargetDataClauses( Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - Fortran::lower::StatementContext &stmtCtx, - const Fortran::parser::OmpClauseList &clauses, mlir::Location loc, - mlir::omp::TargetDataClauseOps &clauseOps, + Fortran::lower::StatementContext &stmtCtx, const List &clauses, + mlir::Location loc, mlir::omp::TargetDataClauseOps &clauseOps, llvm::SmallVectorImpl &useDeviceTypes, llvm::SmallVectorImpl &useDeviceLocs, llvm::SmallVectorImpl &useDeviceSyms) { @@ -1326,9 +1317,8 @@ static void genTargetDataClauses( static void genTargetEnterExitUpdateDataClauses( Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - Fortran::lower::StatementContext &stmtCtx, - const Fortran::parser::OmpClauseList &clauses, mlir::Location loc, - llvm::omp::Directive directive, + Fortran::lower::StatementContext &stmtCtx, const List &clauses, + mlir::Location loc, llvm::omp::Directive directive, mlir::omp::TargetEnterExitUpdateDataClauseOps &clauseOps) { ClauseProcessor cp(converter, semaCtx, clauses); cp.processDepend(clauseOps); @@ -1347,8 +1337,7 @@ static void genTargetEnterExitUpdateDataClauses( static void genTaskClauses(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::StatementContext &stmtCtx, - const Fortran::parser::OmpClauseList &clauses, - mlir::Location loc, + const List &clauses, mlir::Location loc, mlir::omp::TaskClauseOps &clauseOps) { ClauseProcessor cp(converter, semaCtx, clauses); cp.processAllocate(clauseOps); @@ -1367,8 +1356,7 @@ static void genTaskClauses(Fortran::lower::AbstractConverter &converter, static void genTaskgroupClauses(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &clauses, - mlir::Location loc, + const List &clauses, mlir::Location loc, mlir::omp::TaskgroupClauseOps &clauseOps) { ClauseProcessor cp(converter, semaCtx, clauses); cp.processAllocate(clauseOps); @@ -1378,8 +1366,7 @@ static void genTaskgroupClauses(Fortran::lower::AbstractConverter &converter, static void genTaskwaitClauses(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, - const Fortran::parser::OmpClauseList &clauses, - mlir::Location loc, + const List &clauses, mlir::Location loc, mlir::omp::TaskwaitClauseOps &clauseOps) { ClauseProcessor cp(converter, semaCtx, clauses); cp.processTODO( @@ -1389,8 +1376,7 @@ static void genTaskwaitClauses(Fortran::lower::AbstractConverter &converter, static void genTeamsClauses(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::StatementContext &stmtCtx, - const Fortran::parser::OmpClauseList &clauses, - mlir::Location loc, + const List &clauses, mlir::Location loc, mlir::omp::TeamsClauseOps &clauseOps) { ClauseProcessor cp(converter, semaCtx, clauses); cp.processAllocate(clauseOps); @@ -1407,9 +1393,8 @@ static void genWsloopClauses( Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::StatementContext &stmtCtx, - Fortran::lower::pft::Evaluation &eval, - const Fortran::parser::OmpClauseList &beginClauses, - const Fortran::parser::OmpClauseList *endClauses, mlir::Location loc, + Fortran::lower::pft::Evaluation &eval, const List &beginClauses, + const List *endClauses, mlir::Location loc, mlir::omp::WsloopClauseOps &clauseOps, llvm::SmallVectorImpl &iv, llvm::SmallVectorImpl &reductionTypes, @@ -1450,8 +1435,7 @@ static mlir::omp::CriticalOp genCriticalOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList, + mlir::Location loc, const List &clauses, const std::optional &name) { fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); mlir::FlatSymbolRefAttr nameAttr; @@ -1462,7 +1446,7 @@ genCriticalOp(Fortran::lower::AbstractConverter &converter, auto global = mod.lookupSymbol(nameStr); if (!global) { mlir::omp::CriticalClauseOps clauseOps; - genCriticalDeclareClauses(converter, semaCtx, clauseList, loc, clauseOps, + genCriticalDeclareClauses(converter, semaCtx, clauses, loc, clauseOps, nameStr); mlir::OpBuilder modBuilder(mod.getBodyRegion()); @@ -1481,8 +1465,7 @@ static mlir::omp::DistributeOp genDistributeOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + mlir::Location loc, const List &clauses) { TODO(loc, "Distribute construct"); return nullptr; } @@ -1491,12 +1474,9 @@ static mlir::omp::FlushOp genFlushOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, - const std::optional &objectList, - const std::optional> - &clauseList) { + const ObjectList &objects, const List &clauses) { llvm::SmallVector operandRange; - genFlushClauses(converter, semaCtx, objectList, clauseList, loc, - operandRange); + genFlushClauses(converter, semaCtx, objects, clauses, loc, operandRange); return converter.getFirOpBuilder().create( converter.getCurrentLocation(), operandRange); @@ -1516,7 +1496,7 @@ static mlir::omp::OrderedOp genOrderedOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + const List &clauses) { TODO(loc, "OMPD_ordered"); return nullptr; } @@ -1525,10 +1505,9 @@ static mlir::omp::OrderedRegionOp genOrderedRegionOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + mlir::Location loc, const List &clauses) { mlir::omp::OrderedRegionClauseOps clauseOps; - genOrderedRegionClauses(converter, semaCtx, clauseList, loc, clauseOps); + genOrderedRegionClauses(converter, semaCtx, clauses, loc, clauseOps); return genOpWithBody( OpWithBodyGenInfo(converter, semaCtx, loc, eval).setGenNested(genNested), @@ -1540,8 +1519,7 @@ genParallelOp(Fortran::lower::AbstractConverter &converter, Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList, + mlir::Location loc, const List &clauses, bool outerCombined = false) { fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); Fortran::lower::StatementContext stmtCtx; @@ -1549,7 +1527,7 @@ genParallelOp(Fortran::lower::AbstractConverter &converter, llvm::SmallVector privateSyms; llvm::SmallVector reductionTypes; llvm::SmallVector reductionSyms; - genParallelClauses(converter, semaCtx, stmtCtx, clauseList, loc, + genParallelClauses(converter, semaCtx, stmtCtx, clauses, loc, /*processReduction=*/!outerCombined, clauseOps, reductionTypes, reductionSyms); @@ -1562,7 +1540,7 @@ genParallelOp(Fortran::lower::AbstractConverter &converter, OpWithBodyGenInfo(converter, semaCtx, loc, eval) .setGenNested(genNested) .setOuterCombined(outerCombined) - .setClauses(&clauseList) + .setClauses(&clauses) .setReductions(&reductionSyms, &reductionTypes) .setGenRegionEntryCb(reductionCallback); @@ -1570,7 +1548,7 @@ genParallelOp(Fortran::lower::AbstractConverter &converter, return genOpWithBody(genInfo, clauseOps); bool privatize = !outerCombined; - DataSharingProcessor dsp(converter, semaCtx, clauseList, eval, + DataSharingProcessor dsp(converter, semaCtx, clauses, eval, /*useDelayedPrivatization=*/true, &symTable); if (privatize) @@ -1617,14 +1595,13 @@ static mlir::omp::SectionOp genSectionOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + mlir::Location loc, const List &clauses) { // Currently only private/firstprivate clause is handled, and // all privatization is done within `omp.section` operations. return genOpWithBody( OpWithBodyGenInfo(converter, semaCtx, loc, eval) .setGenNested(genNested) - .setClauses(&clauseList)); + .setClauses(&clauses)); } static mlir::omp::SectionsOp @@ -1641,18 +1618,17 @@ static mlir::omp::SimdLoopOp genSimdLoopOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { - DataSharingProcessor dsp(converter, semaCtx, clauseList, eval); + const List &clauses) { + DataSharingProcessor dsp(converter, semaCtx, clauses, eval); dsp.processStep1(); Fortran::lower::StatementContext stmtCtx; mlir::omp::SimdLoopClauseOps clauseOps; llvm::SmallVector iv; - genSimdLoopClauses(converter, semaCtx, stmtCtx, eval, clauseList, loc, - clauseOps, iv); + genSimdLoopClauses(converter, semaCtx, stmtCtx, eval, clauses, loc, clauseOps, + iv); - auto *nestedEval = - getCollapsedLoopEval(eval, Fortran::lower::getCollapseValue(clauseList)); + auto *nestedEval = getCollapsedLoopEval(eval, getCollapseValue(clauses)); auto ivCallback = [&](mlir::Operation *op) { return genLoopVars(op, converter, loc, iv); @@ -1660,7 +1636,7 @@ genSimdLoopOp(Fortran::lower::AbstractConverter &converter, return genOpWithBody( OpWithBodyGenInfo(converter, semaCtx, loc, *nestedEval) - .setClauses(&clauseList) + .setClauses(&clauses) .setDataSharingProcessor(&dsp) .setGenRegionEntryCb(ivCallback), clauseOps); @@ -1670,17 +1646,16 @@ static mlir::omp::SingleOp genSingleOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &beginClauseList, - const Fortran::parser::OmpClauseList &endClauseList) { + mlir::Location loc, const List &beginClauses, + const List &endClauses) { mlir::omp::SingleClauseOps clauseOps; - genSingleClauses(converter, semaCtx, beginClauseList, endClauseList, loc, + genSingleClauses(converter, semaCtx, beginClauses, endClauses, loc, clauseOps); return genOpWithBody( OpWithBodyGenInfo(converter, semaCtx, loc, eval) .setGenNested(genNested) - .setClauses(&beginClauseList), + .setClauses(&beginClauses), clauseOps); } @@ -1688,8 +1663,7 @@ static mlir::omp::TargetOp genTargetOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList, + mlir::Location loc, const List &clauses, bool outerCombined = false) { fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); Fortran::lower::StatementContext stmtCtx; @@ -1702,7 +1676,7 @@ genTargetOp(Fortran::lower::AbstractConverter &converter, llvm::SmallVector mapSyms; llvm::SmallVector mapSymLocs; llvm::SmallVector mapSymTypes; - genTargetClauses(converter, semaCtx, stmtCtx, clauseList, loc, + genTargetClauses(converter, semaCtx, stmtCtx, clauses, loc, processHostOnlyClauses, /*processReduction=*/outerCombined, clauseOps, mapSyms, mapSymLocs, mapSymTypes); @@ -1800,14 +1774,13 @@ static mlir::omp::TargetDataOp genTargetDataOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + mlir::Location loc, const List &clauses) { Fortran::lower::StatementContext stmtCtx; mlir::omp::TargetDataClauseOps clauseOps; llvm::SmallVector useDeviceTypes; llvm::SmallVector useDeviceLocs; llvm::SmallVector useDeviceSyms; - genTargetDataClauses(converter, semaCtx, stmtCtx, clauseList, loc, clauseOps, + genTargetDataClauses(converter, semaCtx, stmtCtx, clauses, loc, clauseOps, useDeviceTypes, useDeviceLocs, useDeviceSyms); auto targetDataOp = @@ -1819,11 +1792,11 @@ genTargetDataOp(Fortran::lower::AbstractConverter &converter, return targetDataOp; } -template -static OpTy genTargetEnterExitUpdateDataOp( - Fortran::lower::AbstractConverter &converter, - Fortran::semantics::SemanticsContext &semaCtx, mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { +template static OpTy +genTargetEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter, + Fortran::semantics::SemanticsContext &semaCtx, + mlir::Location loc, + const List &clauses) { fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder(); Fortran::lower::StatementContext stmtCtx; @@ -1840,8 +1813,8 @@ static OpTy genTargetEnterExitUpdateDataOp( } mlir::omp::TargetEnterExitUpdateDataClauseOps clauseOps; - genTargetEnterExitUpdateDataClauses(converter, semaCtx, stmtCtx, clauseList, - loc, directive, clauseOps); + genTargetEnterExitUpdateDataClauses(converter, semaCtx, stmtCtx, clauses, loc, + directive, clauseOps); return firOpBuilder.create(loc, clauseOps); } @@ -1850,16 +1823,15 @@ static mlir::omp::TaskOp genTaskOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + mlir::Location loc, const List &clauses) { Fortran::lower::StatementContext stmtCtx; mlir::omp::TaskClauseOps clauseOps; - genTaskClauses(converter, semaCtx, stmtCtx, clauseList, loc, clauseOps); + genTaskClauses(converter, semaCtx, stmtCtx, clauses, loc, clauseOps); return genOpWithBody( OpWithBodyGenInfo(converter, semaCtx, loc, eval) .setGenNested(genNested) - .setClauses(&clauseList), + .setClauses(&clauses), clauseOps); } @@ -1867,15 +1839,14 @@ static mlir::omp::TaskgroupOp genTaskgroupOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + mlir::Location loc, const List &clauses) { mlir::omp::TaskgroupClauseOps clauseOps; - genTaskgroupClauses(converter, semaCtx, clauseList, loc, clauseOps); + genTaskgroupClauses(converter, semaCtx, clauses, loc, clauseOps); return genOpWithBody( OpWithBodyGenInfo(converter, semaCtx, loc, eval) .setGenNested(genNested) - .setClauses(&clauseList), + .setClauses(&clauses), clauseOps); } @@ -1883,7 +1854,7 @@ static mlir::omp::TaskloopOp genTaskloopOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + const List &clauses) { TODO(loc, "Taskloop construct"); } @@ -1891,9 +1862,9 @@ static mlir::omp::TaskwaitOp genTaskwaitOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, - const Fortran::parser::OmpClauseList &clauseList) { + const List &clauses) { mlir::omp::TaskwaitClauseOps clauseOps; - genTaskwaitClauses(converter, semaCtx, clauseList, loc, clauseOps); + genTaskwaitClauses(converter, semaCtx, clauses, loc, clauseOps); return converter.getFirOpBuilder().create(loc, clauseOps); } @@ -1909,17 +1880,17 @@ static mlir::omp::TeamsOp genTeamsOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, - mlir::Location loc, const Fortran::parser::OmpClauseList &clauseList, + mlir::Location loc, const List &clauses, bool outerCombined = false) { Fortran::lower::StatementContext stmtCtx; mlir::omp::TeamsClauseOps clauseOps; - genTeamsClauses(converter, semaCtx, stmtCtx, clauseList, loc, clauseOps); + genTeamsClauses(converter, semaCtx, stmtCtx, clauses, loc, clauseOps); return genOpWithBody( OpWithBodyGenInfo(converter, semaCtx, loc, eval) .setGenNested(genNested) .setOuterCombined(outerCombined) - .setClauses(&clauseList), + .setClauses(&clauses), clauseOps); } @@ -1927,9 +1898,8 @@ static mlir::omp::WsloopOp genWsloopOp(Fortran::lower::AbstractConverter &converter, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, - const Fortran::parser::OmpClauseList &beginClauseList, - const Fortran::parser::OmpClauseList *endClauseList) { - DataSharingProcessor dsp(converter, semaCtx, beginClauseList, eval); + const List &beginClauses, const List *endClauses) { + DataSharingProcessor dsp(converter, semaCtx, beginClauses, eval); dsp.processStep1(); Fortran::lower::StatementContext stmtCtx; @@ -1937,12 +1907,10 @@ genWsloopOp(Fortran::lower::AbstractConverter &converter, llvm::SmallVector iv; llvm::SmallVector reductionTypes; llvm::SmallVector reductionSyms; - genWsloopClauses(converter, semaCtx, stmtCtx, eval, beginClauseList, - endClauseList, loc, clauseOps, iv, reductionTypes, - reductionSyms); + genWsloopClauses(converter, semaCtx, stmtCtx, eval, beginClauses, endClauses, + loc, clauseOps, iv, reductionTypes, reductionSyms); - auto *nestedEval = getCollapsedLoopEval( - eval, Fortran::lower::getCollapseValue(beginClauseList)); + auto *nestedEval = getCollapsedLoopEval(eval, getCollapseValue(beginClauses)); auto ivCallback = [&](mlir::Operation *op) { return genLoopAndReductionVars(op, converter, loc, iv, reductionSyms, @@ -1951,7 +1919,7 @@ genWsloopOp(Fortran::lower::AbstractConverter &converter, return genOpWithBody( OpWithBodyGenInfo(converter, semaCtx, loc, *nestedEval) - .setClauses(&beginClauseList) + .setClauses(&beginClauses) .setDataSharingProcessor(&dsp) .setReductions(&reductionSyms, &reductionTypes) .setGenRegionEntryCb(ivCallback), @@ -1962,13 +1930,14 @@ genWsloopOp(Fortran::lower::AbstractConverter &converter, // Code generation functions for composite constructs //===----------------------------------------------------------------------===// -static void genCompositeDoSimd( - Fortran::lower::AbstractConverter &converter, - Fortran::semantics::SemanticsContext &semaCtx, - Fortran::lower::pft::Evaluation &eval, llvm::omp::Directive ompDirective, - const Fortran::parser::OmpClauseList &beginClauseList, - const Fortran::parser::OmpClauseList *endClauseList, mlir::Location loc) { - ClauseProcessor cp(converter, semaCtx, beginClauseList); +static void genCompositeDoSimd(Fortran::lower::AbstractConverter &converter, + Fortran::semantics::SemanticsContext &semaCtx, + Fortran::lower::pft::Evaluation &eval, + llvm::omp::Directive ompDirective, + const List &beginClauses, + const List *endClauses, + mlir::Location loc) { + ClauseProcessor cp(converter, semaCtx, beginClauses); cp.processTODO(loc, ompDirective); @@ -1980,7 +1949,7 @@ static void genCompositeDoSimd( // When support for vectorization is enabled, then we need to add handling of // if clause. Currently if clause can be skipped because we always assume // SIMD length = 1. - genWsloopOp(converter, semaCtx, eval, loc, beginClauseList, endClauseList); + genWsloopOp(converter, semaCtx, eval, loc, beginClauses, endClauses); } //===----------------------------------------------------------------------===// @@ -2088,8 +2057,9 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, const auto &directive = std::get( simpleStandaloneConstruct.t); - const auto &clauseList = - std::get(simpleStandaloneConstruct.t); + List clauses = makeClauses( + std::get(simpleStandaloneConstruct.t), + semaCtx); mlir::Location currentLocation = converter.genLocation(directive.source); switch (directive.v) { @@ -2099,29 +2069,29 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, genBarrierOp(converter, semaCtx, eval, currentLocation); break; case llvm::omp::Directive::OMPD_taskwait: - genTaskwaitOp(converter, semaCtx, eval, currentLocation, clauseList); + genTaskwaitOp(converter, semaCtx, eval, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_taskyield: genTaskyieldOp(converter, semaCtx, eval, currentLocation); break; case llvm::omp::Directive::OMPD_target_data: genTargetDataOp(converter, semaCtx, eval, /*genNested=*/true, - currentLocation, clauseList); + currentLocation, clauses); break; case llvm::omp::Directive::OMPD_target_enter_data: genTargetEnterExitUpdateDataOp( - converter, semaCtx, currentLocation, clauseList); + converter, semaCtx, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_target_exit_data: genTargetEnterExitUpdateDataOp( - converter, semaCtx, currentLocation, clauseList); + converter, semaCtx, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_target_update: genTargetEnterExitUpdateDataOp( - converter, semaCtx, currentLocation, clauseList); + converter, semaCtx, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_ordered: - genOrderedOp(converter, semaCtx, eval, currentLocation, clauseList); + genOrderedOp(converter, semaCtx, eval, currentLocation, clauses); break; } } @@ -2138,8 +2108,14 @@ genOMP(Fortran::lower::AbstractConverter &converter, const auto &clauseList = std::get>>( flushConstruct.t); + ObjectList objects = + objectList ? makeObjects(*objectList, semaCtx) : ObjectList{}; + List clauses = + clauseList ? makeList(*clauseList, + [&](auto &&s) { return makeClause(s.v, semaCtx); }) + : List{}; mlir::Location currentLocation = converter.genLocation(verbatim.source); - genFlushOp(converter, semaCtx, eval, currentLocation, objectList, clauseList); + genFlushOp(converter, semaCtx, eval, currentLocation, objects, clauses); } static void @@ -2242,41 +2218,41 @@ genOMP(Fortran::lower::AbstractConverter &converter, std::get(blockConstruct.t); const auto &directive = std::get(beginBlockDirective.t); - const auto &beginClauseList = - std::get(beginBlockDirective.t); - const auto &endClauseList = - std::get(endBlockDirective.t); + List beginClauses = makeClauses( + std::get(beginBlockDirective.t), semaCtx); + List endClauses = makeClauses( + std::get(endBlockDirective.t), semaCtx); - for (const Fortran::parser::OmpClause &clause : beginClauseList.v) { + for (const Clause &clause : beginClauses) { mlir::Location clauseLocation = converter.genLocation(clause.source); - if (!std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u) && - !std::get_if(&clause.u)) { + if (!std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u) && + !std::get_if(&clause.u)) { TODO(clauseLocation, "OpenMP Block construct clause"); } } - for (const auto &clause : endClauseList.v) { + for (const Clause &clause : endClauses) { mlir::Location clauseLocation = converter.genLocation(clause.source); - if (!std::get_if(&clause.u) && - !std::get_if(&clause.u)) + if (!std::get_if(&clause.u) && + !std::get_if(&clause.u)) TODO(clauseLocation, "OpenMP Block construct clause"); } @@ -2288,42 +2264,42 @@ genOMP(Fortran::lower::AbstractConverter &converter, break; case llvm::omp::Directive::OMPD_ordered: genOrderedRegionOp(converter, semaCtx, eval, /*genNested=*/true, - currentLocation, beginClauseList); + currentLocation, beginClauses); break; case llvm::omp::Directive::OMPD_parallel: genParallelOp(converter, symTable, semaCtx, eval, /*genNested=*/true, - currentLocation, beginClauseList); + currentLocation, beginClauses); break; case llvm::omp::Directive::OMPD_single: genSingleOp(converter, semaCtx, eval, /*genNested=*/true, currentLocation, - beginClauseList, endClauseList); + beginClauses, endClauses); break; case llvm::omp::Directive::OMPD_target: genTargetOp(converter, semaCtx, eval, /*genNested=*/true, currentLocation, - beginClauseList); + beginClauses); break; case llvm::omp::Directive::OMPD_target_data: genTargetDataOp(converter, semaCtx, eval, /*genNested=*/true, - currentLocation, beginClauseList); + currentLocation, beginClauses); break; case llvm::omp::Directive::OMPD_task: genTaskOp(converter, semaCtx, eval, /*genNested=*/true, currentLocation, - beginClauseList); + beginClauses); break; case llvm::omp::Directive::OMPD_taskgroup: genTaskgroupOp(converter, semaCtx, eval, /*genNested=*/true, - currentLocation, beginClauseList); + currentLocation, beginClauses); break; case llvm::omp::Directive::OMPD_teams: genTeamsOp(converter, semaCtx, eval, /*genNested=*/true, currentLocation, - beginClauseList); + beginClauses); break; case llvm::omp::Directive::OMPD_workshare: // FIXME: Workshare is not a commonly used OpenMP construct, an // implementation for this feature will come later. For the codes // that use this construct, add a single construct for now. genSingleOp(converter, semaCtx, eval, /*genNested=*/true, currentLocation, - beginClauseList, endClauseList); + beginClauses, endClauses); break; default: singleDirective = false; @@ -2338,13 +2314,13 @@ genOMP(Fortran::lower::AbstractConverter &converter, if ((llvm::omp::allTargetSet & llvm::omp::blockConstructSet) .test(directive.v)) { genTargetOp(converter, semaCtx, eval, /*genNested=*/false, currentLocation, - beginClauseList, /*outerCombined=*/true); + beginClauses, /*outerCombined=*/true); combinedDirective = true; } if ((llvm::omp::allTeamsSet & llvm::omp::blockConstructSet) .test(directive.v)) { genTeamsOp(converter, semaCtx, eval, /*genNested=*/false, currentLocation, - beginClauseList); + beginClauses); combinedDirective = true; } if ((llvm::omp::allParallelSet & llvm::omp::blockConstructSet) @@ -2352,13 +2328,13 @@ genOMP(Fortran::lower::AbstractConverter &converter, bool outerCombined = directive.v != llvm::omp::Directive::OMPD_target_parallel; genParallelOp(converter, symTable, semaCtx, eval, /*genNested=*/false, - currentLocation, beginClauseList, outerCombined); + currentLocation, beginClauses, outerCombined); combinedDirective = true; } if ((llvm::omp::workShareSet & llvm::omp::blockConstructSet) .test(directive.v)) { genSingleOp(converter, semaCtx, eval, /*genNested=*/false, currentLocation, - beginClauseList, endClauseList); + beginClauses, endClauses); combinedDirective = true; } if (!combinedDirective) @@ -2377,11 +2353,12 @@ genOMP(Fortran::lower::AbstractConverter &converter, const Fortran::parser::OpenMPCriticalConstruct &criticalConstruct) { const auto &cd = std::get(criticalConstruct.t); - const auto &clauseList = std::get(cd.t); + List clauses = + makeClauses(std::get(cd.t), semaCtx); const auto &name = std::get>(cd.t); mlir::Location currentLocation = converter.getCurrentLocation(); genCriticalOp(converter, semaCtx, eval, /*genNested=*/true, currentLocation, - clauseList, name); + clauses, name); } static void @@ -2400,52 +2377,52 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, const Fortran::parser::OpenMPLoopConstruct &loopConstruct) { const auto &beginLoopDirective = std::get(loopConstruct.t); - const auto &beginClauseList = - std::get(beginLoopDirective.t); + List beginClauses = makeClauses( + std::get(beginLoopDirective.t), semaCtx); mlir::Location currentLocation = converter.genLocation(beginLoopDirective.source); const auto ompDirective = std::get(beginLoopDirective.t).v; - const auto *endClauseList = [&]() { - using RetTy = const Fortran::parser::OmpClauseList *; + List endClauses = [&]() { if (auto &endLoopDirective = std::get>( loopConstruct.t)) { - return RetTy( - &std::get((*endLoopDirective).t)); + return makeClauses( + std::get(endLoopDirective->t), + semaCtx); } - return RetTy(); + return List{}; }(); bool validDirective = false; if (llvm::omp::topTaskloopSet.test(ompDirective)) { validDirective = true; - genTaskloopOp(converter, semaCtx, eval, currentLocation, beginClauseList); + genTaskloopOp(converter, semaCtx, eval, currentLocation, beginClauses); } else { // Create omp.{target, teams, distribute, parallel} nested operations if ((llvm::omp::allTargetSet & llvm::omp::loopConstructSet) .test(ompDirective)) { validDirective = true; genTargetOp(converter, semaCtx, eval, /*genNested=*/false, - currentLocation, beginClauseList, /*outerCombined=*/true); + currentLocation, beginClauses, /*outerCombined=*/true); } if ((llvm::omp::allTeamsSet & llvm::omp::loopConstructSet) .test(ompDirective)) { validDirective = true; genTeamsOp(converter, semaCtx, eval, /*genNested=*/false, currentLocation, - beginClauseList, /*outerCombined=*/true); + beginClauses, /*outerCombined=*/true); } if (llvm::omp::allDistributeSet.test(ompDirective)) { validDirective = true; genDistributeOp(converter, semaCtx, eval, /*genNested=*/false, - currentLocation, beginClauseList); + currentLocation, beginClauses); } if ((llvm::omp::allParallelSet & llvm::omp::loopConstructSet) .test(ompDirective)) { validDirective = true; genParallelOp(converter, symTable, semaCtx, eval, /*genNested=*/false, - currentLocation, beginClauseList, /*outerCombined=*/true); + currentLocation, beginClauses, /*outerCombined=*/true); } } if ((llvm::omp::allDoSet | llvm::omp::allSimdSet).test(ompDirective)) @@ -2459,15 +2436,15 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, if (llvm::omp::allDoSimdSet.test(ompDirective)) { // 2.9.3.2 Workshare SIMD construct - genCompositeDoSimd(converter, semaCtx, eval, ompDirective, beginClauseList, - endClauseList, currentLocation); + genCompositeDoSimd(converter, semaCtx, eval, ompDirective, beginClauses, + &endClauses, currentLocation); } else if (llvm::omp::allSimdSet.test(ompDirective)) { // 2.9.3.1 SIMD construct - genSimdLoopOp(converter, semaCtx, eval, currentLocation, beginClauseList); - genOpenMPReduction(converter, semaCtx, beginClauseList); + genSimdLoopOp(converter, semaCtx, eval, currentLocation, beginClauses); + genOpenMPReduction(converter, semaCtx, beginClauses); } else { - genWsloopOp(converter, semaCtx, eval, currentLocation, beginClauseList, - endClauseList); + genWsloopOp(converter, semaCtx, eval, currentLocation, beginClauses, + &endClauses); } } @@ -2489,14 +2466,15 @@ genOMP(Fortran::lower::AbstractConverter &converter, const Fortran::parser::OpenMPSectionsConstruct §ionsConstruct) { const auto &beginSectionsDirective = std::get(sectionsConstruct.t); - const auto &beginClauseList = - std::get(beginSectionsDirective.t); + List beginClauses = makeClauses( + std::get(beginSectionsDirective.t), + semaCtx); // Process clauses before optional omp.parallel, so that new variables are // allocated outside of the parallel region mlir::Location currentLocation = converter.getCurrentLocation(); mlir::omp::SectionsClauseOps clauseOps; - genSectionsClauses(converter, semaCtx, beginClauseList, currentLocation, + genSectionsClauses(converter, semaCtx, beginClauses, currentLocation, /*clausesFromBeginSections=*/true, clauseOps); // Parallel wrapper of PARALLEL SECTIONS construct @@ -2505,14 +2483,15 @@ genOMP(Fortran::lower::AbstractConverter &converter, .v; if (dir == llvm::omp::Directive::OMPD_parallel_sections) { genParallelOp(converter, symTable, semaCtx, eval, - /*genNested=*/false, currentLocation, beginClauseList, + /*genNested=*/false, currentLocation, beginClauses, /*outerCombined=*/true); } else { const auto &endSectionsDirective = std::get(sectionsConstruct.t); - const auto &endClauseList = - std::get(endSectionsDirective.t); - genSectionsClauses(converter, semaCtx, endClauseList, currentLocation, + List endClauses = makeClauses( + std::get(endSectionsDirective.t), + semaCtx); + genSectionsClauses(converter, semaCtx, endClauses, currentLocation, /*clausesFromBeginSections=*/false, clauseOps); } @@ -2528,7 +2507,7 @@ genOMP(Fortran::lower::AbstractConverter &converter, llvm::zip(sectionBlocks.v, eval.getNestedEvaluations())) { symTable.pushScope(); genSectionOp(converter, semaCtx, neval, /*genNested=*/true, currentLocation, - beginClauseList); + beginClauses); symTable.popScope(); firOpBuilder.restoreInsertionPoint(ip); } diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp index b9c0660aa4da8e..da3f2be73e5095 100644 --- a/flang/lib/Lower/OpenMP/Utils.cpp +++ b/flang/lib/Lower/OpenMP/Utils.cpp @@ -36,6 +36,17 @@ namespace Fortran { namespace lower { namespace omp { +int64_t getCollapseValue(const List &clauses) { + auto iter = llvm::find_if(clauses, [](const Clause &clause) { + return clause.id == llvm::omp::Clause::OMPC_collapse; + }); + if (iter != clauses.end()) { + const auto &collapse = std::get(iter->u); + return evaluate::ToInt64(collapse.v).value(); + } + return 1; +} + void genObjectList(const ObjectList &objects, Fortran::lower::AbstractConverter &converter, llvm::SmallVectorImpl &operands) { @@ -52,25 +63,6 @@ void genObjectList(const ObjectList &objects, } } -void genObjectList2(const Fortran::parser::OmpObjectList &objectList, - Fortran::lower::AbstractConverter &converter, - llvm::SmallVectorImpl &operands) { - auto addOperands = [&](Fortran::lower::SymbolRef sym) { - const mlir::Value variable = converter.getSymbolAddress(sym); - if (variable) { - operands.push_back(variable); - } else if (const auto *details = - sym->detailsIf()) { - operands.push_back(converter.getSymbolAddress(details->symbol())); - converter.copySymbolBinding(details->symbol(), sym); - } - }; - for (const Fortran::parser::OmpObject &ompObject : objectList.v) { - Fortran::semantics::Symbol *sym = getOmpObjectSymbol(ompObject); - addOperands(*sym); - } -} - mlir::Type getLoopVarType(Fortran::lower::AbstractConverter &converter, std::size_t loopVarTypeSize) { // OpenMP runtime requires 32-bit or 64-bit loop variables. diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h index 4074bf73987d5b..b3a9f7f30c98bd 100644 --- a/flang/lib/Lower/OpenMP/Utils.h +++ b/flang/lib/Lower/OpenMP/Utils.h @@ -58,6 +58,8 @@ void gatherFuncAndVarSyms( const ObjectList &objects, mlir::omp::DeclareTargetCaptureClause clause, llvm::SmallVectorImpl &symbolAndClause); +int64_t getCollapseValue(const List &clauses); + Fortran::semantics::Symbol * getOmpObjectSymbol(const Fortran::parser::OmpObject &ompObject); @@ -65,10 +67,6 @@ void genObjectList(const ObjectList &objects, Fortran::lower::AbstractConverter &converter, llvm::SmallVectorImpl &operands); -void genObjectList2(const Fortran::parser::OmpObjectList &objectList, - Fortran::lower::AbstractConverter &converter, - llvm::SmallVectorImpl &operands); - } // namespace omp } // namespace lower } // namespace Fortran