FLANG
OpenACC.h
1//===-- Lower/OpenACC.h -- lower OpenACC 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_OPENACC_H
14#define FORTRAN_LOWER_OPENACC_H
15
16#include "mlir/Dialect/OpenACC/OpenACC.h"
17
18namespace llvm {
19template <typename T, unsigned N>
21class StringRef;
22} // namespace llvm
23
24namespace mlir {
25class Location;
26class Type;
27class ModuleOp;
28class OpBuilder;
29class Value;
30} // namespace mlir
31
32namespace fir {
33class FirOpBuilder;
34}
35
36namespace Fortran {
37namespace parser {
38struct AccClauseList;
39struct OpenACCConstruct;
40struct OpenACCDeclarativeConstruct;
41struct OpenACCRoutineConstruct;
42} // namespace parser
43
44namespace semantics {
45class SemanticsContext;
46class Symbol;
47} // namespace semantics
48
49namespace lower {
50
51class AbstractConverter;
52class StatementContext;
53
54namespace pft {
55struct Evaluation;
56} // namespace pft
57
58using AccRoutineInfoMappingList =
60
61static constexpr llvm::StringRef declarePostAllocSuffix =
62 "_acc_declare_update_desc_post_alloc";
63static constexpr llvm::StringRef declarePreDeallocSuffix =
64 "_acc_declare_update_desc_pre_dealloc";
65static constexpr llvm::StringRef declarePostDeallocSuffix =
66 "_acc_declare_update_desc_post_dealloc";
67
68static constexpr llvm::StringRef privatizationRecipePrefix = "privatization";
69
70mlir::Value genOpenACCConstruct(AbstractConverter &,
72 pft::Evaluation &,
73 const parser::OpenACCConstruct &);
74void genOpenACCDeclarativeConstruct(AbstractConverter &,
76 StatementContext &,
77 const parser::OpenACCDeclarativeConstruct &,
78 AccRoutineInfoMappingList &);
79void genOpenACCRoutineConstruct(AbstractConverter &,
81 mlir::ModuleOp,
82 const parser::OpenACCRoutineConstruct &,
83 AccRoutineInfoMappingList &);
84
85void finalizeOpenACCRoutineAttachment(mlir::ModuleOp,
86 AccRoutineInfoMappingList &);
87
90mlir::acc::PrivateRecipeOp createOrGetPrivateRecipe(mlir::OpBuilder &,
91 llvm::StringRef,
92 mlir::Location, mlir::Type);
93
96mlir::acc::ReductionRecipeOp
97createOrGetReductionRecipe(fir::FirOpBuilder &, llvm::StringRef, mlir::Location,
98 mlir::Type, mlir::acc::ReductionOperator,
100
103mlir::acc::FirstprivateRecipeOp
104createOrGetFirstprivateRecipe(mlir::OpBuilder &, llvm::StringRef,
105 mlir::Location, mlir::Type,
107
108void attachDeclarePostAllocAction(AbstractConverter &, fir::FirOpBuilder &,
110void attachDeclarePreDeallocAction(AbstractConverter &, fir::FirOpBuilder &,
111 mlir::Value beginOpValue,
113void attachDeclarePostDeallocAction(AbstractConverter &, fir::FirOpBuilder &,
115
116void genOpenACCTerminator(fir::FirOpBuilder &, mlir::Operation *,
117 mlir::Location);
118
119int64_t getCollapseValue(const Fortran::parser::AccClauseList &);
120
121bool isInOpenACCLoop(fir::FirOpBuilder &);
122
123void setInsertionPointAfterOpenACCLoopIfInside(fir::FirOpBuilder &);
124
125void genEarlyReturnInOpenACCLoop(fir::FirOpBuilder &, mlir::Location);
126
127} // namespace lower
128} // namespace Fortran
129
130#endif // FORTRAN_LOWER_OPENACC_H
Definition: semantics.h:67
Definition: symbol.h:712
Definition: FIRBuilder.h:55
Definition: OpenACC.h:20
mlir::acc::FirstprivateRecipeOp createOrGetFirstprivateRecipe(mlir::OpBuilder &, llvm::StringRef, mlir::Location, mlir::Type, llvm::SmallVector< mlir::Value > &)
Definition: OpenACC.cpp:668
mlir::acc::PrivateRecipeOp createOrGetPrivateRecipe(mlir::OpBuilder &, llvm::StringRef, mlir::Location, mlir::Type)
Definition: OpenACC.cpp:528
mlir::acc::ReductionRecipeOp createOrGetReductionRecipe(fir::FirOpBuilder &, llvm::StringRef, mlir::Location, mlir::Type, mlir::acc::ReductionOperator, llvm::SmallVector< mlir::Value > &)
Definition: OpenACC.cpp:1344
Definition: bit-population-count.h:20
Definition: AbstractConverter.h:31
Definition: AbstractConverter.h:27
Definition: parse-tree.h:4904