@@ -1372,6 +1372,15 @@ static void genTaskwaitClauses(lower::AbstractConverter &converter,
1372
1372
loc, llvm::omp::Directive::OMPD_taskwait);
1373
1373
}
1374
1374
1375
+ static void genWorkshareClauses (lower::AbstractConverter &converter,
1376
+ semantics::SemanticsContext &semaCtx,
1377
+ lower::StatementContext &stmtCtx,
1378
+ const List<Clause> &clauses, mlir::Location loc,
1379
+ mlir::omp::WorkshareOperands &clauseOps) {
1380
+ ClauseProcessor cp (converter, semaCtx, clauses);
1381
+ cp.processNowait (clauseOps);
1382
+ }
1383
+
1375
1384
static void genTeamsClauses (lower::AbstractConverter &converter,
1376
1385
semantics::SemanticsContext &semaCtx,
1377
1386
lower::StatementContext &stmtCtx,
@@ -2033,6 +2042,24 @@ genTaskyieldOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
2033
2042
return converter.getFirOpBuilder ().create <mlir::omp::TaskyieldOp>(loc);
2034
2043
}
2035
2044
2045
+ static mlir::omp::WorkshareOp
2046
+ genWorkshareOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
2047
+ semantics::SemanticsContext &semaCtx,
2048
+ lower::pft::Evaluation &eval, mlir::Location loc,
2049
+ const ConstructQueue &queue,
2050
+ ConstructQueue::const_iterator item) {
2051
+ lower::StatementContext stmtCtx;
2052
+ mlir::omp::WorkshareOperands clauseOps;
2053
+ genWorkshareClauses (converter, semaCtx, stmtCtx, item->clauses , loc,
2054
+ clauseOps);
2055
+
2056
+ return genOpWithBody<mlir::omp::WorkshareOp>(
2057
+ OpWithBodyGenInfo (converter, symTable, semaCtx, loc, eval,
2058
+ llvm::omp::Directive::OMPD_workshare)
2059
+ .setClauses (&item->clauses ),
2060
+ queue, item, clauseOps);
2061
+ }
2062
+
2036
2063
static mlir::omp::TeamsOp
2037
2064
genTeamsOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
2038
2065
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
@@ -2631,10 +2658,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
2631
2658
llvm::omp::getOpenMPDirectiveName (dir) + " )" );
2632
2659
// case llvm::omp::Directive::OMPD_workdistribute:
2633
2660
case llvm::omp::Directive::OMPD_workshare:
2634
- // FIXME: Workshare is not a commonly used OpenMP construct, an
2635
- // implementation for this feature will come later. For the codes
2636
- // that use this construct, add a single construct for now.
2637
- genSingleOp (converter, symTable, semaCtx, eval, loc, queue, item);
2661
+ genWorkshareOp (converter, symTable, semaCtx, eval, loc, queue, item);
2638
2662
break ;
2639
2663
default :
2640
2664
// Combined and composite constructs should have been split into a sequence
0 commit comments