CIRCT  20.0.0git
LLVM.h
Go to the documentation of this file.
1 //===- LLVM.h - Import and forward declare core LLVM types ------*- 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 forward declares and imports various common LLVM and MLIR datatypes
10 // that we want to use unqualified.
11 //
12 // Note that most of these are forward declared and then imported into the circt
13 // namespace with using decls, rather than being #included. This is because we
14 // want clients to explicitly #include the files they need.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef CIRCT_SUPPORT_LLVM_H
19 #define CIRCT_SUPPORT_LLVM_H
20 
21 // MLIR includes a lot of forward declarations of LLVM types, use them.
22 #include "mlir/Support/LLVM.h"
23 
24 // Can not forward declare inline functions with default arguments, so we
25 // include the header directly.
26 #include "mlir/Support/LogicalResult.h"
27 
28 // Import classes from the `mlir` namespace into the `circt` namespace. All of
29 // the following classes have been already forward declared and imported from
30 // `llvm` in to the `mlir` namespace. For classes with default template
31 // arguments, MLIR does not import the type directly, it creates a templated
32 // using statement. This is due to the limitiation that only one declaration of
33 // a type can have default arguments. For those types, it is important to import
34 // the MLIR version, and not the LLVM version. To keep things simple, all
35 // classes here should be imported from the `mlir` namespace, not the `llvm`
36 // namespace.
37 namespace circt {
38 using mlir::APFloat; // NOLINT(misc-unused-using-decls)
39 using mlir::APInt; // NOLINT(misc-unused-using-decls)
40 using mlir::APSInt; // NOLINT(misc-unused-using-decls)
41 using mlir::ArrayRef; // NOLINT(misc-unused-using-decls)
42 using mlir::BitVector; // NOLINT(misc-unused-using-decls)
43 using mlir::cast; // NOLINT(misc-unused-using-decls)
44 using mlir::cast_or_null; // NOLINT(misc-unused-using-decls)
45 using mlir::DenseMap; // NOLINT(misc-unused-using-decls)
46 using mlir::DenseMapInfo; // NOLINT(misc-unused-using-decls)
47 using mlir::DenseSet; // NOLINT(misc-unused-using-decls)
48 using mlir::dyn_cast; // NOLINT(misc-unused-using-decls)
49 using mlir::dyn_cast_or_null; // NOLINT(misc-unused-using-decls)
50 using mlir::function_ref; // NOLINT(misc-unused-using-decls)
51 using mlir::isa; // NOLINT(misc-unused-using-decls)
52 using mlir::isa_and_nonnull; // NOLINT(misc-unused-using-decls)
53 using mlir::iterator_range; // NOLINT(misc-unused-using-decls)
54 using mlir::MutableArrayRef; // NOLINT(misc-unused-using-decls)
55 using mlir::PointerUnion; // NOLINT(misc-unused-using-decls)
56 using mlir::raw_ostream; // NOLINT(misc-unused-using-decls)
57 using mlir::SetVector; // NOLINT(misc-unused-using-decls)
58 using mlir::SmallPtrSet; // NOLINT(misc-unused-using-decls)
59 using mlir::SmallPtrSetImpl; // NOLINT(misc-unused-using-decls)
60 using mlir::SmallString; // NOLINT(misc-unused-using-decls)
61 using mlir::SmallVector; // NOLINT(misc-unused-using-decls)
62 using mlir::SmallVectorImpl; // NOLINT(misc-unused-using-decls)
63 using mlir::StringLiteral; // NOLINT(misc-unused-using-decls)
64 using mlir::StringRef; // NOLINT(misc-unused-using-decls)
65 using mlir::StringSet; // NOLINT(misc-unused-using-decls)
66 using mlir::TinyPtrVector; // NOLINT(misc-unused-using-decls)
67 using mlir::Twine; // NOLINT(misc-unused-using-decls)
68 using mlir::TypeSwitch; // NOLINT(misc-unused-using-decls)
69 } // namespace circt
70 
71 // Forward declarations of LLVM classes to be imported in to the circt
72 // namespace.
73 namespace llvm {
74 template <typename KeyT, typename ValueT, unsigned InlineBuckets,
75  typename KeyInfoT, typename BucketT>
77 template <typename T, unsigned N, typename C>
78 class SmallSet;
79 } // namespace llvm
80 
81 // Import things we want into our namespace.
82 namespace circt {
83 using llvm::SmallDenseMap; // NOLINT(misc-unused-using-decls)
84 using llvm::SmallSet; // NOLINT(misc-unused-using-decls)
85 } // namespace circt
86 
87 // Forward declarations of classes to be imported in to the circt namespace.
88 namespace mlir {
89 class ArrayAttr;
90 class AsmParser;
91 class AsmPrinter;
92 class Attribute;
93 class Block;
94 class TypedAttr;
95 class IRMapping;
96 class BlockArgument;
97 class BoolAttr;
98 class Builder;
99 class NamedAttrList;
100 class ConversionPattern;
101 class ConversionPatternRewriter;
102 class ConversionTarget;
103 class DenseElementsAttr;
104 class Diagnostic;
105 class Dialect;
106 class DialectAsmParser;
107 class DialectAsmPrinter;
108 class DictionaryAttr;
109 class DistinctAttr;
110 class ElementsAttr;
111 class FileLineColLoc;
112 class FlatSymbolRefAttr;
113 class FloatAttr;
114 class FunctionType;
115 class FusedLoc;
116 class ImplicitLocOpBuilder;
117 class IndexType;
118 class InFlightDiagnostic;
119 class IntegerAttr;
120 class IntegerType;
121 class Location;
122 class LocationAttr;
123 class MemRefType;
124 class MLIRContext;
125 class ModuleOp;
126 class MutableOperandRange;
127 class NamedAttribute;
128 class NamedAttrList;
129 class NoneType;
130 class OpAsmDialectInterface;
131 class OpAsmParser;
132 class OpAsmPrinter;
133 class OpaqueProperties;
134 class OpBuilder;
135 class OperandRange;
136 class Operation;
137 class OpFoldResult;
138 class OpOperand;
139 class OpResult;
140 template <typename OpTy>
142 class Pass;
143 class PatternRewriter;
144 class Region;
145 class RewritePatternSet;
146 class ShapedType;
147 class SplatElementsAttr;
148 class StringAttr;
149 class SymbolRefAttr;
150 class SymbolTable;
151 class SymbolTableCollection;
152 class TupleType;
153 class Type;
154 class TypeAttr;
155 class TypeConverter;
156 class TypeID;
157 class TypeRange;
158 class TypeStorage;
159 class UnitAttr;
160 class UnknownLoc;
161 class Value;
162 class ValueRange;
163 class VectorType;
164 class WalkResult;
165 enum class RegionKind;
166 struct CallInterfaceCallable;
167 struct OperationState;
168 class OperationName;
169 
170 namespace affine {
171 struct MemRefAccess;
172 } // namespace affine
173 
174 template <typename SourceOp>
176 template <typename T>
177 class OperationPass;
178 template <typename SourceOp>
180 
181 using DefaultTypeStorage = TypeStorage;
182 using OpAsmSetValueNameFn = function_ref<void(Value, StringRef)>;
183 
184 namespace OpTrait {}
185 
186 } // namespace mlir
187 
188 // Import things we want into our namespace.
189 namespace circt {
190 // clang-tidy removes following using directives incorrectly. So force
191 // clang-tidy to ignore them.
192 // TODO: It is better to use `NOLINTBEGIN/END` comments to disable clang-tidy
193 // than adding `NOLINT` to every line. `NOLINTBEGIN/END` will supported from
194 // clang-tidy-14.
195 using mlir::ArrayAttr; // NOLINT(misc-unused-using-decls)
196 using mlir::AsmParser; // NOLINT(misc-unused-using-decls)
197 using mlir::AsmPrinter; // NOLINT(misc-unused-using-decls)
198 using mlir::Attribute; // NOLINT(misc-unused-using-decls)
199 using mlir::Block; // NOLINT(misc-unused-using-decls)
200 using mlir::BlockArgument; // NOLINT(misc-unused-using-decls)
201 using mlir::BoolAttr; // NOLINT(misc-unused-using-decls)
202 using mlir::Builder; // NOLINT(misc-unused-using-decls)
203 using mlir::CallInterfaceCallable; // NOLINT(misc-unused-using-decls)
204 using mlir::ConversionPattern; // NOLINT(misc-unused-using-decls)
205 using mlir::ConversionPatternRewriter; // NOLINT(misc-unused-using-decls)
206 using mlir::ConversionTarget; // NOLINT(misc-unused-using-decls)
207 using mlir::DefaultTypeStorage; // NOLINT(misc-unused-using-decls)
208 using mlir::DenseElementsAttr; // NOLINT(misc-unused-using-decls)
209 using mlir::Diagnostic; // NOLINT(misc-unused-using-decls)
210 using mlir::Dialect; // NOLINT(misc-unused-using-decls)
211 using mlir::DialectAsmParser; // NOLINT(misc-unused-using-decls)
212 using mlir::DialectAsmPrinter; // NOLINT(misc-unused-using-decls)
213 using mlir::DictionaryAttr; // NOLINT(misc-unused-using-decls)
214 using mlir::DistinctAttr; // NOLINT(misc-unused-using-decls)
215 using mlir::ElementsAttr; // NOLINT(misc-unused-using-decls)
216 using mlir::failed; // NOLINT(misc-unused-using-decls)
217 using mlir::failure; // NOLINT(misc-unused-using-decls)
218 using mlir::FailureOr; // NOLINT(misc-unused-using-decls)
219 using mlir::FileLineColLoc; // NOLINT(misc-unused-using-decls)
220 using mlir::FlatSymbolRefAttr; // NOLINT(misc-unused-using-decls)
221 using mlir::FloatAttr; // NOLINT(misc-unused-using-decls)
222 using mlir::FunctionType; // NOLINT(misc-unused-using-decls)
223 using mlir::FusedLoc; // NOLINT(misc-unused-using-decls)
224 using mlir::ImplicitLocOpBuilder; // NOLINT(misc-unused-using-decls)
225 using mlir::IndexType; // NOLINT(misc-unused-using-decls)
226 using mlir::InFlightDiagnostic; // NOLINT(misc-unused-using-decls)
227 using mlir::IntegerAttr; // NOLINT(misc-unused-using-decls)
228 using mlir::IntegerType; // NOLINT(misc-unused-using-decls)
229 using mlir::IRMapping; // NOLINT(misc-unused-using-decls)
230 using mlir::Location; // NOLINT(misc-unused-using-decls)
231 using mlir::LocationAttr; // NOLINT(misc-unused-using-decls)
232 using mlir::LogicalResult; // NOLINT(misc-unused-using-decls)
233 using mlir::MemRefType; // NOLINT(misc-unused-using-decls)
234 using mlir::MLIRContext; // NOLINT(misc-unused-using-decls)
235 using mlir::ModuleOp; // NOLINT(misc-unused-using-decls)
236 using mlir::MutableOperandRange; // NOLINT(misc-unused-using-decls)
237 using mlir::NamedAttribute; // NOLINT(misc-unused-using-decls)
238 using mlir::NamedAttrList; // NOLINT(misc-unused-using-decls)
239 using mlir::NoneType; // NOLINT(misc-unused-using-decls)
240 using mlir::OpaqueProperties; // NOLINT(misc-unused-using-decls)
241 using mlir::OpAsmDialectInterface; // NOLINT(misc-unused-using-decls)
242 using mlir::OpAsmParser; // NOLINT(misc-unused-using-decls)
243 using mlir::OpAsmPrinter; // NOLINT(misc-unused-using-decls)
244 using mlir::OpAsmSetValueNameFn; // NOLINT(misc-unused-using-decls)
245 using mlir::OpBuilder; // NOLINT(misc-unused-using-decls)
246 using mlir::OpConversionPattern; // NOLINT(misc-unused-using-decls)
247 using mlir::OperandRange; // NOLINT(misc-unused-using-decls)
248 using mlir::Operation; // NOLINT(misc-unused-using-decls)
249 using mlir::OperationName; // NOLINT(misc-unused-using-decls)
250 using mlir::OperationPass; // NOLINT(misc-unused-using-decls)
251 using mlir::OperationState; // NOLINT(misc-unused-using-decls)
252 using mlir::OpFoldResult; // NOLINT(misc-unused-using-decls)
253 using mlir::OpOperand; // NOLINT(misc-unused-using-decls)
254 using mlir::OpResult; // NOLINT(misc-unused-using-decls)
255 using mlir::OpRewritePattern; // NOLINT(misc-unused-using-decls)
256 using mlir::OwningOpRef; // NOLINT(misc-unused-using-decls)
257 using mlir::ParseResult; // NOLINT(misc-unused-using-decls)
258 using mlir::Pass; // NOLINT(misc-unused-using-decls)
259 using mlir::PatternRewriter; // NOLINT(misc-unused-using-decls)
260 using mlir::Region; // NOLINT(misc-unused-using-decls)
261 using mlir::RegionKind; // NOLINT(misc-unused-using-decls)
262 using mlir::RewritePatternSet; // NOLINT(misc-unused-using-decls)
263 using mlir::ShapedType; // NOLINT(misc-unused-using-decls)
264 using mlir::SplatElementsAttr; // NOLINT(misc-unused-using-decls)
265 using mlir::StringAttr; // NOLINT(misc-unused-using-decls)
266 using mlir::succeeded; // NOLINT(misc-unused-using-decls)
267 using mlir::success; // NOLINT(misc-unused-using-decls)
268 using mlir::SymbolRefAttr; // NOLINT(misc-unused-using-decls)
269 using mlir::SymbolTable; // NOLINT(misc-unused-using-decls)
270 using mlir::SymbolTableCollection; // NOLINT(misc-unused-using-decls)
271 using mlir::TupleType; // NOLINT(misc-unused-using-decls)
272 using mlir::Type; // NOLINT(misc-unused-using-decls)
273 using mlir::TypeAttr; // NOLINT(misc-unused-using-decls)
274 using mlir::TypeConverter; // NOLINT(misc-unused-using-decls)
275 using mlir::TypedAttr; // NOLINT(misc-unused-using-decls)
276 using mlir::TypeID; // NOLINT(misc-unused-using-decls)
277 using mlir::TypeRange; // NOLINT(misc-unused-using-decls)
278 using mlir::TypeStorage; // NOLINT(misc-unused-using-decls)
279 using mlir::UnitAttr; // NOLINT(misc-unused-using-decls)
280 using mlir::UnknownLoc; // NOLINT(misc-unused-using-decls)
281 using mlir::Value; // NOLINT(misc-unused-using-decls)
282 using mlir::ValueRange; // NOLINT(misc-unused-using-decls)
283 using mlir::VectorType; // NOLINT(misc-unused-using-decls)
284 using mlir::WalkResult; // NOLINT(misc-unused-using-decls)
285 using mlir::affine::MemRefAccess; // NOLINT(misc-unused-using-decls)
286 namespace OpTrait = mlir::OpTrait;
287 } // namespace circt
288 
289 #endif // CIRCT_SUPPORT_LLVM_H
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
TypeStorage DefaultTypeStorage
Definition: LLVM.h:181
function_ref< void(Value, StringRef)> OpAsmSetValueNameFn
Definition: LLVM.h:182