CIRCT 23.0.0git
Loading...
Searching...
No Matches
LTLVisitors.h
Go to the documentation of this file.
1//===- LTLVisitors.h - LTL 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#ifndef CIRCT_DIALECT_LTL_LTLVISITORS_H
10#define CIRCT_DIALECT_LTL_LTLVISITORS_H
11
13#include "llvm/ADT/TypeSwitch.h"
14
15namespace circt {
16namespace ltl {
17template <typename ConcreteType, typename ResultType = void,
18 typename... ExtraArgs>
19class Visitor {
20public:
21 ResultType dispatchLTLVisitor(Operation *op, ExtraArgs... args) {
22 auto *thisCast = static_cast<ConcreteType *>(this);
23 return TypeSwitch<Operation *, ResultType>(op)
24 .template Case<AndOp, OrOp, DelayOp, ClockedDelayOp, ConcatOp, RepeatOp,
25 NotOp, ImplicationOp, UntilOp, EventuallyOp, ClockOp,
26 ClockedAtomOp, IntersectOp, NonConsecutiveRepeatOp,
27 GoToRepeatOp, BooleanConstantOp>(
28 [&](auto op) -> ResultType {
29 return thisCast->visitLTL(op, args...);
30 })
31 .Default([&](auto) -> ResultType {
32 return thisCast->visitInvalidLTL(op, args...);
33 });
34 }
35
36 /// This callback is invoked on any non-LTL operations.
37 ResultType visitInvalidLTL(Operation *op, ExtraArgs... args) {
38 op->emitOpError("is not an LTL operation");
39 abort();
40 }
41
42 /// This callback is invoked on any LTL operations that were not handled by
43 /// their concrete `visitLTL(...)` callback.
44 ResultType visitUnhandledLTL(Operation *op, ExtraArgs... args) {
45 return ResultType();
46 }
47
48#define HANDLE(OPTYPE, OPKIND) \
49 ResultType visitLTL(OPTYPE op, ExtraArgs... args) { \
50 return static_cast<ConcreteType *>(this)->visit##OPKIND##LTL(op, args...); \
51 }
52
53 HANDLE(AndOp, Unhandled);
54 HANDLE(OrOp, Unhandled);
55 HANDLE(DelayOp, Unhandled);
56 HANDLE(ClockedDelayOp, Unhandled);
57 HANDLE(ConcatOp, Unhandled);
58 HANDLE(RepeatOp, Unhandled);
59 HANDLE(NotOp, Unhandled);
60 HANDLE(ImplicationOp, Unhandled);
61 HANDLE(UntilOp, Unhandled);
62 HANDLE(EventuallyOp, Unhandled);
63 HANDLE(ClockOp, Unhandled);
64 HANDLE(ClockedAtomOp, Unhandled);
65 HANDLE(IntersectOp, Unhandled);
66 HANDLE(NonConsecutiveRepeatOp, Unhandled);
67 HANDLE(GoToRepeatOp, Unhandled);
68 HANDLE(BooleanConstantOp, Unhandled);
69#undef HANDLE
70};
71
72} // namespace ltl
73} // namespace circt
74
75#endif // CIRCT_DIALECT_LTL_LTLVISITORS_H
HANDLE(UntilOp, Unhandled)
ResultType visitInvalidLTL(Operation *op, ExtraArgs... args)
This callback is invoked on any non-LTL operations.
Definition LTLVisitors.h:37
HANDLE(GoToRepeatOp, Unhandled)
HANDLE(AndOp, Unhandled)
HANDLE(DelayOp, Unhandled)
HANDLE(EventuallyOp, Unhandled)
HANDLE(ClockedAtomOp, Unhandled)
ResultType dispatchLTLVisitor(Operation *op, ExtraArgs... args)
Definition LTLVisitors.h:21
HANDLE(NotOp, Unhandled)
HANDLE(ClockOp, Unhandled)
HANDLE(RepeatOp, Unhandled)
HANDLE(NonConsecutiveRepeatOp, Unhandled)
HANDLE(ConcatOp, Unhandled)
HANDLE(IntersectOp, Unhandled)
ResultType visitUnhandledLTL(Operation *op, ExtraArgs... args)
This callback is invoked on any LTL operations that were not handled by their concrete visitLTL(....
Definition LTLVisitors.h:44
HANDLE(OrOp, Unhandled)
HANDLE(ClockedDelayOp, Unhandled)
HANDLE(BooleanConstantOp, Unhandled)
HANDLE(ImplicationOp, Unhandled)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition ltl.py:1