MLIR  15.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 these two headers because they cannot be practically forward
22 // declared, and are effectively language features.
23 #include "llvm/ADT/None.h"
24 #include "llvm/Support/Casting.h"
25 #include <vector>
26 
27 // Workaround for clang-5 (PR41549)
28 #if defined(__clang_major__)
29 #if __clang_major__ <= 5
30 #include "llvm/ADT/DenseMapInfo.h"
31 #include "llvm/ADT/SmallVector.h"
32 #endif
33 #endif
34 
35 // Forward declarations.
36 namespace llvm {
37 // String types
38 template <unsigned N> class SmallString;
39 class StringRef;
40 class StringLiteral;
41 class Twine;
42 
43 // Containers.
44 template <typename T> class ArrayRef;
45 class BitVector;
46 namespace detail {
47 template <typename KeyT, typename ValueT> struct DenseMapPair;
48 } // namespace detail
49 template <typename KeyT, typename ValueT, typename KeyInfoT, typename BucketT>
50 class DenseMap;
51 template <typename T, typename Enable> struct DenseMapInfo;
52 template <typename ValueT, typename ValueInfoT> class DenseSet;
53 class MallocAllocator;
54 template <typename T> class MutableArrayRef;
55 template <typename T> class Optional;
56 template <typename... PT> class PointerUnion;
57 template <typename T, typename Vector, typename Set> class SetVector;
58 template <typename T, unsigned N> class SmallPtrSet;
59 template <typename T> class SmallPtrSetImpl;
60 template <typename T, unsigned N> class SmallVector;
61 template <typename T> class SmallVectorImpl;
62 template <typename AllocatorTy> class StringSet;
63 template <typename T, typename R> class StringSwitch;
64 template <typename T> class TinyPtrVector;
65 template <typename T, typename ResultT> class TypeSwitch;
66 
67 // Other common classes.
68 class APInt;
69 class APSInt;
70 class APFloat;
71 template <typename Fn> class function_ref;
72 template <typename IteratorT> class iterator_range;
73 class raw_ostream;
74 class SMLoc;
75 class SMRange;
76 } // namespace llvm
77 
78 namespace mlir {
79 // Casting operators.
80 using llvm::cast;
81 using llvm::cast_or_null;
82 using llvm::dyn_cast;
83 using llvm::dyn_cast_or_null;
84 using llvm::isa;
85 using llvm::isa_and_nonnull;
86 
87 // String types
88 using llvm::SmallString;
89 using llvm::StringLiteral;
90 using llvm::StringRef;
91 using llvm::Twine;
92 
93 // Container Related types
94 //
95 // Containers.
96 using llvm::ArrayRef;
97 using llvm::BitVector;
98 template <typename T, typename Enable = void>
100 template <typename KeyT, typename ValueT,
101  typename KeyInfoT = DenseMapInfo<KeyT>,
102  typename BucketT = llvm::detail::DenseMapPair<KeyT, ValueT>>
104 template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
106 template <typename T, typename Vector = std::vector<T>,
107  typename Set = DenseSet<T>>
109 template <typename AllocatorTy = llvm::MallocAllocator>
112 using llvm::None;
113 using llvm::Optional;
114 using llvm::PointerUnion;
115 using llvm::SmallPtrSet;
117 using llvm::SmallVector;
119 template <typename T, typename R = T>
121 using llvm::TinyPtrVector;
122 template <typename T, typename ResultT = void>
124 
125 // Other common classes.
126 using llvm::APFloat;
127 using llvm::APInt;
128 using llvm::APSInt;
129 template <typename Fn> using function_ref = llvm::function_ref<Fn>;
131 using llvm::raw_ostream;
132 using llvm::SMLoc;
133 using llvm::SMRange;
134 } // namespace mlir
135 
136 #endif // MLIR_SUPPORT_LLVM_H
TODO: Remove this file when SCCP and integer range analysis have been ported to the new framework...
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition: CallGraph.h:221