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