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