MLIR 24.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// Forward declarations.
30namespace llvm {
31// String types
32template <unsigned N>
34class StringRef;
35class StringLiteral;
36class Twine;
37
38// Containers.
39template <typename T>
41class BitVector;
42namespace detail {
43template <typename KeyT, typename ValueT>
45} // namespace detail
46template <typename KeyT, typename ValueT, typename KeyInfoT, typename BucketT>
48template <typename T, typename Enable>
50template <typename ValueT, typename ValueInfoT>
52class MallocAllocator;
53template <typename T>
55template <typename... PT>
57template <typename T, typename Vector, typename Set, unsigned N>
59template <typename KeyT, typename ValueT, typename MapType, typename VectorType,
60 unsigned N>
62template <typename T, unsigned N>
64template <typename T>
66template <typename T, unsigned N>
68template <typename T>
70template <typename AllocatorTy>
72template <typename T, typename R>
74template <typename T>
75struct Repeated;
76template <typename T>
78template <typename T, typename ResultT>
80
81// Other common classes.
82class APInt;
83class DynamicAPInt;
84class APSInt;
85class APFloat;
86template <typename Fn>
88template <typename IteratorT>
90class raw_ostream;
91class SMLoc;
92class SMRange;
93} // namespace llvm
94
95namespace mlir {
96// Casting operators.
97using llvm::cast;
98using llvm::cast_if_present;
99using llvm::cast_or_null;
100using llvm::dyn_cast;
101using llvm::dyn_cast_if_present;
102using llvm::dyn_cast_or_null;
103using llvm::isa;
104using llvm::isa_and_nonnull;
105using llvm::isa_and_present;
106
107// String types
109using llvm::StringLiteral;
110using llvm::StringRef;
111using llvm::Twine;
112
113// Container Related types
114//
115// Containers.
116using llvm::ArrayRef;
117using llvm::BitVector;
118template <typename T, typename Enable = void>
120template <typename KeyT, typename ValueT,
121 typename KeyInfoT = DenseMapInfo<KeyT>,
124template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
126template <typename T, typename Vector = llvm::SmallVector<T, 0>,
127 typename Set = DenseSet<T>, unsigned N = 0>
129template <typename KeyT, typename ValueT,
130 typename MapType = DenseMap<KeyT, unsigned>,
131 typename VectorType = llvm::SmallVector<std::pair<KeyT, ValueT>, 0>,
132 unsigned N = 0>
134template <typename AllocatorTy = llvm::MallocAllocator>
138using llvm::Repeated;
143template <typename T, typename R = T>
146template <typename T, typename ResultT = void>
148
149// Other common classes.
150using llvm::APFloat;
151using llvm::APInt;
152using llvm::APSInt;
153using llvm::DynamicAPInt;
154template <typename Fn>
157using llvm::raw_ostream;
158using llvm::SMLoc;
159using llvm::SMRange;
160
161// LogicalResult.
162using llvm::failed;
163using llvm::failure;
164using llvm::FailureOr;
165using llvm::LogicalResult;
166using llvm::ParseResult;
167using llvm::succeeded;
168using llvm::success;
169} // namespace mlir
170
171#endif // MLIR_SUPPORT_LLVM_H
The OpAsmOpInterface, see OpAsmInterface.td for more details.
Definition CallGraph.h:227
Include the generated interface declarations.
llvm::MapVector< KeyT, ValueT, MapType, VectorType, N > MapVector
Definition LLVM.h:133
llvm::DenseMapInfo< T, Enable > DenseMapInfo
Definition LLVM.h:119
llvm::DenseSet< ValueT, ValueInfoT > DenseSet
Definition LLVM.h:125
llvm::SetVector< T, Vector, Set, N > SetVector
Definition LLVM.h:128
llvm::StringSet< AllocatorTy > StringSet
Definition LLVM.h:135
llvm::TypeSwitch< T, ResultT > TypeSwitch
Definition LLVM.h:147
llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT > DenseMap
Definition LLVM.h:123
llvm::StringSwitch< T, R > StringSwitch
Definition LLVM.h:144
llvm::function_ref< Fn > function_ref
Definition LLVM.h:155