[clang] [OpenACC][CIR] Implement beginning of 'copy' lowering for compute con… (PR #140304)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri May 16 13:30:39 PDT 2025


================
@@ -157,6 +222,103 @@ class OpenACCClauseCIREmitter final
     computeEmitter.Visit(&c);
   }
 
+  template <typename BeforeOpTy, typename AfterOpTy>
+  void addDataOperand(const Expr *varOperand, mlir::acc::DataClause dataClause,
+                      bool structured, bool implicit) {
+    DataOperandInfo opInfo =
+        getDataOperandInfo(cgf, builder, dirKind, varOperand);
+
+    // TODO: OpenACC: we should comprehend the 'modifier-list' here for the data
+    // operand. At the moment, we don't have a uniform way to assign these
+    // properly, and the dialect cannot represent anything other than 'readonly'
+    // and 'zero' on copyin/copyout/create, so for now, we skip it.
+
+    auto beforeOp =
+        builder.create<BeforeOpTy>(opInfo.beginLoc, opInfo.varValue, structured,
+                                   implicit, opInfo.name, opInfo.bounds);
+    operation.getDataClauseOperandsMutable().append(beforeOp.getResult());
+
+    AfterOpTy afterOp;
+    {
+      mlir::OpBuilder::InsertionGuard guardCase(builder);
+      builder.setInsertionPointAfter(operation);
+      afterOp = builder.create<AfterOpTy>(opInfo.beginLoc, beforeOp.getResult(),
+                                          opInfo.varValue, structured, implicit,
----------------
erichkeane wrote:

DOES the 'implicit' and 'structured' ALWAYS match the 'before'?  Or do I need a separate variable for that @razvanlupusoru and @clementval ?

https://github.com/llvm/llvm-project/pull/140304


More information about the cfe-commits mailing list