//===-- Lower/OpenMP/Utils.h ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef FORTRAN_LOWER_OPENMPUTILS_H #define FORTRAN_LOWER_OPENMPUTILS_H #include "Clauses.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" #include "mlir/IR/Location.h" #include "mlir/IR/Value.h" #include "llvm/Support/CommandLine.h" extern llvm::cl::opt treatIndexAsSection; extern llvm::cl::opt enableDelayedPrivatization; extern llvm::cl::opt enableDelayedPrivatizationStaging; namespace fir { class FirOpBuilder; } // namespace fir namespace Fortran { namespace semantics { class Symbol; } // namespace semantics namespace parser { struct OmpObject; struct OmpObjectList; } // namespace parser namespace lower { namespace pft { struct Evaluation; } class AbstractConverter; namespace omp { using DeclareTargetCapturePair = std::pair; // A small helper structure for keeping track of a component members MapInfoOp // and index data when lowering OpenMP map clauses. Keeps track of the // placement of the component in the derived type hierarchy it rests within, // alongside the generated mlir::omp::MapInfoOp for the mapped component. struct OmpMapMemberIndicesData { // The indices representing the component members placement in its derived // type parents hierarchy. llvm::SmallVector memberPlacementIndices; // Placement of the member in the member vector. mlir::omp::MapInfoOp memberMap; }; mlir::omp::MapInfoOp createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value baseAddr, mlir::Value varPtrPtr, std::string name, mlir::ArrayRef bounds, mlir::ArrayRef members, mlir::DenseIntElementsAttr membersIndex, uint64_t mapType, mlir::omp::VariableCaptureKind mapCaptureType, mlir::Type retTy, bool partialMap = false); void addChildIndexAndMapToParent( const omp::Object &object, std::map> &parentMemberIndices, mlir::omp::MapInfoOp &mapOp, semantics::SemanticsContext &semaCtx); void insertChildMapInfoIntoParent( lower::AbstractConverter &converter, std::map> &parentMemberIndices, llvm::SmallVectorImpl &mapOperands, llvm::SmallVectorImpl &mapSyms, llvm::SmallVectorImpl *mapSymTypes, llvm::SmallVectorImpl *mapSymLocs); mlir::Type getLoopVarType(lower::AbstractConverter &converter, std::size_t loopVarTypeSize); semantics::Symbol * getIterationVariableSymbol(const lower::pft::Evaluation &eval); void gatherFuncAndVarSyms( const ObjectList &objects, mlir::omp::DeclareTargetCaptureClause clause, llvm::SmallVectorImpl &symbolAndClause); int64_t getCollapseValue(const List &clauses); semantics::Symbol *getOmpObjectSymbol(const parser::OmpObject &ompObject); void genObjectList(const ObjectList &objects, lower::AbstractConverter &converter, llvm::SmallVectorImpl &operands); } // namespace omp } // namespace lower } // namespace Fortran #endif // FORTRAN_LOWER_OPENMPUTILS_H