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