CIRCT  19.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 ParseResult;
143 class Pass;
144 class PatternRewriter;
145 class Region;
146 class RewritePatternSet;
147 class ShapedType;
148 class SplatElementsAttr;
149 class StringAttr;
150 class SymbolRefAttr;
151 class SymbolTable;
152 class SymbolTableCollection;
153 class TupleType;
154 class Type;
155 class TypeAttr;
156 class TypeConverter;
157 class TypeID;
158 class TypeRange;
159 class TypeStorage;
160 class UnitAttr;
161 class UnknownLoc;
162 class Value;
163 class ValueRange;
164 class VectorType;
165 class WalkResult;
166 enum class RegionKind;
167 struct CallInterfaceCallable;
168 struct LogicalResult;
169 struct OperationState;
170 class OperationName;
171 
172 namespace affine {
173 struct MemRefAccess;
174 } // namespace affine
175 
176 template <typename T>
177 class FailureOr;
178 template <typename SourceOp>
180 template <typename T>
181 class OperationPass;
182 template <typename SourceOp>
184 
185 using DefaultTypeStorage = TypeStorage;
186 using OpAsmSetValueNameFn = function_ref<void(Value, StringRef)>;
187 
188 namespace OpTrait {}
189 
190 } // namespace mlir
191 
192 // Import things we want into our namespace.
193 namespace circt {
194 // clang-tidy removes following using directives incorrectly. So force
195 // clang-tidy to ignore them.
196 // TODO: It is better to use `NOLINTBEGIN/END` comments to disable clang-tidy
197 // than adding `NOLINT` to every line. `NOLINTBEGIN/END` will supported from
198 // clang-tidy-14.
199 using mlir::ArrayAttr; // NOLINT(misc-unused-using-decls)
200 using mlir::AsmParser; // NOLINT(misc-unused-using-decls)
201 using mlir::AsmPrinter; // NOLINT(misc-unused-using-decls)
202 using mlir::Attribute; // NOLINT(misc-unused-using-decls)
203 using mlir::Block; // NOLINT(misc-unused-using-decls)
204 using mlir::BlockArgument; // NOLINT(misc-unused-using-decls)
205 using mlir::BoolAttr; // NOLINT(misc-unused-using-decls)
206 using mlir::Builder; // NOLINT(misc-unused-using-decls)
207 using mlir::CallInterfaceCallable; // NOLINT(misc-unused-using-decls)
208 using mlir::ConversionPattern; // NOLINT(misc-unused-using-decls)
209 using mlir::ConversionPatternRewriter; // NOLINT(misc-unused-using-decls)
210 using mlir::ConversionTarget; // NOLINT(misc-unused-using-decls)
211 using mlir::DefaultTypeStorage; // NOLINT(misc-unused-using-decls)
212 using mlir::DenseElementsAttr; // NOLINT(misc-unused-using-decls)
213 using mlir::Diagnostic; // NOLINT(misc-unused-using-decls)
214 using mlir::Dialect; // NOLINT(misc-unused-using-decls)
215 using mlir::DialectAsmParser; // NOLINT(misc-unused-using-decls)
216 using mlir::DialectAsmPrinter; // NOLINT(misc-unused-using-decls)
217 using mlir::DictionaryAttr; // NOLINT(misc-unused-using-decls)
218 using mlir::DistinctAttr; // NOLINT(misc-unused-using-decls)
219 using mlir::ElementsAttr; // NOLINT(misc-unused-using-decls)
220 using mlir::failed; // NOLINT(misc-unused-using-decls)
221 using mlir::failure; // NOLINT(misc-unused-using-decls)
222 using mlir::FailureOr; // NOLINT(misc-unused-using-decls)
223 using mlir::FileLineColLoc; // NOLINT(misc-unused-using-decls)
224 using mlir::FlatSymbolRefAttr; // NOLINT(misc-unused-using-decls)
225 using mlir::FloatAttr; // NOLINT(misc-unused-using-decls)
226 using mlir::FunctionType; // NOLINT(misc-unused-using-decls)
227 using mlir::FusedLoc; // NOLINT(misc-unused-using-decls)
228 using mlir::ImplicitLocOpBuilder; // NOLINT(misc-unused-using-decls)
229 using mlir::IndexType; // NOLINT(misc-unused-using-decls)
230 using mlir::InFlightDiagnostic; // NOLINT(misc-unused-using-decls)
231 using mlir::IntegerAttr; // NOLINT(misc-unused-using-decls)
232 using mlir::IntegerType; // NOLINT(misc-unused-using-decls)
233 using mlir::IRMapping; // NOLINT(misc-unused-using-decls)
234 using mlir::Location; // NOLINT(misc-unused-using-decls)
235 using mlir::LocationAttr; // NOLINT(misc-unused-using-decls)
236 using mlir::LogicalResult; // NOLINT(misc-unused-using-decls)
237 using mlir::MemRefType; // NOLINT(misc-unused-using-decls)
238 using mlir::MLIRContext; // NOLINT(misc-unused-using-decls)
239 using mlir::ModuleOp; // NOLINT(misc-unused-using-decls)
240 using mlir::MutableOperandRange; // NOLINT(misc-unused-using-decls)
241 using mlir::NamedAttribute; // NOLINT(misc-unused-using-decls)
242 using mlir::NamedAttrList; // NOLINT(misc-unused-using-decls)
243 using mlir::NoneType; // NOLINT(misc-unused-using-decls)
244 using mlir::OpaqueProperties; // NOLINT(misc-unused-using-decls)
245 using mlir::OpAsmDialectInterface; // NOLINT(misc-unused-using-decls)
246 using mlir::OpAsmParser; // NOLINT(misc-unused-using-decls)
247 using mlir::OpAsmPrinter; // NOLINT(misc-unused-using-decls)
248 using mlir::OpAsmSetValueNameFn; // NOLINT(misc-unused-using-decls)
249 using mlir::OpBuilder; // NOLINT(misc-unused-using-decls)
250 using mlir::OpConversionPattern; // NOLINT(misc-unused-using-decls)
251 using mlir::OperandRange; // NOLINT(misc-unused-using-decls)
252 using mlir::Operation; // NOLINT(misc-unused-using-decls)
253 using mlir::OperationName; // NOLINT(misc-unused-using-decls)
254 using mlir::OperationPass; // NOLINT(misc-unused-using-decls)
255 using mlir::OperationState; // NOLINT(misc-unused-using-decls)
256 using mlir::OpFoldResult; // NOLINT(misc-unused-using-decls)
257 using mlir::OpOperand; // NOLINT(misc-unused-using-decls)
258 using mlir::OpResult; // NOLINT(misc-unused-using-decls)
259 using mlir::OpRewritePattern; // NOLINT(misc-unused-using-decls)
260 using mlir::OwningOpRef; // NOLINT(misc-unused-using-decls)
261 using mlir::ParseResult; // NOLINT(misc-unused-using-decls)
262 using mlir::Pass; // NOLINT(misc-unused-using-decls)
263 using mlir::PatternRewriter; // NOLINT(misc-unused-using-decls)
264 using mlir::Region; // NOLINT(misc-unused-using-decls)
265 using mlir::RegionKind; // NOLINT(misc-unused-using-decls)
266 using mlir::RewritePatternSet; // NOLINT(misc-unused-using-decls)
267 using mlir::ShapedType; // NOLINT(misc-unused-using-decls)
268 using mlir::SplatElementsAttr; // NOLINT(misc-unused-using-decls)
269 using mlir::StringAttr; // NOLINT(misc-unused-using-decls)
270 using mlir::succeeded; // NOLINT(misc-unused-using-decls)
271 using mlir::success; // NOLINT(misc-unused-using-decls)
272 using mlir::SymbolRefAttr; // NOLINT(misc-unused-using-decls)
273 using mlir::SymbolTable; // NOLINT(misc-unused-using-decls)
274 using mlir::SymbolTableCollection; // NOLINT(misc-unused-using-decls)
275 using mlir::TupleType; // NOLINT(misc-unused-using-decls)
276 using mlir::Type; // NOLINT(misc-unused-using-decls)
277 using mlir::TypeAttr; // NOLINT(misc-unused-using-decls)
278 using mlir::TypeConverter; // NOLINT(misc-unused-using-decls)
279 using mlir::TypedAttr; // NOLINT(misc-unused-using-decls)
280 using mlir::TypeID; // NOLINT(misc-unused-using-decls)
281 using mlir::TypeRange; // NOLINT(misc-unused-using-decls)
282 using mlir::TypeStorage; // NOLINT(misc-unused-using-decls)
283 using mlir::UnitAttr; // NOLINT(misc-unused-using-decls)
284 using mlir::UnknownLoc; // NOLINT(misc-unused-using-decls)
285 using mlir::Value; // NOLINT(misc-unused-using-decls)
286 using mlir::ValueRange; // NOLINT(misc-unused-using-decls)
287 using mlir::VectorType; // NOLINT(misc-unused-using-decls)
288 using mlir::WalkResult; // NOLINT(misc-unused-using-decls)
289 using mlir::affine::MemRefAccess; // NOLINT(misc-unused-using-decls)
290 namespace OpTrait = mlir::OpTrait;
291 } // namespace circt
292 
293 #endif // CIRCT_SUPPORT_LLVM_H
This file defines an intermediate representation for circuits acting as an abstraction for constraint...
Definition: DebugAnalysis.h:21
TypeStorage DefaultTypeStorage
Definition: LLVM.h:185
function_ref< void(Value, StringRef)> OpAsmSetValueNameFn
Definition: LLVM.h:186