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