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