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