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