13 #ifndef MLIR_DIALECT_SMT_IR_SMTVISITORS_H
14 #define MLIR_DIALECT_SMT_IR_SMTVISITORS_H
17 #include "llvm/ADT/TypeSwitch.h"
23 template <
typename ConcreteType,
typename ResultType = void,
24 typename... ExtraArgs>
28 auto *thisCast =
static_cast<ConcreteType *
>(
this);
32 BoolConstantOp, IntConstantOp, BVConstantOp,
34 BVNegOp, BVAddOp, BVMulOp, BVURemOp, BVSRemOp, BVSModOp, BVShlOp,
35 BVLShrOp, BVAShrOp, BVUDivOp, BVSDivOp,
37 BVNotOp, BVAndOp, BVOrOp, BVXOrOp,
39 ConcatOp, ExtractOp, RepeatOp, BVCmpOp, BV2IntOp,
41 IntAddOp, IntMulOp, IntSubOp, IntDivOp, IntModOp, IntCmpOp,
44 EqOp, DistinctOp, IteOp,
46 DeclareFunOp, ApplyFuncOp,
48 SolverOp, AssertOp, ResetOp, PushOp, PopOp, CheckOp, SetLogicOp,
50 NotOp, AndOp, OrOp, XOrOp, ImpliesOp,
52 ArrayStoreOp, ArraySelectOp, ArrayBroadcastOp,
54 ForallOp, ExistsOp, YieldOp>([&](
auto expr) -> ResultType {
55 return thisCast->visitSMTOp(expr, args...);
57 .Default([&](
auto expr) -> ResultType {
58 return thisCast->visitInvalidSMTOp(op, args...);
74 #define HANDLE(OPTYPE, OPKIND) \
75 ResultType visitSMTOp(OPTYPE op, ExtraArgs... args) { \
76 return static_cast<ConcreteType *>(this)->visit##OPKIND##SMTOp(op, \
157 template <
typename ConcreteType,
typename ResultType = void,
158 typename... ExtraArgs>
162 auto *thisCast =
static_cast<ConcreteType *
>(
this);
164 .template Case<BoolType, IntType, BitVectorType, ArrayType, SMTFuncType,
165 SortType>([&](
auto expr) -> ResultType {
166 return thisCast->visitSMTType(expr, args...);
168 .Default([&](
auto expr) -> ResultType {
169 return thisCast->visitInvalidSMTType(type, args...);
182 #define HANDLE(TYPE, KIND) \
183 ResultType visitSMTType(TYPE op, ExtraArgs... args) { \
184 return static_cast<ConcreteType *>(this)->visit##KIND##SMTType(op, \
Operation is the basic unit of execution within MLIR.
InFlightDiagnostic emitOpError(const Twine &message={})
Emit an error with the op name prefixed, like "'dim' op " which is convenient for verifiers.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
This helps visit SMT nodes.
HANDLE(BoolConstantOp, Unhandled)
ResultType visitUnhandledSMTOp(Operation *op, ExtraArgs... args)
This callback is invoked on any SMT operations that are not handled by the concrete visitor.
HANDLE(BVConstantOp, Unhandled)
HANDLE(BVSRemOp, Unhandled)
HANDLE(IntConstantOp, Unhandled)
HANDLE(BV2IntOp, Unhandled)
HANDLE(YieldOp, Unhandled)
HANDLE(BVNotOp, Unhandled)
HANDLE(IntMulOp, Unhandled)
HANDLE(BVAddOp, Unhandled)
ResultType visitInvalidSMTOp(Operation *op, ExtraArgs... args)
This callback is invoked on any non-expression operations.
HANDLE(RepeatOp, Unhandled)
HANDLE(BVXOrOp, Unhandled)
HANDLE(BVLShrOp, Unhandled)
ResultType dispatchSMTOpVisitor(Operation *op, ExtraArgs... args)
HANDLE(SolverOp, Unhandled)
HANDLE(BVUDivOp, Unhandled)
HANDLE(PushOp, Unhandled)
HANDLE(SetLogicOp, Unhandled)
HANDLE(ExtractOp, Unhandled)
HANDLE(IntCmpOp, Unhandled)
HANDLE(Int2BVOp, Unhandled)
HANDLE(BVCmpOp, Unhandled)
HANDLE(BVSModOp, Unhandled)
HANDLE(BVNegOp, Unhandled)
HANDLE(IntAddOp, Unhandled)
HANDLE(IntSubOp, Unhandled)
HANDLE(BVShlOp, Unhandled)
HANDLE(BVSDivOp, Unhandled)
HANDLE(BVOrOp, Unhandled)
HANDLE(ImpliesOp, Unhandled)
HANDLE(BVMulOp, Unhandled)
HANDLE(BVURemOp, Unhandled)
HANDLE(CheckOp, Unhandled)
HANDLE(ArraySelectOp, Unhandled)
HANDLE(DistinctOp, Unhandled)
HANDLE(ArrayBroadcastOp, Unhandled)
HANDLE(BVAndOp, Unhandled)
HANDLE(AssertOp, Unhandled)
HANDLE(DeclareFunOp, Unhandled)
HANDLE(ApplyFuncOp, Unhandled)
HANDLE(IntDivOp, Unhandled)
HANDLE(ResetOp, Unhandled)
HANDLE(ConcatOp, Unhandled)
HANDLE(ArrayStoreOp, Unhandled)
HANDLE(IntModOp, Unhandled)
HANDLE(ForallOp, Unhandled)
HANDLE(ExistsOp, Unhandled)
HANDLE(BVAShrOp, Unhandled)
This helps visit SMT types.
ResultType visitInvalidSMTType(Type type, ExtraArgs... args)
This callback is invoked on any non-expression types.
HANDLE(BoolType, Unhandled)
ResultType dispatchSMTTypeVisitor(Type type, ExtraArgs... args)
HANDLE(IntegerType, Unhandled)
HANDLE(ArrayType, Unhandled)
HANDLE(SMTFuncType, Unhandled)
ResultType visitUnhandledSMTType(Type type, ExtraArgs... args)
This callback is invoked on any SMT type that are not handled by the concrete visitor.
HANDLE(BitVectorType, Unhandled)
HANDLE(SortType, Unhandled)
Include the generated interface declarations.