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