1 | //===-- Lower/OpenMP/Utils.h ------------------------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef FORTRAN_LOWER_OPENMPUTILS_H |
10 | #define FORTRAN_LOWER_OPENMPUTILS_H |
11 | |
12 | #include "Clauses.h" |
13 | #include "mlir/Dialect/OpenMP/OpenMPDialect.h" |
14 | #include "mlir/IR/Location.h" |
15 | #include "mlir/IR/Value.h" |
16 | #include "llvm/Support/CommandLine.h" |
17 | |
18 | extern llvm::cl::opt<bool> treatIndexAsSection; |
19 | extern llvm::cl::opt<bool> enableDelayedPrivatization; |
20 | |
21 | namespace fir { |
22 | class FirOpBuilder; |
23 | } // namespace fir |
24 | |
25 | namespace Fortran { |
26 | |
27 | namespace semantics { |
28 | class Symbol; |
29 | } // namespace semantics |
30 | |
31 | namespace parser { |
32 | struct OmpObject; |
33 | struct OmpObjectList; |
34 | } // namespace parser |
35 | |
36 | namespace lower { |
37 | |
38 | class AbstractConverter; |
39 | |
40 | namespace omp { |
41 | |
42 | using DeclareTargetCapturePair = |
43 | std::pair<mlir::omp::DeclareTargetCaptureClause, |
44 | const Fortran::semantics::Symbol &>; |
45 | |
46 | mlir::omp::MapInfoOp |
47 | createMapInfoOp(fir::FirOpBuilder &builder, mlir::Location loc, |
48 | mlir::Value baseAddr, mlir::Value varPtrPtr, std::string name, |
49 | mlir::ArrayRef<mlir::Value> bounds, |
50 | mlir::ArrayRef<mlir::Value> members, uint64_t mapType, |
51 | mlir::omp::VariableCaptureKind mapCaptureType, mlir::Type retTy, |
52 | bool isVal = false); |
53 | |
54 | mlir::Type getLoopVarType(Fortran::lower::AbstractConverter &converter, |
55 | std::size_t loopVarTypeSize); |
56 | |
57 | void gatherFuncAndVarSyms( |
58 | const ObjectList &objects, mlir::omp::DeclareTargetCaptureClause clause, |
59 | llvm::SmallVectorImpl<DeclareTargetCapturePair> &symbolAndClause); |
60 | |
61 | int64_t getCollapseValue(const List<Clause> &clauses); |
62 | |
63 | Fortran::semantics::Symbol * |
64 | getOmpObjectSymbol(const Fortran::parser::OmpObject &ompObject); |
65 | |
66 | void genObjectList(const ObjectList &objects, |
67 | Fortran::lower::AbstractConverter &converter, |
68 | llvm::SmallVectorImpl<mlir::Value> &operands); |
69 | |
70 | } // namespace omp |
71 | } // namespace lower |
72 | } // namespace Fortran |
73 | |
74 | #endif // FORTRAN_LOWER_OPENMPUTILS_H |
75 | |