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 PropEqOp, BoolAndOp, BoolOrOp, BoolXorOp, 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(PropEqOp, Unhandled);
238 HANDLE(BoolAndOp, Unhandled);
239 HANDLE(BoolOrOp, Unhandled);
240 HANDLE(BoolXorOp, Unhandled);
241 HANDLE(UnknownValueOp, Unhandled);
242
243 // Format string expressions
244 HANDLE(TimeOp, Unhandled);
245 HANDLE(HierarchicalModuleNameOp, Unhandled);
246#undef HANDLE
247};
248
249/// ExprVisitor is a visitor for FIRRTL statement nodes.
250template <typename ConcreteType, typename ResultType = void,
251 typename... ExtraArgs>
253public:
254 ResultType dispatchStmtVisitor(Operation *op, ExtraArgs... args) {
255 auto *thisCast = static_cast<ConcreteType *>(this);
256 return TypeSwitch<Operation *, ResultType>(op)
257 .template Case<AttachOp, ConnectOp, MatchingConnectOp, RefDefineOp,
258 DomainDefineOp, ForceOp, PrintFOp, FPrintFOp, FFlushOp,
259 SkipOp, StopOp, WhenOp, AssertOp, AssumeOp, CoverOp,
260 PropAssignOp, RefForceOp, RefForceInitialOp,
261 RefReleaseOp, RefReleaseInitialOp, FPGAProbeIntrinsicOp,
262 VerifAssertIntrinsicOp, VerifAssumeIntrinsicOp,
263 UnclockedAssumeIntrinsicOp, VerifCoverIntrinsicOp,
264 VerifRequireIntrinsicOp, VerifEnsureIntrinsicOp,
265 LayerBlockOp, MatchOp, ViewIntrinsicOp, BindOp>(
266 [&](auto opNode) -> ResultType {
267 return thisCast->visitStmt(opNode, args...);
268 })
269 .Default([&](auto expr) -> ResultType {
270 return thisCast->visitInvalidStmt(op, args...);
271 });
272 }
273
274 /// This callback is invoked on any non-Stmt operations.
275 ResultType visitInvalidStmt(Operation *op, ExtraArgs... args) {
276 op->emitOpError("unknown firrtl stmt");
277 abort();
278 }
279
280 /// This callback is invoked on any Stmt operations that are not handled
281 /// by the concrete visitor.
282 ResultType visitUnhandledStmt(Operation *op, ExtraArgs... args) {
283 return ResultType();
284 }
285
286#define HANDLE(OPTYPE) \
287 ResultType visitStmt(OPTYPE op, ExtraArgs... args) { \
288 return static_cast<ConcreteType *>(this)->visitUnhandledStmt(op, args...); \
289 }
290
291 HANDLE(AttachOp);
292 HANDLE(ConnectOp);
293 HANDLE(MatchingConnectOp);
294 HANDLE(RefDefineOp);
295 HANDLE(DomainDefineOp);
296 HANDLE(ForceOp);
297 HANDLE(PrintFOp);
298 HANDLE(FPrintFOp);
299 HANDLE(FFlushOp);
300 HANDLE(SkipOp);
301 HANDLE(StopOp);
302 HANDLE(WhenOp);
303 HANDLE(AssertOp);
304 HANDLE(AssumeOp);
305 HANDLE(CoverOp);
306 HANDLE(PropAssignOp);
307 HANDLE(RefForceOp);
308 HANDLE(RefForceInitialOp);
309 HANDLE(RefReleaseOp);
310 HANDLE(RefReleaseInitialOp);
311 HANDLE(FPGAProbeIntrinsicOp);
312 HANDLE(VerifAssertIntrinsicOp);
313 HANDLE(VerifAssumeIntrinsicOp);
314 HANDLE(VerifCoverIntrinsicOp);
315 HANDLE(VerifRequireIntrinsicOp);
316 HANDLE(VerifEnsureIntrinsicOp);
317 HANDLE(UnclockedAssumeIntrinsicOp);
318 HANDLE(LayerBlockOp);
319 HANDLE(MatchOp);
320 HANDLE(ViewIntrinsicOp);
321 HANDLE(BindOp);
322
323#undef HANDLE
324};
325
326/// ExprVisitor is a visitor for FIRRTL declaration nodes.
327template <typename ConcreteType, typename ResultType = void,
328 typename... ExtraArgs>
330public:
331 ResultType dispatchDeclVisitor(Operation *op, ExtraArgs... args) {
332 auto *thisCast = static_cast<ConcreteType *>(this);
333 return TypeSwitch<Operation *, ResultType>(op)
334 .template Case<InstanceOp, InstanceChoiceOp, ObjectOp, MemOp, NodeOp,
335 RegOp, RegResetOp, WireOp, VerbatimWireOp, ContractOp,
336 DomainCreateOp>([&](auto opNode) -> ResultType {
337 return thisCast->visitDecl(opNode, args...);
338 })
339 .Default([&](auto expr) -> ResultType {
340 return thisCast->visitInvalidDecl(op, args...);
341 });
342 }
343
344 /// This callback is invoked on any non-Decl operations.
345 ResultType visitInvalidDecl(Operation *op, ExtraArgs... args) {
346 op->emitOpError("unknown firrtl decl");
347 abort();
348 }
349
350 /// This callback is invoked on any Decl operations that are not handled
351 /// by the concrete visitor.
352 ResultType visitUnhandledDecl(Operation *op, ExtraArgs... args) {
353 return ResultType();
354 }
355
356#define HANDLE(OPTYPE) \
357 ResultType visitDecl(OPTYPE op, ExtraArgs... args) { \
358 return static_cast<ConcreteType *>(this)->visitUnhandledDecl(op, args...); \
359 }
360
361 HANDLE(InstanceOp);
362 HANDLE(InstanceChoiceOp);
363 HANDLE(ObjectOp);
364 HANDLE(MemOp);
365 HANDLE(NodeOp);
366 HANDLE(RegOp);
367 HANDLE(RegResetOp);
368 HANDLE(WireOp);
369 HANDLE(VerbatimWireOp);
370 HANDLE(ContractOp);
371 HANDLE(DomainCreateOp);
372#undef HANDLE
373};
374
375/// StmtExprVisitor is a visitor for FIRRTL operation that has an optional
376/// result.
377template <typename ConcreteType, typename ResultType = void,
378 typename... ExtraArgs>
380public:
381 ResultType dispatchStmtExprVisitor(Operation *op, ExtraArgs... args) {
382 auto *thisCast = static_cast<ConcreteType *>(this);
383 return TypeSwitch<Operation *, ResultType>(op)
384 .template Case<GenericIntrinsicOp, DPICallIntrinsicOp>(
385 [&](auto expr) -> ResultType {
386 return thisCast->visitStmtExpr(expr, args...);
387 })
388 .Default([&](auto expr) -> ResultType {
389 return thisCast->visitInvalidStmtExpr(op, args...);
390 });
391 }
392
393 /// This callback is invoked on any non-StmtExpr operations.
394 ResultType visitInvalidStmtExpr(Operation *op, ExtraArgs... args) {
395 op->emitOpError("unknown FIRRTL stmt expression");
396 abort();
397 }
398
399 /// This callback is invoked on any StmtExpr operations that are not handled
400 /// by the concrete visitor.
401 ResultType visitUnhandledStmtExpr(Operation *op, ExtraArgs... args) {
402 return ResultType();
403 }
404
405#define HANDLE(OPTYPE, OPKIND) \
406 ResultType visitStmtExpr(OPTYPE op, ExtraArgs... args) { \
407 return static_cast<ConcreteType *>(this)->visit##OPKIND##StmtExpr( \
408 op, args...); \
409 }
410
411 // Statement expressions.
412 HANDLE(DPICallIntrinsicOp, Unhandled);
413 HANDLE(GenericIntrinsicOp, Unhandled);
414#undef HANDLE
415};
416
417/// FIRRTLVisitor allows you to visit all of the expr/stmt/decls with one class
418/// declaration.
419///
420/// Clients call dispatchVisitor to invoke the dispatch, and may implement
421/// visitInvalidOp() to get notified about non-FIRRTL dialect nodes and
422/// visitUnhandledOp() to get notified about FIRRTL dialect ops that are not
423/// handled specifically.
424template <typename ConcreteType, typename ResultType = void,
425 typename... ExtraArgs>
427 : public ExprVisitor<ConcreteType, ResultType, ExtraArgs...>,
428 public StmtVisitor<ConcreteType, ResultType, ExtraArgs...>,
429 public DeclVisitor<ConcreteType, ResultType, ExtraArgs...>,
430 public StmtExprVisitor<ConcreteType, ResultType, ExtraArgs...> {
431public:
432 /// This is the main entrypoint for the FIRRTLVisitor.
433 ResultType dispatchVisitor(Operation *op, ExtraArgs... args) {
434 return this->dispatchExprVisitor(op, args...);
435 }
436
437 // Chain from each visitor onto the next one.
438 ResultType visitInvalidExpr(Operation *op, ExtraArgs... args) {
439 return this->dispatchStmtVisitor(op, args...);
440 }
441 ResultType visitInvalidStmt(Operation *op, ExtraArgs... args) {
442 return this->dispatchDeclVisitor(op, args...);
443 }
444 ResultType visitInvalidDecl(Operation *op, ExtraArgs... args) {
445 return this->dispatchStmtExprVisitor(op, args...);
446 }
447 ResultType visitInvalidStmtExpr(Operation *op, ExtraArgs... args) {
448 return static_cast<ConcreteType *>(this)->visitInvalidOp(op, args...);
449 }
450
451 // Default to chaining visitUnhandledXXX to visitUnhandledOp.
452 ResultType visitUnhandledExpr(Operation *op, ExtraArgs... args) {
453 return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
454 }
455 ResultType visitUnhandledStmt(Operation *op, ExtraArgs... args) {
456 return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
457 }
458 ResultType visitUnhandledDecl(Operation *op, ExtraArgs... args) {
459 return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
460 }
461 ResultType visitUnhandledStmtExpr(Operation *op, ExtraArgs... args) {
462 return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
463 }
464
465 /// visitInvalidOp is an override point for non-FIRRTL dialect operations.
466 ResultType visitInvalidOp(Operation *op, ExtraArgs... args) {
467 return ResultType();
468 }
469
470 /// visitUnhandledOp is an override point for FIRRTL dialect ops that the
471 /// concrete visitor didn't bother to implement.
472 ResultType visitUnhandledOp(Operation *op, ExtraArgs... args) {
473 return ResultType();
474 }
475};
476} // namespace firrtl
477} // namespace circt
478
479#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(PropEqOp, Unhandled)
HANDLE(SubindexOp, Unhandled)
HANDLE(HasBeenResetIntrinsicOp, Unhandled)
HANDLE(SubfieldOp, Unhandled)
HANDLE(DShrPrimOp, Binary)
HANDLE(AsUIntPrimOp, Unary)
HANDLE(LTLDelayIntrinsicOp, Unhandled)
HANDLE(RefCastOp, Unhandled)
HANDLE(BoolAndOp, 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(BoolXorOp, 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(BoolOrOp, Unhandled)
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.