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
18extern llvm::cl::opt<bool> treatIndexAsSection;
19extern llvm::cl::opt<bool> enableDelayedPrivatization;
20
21namespace fir {
22class FirOpBuilder;
23} // namespace fir
24
25namespace Fortran {
26
27namespace semantics {
28class Symbol;
29} // namespace semantics
30
31namespace parser {
32struct OmpObject;
33struct OmpObjectList;
34} // namespace parser
35
36namespace lower {
37
38class AbstractConverter;
39
40namespace omp {
41
42using DeclareTargetCapturePair =
43 std::pair<mlir::omp::DeclareTargetCaptureClause,
44 const Fortran::semantics::Symbol &>;
45
46mlir::omp::MapInfoOp
47createMapInfoOp(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
54mlir::Type getLoopVarType(Fortran::lower::AbstractConverter &converter,
55 std::size_t loopVarTypeSize);
56
57void gatherFuncAndVarSyms(
58 const ObjectList &objects, mlir::omp::DeclareTargetCaptureClause clause,
59 llvm::SmallVectorImpl<DeclareTargetCapturePair> &symbolAndClause);
60
61int64_t getCollapseValue(const List<Clause> &clauses);
62
63Fortran::semantics::Symbol *
64getOmpObjectSymbol(const Fortran::parser::OmpObject &ompObject);
65
66void 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

source code of flang/lib/Lower/OpenMP/Utils.h