MLIR 22.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.
38namespace llvm {
39// String types
40template <unsigned N>
42class StringRef;
43class StringLiteral;
44class Twine;
45
46// Containers.
47template <typename T>
49class BitVector;
50namespace detail {
51template <typename KeyT, typename ValueT>
53} // namespace detail
54template <typename KeyT, typename ValueT, typename KeyInfoT, typename BucketT>
56template <typename T, typename Enable>
58template <typename ValueT, typename ValueInfoT>
60class MallocAllocator;
61template <typename T>
63template <typename... PT>
65template <typename T, typename Vector, typename Set, unsigned N>
67template <typename T, unsigned N>
69template <typename T>
71template <typename T, unsigned N>
73template <typename T>
75template <typename AllocatorTy>
77template <typename T, typename R>
79template <typename T>
81template <typename T, typename ResultT>
83
84// Other common classes.
85class APInt;
86class DynamicAPInt;
87class APSInt;
88class APFloat;
89template <typename Fn>
91template <typename IteratorT>
93class raw_ostream;
94class SMLoc;
95class SMRange;
96} // namespace llvm
97
98namespace mlir {
99// Casting operators.
100using llvm::cast;
101using llvm::cast_if_present;
102using llvm::cast_or_null;
103using llvm::dyn_cast;
104using llvm::dyn_cast_if_present;
105using llvm::dyn_cast_or_null;
106using llvm::isa;
107using llvm::isa_and_nonnull;
108using llvm::isa_and_present;
109
110// String types
112using llvm::StringLiteral;
113using llvm::StringRef;
114using llvm::Twine;
115
116// Container Related types
117//
118// Containers.
119using llvm::ArrayRef;
120using llvm::BitVector;
121template <typename T, typename Enable = void>
123template <typename KeyT, typename ValueT,
124 typename KeyInfoT = DenseMapInfo<KeyT>,
127template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
129template <typename T, typename Vector = llvm::SmallVector<T, 0>,
130 typename Set = DenseSet<T>, unsigned N = 0>
132template <typename AllocatorTy = llvm::MallocAllocator>
140template <typename T, typename R = T>
143template <typename T, typename ResultT = void>
145
146// Other common classes.
147using llvm::APFloat;
148using llvm::APInt;
149using llvm::APSInt;
150using llvm::DynamicAPInt;
151template <typename Fn>
154using llvm::raw_ostream;
155using llvm::SMLoc;
156using llvm::SMRange;
157
158// LogicalResult.
159using llvm::failed;
160using llvm::failure;
161using llvm::FailureOr;
162using llvm::LogicalResult;
163using llvm::ParseResult;
164using llvm::succeeded;
165using 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.
llvm::DenseMapInfo< T, Enable > DenseMapInfo
Definition LLVM.h:122
llvm::DenseSet< ValueT, ValueInfoT > DenseSet
Definition LLVM.h:128
llvm::SetVector< T, Vector, Set, N > SetVector
Definition LLVM.h:131
llvm::StringSet< AllocatorTy > StringSet
Definition LLVM.h:133
llvm::TypeSwitch< T, ResultT > TypeSwitch
Definition LLVM.h:144
llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT > DenseMap
Definition LLVM.h:126
llvm::StringSwitch< T, R > StringSwitch
Definition LLVM.h:141
llvm::function_ref< Fn > function_ref
Definition LLVM.h:152