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