FLANG
FIROpenACCOpsInterfaces.h
1//===- FIROpenACCOpsInterfaces.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// This file contains external operation interfaces for FIR.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef FLANG_OPTIMIZER_OPENACC_FIROPENACC_OPS_INTERFACES_H_
14#define FLANG_OPTIMIZER_OPENACC_FIROPENACC_OPS_INTERFACES_H_
15
16#include "mlir/Dialect/OpenACC/OpenACC.h"
17
18namespace fir {
19class AddrOfOp;
20class DeclareOp;
21class GlobalOp;
22} // namespace fir
23
24namespace hlfir {
25class DeclareOp;
26class DesignateOp;
27} // namespace hlfir
28
29namespace fir::acc {
30
31template <typename Op>
33 : public mlir::acc::PartialEntityAccessOpInterface::ExternalModel<
34 PartialEntityAccessModel<Op>, Op> {
35 mlir::Value getBaseEntity(mlir::Operation *op) const;
36
37 // Default implementation - returns false (partial view)
38 bool isCompleteView(mlir::Operation *op) const { return false; }
39};
40
41// Full specializations for declare operations
42template <>
43struct PartialEntityAccessModel<fir::DeclareOp>
44 : public mlir::acc::PartialEntityAccessOpInterface::ExternalModel<
45 PartialEntityAccessModel<fir::DeclareOp>, fir::DeclareOp> {
46 mlir::Value getBaseEntity(mlir::Operation *op) const;
47 bool isCompleteView(mlir::Operation *op) const;
48};
49
50template <>
51struct PartialEntityAccessModel<hlfir::DeclareOp>
52 : public mlir::acc::PartialEntityAccessOpInterface::ExternalModel<
53 PartialEntityAccessModel<hlfir::DeclareOp>, hlfir::DeclareOp> {
54 mlir::Value getBaseEntity(mlir::Operation *op) const;
55 bool isCompleteView(mlir::Operation *op) const;
56};
57
59 : public mlir::acc::AddressOfGlobalOpInterface::ExternalModel<
60 AddressOfGlobalModel, fir::AddrOfOp> {
61 mlir::SymbolRefAttr getSymbol(mlir::Operation *op) const;
62};
63
65 : public mlir::acc::GlobalVariableOpInterface::ExternalModel<
66 GlobalVariableModel, fir::GlobalOp> {
67 bool isConstant(mlir::Operation *op) const;
68 mlir::Region *getInitRegion(mlir::Operation *op) const;
69};
70
71template <typename Op>
73 : public mlir::acc::IndirectGlobalAccessOpInterface::ExternalModel<
74 IndirectGlobalAccessModel<Op>, Op> {
75 void getReferencedSymbols(mlir::Operation *op,
76 llvm::SmallVectorImpl<mlir::SymbolRefAttr> &symbols,
77 mlir::SymbolTable *symbolTable) const;
78};
79
80} // namespace fir::acc
81
82#endif // FLANG_OPTIMIZER_OPENACC_FIROPENACC_OPS_INTERFACES_H_
Definition AbstractConverter.h:34
Definition FIROpenACCOpsInterfaces.h:60
Definition FIROpenACCOpsInterfaces.h:66
Definition FIROpenACCOpsInterfaces.h:74
Definition FIROpenACCOpsInterfaces.h:34