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