MLIR 23.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 T, unsigned N>
61template <typename T>
63template <typename T, unsigned N>
65template <typename T>
67template <typename AllocatorTy>
69template <typename T, typename R>
71template <typename T>
73template <typename T, typename ResultT>
75
76// Other common classes.
77class APInt;
78class DynamicAPInt;
79class APSInt;
80class APFloat;
81template <typename Fn>
83template <typename IteratorT>
85class raw_ostream;
86class SMLoc;
87class SMRange;
88} // namespace llvm
89
90namespace mlir {
91// Casting operators.
92using llvm::cast;
93using llvm::cast_if_present;
94using llvm::cast_or_null;
95using llvm::dyn_cast;
96using llvm::dyn_cast_if_present;
97using llvm::dyn_cast_or_null;
98using llvm::isa;
99using llvm::isa_and_nonnull;
100using llvm::isa_and_present;
101
102// String types
104using llvm::StringLiteral;
105using llvm::StringRef;
106using llvm::Twine;
107
108// Container Related types
109//
110// Containers.
111using llvm::ArrayRef;
112using llvm::BitVector;
113template <typename T, typename Enable = void>
115template <typename KeyT, typename ValueT,
116 typename KeyInfoT = DenseMapInfo<KeyT>,
119template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
121template <typename T, typename Vector = llvm::SmallVector<T, 0>,
122 typename Set = DenseSet<T>, unsigned N = 0>
124template <typename AllocatorTy = llvm::MallocAllocator>
132template <typename T, typename R = T>
135template <typename T, typename ResultT = void>
137
138// Other common classes.
139using llvm::APFloat;
140using llvm::APInt;
141using llvm::APSInt;
142using llvm::DynamicAPInt;
143template <typename Fn>
146using llvm::raw_ostream;
147using llvm::SMLoc;
148using llvm::SMRange;
149
150// LogicalResult.
151using llvm::failed;
152using llvm::failure;
153using llvm::FailureOr;
154using llvm::LogicalResult;
155using llvm::ParseResult;
156using llvm::succeeded;
157using llvm::success;
158} // namespace mlir
159
160#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:114
llvm::DenseSet< ValueT, ValueInfoT > DenseSet
Definition LLVM.h:120
llvm::SetVector< T, Vector, Set, N > SetVector
Definition LLVM.h:123
llvm::StringSet< AllocatorTy > StringSet
Definition LLVM.h:125
llvm::TypeSwitch< T, ResultT > TypeSwitch
Definition LLVM.h:136
llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT > DenseMap
Definition LLVM.h:118
llvm::StringSwitch< T, R > StringSwitch
Definition LLVM.h:133
llvm::function_ref< Fn > function_ref
Definition LLVM.h:144