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 EffectOp, WithHandlersOp, PerformOp, ResumeOp>(
72 [&](
auto expr) -> ResultType {
73 return thisCast->visitOp(expr, args...);
75 .Default([&](
auto expr) -> ResultType {
76 if (op->getDialect() ==
77 op->getContext()->getLoadedDialect<RTGDialect>())
80 return thisCast->visitExternalOp(op, args...);
87 op->emitOpError(
"Unknown RTG operation: ") << op->getName();
99#define HANDLE(OPTYPE, OPKIND) \
100 ResultType visitOp(OPTYPE op, ExtraArgs... args) { \
101 return static_cast<ConcreteType *>(this)->visit##OPKIND##Op(op, args...); \
109 HANDLE(InterleaveSequencesOp, Unhandled);
111 HANDLE(RandomNumberInRangeOp, Unhandled);
119 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(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(PerformOp, Unhandled)
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(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.