Warning: This file is not a C or C++ file. It does not have highlighting.

1//===-- Lower/OpenMP.h -- lower Open MP directives --------------*- 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// Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef FORTRAN_LOWER_OPENMP_H
14#define FORTRAN_LOWER_OPENMP_H
15
16#include "llvm/ADT/SmallVector.h"
17
18#include <cinttypes>
19#include <utility>
20
21namespace mlir {
22class Operation;
23class Location;
24namespace omp {
25enum class DeclareTargetDeviceType : uint32_t;
26enum class DeclareTargetCaptureClause : uint32_t;
27} // namespace omp
28} // namespace mlir
29
30namespace fir {
31class FirOpBuilder;
32} // namespace fir
33
34namespace Fortran {
35namespace parser {
36struct OpenMPConstruct;
37struct OpenMPDeclarativeConstruct;
38struct OmpEndLoopDirective;
39struct OmpClauseList;
40} // namespace parser
41
42namespace semantics {
43class Symbol;
44class SemanticsContext;
45} // namespace semantics
46
47namespace lower {
48
49class AbstractConverter;
50class SymMap;
51
52namespace pft {
53struct Evaluation;
54struct Variable;
55} // namespace pft
56
57struct OMPDeferredDeclareTargetInfo {
58 mlir::omp::DeclareTargetCaptureClause declareTargetCaptureClause;
59 mlir::omp::DeclareTargetDeviceType declareTargetDeviceType;
60 const Fortran::semantics::Symbol &sym;
61};
62
63// Generate the OpenMP terminator for Operation at Location.
64mlir::Operation *genOpenMPTerminator(fir::FirOpBuilder &, mlir::Operation *,
65 mlir::Location);
66
67void genOpenMPConstruct(AbstractConverter &, Fortran::lower::SymMap &,
68 semantics::SemanticsContext &, pft::Evaluation &,
69 const parser::OpenMPConstruct &);
70void genOpenMPDeclarativeConstruct(AbstractConverter &,
71 Fortran::lower::SymMap &,
72 semantics::SemanticsContext &,
73 pft::Evaluation &,
74 const parser::OpenMPDeclarativeConstruct &);
75/// Symbols in OpenMP code can have flags (e.g. threadprivate directive)
76/// that require additional handling when lowering the corresponding
77/// variable. Perform such handling according to the flags on the symbol.
78/// The variable \p var is required to have a `Symbol`.
79void genOpenMPSymbolProperties(AbstractConverter &converter,
80 const pft::Variable &var);
81
82int64_t getCollapseValue(const Fortran::parser::OmpClauseList &clauseList);
83void genThreadprivateOp(AbstractConverter &, const pft::Variable &);
84void genDeclareTargetIntGlobal(AbstractConverter &, const pft::Variable &);
85bool isOpenMPTargetConstruct(const parser::OpenMPConstruct &);
86bool isOpenMPDeviceDeclareTarget(Fortran::lower::AbstractConverter &,
87 Fortran::semantics::SemanticsContext &,
88 Fortran::lower::pft::Evaluation &,
89 const parser::OpenMPDeclarativeConstruct &);
90void gatherOpenMPDeferredDeclareTargets(
91 Fortran::lower::AbstractConverter &, Fortran::semantics::SemanticsContext &,
92 Fortran::lower::pft::Evaluation &,
93 const parser::OpenMPDeclarativeConstruct &,
94 llvm::SmallVectorImpl<OMPDeferredDeclareTargetInfo> &);
95bool markOpenMPDeferredDeclareTargetFunctions(
96 mlir::Operation *, llvm::SmallVectorImpl<OMPDeferredDeclareTargetInfo> &,
97 AbstractConverter &);
98void genOpenMPRequires(mlir::Operation *, const Fortran::semantics::Symbol *);
99
100} // namespace lower
101} // namespace Fortran
102
103#endif // FORTRAN_LOWER_OPENMP_H
104

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of flang/include/flang/Lower/OpenMP.h