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;
30class ConstantDataSequential;
31class FixedVectorType;
32class FPMathOperator;
33class FunctionType;
34class IntegerType;
35class Module;
36class PointerType;
37class ScalableVectorType;
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.
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 {
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 {
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 ///
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.
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 {
285 }
286
287#ifndef NDEBUG
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
367 return cast<FixedVectorType>(VectorType::getInteger(VTy));
368 }
369
371 return cast<FixedVectorType>(VectorType::getExtendedElementVectorType(VTy));
372 }
373
375 return cast<FixedVectorType>(
377 }
378
380 int NumSubdivs) {
381 return cast<FixedVectorType>(
382 VectorType::getSubdividedVectorType(VTy, NumSubdivs));
383 }
384
386 return cast<FixedVectorType>(VectorType::getHalfElementsVectorType(VTy));
387 }
388
390 return cast<FixedVectorType>(VectorType::getDoubleElementsVectorType(VTy));
391 }
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
413 return cast<ScalableVectorType>(VectorType::getInteger(VTy));
414 }
415
416 static ScalableVectorType *
418 return cast<ScalableVectorType>(
420 }
421
422 static ScalableVectorType *
424 return cast<ScalableVectorType>(
426 }
427
429 int NumSubdivs) {
430 return cast<ScalableVectorType>(
431 VectorType::getSubdividedVectorType(VTy, NumSubdivs));
432 }
433
434 static ScalableVectorType *
436 return cast<ScalableVectorType>(VectorType::getHalfElementsVectorType(VTy));
437 }
438
439 static ScalableVectorType *
441 return cast<ScalableVectorType>(
443 }
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 {
474 return *cast<llvm::IntegerType>(LLVMTy);
475 }
476};
477
478} // namespace llvm::sandboxir
479
480#endif // LLVM_SANDBOXIR_TYPE_H
BlockVerifier::State From
#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
Machine Check Debug Module
raw_pwrite_stream & OS
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:318
Class to represent integer types.
Definition: DerivedTypes.h:42
void reserve(size_type NewNumEntries)
Definition: SmallPtrSet.h:117
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:380
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:401
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:541
Class to represent target extensions types, which are generally unintrospectable from target-independ...
Definition: DerivedTypes.h:781
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
bool isVectorTy() const
True if this is an instance of VectorType.
Definition: Type.h:273
bool isX86_FP80Ty() const
Return true if this is x86 long double.
Definition: Type.h:159
LLVM_ABI int getFPMantissaWidth() const
Return the width of the mantissa of this type.
LLVM_ABI bool canLosslesslyBitCastTo(Type *Ty) const
Return true if this type could be converted with a lossless BitCast to type 'Ty'.
bool isArrayTy() const
True if this is an instance of ArrayType.
Definition: Type.h:264
bool isLabelTy() const
Return true if this is 'label'.
Definition: Type.h:228
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition: Type.h:246
LLVM_ABI bool isEmptyTy() const
Return true if this type is empty, that is, it has no elements or all of its elements are empty.
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:267
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition: Type.h:153
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition: Type.h:145
LLVM_ABI bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value.
LLVM_ABI bool isScalableTargetExtTy() const
Return true if this is a target extension type with a scalable layout.
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
Definition: Type.h:296
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
Definition: Type.h:165
bool isFP128Ty() const
Return true if this is 'fp128'.
Definition: Type.h:162
bool is16bitFPTy() const
Return true if this is a 16-bit float type.
Definition: Type.h:148
LLVM_ABI unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
LLVM_ABI bool isScalableTy(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this is a type whose size is a known multiple of vscale.
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:193
bool isStructTy() const
True if this is an instance of StructType.
Definition: Type.h:261
bool isTargetExtTy() const
Return true if this is a target extension type.
Definition: Type.h:203
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
Definition: Type.h:311
bool isAggregateType() const
Return true if the type is an aggregate type.
Definition: Type.h:304
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition: Type.h:142
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition: Type.h:156
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition: Type.h:184
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Definition: Type.h:270
bool isX86_AMXTy() const
Return true if this is X86 AMX.
Definition: Type.h:200
bool isFunctionTy() const
True if this is an instance of FunctionType.
Definition: Type.h:258
bool isIntOrPtrTy() const
Return true if this is an integer type or a pointer type.
Definition: Type.h:255
LLVM_ABI const fltSemantics & getFltSemantics() const
LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:240
bool isTokenTy() const
Return true if this is 'token'.
Definition: Type.h:234
LLVM_ABI void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition: Type.h:225
bool isIEEELikeFPTy() const
Return true if this is a well-behaved IEEE-like type, which has a IEEE compatible layout,...
Definition: Type.h:170
bool isVoidTy() const
Return true if this is 'void'.
Definition: Type.h:139
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition: Type.h:231
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
const fltSemantics & getFltSemantics() const
Definition: Type.h:137
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
static LLVM_ABI Type * getDoubleTy(Context &Ctx)
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
static LLVM_ABI Type * getInt8Ty(Context &Ctx)
bool canLosslesslyBitCastTo(Type *Ty) const
Return true if this type could be converted with a lossless BitCast to type 'Ty'.
Definition: Type.h:207
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition: Type.h:160
TypeSize getPrimitiveSizeInBits() const
Return the basic size of this type if it is a primitive type.
Definition: Type.h:252
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
void dumpOS(raw_ostream &OS)
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
bool is16bitFPTy() const
Return true if this is a 16-bit float type.
Definition: Type.h:106
static LLVM_ABI Type * getInt64Ty(Context &Ctx)
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)
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Definition: Type.h:198
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
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
static LLVM_ABI Type * getInt16Ty(Context &Ctx)
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
bool isScalableTargetExtTy() const
Return true if this is a target extension type with a scalable layout.
Definition: Type.h:148
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
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
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:195
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
static LLVM_ABI Type * getHalfTy(Context &Ctx)
static LLVM_ABI Type * getInt32Ty(Context &Ctx)
Context & Ctx
Definition: Type.h:76
Context & getContext() const
Definition: Type.h:94
static LLVM_ABI Type * getFloatTy(Context &Ctx)
LLVM_DUMP_METHOD void dump()
bool isLabelTy() const
Return true if this is 'label'.
Definition: Type.h:157
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
@ Other
Any other memory.
constexpr unsigned BitWidth
Definition: BitmaskEnum.h:223