//===-- FIROpenACCOpsInterfaces.cpp ---------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Implementation of external operation interfaces for FIR. // //===----------------------------------------------------------------------===// #include "flang/Optimizer/OpenACC/Support/FIROpenACCOpsInterfaces.h" #include "flang/Optimizer/Dialect/FIROps.h" #include "flang/Optimizer/HLFIR/HLFIROps.h" namespace fir::acc { template <> mlir::Value PartialEntityAccessModel::getBaseEntity( mlir::Operation *op) const { return mlir::cast(op).getMemref(); } template <> mlir::Value PartialEntityAccessModel::getBaseEntity( mlir::Operation *op) const { return mlir::cast(op).getRef(); } template <> mlir::Value PartialEntityAccessModel::getBaseEntity( mlir::Operation *op) const { return mlir::cast(op).getMemref(); } mlir::Value PartialEntityAccessModel::getBaseEntity( mlir::Operation *op) const { return mlir::cast(op).getStorage(); } bool PartialEntityAccessModel::isCompleteView( mlir::Operation *op) const { // Return false (partial view) only if storage is present // Return true (complete view) if storage is absent return !getBaseEntity(op); } mlir::Value PartialEntityAccessModel::getBaseEntity( mlir::Operation *op) const { return mlir::cast(op).getStorage(); } bool PartialEntityAccessModel::isCompleteView( mlir::Operation *op) const { // Return false (partial view) only if storage is present // Return true (complete view) if storage is absent return !getBaseEntity(op); } mlir::SymbolRefAttr AddressOfGlobalModel::getSymbol(mlir::Operation *op) const { return mlir::cast(op).getSymbolAttr(); } bool GlobalVariableModel::isConstant(mlir::Operation *op) const { auto globalOp = mlir::cast(op); return globalOp.getConstant().has_value(); } } // namespace fir::acc