13 #ifndef CIRCT_DIALECT_FIRRTL_CHIRRTLVISITORS_H
14 #define CIRCT_DIALECT_FIRRTL_CHIRRTLVISITORS_H
18 #include "llvm/ADT/TypeSwitch.h"
24 template <
typename ConcreteType,
typename ResultType = void,
25 typename... ExtraArgs>
29 auto *thisCast =
static_cast<ConcreteType *
>(
this);
30 return TypeSwitch<Operation *, ResultType>(op)
31 .template Case<CombMemOp, MemoryPortOp, MemoryDebugPortOp,
32 MemoryPortAccessOp, SeqMemOp>(
33 [&](
auto opNode) -> ResultType {
34 return thisCast->visitCHIRRTL(opNode, args...);
36 .Default([&](
auto expr) -> ResultType {
37 return thisCast->visitInvalidCHIRRTL(op, args...);
43 op->emitOpError(
"unknown chirrtl op");
53 #define HANDLE(OPTYPE) \
54 ResultType visitCHIRRTL(OPTYPE op, ExtraArgs... args) { \
55 return static_cast<ConcreteType *>(this)->visitUnhandledCHIRRTL(op, \
CHIRRTLVisitor is a visitor for CHIRRTL operations.
ResultType visitUnhandledCHIRRTL(Operation *op, ExtraArgs... args)
This callback is invoked on any CHIRRTL operations that are not handled by the concrete visitor.
ResultType visitInvalidCHIRRTL(Operation *op, ExtraArgs... args)
This callback is invoked on any non-CHIRRTL operations.
ResultType dispatchCHIRRTLVisitor(Operation *op, ExtraArgs... args)
HANDLE(MemoryDebugPortOp)
HANDLE(MemoryPortAccessOp)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.