13#ifndef FLANG_OPTIMIZER_OPENACC_FIROPENACC_OPS_INTERFACES_H_
14#define FLANG_OPTIMIZER_OPENACC_FIROPENACC_OPS_INTERFACES_H_
16#include "flang/Optimizer/Dialect/FIROperationMoveOpInterface.h"
17#include "flang/Optimizer/Dialect/FIROps.h"
18#include "flang/Optimizer/Dialect/FortranVariableInterface.h"
19#include "mlir/Dialect/OpenACC/OpenACC.h"
36 :
public mlir::acc::PartialEntityAccessOpInterface::ExternalModel<
37 PartialEntityAccessModel<Op>, Op> {
38 mlir::Value getBaseEntity(mlir::Operation *op)
const;
41 bool isCompleteView(mlir::Operation *op)
const {
return false; }
47 :
public mlir::acc::PartialEntityAccessOpInterface::ExternalModel<
48 PartialEntityAccessModel<fir::DeclareOp>, fir::DeclareOp> {
49 mlir::Value getBaseEntity(mlir::Operation *op)
const;
50 bool isCompleteView(mlir::Operation *op)
const;
55 :
public mlir::acc::PartialEntityAccessOpInterface::ExternalModel<
56 PartialEntityAccessModel<hlfir::DeclareOp>, hlfir::DeclareOp> {
57 mlir::Value getBaseEntity(mlir::Operation *op)
const;
58 bool isCompleteView(mlir::Operation *op)
const;
63 :
public mlir::acc::StoreLikeOpInterface::ExternalModel<StoreLikeModel,
66 getStoredValues(mlir::Operation *op,
68 auto store = mlir::cast<fir::StoreOp>(op);
70 {{mlir::acc::StoredSourceKind::Operand, &store.getValueMutable(), {}},
71 {mlir::acc::StoreLocation{&store.getMemrefMutable()}}});
76 :
public mlir::acc::AddressOfGlobalOpInterface::ExternalModel<
77 AddressOfGlobalModel, fir::AddrOfOp> {
78 mlir::SymbolRefAttr getSymbol(mlir::Operation *op)
const;
82 :
public mlir::acc::GlobalVariableOpInterface::ExternalModel<
83 GlobalVariableModel, fir::GlobalOp> {
84 bool isConstant(mlir::Operation *op)
const;
85 bool hasInitializer(mlir::Operation *op)
const;
86 mlir::Region *getInitRegion(mlir::Operation *op)
const;
87 bool isDeviceAccessible(mlir::Operation *op)
const;
88 bool isInDeviceMemory(mlir::Operation *op)
const;
89 bool isCompilerGenerated(mlir::Operation *op)
const;
90 bool hasLocalLinkage(mlir::Operation *op)
const;
95 :
public mlir::acc::IndirectGlobalAccessOpInterface::ExternalModel<
96 IndirectGlobalAccessModel<Op>, Op> {
97 void getReferencedSymbols(mlir::Operation *op,
99 mlir::SymbolTable *symbolTable)
const;
106template <
typename Op>
108 :
public mlir::acc::OutlineRematerializationOpInterface::ExternalModel<
109 OutlineRematerializationModel<Op>, Op> {
110 bool isRematerializationCandidate(mlir::Operation *op)
const {
return true; }
115 :
public mlir::acc::OutlineRematerializationOpInterface::ExternalModel<
116 OutlineRematerializationModel<fir::ConvertOp>, fir::ConvertOp> {
117 bool isRematerializationCandidate(mlir::Operation *op)
const;
127template <
typename Op>
129 :
public mlir::acc::OutlineIdentityOperandOpInterface::ExternalModel<
130 OutlineIdentityOperandDeclareModel<Op>, Op> {
131 void dropOutlinedIdentityOperands(mlir::Operation *op)
const;
137template <
typename Op>
139 :
public mlir::acc::OffloadRegionOpInterface::ExternalModel<
140 OffloadRegionModel<Op>, Op> {
141 mlir::Region &getOffloadRegion(mlir::Operation *op)
const {
142 return mlir::cast<Op>(op).getRegion();
150template <
typename Op>
152 OperationMoveModel<Op>, Op> {
157 bool canMoveFromDescendant(mlir::Operation *op, mlir::Operation *descendant,
158 mlir::Operation *candidate)
const;
164 bool canMoveOutOf(mlir::Operation *op, mlir::Operation *candidate)
const;
168void verifyFortranObjectViewResult(mlir::Operation *op,
169 mlir::OpResult resultView);
173template <
typename Op>
175 :
public fir::FortranObjectViewOpInterface::ExternalModel<
176 AccFortranObjectViewModel<Op>, Op> {
177 mlir::Value getViewSource(mlir::Operation *op,
178 mlir::OpResult resultView)
const;
179 std::optional<std::int64_t> getViewOffset(mlir::Operation *op,
180 mlir::OpResult resultView)
const {
181 detail::verifyFortranObjectViewResult(op, resultView);
Definition AbstractConverter.h:37
External model for acc ops whose result is a zero-offset view of an operand.
Definition FIROpenACCOpsInterfaces.h:176
Definition FIROpenACCOpsInterfaces.h:77
Definition FIROpenACCOpsInterfaces.h:83
Definition FIROpenACCOpsInterfaces.h:96
Definition FIROpenACCOpsInterfaces.h:140
Definition FIROpenACCOpsInterfaces.h:152
Definition FIROpenACCOpsInterfaces.h:130
Definition FIROpenACCOpsInterfaces.h:109
Definition FIROpenACCOpsInterfaces.h:37
fir.store writes its value operand through its memory operand.
Definition FIROpenACCOpsInterfaces.h:64