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)
32 ConstantOp, StructDeclOp, VariantDeclOp,
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 StructCreateOp, StructExtractOp,
60 VariantCreateOp, VariantMatchOp,
62 IntToImmediateOp, ConcatImmediateOp, SliceImmediateOp,
64 MemoryAllocOp, MemoryBaseAddressOp, MemorySizeOp,
68 SpaceOp, StringDataOp, SegmentOp,
70 StringConcatOp, IntFormatOp, ImmediateFormatOp, RegisterFormatOp,
73 CommentOp, ConstraintOp, RandomScopeOp,
75 MutCreateOp, MutReadOp, MutWriteOp,
77 EffectOp, WithHandlersOp, PerformOp, ResumeOp>(
78 [&](
auto expr) -> ResultType {
79 return thisCast->visitOp(expr, args...);
81 .Default([&](
auto expr) -> ResultType {
82 if (op->getDialect() ==
83 op->getContext()->getLoadedDialect<RTGDialect>())
86 return thisCast->visitExternalOp(op, args...);
93 op->emitOpError(
"Unknown RTG operation: ") << op->getName();
105#define HANDLE(OPTYPE, OPKIND) \
106 ResultType visitOp(OPTYPE op, ExtraArgs... args) { \
107 return static_cast<ConcreteType *>(this)->visit##OPKIND##Op(op, args...); \
117 HANDLE(InterleaveSequencesOp, Unhandled);
119 HANDLE(RandomNumberInRangeOp, Unhandled);
127 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(StructExtractOp, Unhandled)
HANDLE(RandomizeSequenceOp, Unhandled)
HANDLE(IntToImmediateOp, Unhandled)
HANDLE(StructDeclOp, Unhandled)
HANDLE(BagConvertToSetOp, Unhandled)
HANDLE(VirtualRegisterOp, Unhandled)
HANDLE(SetConvertToBagOp, Unhandled)
HANDLE(BagDifferenceOp, Unhandled)
HANDLE(InterleaveSequencesOp, Unhandled)
HANDLE(StringToLabelOp, Unhandled)
HANDLE(VariantMatchOp, 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(VariantDeclOp, 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(StructCreateOp, Unhandled)
HANDLE(IndexToRegisterOp, Unhandled)
HANDLE(StringToASCIIArrayOp, Unhandled)
HANDLE(MemoryBlockDeclareOp, Unhandled)
HANDLE(ArrayExtractOp, Unhandled)
HANDLE(VariantCreateOp, 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.