13 #ifndef CIRCT_DIALECT_COMB_COMBVISITORS_H
14 #define CIRCT_DIALECT_COMB_COMBVISITORS_H
17 #include "llvm/ADT/TypeSwitch.h"
23 template <
typename ConcreteType,
typename ResultType = void,
24 typename... ExtraArgs>
28 auto *thisCast =
static_cast<ConcreteType *
>(
this);
29 return TypeSwitch<Operation *, ResultType>(op)
32 AddOp, SubOp, MulOp, DivUOp, DivSOp, ModUOp, ModSOp, ShlOp, ShrUOp,
41 ConcatOp, ReplicateOp, ExtractOp, MuxOp>(
42 [&](
auto expr) -> ResultType {
43 return thisCast->visitComb(expr, args...);
45 .Default([&](
auto expr) -> ResultType {
46 return thisCast->visitInvalidComb(op, args...);
52 op->emitOpError(
"unknown combinational node");
76 #define HANDLE(OPTYPE, OPKIND) \
77 ResultType visitComb(OPTYPE op, ExtraArgs... args) { \
78 return static_cast<ConcreteType *>(this)->visit##OPKIND##Comb(op, \
This helps visit Combinational nodes.
HANDLE(ReplicateOp, Unhandled)
HANDLE(ExtractOp, Unhandled)
ResultType visitUnaryComb(Operation *op, ExtraArgs... args)
ResultType visitVariadicComb(Operation *op, ExtraArgs... args)
ResultType visitBinaryComb(Operation *op, ExtraArgs... args)
This fallback is invoked on any binary node that isn't explicitly handled.
ResultType visitInvalidComb(Operation *op, ExtraArgs... args)
This callback is invoked on any non-expression operations.
ResultType visitUnhandledComb(Operation *op, ExtraArgs... args)
This callback is invoked on any combinational operations that are not handled by the concrete visitor...
HANDLE(ConcatOp, Unhandled)
ResultType dispatchCombinationalVisitor(Operation *op, ExtraArgs... args)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.