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,
69 CommentOp, ConstraintOp, RandomScopeOp,
71 MutCreateOp, MutReadOp, MutWriteOp,
73 EffectOp, WithHandlersOp, PerformOp, ResumeOp>(
74 [&](
auto expr) -> ResultType {
75 return thisCast->visitOp(expr, args...);
77 .Default([&](
auto expr) -> ResultType {
78 if (op->getDialect() ==
79 op->getContext()->getLoadedDialect<RTGDialect>())
82 return thisCast->visitExternalOp(op, args...);
89 op->emitOpError(
"Unknown RTG operation: ") << op->getName();
101#define HANDLE(OPTYPE, OPKIND) \
102 ResultType visitOp(OPTYPE op, ExtraArgs... args) { \
103 return static_cast<ConcreteType *>(this)->visit##OPKIND##Op(op, args...); \
111 HANDLE(InterleaveSequencesOp, Unhandled);
113 HANDLE(RandomNumberInRangeOp, Unhandled);
121 HANDLE(SetCartesianProductOp, Unhandled);
This helps visit TypeOp nodes.
HANDLE(ConcatImmediateOp, Unhandled)
HANDLE(SegmentOp, Unhandled)
HANDLE(EffectOp, 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(ResumeOp, 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(MutReadOp, Unhandled)
HANDLE(RandomNumberInRangeOp, Unhandled)
HANDLE(BagUnionOp, Unhandled)
HANDLE(StringDataOp, Unhandled)
HANDLE(SetCartesianProductOp, Unhandled)
HANDLE(WithHandlersOp, 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(MutCreateOp, Unhandled)
HANDLE(PerformOp, Unhandled)
HANDLE(RandomScopeOp, Unhandled)
HANDLE(CommentOp, Unhandled)
HANDLE(SubstituteSequenceOp, Unhandled)
HANDLE(MutWriteOp, 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(StringToASCIIArrayOp, 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.