/home/arjun/llvm-project/build/tools/mlir/include/mlir/IR/SymbolInterfaces.h.inc
Line | Count | Source (jump to first uncovered line) |
1 | | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
2 | | |* *| |
3 | | |* Operation Interface Declarations *| |
4 | | |* *| |
5 | | |* Automatically generated file, do not edit! *| |
6 | | |* *| |
7 | | \*===----------------------------------------------------------------------===*/ |
8 | | |
9 | | namespace detail { |
10 | | struct SymbolOpInterfaceInterfaceTraits { |
11 | | class Concept { |
12 | | public: |
13 | 0 | virtual ~Concept() = default; |
14 | | virtual StringRef getName(Operation *tablegen_opaque_op) = 0; |
15 | | virtual void setName(Operation *tablegen_opaque_op, StringRef name) = 0; |
16 | | virtual mlir::SymbolTable::Visibility getVisibility(Operation *tablegen_opaque_op) = 0; |
17 | | virtual void setVisibility(Operation *tablegen_opaque_op, mlir::SymbolTable::Visibility vis) = 0; |
18 | | virtual Optional<::mlir::SymbolTable::UseRange> getSymbolUses(Operation *tablegen_opaque_op, Operation * from) = 0; |
19 | | virtual bool symbolKnownUseEmpty(Operation *tablegen_opaque_op, Operation * from) = 0; |
20 | | virtual LogicalResult replaceAllSymbolUses(Operation *tablegen_opaque_op, StringRef newSymbol, Operation * from) = 0; |
21 | | virtual bool isOptionalSymbol(Operation *tablegen_opaque_op) = 0; |
22 | | virtual bool canDiscardOnUseEmpty(Operation *tablegen_opaque_op) = 0; |
23 | | }; |
24 | | template<typename ConcreteOp> |
25 | | class Model : public Concept { |
26 | | public: |
27 | 0 | StringRef getName(Operation *tablegen_opaque_op) final { |
28 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
29 | 0 | (void)op; |
30 | 0 |
|
31 | 0 | // Don't rely on the trait implementation as optional symbol operations |
32 | 0 | // may override this. |
33 | 0 | return mlir::SymbolTable::getSymbolName(op); |
34 | 0 | |
35 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE7getNameEPNS_9OperationE Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE7getNameEPNS_9OperationE |
36 | 0 | void setName(Operation *tablegen_opaque_op, StringRef name) final { |
37 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
38 | 0 | (void)op; |
39 | 0 | return op.setName(name); |
40 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE7setNameEPNS_9OperationEN4llvm9StringRefE Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE7setNameEPNS_9OperationEN4llvm9StringRefE |
41 | 0 | mlir::SymbolTable::Visibility getVisibility(Operation *tablegen_opaque_op) final { |
42 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
43 | 0 | (void)op; |
44 | 0 | return op.getVisibility(); |
45 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE13getVisibilityEPNS_9OperationE Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE13getVisibilityEPNS_9OperationE |
46 | 0 | void setVisibility(Operation *tablegen_opaque_op, mlir::SymbolTable::Visibility vis) final { |
47 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
48 | 0 | (void)op; |
49 | 0 | return op.setVisibility(vis); |
50 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE13setVisibilityEPNS_9OperationENS_11SymbolTable10VisibilityE Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE13setVisibilityEPNS_9OperationENS_11SymbolTable10VisibilityE |
51 | 0 | Optional<::mlir::SymbolTable::UseRange> getSymbolUses(Operation *tablegen_opaque_op, Operation * from) final { |
52 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
53 | 0 | (void)op; |
54 | 0 | return op.getSymbolUses(from); |
55 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE13getSymbolUsesEPNS_9OperationES6_ Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE13getSymbolUsesEPNS_9OperationES6_ |
56 | 0 | bool symbolKnownUseEmpty(Operation *tablegen_opaque_op, Operation * from) final { |
57 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
58 | 0 | (void)op; |
59 | 0 | return op.symbolKnownUseEmpty(from); |
60 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE19symbolKnownUseEmptyEPNS_9OperationES6_ Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE19symbolKnownUseEmptyEPNS_9OperationES6_ |
61 | 0 | LogicalResult replaceAllSymbolUses(Operation *tablegen_opaque_op, StringRef newSymbol, Operation * from) final { |
62 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
63 | 0 | (void)op; |
64 | 0 | return op.replaceAllSymbolUses(newSymbol, from); |
65 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE20replaceAllSymbolUsesEPNS_9OperationEN4llvm9StringRefES6_ Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE20replaceAllSymbolUsesEPNS_9OperationEN4llvm9StringRefES6_ |
66 | 0 | bool isOptionalSymbol(Operation *tablegen_opaque_op) final { |
67 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
68 | 0 | (void)op; |
69 | 0 | return op.isOptionalSymbol(); |
70 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE16isOptionalSymbolEPNS_9OperationE Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE16isOptionalSymbolEPNS_9OperationE |
71 | 0 | bool canDiscardOnUseEmpty(Operation *tablegen_opaque_op) final { |
72 | 0 | auto op = llvm::cast<ConcreteOp>(tablegen_opaque_op); |
73 | 0 | (void)op; |
74 | 0 | return op.canDiscardOnUseEmpty(); |
75 | 0 | } Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_6FuncOpEE20canDiscardOnUseEmptyEPNS_9OperationE Unexecuted instantiation: _ZN4mlir6detail32SymbolOpInterfaceInterfaceTraits5ModelINS_8ModuleOpEE20canDiscardOnUseEmptyEPNS_9OperationE |
76 | | }; |
77 | | }; |
78 | | } // end namespace detail |
79 | | class SymbolOpInterface : public OpInterface<SymbolOpInterface, detail::SymbolOpInterfaceInterfaceTraits> { |
80 | | public: |
81 | | using OpInterface<SymbolOpInterface, detail::SymbolOpInterfaceInterfaceTraits>::OpInterface; |
82 | | template <typename ConcreteOp> |
83 | | struct SymbolOpInterfaceTrait : public OpInterface<SymbolOpInterface, detail::SymbolOpInterfaceInterfaceTraits>::Trait<ConcreteOp> { |
84 | | StringRef getName() { |
85 | | |
86 | | return mlir::SymbolTable::getSymbolName(this->getOperation()); |
87 | | } |
88 | 0 | void setName(StringRef name) { |
89 | 0 |
|
90 | 0 | this->getOperation()->setAttr( |
91 | 0 | mlir::SymbolTable::getSymbolAttrName(), |
92 | 0 | StringAttr::get(name, this->getOperation()->getContext())); |
93 | 0 | } Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_6FuncOpEE7setNameEN4llvm9StringRefE Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_8ModuleOpEE7setNameEN4llvm9StringRefE |
94 | 0 | mlir::SymbolTable::Visibility getVisibility() { |
95 | 0 |
|
96 | 0 | return mlir::SymbolTable::getSymbolVisibility(this->getOperation()); |
97 | 0 | } Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_6FuncOpEE13getVisibilityEv Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_8ModuleOpEE13getVisibilityEv |
98 | 0 | void setVisibility(mlir::SymbolTable::Visibility vis) { |
99 | 0 |
|
100 | 0 | mlir::SymbolTable::setSymbolVisibility(this->getOperation(), vis); |
101 | 0 | } Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_6FuncOpEE13setVisibilityENS_11SymbolTable10VisibilityE Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_8ModuleOpEE13setVisibilityENS_11SymbolTable10VisibilityE |
102 | 0 | Optional<::mlir::SymbolTable::UseRange> getSymbolUses(Operation * from) { |
103 | 0 |
|
104 | 0 | return ::mlir::SymbolTable::getSymbolUses(this->getOperation(), from); |
105 | 0 | } Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_6FuncOpEE13getSymbolUsesEPNS_9OperationE Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_8ModuleOpEE13getSymbolUsesEPNS_9OperationE |
106 | 0 | bool symbolKnownUseEmpty(Operation * from) { |
107 | 0 |
|
108 | 0 | return ::mlir::SymbolTable::symbolKnownUseEmpty(this->getOperation(), |
109 | 0 | from); |
110 | 0 | } Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_6FuncOpEE19symbolKnownUseEmptyEPNS_9OperationE Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_8ModuleOpEE19symbolKnownUseEmptyEPNS_9OperationE |
111 | 0 | LogicalResult replaceAllSymbolUses(StringRef newSymbol, Operation * from) { |
112 | 0 |
|
113 | 0 | return ::mlir::SymbolTable::replaceAllSymbolUses(this->getOperation(), |
114 | 0 | newSymbol, from); |
115 | 0 | } Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_6FuncOpEE20replaceAllSymbolUsesEN4llvm9StringRefEPNS_9OperationE Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_8ModuleOpEE20replaceAllSymbolUsesEN4llvm9StringRefEPNS_9OperationE |
116 | 0 | bool isOptionalSymbol() { |
117 | 0 | return false; } |
118 | 0 | bool canDiscardOnUseEmpty() { |
119 | 0 |
|
120 | 0 | // By default, base this on the visibility alone. A symbol can be |
121 | 0 | // discarded as long as it is not public. Only public symbols may be |
122 | 0 | // visible from outside of the IR. |
123 | 0 | return getVisibility() != ::mlir::SymbolTable::Visibility::Public; |
124 | 0 | } Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_6FuncOpEE20canDiscardOnUseEmptyEv Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_8ModuleOpEE20canDiscardOnUseEmptyEv |
125 | 0 | static LogicalResult verifyTrait(Operation* op) { |
126 | 0 |
|
127 | 0 | // If this is an optional symbol, bail out early if possible. |
128 | 0 | auto concreteOp = cast<ConcreteOp>(op); |
129 | 0 | if (concreteOp.isOptionalSymbol()) { |
130 | 0 | if(!concreteOp.getAttr(::mlir::SymbolTable::getSymbolAttrName())) |
131 | 0 | return success(); |
132 | 0 | } |
133 | 0 | return ::mlir::detail::verifySymbol(op); |
134 | 0 | |
135 | 0 | } Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_6FuncOpEE11verifyTraitEPNS_9OperationE Unexecuted instantiation: _ZN4mlir17SymbolOpInterface22SymbolOpInterfaceTraitINS_8ModuleOpEE11verifyTraitEPNS_9OperationE |
136 | | |
137 | | using Visibility = mlir::SymbolTable::Visibility; |
138 | | |
139 | | }; |
140 | | template <typename ConcreteOp> |
141 | | struct Trait : public SymbolOpInterfaceTrait<ConcreteOp> {}; |
142 | | StringRef getName(); |
143 | | void setName(StringRef name); |
144 | | mlir::SymbolTable::Visibility getVisibility(); |
145 | | void setVisibility(mlir::SymbolTable::Visibility vis); |
146 | | Optional<::mlir::SymbolTable::UseRange> getSymbolUses(Operation * from); |
147 | | bool symbolKnownUseEmpty(Operation * from); |
148 | | LogicalResult replaceAllSymbolUses(StringRef newSymbol, Operation * from); |
149 | | bool isOptionalSymbol(); |
150 | | bool canDiscardOnUseEmpty(); |
151 | | |
152 | | using Visibility = mlir::SymbolTable::Visibility; |
153 | | |
154 | | /// Custom classof that handles the case where the symbol is optional. |
155 | 0 | static bool classof(Operation *op) { |
156 | 0 | return Base::classof(op) |
157 | 0 | && op->getAttr(::mlir::SymbolTable::getSymbolAttrName()); |
158 | 0 | } |
159 | | |
160 | | /// Returns true if this symbol has nested visibility. |
161 | 0 | bool isNested() { return getVisibility() == Visibility::Nested; } |
162 | | /// Returns true if this symbol has private visibility. |
163 | 0 | bool isPrivate() { return getVisibility() == Visibility::Private; } |
164 | | /// Returns true if this symbol has public visibility. |
165 | 0 | bool isPublic() { return getVisibility() == Visibility::Public; } |
166 | | |
167 | | }; |