[clang] [CIR][OpenMP] Add support for the OpenMP 'for' directive (PR #229256)
Jan Leyonberg via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 15 08:07:09 PDT 2026
================
@@ -496,9 +715,53 @@ mlir::LogicalResult CIRGenFunction::emitOMPTargetParallelDirective(
}
mlir::LogicalResult CIRGenFunction::emitOMPTargetParallelForDirective(
const OMPTargetParallelForDirective &s) {
- getCIRGenModule().errorNYI(s.getSourceRange(),
- "OpenMP OMPTargetParallelForDirective");
- return mlir::failure();
+ mlir::Location begin = getLoc(s.getBeginLoc());
+ mlir::Location end = getLoc(s.getEndLoc());
+
+ omp::ConstructQueue queue =
+ omp::buildConstructQueue(getContext().getLangOpts().OpenMP, s);
+ omp::ConstructQueue::const_iterator targetItem = queue.begin();
+ assert(targetItem->id == llvm::omp::OMPD_target &&
+ "expected 'target' to be the outermost leaf");
+
+ if (mlir::failed(checkSynthesizedClauses(*this, s, targetItem)))
+ return mlir::failure();
+
+ mlir::omp::TargetExtOperands targetOps;
+ llvm::SmallVector<const VarDecl *> mapSyms;
+ if (mlir::failed(emitTargetClauses(*this, getCIRGenModule(), builder, begin,
----------------
jsjodin wrote:
Yes, I didn't spot this in the previous PR but there should be helper functions for this. Thanks for pointing it out.
https://github.com/llvm/llvm-project/pull/229256
More information about the cfe-commits
mailing list