10#define REGISTER(CLASS) phys_opt.register_operator<interpreter::CLASS>();
15#define ACCEPT(CLASS) \
16 void CLASS::accept(MatchBaseVisitor &v) { v(*this); } \
17 void CLASS::accept(ConstMatchBaseVisitor &v) const { v(*this); }
23template<
bool C,
bool PreOrder>
27 template<
typename T>
using Const =
typename super::template Const<T>;
28 using callback_t = std::conditional_t<C, ConstMatchBaseVisitor, MatchBaseVisitor>;
31 callback_t &callback_;
34 recursive_matchbase_visitor(callback_t &callback) : callback_(callback) { }
36 using super::operator();
37#define DECLARE(CLASS) \
38 void operator()(Const<CLASS> &M) override { \
39 if constexpr (PreOrder) try { callback_(M); } catch (visit_skip_subtree) { return; } \
40 super::operator()(M); \
41 if constexpr (not PreOrder) callback_(M); \
52 recursive_matchbase_visitor<C,
true>{*
this}(M);
58 recursive_matchbase_visitor<C,
false>{*
this}(M);
#define M_INTERPRETER_MATCH_LIST(X)
#define M_OPERATOR_LIST(X)
The physical optimizer interface.
void operator()(Const< MatchBase > &)
typename super::template Const< T > Const
typename super::template Const< T > Const
void operator()(Const< MatchBase > &)
A generic base class for implementing recursive interpreter::MatchBase visitors.