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