================ @@ -1841,14 +1867,112 @@ createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc, llvm::cast<mlir::omp::PointerLikeType>(retTy).getElementType()); mlir::omp::MapInfoOp op = builder.create<mlir::omp::MapInfoOp>( - loc, retTy, baseAddr, varType, varPtrPtr, members, bounds, + loc, retTy, baseAddr, varType, varPtrPtr, members, membersIndex, bounds, builder.getIntegerAttr(builder.getIntegerType(64, false), mapType), builder.getAttr<mlir::omp::VariableCaptureKindAttr>(mapCaptureType), - builder.getStringAttr(name)); + builder.getStringAttr(name), builder.getBoolAttr(partialMap)); return op; } +int findComponenetMemberPlacement( + const Fortran::semantics::Symbol *dTypeSym, + const Fortran::semantics::Symbol *componentSym) { + int placement = -1; + if (const auto *derived{ + dTypeSym->detailsIf<Fortran::semantics::DerivedTypeDetails>()}) { + for (auto t : derived->componentNames()) { + placement++; + if (t == componentSym->name()) + return placement; + } + } + return placement; +} + +static void +checkAndApplyDeclTargetMapFlags(Fortran::lower::AbstractConverter &converter, + llvm::omp::OpenMPOffloadMappingFlags &mapFlags, + Fortran::semantics::Symbol *symbol) { + mlir::Operation *op = + converter.getModuleOp().lookupSymbol(converter.mangleName(*symbol)); + if (op) + if (auto declareTargetOp = + llvm::dyn_cast<mlir::omp::DeclareTargetInterface>(op)) { + // only Link clauses have OMP_MAP_PTR_AND_OBJ applied, To clause + // functions fairly different. + if (declareTargetOp.getDeclareTargetCaptureClause() == + mlir::omp::DeclareTargetCaptureClause::link) + mapFlags |= llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_PTR_AND_OBJ; + } +} + +static void insertChildMapInfoIntoParent( + Fortran::lower::AbstractConverter &converter, + llvm::SmallVector<const Fortran::semantics::Symbol *> &memberParentSyms, + llvm::SmallVector<mlir::Value> &memberMaps, ---------------- ergawy wrote:
Is there a reason to use the more general `mlir::Value` rather than `omp::MapInfoOp`? I think all elements of `memberMaps` are always instances of `MapInfoOp`, right? It can be argued that we don't need full access to the op's data but my suggestion is to provide more "documentation" in the code by using as much specific types as possible. https://github.com/llvm/llvm-project/pull/81511 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits