LLVM 24.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
16#include "llvm/ADT/APInt.h"
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 ByteType;
29class CallBase;
30class CmpInst;
32class FixedVectorType;
33class FPMathOperator;
34class FunctionType;
35class IntegerType;
36class Module;
37class PointerType;
39class StructType;
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 ByteType; // For LLVMTy.
53 friend class StructType; // For LLVMTy.
54 friend class VectorType; // For LLVMTy.
55 friend class FixedVectorType; // For LLVMTy.
56 friend class ScalableVectorType; // For LLVMTy.
57 friend class PointerType; // For LLVMTy.
58 friend class FunctionType; // For LLVMTy.
59 friend class IntegerType; // For LLVMTy.
60 friend class Function; // For LLVMTy.
61 friend class CallBase; // For LLVMTy.
62 friend class ConstantInt; // For LLVMTy.
63 friend class ConstantExpr; // For LLVMTy.
64 friend class ConstantArray; // For LLVMTy.
65 friend class ConstantStruct; // For LLVMTy.
66 friend class ConstantVector; // For LLVMTy.
67 friend class CmpInst; // For LLVMTy. TODO: Cleanup after
68 // sandboxir::VectorType is more complete.
69 friend class Utils; // for LLVMTy
70 friend class Module; // For LLVMTy.
71 friend class FPMathOperator; // For LLVMTy.
72 friend class ConstantDataSequential; // For LLVMTy.
73
74 // Friend all instruction classes because `create()` functions use LLVMTy.
75#define DEF_INSTR(ID, OPCODE, CLASS) friend class CLASS;
76#define DEF_CONST(ID, CLASS) friend class CLASS;
77#define DEF_DISABLE_AUTO_UNDEF // ValuesDefFilesList.def includes multiple .def
78#include "llvm/SandboxIR/ValuesDefFilesList.def"
79#undef DEF_INSTR
80#undef DEF_CONST
82
84 friend class Context; // For constructor and ~Type().
85 ~Type() = default;
86
87public:
88 /// Print the current type.
89 /// Omit the type details if \p NoDetails == true.
90 /// E.g., let %st = type { i32, i16 }
91 /// When \p NoDetails is true, we only print %st.
92 /// Put differently, \p NoDetails prints the type as if
93 /// inlined with the operands when printing an instruction.
94 void print(raw_ostream &OS, bool IsForDebug = false,
95 bool NoDetails = false) const {
96 LLVMTy->print(OS, IsForDebug, NoDetails);
97 }
98
99 Context &getContext() const { return Ctx; }
100
101 /// Return true if this is 'void'.
102 bool isVoidTy() const { return LLVMTy->isVoidTy(); }
103
104 /// Return true if this is 'half', a 16-bit IEEE fp type.
105 bool isHalfTy() const { return LLVMTy->isHalfTy(); }
106
107 /// Return true if this is 'bfloat', a 16-bit bfloat type.
108 bool isBFloatTy() const { return LLVMTy->isBFloatTy(); }
109
110 /// Return true if this is a 16-bit float type.
111 bool is16bitFPTy() const { return LLVMTy->is16bitFPTy(); }
112
113 /// Return true if this is 'float', a 32-bit IEEE fp type.
114 bool isFloatTy() const { return LLVMTy->isFloatTy(); }
115
116 /// Return true if this is 'double', a 64-bit IEEE fp type.
117 bool isDoubleTy() const { return LLVMTy->isDoubleTy(); }
118
119 /// Return true if this is x86 long double.
120 bool isX86_FP80Ty() const { return LLVMTy->isX86_FP80Ty(); }
121
122 /// Return true if this is 'fp128'.
123 bool isFP128Ty() const { return LLVMTy->isFP128Ty(); }
124
125 /// Return true if this is powerpc long double.
126 bool isPPC_FP128Ty() const { return LLVMTy->isPPC_FP128Ty(); }
127
128 /// Return true if this is a well-behaved IEEE-like type, which has a IEEE
129 /// compatible layout, and does not have non-IEEE values, such as x86_fp80's
130 /// unnormal values.
131 bool isIEEELikeFPTy() const { return LLVMTy->isIEEELikeFPTy(); }
132
133 /// Return true if this is one of the floating-point types
134 bool isFloatingPointTy() const { return LLVMTy->isFloatingPointTy(); }
135
136 /// Returns true if this is a floating-point type that is an unevaluated sum
137 /// of multiple floating-point units.
138 /// An example of such a type is ppc_fp128, also known as double-double, which
139 /// consists of two IEEE 754 doubles.
140 bool isMultiUnitFPType() const { return LLVMTy->isMultiUnitFPType(); }
141
143 return LLVMTy->getFltSemantics();
144 }
145
146 /// Return true if this is X86 AMX.
147 bool isX86_AMXTy() const { return LLVMTy->isX86_AMXTy(); }
148
149 /// Return true if this is a target extension type.
150 bool isTargetExtTy() const { return LLVMTy->isTargetExtTy(); }
151
152 /// Return true if this is a target extension type with a scalable layout.
153 bool isScalableTargetExtTy() const { return LLVMTy->isScalableTargetExtTy(); }
154
155 /// Return true if this is a type whose size is a known multiple of vscale.
156 bool isScalableTy() const { return LLVMTy->isScalableTy(); }
157
158 /// Return true if this is a FP type or a vector of FP.
159 bool isFPOrFPVectorTy() const { return LLVMTy->isFPOrFPVectorTy(); }
160
161 /// Return true if this is 'label'.
162 bool isLabelTy() const { return LLVMTy->isLabelTy(); }
163
164 /// Return true if this is 'metadata'.
165 bool isMetadataTy() const { return LLVMTy->isMetadataTy(); }
166
167 /// Return true if this is 'token'.
168 bool isTokenTy() const { return LLVMTy->isTokenTy(); }
169
170 /// True if this is an instance of IntegerType.
171 bool isIntegerTy() const { return LLVMTy->isIntegerTy(); }
172
173 /// True if this is an instance of ByteType.
174 bool isByteTy() const { return LLVMTy->isByteTy(); }
175
176 /// Return true if this is a ByteType of the given width.
177 bool isByteTy(unsigned Bitwidth) const { return LLVMTy->isByteTy(Bitwidth); }
178
179 /// Return true if this is an IntegerType of the given width.
180 bool isIntegerTy(unsigned Bitwidth) const {
181 return LLVMTy->isIntegerTy(Bitwidth);
182 }
183
184 /// Return true if this is an integer type or a vector of integer types.
185 bool isIntOrIntVectorTy() const { return LLVMTy->isIntOrIntVectorTy(); }
186
187 /// Return true if this is an integer type or a vector of integer types of
188 /// the given width.
189 bool isIntOrIntVectorTy(unsigned BitWidth) const {
190 return LLVMTy->isIntOrIntVectorTy(BitWidth);
191 }
192
193 /// Return true if this is an integer type or a pointer type.
194 bool isIntOrPtrTy() const { return LLVMTy->isIntOrPtrTy(); }
195
196 /// True if this is an instance of FunctionType.
197 bool isFunctionTy() const { return LLVMTy->isFunctionTy(); }
198
199 /// True if this is an instance of StructType.
200 bool isStructTy() const { return LLVMTy->isStructTy(); }
201
202 /// True if this is an instance of ArrayType.
203 bool isArrayTy() const { return LLVMTy->isArrayTy(); }
204
205 /// True if this is an instance of PointerType.
206 bool isPointerTy() const { return LLVMTy->isPointerTy(); }
207
208 /// Return true if this is a pointer type or a vector of pointer types.
209 bool isPtrOrPtrVectorTy() const { return LLVMTy->isPtrOrPtrVectorTy(); }
210
211 /// True if this is an instance of VectorType.
212 inline bool isVectorTy() const { return LLVMTy->isVectorTy(); }
213
214 /// Return true if this type could be converted with a lossless BitCast to
215 /// type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the
216 /// same size only where no re-interpretation of the bits is done.
217 /// Determine if this type could be losslessly bitcast to Ty
218 bool canLosslesslyBitCastTo(Type *Ty) const {
219 return LLVMTy->canLosslesslyBitCastTo(Ty->LLVMTy);
220 }
221
222 /// Return true if this type is empty, that is, it has no elements or all of
223 /// its elements are empty.
224 bool isEmptyTy() const { return LLVMTy->isEmptyTy(); }
225
226 /// Return true if the type is "first class", meaning it is a valid type for a
227 /// Value.
228 bool isFirstClassType() const { return LLVMTy->isFirstClassType(); }
229
230 /// Return true if the type is a valid type for a register in codegen. This
231 /// includes all first-class types except struct and array types.
232 bool isSingleValueType() const { return LLVMTy->isSingleValueType(); }
233
234 /// Return true if the type is an aggregate type. This means it is valid as
235 /// the first operand of an insertvalue or extractvalue instruction. This
236 /// includes struct and array types, but does not include vector types.
237 bool isAggregateType() const { return LLVMTy->isAggregateType(); }
238
239 /// Return true if it makes sense to take the size of this type. To get the
240 /// actual size for a particular target, it is reasonable to use the
241 /// DataLayout subsystem to do this.
242 bool isSized() const { return LLVMTy->isSized(); }
243
244 /// Return the basic size of this type if it is a primitive type. These are
245 /// fixed by LLVM and are not target-dependent.
246 /// This will return zero if the type does not have a size or is not a
247 /// primitive type.
248 ///
249 /// If this is a scalable vector type, the scalable property will be set and
250 /// the runtime size will be a positive integer multiple of the base size.
251 ///
252 /// Note that this may not reflect the size of memory allocated for an
253 /// instance of the type or the number of bytes that are written when an
254 /// instance of the type is stored to memory. The DataLayout class provides
255 /// additional query functions to provide this information.
256 ///
258 return LLVMTy->getPrimitiveSizeInBits();
259 }
260
261 /// If this is a vector type, return the getPrimitiveSizeInBits value for the
262 /// element type. Otherwise return the getPrimitiveSizeInBits value for this
263 /// type.
264 unsigned getScalarSizeInBits() const { return LLVMTy->getScalarSizeInBits(); }
265
266 /// Return the width of the mantissa of this type. This is only valid on
267 /// floating-point types. If the FP type does not have a stable mantissa (e.g.
268 /// ppc long double), this method returns -1.
269 int getFPMantissaWidth() const { return LLVMTy->getFPMantissaWidth(); }
270
271 /// If this is a vector type, return the element type, otherwise return
272 /// 'this'.
274
275 // TODO: ADD MISSING
276
282 LLVM_ABI static ByteType *getByteNTy(Context &Ctx, unsigned N);
289 /// Returns an integer (vector of integer) type with the same size of a byte
290 /// of the given byte (vector of byte) type.
292 /// Returns a byte (vector of byte) type with the same size of an integer of
293 /// the given integer (vector of integer) type.
298 // TODO: missing get*
299
300 /// Get the address space of this pointer or pointer vector type.
301 inline unsigned getPointerAddressSpace() const {
302 return LLVMTy->getPointerAddressSpace();
303 }
304
305#ifndef NDEBUG
306 void dumpOS(raw_ostream &OS);
307 LLVM_DUMP_METHOD void dump();
308#endif // NDEBUG
309};
310
311class PointerType : public Type {
312public:
313 // TODO: add missing functions
314
315 LLVM_ABI static PointerType *get(Context &Ctx, unsigned AddressSpace);
316
317 static bool classof(const Type *From) {
318 return isa<llvm::PointerType>(From->LLVMTy);
319 }
320
321 /// Return the address space of the Pointer type.
322 inline unsigned getAddressSpace() const {
323 return cast<llvm::PointerType>(LLVMTy)->getAddressSpace();
324 }
325};
326
327class ArrayType : public Type {
328public:
329 LLVM_ABI static ArrayType *get(Type *ElementType, uint64_t NumElements);
330 // TODO: add missing functions
331 static bool classof(const Type *From) {
332 return isa<llvm::ArrayType>(From->LLVMTy);
333 }
334};
335
336class StructType : public Type {
337public:
338 /// This static method is the primary way to create a literal StructType.
340 bool IsPacked = false);
341
342 bool isPacked() const { return cast<llvm::StructType>(LLVMTy)->isPacked(); }
343
344 // TODO: add missing functions
345 static bool classof(const Type *From) {
346 return isa<llvm::StructType>(From->LLVMTy);
347 }
348};
349
350class VectorType : public Type {
351public:
352 LLVM_ABI static VectorType *get(Type *ElementType, ElementCount EC);
353 static VectorType *get(Type *ElementType, unsigned NumElements,
354 bool Scalable) {
355 return VectorType::get(ElementType,
356 ElementCount::get(NumElements, Scalable));
357 }
359
360 static VectorType *get(Type *ElementType, const VectorType *Other) {
361 return VectorType::get(ElementType, Other->getElementCount());
362 }
363
365 return cast<llvm::VectorType>(LLVMTy)->getElementCount();
366 }
371 int NumSubdivs);
375
376 static bool classof(const Type *From) {
377 return isa<llvm::VectorType>(From->LLVMTy);
378 }
379};
380
382public:
383 LLVM_ABI static FixedVectorType *get(Type *ElementType, unsigned NumElts);
384
385 static FixedVectorType *get(Type *ElementType, const FixedVectorType *FVTy) {
386 return get(ElementType, FVTy->getNumElements());
387 }
388
392
396
401
403 int NumSubdivs) {
405 VectorType::getSubdividedVectorType(VTy, NumSubdivs));
406 }
407
411
415
416 static bool classof(const Type *T) {
417 return isa<llvm::FixedVectorType>(T->LLVMTy);
418 }
419
420 unsigned getNumElements() const {
421 return cast<llvm::FixedVectorType>(LLVMTy)->getNumElements();
422 }
423};
424
426public:
427 LLVM_ABI static ScalableVectorType *get(Type *ElementType,
428 unsigned MinNumElts);
429
430 static ScalableVectorType *get(Type *ElementType,
431 const ScalableVectorType *SVTy) {
432 return get(ElementType, SVTy->getMinNumElements());
433 }
434
438
439 static ScalableVectorType *
444
445 static ScalableVectorType *
450
452 int NumSubdivs) {
454 VectorType::getSubdividedVectorType(VTy, NumSubdivs));
455 }
456
457 static ScalableVectorType *
461
462 static ScalableVectorType *
467
468 unsigned getMinNumElements() const {
469 return cast<llvm::ScalableVectorType>(LLVMTy)->getMinNumElements();
470 }
471
472 static bool classof(const Type *T) {
473 return isa<llvm::ScalableVectorType>(T->LLVMTy);
474 }
475};
476
477class FunctionType : public Type {
478public:
479 // TODO: add missing functions
480 static bool classof(const Type *From) {
481 return isa<llvm::FunctionType>(From->LLVMTy);
482 }
483};
484
485/// Class to represent integer types. Note that this class is also used to
486/// represent the built-in integer types: Int1Ty, Int8Ty, Int16Ty, Int32Ty and
487/// Int64Ty.
488/// Integer representation type
489class IntegerType : public Type {
490public:
491 LLVM_ABI static IntegerType *get(Context &C, unsigned NumBits);
492 // TODO: add missing functions
493 static bool classof(const Type *From) {
494 return isa<llvm::IntegerType>(From->LLVMTy);
495 }
496 operator llvm::IntegerType &() const {
498 }
499};
500
501/// Class to represent byte types.
502class ByteType : public Type {
503public:
504 LLVM_ABI static ByteType *get(Context &C, unsigned NumBits);
505
506 /// Get the number of bits in this ByteType
507 unsigned getBitWidth() const {
508 return cast<llvm::ByteType>(LLVMTy)->getBitWidth();
509 }
510
511 /// Get a bit mask for this type.
512 APInt getMask() const { return cast<llvm::ByteType>(LLVMTy)->getMask(); }
513
514 static bool classof(const Type *From) {
515 return isa<llvm::ByteType>(From->LLVMTy);
516 }
517};
518
519} // namespace llvm::sandboxir
520
521#endif // LLVM_SANDBOXIR_TYPE_H
uint64_t uint64_t
This file implements a class to represent arbitrary precision integral constant values and operations...
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_ABI
Definition Compiler.h:211
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition Compiler.h:690
#define T
Class for arbitrary precision integers.
Definition APInt.h:78
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:312
Class to represent integer types.
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:331
static LLVM_ABI ArrayType * get(Type *ElementType, uint64_t NumElements)
Definition Type.cpp:793
Class to represent byte types.
Definition Type.h:502
APInt getMask() const
Get a bit mask for this type.
Definition Type.h:512
static LLVM_ABI ByteType * get(Context &C, unsigned NumBits)
static bool classof(const Type *From)
Definition Type.h:514
unsigned getBitWidth() const
Get the number of bits in this ByteType.
Definition Type.h:507
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:393
unsigned getNumElements() const
Definition Type.h:420
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
static bool classof(const Type *T)
Definition Type.h:416
static FixedVectorType * getDoubleElementsVectorType(FixedVectorType *VTy)
Definition Type.h:412
static FixedVectorType * get(Type *ElementType, const FixedVectorType *FVTy)
Definition Type.h:385
static FixedVectorType * getHalfElementsVectorType(FixedVectorType *VTy)
Definition Type.h:408
static FixedVectorType * getSubdividedVectorType(FixedVectorType *VTy, int NumSubdivs)
Definition Type.h:402
static FixedVectorType * getTruncatedElementVectorType(FixedVectorType *VTy)
Definition Type.h:397
static FixedVectorType * getInteger(FixedVectorType *VTy)
Definition Type.h:389
static bool classof(const Type *From)
Definition Type.h:480
Class to represent integer types.
Definition Type.h:489
static LLVM_ABI IntegerType * get(Context &C, unsigned NumBits)
static bool classof(const Type *From)
Definition Type.h:493
In SandboxIR the Module is mainly used to access the list of global objects.
Definition Module.h:34
static bool classof(const Type *From)
Definition Type.h:317
static LLVM_ABI PointerType * get(Context &Ctx, unsigned AddressSpace)
Definition Type.cpp:78
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Definition Type.h:322
static ScalableVectorType * getExtendedElementVectorType(ScalableVectorType *VTy)
Definition Type.h:440
static bool classof(const Type *T)
Definition Type.h:472
static ScalableVectorType * getInteger(ScalableVectorType *VTy)
Definition Type.h:435
static ScalableVectorType * getHalfElementsVectorType(ScalableVectorType *VTy)
Definition Type.h:458
unsigned getMinNumElements() const
Definition Type.h:468
static ScalableVectorType * getDoubleElementsVectorType(ScalableVectorType *VTy)
Definition Type.h:463
static ScalableVectorType * get(Type *ElementType, const ScalableVectorType *SVTy)
Definition Type.h:430
static ScalableVectorType * getSubdividedVectorType(ScalableVectorType *VTy, int NumSubdivs)
Definition Type.h:451
static ScalableVectorType * getTruncatedElementVectorType(ScalableVectorType *VTy)
Definition Type.h:446
static LLVM_ABI ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
static bool classof(const Type *From)
Definition Type.h:345
bool isPacked() const
Definition Type.h:342
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:88
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:120
bool isScalableTy() const
Return true if this is a type whose size is a known multiple of vscale.
Definition Type.h:156
bool isFP128Ty() const
Return true if this is 'fp128'.
Definition Type.h:123
static LLVM_ABI Type * getHalfTy(Context &Ctx)
Definition Type.cpp:66
static LLVM_ABI Type * getIntFromByteType(Type *Ty)
Returns an integer (vector of integer) type with the same size of a byte of the given byte (vector of...
static LLVM_ABI ByteType * getByte8Ty(Context &Ctx)
Definition Type.cpp:39
friend class ConstantStruct
Definition Type.h:65
friend class ConstantVector
Definition Type.h:66
const fltSemantics & getFltSemantics() const
Definition Type.h:142
friend class FPMathOperator
Definition Type.h:71
friend class Module
Definition Type.h:70
bool isIntOrPtrTy() const
Return true if this is an integer type or a pointer type.
Definition Type.h:194
bool isTargetExtTy() const
Return true if this is a target extension type.
Definition Type.h:150
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:131
Type(llvm::Type *LLVMTy, Context &Ctx)
Definition Type.h:83
static LLVM_ABI IntegerType * getInt64Ty(Context &Ctx)
Definition Type.cpp:18
static LLVM_ABI ByteType * getByte128Ty(Context &Ctx)
Definition Type.cpp:51
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition Type.h:134
bool canLosslesslyBitCastTo(Type *Ty) const
Return true if this type could be converted with a lossless BitCast to type 'Ty'.
Definition Type.h:218
friend class CmpInst
Definition Type.h:67
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition Type.h:165
bool isByteTy() const
True if this is an instance of ByteType.
Definition Type.h:174
static LLVM_ABI Type * getDoubleTy(Context &Ctx)
Definition Type.cpp:60
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:257
friend class ArrayType
Definition Type.h:51
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition Type.h:171
void print(raw_ostream &OS, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
Definition Type.h:94
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition Type.h:185
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition Type.h:159
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition Type.h:301
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition Type.h:105
bool isStructTy() const
True if this is an instance of StructType.
Definition Type.h:200
bool isX86_AMXTy() const
Return true if this is X86 AMX.
Definition Type.h:147
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition Type.h:117
unsigned getScalarSizeInBits() const
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Definition Type.h:264
static LLVM_ABI IntegerType * getInt8Ty(Context &Ctx)
Definition Type.cpp:27
friend class ConstantDataSequential
Definition Type.h:72
bool is16bitFPTy() const
Return true if this is a 16-bit float type.
Definition Type.h:111
friend class FixedVectorType
Definition Type.h:55
static LLVM_ABI ByteType * getByte64Ty(Context &Ctx)
Definition Type.cpp:48
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Definition Type.h:209
friend class ConstantExpr
Definition Type.h:63
static LLVM_ABI IntegerType * getInt1Ty(Context &Ctx)
Definition Type.cpp:30
friend class VectorType
Definition Type.h:54
friend class FunctionType
Definition Type.h:58
bool isArrayTy() const
True if this is an instance of ArrayType.
Definition Type.h:203
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
Definition Type.h:126
LLVM_ABI Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
bool isSized() const
Return true if it makes sense to take the size of this type.
Definition Type.h:242
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
Definition Type.h:232
LLVM_DUMP_METHOD void dump()
Definition Type.cpp:72
static LLVM_ABI ByteType * getByteNTy(Context &Ctx, unsigned N)
Definition Type.cpp:33
bool isTokenTy() const
Return true if this is 'token'.
Definition Type.h:168
bool isVoidTy() const
Return true if this is 'void'.
Definition Type.h:102
static LLVM_ABI ByteType * getByte16Ty(Context &Ctx)
Definition Type.cpp:42
friend class IntegerType
Definition Type.h:59
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:269
bool isFunctionTy() const
True if this is an instance of FunctionType.
Definition Type.h:197
friend class ConstantArray
Definition Type.h:64
bool isScalableTargetExtTy() const
Return true if this is a target extension type with a scalable layout.
Definition Type.h:153
void dumpOS(raw_ostream &OS)
Definition Type.cpp:71
friend class Function
Definition Type.h:60
bool isVectorTy() const
True if this is an instance of VectorType.
Definition Type.h:212
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:140
friend class CallBase
Definition Type.h:61
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:224
friend class PointerType
Definition Type.h:57
friend class Utils
Definition Type.h:69
bool isPointerTy() const
True if this is an instance of PointerType.
Definition Type.h:206
friend class Context
Definition Type.h:84
static LLVM_ABI Type * getByteFromIntType(Type *Ty)
Returns a byte (vector of byte) type with the same size of an integer of the given integer (vector of...
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition Type.h:114
bool isIntegerTy(unsigned Bitwidth) const
Return true if this is an IntegerType of the given width.
Definition Type.h:180
bool isAggregateType() const
Return true if the type is an aggregate type.
Definition Type.h:237
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value.
Definition Type.h:228
friend class ScalableVectorType
Definition Type.h:56
friend class ConstantInt
Definition Type.h:62
friend class StructType
Definition Type.h:53
Context & Ctx
Definition Type.h:81
static LLVM_ABI ByteType * getByte32Ty(Context &Ctx)
Definition Type.cpp:45
Context & getContext() const
Definition Type.h:99
friend class ByteType
Definition Type.h:52
bool isLabelTy() const
Return true if this is 'label'.
Definition Type.h:162
static LLVM_ABI Type * getFloatTy(Context &Ctx)
Definition Type.cpp:63
bool isByteTy(unsigned Bitwidth) const
Return true if this is a ByteType of the given width.
Definition Type.h:177
static LLVM_ABI ByteType * getByte1Ty(Context &Ctx)
Definition Type.cpp:36
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition Type.h:108
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:189
static LLVM_ABI bool isValidElementType(Type *ElemTy)
Definition Type.cpp:829
ElementCount getElementCount() const
Definition Type.h:364
static LLVM_ABI VectorType * getSubdividedVectorType(VectorType *VTy, int NumSubdivs)
Definition Type.cpp:120
static VectorType * get(Type *ElementType, const VectorType *Other)
Definition Type.h:360
static bool classof(const Type *From)
Definition Type.h:376
static VectorType * get(Type *ElementType, unsigned NumElements, bool Scalable)
Definition Type.h:353
static LLVM_ABI VectorType * getInteger(VectorType *VTy)
Definition Type.cpp:106
static LLVM_ABI VectorType * get(Type *ElementType, ElementCount EC)
Definition Type.cpp:822
static LLVM_ABI VectorType * getTruncatedElementVectorType(VectorType *VTy)
Definition Type.cpp:115
static LLVM_ABI VectorType * getDoubleElementsVectorType(VectorType *VTy)
Definition Type.cpp:131
static LLVM_ABI VectorType * getHalfElementsVectorType(VectorType *VTy)
Definition Type.cpp:126
static LLVM_ABI VectorType * getExtendedElementVectorType(VectorType *VTy)
Definition Type.cpp:110
LLVM_ABI Type * getElementType() const
Definition Type.cpp:103
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
#define N