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