@@ -1584,6 +1584,15 @@ static void genParallelClauses(
15841584 cp.processReduction (loc, clauseOps, reductionSyms);
15851585}
15861586
1587+ static void genScanClauses (lower::AbstractConverter &converter,
1588+ semantics::SemanticsContext &semaCtx,
1589+ const List<Clause> &clauses, mlir::Location loc,
1590+ mlir::omp::ScanOperands &clauseOps) {
1591+ ClauseProcessor cp (converter, semaCtx, clauses);
1592+ cp.processInclusive (loc, clauseOps);
1593+ cp.processExclusive (loc, clauseOps);
1594+ }
1595+
15871596static void genSectionsClauses (
15881597 lower::AbstractConverter &converter, semantics::SemanticsContext &semaCtx,
15891598 const List<Clause> &clauses, mlir::Location loc,
@@ -1981,6 +1990,16 @@ genParallelOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
19811990 return parallelOp;
19821991}
19831992
1993+ static mlir::omp::ScanOp
1994+ genScanOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1995+ semantics::SemanticsContext &semaCtx, mlir::Location loc,
1996+ const ConstructQueue &queue, ConstructQueue::const_iterator item) {
1997+ mlir::omp::ScanOperands clauseOps;
1998+ genScanClauses (converter, semaCtx, item->clauses , loc, clauseOps);
1999+ return converter.getFirOpBuilder ().create <mlir::omp::ScanOp>(
2000+ converter.getCurrentLocation (), clauseOps);
2001+ }
2002+
19842003// / This breaks the normal prototype of the gen*Op functions: adding the
19852004// / sectionBlocks argument so that the enclosed section constructs can be
19862005// / lowered here with correct reduction symbol remapping.
@@ -2990,7 +3009,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
29903009 genStandaloneParallel (converter, symTable, semaCtx, eval, loc, queue, item);
29913010 break ;
29923011 case llvm::omp::Directive::OMPD_scan:
2993- TODO (loc, " Unhandled directive " + llvm::omp::getOpenMPDirectiveName (dir) );
3012+ genScanOp (converter, symTable, semaCtx, loc, queue, item );
29943013 break ;
29953014 case llvm::omp::Directive::OMPD_section:
29963015 llvm_unreachable (" genOMPDispatch: OMPD_section" );
0 commit comments