brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 5d5dd3d Raw
68 lines · cpp
1//===-- FIROpenACCAttributes.cpp ------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8/// \file9/// This file implements attribute interfaces that are promised by FIR10/// dialect attributes related to OpenACC.11//===----------------------------------------------------------------------===//12 13#include "flang/Optimizer/Builder/FIRBuilder.h"14#include "flang/Optimizer/Builder/Todo.h"15#include "flang/Optimizer/Dialect/FIRAttr.h"16#include "flang/Optimizer/Dialect/FIRDialect.h"17#include "mlir/Dialect/OpenACC/OpenACC.h"18 19namespace fir::acc {20class FortranSafeTempArrayCopyAttrImpl21    : public fir::SafeTempArrayCopyAttrInterface::FallbackModel<22          FortranSafeTempArrayCopyAttrImpl> {23public:24  // SafeTempArrayCopyAttrInterface interface methods.25  static bool isDynamicallySafe() { return false; }26  static mlir::Value genDynamicCheck(mlir::Location loc,27                                     fir::FirOpBuilder &builder,28                                     mlir::Value array) {29    TODO(loc, "fir::acc::FortranSafeTempArrayCopyAttrImpl::genDynamicCheck()");30    return nullptr;31  }32  static void registerTempDeallocation(mlir::Location loc,33                                       fir::FirOpBuilder &builder,34                                       mlir::Value array, mlir::Value temp) {35    TODO(loc, "fir::acc::FortranSafeTempArrayCopyAttrImpl::"36              "registerTempDeallocation()");37  }38 39  // Extra helper methods.40 41  /// Attach the implementation to fir::OpenACCSafeTempArrayCopyAttr.42  static void registerExternalModel(mlir::DialectRegistry &registry);43 44  /// If the methods above create any new operations, this method45  /// must register all the corresponding dialect.46  static void getDependentDialects(mlir::DialectRegistry &registry) {}47};48 49void FortranSafeTempArrayCopyAttrImpl::registerExternalModel(50    mlir::DialectRegistry &registry) {51  registry.addExtension(52      +[](mlir::MLIRContext *ctx, fir::FIROpsDialect *dialect) {53        fir::OpenACCSafeTempArrayCopyAttr::attachInterface<54            FortranSafeTempArrayCopyAttrImpl>(*ctx);55      });56}57 58void registerAttrsExtensions(mlir::DialectRegistry &registry) {59  FortranSafeTempArrayCopyAttrImpl::registerExternalModel(registry);60}61 62void registerTransformationalAttrsDependentDialects(63    mlir::DialectRegistry &registry) {64  FortranSafeTempArrayCopyAttrImpl::getDependentDialects(registry);65}66 67} // namespace fir::acc68