================
@@ -361,9 +436,35 @@ mlir::LogicalResult 
CIRGenFunction::emitOMPTargetExitDataDirective(
 }
 mlir::LogicalResult CIRGenFunction::emitOMPTargetParallelDirective(
     const OMPTargetParallelDirective &s) {
-  getCIRGenModule().errorNYI(s.getSourceRange(),
-                             "OpenMP OMPTargetParallelDirective");
-  return mlir::failure();
+  mlir::Location begin = getLoc(s.getBeginLoc());
+  mlir::Location end = getLoc(s.getEndLoc());
+
+  // Split the clauses per leaf construct and evaluate them into their operand
+  // structures before creating the nested target/parallel ops.
+  llvm::SmallVector<const OMPClause *> targetClauses =
+      getLeafClauses(*this, s, llvm::omp::OMPD_target);
+  mlir::omp::TargetExtOperands targetOps;
+  llvm::SmallVector<const VarDecl *> mapSyms;
+  if (mlir::failed(emitTargetClauses(*this, getCIRGenModule(), builder, begin,
+                                     targetClauses, targetOps, mapSyms)))
+    return mlir::failure();
+
+  llvm::SmallVector<const OMPClause *> parallelClauses =
+      getLeafClauses(*this, s, llvm::omp::OMPD_parallel);
+  mlir::omp::ParallelOperands parallelOps;
+  if (mlir::failed(emitParallelClauses(*this, getCIRGenModule(), builder, 
begin,
+                                       parallelClauses, parallelOps)))
+    return mlir::failure();
----------------
skatrak wrote:

This should be evaluated inside of the target region, in the `emitTargetOp` 
callback. Otherwise, we could end up passing outside values into the 
IsolatedFromAbove region. In general, I think that's the pattern we should 
follow for combined constructs. We evaluate all leafs in advance only for 
composite ones in Flang.

The set of specific clauses/expressions that must actually be host-evaluated in 
this way is quite restricted.

https://github.com/llvm/llvm-project/pull/207019
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to