MLIR
18.0.0git
|
Functions | |
template<typename PDLFnT , std::size_t... I> | |
LogicalResult | verifyAsArgs (PatternRewriter &rewriter, ArrayRef< PDLValue > values, std::index_sequence< I... >) |
Validate the given PDLValues match the constraints defined by the argument types of the given function. More... | |
template<typename PDLFnT , std::size_t... I> | |
void | assertArgs (PatternRewriter &rewriter, ArrayRef< PDLValue > values, std::index_sequence< I... >) |
Assert that the given PDLValues match the constraints defined by the arguments of the given function. More... | |
template<typename T > | |
static LogicalResult | processResults (PatternRewriter &rewriter, PDLResultList &results, T &&value) |
Store a single result within the result list. More... | |
template<typename T1 , typename T2 > | |
static LogicalResult | processResults (PatternRewriter &rewriter, PDLResultList &results, std::pair< T1, T2 > &&pair) |
Store a std::pair<> as individual results within the result list. More... | |
template<typename... Ts> | |
static LogicalResult | processResults (PatternRewriter &rewriter, PDLResultList &results, std::tuple< Ts... > &&tuple) |
Store a std::tuple<> as individual results within the result list. More... | |
LogicalResult | processResults (PatternRewriter &rewriter, PDLResultList &results, LogicalResult &&result) |
Handle LogicalResult propagation. More... | |
template<typename T > | |
static LogicalResult | processResults (PatternRewriter &rewriter, PDLResultList &results, FailureOr< T > &&result) |
template<typename PDLFnT , std::size_t... I, typename FnTraitsT = llvm::function_traits<PDLFnT>> | |
FnTraitsT::result_t | processArgsAndInvokeConstraint (PDLFnT &fn, PatternRewriter &rewriter, ArrayRef< PDLValue > values, std::index_sequence< I... >) |
Process the arguments of a native constraint and invoke it. More... | |
template<typename ConstraintFnT > | |
std::enable_if_t< std::is_convertible< ConstraintFnT, PDLConstraintFunction >::value, PDLConstraintFunction > | buildConstraintFn (ConstraintFnT &&constraintFn) |
Build a constraint function from the given function ConstraintFnT . More... | |
template<typename ConstraintFnT > | |
std::enable_if_t< !std::is_convertible< ConstraintFnT, PDLConstraintFunction >::value, PDLConstraintFunction > | buildConstraintFn (ConstraintFnT &&constraintFn) |
Otherwise, we generate a wrapper that will unpack the PDLValues in the form we desire. More... | |
template<typename PDLFnT , std::size_t... I, typename FnTraitsT = llvm::function_traits<PDLFnT>> | |
std::enable_if_t< std::is_same< typename FnTraitsT::result_t, void >::value, LogicalResult > | processArgsAndInvokeRewrite (PDLFnT &fn, PatternRewriter &rewriter, PDLResultList &, ArrayRef< PDLValue > values, std::index_sequence< I... >) |
Process the arguments of a native rewrite and invoke it. More... | |
template<typename PDLFnT , std::size_t... I, typename FnTraitsT = llvm::function_traits<PDLFnT>> | |
std::enable_if_t<!std::is_same< typename FnTraitsT::result_t, void >::value, LogicalResult > | processArgsAndInvokeRewrite (PDLFnT &fn, PatternRewriter &rewriter, PDLResultList &results, ArrayRef< PDLValue > values, std::index_sequence< I... >) |
This overload handles the case of return values, which need to be packaged into the result list. More... | |
template<typename RewriteFnT > | |
std::enable_if_t< std::is_convertible< RewriteFnT, PDLRewriteFunction >::value, PDLRewriteFunction > | buildRewriteFn (RewriteFnT &&rewriteFn) |
Build a rewrite function from the given function RewriteFnT . More... | |
template<typename RewriteFnT > | |
std::enable_if_t<!std::is_convertible< RewriteFnT, PDLRewriteFunction >::value, PDLRewriteFunction > | buildRewriteFn (RewriteFnT &&rewriteFn) |
Otherwise, we generate a wrapper that will unpack the PDLValues in the form we desire. More... | |
Variables | |
template<class... T> | |
constexpr bool | always_false = false |
A utility variable that always resolves to false. More... | |
void mlir::detail::pdl_function_builder::assertArgs | ( | PatternRewriter & | rewriter, |
ArrayRef< PDLValue > | values, | ||
std::index_sequence< I... > | |||
) |
Assert that the given PDLValues match the constraints defined by the arguments of the given function.
In the case of failure, a fatal error is emitted.
Definition at line 1343 of file PatternMatch.h.
References mlir::succeeded().
std::enable_if_t< std::is_convertible<ConstraintFnT, PDLConstraintFunction>::value, PDLConstraintFunction> mlir::detail::pdl_function_builder::buildConstraintFn | ( | ConstraintFnT && | constraintFn | ) |
Build a constraint function from the given function ConstraintFnT
.
This allows for enabling the user to define simpler, more direct constraint functions without needing to handle the low-level PDL goop.
If the constraint function is already in the correct form, we just forward it directly.
Definition at line 1437 of file PatternMatch.h.
Referenced by mlir::PDLPatternModule::registerConstraintFunction().
std::enable_if_t< !std::is_convertible<ConstraintFnT, PDLConstraintFunction>::value, PDLConstraintFunction> mlir::detail::pdl_function_builder::buildConstraintFn | ( | ConstraintFnT && | constraintFn | ) |
Otherwise, we generate a wrapper that will unpack the PDLValues in the form we desire.
Definition at line 1446 of file PatternMatch.h.
References mlir::failed(), mlir::failure(), and processArgsAndInvokeConstraint().
std::enable_if_t<std::is_convertible<RewriteFnT, PDLRewriteFunction>::value, PDLRewriteFunction> mlir::detail::pdl_function_builder::buildRewriteFn | ( | RewriteFnT && | rewriteFn | ) |
Build a rewrite function from the given function RewriteFnT
.
This allows for enabling the user to define simpler, more direct rewrite functions without needing to handle the low-level PDL goop.
If the rewrite function is already in the correct form, we just forward it directly.
Definition at line 1502 of file PatternMatch.h.
Referenced by mlir::PDLPatternModule::registerRewriteFunction().
std::enable_if_t<!std::is_convertible<RewriteFnT, PDLRewriteFunction>::value, PDLRewriteFunction> mlir::detail::pdl_function_builder::buildRewriteFn | ( | RewriteFnT && | rewriteFn | ) |
Otherwise, we generate a wrapper that will unpack the PDLValues in the form we desire.
Definition at line 1510 of file PatternMatch.h.
References processArgsAndInvokeRewrite().
FnTraitsT::result_t mlir::detail::pdl_function_builder::processArgsAndInvokeConstraint | ( | PDLFnT & | fn, |
PatternRewriter & | rewriter, | ||
ArrayRef< PDLValue > | values, | ||
std::index_sequence< I... > | |||
) |
Process the arguments of a native constraint and invoke it.
Definition at line 1418 of file PatternMatch.h.
Referenced by buildConstraintFn().
std::enable_if_t<std::is_same<typename FnTraitsT::result_t, void>::value, LogicalResult> mlir::detail::pdl_function_builder::processArgsAndInvokeRewrite | ( | PDLFnT & | fn, |
PatternRewriter & | rewriter, | ||
PDLResultList & | , | ||
ArrayRef< PDLValue > | values, | ||
std::index_sequence< I... > | |||
) |
Process the arguments of a native rewrite and invoke it.
This overload handles the case of no return values.
Definition at line 1469 of file PatternMatch.h.
References mlir::success().
Referenced by buildRewriteFn().
std::enable_if_t<!std::is_same<typename FnTraitsT::result_t, void>::value, LogicalResult> mlir::detail::pdl_function_builder::processArgsAndInvokeRewrite | ( | PDLFnT & | fn, |
PatternRewriter & | rewriter, | ||
PDLResultList & | results, | ||
ArrayRef< PDLValue > | values, | ||
std::index_sequence< I... > | |||
) |
This overload handles the case of return values, which need to be packaged into the result list.
Definition at line 1483 of file PatternMatch.h.
References processResults().
|
static |
Definition at line 1402 of file PatternMatch.h.
References mlir::failed(), mlir::failure(), and processResults().
|
inline |
Handle LogicalResult propagation.
Definition at line 1396 of file PatternMatch.h.
|
static |
Store a std::pair<> as individual results within the result list.
Definition at line 1374 of file PatternMatch.h.
References mlir::failed(), mlir::failure(), processResults(), and mlir::success().
|
static |
Store a std::tuple<> as individual results within the result list.
Definition at line 1385 of file PatternMatch.h.
References processResults(), mlir::succeeded(), and mlir::success().
|
static |
Store a single result within the result list.
Definition at line 1365 of file PatternMatch.h.
References mlir::success().
Referenced by processArgsAndInvokeRewrite(), and processResults().
LogicalResult mlir::detail::pdl_function_builder::verifyAsArgs | ( | PatternRewriter & | rewriter, |
ArrayRef< PDLValue > | values, | ||
std::index_sequence< I... > | |||
) |
Validate the given PDLValues match the constraints defined by the argument types of the given function.
In the case of failure, a match failure diagnostic is emitted. FIXME: This should be completely removed in favor of assertArgs
, but PDL does not currently preserve Constraint application ordering.
Definition at line 1326 of file PatternMatch.h.
References mlir::Builder::getUnknownLoc(), mlir::RewriterBase::notifyMatchFailure(), mlir::succeeded(), and mlir::success().
|
constexpr |
A utility variable that always resolves to false.
This is useful for static asserts that are always false, but only should fire in certain templated constructs. For example, if a templated function should never be called, the function could be defined as:
template <typename T> void foo() { static_assert(always_false<T>, "This function should never be called"); }
Definition at line 1064 of file PatternMatch.h.