@@ -1270,6 +1270,15 @@ static void genTaskwaitClauses(lower::AbstractConverter &converter,
1270
1270
loc, llvm::omp::Directive::OMPD_taskwait);
1271
1271
}
1272
1272
1273
+ static void genWorkshareClauses (lower::AbstractConverter &converter,
1274
+ semantics::SemanticsContext &semaCtx,
1275
+ lower::StatementContext &stmtCtx,
1276
+ const List<Clause> &clauses, mlir::Location loc,
1277
+ mlir::omp::WorkshareOperands &clauseOps) {
1278
+ ClauseProcessor cp (converter, semaCtx, clauses);
1279
+ cp.processNowait (clauseOps);
1280
+ }
1281
+
1273
1282
static void genTeamsClauses (lower::AbstractConverter &converter,
1274
1283
semantics::SemanticsContext &semaCtx,
1275
1284
lower::StatementContext &stmtCtx,
@@ -1890,6 +1899,22 @@ genTaskyieldOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
1890
1899
return converter.getFirOpBuilder ().create <mlir::omp::TaskyieldOp>(loc);
1891
1900
}
1892
1901
1902
+ static mlir::omp::WorkshareOp
1903
+ genWorkshareOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1904
+ semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
1905
+ mlir::Location loc, const ConstructQueue &queue,
1906
+ ConstructQueue::iterator item) {
1907
+ lower::StatementContext stmtCtx;
1908
+ mlir::omp::WorkshareOperands clauseOps;
1909
+ genWorkshareClauses (converter, semaCtx, stmtCtx, item->clauses , loc, clauseOps);
1910
+
1911
+ return genOpWithBody<mlir::omp::WorkshareOp>(
1912
+ OpWithBodyGenInfo (converter, symTable, semaCtx, loc, eval,
1913
+ llvm::omp::Directive::OMPD_workshare)
1914
+ .setClauses (&item->clauses ),
1915
+ queue, item, clauseOps);
1916
+ }
1917
+
1893
1918
static mlir::omp::TeamsOp
1894
1919
genTeamsOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1895
1920
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
@@ -2249,10 +2274,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
2249
2274
llvm::omp::getOpenMPDirectiveName (dir) + " )" );
2250
2275
// case llvm::omp::Directive::OMPD_workdistribute:
2251
2276
case llvm::omp::Directive::OMPD_workshare:
2252
- // FIXME: Workshare is not a commonly used OpenMP construct, an
2253
- // implementation for this feature will come later. For the codes
2254
- // that use this construct, add a single construct for now.
2255
- genSingleOp (converter, symTable, semaCtx, eval, loc, queue, item);
2277
+ genWorkshareOp (converter, symTable, semaCtx, eval, loc, queue, item);
2256
2278
break ;
2257
2279
2258
2280
// Composite constructs
0 commit comments