13#ifndef MLIR_DIALECT_SMT_IR_SMTVISITORS_H
14#define MLIR_DIALECT_SMT_IR_SMTVISITORS_H
18#include <llvm/ADT/TypeSwitch.h>
23template <
typename ConcreteType,
typename ResultType = void,
typename... ExtraArgs>
27 auto *thisCast =
static_cast<ConcreteType *
>(
this);
28 return mlir::TypeSwitch<mlir::Operation *, ResultType>(op)
53 return thisCast->visitSMTOp(expr, args...);
54 }).Default([&](
auto) -> ResultType {
return thisCast->visitInvalidSMTOp(op, args...); });
59 op->emitOpError(
"unknown SMT node");
69#define HANDLE(OPTYPE, OPKIND) \
70 ResultType visitSMTOp(OPTYPE op, ExtraArgs... args) { \
71 return static_cast<ConcreteType *>(this)->visit##OPKIND##SMTOp(op, args...); \
151template <
typename ConcreteType,
typename ResultType = void,
typename... ExtraArgs>
155 auto *thisCast =
static_cast<ConcreteType *
>(
this);
156 return mlir::TypeSwitch<mlir::Type, ResultType>(type)
157 .template Case<BoolType, IntType, BitVectorType, ArrayType, SMTFuncType, SortType>(
158 [&](
auto expr) -> ResultType {
return thisCast->visitSMTType(expr, args...); }
160 .Default([&](
auto) -> ResultType {
return thisCast->visitInvalidSMTType(type, args...); });
172#define HANDLE(TYPE, KIND) \
173 ResultType visitSMTType(TYPE op, ExtraArgs... args) { \
174 return static_cast<ConcreteType *>(this)->visit##KIND##SMTType(op, args...); \
This helps visit SMT nodes.
HANDLE(IntMulOp, Unhandled)
HANDLE(BVURemOp, Unhandled)
HANDLE(ResetOp, Unhandled)
HANDLE(ForallOp, Unhandled)
HANDLE(ArrayStoreOp, Unhandled)
HANDLE(BVLShrOp, Unhandled)
HANDLE(BVUDivOp, Unhandled)
HANDLE(BoolConstantOp, Unhandled)
HANDLE(BVShlOp, Unhandled)
HANDLE(BVAShrOp, Unhandled)
HANDLE(PushOp, Unhandled)
HANDLE(ImpliesOp, Unhandled)
HANDLE(ExistsOp, Unhandled)
HANDLE(IntAddOp, Unhandled)
HANDLE(IntSubOp, Unhandled)
HANDLE(BVConstantOp, Unhandled)
HANDLE(RepeatOp, Unhandled)
HANDLE(Int2BVOp, Unhandled)
HANDLE(ConcatOp, Unhandled)
HANDLE(SetLogicOp, Unhandled)
HANDLE(AssertOp, Unhandled)
HANDLE(BVMulOp, Unhandled)
ResultType dispatchSMTOpVisitor(mlir::Operation *op, ExtraArgs... args)
ResultType visitUnhandledSMTOp(mlir::Operation *, ExtraArgs...)
This callback is invoked on any SMT operations that are not handled by the concrete visitor.
HANDLE(BV2IntOp, Unhandled)
HANDLE(SolverOp, Unhandled)
ResultType visitInvalidSMTOp(mlir::Operation *op, ExtraArgs...)
This callback is invoked on any non-expression operations.
HANDLE(IntModOp, Unhandled)
HANDLE(BVSRemOp, Unhandled)
HANDLE(BVAddOp, Unhandled)
HANDLE(IntConstantOp, Unhandled)
HANDLE(BVAndOp, Unhandled)
HANDLE(BVXOrOp, Unhandled)
HANDLE(BVNotOp, Unhandled)
HANDLE(CheckOp, Unhandled)
HANDLE(BVSDivOp, Unhandled)
HANDLE(BVNegOp, Unhandled)
HANDLE(ArraySelectOp, Unhandled)
HANDLE(YieldOp, Unhandled)
HANDLE(ExtractOp, Unhandled)
HANDLE(ApplyFuncOp, Unhandled)
HANDLE(DistinctOp, Unhandled)
HANDLE(IntDivOp, Unhandled)
HANDLE(BVCmpOp, Unhandled)
HANDLE(IntCmpOp, Unhandled)
HANDLE(BVOrOp, Unhandled)
HANDLE(BVSModOp, Unhandled)
HANDLE(DeclareFunOp, Unhandled)
HANDLE(ArrayBroadcastOp, Unhandled)
This helps visit SMT types.
HANDLE(BoolType, Unhandled)
HANDLE(SortType, Unhandled)
HANDLE(IntType, Unhandled)
HANDLE(BitVectorType, Unhandled)
HANDLE(SMTFuncType, Unhandled)
HANDLE(ArrayType, Unhandled)
ResultType visitInvalidSMTType(mlir::Type, ExtraArgs...)
This callback is invoked on any non-expression types.
ResultType dispatchSMTTypeVisitor(mlir::Type type, ExtraArgs... args)
ResultType visitUnhandledSMTType(mlir::Type, ExtraArgs...)
This callback is invoked on any SMT type that are not handled by the concrete visitor.