@@ -98,62 +98,50 @@ struct OmpMapParentAndMemberData {
9898 // Placement of the member in the member vector.
9999 llvm::SmallVector<mlir::omp::MapInfoOp> memberMap;
100100
101- // The list of associated parent object symbols. used to track data we
102- // need for various parent processing tasks when performing member
103- // mapping, the main example currently being re-evaluating the parent
104- // maps bounds at the final step of map processing, where we need to
105- // keep a hold of all of the omp::Object's which contain array bounds
106- // for the respective parent to calculate the final bounds from.
107- //
108- // As an Example:
109- //
110- // !$omp target map(tofrom: alloca_dtype_arr(2)%array_i,
111- // alloca_dtype_arr(3)%array_i)
112- //
113- // parentObjList will contain alloca_dtype_arr(3) as well as
114- // alloca_dtype_arr(2).
115- ObjectList parentObjList;
101+ bool isDuplicateMemberMapInfo (llvm::SmallVectorImpl<int64_t > &memberIndices) {
102+ return llvm::find_if (memberPlacementIndices, [&](auto &memberData) {
103+ return llvm::equal (memberIndices, memberData);
104+ }) != memberPlacementIndices.end ();
105+ }
106+
107+ void addChildIndexAndMapToParent (const omp::Object &object,
108+ mlir::omp::MapInfoOp &mapOp,
109+ semantics::SemanticsContext &semaCtx);
116110};
117111
112+ mlir::omp::MapInfoOp
113+ createMapInfoOp (fir::FirOpBuilder &builder, mlir::Location loc,
114+ mlir::Value baseAddr, mlir::Value varPtrPtr,
115+ llvm::StringRef name, llvm::ArrayRef<mlir::Value> bounds,
116+ llvm::ArrayRef<mlir::Value> members,
117+ mlir::ArrayAttr membersIndex, uint64_t mapType,
118+ mlir::omp::VariableCaptureKind mapCaptureType, mlir::Type retTy,
119+ bool partialMap = false );
120+
121+ void insertChildMapInfoIntoParent (
122+ Fortran::lower::AbstractConverter &converter,
123+ Fortran::semantics::SemanticsContext &semaCtx,
124+ Fortran::lower::StatementContext &stmtCtx,
125+ std::map<Object, OmpMapParentAndMemberData> &parentMemberIndices,
126+ llvm::SmallVectorImpl<mlir::Value> &mapOperands,
127+ llvm::SmallVectorImpl<const semantics::Symbol *> &mapSyms);
128+
118129void generateMemberPlacementIndices (
119130 const Object &object, llvm::SmallVectorImpl<int64_t > &indices,
120131 Fortran::semantics::SemanticsContext &semaCtx);
121132
122133bool isMemberOrParentAllocatableOrPointer (
123134 const Object &object, Fortran::semantics::SemanticsContext &semaCtx);
124135
125- bool isDuplicateMemberMapInfo (OmpMapParentAndMemberData &parentMembers,
126- llvm::SmallVectorImpl<int64_t > &memberIndices);
127-
128- mlir::omp::MapInfoOp createMapInfoOp (
129- fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value baseAddr,
130- mlir::Value varPtrPtr, std::string name, mlir::ArrayRef<mlir::Value> bounds,
131- mlir::ArrayRef<mlir::Value> members, mlir::ArrayAttr membersIndex,
132- uint64_t mapType, mlir::omp::VariableCaptureKind mapCaptureType,
133- mlir::Type retTy, bool partialMap = false );
134-
135136mlir::Value createParentSymAndGenIntermediateMaps (
136137 mlir::Location clauseLocation, Fortran::lower::AbstractConverter &converter,
137138 semantics::SemanticsContext &semaCtx, lower::StatementContext &stmtCtx,
138- omp::ObjectList &objectList, llvm::SmallVector <int64_t > &indices,
139- OmpMapParentAndMemberData &parentMemberIndices, std::string asFortran,
139+ omp::ObjectList &objectList, llvm::SmallVectorImpl <int64_t > &indices,
140+ OmpMapParentAndMemberData &parentMemberIndices, llvm::StringRef asFortran,
140141 llvm::omp::OpenMPOffloadMappingFlags mapTypeBits);
141142
142- omp::ObjectList gatherObjects (omp::Object obj,
143- semantics::SemanticsContext &semaCtx);
144-
145- void addChildIndexAndMapToParent (const omp::Object &object,
146- OmpMapParentAndMemberData &parentMemberIndices,
147- mlir::omp::MapInfoOp &mapOp,
148- semantics::SemanticsContext &semaCtx);
149-
150- void insertChildMapInfoIntoParent (
151- Fortran::lower::AbstractConverter &converter,
152- Fortran::semantics::SemanticsContext &semaCtx,
153- Fortran::lower::StatementContext &stmtCtx,
154- std::map<Object, OmpMapParentAndMemberData> &parentMemberIndices,
155- llvm::SmallVectorImpl<mlir::Value> &mapOperands,
156- llvm::SmallVectorImpl<const Fortran::semantics::Symbol *> &mapSymbols);
143+ omp::ObjectList gatherObjectsOf (omp::Object derivedTypeMember,
144+ semantics::SemanticsContext &semaCtx);
157145
158146mlir::Type getLoopVarType (lower::AbstractConverter &converter,
159147 std::size_t loopVarTypeSize);
0 commit comments