CIRCT  20.0.0git
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 
20 namespace circt {
21 namespace firrtl {
22 
23 /// ExprVisitor is a visitor for FIRRTL expression nodes.
24 template <typename ConcreteType, typename ResultType = void,
25  typename... ExtraArgs>
26 class ExprVisitor {
27 public:
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.
232 template <typename ConcreteType, typename ResultType = void,
233  typename... ExtraArgs>
234 class StmtVisitor {
235 public:
236  ResultType dispatchStmtVisitor(Operation *op, ExtraArgs... args) {
237  auto *thisCast = static_cast<ConcreteType *>(this);
238  return TypeSwitch<Operation *, ResultType>(op)
239  .template Case<AttachOp, ConnectOp, MatchingConnectOp, RefDefineOp,
240  ForceOp, PrintFOp, SkipOp, StopOp, WhenOp, AssertOp,
241  AssumeOp, CoverOp, PropAssignOp, RefForceOp,
242  RefForceInitialOp, RefReleaseOp, RefReleaseInitialOp,
243  FPGAProbeIntrinsicOp, VerifAssertIntrinsicOp,
244  VerifAssumeIntrinsicOp, UnclockedAssumeIntrinsicOp,
245  VerifCoverIntrinsicOp, LayerBlockOp, MatchOp>(
246  [&](auto opNode) -> ResultType {
247  return thisCast->visitStmt(opNode, args...);
248  })
249  .Default([&](auto expr) -> ResultType {
250  return thisCast->visitInvalidStmt(op, args...);
251  });
252  }
253 
254  /// This callback is invoked on any non-Stmt operations.
255  ResultType visitInvalidStmt(Operation *op, ExtraArgs... args) {
256  op->emitOpError("unknown firrtl stmt");
257  abort();
258  }
259 
260  /// This callback is invoked on any Stmt operations that are not handled
261  /// by the concrete visitor.
262  ResultType visitUnhandledStmt(Operation *op, ExtraArgs... args) {
263  return ResultType();
264  }
265 
266 #define HANDLE(OPTYPE) \
267  ResultType visitStmt(OPTYPE op, ExtraArgs... args) { \
268  return static_cast<ConcreteType *>(this)->visitUnhandledStmt(op, args...); \
269  }
270 
271  HANDLE(AttachOp);
272  HANDLE(ConnectOp);
273  HANDLE(MatchingConnectOp);
274  HANDLE(RefDefineOp);
275  HANDLE(ForceOp);
276  HANDLE(PrintFOp);
277  HANDLE(SkipOp);
278  HANDLE(StopOp);
279  HANDLE(WhenOp);
280  HANDLE(AssertOp);
281  HANDLE(AssumeOp);
282  HANDLE(CoverOp);
283  HANDLE(PropAssignOp);
284  HANDLE(RefForceOp);
285  HANDLE(RefForceInitialOp);
286  HANDLE(RefReleaseOp);
287  HANDLE(RefReleaseInitialOp);
288  HANDLE(FPGAProbeIntrinsicOp);
289  HANDLE(VerifAssertIntrinsicOp);
290  HANDLE(VerifAssumeIntrinsicOp);
291  HANDLE(VerifCoverIntrinsicOp);
292  HANDLE(UnclockedAssumeIntrinsicOp);
293  HANDLE(LayerBlockOp);
294  HANDLE(MatchOp);
295 
296 #undef HANDLE
297 };
298 
299 /// ExprVisitor is a visitor for FIRRTL declaration nodes.
300 template <typename ConcreteType, typename ResultType = void,
301  typename... ExtraArgs>
302 class DeclVisitor {
303 public:
304  ResultType dispatchDeclVisitor(Operation *op, ExtraArgs... args) {
305  auto *thisCast = static_cast<ConcreteType *>(this);
306  return TypeSwitch<Operation *, ResultType>(op)
307  .template Case<InstanceOp, InstanceChoiceOp, ObjectOp, MemOp, NodeOp,
308  RegOp, RegResetOp, WireOp, VerbatimWireOp>(
309  [&](auto opNode) -> ResultType {
310  return thisCast->visitDecl(opNode, args...);
311  })
312  .Default([&](auto expr) -> ResultType {
313  return thisCast->visitInvalidDecl(op, args...);
314  });
315  }
316 
317  /// This callback is invoked on any non-Decl operations.
318  ResultType visitInvalidDecl(Operation *op, ExtraArgs... args) {
319  op->emitOpError("unknown firrtl decl");
320  abort();
321  }
322 
323  /// This callback is invoked on any Decl operations that are not handled
324  /// by the concrete visitor.
325  ResultType visitUnhandledDecl(Operation *op, ExtraArgs... args) {
326  return ResultType();
327  }
328 
329 #define HANDLE(OPTYPE) \
330  ResultType visitDecl(OPTYPE op, ExtraArgs... args) { \
331  return static_cast<ConcreteType *>(this)->visitUnhandledDecl(op, args...); \
332  }
333 
334  HANDLE(InstanceOp);
335  HANDLE(InstanceChoiceOp);
336  HANDLE(ObjectOp);
337  HANDLE(MemOp);
338  HANDLE(NodeOp);
339  HANDLE(RegOp);
340  HANDLE(RegResetOp);
341  HANDLE(WireOp);
342  HANDLE(VerbatimWireOp);
343 #undef HANDLE
344 };
345 
346 /// StmtExprVisitor is a visitor for FIRRTL operation that has an optional
347 /// result.
348 template <typename ConcreteType, typename ResultType = void,
349  typename... ExtraArgs>
351 public:
352  ResultType dispatchStmtExprVisitor(Operation *op, ExtraArgs... args) {
353  auto *thisCast = static_cast<ConcreteType *>(this);
354  return TypeSwitch<Operation *, ResultType>(op)
355  .template Case<GenericIntrinsicOp, DPICallIntrinsicOp>(
356  [&](auto expr) -> ResultType {
357  return thisCast->visitStmtExpr(expr, args...);
358  })
359  .Default([&](auto expr) -> ResultType {
360  return thisCast->visitInvalidStmtExpr(op, args...);
361  });
362  }
363 
364  /// This callback is invoked on any non-StmtExpr operations.
365  ResultType visitInvalidStmtExpr(Operation *op, ExtraArgs... args) {
366  op->emitOpError("unknown FIRRTL stmt expression");
367  abort();
368  }
369 
370  /// This callback is invoked on any StmtExpr operations that are not handled
371  /// by the concrete visitor.
372  ResultType visitUnhandledStmtExpr(Operation *op, ExtraArgs... args) {
373  return ResultType();
374  }
375 
376 #define HANDLE(OPTYPE, OPKIND) \
377  ResultType visitStmtExpr(OPTYPE op, ExtraArgs... args) { \
378  return static_cast<ConcreteType *>(this)->visit##OPKIND##StmtExpr( \
379  op, args...); \
380  }
381 
382  // Statement expressions.
383  HANDLE(DPICallIntrinsicOp, Unhandled);
384  HANDLE(GenericIntrinsicOp, Unhandled);
385 #undef HANDLE
386 };
387 
388 /// FIRRTLVisitor allows you to visit all of the expr/stmt/decls with one class
389 /// declaration.
390 ///
391 /// Clients call dispatchVisitor to invoke the dispatch, and may implement
392 /// visitInvalidOp() to get notified about non-FIRRTL dialect nodes and
393 /// visitUnhandledOp() to get notified about FIRRTL dialect ops that are not
394 /// handled specifically.
395 template <typename ConcreteType, typename ResultType = void,
396  typename... ExtraArgs>
398  : public ExprVisitor<ConcreteType, ResultType, ExtraArgs...>,
399  public StmtVisitor<ConcreteType, ResultType, ExtraArgs...>,
400  public DeclVisitor<ConcreteType, ResultType, ExtraArgs...>,
401  public StmtExprVisitor<ConcreteType, ResultType, ExtraArgs...> {
402 public:
403  /// This is the main entrypoint for the FIRRTLVisitor.
404  ResultType dispatchVisitor(Operation *op, ExtraArgs... args) {
405  return this->dispatchExprVisitor(op, args...);
406  }
407 
408  // Chain from each visitor onto the next one.
409  ResultType visitInvalidExpr(Operation *op, ExtraArgs... args) {
410  return this->dispatchStmtVisitor(op, args...);
411  }
412  ResultType visitInvalidStmt(Operation *op, ExtraArgs... args) {
413  return this->dispatchDeclVisitor(op, args...);
414  }
415  ResultType visitInvalidDecl(Operation *op, ExtraArgs... args) {
416  return this->dispatchStmtExprVisitor(op, args...);
417  }
418  ResultType visitInvalidStmtExpr(Operation *op, ExtraArgs... args) {
419  return static_cast<ConcreteType *>(this)->visitInvalidOp(op, args...);
420  }
421 
422  // Default to chaining visitUnhandledXXX to visitUnhandledOp.
423  ResultType visitUnhandledExpr(Operation *op, ExtraArgs... args) {
424  return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
425  }
426  ResultType visitUnhandledStmt(Operation *op, ExtraArgs... args) {
427  return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
428  }
429  ResultType visitUnhandledDecl(Operation *op, ExtraArgs... args) {
430  return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
431  }
432  ResultType visitUnhandledStmtExpr(Operation *op, ExtraArgs... args) {
433  return static_cast<ConcreteType *>(this)->visitUnhandledOp(op, args...);
434  }
435 
436  /// visitInvalidOp is an override point for non-FIRRTL dialect operations.
437  ResultType visitInvalidOp(Operation *op, ExtraArgs... args) {
438  return ResultType();
439  }
440 
441  /// visitUnhandledOp is an override point for FIRRTL dialect ops that the
442  /// concrete visitor didn't bother to implement.
443  ResultType visitUnhandledOp(Operation *op, ExtraArgs... args) {
444  return ResultType();
445  }
446 };
447 } // namespace firrtl
448 } // namespace circt
449 
450 #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(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(VerifAssumeIntrinsicOp)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21