CIRCT 23.0.0git
Loading...
Searching...
No Matches
FIRRTLVisitors.h
Go to the documentation of this file.
1//===- FIRRTLVisitors.h - FIRRTL Dialect Visitors ---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines visitors that make it easier to work with FIRRTL IR.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef CIRCT_DIALECT_FIRRTL_FIRRTLVISITORS_H
14#define CIRCT_DIALECT_FIRRTL_FIRRTLVISITORS_H
15
17#include "mlir/IR/BuiltinOps.h"
18#include "llvm/ADT/TypeSwitch.h"
19
20namespace circt {
21namespace firrtl {
22
23/// ExprVisitor is a visitor for FIRRTL expression nodes.
24template <typename ConcreteType, typename ResultType = void,
25 typename... ExtraArgs>
27public:
28 ResultType dispatchExprVisitor(Operation *op, ExtraArgs... args) {
29 auto *thisCast = static_cast<ConcreteType *>(this);
30 return TypeSwitch<Operation *, ResultType>(op)
31 // Basic Expressions
32 .template Case<
33 ConstantOp, SpecialConstantOp, AggregateConstantOp, InvalidValueOp,
34 SubfieldOp, SubindexOp, SubaccessOp, IsTagOp, SubtagOp,
35 BundleCreateOp, VectorCreateOp, FEnumCreateOp, MultibitMuxOp,
36 TagExtractOp, OpenSubfieldOp, OpenSubindexOp, ObjectSubfieldOp,
37 DomainSubfieldOp, ObjectAnyRefCastOp,
38 // Arithmetic and Logical Binary Primitives.
39 AddPrimOp, SubPrimOp, MulPrimOp, DivPrimOp, RemPrimOp, AndPrimOp,
40 OrPrimOp, XorPrimOp,
41 // Elementwise operations,
42 ElementwiseOrPrimOp, ElementwiseAndPrimOp, ElementwiseXorPrimOp,
43 // Comparisons.
44 LEQPrimOp, LTPrimOp, GEQPrimOp, GTPrimOp, EQPrimOp, NEQPrimOp,
45 // Misc Binary Primitives.
46 CatPrimOp, DShlPrimOp, DShlwPrimOp, DShrPrimOp,
47 // Unary operators.
48 AsSIntPrimOp, AsUIntPrimOp, AsAsyncResetPrimOp, AsResetPrimOp,
49 AsClockPrimOp, CvtPrimOp, NegPrimOp, NotPrimOp, AndRPrimOp,
50 OrRPrimOp, XorRPrimOp,
51 // Intrinsic Expressions.
52 IsXIntrinsicOp, PlusArgsValueIntrinsicOp, PlusArgsTestIntrinsicOp,
53 SizeOfIntrinsicOp, ClockGateIntrinsicOp, ClockInverterIntrinsicOp,
54 ClockDividerIntrinsicOp, LTLAndIntrinsicOp, LTLOrIntrinsicOp,
55 LTLIntersectIntrinsicOp, LTLDelayIntrinsicOp, LTLConcatIntrinsicOp,
56 LTLRepeatIntrinsicOp, LTLGoToRepeatIntrinsicOp,
57 LTLNonConsecutiveRepeatIntrinsicOp, LTLNotIntrinsicOp,
58 LTLImplicationIntrinsicOp, LTLUntilIntrinsicOp,
59 LTLEventuallyIntrinsicOp, LTLPastIntrinsicOp, LTLClockIntrinsicOp,
60 Mux2CellIntrinsicOp, Mux4CellIntrinsicOp, HasBeenResetIntrinsicOp,
61 // Miscellaneous.
62 BitsPrimOp, HeadPrimOp, MuxPrimOp, PadPrimOp, ShlPrimOp, ShrPrimOp,
63 TailPrimOp, VerbatimExprOp, HWStructCastOp, BitCastOp, RefSendOp,
64 RefResolveOp, RefSubOp, RWProbeOp, XMRRefOp, XMRDerefOp,
65 UnsafeDomainCastOp,
66 // Casts to deal with weird stuff
67 UninferredResetCastOp, ConstCastOp, RefCastOp,
68 // Property expressions.
69 StringConstantOp, FIntegerConstantOp, BoolConstantOp,
70 DoubleConstantOp, ListCreateOp, ListConcatOp, UnresolvedPathOp,
71 PathOp, IntegerAddOp, IntegerMulOp, IntegerShrOp, StringConcatOp,
72 UnknownValueOp,
73 // Format String expressions
74 TimeOp, HierarchicalModuleNameOp>([&](auto expr) -> ResultType {
75 return thisCast->visitExpr(expr, args...);
76 })
77 .Default([&](auto expr) -> ResultType {
78 return thisCast->visitInvalidExpr(op, args...);
79 });
80 }
81
82 /// This callback is invoked on any non-expression operations.
83 ResultType visitInvalidExpr(Operation *op, ExtraArgs... args) {
84 op->emitOpError("unknown FIRRTL expression");
85 abort();
86 }
87
88 /// This callback is invoked on any expression operations that are not handled
89 /// by the concrete visitor.
90 ResultType visitUnhandledExpr(Operation *op, ExtraArgs... args) {
91 return ResultType();
92 }
93
94 /// This fallback is invoked on any unary expr that isn't explicitly handled.
95 /// The default implementation delegates to the unhandled expression fallback.
96 ResultType visitUnaryExpr(Operation *op, ExtraArgs... args) {
97 return static_cast<ConcreteType *>(this)->visitUnhandledExpr(op, args...);
98 }
99
100 /// This fallback is invoked on any binary expr that isn't explicitly handled.
101 /// The default implementation delegates to the unhandled expression fallback.
102 ResultType visitBinaryExpr(Operation *op, ExtraArgs... args) {
103 return static_cast<ConcreteType *>(this)->visitUnhandledExpr(op, args...);
104 }
105
106#define HANDLE(OPTYPE, OPKIND) \
107 ResultType visitExpr(OPTYPE op, ExtraArgs... args) { \
108 return static_cast<ConcreteType *>(this)->visit##OPKIND##Expr(op, \
109 args...); \
110 }
111
112 // Basic expressions.
113 HANDLE(ConstantOp, Unhandled);
114 HANDLE(SpecialConstantOp, Unhandled);
115 HANDLE(AggregateConstantOp, Unhandled);
116 HANDLE(BundleCreateOp, Unhandled);
117 HANDLE(VectorCreateOp, Unhandled);
118 HANDLE(FEnumCreateOp, Unhandled);
119 HANDLE(SubfieldOp, Unhandled);
120 HANDLE(SubindexOp, Unhandled);
121 HANDLE(SubaccessOp, Unhandled);
122 HANDLE(IsTagOp, Unhandled);
123 HANDLE(SubtagOp, Unhandled);
124 HANDLE(TagExtractOp, Unhandled);
125 HANDLE(MultibitMuxOp, Unhandled);
126 HANDLE(OpenSubfieldOp, Unhandled);
127 HANDLE(OpenSubindexOp, Unhandled);
128 HANDLE(ObjectSubfieldOp, Unhandled);
129 HANDLE(DomainSubfieldOp, Unhandled);
130 HANDLE(ObjectAnyRefCastOp, Unhandled);
131 HANDLE(CatPrimOp, Unhandled);
132
133 // Arithmetic and Logical Binary Primitives.
134 HANDLE(AddPrimOp, Binary);
135 HANDLE(SubPrimOp, Binary);
136 HANDLE(MulPrimOp, Binary);
137 HANDLE(DivPrimOp, Binary);
138 HANDLE(RemPrimOp, Binary);
139 HANDLE(AndPrimOp, Binary);
140 HANDLE(OrPrimOp, Binary);
141 HANDLE(XorPrimOp, Binary);
142
143 // Comparisons.
144 HANDLE(LEQPrimOp, Binary);
145 HANDLE(LTPrimOp, Binary);
146 HANDLE(GEQPrimOp, Binary);
147 HANDLE(GTPrimOp, Binary);
148 HANDLE(EQPrimOp, Binary);
149 HANDLE(NEQPrimOp, Binary);
150
151 // Misc Binary Primitives.
152 HANDLE(DShlPrimOp, Binary);
153 HANDLE(DShlwPrimOp, Binary);
154 HANDLE(DShrPrimOp, Binary);
155
156 // Unary operators.
157 HANDLE(AsSIntPrimOp, Unary);
158 HANDLE(AsUIntPrimOp, Unary);
159 HANDLE(AsAsyncResetPrimOp, Unary);
160 HANDLE(AsResetPrimOp, Unary);
161 HANDLE(AsClockPrimOp, Unary);
162 HANDLE(CvtPrimOp, Unary);
163 HANDLE(NegPrimOp, Unary);
164 HANDLE(NotPrimOp, Unary);
165 HANDLE(AndRPrimOp, Unary);
166 HANDLE(OrRPrimOp, Unary);
167 HANDLE(XorRPrimOp, Unary);
168
169 HANDLE(ElementwiseOrPrimOp, Unhandled);
170 HANDLE(ElementwiseAndPrimOp, Unhandled);
171 HANDLE(ElementwiseXorPrimOp, Unhandled);
172
173 // Intrinsic Expr.
174 HANDLE(IsXIntrinsicOp, Unhandled);
175 HANDLE(PlusArgsValueIntrinsicOp, Unhandled);
176 HANDLE(PlusArgsTestIntrinsicOp, Unhandled);
177 HANDLE(SizeOfIntrinsicOp, Unhandled);
178 HANDLE(ClockGateIntrinsicOp, Unhandled);
179 HANDLE(ClockInverterIntrinsicOp, Unhandled);
180 HANDLE(ClockDividerIntrinsicOp, Unhandled);
181 HANDLE(LTLAndIntrinsicOp, Unhandled);
182 HANDLE(LTLOrIntrinsicOp, Unhandled);
183 HANDLE(LTLIntersectIntrinsicOp, Unhandled);
184 HANDLE(LTLDelayIntrinsicOp, Unhandled);
185 HANDLE(LTLConcatIntrinsicOp, Unhandled);
186 HANDLE(LTLRepeatIntrinsicOp, Unhandled);
187 HANDLE(LTLGoToRepeatIntrinsicOp, Unhandled);
188 HANDLE(LTLNonConsecutiveRepeatIntrinsicOp, Unhandled);
189 HANDLE(LTLNotIntrinsicOp, Unhandled);
190 HANDLE(LTLImplicationIntrinsicOp, Unhandled);
191 HANDLE(LTLUntilIntrinsicOp, Unhandled);
192 HANDLE(LTLEventuallyIntrinsicOp, Unhandled);
193 HANDLE(LTLPastIntrinsicOp, Unhandled);
194 HANDLE(LTLClockIntrinsicOp, Unhandled);
195 HANDLE(Mux4CellIntrinsicOp, Unhandled);
196 HANDLE(Mux2CellIntrinsicOp, Unhandled);
197 HANDLE(HasBeenResetIntrinsicOp, Unhandled);
198
199 // Miscellaneous.
200 HANDLE(BitsPrimOp, Unhandled);
201 HANDLE(HeadPrimOp, Unhandled);
202 HANDLE(InvalidValueOp, Unhandled);
203 HANDLE(MuxPrimOp, Unhandled);
204 HANDLE(PadPrimOp, Unhandled);
205 HANDLE(ShlPrimOp, Unhandled);
206 HANDLE(ShrPrimOp, Unhandled);
207 HANDLE(TailPrimOp, Unhandled);
208 HANDLE(VerbatimExprOp, Unhandled);
209 HANDLE(RefSendOp, Unhandled);
210 HANDLE(RefResolveOp, Unhandled);
211 HANDLE(RefSubOp, Unhandled);
212 HANDLE(RWProbeOp, Unhandled);
213 HANDLE(XMRRefOp, Unhandled);
214 HANDLE(XMRDerefOp, Unhandled);
215 HANDLE(UnsafeDomainCastOp, Unhandled);
216
217 // Conversions.
218 HANDLE(HWStructCastOp, Unhandled);
219 HANDLE(UninferredResetCastOp, Unhandled);
220 HANDLE(ConstCastOp, Unhandled);
221 HANDLE(BitCastOp, Unhandled);
222 HANDLE(RefCastOp, Unhandled);
223
224 // Property expressions.
225 HANDLE(StringConstantOp, Unhandled);
226 HANDLE(FIntegerConstantOp, Unhandled);
227 HANDLE(BoolConstantOp, Unhandled);
228 HANDLE(DoubleConstantOp, Unhandled);
229 HANDLE(ListCreateOp, Unhandled);
230 HANDLE(ListConcatOp, Unhandled);
231 HANDLE(PathOp, Unhandled);
232 HANDLE(UnresolvedPathOp, Unhandled);
233 HANDLE(IntegerAddOp, Unhandled);
234 HANDLE(IntegerMulOp, Unhandled);
235 HANDLE(IntegerShrOp, Unhandled);
236 HANDLE(StringConcatOp, Unhandled);
237 HANDLE(UnknownValueOp, Unhandled);
238
239 // Format string expressions
240 HANDLE(TimeOp, Unhandled);
241 HANDLE(HierarchicalModuleNameOp, Unhandled);
242#undef HANDLE
243};
244
245/// ExprVisitor is a visitor for FIRRTL statement nodes.
246template <typename ConcreteType, typename ResultType = void,
247 typename... ExtraArgs>
249public:
250 ResultType dispatchStmtVisitor(Operation *op, ExtraArgs... args) {
251 auto *thisCast = static_cast<ConcreteType *>(this);
252 return TypeSwitch<Operation *, ResultType>(op)
253 .template Case<AttachOp, ConnectOp, MatchingConnectOp, RefDefineOp,
254 DomainDefineOp, ForceOp, PrintFOp, FPrintFOp, FFlushOp,
255 SkipOp, StopOp, WhenOp, AssertOp, AssumeOp, CoverOp,
256 PropAssignOp, RefForceOp, RefForceInitialOp,
257 RefReleaseOp, RefReleaseInitialOp, FPGAProbeIntrinsicOp,
258 VerifAssertIntrinsicOp, VerifAssumeIntrinsicOp,
259 UnclockedAssumeIntrinsicOp, VerifCoverIntrinsicOp,
260 VerifRequireIntrinsicOp, VerifEnsureIntrinsicOp,
261 LayerBlockOp, MatchOp, ViewIntrinsicOp, BindOp>(
262 [&](auto opNode) -> ResultType {
263 return thisCast->visitStmt(opNode, args...);
264 })
265 .Default([&](auto expr) -> ResultType {
266 return thisCast->visitInvalidStmt(op, args...);
267 });
268 }
269
270 /// This callback is invoked on any non-Stmt operations.
271 ResultType visitInvalidStmt(Operation *op, ExtraArgs... args) {
272 op->emitOpError("unknown firrtl stmt");
273 abort();
274 }
275
276 /// This callback is invoked on any Stmt operations that are not handled
277 /// by the concrete visitor.
278 ResultType visitUnhandledStmt(Operation *op, ExtraArgs... args) {
279 return ResultType();
280 }
281
282#define HANDLE(OPTYPE) \
283 ResultType visitStmt(OPTYPE op, ExtraArgs... args) { \
284 return static_cast<ConcreteType *>(this)->visitUnhandledStmt(op, args...); \
285 }
286
287 HANDLE(AttachOp);
288 HANDLE(ConnectOp);
289 HANDLE(MatchingConnectOp);
290 HANDLE(RefDefineOp);
291 HANDLE(DomainDefineOp);
292 HANDLE(ForceOp);
293 HANDLE(PrintFOp);
294 HANDLE(FPrintFOp);
295 HANDLE(FFlushOp);
296 HANDLE(SkipOp);
297 HANDLE(StopOp);
298 HANDLE(WhenOp);
299 HANDLE(AssertOp);
300 HANDLE(AssumeOp);
301 HANDLE(CoverOp);
302 HANDLE(PropAssignOp);
303 HANDLE(RefForceOp);
304 HANDLE(RefForceInitialOp);
305 HANDLE(RefReleaseOp);
306 HANDLE(RefReleaseInitialOp);
307 HANDLE(FPGAProbeIntrinsicOp);
308 HANDLE(VerifAssertIntrinsicOp);
309 HANDLE(VerifAssumeIntrinsicOp);
310 HANDLE(VerifCoverIntrinsicOp);
311 HANDLE(VerifRequireIntrinsicOp);
312 HANDLE(VerifEnsureIntrinsicOp);
313 HANDLE(UnclockedAssumeIntrinsicOp);
314 HANDLE(LayerBlockOp);
315 HANDLE(MatchOp);
316 HANDLE(ViewIntrinsicOp);
317 HANDLE(BindOp);
318
319#undef HANDLE
320};
321
322/// ExprVisitor is a visitor for FIRRTL declaration nodes.
323template <typename ConcreteType, typename ResultType = void,
324 typename... ExtraArgs>
326public:
327 ResultType dispatchDeclVisitor(Operation *op, ExtraArgs... args) {
328 auto *thisCast = static_cast<ConcreteType *>(this);
329 return TypeSwitch<Operation *, ResultType>(op)
330 .template Case<InstanceOp, InstanceChoiceOp, ObjectOp, MemOp, NodeOp,
331 RegOp, RegResetOp, WireOp, VerbatimWireOp, ContractOp,
332 DomainCreateOp>([&](auto opNode) -> ResultType {
333 return thisCast->visitDecl(opNode, args...);
334 })
335 .Default([&](auto expr) -> ResultType {
336 return thisCast->visitInvalidDecl(op, args...);
337 });
338 }
339
340 /// This callback is invoked on any non-Decl operations.
341 ResultType visitInvalidDecl(Operation *op, ExtraArgs... args) {
342 op->emitOpError("unknown firrtl decl");
343 abort();
344 }
345
346 /// This callback is invoked on any Decl operations that are not handled
347 /// by the concrete visitor.
348 ResultType visitUnhandledDecl(Operation *op, ExtraArgs... args) {
349 return ResultType();
350 }
351
352#define HANDLE(OPTYPE) \
353 ResultType visitDecl(OPTYPE op, ExtraArgs... args) { \
354 return static_cast<ConcreteType *>(this)->visitUnhandledDecl(op, args...); \
355 }
356
357 HANDLE(InstanceOp);
358 HANDLE(InstanceChoiceOp);
359 HANDLE(ObjectOp);
360 HANDLE(MemOp);
361 HANDLE(NodeOp);
362 HANDLE(RegOp);
363 HANDLE(RegResetOp);
364 HANDLE(WireOp);
365 HANDLE(VerbatimWireOp);
366 HANDLE(ContractOp);
367 HANDLE(DomainCreateOp);
368#undef HANDLE
369};
370
371/// StmtExprVisitor is a visitor for FIRRTL operation that has an optional
372/// result.
373template <typename ConcreteType, typename ResultType = void,
374 typename... ExtraArgs>
376public:
377 ResultType dispatchStmtExprVisitor(Operation *op, ExtraArgs... args) {
378 auto *thisCast = static_cast<ConcreteType *>(this);
379 return TypeSwitch<Operation *, ResultType>(op)
380 .template Case<GenericIntrinsicOp, DPICallIntrinsicOp>(
381 [&](auto expr) -> ResultType {
382 return thisCast->visitStmtExpr(expr, args...);
383 })
384 .Default([&](auto expr) -> ResultType {
385 return thisCast->visitInvalidStmtExpr(op, args...);
386 });
387 }
388
389 /// This callback is invoked on any non-StmtExpr operations.
390 ResultType visitInvalidStmtExpr(Operation *op, ExtraArgs... args) {
391 op->emitOpError("unknown FIRRTL stmt expression");
392 abort();
393 }
394
395 /// This callback is invoked on any StmtExpr operations that are not handled
396 /// by the concrete visitor.
397 ResultType visitUnhandledStmtExpr(Operation *op, ExtraArgs... args) {
398 return ResultType();
399 }
400
401#define HANDLE(OPTYPE, OPKIND) \
402 ResultType visitStmtExpr(OPTYPE op, ExtraArgs... args) { \
403 return static_cast<ConcreteType *>(this)->visit##OPKIND##StmtExpr( \
404 op, args...); \
405 }
406
407 // Statement expressions.
408 HANDLE(DPICallIntrinsicOp, Unhandled);
409 HANDLE(GenericIntrinsicOp, Unhandled);
410#undef HANDLE
411};
412
413/// FIRRTLVisitor allows you to visit all of the expr/stmt/decls with one class
414/// declaration.
415///
416/// Clients call dispatchVisitor to invoke the dispatch, and may implement
417/// visitInvalidOp() to get notified about non-FIRRTL dialect nodes and
418/// visitUnhandledOp() to get notified about FIRRTL dialect ops that are not
419/// handled specifically.
420template <typename ConcreteType, typename ResultType = void,
421 typename... ExtraArgs>
423 : public ExprVisitor<ConcreteType, ResultType, ExtraArgs...>,
424 public StmtVisitor<ConcreteType, ResultType, ExtraArgs...>,
425 public DeclVisitor<ConcreteType, ResultType, ExtraArgs...>,
426 public StmtExprVisitor<ConcreteType, ResultType, ExtraArgs...> {
427public:
428 /// This is the main entrypoint for the FIRRTLVisitor.
429 ResultType dispatchVisitor(Operation *op, ExtraArgs... args) {
430 return this->dispatchExprVisitor(op, args...);
431 }
432
433 // Chain from each visitor onto the next one.
434 ResultType visitInvalidExpr(Operation *op, ExtraArgs... args) {
435 return this->dispatchStmtVisitor(op, args...);
436 }
437 ResultType visitInvalidStmt(Operation *op, ExtraArgs... args) {
438 return this->dispatchDeclVisitor(op, args...);
439 }
440 ResultType visitInvalidDecl(Operation *op, ExtraArgs... args) {
441 return this->dispatchStmtExprVisitor(op, args...);
442 }
443 ResultType visitInvalidStmtExpr(Operation *op, ExtraArgs... args) {
444 return static_cast<ConcreteType *>(this)->visitInvalidOp(op, args...);
445 }
446
447 // Default to chaining visitUnhandledXXX to visitUnhandledOp.
448 ResultType visitUnhandledExpr(Operation *op, ExtraArgs... args) {
449 return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
450 }
451 ResultType visitUnhandledStmt(Operation *op, ExtraArgs... args) {
452 return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
453 }
454 ResultType visitUnhandledDecl(Operation *op, ExtraArgs... args) {
455 return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
456 }
457 ResultType visitUnhandledStmtExpr(Operation *op, ExtraArgs... args) {
458 return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
459 }
460
461 /// visitInvalidOp is an override point for non-FIRRTL dialect operations.
462 ResultType visitInvalidOp(Operation *op, ExtraArgs... args) {
463 return ResultType();
464 }
465
466 /// visitUnhandledOp is an override point for FIRRTL dialect ops that the
467 /// concrete visitor didn't bother to implement.
468 ResultType visitUnhandledOp(Operation *op, ExtraArgs... args) {
469 return ResultType();
470 }
471};
472} // namespace firrtl
473} // namespace circt
474
475#endif // CIRCT_DIALECT_FIRRTL_FIRRTLVISITORS_H
ExprVisitor is a visitor for FIRRTL declaration nodes.
ResultType dispatchDeclVisitor(Operation *op, ExtraArgs... args)
HANDLE(InstanceChoiceOp)
ResultType visitInvalidDecl(Operation *op, ExtraArgs... args)
This callback is invoked on any non-Decl operations.
ResultType visitUnhandledDecl(Operation *op, ExtraArgs... args)
This callback is invoked on any Decl operations that are not handled by the concrete visitor.
ExprVisitor is a visitor for FIRRTL expression nodes.
HANDLE(ListCreateOp, Unhandled)
HANDLE(UnknownValueOp, Unhandled)
HANDLE(LTLUntilIntrinsicOp, Unhandled)
HANDLE(DoubleConstantOp, Unhandled)
HANDLE(LTLNotIntrinsicOp, Unhandled)
HANDLE(PadPrimOp, Unhandled)
HANDLE(SubPrimOp, Binary)
HANDLE(ElementwiseXorPrimOp, Unhandled)
HANDLE(UnsafeDomainCastOp, Unhandled)
HANDLE(ClockDividerIntrinsicOp, Unhandled)
HANDLE(LTLPastIntrinsicOp, Unhandled)
HANDLE(AddPrimOp, Binary)
HANDLE(BitsPrimOp, Unhandled)
HANDLE(RWProbeOp, Unhandled)
HANDLE(LTLAndIntrinsicOp, Unhandled)
HANDLE(OpenSubfieldOp, Unhandled)
HANDLE(BoolConstantOp, Unhandled)
HANDLE(CatPrimOp, Unhandled)
HANDLE(AndRPrimOp, Unary)
HANDLE(HeadPrimOp, Unhandled)
HANDLE(LTPrimOp, Binary)
HANDLE(ClockInverterIntrinsicOp, Unhandled)
HANDLE(LTLGoToRepeatIntrinsicOp, Unhandled)
HANDLE(LTLNonConsecutiveRepeatIntrinsicOp, Unhandled)
HANDLE(BitCastOp, Unhandled)
HANDLE(SubindexOp, Unhandled)
HANDLE(HasBeenResetIntrinsicOp, Unhandled)
HANDLE(SubfieldOp, Unhandled)
HANDLE(DShrPrimOp, Binary)
HANDLE(AsUIntPrimOp, Unary)
HANDLE(LTLDelayIntrinsicOp, Unhandled)
HANDLE(RefCastOp, Unhandled)
HANDLE(ElementwiseOrPrimOp, Unhandled)
HANDLE(MultibitMuxOp, Unhandled)
HANDLE(XorRPrimOp, Unary)
HANDLE(ConstCastOp, Unhandled)
HANDLE(StringConcatOp, Unhandled)
HANDLE(Mux4CellIntrinsicOp, Unhandled)
HANDLE(StringConstantOp, Unhandled)
HANDLE(LTLConcatIntrinsicOp, Unhandled)
HANDLE(TagExtractOp, Unhandled)
HANDLE(UninferredResetCastOp, Unhandled)
HANDLE(XorPrimOp, Binary)
HANDLE(MulPrimOp, Binary)
HANDLE(LTLImplicationIntrinsicOp, Unhandled)
HANDLE(ListConcatOp, Unhandled)
ResultType visitInvalidExpr(Operation *op, ExtraArgs... args)
This callback is invoked on any non-expression operations.
HANDLE(OrPrimOp, Binary)
ResultType dispatchExprVisitor(Operation *op, ExtraArgs... args)
HANDLE(RefSubOp, Unhandled)
HANDLE(ObjectAnyRefCastOp, Unhandled)
HANDLE(LTLIntersectIntrinsicOp, Unhandled)
HANDLE(RemPrimOp, Binary)
HANDLE(IntegerShrOp, Unhandled)
HANDLE(Mux2CellIntrinsicOp, Unhandled)
HANDLE(TimeOp, Unhandled)
HANDLE(MuxPrimOp, Unhandled)
HANDLE(BundleCreateOp, Unhandled)
HANDLE(PlusArgsTestIntrinsicOp, Unhandled)
HANDLE(FEnumCreateOp, Unhandled)
HANDLE(RefSendOp, Unhandled)
HANDLE(XMRDerefOp, Unhandled)
HANDLE(ShrPrimOp, Unhandled)
HANDLE(IntegerAddOp, Unhandled)
HANDLE(UnresolvedPathOp, Unhandled)
HANDLE(PlusArgsValueIntrinsicOp, Unhandled)
HANDLE(LTLOrIntrinsicOp, Unhandled)
HANDLE(LTLRepeatIntrinsicOp, Unhandled)
HANDLE(FIntegerConstantOp, Unhandled)
HANDLE(HWStructCastOp, Unhandled)
HANDLE(DomainSubfieldOp, Unhandled)
HANDLE(ClockGateIntrinsicOp, Unhandled)
HANDLE(OpenSubindexOp, Unhandled)
HANDLE(ObjectSubfieldOp, Unhandled)
HANDLE(InvalidValueOp, Unhandled)
HANDLE(SubaccessOp, Unhandled)
HANDLE(HierarchicalModuleNameOp, Unhandled)
HANDLE(DShlPrimOp, Binary)
HANDLE(ShlPrimOp, Unhandled)
HANDLE(IsXIntrinsicOp, Unhandled)
HANDLE(RefResolveOp, Unhandled)
HANDLE(NotPrimOp, Unary)
HANDLE(XMRRefOp, Unhandled)
HANDLE(TailPrimOp, Unhandled)
HANDLE(IntegerMulOp, Unhandled)
HANDLE(GTPrimOp, Binary)
HANDLE(LTLClockIntrinsicOp, Unhandled)
HANDLE(GEQPrimOp, Binary)
HANDLE(ElementwiseAndPrimOp, Unhandled)
HANDLE(CvtPrimOp, Unary)
ResultType visitUnaryExpr(Operation *op, ExtraArgs... args)
This fallback is invoked on any unary expr that isn't explicitly handled.
HANDLE(SizeOfIntrinsicOp, Unhandled)
ResultType visitUnhandledExpr(Operation *op, ExtraArgs... args)
This callback is invoked on any expression operations that are not handled by the concrete visitor.
HANDLE(NegPrimOp, Unary)
HANDLE(LEQPrimOp, Binary)
HANDLE(ConstantOp, Unhandled)
HANDLE(AsAsyncResetPrimOp, Unary)
HANDLE(DShlwPrimOp, Binary)
ResultType visitBinaryExpr(Operation *op, ExtraArgs... args)
This fallback is invoked on any binary expr that isn't explicitly handled.
HANDLE(OrRPrimOp, Unary)
HANDLE(AggregateConstantOp, Unhandled)
HANDLE(AndPrimOp, Binary)
HANDLE(AsClockPrimOp, Unary)
HANDLE(SpecialConstantOp, Unhandled)
HANDLE(VectorCreateOp, Unhandled)
HANDLE(LTLEventuallyIntrinsicOp, Unhandled)
HANDLE(DivPrimOp, Binary)
HANDLE(EQPrimOp, Binary)
HANDLE(NEQPrimOp, Binary)
HANDLE(SubtagOp, Unhandled)
HANDLE(VerbatimExprOp, Unhandled)
HANDLE(IsTagOp, Unhandled)
HANDLE(AsResetPrimOp, Unary)
HANDLE(AsSIntPrimOp, Unary)
HANDLE(PathOp, Unhandled)
FIRRTLVisitor allows you to visit all of the expr/stmt/decls with one class declaration.
ResultType dispatchVisitor(Operation *op, ExtraArgs... args)
This is the main entrypoint for the FIRRTLVisitor.
ResultType visitInvalidOp(Operation *op, ExtraArgs... args)
visitInvalidOp is an override point for non-FIRRTL dialect operations.
ResultType visitUnhandledExpr(Operation *op, ExtraArgs... args)
ResultType visitUnhandledOp(Operation *op, ExtraArgs... args)
visitUnhandledOp is an override point for FIRRTL dialect ops that the concrete visitor didn't bother ...
ResultType visitUnhandledStmt(Operation *op, ExtraArgs... args)
ResultType visitUnhandledDecl(Operation *op, ExtraArgs... args)
ResultType visitUnhandledStmtExpr(Operation *op, ExtraArgs... args)
ResultType visitInvalidDecl(Operation *op, ExtraArgs... args)
ResultType visitInvalidExpr(Operation *op, ExtraArgs... args)
ResultType visitInvalidStmtExpr(Operation *op, ExtraArgs... args)
ResultType visitInvalidStmt(Operation *op, ExtraArgs... args)
StmtExprVisitor is a visitor for FIRRTL operation that has an optional result.
HANDLE(DPICallIntrinsicOp, Unhandled)
ResultType visitUnhandledStmtExpr(Operation *op, ExtraArgs... args)
This callback is invoked on any StmtExpr operations that are not handled by the concrete visitor.
ResultType visitInvalidStmtExpr(Operation *op, ExtraArgs... args)
This callback is invoked on any non-StmtExpr operations.
HANDLE(GenericIntrinsicOp, Unhandled)
ResultType dispatchStmtExprVisitor(Operation *op, ExtraArgs... args)
ExprVisitor is a visitor for FIRRTL statement nodes.
HANDLE(VerifCoverIntrinsicOp)
HANDLE(RefForceInitialOp)
ResultType dispatchStmtVisitor(Operation *op, ExtraArgs... args)
HANDLE(UnclockedAssumeIntrinsicOp)
HANDLE(VerifEnsureIntrinsicOp)
HANDLE(VerifAssertIntrinsicOp)
ResultType visitUnhandledStmt(Operation *op, ExtraArgs... args)
This callback is invoked on any Stmt operations that are not handled by the concrete visitor.
HANDLE(RefReleaseInitialOp)
HANDLE(FPGAProbeIntrinsicOp)
HANDLE(MatchingConnectOp)
ResultType visitInvalidStmt(Operation *op, ExtraArgs... args)
This callback is invoked on any non-Stmt operations.
HANDLE(ViewIntrinsicOp)
HANDLE(VerifRequireIntrinsicOp)
HANDLE(VerifAssumeIntrinsicOp)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.