@@ -1578,6 +1578,15 @@ static void genParallelClauses(
15781578 cp.processReduction (loc, clauseOps, reductionSyms);
15791579}
15801580
1581+ static void genScanClauses (lower::AbstractConverter &converter,
1582+ semantics::SemanticsContext &semaCtx,
1583+ const List<Clause> &clauses, mlir::Location loc,
1584+ mlir::omp::ScanOperands &clauseOps) {
1585+ ClauseProcessor cp (converter, semaCtx, clauses);
1586+ cp.processInclusive (loc, clauseOps);
1587+ cp.processExclusive (loc, clauseOps);
1588+ }
1589+
15811590static void genSectionsClauses (
15821591 lower::AbstractConverter &converter, semantics::SemanticsContext &semaCtx,
15831592 const List<Clause> &clauses, mlir::Location loc,
@@ -1975,6 +1984,17 @@ genParallelOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
19751984 return parallelOp;
19761985}
19771986
1987+ static mlir::omp::ScanOp
1988+ genScanOp (lower::AbstractConverter &converter, lower::SymMap &symTable,
1989+ semantics::SemanticsContext &semaCtx, mlir::Location loc,
1990+ const ConstructQueue &queue, ConstructQueue::const_iterator item) {
1991+
1992+ mlir::omp::ScanOperands clauseOps;
1993+ genScanClauses (converter, semaCtx, item->clauses , loc, clauseOps);
1994+ return converter.getFirOpBuilder ().create <mlir::omp::ScanOp>(
1995+ converter.getCurrentLocation (), clauseOps);
1996+ }
1997+
19781998// / This breaks the normal prototype of the gen*Op functions: adding the
19791999// / sectionBlocks argument so that the enclosed section constructs can be
19802000// / lowered here with correct reduction symbol remapping.
@@ -2978,7 +2998,7 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
29782998 genStandaloneParallel (converter, symTable, semaCtx, eval, loc, queue, item);
29792999 break ;
29803000 case llvm::omp::Directive::OMPD_scan:
2981- TODO (loc, " Unhandled directive " + llvm::omp::getOpenMPDirectiveName (dir) );
3001+ genScanOp (converter, symTable, semaCtx, loc, queue, item );
29823002 break ;
29833003 case llvm::omp::Directive::OMPD_section:
29843004 llvm_unreachable (" genOMPDispatch: OMPD_section" );
0 commit comments