@@ -1330,6 +1330,15 @@ static void genTaskwaitClauses(lower::AbstractConverter &converter,
1330
1330
loc, llvm::omp::Directive::OMPD_taskwait);
1331
1331
}
1332
1332
1333
+ static void genWorkshareClauses (lower::AbstractConverter &converter,
1334
+ semantics::SemanticsContext &semaCtx,
1335
+ lower::StatementContext &stmtCtx,
1336
+ const List<Clause> &clauses, mlir::Location loc,
1337
+ mlir::omp::WorkshareOperands &clauseOps) {
1338
+ ClauseProcessor cp (converter, semaCtx, clauses);
1339
+ cp.processNowait (clauseOps);
1340
+ }
1341
+
1333
1342
static void genTeamsClauses (lower::AbstractConverter &converter,
1334
1343
semantics::SemanticsContext &semaCtx,
1335
1344
lower::StatementContext &stmtCtx,
@@ -1923,6 +1932,22 @@ genTaskyieldOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
1923
1932
return converter.getFirOpBuilder ().create <mlir::omp::TaskyieldOp>(loc);
1924
1933
}
1925
1934
1935
+ static mlir::omp::WorkshareOp
1936
+ genWorkshareOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1937
+ semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
1938
+ mlir::Location loc, const ConstructQueue &queue,
1939
+ ConstructQueue::iterator item) {
1940
+ lower::StatementContext stmtCtx;
1941
+ mlir::omp::WorkshareOperands clauseOps;
1942
+ genWorkshareClauses (converter, semaCtx, stmtCtx, item->clauses , loc, clauseOps);
1943
+
1944
+ return genOpWithBody<mlir::omp::WorkshareOp>(
1945
+ OpWithBodyGenInfo (converter, symTable, semaCtx, loc, eval,
1946
+ llvm::omp::Directive::OMPD_workshare)
1947
+ .setClauses (&item->clauses ),
1948
+ queue, item, clauseOps);
1949
+ }
1950
+
1926
1951
static mlir::omp::TeamsOp
1927
1952
genTeamsOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1928
1953
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
@@ -2515,10 +2540,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
2515
2540
llvm::omp::getOpenMPDirectiveName (dir) + " )" );
2516
2541
// case llvm::omp::Directive::OMPD_workdistribute:
2517
2542
case llvm::omp::Directive::OMPD_workshare:
2518
- // FIXME: Workshare is not a commonly used OpenMP construct, an
2519
- // implementation for this feature will come later. For the codes
2520
- // that use this construct, add a single construct for now.
2521
- genSingleOp (converter, symTable, semaCtx, eval, loc, queue, item);
2543
+ genWorkshareOp (converter, symTable, semaCtx, eval, loc, queue, item);
2522
2544
break ;
2523
2545
default :
2524
2546
// Combined and composite constructs should have been split into a sequence
0 commit comments