tvm
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
pattern_match.h File Reference

Shared expression-template pattern and capture protocol. More...

#include <tvm/ffi/cast.h>
#include <optional>
#include <tuple>
#include <type_traits>
#include <utility>
Include dependency graph for pattern_match.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tvm::Pattern< Derived >
 Base class of all the patterns. More...
 
class  tvm::PEqualChecker< T >
 Default deep equality checker. More...
 
class  tvm::PVar< T >
 Pattern variable container. More...
 
class  tvm::PVarWithCheck< Derived, T >
 Wrapper for pattern variable container with extra match logic. More...
 
class  tvm::PConst< T >
 Constant Pattern variable container. More...
 
class  tvm::PMatchesOneOf< TPattern >
 

Namespaces

namespace  tvm
 An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
 

Functions

template<typename... TPattern>
std::enable_if_t<(std::is_base_of_v< Pattern< TPattern >, TPattern > &&... &&true), PMatchesOneOf< TPattern... > > tvm::MatchesOneOf (const TPattern &... patterns)
 

Detailed Description

Shared expression-template pattern and capture protocol.

\rst .. code-block:: cpp

#include <tvm/ir/prim/pattern_match.h>

void MatchMultiplyAdd(const tvm::PrimExpr& expr) { tvm::PVar<tvm::PrimExpr> a, b, c; if ((a * b + c).Match(expr)) { tvm::PrimExpr lhs = a.Eval(); tvm::PrimExpr rhs = b.Eval(); tvm::PrimExpr addend = c.Eval(); } } \endrst