50#ifndef MLIR_DIALECT_OPENACC_ANALYSIS_OPENACCSUPPORT_H
51#define MLIR_DIALECT_OPENACC_ANALYSIS_OPENACCSUPPORT_H
56#include "llvm/ADT/StringRef.h"
64enum class RecipeKind : uint32_t;
68 llvm::StringRef category);
95 llvm::StringRef category) = 0;
106 template <
typename ImplT,
typename... Args>
108 decltype(std::declval<ImplT>().isValidSymbolUse(std::declval<Args>()...));
110 template <
typename ImplT>
115 template <
typename ImplT,
typename... Args>
118 decltype(std::declval<ImplT>().isValidValueUse(std::declval<Args>()...));
120 template <
typename ImplT>
122 llvm::is_detected<isValidValueUse_t, ImplT, Value, Region &>;
124 template <
typename ImplT,
typename... Args>
126 decltype(std::declval<ImplT>().emitRemark(std::declval<Args>()...));
128 template <
typename ImplT>
130 const Twine &, llvm::StringRef>;
137 template <
typename ImplT>
144 return impl.getVariableName(v);
148 return impl.getRecipeName(kind, type, var);
152 return impl.emitNYI(loc, message);
156 const Twine &message,
157 llvm::StringRef category)
final {
159 return impl.emitRemark(op, message, category);
167 return impl.isValidSymbolUse(user, symbol, definingOpPtr);
174 return impl.isValidValueUse(v, region);
191 template <
typename ImplT>
201 template <
typename AnalysisT>
204 std::make_unique<Model<AnalysisT>>(std::forward<AnalysisT>(analysis));
240 llvm::StringRef category =
"openacc");
265 std::unique_ptr<Concept>
impl;
detail::PreservedAnalyses PreservedAnalyses
This class represents a diagnostic that is inflight and set to be reported.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Operation is the basic unit of execution within MLIR.
This class contains a list of basic blocks and a link to the parent operation it is attached to.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
remark::detail::InFlightRemark emitRemark(Operation *op, const Twine &message, llvm::StringRef category="openacc")
Emit an OpenACC remark.
void setImplementation(AnalysisT &&analysis)
Register a custom OpenACCSupport implementation.
InFlightDiagnostic emitNYI(Location loc, const Twine &message)
Report a case that is not yet supported by the implementation.
bool isValidValueUse(Value v, Region ®ion)
Check if a value use is legal in an OpenACC region.
OpenACCSupport(Operation *op)
bool isValidSymbolUse(Operation *user, SymbolRefAttr symbol, Operation **definingOpPtr=nullptr)
Check if a symbol use is valid for use in an OpenACC region.
bool isInvalidated(const AnalysisManager::PreservedAnalyses &pa)
Signal that this analysis should always be preserved so that underlying implementation registration i...
std::string getVariableName(Value v)
Get the variable name for a given value.
std::string getRecipeName(RecipeKind kind, Type type, Value var)
Get the recipe name for a given type and value.
virtual std::string getRecipeName(RecipeKind kind, Type type, Value var)=0
Get the recipe name for a given kind, type and value.
virtual std::string getVariableName(Value v)=0
Get the variable name for a given MLIR value.
virtual bool isValidValueUse(Value v, mlir::Region ®ion)=0
Check if a value use is legal in an OpenACC region.
virtual InFlightDiagnostic emitNYI(Location loc, const Twine &message)=0
virtual ~Concept()=default
virtual bool isValidSymbolUse(Operation *user, SymbolRefAttr symbol, Operation **definingOpPtr)=0
Check if a symbol use is valid for use in an OpenACC region.
virtual remark::detail::InFlightRemark emitRemark(Operation *op, const Twine &message, llvm::StringRef category)=0
This class wraps a concrete OpenACCSupport implementation and forwards interface calls to it.
bool isValidValueUse(Value v, Region ®ion) final
Check if a value use is legal in an OpenACC region.
InFlightDiagnostic emitNYI(Location loc, const Twine &message) final
std::string getRecipeName(RecipeKind kind, Type type, Value var) final
Get the recipe name for a given kind, type and value.
remark::detail::InFlightRemark emitRemark(Operation *op, const Twine &message, llvm::StringRef category) final
bool isValidSymbolUse(Operation *user, SymbolRefAttr symbol, Operation **definingOpPtr) final
Check if a symbol use is valid for use in an OpenACC region.
~Model() override=default
std::string getVariableName(Value v) final
Get the variable name for a given MLIR value.
remark::detail::InFlightRemark emitRemark(Operation *op, const Twine &message, llvm::StringRef category)
bool isValidSymbolUse(Operation *user, SymbolRefAttr symbol, Operation **definingOpPtr)
Include the generated interface declarations.
This class contains internal trait classes used by OpenACCSupport.
decltype(std::declval< ImplT >().isValidValueUse(std::declval< Args >()...)) isValidValueUse_t
llvm::is_detected< emitRemark_t, ImplT, Operation *, const Twine &, llvm::StringRef > has_emitRemark
llvm::is_detected< isValidValueUse_t, ImplT, Value, Region & > has_isValidValueUse
llvm::is_detected< isValidSymbolUse_t, ImplT, Operation *, SymbolRefAttr, Operation ** > has_isValidSymbolUse
decltype(std::declval< ImplT >().emitRemark(std::declval< Args >()...)) emitRemark_t
decltype(std::declval< ImplT >().isValidSymbolUse(std::declval< Args >()...)) isValidSymbolUse_t
SFINAE helpers to detect if implementation has optional methods.