@@ -1272,6 +1272,15 @@ static void genTaskwaitClauses(lower::AbstractConverter &converter,
1272
1272
loc, llvm::omp::Directive::OMPD_taskwait);
1273
1273
}
1274
1274
1275
+ static void genWorkshareClauses (lower::AbstractConverter &converter,
1276
+ semantics::SemanticsContext &semaCtx,
1277
+ lower::StatementContext &stmtCtx,
1278
+ const List<Clause> &clauses, mlir::Location loc,
1279
+ mlir::omp::WorkshareOperands &clauseOps) {
1280
+ ClauseProcessor cp (converter, semaCtx, clauses);
1281
+ cp.processNowait (clauseOps);
1282
+ }
1283
+
1275
1284
static void genTeamsClauses (lower::AbstractConverter &converter,
1276
1285
semantics::SemanticsContext &semaCtx,
1277
1286
lower::StatementContext &stmtCtx,
@@ -1897,6 +1906,22 @@ genTaskyieldOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
1897
1906
return converter.getFirOpBuilder ().create <mlir::omp::TaskyieldOp>(loc);
1898
1907
}
1899
1908
1909
+ static mlir::omp::WorkshareOp
1910
+ genWorkshareOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1911
+ semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
1912
+ mlir::Location loc, const ConstructQueue &queue,
1913
+ ConstructQueue::iterator item) {
1914
+ lower::StatementContext stmtCtx;
1915
+ mlir::omp::WorkshareOperands clauseOps;
1916
+ genWorkshareClauses (converter, semaCtx, stmtCtx, item->clauses , loc, clauseOps);
1917
+
1918
+ return genOpWithBody<mlir::omp::WorkshareOp>(
1919
+ OpWithBodyGenInfo (converter, symTable, semaCtx, loc, eval,
1920
+ llvm::omp::Directive::OMPD_workshare)
1921
+ .setClauses (&item->clauses ),
1922
+ queue, item, clauseOps);
1923
+ }
1924
+
1900
1925
static mlir::omp::TeamsOp
1901
1926
genTeamsOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1902
1927
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
@@ -2309,10 +2334,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
2309
2334
llvm::omp::getOpenMPDirectiveName (dir) + " )" );
2310
2335
// case llvm::omp::Directive::OMPD_workdistribute:
2311
2336
case llvm::omp::Directive::OMPD_workshare:
2312
- // FIXME: Workshare is not a commonly used OpenMP construct, an
2313
- // implementation for this feature will come later. For the codes
2314
- // that use this construct, add a single construct for now.
2315
- genSingleOp (converter, symTable, semaCtx, eval, loc, queue, item);
2337
+ genWorkshareOp (converter, symTable, semaCtx, eval, loc, queue, item);
2316
2338
break ;
2317
2339
default :
2318
2340
// Combined and composite constructs should have been split into a sequence
0 commit comments