[flang-commits] [flang] [NFC][flang][OpenMP] Extract target region utils to map or clone outside values (PR #155754)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Mon Sep 8 04:51:01 PDT 2025


================
@@ -28,6 +32,31 @@ mlir::omp::MapInfoOp createMapInfoOp(mlir::OpBuilder &builder,
     uint64_t mapType, mlir::omp::VariableCaptureKind mapCaptureType,
     mlir::Type retTy, bool partialMap = false,
     mlir::FlatSymbolRefAttr mapperId = mlir::FlatSymbolRefAttr());
+
+/// For an mlir value that does not have storage, allocate temporary storage
+/// (outside the target region), store the value in that storage, and map the
+/// storage to the target region.
+///
+/// \param firOpBuilder - Operation builder.
+/// \param targetOp     - Target op to which the temporary value is mapped.
+/// \param val          - Temp value that should be mapped to the target region.
+/// \param name         - A string used to identify the created `omp.map.info`
+/// op.
+///
+/// \returns The loaded mapped value inside the target region.
+mlir::Value mapTemporaryValue(fir::FirOpBuilder &firOpBuilder,
+    mlir::omp::TargetOp targetOp, mlir::Value val, llvm::StringRef name);
+
+/// For values used inside a target region but defined outside, either clone
+/// these value inside the target region or map them to the region. This
+/// function tries firts to clone values (if they are defined by
----------------
ergawy wrote:

Done

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


More information about the flang-commits mailing list