Halide
Halide::Internal::IRMatcher Namespace Reference

An alternative template-metaprogramming approach to expression matching. More...

Classes

struct  bindings
 
struct  BinOp
 
struct  BroadcastOp
 
struct  CanProve
 
struct  CastOp
 
struct  CmpOp
 
struct  Const
 
struct  enable_if_pattern
 
struct  Fold
 
struct  Intrin
 
struct  IsConst
 
struct  IsFloat
 
struct  MatcherState
 To save stack space, the matcher objects are largely stateless and immutable. More...
 
struct  NegateOp
 
struct  NotOp
 
struct  Overflow
 
struct  Overflows
 
struct  RampOp
 
struct  Rewriter
 
struct  SelectOp
 
struct  SpecificExpr
 
struct  VectorReduceOp
 
struct  Wild
 
struct  WildConst
 
struct  WildConstFloat
 
struct  WildConstInt
 
struct  WildConstUInt
 

Functions

HALIDE_NEVER_INLINE Expr make_const_special_expr (halide_type_t ty)
 
HALIDE_ALWAYS_INLINE Expr make_const_expr (halide_scalar_value_t val, halide_type_t ty)
 
bool equal_helper (const BaseExprNode &a, const BaseExprNode &b) noexcept
 
HALIDE_ALWAYS_INLINE bool equal (const BaseExprNode &a, const BaseExprNode &b) noexcept
 
std::ostream & operator<< (std::ostream &s, const SpecificExpr &e)
 
template<int i>
std::ostream & operator<< (std::ostream &s, const WildConstInt< i > &c)
 
template<int i>
std::ostream & operator<< (std::ostream &s, const WildConstUInt< i > &c)
 
template<int i>
std::ostream & operator<< (std::ostream &s, const WildConstFloat< i > &c)
 
template<int i>
std::ostream & operator<< (std::ostream &s, const WildConst< i > &c)
 
template<int i>
std::ostream & operator<< (std::ostream &s, const Wild< i > &op)
 
template<typename T , typename = typename std::decay<T>::type::pattern_tag>
HALIDE_ALWAYS_INLINEpattern_arg (T t)
 
HALIDE_ALWAYS_INLINE Const pattern_arg (int64_t x)
 
const HALIDE_ALWAYS_INLINE SpecificExpr pattern_arg (const Expr &e)
 
template<typename T , typename = typename std::decay<T>::type::pattern_tag, typename = typename std::enable_if<!std::is_same<typename std::decay<T>::type, SpecificExpr>::value>::type>
HALIDE_ALWAYS_INLINEunwrap (T t)
 
const HALIDE_ALWAYS_INLINE BaseExprNodeunwrap (const SpecificExpr &e)
 
std::ostream & operator<< (std::ostream &s, const Const &op)
 
template<typename Op >
int64_t constant_fold_bin_op (halide_type_t &, int64_t, int64_t) noexcept
 
template<typename Op >
uint64_t constant_fold_bin_op (halide_type_t &, uint64_t, uint64_t) noexcept
 
template<typename Op >
double constant_fold_bin_op (halide_type_t &, double, double) noexcept
 
constexpr bool commutative (IRNodeType t)
 
template<typename Op >
uint64_t constant_fold_cmp_op (int64_t, int64_t) noexcept
 
template<typename Op >
uint64_t constant_fold_cmp_op (uint64_t, uint64_t) noexcept
 
