MLIR  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 datatypes that
10 // MLIR wants to use unqualified.
11 //
12 // Note that most of these are forward declared and then imported into the MLIR
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 MLIR_SUPPORT_LLVM_H
19 #define MLIR_SUPPORT_LLVM_H
20 
21 // We include this header because it cannot be practically forward
22 // declared, and are effectively language features.
23 #include "llvm/Support/Casting.h"
24 
25 // We include this header because large portions of mlir would have to include
26 // it anyway.
27 #include "llvm/Support/LogicalResult.h"
28 
29 // Workaround for clang-5 (PR41549)
30 #if defined(__clang_major__)
31 #if __clang_major__ <= 5
32 #include "llvm/ADT/DenseMapInfo.h"
33 #include "llvm/ADT/SmallVector.h"
34 #endif
35 #endif
36 
37 // Forward declarations.
38 namespace llvm {
39 // String types
40 template <unsigned N>
42 class StringRef;
43 class StringLiteral;
44 class Twine;
45 
46 // Containers.
47 template <typename T>
48 class ArrayRef;
49 class BitVector;
50 namespace detail {
51 template <typename KeyT, typename ValueT>
52 struct DenseMapPair;
53 } // namespace detail
54 template <typename KeyT, typename ValueT, typename KeyInfoT, typename BucketT>
55 class DenseMap;
56 template <typename T, typename Enable>
57 struct DenseMapInfo;
58 template <typename ValueT, typename ValueInfoT>
59 class DenseSet;
60 class MallocAllocator;
61 template <typename T>
63 template <typename... PT>
65 template <typename T, typename Vector, typename Set, unsigned N>
66 class SetVector;
67 template <typename T, unsigned N>
69 template <typename T>
71 template <typename T, unsigned N>
73 template <typename T>
75 template <typename AllocatorTy>
76 class StringSet;
77 template <typename T, typename R>
79 template <typename T>
81 template <typename T, typename ResultT>
82 class TypeSwitch;
83 
84 // Other common classes.
85 class APInt;
86 class DynamicAPInt;
87 class APSInt;
88 class APFloat;
89 template <typename Fn>
91 template <typename IteratorT>
93 class raw_ostream;
94 class SMLoc;
95 class SMRange;
96 } // namespace llvm
97 
98 namespace mlir {
99 // Casting operators.
100 using llvm::cast;
101 using llvm::cast_if_present;
102 using llvm::cast_or_null;
103 using llvm::dyn_cast;
104 using llvm::dyn_cast_if_present;
105 using llvm::dyn_cast_or_null;
106 using llvm::isa;
107 using llvm::isa_and_nonnull;
108 using llvm::isa_and_present;
109 
110 // String types
111 using llvm::SmallString;
112 using llvm::StringLiteral;
113 using llvm::StringRef;
114 using llvm::Twine;
115 
116 // Container Related types
117 //
118 // Containers.
119 using llvm::ArrayRef;
120 using llvm::BitVector;
121 template <typename T, typename Enable = void>
123 template <typename KeyT, typename ValueT,
124  typename KeyInfoT = DenseMapInfo<KeyT>,
125  typename BucketT = llvm::detail::DenseMapPair<KeyT, ValueT>>
127 template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
129 template <typename T, typename Vector = llvm::SmallVector<T, 0>,
130  typename Set = DenseSet<T>, unsigned N = 0>
132 template <typename AllocatorTy = llvm::MallocAllocator>
135 using llvm::PointerUnion;
136 using llvm::SmallPtrSet;
138 using llvm::SmallVector;
140 template <typename T, typename R = T>
142 using llvm::TinyPtrVector;
143 template <typename T, typename ResultT = void>
145 
146 // Other common classes.
147 using llvm::APFloat;
148 using llvm::APInt;
149 using llvm::APSInt;
150 using llvm::DynamicAPInt;
151 template <typename Fn>
154 using llvm::raw_ostream;
155 using llvm::SMLoc;
156 using llvm::SMRange;
157 
158 // LogicalResult.
159 using llvm::failed;
160 using llvm::failure;
161 using llvm::FailureOr;
162 using llvm::LogicalResult;
163 using llvm::ParseResult;
164 using llvm::succeeded;
165 using llvm::success;
166 } // namespace mlir
167 
168 #endif // MLIR_SUPPORT_LLVM_H
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition: CallGraph.h:229
Include the generated interface declarations.