53 lines · cpp
1//===- OpenACCSupport.cpp - OpenACCSupport Implementation -----------------===//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//9// This file implements the OpenACCSupport analysis interface.10//11//===----------------------------------------------------------------------===//12 13#include "mlir/Dialect/OpenACC/Analysis/OpenACCSupport.h"14#include "mlir/Dialect/OpenACC/OpenACCUtils.h"15 16namespace mlir {17namespace acc {18 19std::string OpenACCSupport::getVariableName(Value v) {20 if (impl)21 return impl->getVariableName(v);22 return acc::getVariableName(v);23}24 25std::string OpenACCSupport::getRecipeName(RecipeKind kind, Type type,26 Value var) {27 if (impl)28 return impl->getRecipeName(kind, type, var);29 // The default implementation assumes that only type matters30 // and the actual instance of variable is not relevant.31 auto recipeName = acc::getRecipeName(kind, type);32 if (recipeName.empty())33 emitNYI(var ? var.getLoc() : UnknownLoc::get(type.getContext()),34 "variable privatization (incomplete recipe name handling)");35 return recipeName;36}37 38InFlightDiagnostic OpenACCSupport::emitNYI(Location loc, const Twine &message) {39 if (impl)40 return impl->emitNYI(loc, message);41 return mlir::emitError(loc, "not yet implemented: " + message);42}43 44bool OpenACCSupport::isValidSymbolUse(Operation *user, SymbolRefAttr symbol,45 Operation **definingOpPtr) {46 if (impl)47 return impl->isValidSymbolUse(user, symbol, definingOpPtr);48 return acc::isValidSymbolUse(user, symbol, definingOpPtr);49}50 51} // namespace acc52} // namespace mlir53