https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/90090
This will unify the interface a bit more. >From 8f1ce585ea3b32551563c2949630ad4118d511e6 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <krzysztof.parzys...@amd.com> Date: Wed, 24 Apr 2024 09:51:49 -0500 Subject: [PATCH] [flang][OpenMP] Pass symTable to all genXYZ functions, NFC This will unify the interface a bit more. --- flang/lib/Lower/OpenMP/OpenMP.cpp | 171 ++++++++++++++++++------------ 1 file changed, 105 insertions(+), 66 deletions(-) diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp index f454f5a45a5150..47935e6cf8efcf 100644 --- a/flang/lib/Lower/OpenMP/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP/OpenMP.cpp @@ -548,11 +548,12 @@ struct OpWithBodyGenInfo { mlir::Operation *)>; OpWithBodyGenInfo(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, mlir::Location loc, Fortran::lower::pft::Evaluation &eval, llvm::omp::Directive dir) - : converter(converter), semaCtx(semaCtx), loc(loc), eval(eval), dir(dir) { - } + : converter(converter), symTable(symTable), semaCtx(semaCtx), loc(loc), + eval(eval), dir(dir) {} OpWithBodyGenInfo &setGenNested(bool value) { genNested = value; @@ -589,6 +590,8 @@ struct OpWithBodyGenInfo { /// [inout] converter to use for the clauses. Fortran::lower::AbstractConverter &converter; + /// [in] Symbol table + Fortran::lower::SymMap &symTable; /// [in] Semantics context Fortran::semantics::SemanticsContext &semaCtx; /// [in] location in source code. @@ -764,6 +767,7 @@ static void createBodyOfOp(mlir::Operation &op, OpWithBodyGenInfo &info) { static void genBodyOfTargetDataOp( Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::omp::TargetDataOp &dataOp, llvm::ArrayRef<mlir::Type> useDeviceTypes, @@ -830,6 +834,7 @@ static void genBodyOfTargetDataOp( // all the symbols present in mapSymbols as block arguments to this block. static void genBodyOfTargetOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::omp::TargetOp &targetOp, @@ -1267,6 +1272,7 @@ static void genWsloopClauses( static mlir::omp::BarrierOp genBarrierOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc) { return converter.getFirOpBuilder().create<mlir::omp::BarrierOp>(loc); @@ -1274,6 +1280,7 @@ genBarrierOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::CriticalOp genCriticalOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses, @@ -1298,7 +1305,7 @@ genCriticalOp(Fortran::lower::AbstractConverter &converter, } return genOpWithBody<mlir::omp::CriticalOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_critical) .setGenNested(genNested), nameAttr); @@ -1306,6 +1313,7 @@ genCriticalOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::DistributeOp genDistributeOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses) { @@ -1315,6 +1323,7 @@ genDistributeOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::FlushOp genFlushOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, const ObjectList &objects, const List<Clause> &clauses) { @@ -1327,17 +1336,19 @@ genFlushOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::MasterOp genMasterOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc) { return genOpWithBody<mlir::omp::MasterOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_master) .setGenNested(genNested)); } static mlir::omp::OrderedOp genOrderedOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, const List<Clause> &clauses) { @@ -1347,6 +1358,7 @@ genOrderedOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::OrderedRegionOp genOrderedRegionOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses) { @@ -1354,7 +1366,7 @@ genOrderedRegionOp(Fortran::lower::AbstractConverter &converter, genOrderedRegionClauses(converter, semaCtx, clauses, loc, clauseOps); return genOpWithBody<mlir::omp::OrderedRegionOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_ordered) .setGenNested(genNested), clauseOps); @@ -1383,7 +1395,7 @@ genParallelOp(Fortran::lower::AbstractConverter &converter, }; OpWithBodyGenInfo genInfo = - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_parallel) .setGenNested(genNested) .setOuterCombined(outerCombined) @@ -1440,13 +1452,14 @@ genParallelOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::SectionOp genSectionOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses) { // Currently only private/firstprivate clause is handled, and // all privatization is done within `omp.section` operations. return genOpWithBody<mlir::omp::SectionOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_section) .setGenNested(genNested) .setClauses(&clauses)); @@ -1454,11 +1467,12 @@ genSectionOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::SectionsOp genSectionsOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, const mlir::omp::SectionsClauseOps &clauseOps) { return genOpWithBody<mlir::omp::SectionsOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_sections) .setGenNested(false), clauseOps); @@ -1466,6 +1480,7 @@ genSectionsOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::SimdOp genSimdOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, const List<Clause> &clauses) { @@ -1499,8 +1514,8 @@ genSimdOp(Fortran::lower::AbstractConverter &converter, }; createBodyOfOp(*loopOp, - OpWithBodyGenInfo(converter, semaCtx, loc, *nestedEval, - llvm::omp::Directive::OMPD_simd) + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, + *nestedEval, llvm::omp::Directive::OMPD_simd) .setClauses(&clauses) .setDataSharingProcessor(&dsp) .setGenRegionEntryCb(ivCallback)); @@ -1510,6 +1525,7 @@ genSimdOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::SingleOp genSingleOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses) { @@ -1517,7 +1533,7 @@ genSingleOp(Fortran::lower::AbstractConverter &converter, genSingleClauses(converter, semaCtx, clauses, loc, clauseOps); return genOpWithBody<mlir::omp::SingleOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_single) .setGenNested(genNested) .setClauses(&clauses), @@ -1526,6 +1542,7 @@ genSingleOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::TargetOp genTargetOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses, @@ -1633,13 +1650,14 @@ genTargetOp(Fortran::lower::AbstractConverter &converter, Fortran::lower::pft::visitAllSymbols(eval, captureImplicitMap); auto targetOp = firOpBuilder.create<mlir::omp::TargetOp>(loc, clauseOps); - genBodyOfTargetOp(converter, semaCtx, eval, genNested, targetOp, mapSyms, - mapLocs, mapTypes, loc); + genBodyOfTargetOp(converter, symTable, semaCtx, eval, genNested, targetOp, + mapSyms, mapLocs, mapTypes, loc); return targetOp; } static mlir::omp::TargetDataOp genTargetDataOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses) { @@ -1654,14 +1672,16 @@ genTargetDataOp(Fortran::lower::AbstractConverter &converter, auto targetDataOp = converter.getFirOpBuilder().create<mlir::omp::TargetDataOp>(loc, clauseOps); - genBodyOfTargetDataOp(converter, semaCtx, eval, genNested, targetDataOp, - useDeviceTypes, useDeviceLocs, useDeviceSyms, loc); + genBodyOfTargetDataOp(converter, symTable, semaCtx, eval, genNested, + targetDataOp, useDeviceTypes, useDeviceLocs, + useDeviceSyms, loc); return targetDataOp; } template <typename OpTy> static OpTy genTargetEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, mlir::Location loc, const List<Clause> &clauses) { @@ -1689,6 +1709,7 @@ genTargetEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::TaskOp genTaskOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses) { @@ -1697,7 +1718,7 @@ genTaskOp(Fortran::lower::AbstractConverter &converter, genTaskClauses(converter, semaCtx, stmtCtx, clauses, loc, clauseOps); return genOpWithBody<mlir::omp::TaskOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_task) .setGenNested(genNested) .setClauses(&clauses), @@ -1706,6 +1727,7 @@ genTaskOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::TaskgroupOp genTaskgroupOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses) { @@ -1713,7 +1735,7 @@ genTaskgroupOp(Fortran::lower::AbstractConverter &converter, genTaskgroupClauses(converter, semaCtx, clauses, loc, clauseOps); return genOpWithBody<mlir::omp::TaskgroupOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_taskgroup) .setGenNested(genNested) .setClauses(&clauses), @@ -1722,6 +1744,7 @@ genTaskgroupOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::TaskloopOp genTaskloopOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, const List<Clause> &clauses) { @@ -1730,6 +1753,7 @@ genTaskloopOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::TaskwaitOp genTaskwaitOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, const List<Clause> &clauses) { @@ -1741,6 +1765,7 @@ genTaskwaitOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::TaskyieldOp genTaskyieldOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc) { return converter.getFirOpBuilder().create<mlir::omp::TaskyieldOp>(loc); @@ -1748,6 +1773,7 @@ genTaskyieldOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::TeamsOp genTeamsOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, bool genNested, mlir::Location loc, const List<Clause> &clauses, @@ -1757,7 +1783,7 @@ genTeamsOp(Fortran::lower::AbstractConverter &converter, genTeamsClauses(converter, semaCtx, stmtCtx, clauses, loc, clauseOps); return genOpWithBody<mlir::omp::TeamsOp>( - OpWithBodyGenInfo(converter, semaCtx, loc, eval, + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, eval, llvm::omp::Directive::OMPD_teams) .setGenNested(genNested) .setOuterCombined(outerCombined) @@ -1767,6 +1793,7 @@ genTeamsOp(Fortran::lower::AbstractConverter &converter, static mlir::omp::WsloopOp genWsloopOp(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, mlir::Location loc, const List<Clause> &clauses) { @@ -1805,8 +1832,8 @@ genWsloopOp(Fortran::lower::AbstractConverter &converter, }; createBodyOfOp(*loopOp, - OpWithBodyGenInfo(converter, semaCtx, loc, *nestedEval, - llvm::omp::Directive::OMPD_do) + OpWithBodyGenInfo(converter, symTable, semaCtx, loc, + *nestedEval, llvm::omp::Directive::OMPD_do) .setClauses(&clauses) .setDataSharingProcessor(&dsp) .setReductions(&reductionSyms, &reductionTypes) @@ -1820,6 +1847,7 @@ genWsloopOp(Fortran::lower::AbstractConverter &converter, static void genCompositeDistributeParallelDo(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, const List<Clause> &clauses, @@ -1829,6 +1857,7 @@ genCompositeDistributeParallelDo(Fortran::lower::AbstractConverter &converter, static void genCompositeDistributeParallelDoSimd( Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, const List<Clause> &clauses, mlir::Location loc) { @@ -1837,6 +1866,7 @@ static void genCompositeDistributeParallelDoSimd( static void genCompositeDistributeSimd(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, const List<Clause> &clauses, mlir::Location loc) { @@ -1844,6 +1874,7 @@ genCompositeDistributeSimd(Fortran::lower::AbstractConverter &converter, } static void genCompositeDoSimd(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, const List<Clause> &clauses, @@ -1860,11 +1891,12 @@ static void genCompositeDoSimd(Fortran::lower::AbstractConverter &converter, // 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, clauses); + genWsloopOp(converter, symTable, semaCtx, eval, loc, clauses); } static void genCompositeTaskloopSimd(Fortran::lower::AbstractConverter &converter, + Fortran::lower::SymMap &symTable, Fortran::semantics::SemanticsContext &semaCtx, Fortran::lower::pft::Evaluation &eval, const List<Clause> &clauses, mlir::Location loc) { @@ -1985,32 +2017,32 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, default: break; case llvm::omp::Directive::OMPD_barrier: - genBarrierOp(converter, semaCtx, eval, currentLocation); + genBarrierOp(converter, symTable, semaCtx, eval, currentLocation); break; case llvm::omp::Directive::OMPD_taskwait: - genTaskwaitOp(converter, semaCtx, eval, currentLocation, clauses); + genTaskwaitOp(converter, symTable, semaCtx, eval, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_taskyield: - genTaskyieldOp(converter, semaCtx, eval, currentLocation); + genTaskyieldOp(converter, symTable, semaCtx, eval, currentLocation); break; case llvm::omp::Directive::OMPD_target_data: - genTargetDataOp(converter, semaCtx, eval, /*genNested=*/true, + genTargetDataOp(converter, symTable, semaCtx, eval, /*genNested=*/true, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_target_enter_data: genTargetEnterExitUpdateDataOp<mlir::omp::TargetEnterDataOp>( - converter, semaCtx, currentLocation, clauses); + converter, symTable, semaCtx, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_target_exit_data: genTargetEnterExitUpdateDataOp<mlir::omp::TargetExitDataOp>( - converter, semaCtx, currentLocation, clauses); + converter, symTable, semaCtx, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_target_update: genTargetEnterExitUpdateDataOp<mlir::omp::TargetUpdateOp>( - converter, semaCtx, currentLocation, clauses); + converter, symTable, semaCtx, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_ordered: - genOrderedOp(converter, semaCtx, eval, currentLocation, clauses); + genOrderedOp(converter, symTable, semaCtx, eval, currentLocation, clauses); break; } } @@ -2034,7 +2066,8 @@ genOMP(Fortran::lower::AbstractConverter &converter, [&](auto &&s) { return makeClause(s.v, semaCtx); }) : List<Clause>{}; mlir::Location currentLocation = converter.genLocation(verbatim.source); - genFlushOp(converter, semaCtx, eval, currentLocation, objects, clauses); + genFlushOp(converter, symTable, semaCtx, eval, currentLocation, objects, + clauses); } static void @@ -2187,12 +2220,13 @@ genOMP(Fortran::lower::AbstractConverter &converter, switch (leafDir) { case llvm::omp::Directive::OMPD_master: // 2.16 MASTER construct. - genMasterOp(converter, semaCtx, eval, genNested, currentLocation); + genMasterOp(converter, symTable, semaCtx, eval, genNested, + currentLocation); break; case llvm::omp::Directive::OMPD_ordered: // 2.17.9 ORDERED construct. - genOrderedRegionOp(converter, semaCtx, eval, genNested, currentLocation, - clauses); + genOrderedRegionOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses); break; case llvm::omp::Directive::OMPD_parallel: // 2.6 PARALLEL construct. @@ -2201,41 +2235,43 @@ genOMP(Fortran::lower::AbstractConverter &converter, break; case llvm::omp::Directive::OMPD_single: // 2.8.2 SINGLE construct. - genSingleOp(converter, semaCtx, eval, genNested, currentLocation, - clauses); + genSingleOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses); break; case llvm::omp::Directive::OMPD_target: // 2.12.5 TARGET construct. - genTargetOp(converter, semaCtx, eval, genNested, currentLocation, clauses, - outerCombined); + genTargetOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses, outerCombined); break; case llvm::omp::Directive::OMPD_target_data: // 2.12.2 TARGET DATA construct. - genTargetDataOp(converter, semaCtx, eval, genNested, currentLocation, - clauses); + genTargetDataOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses); break; case llvm::omp::Directive::OMPD_task: // 2.10.1 TASK construct. - genTaskOp(converter, semaCtx, eval, genNested, currentLocation, clauses); + genTaskOp(converter, symTable, semaCtx, eval, genNested, currentLocation, + clauses); break; case llvm::omp::Directive::OMPD_taskgroup: // 2.17.6 TASKGROUP construct. - genTaskgroupOp(converter, semaCtx, eval, genNested, currentLocation, - clauses); + genTaskgroupOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses); break; case llvm::omp::Directive::OMPD_teams: // 2.7 TEAMS construct. // FIXME Pass the outerCombined argument or rename it to better describe // what it represents if it must always be `false` in this context. - genTeamsOp(converter, semaCtx, eval, genNested, currentLocation, clauses); + genTeamsOp(converter, symTable, semaCtx, eval, genNested, currentLocation, + clauses); break; case llvm::omp::Directive::OMPD_workshare: // 2.8.3 WORKSHARE construct. // 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, currentLocation, - clauses); + genSingleOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses); break; default: llvm_unreachable("Unexpected block construct"); @@ -2257,8 +2293,8 @@ genOMP(Fortran::lower::AbstractConverter &converter, makeClauses(std::get<Fortran::parser::OmpClauseList>(cd.t), semaCtx); const auto &name = std::get<std::optional<Fortran::parser::Name>>(cd.t); mlir::Location currentLocation = converter.getCurrentLocation(); - genCriticalOp(converter, semaCtx, eval, /*genNested=*/true, currentLocation, - clauses, name); + genCriticalOp(converter, symTable, semaCtx, eval, /*genNested=*/true, + currentLocation, clauses, name); } static void @@ -2304,26 +2340,27 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, switch (leafDir) { case llvm::omp::Directive::OMPD_distribute_parallel_do: // 2.9.4.3 DISTRIBUTE PARALLEL Worksharing-Loop construct. - genCompositeDistributeParallelDo(converter, semaCtx, eval, clauses, - currentLocation); + genCompositeDistributeParallelDo(converter, symTable, semaCtx, eval, + clauses, currentLocation); break; case llvm::omp::Directive::OMPD_distribute_parallel_do_simd: // 2.9.4.4 DISTRIBUTE PARALLEL Worksharing-Loop SIMD construct. - genCompositeDistributeParallelDoSimd(converter, semaCtx, eval, clauses, - currentLocation); + genCompositeDistributeParallelDoSimd(converter, symTable, semaCtx, eval, + clauses, currentLocation); break; case llvm::omp::Directive::OMPD_distribute_simd: // 2.9.4.2 DISTRIBUTE SIMD construct. - genCompositeDistributeSimd(converter, semaCtx, eval, clauses, + genCompositeDistributeSimd(converter, symTable, semaCtx, eval, clauses, currentLocation); break; case llvm::omp::Directive::OMPD_do_simd: // 2.9.3.2 Worksharing-Loop SIMD construct. - genCompositeDoSimd(converter, semaCtx, eval, clauses, currentLocation); + genCompositeDoSimd(converter, symTable, semaCtx, eval, clauses, + currentLocation); break; case llvm::omp::Directive::OMPD_taskloop_simd: // 2.10.3 TASKLOOP SIMD construct. - genCompositeTaskloopSimd(converter, semaCtx, eval, clauses, + genCompositeTaskloopSimd(converter, symTable, semaCtx, eval, clauses, currentLocation); break; default: @@ -2334,12 +2371,13 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, switch (leafDir) { case llvm::omp::Directive::OMPD_distribute: // 2.9.4.1 DISTRIBUTE construct. - genDistributeOp(converter, semaCtx, eval, genNested, currentLocation, - clauses); + genDistributeOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses); break; case llvm::omp::Directive::OMPD_do: // 2.9.2 Worksharing-Loop construct. - genWsloopOp(converter, semaCtx, eval, currentLocation, clauses); + genWsloopOp(converter, symTable, semaCtx, eval, currentLocation, + clauses); break; case llvm::omp::Directive::OMPD_parallel: // 2.6 PARALLEL construct. @@ -2353,16 +2391,17 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, break; case llvm::omp::Directive::OMPD_simd: // 2.9.3.1 SIMD construct. - genSimdOp(converter, semaCtx, eval, currentLocation, clauses); + genSimdOp(converter, symTable, semaCtx, eval, currentLocation, clauses); break; case llvm::omp::Directive::OMPD_target: // 2.12.5 TARGET construct. - genTargetOp(converter, semaCtx, eval, genNested, currentLocation, - clauses, /*outerCombined=*/true); + genTargetOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses, /*outerCombined=*/true); break; case llvm::omp::Directive::OMPD_taskloop: // 2.10.2 TASKLOOP construct. - genTaskloopOp(converter, semaCtx, eval, currentLocation, clauses); + genTaskloopOp(converter, symTable, semaCtx, eval, currentLocation, + clauses); break; case llvm::omp::Directive::OMPD_teams: // 2.7 TEAMS construct. @@ -2370,8 +2409,8 @@ static void genOMP(Fortran::lower::AbstractConverter &converter, // combined construct in this constext (e.g. target teams distribute). // Maybe rename the argument if it represents something else or // initialize it properly. - genTeamsOp(converter, semaCtx, eval, genNested, currentLocation, - clauses, /*outerCombined=*/true); + genTeamsOp(converter, symTable, semaCtx, eval, genNested, + currentLocation, clauses, /*outerCombined=*/true); break; case llvm::omp::Directive::OMPD_loop: case llvm::omp::Directive::OMPD_masked: @@ -2433,7 +2472,7 @@ genOMP(Fortran::lower::AbstractConverter &converter, } // SECTIONS construct. - genSectionsOp(converter, semaCtx, eval, currentLocation, clauseOps); + genSectionsOp(converter, symTable, semaCtx, eval, currentLocation, clauseOps); // Generate nested SECTION operations recursively. const auto §ionBlocks = @@ -2443,8 +2482,8 @@ genOMP(Fortran::lower::AbstractConverter &converter, for (const auto &[nblock, neval] : llvm::zip(sectionBlocks.v, eval.getNestedEvaluations())) { symTable.pushScope(); - genSectionOp(converter, semaCtx, neval, /*genNested=*/true, currentLocation, - clauses); + genSectionOp(converter, symTable, semaCtx, neval, /*genNested=*/true, + currentLocation, clauses); symTable.popScope(); firOpBuilder.restoreInsertionPoint(ip); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits