13#ifndef CIRCT_DIALECT_RTG_IR_RTGVISITORS_H
14#define CIRCT_DIALECT_RTG_IR_RTGVISITORS_H
17#include "llvm/ADT/TypeSwitch.h"
23template <
typename ConcreteType,
typename ResultType = void,
24 typename... ExtraArgs>
28 auto *thisCast =
static_cast<ConcreteType *
>(
this);
29 return TypeSwitch<Operation *, ResultType>(op)
34 BagCreateOp, BagSelectRandomOp, BagDifferenceOp, BagUnionOp,
35 BagUniqueSizeOp, BagConvertToSetOp,
37 OnContextOp, ContextSwitchOp,
39 StringToLabelOp, LabelUniqueDeclOp, LabelOp,
41 VirtualRegisterOp, RegisterToIndexOp, IndexToRegisterOp,
43 TestOp, TargetOp, YieldOp, ValidateOp, TestSuccessOp, TestFailureOp,
45 RandomNumberInRangeOp,
47 SequenceOp, GetSequenceOp, SubstituteSequenceOp,
48 RandomizeSequenceOp, EmbedSequenceOp, InterleaveSequencesOp,
50 SetCreateOp, SetSelectRandomOp, SetDifferenceOp, SetUnionOp,
51 SetSizeOp, SetCartesianProductOp, SetConvertToBagOp,
53 ArrayCreateOp, ArrayExtractOp, ArrayInjectOp, ArraySizeOp,
56 TupleCreateOp, TupleExtractOp,
58 IntToImmediateOp, ConcatImmediateOp, SliceImmediateOp,
60 MemoryAllocOp, MemoryBaseAddressOp, MemorySizeOp,
64 SpaceOp, StringDataOp, SegmentOp,
66 StringConcatOp, IntFormatOp, ImmediateFormatOp, RegisterFormatOp,
68 CommentOp, ConstraintOp, RandomScopeOp>(
69 [&](
auto expr) -> ResultType {
70 return thisCast->visitOp(expr, args...);
72 .Default([&](
auto expr) -> ResultType {
73 if (op->getDialect() ==
74 op->getContext()->getLoadedDialect<RTGDialect>())
77 return thisCast->visitExternalOp(op, args...);
84 op->emitOpError(
"Unknown RTG operation: ") << op->getName();
96#define HANDLE(OPTYPE, OPKIND) \
97 ResultType visitOp(OPTYPE op, ExtraArgs... args) { \
98 return static_cast<ConcreteType *>(this)->visit##OPKIND##Op(op, args...); \
106 HANDLE(InterleaveSequencesOp, Unhandled);
108 HANDLE(RandomNumberInRangeOp, Unhandled);
116 HANDLE(SetCartesianProductOp, Unhandled);
This helps visit TypeOp nodes.
HANDLE(ConcatImmediateOp, Unhandled)
HANDLE(SegmentOp, Unhandled)
HANDLE(ValidateOp, Unhandled)
HANDLE(MemoryAllocOp, Unhandled)
HANDLE(YieldOp, Unhandled)
HANDLE(IntFormatOp, Unhandled)
HANDLE(ConstraintOp, Unhandled)
ResultType visitExternalOp(Operation *op, ExtraArgs... args)
HANDLE(TupleCreateOp, Unhandled)
HANDLE(MemorySizeOp, Unhandled)
HANDLE(MemoryBaseAddressOp, Unhandled)
HANDLE(TestOp, Unhandled)
HANDLE(ArrayInjectOp, Unhandled)
ResultType visitInvalidTypeOp(Operation *op, ExtraArgs... args)
This callback is invoked on any RTG operations not handled properly by the TypeSwitch.
HANDLE(BagUniqueSizeOp, Unhandled)
HANDLE(EmbedSequenceOp, Unhandled)
HANDLE(OnContextOp, Unhandled)
HANDLE(BagCreateOp, Unhandled)
HANDLE(LabelUniqueDeclOp, Unhandled)
HANDLE(TestSuccessOp, Unhandled)
HANDLE(ConstantOp, Unhandled)
HANDLE(SpaceOp, Unhandled)
HANDLE(ArrayAppendOp, Unhandled)
HANDLE(TestFailureOp, Unhandled)
HANDLE(StringConcatOp, Unhandled)
HANDLE(SetUnionOp, Unhandled)
HANDLE(SliceImmediateOp, Unhandled)
HANDLE(ContextSwitchOp, Unhandled)
HANDLE(RandomizeSequenceOp, Unhandled)
HANDLE(IntToImmediateOp, Unhandled)
HANDLE(BagConvertToSetOp, Unhandled)
HANDLE(VirtualRegisterOp, Unhandled)
HANDLE(SetConvertToBagOp, Unhandled)
HANDLE(BagDifferenceOp, Unhandled)
HANDLE(InterleaveSequencesOp, Unhandled)
HANDLE(StringToLabelOp, Unhandled)
HANDLE(ImmediateFormatOp, Unhandled)
HANDLE(RandomNumberInRangeOp, Unhandled)
HANDLE(BagUnionOp, Unhandled)
HANDLE(StringDataOp, Unhandled)
HANDLE(SetCartesianProductOp, Unhandled)
HANDLE(SetDifferenceOp, Unhandled)
HANDLE(TargetOp, Unhandled)
HANDLE(SetSizeOp, Unhandled)
HANDLE(SetCreateOp, Unhandled)
HANDLE(SetSelectRandomOp, Unhandled)
HANDLE(BagSelectRandomOp, Unhandled)
ResultType dispatchOpVisitor(Operation *op, ExtraArgs... args)
HANDLE(RandomScopeOp, Unhandled)
HANDLE(CommentOp, Unhandled)
HANDLE(SubstituteSequenceOp, Unhandled)
HANDLE(RegisterToIndexOp, Unhandled)
ResultType visitUnhandledOp(Operation *op, ExtraArgs... args)
This callback is invoked on any operations that are not handled by the concrete visitor.
HANDLE(LabelOp, Unhandled)
HANDLE(IndexToRegisterOp, Unhandled)
HANDLE(MemoryBlockDeclareOp, Unhandled)
HANDLE(ArrayExtractOp, Unhandled)
HANDLE(ArrayCreateOp, Unhandled)
HANDLE(RegisterFormatOp, Unhandled)
HANDLE(SequenceOp, Unhandled)
HANDLE(TupleExtractOp, Unhandled)
HANDLE(ArraySizeOp, Unhandled)
HANDLE(GetSequenceOp, Unhandled)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.