LLVM 23.0.0git
Type.h
Go to the documentation of this file.
1//===- llvm/SandboxIR/Type.h - Classes for handling data 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 is a thin wrapper over llvm::Type.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_SANDBOXIR_TYPE_H
14#define LLVM_SANDBOXIR_TYPE_H
15
18#include "llvm/IR/Type.h"
20#include "llvm/Support/Debug.h"
22
23namespace llvm::sandboxir {
24
25class Context;
26// Forward declare friend classes for MSVC.
27class ArrayType;
28class CallBase;
29class CmpInst;
31class FixedVectorType;
32class FPMathOperator;
33class FunctionType;
34class IntegerType;
35class Module;
36class PointerType;
38class StructType;
39class TargetExtType;
40class VectorType;
41#define DEF_INSTR(ID, OPCODE, CLASS) class CLASS;
42#define DEF_CONST(ID, CLASS) class CLASS;
43#define DEF_DISABLE_AUTO_UNDEF // ValuesDefFilesList.def includes multiple .def
44#include "llvm/SandboxIR/ValuesDefFilesList.def"
45
46/// Just like llvm::Type these are immutable, unique, never get freed and
47/// can only be created via static factory methods.
48class Type {
49protected:
51 friend class ArrayType; // For LLVMTy.
52 friend class StructType; // For LLVMTy.
53 friend class VectorType; // For LLVMTy.
54 friend class FixedVectorType; // For LLVMTy.
55 friend class ScalableVectorType; // For LLVMTy.
56 friend class PointerType; // For LLVMTy.
57 friend class FunctionType; // For LLVMTy.
58 friend class IntegerType; // For LLVMTy.
59 friend class Function; // For LLVMTy.
60 friend class CallBase; // For LLVMTy.
61 friend class ConstantInt; // For LLVMTy.
62 friend class ConstantArray; // For LLVMTy.
63 friend class ConstantStruct; // For LLVMTy.
64 friend class ConstantVector; // For LLVMTy.
65 friend class CmpInst; // For LLVMTy. TODO: Cleanup after
66 // sandboxir::VectorType is more complete.
67 friend class Utils; // for LLVMTy
68 friend class TargetExtType; // For LLVMTy.
69 friend class Module; // For LLVMTy.
70 friend class FPMathOperator; // For LLVMTy.
71 friend class ConstantDataSequential; // For LLVMTy.
72
73 // Friend all instruction classes because `create()` functions use LLVMTy.
74#define DEF_INSTR(ID, OPCODE, CLASS) friend class CLASS;
75#define DEF_CONST(ID, CLASS) friend class CLASS;
76#define DEF_DISABLE_AUTO_UNDEF // ValuesDefFilesList.def includes multiple .def
77#include "llvm/SandboxIR/ValuesDefFilesList.def"
78#undef DEF_INSTR
79#undef DEF_CONST
81
83 friend class Context; // For constructor and ~Type().
84 ~Type() = default;
85
86public:
87 /// Print the current type.
88 /// Omit the type details if \p NoDetails == true.
89 /// E.g., let %st = type { i32, i16 }
90 /// When \p NoDetails is true, we only print %st.
91 /// Put differently, \p NoDetails prints the type as if
92 /// inlined with the operands when printing an instruction.
93 void print(raw_ostream &OS, bool IsForDebug = false,
94 bool NoDetails = false) const {
95 LLVMTy->print(OS, IsForDebug, NoDetails);
96 }
97
98 Context &getContext() const { return Ctx; }
99
100 /// Return true if this is 'void'.
101 bool isVoidTy() const { return LLVMTy->isVoidTy(); }
102
103 /// Return true if this is 'half', a 16-bit IEEE fp type.
104 bool isHalfTy() const { return LLVMTy->isHalfTy(); }
105
106 /// Return true if this is 'bfloat', a 16-bit bfloat type.
107 bool isBFloatTy() const { return LLVMTy->isBFloatTy(); }
108
109 /// Return true if this is a 16-bit float type.
110 bool is16bitFPTy() const { return LLVMTy->is16bitFPTy(); }
111
112 /// Return true if this is 'float', a 32-bit IEEE fp type.
113 bool isFloatTy() const { return LLVMTy->isFloatTy(); }
114
115 /// Return true if this is 'double', a 64-bit IEEE fp type.
116 bool isDoubleTy() const { return LLVMTy->isDoubleTy(); }
117
118 /// Return true if this is x86 long double.
119 bool isX86_FP80Ty() const { return LLVMTy->isX86_FP80Ty(); }
120
121 /// Return true if this is 'fp128'.
122 bool isFP128Ty() const { return LLVMTy->isFP128Ty(); }
123
124 /// Return true if this is powerpc long double.
125 bool isPPC_FP128Ty() const { return LLVMTy->isPPC_FP128Ty(); }
126
127 /// Return true if this is a well-behaved IEEE-like type, which has a IEEE
128 /// compatible layout, and does not have non-IEEE values, such as x86_fp80's
129 /// unnormal values.
130 bool isIEEELikeFPTy() const { return LLVMTy->isIEEELikeFPTy(); }
131
132 /// Return true if this is one of the floating-point types
133 bool isFloatingPointTy() const { return LLVMTy->isFloatingPointTy(); }
134
135 /// Returns true if this is a floating-point type that is an unevaluated sum
136 /// of multiple floating-point units.
137 /// An example of such a type is ppc_fp128, also known as double-double, which
138 /// consists of two IEEE 754 doubles.
139 bool isMultiUnitFPType() const { return LLVMTy->isMultiUnitFPType(); }
140
142 return LLVMTy->getFltSemantics();
143 }
144
145 /// Return true if this is X86 AMX.
146 bool isX86_AMXTy() const { return LLVMTy->isX86_AMXTy(); }
147
148 /// Return true if this is a target extension type.
149 bool isTargetExtTy() const { return LLVMTy->isTargetExtTy(); }
150
151 /// Return true if this is a target extension type with a scalable layout.
152 bool isScalableTargetExtTy() const { return LLVMTy->isScalableTargetExtTy(); }
153
154 /// Return true if this is a type whose size is a known multiple of vscale.
155 bool isScalableTy() const { return LLVMTy->isScalableTy(); }
156
157 /// Return true if this is a FP type or a vector of FP.
158 bool isFPOrFPVectorTy() const { return LLVMTy->isFPOrFPVectorTy(); }
159
160 /// Return true if this is 'label'.
161 bool isLabelTy() const { return LLVMTy->isLabelTy(); }
162
163 /// Return true if this is 'metadata'.
164 bool isMetadataTy() const { return LLVMTy->isMetadataTy(); }
165
166 /// Return true if this is 'token'.
167 bool isTokenTy() const { return LLVMTy->isTokenTy(); }
168
169 /// True if this is an instance of IntegerType.
170 bool isIntegerTy() const { return LLVMTy->isIntegerTy(); }
171
172 /// Return true if this is an IntegerType of the given width.
173 bool isIntegerTy(unsigned Bitwidth) const {
174 return LLVMTy->isIntegerTy(Bitwidth);
175 }
176
177 /// Return true if this is an integer type or a vector of integer types.
178 bool isIntOrIntVectorTy() const { return LLVMTy->isIntOrIntVectorTy(); }
179
180 /// Return true if this is an integer type or a vector of integer types of
181 /// the given width.
182 bool isIntOrIntVectorTy(unsigned BitWidth) const {
183 return LLVMTy->isIntOrIntVectorTy(BitWidth);
184 }
185
186 /// Return true if this is an integer type or a pointer type.
187 bool isIntOrPtrTy() const { return LLVMTy->isIntOrPtrTy(); }
188
189 /// True if this is an instance of FunctionType.
190 bool isFunctionTy() const { return LLVMTy->isFunctionTy(); }
191
192 /// True if this is an instance of StructType.
193 bool isStructTy() const { return LLVMTy->isStructTy(); }
194
195 /// True if this is an instance of ArrayType.
196 bool isArrayTy() const { return LLVMTy->isArrayTy(); }
197
198 /// True if this is an instance of PointerType.
199 bool isPointerTy() const { return LLVMTy->isPointerTy(); }
200
201 /// Return true if this is a pointer type or a vector of pointer types.
202 bool isPtrOrPtrVectorTy() const { return LLVMTy->isPtrOrPtrVectorTy(); }
203
204 /// True if this is an instance of VectorType.
205 inline bool isVectorTy() const { return LLVMTy->isVectorTy(); }
206
207 /// Return true if this type could be converted with a lossless BitCast to
208 /// type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the
209 /// same size only where no re-interpretation of the bits is done.
210 /// Determine if this type could be losslessly bitcast to Ty
211 bool canLosslesslyBitCastTo(Type *Ty) const {
212 return LLVMTy->canLosslesslyBitCastTo(Ty->LLVMTy);
213 }
214
215 /// Return true if this type is empty, that is, it has no elements or all of
216 /// its elements are empty.
217 bool isEmptyTy() const { return LLVMTy->isEmptyTy(); }
218
219 /// Return true if the type is "first class", meaning it is a valid type for a
220 /// Value.
221 bool isFirstClassType() const { return LLVMTy->isFirstClassType(); }
222
223 /// Return true if the type is a valid type for a register in codegen. This
224 /// includes all first-class types except struct and array types.
225 bool isSingleValueType() const { return LLVMTy->isSingleValueType(); }
226
227 /// Return true if the type is an aggregate type. This means it is valid as
228 /// the first operand of an insertvalue or extractvalue instruction. This
229 /// includes struct and array types, but does not include vector types.
230 bool isAggregateType() const { return LLVMTy->isAggregateType(); }
231
232 /// Return true if it makes sense to take the size of this type. To get the
233 /// actual size for a particular target, it is reasonable to use the
234 /// DataLayout subsystem to do this.
235 bool isSized(SmallPtrSetImpl<Type *> *Visited = nullptr) const {
237 LLVMVisited.reserve(Visited->size());
238 for (Type *Ty : *Visited)
239 LLVMVisited.insert(Ty->LLVMTy);
240 return LLVMTy->isSized(&LLVMVisited);
241 }
242
243 /// Return the basic size of this type if it is a primitive type. These are
244 /// fixed by LLVM and are not target-dependent.
245 /// This will return zero if the type does not have a size or is not a
246 /// primitive type.
247 ///
248 /// If this is a scalable vector type, the scalable property will be set and
249 /// the runtime size will be a positive integer multiple of the base size.
250 ///
251 /// Note that this may not reflect the size of memory allocated for an
252 /// instance of the type or the number of bytes that are written when an
253 /// instance of the type is stored to memory. The DataLayout class provides
254 /// additional query functions to provide this information.
255 ///
257 return LLVMTy->getPrimitiveSizeInBits();
258 }
259
260 /// If this is a vector type, return the getPrimitiveSizeInBits value for the
261 /// element type. Otherwise return the getPrimitiveSizeInBits value for this
262 /// type.
263 unsigned getScalarSizeInBits() const { return LLVMTy->getScalarSizeInBits(); }
264
265 /// Return the width of the mantissa of this type. This is only valid on
266 /// floating-point types. If the FP type does not have a stable mantissa (e.g.
267 /// ppc long double), this method returns -1.
268 int getFPMantissaWidth() const { return LLVMTy->getFPMantissaWidth(); }
269
270 /// If this is a vector type, return the element type, otherwise return
271 /// 'this'.
273
274 // TODO: ADD MISSING
275
284 // TODO: missing get*
285
286 /// Get the address space of this pointer or pointer vector type.
287 inline unsigned getPointerAddressSpace() const {
288 return LLVMTy->getPointerAddressSpace();
289 }
290
291#ifndef NDEBUG
292 void dumpOS(raw_ostream &OS);
293 LLVM_DUMP_METHOD void dump();
294#endif // NDEBUG
295};
296
297class PointerType : public Type {
298public:
299 // TODO: add missing functions
300
301 LLVM_ABI static PointerType *get(Context &Ctx, unsigned AddressSpace);
302
303 static bool classof(const Type *From) {
304 return isa<llvm::PointerType>(From->LLVMTy);
305 }
306};
307
308class ArrayType : public Type {
309public:
310 LLVM_ABI static ArrayType *get(Type *ElementType, uint64_t NumElements);
311 // TODO: add missing functions
312 static bool classof(const Type *From) {
313 return isa<llvm::ArrayType>(From->LLVMTy);
314 }
315};
316
317class StructType : public Type {
318public:
319 /// This static method is the primary way to create a literal StructType.
321 bool IsPacked = false);
322
323 bool isPacked() const { return cast<llvm::StructType>(LLVMTy)->isPacked(); }
324
325 // TODO: add missing functions
326 static bool classof(const Type *From) {
327 return isa<llvm::StructType>(From->LLVMTy);
328 }
329};
330
331class VectorType : public Type {
332public:
333 LLVM_ABI static VectorType *get(Type *ElementType, ElementCount EC);
334 static VectorType *get(Type *ElementType, unsigned NumElements,
335 bool Scalable) {
336 return VectorType::get(ElementType,
337 ElementCount::get(NumElements, Scalable));
338 }
340
341 static VectorType *get(Type *ElementType, const VectorType *Other) {
342 return VectorType::get(ElementType, Other->getElementCount());
343 }
344
346 return cast<llvm::VectorType>(LLVMTy)->getElementCount();
347 }
352 int NumSubdivs);
355 LLVM_ABI static bool isValidElementType(Type *ElemTy);
356
357 static bool classof(const Type *From) {
358 return isa<llvm::VectorType>(From->LLVMTy);
359 }
360};
361
363public:
364 LLVM_ABI static FixedVectorType *get(Type *ElementType, unsigned NumElts);
365
366 static FixedVectorType *get(Type *ElementType, const FixedVectorType *FVTy) {
367 return get(ElementType, FVTy->getNumElements());
368 }
369
373
377
382
384 int NumSubdivs) {
386 VectorType::getSubdividedVectorType(VTy, NumSubdivs));
387 }
388
392
396
397 static bool classof(const Type *T) {
398 return isa<llvm::FixedVectorType>(T->LLVMTy);
399 }
400
401 unsigned getNumElements() const {
402 return cast<llvm::FixedVectorType>(LLVMTy)->getNumElements();
403 }
404};
405
407public:
408 LLVM_ABI static ScalableVectorType *get(Type *ElementType,
409 unsigned MinNumElts);
410
411 static ScalableVectorType *get(Type *ElementType,
412 const ScalableVectorType *SVTy) {
413 return get(ElementType, SVTy->getMinNumElements());
414 }
415
419
420 static ScalableVectorType *
425
426 static ScalableVectorType *
431
433 int NumSubdivs) {
435 VectorType::getSubdividedVectorType(VTy, NumSubdivs));
436 }
437
438 static ScalableVectorType *
442
443 static ScalableVectorType *
448
449 unsigned getMinNumElements() const {
450 return cast<llvm::ScalableVectorType>(LLVMTy)->getMinNumElements();
451 }
452
453 static bool classof(const Type *T) {
454 return isa<llvm::ScalableVectorType>(T->LLVMTy);
455 }
456};
457
458class FunctionType : public Type {
459public:
460 // TODO: add missing functions
461 static bool classof(const Type *From) {
462 return isa<llvm::FunctionType>(From->LLVMTy);
463 }
464};
465
466/// Class to represent integer types. Note that this class is also used to
467/// represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and
468/// Int64Ty.
469/// Integer representation type
470class IntegerType : public Type {
471public:
472 LLVM_ABI static IntegerType *get(Context &C, unsigned NumBits);
473 // TODO: add missing functions
474 static bool classof(const Type *From) {
475 return isa<llvm::IntegerType>(From->LLVMTy);
476 }
477 operator llvm::IntegerType &() const {
479 }
480};
481
482} // namespace llvm::sandboxir
483
484#endif // LLVM_SANDBOXIR_TYPE_H
#define LLVM_ABI
Definition Compiler.h:213
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition Compiler.h:661
#define T
This file defines the SmallPtrSet class.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
static constexpr ElementCount get(ScalarTy MinVal, bool Scalable)
Definition TypeSize.h:315
Class to represent integer types.
void reserve(size_type NewNumEntries)
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:46
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
static bool classof(const Type *From)
Definition Type.h:312
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
Definition Type.cpp:823
ConstantDataSequential - A vector or array constant whose element type is a simple 1/2/4/8-byte integ...
Definition Constant.h:498
static FixedVectorType * getExtendedElementVectorType(FixedVectorType *VTy)
Definition Type.h:374
unsigned getNumElements() const
Definition Type.h:401
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
static bool classof(const Type *T)
Definition Type.h:397
static FixedVectorType * getDoubleElementsVectorType(FixedVectorType *VTy)
Definition Type.h:393
static FixedVectorType * get(Type *ElementType, const FixedVectorType *FVTy)
Definition Type.h:366
static FixedVectorType * getHalfElementsVectorType(FixedVectorType *VTy)
Definition Type.h:389
static FixedVectorType * getSubdividedVectorType(FixedVectorType *VTy, int NumSubdivs)
Definition Type.h:383
static FixedVectorType * getTruncatedElementVectorType(FixedVectorType *VTy)
Definition Type.h:378
static FixedVectorType * getInteger(FixedVectorType *VTy)
Definition Type.h:370
static bool classof(const Type *From)
Definition Type.h:461
Class to represent integer types.
Definition Type.h:470
static LLVM_ABI IntegerType * get(Context &C, unsigned NumBits)
static bool classof(const Type *From)
Definition Type.h:474
In SandboxIR the Module is mainly used to access the list of global objects.
Definition Module.h:32
static bool classof(const Type *From)
Definition Type.h:303
static LLVM_ABI PointerType * get(Context &Ctx, unsigned AddressSpace)
Definition Type.cpp:51
static ScalableVectorType * getExtendedElementVectorType(ScalableVectorType *VTy)
Definition Type.h:421
static bool classof(const Type *T)
Definition Type.h:453
static ScalableVectorType * getInteger(ScalableVectorType *VTy)
Definition Type.h:416
static ScalableVectorType * getHalfElementsVectorType(ScalableVectorType *VTy)
Definition Type.h:439
unsigned getMinNumElements() const
Definition Type.h:449
static ScalableVectorType * getDoubleElementsVectorType(ScalableVectorType *VTy)
Definition Type.h:444
static ScalableVectorType * get(Type *ElementType, const ScalableVectorType *SVTy)
Definition Type.h:411
static ScalableVectorType * getSubdividedVectorType(ScalableVectorType *VTy, int NumSubdivs)
Definition Type.h:432
static ScalableVectorType * getTruncatedElementVectorType(ScalableVectorType *VTy)
Definition Type.h:427
static LLVM_ABI ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
static bool classof(const Type *From)
Definition Type.h:326
bool isPacked() const
Definition Type.h:323
static LLVM_ABI StructType * get(Context &Ctx, ArrayRef< Type * > Elements, bool IsPacked=false)
This static method is the primary way to create a literal StructType.
Definition Type.cpp:61
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
Definition Type.h:48
bool isX86_FP80Ty() const
Return true if this is x86 long double.
Definition Type.h:119
bool isScalableTy() const
Return true if this is a type whose size is a known multiple of vscale.
Definition Type.h:155
bool isFP128Ty() const
Return true if this is 'fp128'.
Definition Type.h:122
static LLVM_ABI Type * getHalfTy(Context &Ctx)
Definition Type.cpp:39
friend class ConstantStruct
Definition Type.h:63
friend class ConstantVector
Definition Type.h:64
const fltSemantics & getFltSemantics() const
Definition Type.h:141
friend class FPMathOperator
Definition Type.h:70
friend class Module
Definition Type.h:69
bool isIntOrPtrTy() const
Return true if this is an integer type or a pointer type.
Definition Type.h:187
bool isTargetExtTy() const
Return true if this is a target extension type.
Definition Type.h:149
llvm::Type * LLVMTy
Definition Type.h:50
bool isIEEELikeFPTy() const
Return true if this is a well-behaved IEEE-like type, which has a IEEE compatible layout,...
Definition Type.h:130
Type(llvm::Type *LLVMTy, Context &Ctx)
Definition Type.h:82
static LLVM_ABI IntegerType * getInt64Ty(Context &Ctx)
Definition Type.cpp:18
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition Type.h:133
bool canLosslesslyBitCastTo(Type *Ty) const
Return true if this type could be converted with a lossless BitCast to type 'Ty'.
Definition Type.h:211
friend class TargetExtType
Definition Type.h:68
friend class CmpInst
Definition Type.h:65
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition Type.h:164
static LLVM_ABI Type * getDoubleTy(Context &Ctx)
Definition Type.cpp:33
static LLVM_ABI IntegerType * getInt16Ty(Context &Ctx)
Definition Type.cpp:24
TypeSize getPrimitiveSizeInBits() const
Return the basic size of this type if it is a primitive type.
Definition Type.h:256
friend class ArrayType
Definition Type.h:51
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition Type.h:170
void print(raw_ostream &OS, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
Definition Type.h:93
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition Type.h:178
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition Type.h:158
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition Type.h:287
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition Type.h:104
bool isStructTy() const
True if this is an instance of StructType.
Definition Type.h:193
bool isX86_AMXTy() const
Return true if this is X86 AMX.
Definition Type.h:146
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition Type.h:116
unsigned getScalarSizeInBits() const
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition Type.h:263
static LLVM_ABI IntegerType * getInt8Ty(Context &Ctx)
Definition Type.cpp:27
friend class ConstantDataSequential
Definition Type.h:71
bool is16bitFPTy() const
Return true if this is a 16-bit float type.
Definition Type.h:110
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
Definition Type.h:235
friend class FixedVectorType
Definition Type.h:54
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Definition Type.h:202
static LLVM_ABI IntegerType * getInt1Ty(Context &Ctx)
Definition Type.cpp:30
friend class VectorType
Definition Type.h:53
friend class FunctionType
Definition Type.h:57
bool isArrayTy() const
True if this is an instance of ArrayType.
Definition Type.h:196
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
Definition Type.h:125
LLVM_ABI Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
Definition Type.h:225
LLVM_DUMP_METHOD void dump()
Definition Type.cpp:45
bool isTokenTy() const
Return true if this is 'token'.
Definition Type.h:167
bool isVoidTy() const
Return true if this is 'void'.
Definition Type.h:101
friend class IntegerType
Definition Type.h:58
static LLVM_ABI IntegerType * getInt32Ty(Context &Ctx)
Definition Type.cpp:21
int getFPMantissaWidth() const
Return the width of the mantissa of this type.
Definition Type.h:268
bool isFunctionTy() const
True if this is an instance of FunctionType.
Definition Type.h:190
friend class ConstantArray
Definition Type.h:62
bool isScalableTargetExtTy() const
Return true if this is a target extension type with a scalable layout.
Definition Type.h:152
void dumpOS(raw_ostream &OS)
Definition Type.cpp:44
friend class Function
Definition Type.h:59
bool isVectorTy() const
True if this is an instance of VectorType.
Definition Type.h:205
bool isMultiUnitFPType() const
Returns true if this is a floating-point type that is an unevaluated sum of multiple floating-point u...
Definition Type.h:139
friend class CallBase
Definition Type.h:60
bool isEmptyTy() const
Return true if this type is empty, that is, it has no elements or all of its elements are empty.
Definition Type.h:217
friend class PointerType
Definition Type.h:56
friend class Utils
Definition Type.h:67
bool isPointerTy() const
True if this is an instance of PointerType.
Definition Type.h:199
friend class Context
Definition Type.h:83
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition Type.h:113
bool isIntegerTy(unsigned Bitwidth) const
Return true if this is an IntegerType of the given width.
Definition Type.h:173
bool isAggregateType() const
Return true if the type is an aggregate type.
Definition Type.h:230
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value.
Definition Type.h:221
friend class ScalableVectorType
Definition Type.h:55
friend class ConstantInt
Definition Type.h:61
friend class StructType
Definition Type.h:52
Context & Ctx
Definition Type.h:80
Context & getContext() const
Definition Type.h:98
bool isLabelTy() const
Return true if this is 'label'.
Definition Type.h:161
static LLVM_ABI Type * getFloatTy(Context &Ctx)
Definition Type.cpp:36
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition Type.h:107
bool isIntOrIntVectorTy(unsigned BitWidth) const
Return true if this is an integer type or a vector of integer types of the given width.
Definition Type.h:182
static LLVM_ABI bool isValidElementType(Type *ElemTy)
Definition Type.cpp:859
ElementCount getElementCount() const
Definition Type.h:345
static LLVM_ABI VectorType * getSubdividedVectorType(VectorType *VTy, int NumSubdivs)
Definition Type.cpp:93
static VectorType * get(Type *ElementType, const VectorType *Other)
Definition Type.h:341
static bool classof(const Type *From)
Definition Type.h:357
static VectorType * get(Type *ElementType, unsigned NumElements, bool Scalable)
Definition Type.h:334
static LLVM_ABI VectorType * getInteger(VectorType *VTy)
Definition Type.cpp:79
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
Definition Type.cpp:852
static LLVM_ABI VectorType * getTruncatedElementVectorType(VectorType *VTy)
Definition Type.cpp:88
static LLVM_ABI VectorType * getDoubleElementsVectorType(VectorType *VTy)
Definition Type.cpp:104
static LLVM_ABI VectorType * getHalfElementsVectorType(VectorType *VTy)
Definition Type.cpp:99
static LLVM_ABI VectorType * getExtendedElementVectorType(VectorType *VTy)
Definition Type.cpp:83
LLVM_ABI Type * getElementType() const
Definition Type.cpp:76
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
@ Other
Any other memory.
Definition ModRef.h:68
constexpr unsigned BitWidth
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559