template<typename Op >
uint64_t constant_fold_cmp_op (double, double) noexcept
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< Add, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< Sub, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< Mul, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< Div, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< And, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< Or, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< Min, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< Max, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const CmpOp< LE, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const CmpOp< LT, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const CmpOp< GE, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const CmpOp< GT, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const CmpOp< EQ, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const CmpOp< NE, A, B > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const BinOp< Mod, A, B > &op)
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator+ (A a, B b) noexcept -> BinOp< Add, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto add (A a, B b) -> decltype(IRMatcher::operator+(a, b))
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Add > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< Add > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< Add > (halide_type_t &t, double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator- (A a, B b) noexcept -> BinOp< Sub, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto sub (A a, B b) -> decltype(IRMatcher::operator-(a, b))
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Sub > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< Sub > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< Sub > (halide_type_t &t, double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator* (A a, B b) noexcept -> BinOp< Mul, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto mul (A a, B b) -> decltype(IRMatcher::operator*(a, b))
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Mul > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< Mul > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< Mul > (halide_type_t &t, double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator/ (A a, B b) noexcept -> BinOp< Div, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto div (A a, B b) -> decltype(IRMatcher::operator/(a, b))
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Div > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< Div > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< Div > (halide_type_t &t, double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator% (A a, B b) noexcept -> BinOp< Mod, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto mod (A a, B b) -> decltype(IRMatcher::operator%(a, b))
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Mod > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< Mod > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< Mod > (halide_type_t &t, double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto min (A a, B b) noexcept -> BinOp< Min, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Min > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< Min > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< Min > (halide_type_t &t, double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto max (A a, B b) noexcept -> BinOp< Max, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Max > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< Max > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< Max > (halide_type_t &t, double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator< (A a, B b) noexcept -> CmpOp< LT, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto lt (A a, B b) -> decltype(IRMatcher::operator<(a, b))
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< LT > (int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< LT > (uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< LT > (double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator> (A a, B b) noexcept -> CmpOp< GT, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto gt (A a, B b) -> decltype(IRMatcher::operator>(a, b))
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< GT > (int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< GT > (uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< GT > (double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator<= (A a, B b) noexcept -> CmpOp< LE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto le (A a, B b) -> decltype(IRMatcher::operator<=(a, b))
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< LE > (int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< LE > (uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< LE > (double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator>= (A a, B b) noexcept -> CmpOp< GE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto ge (A a, B b) -> decltype(IRMatcher::operator>=(a, b))
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< GE > (int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< GE > (uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< GE > (double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator== (A a, B b) noexcept -> CmpOp< EQ, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto eq (A a, B b) -> decltype(IRMatcher::operator==(a, b))
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< EQ > (int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< EQ > (uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< EQ > (double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator!= (A a, B b) noexcept -> CmpOp< NE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto ne (A a, B b) -> decltype(IRMatcher::operator!=(a, b))
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< NE > (int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< NE > (uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_cmp_op< NE > (double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator|| (A a, B b) noexcept -> BinOp< Or, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto or_op (A a, B b) -> decltype(IRMatcher::operator||(a, b))
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< Or > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< Or > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< Or > (halide_type_t &t, double a, double b) noexcept
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto operator&& (A a, B b) noexcept -> BinOp< And, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto and_op (A a, B b) -> decltype(IRMatcher::operator&&(a, b))
 
template<>
HALIDE_ALWAYS_INLINE int64_t constant_fold_bin_op< And > (halide_type_t &t, int64_t a, int64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE uint64_t constant_fold_bin_op< And > (halide_type_t &t, uint64_t a, uint64_t b) noexcept
 
template<>
HALIDE_ALWAYS_INLINE double constant_fold_bin_op< And > (halide_type_t &t, double a, double b) noexcept
 
constexpr uint32_t bitwise_or_reduce ()
 
template<typename... Args>
constexpr uint32_t bitwise_or_reduce (uint32_t first, Args... rest)
 
constexpr bool and_reduce ()
 
template<typename... Args>
constexpr bool and_reduce (bool first, Args... rest)
 
template<typename... Args>
std::ostream & operator<< (std::ostream &s, const Intrin< Args... > &op)
 
template<typename... Args>
HALIDE_ALWAYS_INLINE auto intrin (Call::IntrinsicOp intrinsic_op, Args... args) noexcept -> Intrin< decltype(pattern_arg(args))... >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto operator! (A a) noexcept -> NotOp< decltype(pattern_arg(a))>
 
template<typename A >
HALIDE_ALWAYS_INLINE auto not_op (A a) -> decltype(IRMatcher::operator!(a))
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const NotOp< A > &op)
 
template<typename C , typename T , typename F >
std::ostream & operator<< (std::ostream &s, const SelectOp< C, T, F > &op)
 
template<typename C , typename T , typename F >
HALIDE_ALWAYS_INLINE auto select (C c, T t, F f) noexcept -> SelectOp< decltype(pattern_arg(c)), decltype(pattern_arg(t)), decltype(pattern_arg(f))>
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const BroadcastOp< A, true > &op)
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const BroadcastOp< A, false > &op)
 
template<typename A >
HALIDE_ALWAYS_INLINE auto broadcast (A a, int lanes) noexcept -> BroadcastOp< decltype(pattern_arg(a)), true >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto broadcast (A a) noexcept -> BroadcastOp< decltype(pattern_arg(a)), false >
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const RampOp< A, B, true > &op)
 
template<typename A , typename B >
std::ostream & operator<< (std::ostream &s, const RampOp< A, B, false > &op)
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto ramp (A a, B b, int lanes) noexcept -> RampOp< decltype(pattern_arg(a)), decltype(pattern_arg(b)), true >
 
template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto ramp (A a, B b) noexcept -> RampOp< decltype(pattern_arg(a)), decltype(pattern_arg(b)), false >
 
template<typename A , VectorReduce::Operator reduce_op>
std::ostream & operator<< (std::ostream &s, const VectorReduceOp< A, true, reduce_op > &op)
 
template<typename A , VectorReduce::Operator reduce_op>
std::ostream & operator<< (std::ostream &s, const VectorReduceOp< A, false, reduce_op > &op)
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_add (A a, int lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), true, VectorReduce::Add >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_add (A a) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), false, VectorReduce::Add >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_min (A a, int lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), true, VectorReduce::Min >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_min (A a) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), false, VectorReduce::Min >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_max (A a, int lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), true, VectorReduce::Max >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_max (A a) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), false, VectorReduce::Max >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_and (A a, int lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), true, VectorReduce::And >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_and (A a) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), false, VectorReduce::And >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_or (A a, int lanes) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), true, VectorReduce::Or >
 
template<typename A >
HALIDE_ALWAYS_INLINE auto h_or (A a) noexcept -> VectorReduceOp< decltype(pattern_arg(a)), false, VectorReduce::Or >
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const NegateOp< A > &op)
 
template<typename A >
HALIDE_ALWAYS_INLINE auto operator- (A a) noexcept -> NegateOp< decltype(pattern_arg(a))>
 
template<typename A >
HALIDE_ALWAYS_INLINE auto negate (A a) -> decltype(IRMatcher::operator-(a))
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const CastOp< A > &op)
 
template<typename A >
HALIDE_ALWAYS_INLINE auto cast (halide_type_t t, A a) noexcept -> CastOp< decltype(pattern_arg(a))>
 
template<typename A >
HALIDE_ALWAYS_INLINE auto fold (A a) noexcept -> Fold< decltype(pattern_arg(a))>
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const Fold< A > &op)
 
template<typename A >
HALIDE_ALWAYS_INLINE auto overflows (A a) noexcept -> Overflows< decltype(pattern_arg(a))>
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const Overflows< A > &op)
 
std::ostream & operator<< (std::ostream &s, const Overflow &op)
 
template<typename A >
HALIDE_ALWAYS_INLINE auto is_const (A a) noexcept -> IsConst< decltype(pattern_arg(a))>
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const IsConst< A > &op)
 
template<typename A , typename Prover >
HALIDE_ALWAYS_INLINE auto can_prove (A a, Prover *p) noexcept -> CanProve< decltype(pattern_arg(a)), Prover >
 
template<typename A , typename Prover >
std::ostream & operator<< (std::ostream &s, const CanProve< A, Prover > &op)
 
template<typename A >
HALIDE_ALWAYS_INLINE auto is_float (A a) noexcept -> IsFloat< decltype(pattern_arg(a))>
 
template<typename A >
std::ostream & operator<< (std::ostream &s, const IsFloat< A > &op)
 
template<typename Before , typename After , typename Predicate , typename = typename std::enable_if<std::decay<Before>::type::foldable && std::decay<After>::type::foldable>::type>
HALIDE_NEVER_INLINE void fuzz_test_rule (Before &&before, After &&after, Predicate &&pred, halide_type_t wildcard_type, halide_type_t output_type) noexcept
 
template<typename Before , typename After , typename Predicate , typename = typename std::enable_if<!(std::decay<Before>::type::foldable && std::decay<After>::type::foldable)>::type>
HALIDE_ALWAYS_INLINE void fuzz_test_rule (Before &&before, After &&after, Predicate &&pred, halide_type_t, halide_type_t, int dummy=0) noexcept
 
HALIDE_ALWAYS_INLINE bool evaluate_predicate (bool x, MatcherState &) noexcept
 
template<typename Pattern , typename = typename enable_if_pattern<Pattern>::type>
HALIDE_ALWAYS_INLINE bool evaluate_predicate (Pattern p, MatcherState &state)
 
template<typename Instance , typename = typename enable_if_pattern<Instance>::type>
HALIDE_ALWAYS_INLINE auto rewriter (Instance instance, halide_type_t output_type, halide_type_t wildcard_type) noexcept -> Rewriter< decltype(pattern_arg(instance))>
 Construct a rewriter for the given instance, which may be a pattern with concrete expressions as leaves, or just an expression. More...
 
template<typename Instance , typename = typename enable_if_pattern<Instance>::type>
HALIDE_ALWAYS_INLINE auto rewriter (Instance instance, halide_type_t output_type) noexcept -> Rewriter< decltype(pattern_arg(instance))>
 
HALIDE_ALWAYS_INLINE auto rewriter (const Expr &e, halide_type_t wildcard_type) noexcept -> Rewriter< decltype(pattern_arg(e))>
 
HALIDE_ALWAYS_INLINE auto rewriter (const Expr &e) noexcept -> Rewriter< decltype(pattern_arg(e))>
 

Variables

constexpr int max_wild = 6
 

Detailed Description

An alternative template-metaprogramming approach to expression matching.

Potentially more efficient. We lift the expression pattern into a type, and then use force-inlined functions to generate efficient matching and reconstruction code for any pattern. Pattern elements are either one of the classes in the namespace IRMatcher, or are non-null Exprs (represented as BaseExprNode &).

Pattern elements that are fully specified by their pattern can be built into an expression using the make method. Some patterns, such as a broadcast that matches any number of lanes, don't have enough information to recreate an Expr.

Function Documentation

◆ make_const_special_expr()

◆ make_const_expr()

◆ equal_helper()

bool Halide::Internal::IRMatcher::equal_helper ( const BaseExprNode a,
const BaseExprNode b 
)
noexcept

Referenced by equal().

◆ equal()

HALIDE_ALWAYS_INLINE bool Halide::Internal::IRMatcher::equal ( const BaseExprNode a,
const BaseExprNode b 
)
noexcept

◆ operator<<() [1/39]

std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const SpecificExpr e 
)
inline

Definition at line 222 of file IRMatch.h.

References Halide::Internal::IRMatcher::SpecificExpr::expr.

◆ operator<<() [2/39]

template<int i>
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const WildConstInt< i > &  c 
)

Definition at line 275 of file IRMatch.h.

◆ operator<<() [3/39]

template<int i>
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const WildConstUInt< i > &  c 
)

Definition at line 328 of file IRMatch.h.

◆ operator<<() [4/39]

template<int i>
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const WildConstFloat< i > &  c 
)

Definition at line 381 of file IRMatch.h.

◆ operator<<() [5/39]

template<int i>
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const WildConst< i > &  c 
)

Definition at line 433 of file IRMatch.h.

◆ operator<<() [6/39]

template<int i>
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const Wild< i > &  op 
)

Definition at line 490 of file IRMatch.h.

◆ pattern_arg() [1/3]

template<typename T , typename = typename std::decay<T>::type::pattern_tag>
HALIDE_ALWAYS_INLINE T Halide::Internal::IRMatcher::pattern_arg ( t)

◆ pattern_arg() [2/3]

HALIDE_ALWAYS_INLINE Const Halide::Internal::IRMatcher::pattern_arg ( int64_t  x)

Definition at line 571 of file IRMatch.h.

◆ pattern_arg() [3/3]

const HALIDE_ALWAYS_INLINE SpecificExpr Halide::Internal::IRMatcher::pattern_arg ( const Expr e)

Definition at line 575 of file IRMatch.h.

◆ unwrap() [1/2]

◆ unwrap() [2/2]

const HALIDE_ALWAYS_INLINE BaseExprNode& Halide::Internal::IRMatcher::unwrap ( const SpecificExpr e)

◆ operator<<() [7/39]

std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const Const op 
)
inline

Definition at line 595 of file IRMatch.h.

References Halide::Internal::IRMatcher::Const::v.

◆ constant_fold_bin_op() [1/3]

template<typename Op >
int64_t Halide::Internal::IRMatcher::constant_fold_bin_op ( halide_type_t ,
int64_t  ,
int64_t   
)
noexcept

◆ constant_fold_bin_op() [2/3]

template<typename Op >
uint64_t Halide::Internal::IRMatcher::constant_fold_bin_op ( halide_type_t ,
uint64_t  ,
uint64_t   
)
noexcept

◆ constant_fold_bin_op() [3/3]

template<typename Op >
double Halide::Internal::IRMatcher::constant_fold_bin_op ( halide_type_t ,
double  ,
double   
)
noexcept

◆ commutative()

constexpr bool Halide::Internal::IRMatcher::commutative ( IRNodeType  t)
constexpr

◆ constant_fold_cmp_op() [1/3]

template<typename Op >
uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op ( int64_t  ,
int64_t   
)
noexcept

◆ constant_fold_cmp_op() [2/3]

template<typename Op >
uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op ( uint64_t  ,
uint64_t   
)
noexcept

◆ constant_fold_cmp_op() [3/3]

template<typename Op >
uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op ( double  ,
double   
)
noexcept

◆ operator<<() [8/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< Add, A, B > &  op 
)

◆ operator<<() [9/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< Sub, A, B > &  op 
)

◆ operator<<() [10/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< Mul, A, B > &  op 
)

◆ operator<<() [11/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< Div, A, B > &  op 
)

◆ operator<<() [12/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< And, A, B > &  op 
)

◆ operator<<() [13/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< Or, A, B > &  op 
)

◆ operator<<() [14/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< Min, A, B > &  op 
)

◆ operator<<() [15/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< Max, A, B > &  op 
)

◆ operator<<() [16/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const CmpOp< LE, A, B > &  op 
)

◆ operator<<() [17/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const CmpOp< LT, A, B > &  op 
)

◆ operator<<() [18/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const CmpOp< GE, A, B > &  op 
)

◆ operator<<() [19/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const CmpOp< GT, A, B > &  op 
)

◆ operator<<() [20/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const CmpOp< EQ, A, B > &  op 
)

◆ operator<<() [21/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const CmpOp< NE, A, B > &  op 
)

◆ operator<<() [22/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BinOp< Mod, A, B > &  op 
)

◆ operator+()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator+ ( a,
b 
) -> BinOp<Add, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 915 of file IRMatch.h.

References pattern_arg().

Referenced by add().

◆ add()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::add ( a,
b 
) -> decltype(IRMatcher::operator+(a, b))

Definition at line 920 of file IRMatch.h.

References operator+().

◆ constant_fold_bin_op< Add >() [1/3]

◆ constant_fold_bin_op< Add >() [2/3]

Definition at line 933 of file IRMatch.h.

◆ constant_fold_bin_op< Add >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< Add > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 939 of file IRMatch.h.

◆ operator-() [1/2]

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator- ( a,
b 
) -> BinOp<Sub, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 944 of file IRMatch.h.

References pattern_arg().

Referenced by negate(), and sub().

◆ sub()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::sub ( a,
b 
) -> decltype(IRMatcher::operator-(a, b))

Definition at line 949 of file IRMatch.h.

References operator-().

◆ constant_fold_bin_op< Sub >() [1/3]

◆ constant_fold_bin_op< Sub >() [2/3]

Definition at line 962 of file IRMatch.h.

◆ constant_fold_bin_op< Sub >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< Sub > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 968 of file IRMatch.h.

◆ operator*()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator* ( a,
b 
) -> BinOp<Mul, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 973 of file IRMatch.h.

References pattern_arg().

Referenced by mul().

◆ mul()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::mul ( a,
b 
) -> decltype(IRMatcher::operator*(a, b))

Definition at line 978 of file IRMatch.h.

References operator*().

◆ constant_fold_bin_op< Mul >() [1/3]

◆ constant_fold_bin_op< Mul >() [2/3]

Definition at line 991 of file IRMatch.h.

◆ constant_fold_bin_op< Mul >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< Mul > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 997 of file IRMatch.h.

◆ operator/()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator/ ( a,
b 
) -> BinOp<Div, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1002 of file IRMatch.h.

References pattern_arg().

Referenced by div().

◆ div()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::div ( a,
b 
) -> decltype(IRMatcher::operator/(a, b))

Definition at line 1007 of file IRMatch.h.

References operator/().

◆ constant_fold_bin_op< Div >() [1/3]

◆ constant_fold_bin_op< Div >() [2/3]

◆ constant_fold_bin_op< Div >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< Div > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 1022 of file IRMatch.h.

References Halide::Internal::div_imp().

◆ operator%()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator% ( a,
b 
) -> BinOp<Mod, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1027 of file IRMatch.h.

References pattern_arg().

Referenced by mod().

◆ mod()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::mod ( a,
b 
) -> decltype(IRMatcher::operator%(a, b))

Definition at line 1032 of file IRMatch.h.

References operator%().

◆ constant_fold_bin_op< Mod >() [1/3]

◆ constant_fold_bin_op< Mod >() [2/3]

◆ constant_fold_bin_op< Mod >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< Mod > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 1047 of file IRMatch.h.

References Halide::Internal::mod_imp().

◆ min()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::min ( a,
b 
) -> BinOp<Min, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1052 of file IRMatch.h.

References pattern_arg().

Referenced by constant_fold_bin_op< Min >().

◆ constant_fold_bin_op< Min >() [1/3]

Definition at line 1057 of file IRMatch.h.

References min().

◆ constant_fold_bin_op< Min >() [2/3]

Definition at line 1062 of file IRMatch.h.

References min().

◆ constant_fold_bin_op< Min >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< Min > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 1067 of file IRMatch.h.

References min().

◆ max()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::max ( a,
b 
) -> BinOp<Max, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1072 of file IRMatch.h.

References pattern_arg().

Referenced by constant_fold_bin_op< Max >().

◆ constant_fold_bin_op< Max >() [1/3]

Definition at line 1077 of file IRMatch.h.

References max().

◆ constant_fold_bin_op< Max >() [2/3]

Definition at line 1082 of file IRMatch.h.

References max().

◆ constant_fold_bin_op< Max >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< Max > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 1087 of file IRMatch.h.

References max().

◆ operator<()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator< ( a,
b 
) -> CmpOp<LT, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1092 of file IRMatch.h.

References pattern_arg().

Referenced by lt().

◆ lt()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::lt ( a,
b 
) -> decltype(IRMatcher::operator<(a, b))

Definition at line 1097 of file IRMatch.h.

References operator<().

◆ constant_fold_cmp_op< LT >() [1/3]

Definition at line 1102 of file IRMatch.h.

◆ constant_fold_cmp_op< LT >() [2/3]

Definition at line 1107 of file IRMatch.h.

◆ constant_fold_cmp_op< LT >() [3/3]

template<>
HALIDE_ALWAYS_INLINE uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op< LT > ( double  a,
double  b 
)
noexcept

Definition at line 1112 of file IRMatch.h.

◆ operator>()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator> ( a,
b 
) -> CmpOp<GT, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1117 of file IRMatch.h.

References pattern_arg().

Referenced by gt().

◆ gt()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::gt ( a,
b 
) -> decltype(IRMatcher::operator>(a, b))

Definition at line 1122 of file IRMatch.h.

References operator>().

◆ constant_fold_cmp_op< GT >() [1/3]

Definition at line 1127 of file IRMatch.h.

◆ constant_fold_cmp_op< GT >() [2/3]

Definition at line 1132 of file IRMatch.h.

◆ constant_fold_cmp_op< GT >() [3/3]

template<>
HALIDE_ALWAYS_INLINE uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op< GT > ( double  a,
double  b 
)
noexcept

Definition at line 1137 of file IRMatch.h.

◆ operator<=()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator<= ( a,
b 
) -> CmpOp<LE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1142 of file IRMatch.h.

References pattern_arg().

Referenced by le().

◆ le()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::le ( a,
b 
) -> decltype(IRMatcher::operator<=(a, b))

Definition at line 1147 of file IRMatch.h.

References operator<=().

◆ constant_fold_cmp_op< LE >() [1/3]

Definition at line 1152 of file IRMatch.h.

◆ constant_fold_cmp_op< LE >() [2/3]

Definition at line 1157 of file IRMatch.h.

◆ constant_fold_cmp_op< LE >() [3/3]

template<>
HALIDE_ALWAYS_INLINE uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op< LE > ( double  a,
double  b 
)
noexcept

Definition at line 1162 of file IRMatch.h.

◆ operator>=()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator>= ( a,
b 
) -> CmpOp<GE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1167 of file IRMatch.h.

References pattern_arg().

Referenced by ge().

◆ ge()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::ge ( a,
b 
) -> decltype(IRMatcher::operator>=(a, b))

Definition at line 1172 of file IRMatch.h.

References operator>=().

◆ constant_fold_cmp_op< GE >() [1/3]

Definition at line 1177 of file IRMatch.h.

◆ constant_fold_cmp_op< GE >() [2/3]

Definition at line 1182 of file IRMatch.h.

◆ constant_fold_cmp_op< GE >() [3/3]

template<>
HALIDE_ALWAYS_INLINE uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op< GE > ( double  a,
double  b 
)
noexcept

Definition at line 1187 of file IRMatch.h.

◆ operator==()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator== ( a,
b 
) -> CmpOp<EQ, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1192 of file IRMatch.h.

References pattern_arg().

Referenced by eq().

◆ eq()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::eq ( a,
b 
) -> decltype(IRMatcher::operator==(a, b))

Definition at line 1197 of file IRMatch.h.

References operator==().

◆ constant_fold_cmp_op< EQ >() [1/3]

Definition at line 1202 of file IRMatch.h.

◆ constant_fold_cmp_op< EQ >() [2/3]

Definition at line 1207 of file IRMatch.h.

◆ constant_fold_cmp_op< EQ >() [3/3]

template<>
HALIDE_ALWAYS_INLINE uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op< EQ > ( double  a,
double  b 
)
noexcept

Definition at line 1212 of file IRMatch.h.

◆ operator!=()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator!= ( a,
b 
) -> CmpOp<NE, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1217 of file IRMatch.h.

References pattern_arg().

Referenced by ne().

◆ ne()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::ne ( a,
b 
) -> decltype(IRMatcher::operator!=(a, b))

Definition at line 1222 of file IRMatch.h.

References operator!=().

◆ constant_fold_cmp_op< NE >() [1/3]

Definition at line 1227 of file IRMatch.h.

◆ constant_fold_cmp_op< NE >() [2/3]

Definition at line 1232 of file IRMatch.h.

◆ constant_fold_cmp_op< NE >() [3/3]

template<>
HALIDE_ALWAYS_INLINE uint64_t Halide::Internal::IRMatcher::constant_fold_cmp_op< NE > ( double  a,
double  b 
)
noexcept

Definition at line 1237 of file IRMatch.h.

◆ operator||()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator|| ( a,
b 
) -> BinOp<Or, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1242 of file IRMatch.h.

References pattern_arg().

Referenced by or_op().

◆ or_op()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::or_op ( a,
b 
) -> decltype(IRMatcher::operator||(a, b))

Definition at line 1247 of file IRMatch.h.

References operator||().

◆ constant_fold_bin_op< Or >() [1/3]

Definition at line 1252 of file IRMatch.h.

◆ constant_fold_bin_op< Or >() [2/3]

Definition at line 1257 of file IRMatch.h.

◆ constant_fold_bin_op< Or >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< Or > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 1262 of file IRMatch.h.

◆ operator&&()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator&& ( a,
b 
) -> BinOp<And, decltype(pattern_arg(a)), decltype(pattern_arg(b))>
noexcept

Definition at line 1268 of file IRMatch.h.

References pattern_arg().

Referenced by and_op().

◆ and_op()

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::and_op ( a,
b 
) -> decltype(IRMatcher::operator&&(a, b))

Definition at line 1273 of file IRMatch.h.

References operator&&().

◆ constant_fold_bin_op< And >() [1/3]

Definition at line 1278 of file IRMatch.h.

◆ constant_fold_bin_op< And >() [2/3]

Definition at line 1283 of file IRMatch.h.

◆ constant_fold_bin_op< And >() [3/3]

template<>
HALIDE_ALWAYS_INLINE double Halide::Internal::IRMatcher::constant_fold_bin_op< And > ( halide_type_t t,
double  a,
double  b 
)
noexcept

Definition at line 1288 of file IRMatch.h.

◆ bitwise_or_reduce() [1/2]

constexpr uint32_t Halide::Internal::IRMatcher::bitwise_or_reduce ( )
inlineconstexpr

Definition at line 1293 of file IRMatch.h.

Referenced by bitwise_or_reduce().

◆ bitwise_or_reduce() [2/2]

template<typename... Args>
constexpr uint32_t Halide::Internal::IRMatcher::bitwise_or_reduce ( uint32_t  first,
Args...  rest 
)
constexpr

Definition at line 1298 of file IRMatch.h.

References bitwise_or_reduce().

◆ and_reduce() [1/2]

constexpr bool Halide::Internal::IRMatcher::and_reduce ( )
inlineconstexpr

Definition at line 1302 of file IRMatch.h.

Referenced by and_reduce().

◆ and_reduce() [2/2]

template<typename... Args>
constexpr bool Halide::Internal::IRMatcher::and_reduce ( bool  first,
Args...  rest 
)
constexpr

Definition at line 1307 of file IRMatch.h.

References and_reduce().

◆ operator<<() [23/39]

template<typename... Args>
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const Intrin< Args... > &  op 
)

◆ intrin()

template<typename... Args>
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::intrin ( Call::IntrinsicOp  intrinsic_op,
Args...  args 
) -> Intrin<decltype(pattern_arg(args))...>
noexcept

Definition at line 1393 of file IRMatch.h.

References pattern_arg().

◆ operator!()

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator! ( a) -> NotOp<decltype(pattern_arg(a))>
noexcept

Definition at line 1438 of file IRMatch.h.

References pattern_arg().

Referenced by not_op().

◆ not_op()

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::not_op ( a) -> decltype(IRMatcher::operator!(a))

Definition at line 1443 of file IRMatch.h.

References operator!().

◆ operator<<() [24/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const NotOp< A > &  op 
)
inline

Definition at line 1448 of file IRMatch.h.

References Halide::Internal::IRMatcher::NotOp< A >::a.

◆ operator<<() [25/39]

template<typename C , typename T , typename F >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const SelectOp< C, T, F > &  op 
)

◆ select()

template<typename C , typename T , typename F >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::select ( c,
t,
f 
) -> SelectOp<decltype(pattern_arg(c)), decltype(pattern_arg(t)), decltype(pattern_arg(f))>
noexcept

Definition at line 1512 of file IRMatch.h.

References pattern_arg().

◆ operator<<() [26/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BroadcastOp< A, true > &  op 
)
inline

◆ operator<<() [27/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const BroadcastOp< A, false > &  op 
)
inline

◆ broadcast() [1/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::broadcast ( a,
int  lanes 
) -> BroadcastOp<decltype(pattern_arg(a)), true>
noexcept

Definition at line 1582 of file IRMatch.h.

References pattern_arg().

◆ broadcast() [2/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::broadcast ( a) -> BroadcastOp<decltype(pattern_arg(a)), false>
noexcept

Definition at line 1587 of file IRMatch.h.

References pattern_arg().

◆ operator<<() [28/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const RampOp< A, B, true > &  op 
)

◆ operator<<() [29/39]

template<typename A , typename B >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const RampOp< A, B, false > &  op 
)

◆ ramp() [1/2]

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::ramp ( a,
b,
int  lanes 
) -> RampOp<decltype(pattern_arg(a)), decltype(pattern_arg(b)), true>
noexcept

Definition at line 1658 of file IRMatch.h.

References pattern_arg().

Referenced by Halide::Internal::HexagonAlignmentAnalyzer::is_aligned_impl().

◆ ramp() [2/2]

template<typename A , typename B >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::ramp ( a,
b 
) -> RampOp<decltype(pattern_arg(a)), decltype(pattern_arg(b)), false>
noexcept

Definition at line 1663 of file IRMatch.h.

References pattern_arg().

◆ operator<<() [30/39]

template<typename A , VectorReduce::Operator reduce_op>
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const VectorReduceOp< A, true, reduce_op > &  op 
)
inline

◆ operator<<() [31/39]

template<typename A , VectorReduce::Operator reduce_op>
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const VectorReduceOp< A, false, reduce_op > &  op 
)
inline

◆ h_add() [1/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_add ( a,
int  lanes 
) -> VectorReduceOp<decltype(pattern_arg(a)), true, VectorReduce::Add>
noexcept

Definition at line 1721 of file IRMatch.h.

References pattern_arg().

◆ h_add() [2/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_add ( a) -> VectorReduceOp<decltype(pattern_arg(a)), false, VectorReduce::Add>
noexcept

Definition at line 1726 of file IRMatch.h.

References pattern_arg().

◆ h_min() [1/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_min ( a,
int  lanes 
) -> VectorReduceOp<decltype(pattern_arg(a)), true, VectorReduce::Min>
noexcept

Definition at line 1731 of file IRMatch.h.

References pattern_arg().

◆ h_min() [2/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_min ( a) -> VectorReduceOp<decltype(pattern_arg(a)), false, VectorReduce::Min>
noexcept

Definition at line 1736 of file IRMatch.h.

References pattern_arg().

◆ h_max() [1/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_max ( a,
int  lanes 
) -> VectorReduceOp<decltype(pattern_arg(a)), true, VectorReduce::Max>
noexcept

Definition at line 1741 of file IRMatch.h.

References pattern_arg().

◆ h_max() [2/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_max ( a) -> VectorReduceOp<decltype(pattern_arg(a)), false, VectorReduce::Max>
noexcept

Definition at line 1746 of file IRMatch.h.

References pattern_arg().

◆ h_and() [1/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_and ( a,
int  lanes 
) -> VectorReduceOp<decltype(pattern_arg(a)), true, VectorReduce::And>
noexcept

Definition at line 1751 of file IRMatch.h.

References pattern_arg().

◆ h_and() [2/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_and ( a) -> VectorReduceOp<decltype(pattern_arg(a)), false, VectorReduce::And>
noexcept

Definition at line 1756 of file IRMatch.h.

References pattern_arg().

◆ h_or() [1/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_or ( a,
int  lanes 
) -> VectorReduceOp<decltype(pattern_arg(a)), true, VectorReduce::Or>
noexcept

Definition at line 1761 of file IRMatch.h.

References pattern_arg().

◆ h_or() [2/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::h_or ( a) -> VectorReduceOp<decltype(pattern_arg(a)), false, VectorReduce::Or>
noexcept

Definition at line 1766 of file IRMatch.h.

References pattern_arg().

◆ operator<<() [32/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const NegateOp< A > &  op 
)

Definition at line 1835 of file IRMatch.h.

References Halide::Internal::IRMatcher::NegateOp< A >::a.

◆ operator-() [2/2]

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::operator- ( a) -> NegateOp<decltype(pattern_arg(a))>
noexcept

Definition at line 1841 of file IRMatch.h.

References pattern_arg().

◆ negate()

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::negate ( a) -> decltype(IRMatcher::operator-(a))

Definition at line 1846 of file IRMatch.h.

References operator-().

◆ operator<<() [33/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const CastOp< A > &  op 
)

◆ cast()

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::cast ( halide_type_t  t,
a 
) -> CastOp<decltype(pattern_arg(a))>
noexcept

◆ fold()

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::fold ( a) -> Fold<decltype(pattern_arg(a))>
noexcept

Definition at line 1923 of file IRMatch.h.

References pattern_arg().

◆ operator<<() [34/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const Fold< A > &  op 
)

Definition at line 1928 of file IRMatch.h.

References Halide::Internal::IRMatcher::Fold< A >::a.

◆ overflows()

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::overflows ( a) -> Overflows<decltype(pattern_arg(a))>
noexcept

Definition at line 1959 of file IRMatch.h.

References pattern_arg().

◆ operator<<() [35/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const Overflows< A > &  op 
)

Definition at line 1964 of file IRMatch.h.

References Halide::Internal::IRMatcher::Overflows< A >::a.

◆ operator<<() [36/39]

std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const Overflow op 
)
inline

Definition at line 2003 of file IRMatch.h.

◆ is_const()

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::is_const ( a) -> IsConst<decltype(pattern_arg(a))>
noexcept

◆ operator<<() [37/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const IsConst< A > &  op 
)

Definition at line 2039 of file IRMatch.h.

References Halide::Internal::IRMatcher::IsConst< A >::a.

◆ can_prove()

template<typename A , typename Prover >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::can_prove ( a,
Prover *  p 
) -> CanProve<decltype(pattern_arg(a)), Prover>
noexcept

Definition at line 2071 of file IRMatch.h.

References pattern_arg().

◆ operator<<() [38/39]

template<typename A , typename Prover >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const CanProve< A, Prover > &  op 
)

Definition at line 2076 of file IRMatch.h.

References Halide::Internal::IRMatcher::CanProve< A, Prover >::a.

◆ is_float()

template<typename A >
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::is_float ( a) -> IsFloat<decltype(pattern_arg(a))>
noexcept

Definition at line 2107 of file IRMatch.h.

References pattern_arg().

◆ operator<<() [39/39]

template<typename A >
std::ostream& Halide::Internal::IRMatcher::operator<< ( std::ostream &  s,
const IsFloat< A > &  op 
)

Definition at line 2112 of file IRMatch.h.

References Halide::Internal::IRMatcher::IsFloat< A >::a.

◆ fuzz_test_rule() [1/2]

◆ fuzz_test_rule() [2/2]

template<typename Before , typename After , typename Predicate , typename = typename std::enable_if<!(std::decay<Before>::type::foldable && std::decay<After>::type::foldable)>::type>
HALIDE_ALWAYS_INLINE void Halide::Internal::IRMatcher::fuzz_test_rule ( Before &&  before,
After &&  after,
Predicate &&  pred,
halide_type_t  ,
halide_type_t  ,
int  dummy = 0 
)
noexcept

Definition at line 2242 of file IRMatch.h.

◆ evaluate_predicate() [1/2]

HALIDE_ALWAYS_INLINE bool Halide::Internal::IRMatcher::evaluate_predicate ( bool  x,
MatcherState  
)
noexcept

◆ evaluate_predicate() [2/2]

template<typename Pattern , typename = typename enable_if_pattern<Pattern>::type>
HALIDE_ALWAYS_INLINE bool Halide::Internal::IRMatcher::evaluate_predicate ( Pattern  p,
MatcherState state 
)

◆ rewriter() [1/4]

template<typename Instance , typename = typename enable_if_pattern<Instance>::type>
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::rewriter ( Instance  instance,
halide_type_t  output_type,
halide_type_t  wildcard_type 
) -> Rewriter<decltype(pattern_arg(instance))>
noexcept

Construct a rewriter for the given instance, which may be a pattern with concrete expressions as leaves, or just an expression.

The second optional argument (wildcard_type) is a hint as to what the type of the wildcards is likely to be. If omitted it uses the same type as the expression itself. They are not required to be this type, but the rule will only be tested for wildcards of that type when testing is enabled.

The rewriter can be used to check to see if the instance is one of some number of patterns and if so rewrite it into another form, using its operator() method. See Simplify.cpp for a bunch of example usage.

Definition at line 2451 of file IRMatch.h.

References pattern_arg().

◆ rewriter() [2/4]

template<typename Instance , typename = typename enable_if_pattern<Instance>::type>
HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::rewriter ( Instance  instance,
halide_type_t  output_type 
) -> Rewriter<decltype(pattern_arg(instance))>
noexcept

Definition at line 2457 of file IRMatch.h.

References pattern_arg().

◆ rewriter() [3/4]

HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::rewriter ( const Expr e,
halide_type_t  wildcard_type 
) -> Rewriter<decltype(pattern_arg(e))>
noexcept

Definition at line 2462 of file IRMatch.h.

References pattern_arg().

◆ rewriter() [4/4]

HALIDE_ALWAYS_INLINE auto Halide::Internal::IRMatcher::rewriter ( const Expr e) -> Rewriter<decltype(pattern_arg(e))>
noexcept

Definition at line 2467 of file IRMatch.h.

References pattern_arg().

Variable Documentation

◆ max_wild