50#ifndef MLIR_DIALECT_OPENACC_ANALYSIS_OPENACCSUPPORT_H
51#define MLIR_DIALECT_OPENACC_ANALYSIS_OPENACCSUPPORT_H
57#include "llvm/ADT/StringRef.h"
89 llvm::StringRef category) = 0;
100 template <
typename ImplT,
typename... Args>
102 decltype(std::declval<ImplT>().isValidSymbolUse(std::declval<Args>()...));
104 template <
typename ImplT>
109 template <
typename ImplT,
typename... Args>
112 decltype(std::declval<ImplT>().isValidValueUse(std::declval<Args>()...));
114 template <
typename ImplT>
116 llvm::is_detected<isValidValueUse_t, ImplT, Value, Region &>;
118 template <
typename ImplT,
typename... Args>
120 decltype(std::declval<ImplT>().emitRemark(std::declval<Args>()...));
122 template <
typename ImplT>
124 const Twine &, llvm::StringRef>;
131 template <
typename ImplT>
138 return impl.getVariableName(v);
142 return impl.getRecipeName(kind, type, var);
146 return impl.emitNYI(loc, message);
150 const Twine &message,
151 llvm::StringRef category)
final {
153 return impl.emitRemark(op, message, category);
161 return impl.isValidSymbolUse(user, symbol, definingOpPtr);
168 return impl.isValidValueUse(v, region);
185 template <
typename ImplT>
195 template <
typename AnalysisT>
198 std::make_unique<Model<AnalysisT>>(std::forward<AnalysisT>(analysis));
234 llvm::StringRef category =
"openacc");
259 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.
bool isValidSymbolUse(mlir::Operation *user, mlir::SymbolRefAttr symbol, mlir::Operation **definingOpPtr=nullptr)
Check if a symbol use is valid for use in an OpenACC region.
remark::detail::InFlightRemark emitRemark(mlir::Operation *op, const llvm::Twine &message, llvm::StringRef category="openacc")
Emit an OpenACC remark for the given operation with the given message.
bool isValidValueUse(mlir::Value val, mlir::Region ®ion)
Check if a value use is valid in an OpenACC region.
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.