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