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;
50struct DeclareTargetCaptureInfo {
51 mlir::omp::DeclareTargetCaptureClause clause;
55 DeclareTargetCaptureInfo(mlir::omp::DeclareTargetCaptureClause c,
57 : clause(c), automap(a), symbol(s) {}
111 bool isDuplicateMemberMapInfo(llvm::SmallVectorImpl<int64_t> &memberIndices) {
112 return llvm::find_if(memberPlacementIndices, [&](
auto &memberData) {
113 return llvm::equal(memberIndices, memberData);
114 }) != memberPlacementIndices.end();
117 void addChildIndexAndMapToParent(
const omp::Object &
object,
118 mlir::omp::MapInfoOp &mapOp,
122void insertChildMapInfoIntoParent(
126 std::map<Object, OmpMapParentAndMemberData> &parentMemberIndices,
127 llvm::SmallVectorImpl<mlir::Value> &mapOperands,
128 llvm::SmallVectorImpl<Object> &mapObjects);
130void generateMemberPlacementIndices(
131 const Object &
object, llvm::SmallVectorImpl<int64_t> &indices,
134bool isMemberOrParentAllocatableOrPointer(
137mlir::Value createParentSymAndGenIntermediateMaps(
140 omp::ObjectList &objectList, llvm::SmallVectorImpl<int64_t> &indices,
142 mlir::omp::ClauseMapFlags mapTypeBits);
144bool requiresImplicitDefaultDeclareMapper(
147omp::ObjectList gatherObjectsOf(omp::Object derivedTypeMember,
151 std::size_t loopVarTypeSize);
156void gatherFuncAndVarSyms(
157 const ObjectList &objects, mlir::omp::DeclareTargetCaptureClause clause,
158 llvm::SmallVectorImpl<DeclareTargetCaptureInfo> &symbolAndClause,
159 bool automap =
false);
161int64_t getCollapseValue(
const List<Clause> &clauses);
163void genObjectList(
const ObjectList &objects,
165 llvm::SmallVectorImpl<mlir::Value> &operands);
167void lastprivateModifierNotSupported(
const omp::clause::Lastprivate &lastp,
172int64_t collectLoopRelatedInfo(
175 const omp::List<omp::Clause> &clauses,
176 mlir::omp::LoopRelatedClauseOps &result,
177 llvm::SmallVectorImpl<const semantics::Symbol *> &iv);
179void collectLoopRelatedInfo(
182 std::int64_t collapseValue,
184 mlir::omp::LoopRelatedClauseOps &result,
185 llvm::SmallVectorImpl<const semantics::Symbol *> &iv);
187void collectTileSizesFromOpenMPConstruct(
189 llvm::SmallVectorImpl<int64_t> &tileSizes,
194 const mlir::DataLayout &dl,
198 const omp::Object &
object,
213bool hasIteratorIVReference(
214 const omp::Object &
object,
215 const llvm::SmallPtrSetImpl<const Fortran::semantics::Symbol *> &ivSyms);
223 std::string &mapperIdName, llvm::StringRef memberName);
248mlir::FlatSymbolRefAttr
250 mlir::Location loc,
const omp::Object &
object,
251 llvm::StringRef mapperIdName,
252 mlir::omp::ClauseMapFlags mapTypeBits,
253 llvm::omp::Directive directive,
bool hasParentObj);
255std::optional<llvm::SmallVector<mlir::Value>> getIteratorElementIndices(
263void collectEnclosingConstructTraits(
265 llvm::SmallVectorImpl<llvm::omp::TraitProperty> &constructTraits);
269class FlangOMPContext final :
public llvm::omp::OMPContext {
271 FlangOMPContext(mlir::ModuleOp module,
273 bool matchesISATrait(llvm::StringRef rawString)
const override;
276 static bool isDeviceCompilation(mlir::ModuleOp module);
277 mlir::LLVM::TargetFeaturesAttr targetFeatures;
Definition AbstractConverter.h:87
Definition StatementContext.h:46
Definition semantics.h:68
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:3628
Definition parse-tree.h:3616
Definition parse-tree.h:5517