9#ifndef FORTRAN_LOWER_OPENMPUTILS_H
10#define FORTRAN_LOWER_OPENMPUTILS_H
12#include "flang/Lower/OpenMP/Clauses.h"
13#include "flang/Optimizer/Builder/HLFIRTools.h"
14#include "mlir/Dialect/LLVMIR/LLVMAttrs.h"
15#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
16#include "mlir/IR/Location.h"
17#include "mlir/IR/Value.h"
18#include "llvm/Frontend/OpenMP/OMPContext.h"
19#include "llvm/Support/CommandLine.h"
23extern llvm::cl::opt<bool> treatIndexAsSection;
53struct DeclareTargetCaptureInfo {
54 mlir::omp::DeclareTargetCaptureClause clause;
58 DeclareTargetCaptureInfo(mlir::omp::DeclareTargetCaptureClause c,
60 : clause(c), automap(a), symbol(s) {}
114 bool isDuplicateMemberMapInfo(llvm::SmallVectorImpl<int64_t> &memberIndices) {
115 return llvm::find_if(memberPlacementIndices, [&](
auto &memberData) {
116 return llvm::equal(memberIndices, memberData);
117 }) != memberPlacementIndices.end();
120 void addChildIndexAndMapToParent(
const omp::Object &
object,
121 mlir::omp::MapInfoOp &mapOp,
125void insertChildMapInfoIntoParent(
129 std::map<Object, OmpMapParentAndMemberData> &parentMemberIndices,
130 llvm::SmallVectorImpl<mlir::Value> &mapOperands,
131 llvm::SmallVectorImpl<Object> &mapObjects);
133void generateMemberPlacementIndices(
134 const Object &
object, llvm::SmallVectorImpl<int64_t> &indices,
137bool isMemberOrParentAllocatableOrPointer(
140mlir::Value createParentSymAndGenIntermediateMaps(
143 omp::ObjectList &objectList, llvm::SmallVectorImpl<int64_t> &indices,
145 mlir::omp::ClauseMapFlags mapTypeBits);
147bool requiresImplicitDefaultDeclareMapper(
150omp::ObjectList gatherObjectsOf(omp::Object derivedTypeMember,
154 std::size_t loopVarTypeSize);
159void gatherFuncAndVarSyms(
160 const ObjectList &objects, mlir::omp::DeclareTargetCaptureClause clause,
161 llvm::SmallVectorImpl<DeclareTargetCaptureInfo> &symbolAndClause,
162 bool automap =
false);
164int64_t getCollapseValue(
const List<Clause> &clauses);
166void genObjectList(
const ObjectList &objects,
168 llvm::SmallVectorImpl<mlir::Value> &operands);
170void lastprivateModifierNotSupported(
const omp::clause::Lastprivate &lastp,
175int64_t collectLoopRelatedInfo(
178 const omp::List<omp::Clause> &clauses,
179 mlir::omp::LoopRelatedClauseOps &result,
180 llvm::SmallVectorImpl<const semantics::Symbol *> &iv);
182void collectLoopRelatedInfo(
185 std::int64_t collapseValue,
187 mlir::omp::LoopRelatedClauseOps &result,
188 llvm::SmallVectorImpl<const semantics::Symbol *> &iv);
190void collectTileSizesFromOpenMPConstruct(
192 llvm::SmallVectorImpl<int64_t> &tileSizes,
197 const mlir::DataLayout &dl,
201 const omp::Object &
object,
216bool hasIteratorIVReference(
217 const omp::Object &
object,
218 const llvm::SmallPtrSetImpl<const Fortran::semantics::Symbol *> &ivSyms);
226 std::string &mapperIdName, llvm::StringRef memberName);
251mlir::FlatSymbolRefAttr
253 mlir::Location loc,
const omp::Object &
object,
254 llvm::StringRef mapperIdName,
255 mlir::omp::ClauseMapFlags mapTypeBits,
256 llvm::omp::Directive directive,
bool hasParentObj);
258std::optional<llvm::SmallVector<mlir::Value>> getIteratorElementIndices(
266void collectEnclosingConstructTraits(
268 llvm::SmallVectorImpl<llvm::omp::TraitProperty> &constructTraits);
274 mlir::ModuleOp module,
Definition AbstractConverter.h:87
Definition StatementContext.h:46
Definition semantics.h:67
Definition openmp-utils.h:247
Definition FIRBuilder.h:59
Definition HLFIRTools.h:52
Definition ParserActions.h:24
Definition check-expression.h:19
Definition bit-population-count.h:20
Definition AbstractConverter.h:37
Definition PFTBuilder.h:221
Definition parse-tree.h:3632
Definition parse-tree.h:3620
Definition parse-tree.h:5549