Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Type.h
Go to the documentation of this file.
1//===- llvm/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 file contains the declaration of the Type class. For more "Type"
10// stuff, look in DerivedTypes.h.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_IR_TYPE_H
15#define LLVM_IR_TYPE_H
16
17#include "llvm/ADT/ArrayRef.h"
18#include "llvm/Support/CBindingWrapping.h"
19#include "llvm/Support/Casting.h"
20#include "llvm/Support/Compiler.h"
21#include "llvm/Support/ErrorHandling.h"
22#include "llvm/Support/TypeSize.h"
23#include <cassert>
24#include <cstdint>
25#include <iterator>
26
27namespacellvm {
28
29classIntegerType;
30structfltSemantics;
31classLLVMContext;
32classPointerType;
33classraw_ostream;
34classStringRef;
35template <typename PtrType>classSmallPtrSetImpl;
36
37/// The instances of the Type class are immutable: once they are created,
38/// they are never changed. Also note that only one instance of a particular
39/// type is ever created. Thus seeing if two types are equal is a matter of
40/// doing a trivial pointer comparison. To enforce that no two equal instances
41/// are created, Type instances can only be created via static factory methods
42/// in class Type and in derived classes. Once allocated, Types are never
43/// free'd.
44///
45classType {
46public:
47//===--------------------------------------------------------------------===//
48 /// Definitions of all of the base types for the Type system. Based on this
49 /// value, you can cast to a class defined in DerivedTypes.h.
50 /// Note: If you add an element to this, you need to add an element to the
51 /// Type::getPrimitiveType function, or else things will break!
52 /// Also update LLVMTypeKind and LLVMGetTypeKind () in the C binding.
53 ///
54enumTypeID {
55// PrimitiveTypes
56HalfTyID = 0,///< 16-bit floating point type
57BFloatTyID,///< 16-bit floating point type (7-bit significand)
58FloatTyID,///< 32-bit floating point type
59DoubleTyID,///< 64-bit floating point type
60X86_FP80TyID,///< 80-bit floating point type (X87)
61FP128TyID,///< 128-bit floating point type (112-bit significand)
62PPC_FP128TyID,///< 128-bit floating point type (two 64-bits, PowerPC)
63VoidTyID,///< type with no size
64LabelTyID,///< Labels
65MetadataTyID,///< Metadata
66X86_AMXTyID,///< AMX vectors (8192 bits, X86 specific)
67TokenTyID,///< Tokens
68
69// Derived types... see DerivedTypes.h file.
70IntegerTyID,///< Arbitrary bit width integers
71FunctionTyID,///< Functions
72PointerTyID,///< Pointers
73StructTyID,///< Structures
74ArrayTyID,///< Arrays
75FixedVectorTyID,///< Fixed width SIMD vector type
76ScalableVectorTyID,///< Scalable SIMD vector type
77TypedPointerTyID,///< Typed pointer used by some GPU targets
78TargetExtTyID,///< Target extension type
79 };
80
81private:
82 /// This refers to the LLVMContext in which this type was uniqued.
83LLVMContext &Context;
84
85TypeIDID : 8;// The current base type of this type.
86unsigned SubclassData : 24;// Space for subclasses to store data.
87// Note that this should be synchronized with
88// MAX_INT_BITS value in IntegerType class.
89
90protected:
91friendclassLLVMContextImpl;
92
93explicitType(LLVMContext &C,TypeID tid)
94 : Context(C),ID(tid), SubclassData(0) {}
95~Type() =default;
96
97unsignedgetSubclassData() const{return SubclassData; }
98
99voidsetSubclassData(unsigned val) {
100 SubclassData = val;
101// Ensure we don't have any accidental truncation.
102assert(getSubclassData() == val &&"Subclass data too large for field");
103 }
104
105 /// Keeps track of how many Type*'s there are in the ContainedTys list.
106unsignedNumContainedTys = 0;
107
108 /// A pointer to the array of Types contained by this Type. For example, this
109 /// includes the arguments of a function type, the elements of a structure,
110 /// the pointee of a pointer, the element type of an array, etc. This pointer
111 /// may be 0 for types that don't contain other types (Integer, Double,
112 /// Float).
113Type *const *ContainedTys =nullptr;
114
115public:
116 /// Print the current type.
117 /// Omit the type details if \p NoDetails == true.
118 /// E.g., let %st = type { i32, i16 }
119 /// When \p NoDetails is true, we only print %st.
120 /// Put differently, \p NoDetails prints the type as if
121 /// inlined with the operands when printing an instruction.
122voidprint(raw_ostream &O,bool IsForDebug =false,
123bool NoDetails =false)const;
124
125voiddump()const;
126
127 /// Return the LLVMContext in which this type was uniqued.
128LLVMContext &getContext() const{return Context; }
129
130//===--------------------------------------------------------------------===//
131// Accessors for working with types.
132//
133
134 /// Return the type id for the type. This will return one of the TypeID enum
135 /// elements defined above.
136TypeIDgetTypeID() const{returnID; }
137
138 /// Return true if this is 'void'.
139boolisVoidTy() const{returngetTypeID() ==VoidTyID; }
140
141 /// Return true if this is 'half', a 16-bit IEEE fp type.
142boolisHalfTy() const{returngetTypeID() ==HalfTyID; }
143
144 /// Return true if this is 'bfloat', a 16-bit bfloat type.
145boolisBFloatTy() const{returngetTypeID() ==BFloatTyID; }
146
147 /// Return true if this is a 16-bit float type.
148boolis16bitFPTy() const{
149returngetTypeID() ==BFloatTyID ||getTypeID() ==HalfTyID;
150 }
151
152 /// Return true if this is 'float', a 32-bit IEEE fp type.
153boolisFloatTy() const{returngetTypeID() ==FloatTyID; }
154
155 /// Return true if this is 'double', a 64-bit IEEE fp type.
156boolisDoubleTy() const{returngetTypeID() ==DoubleTyID; }
157
158 /// Return true if this is x86 long double.
159boolisX86_FP80Ty() const{returngetTypeID() ==X86_FP80TyID; }
160
161 /// Return true if this is 'fp128'.
162boolisFP128Ty() const{returngetTypeID() ==FP128TyID; }
163
164 /// Return true if this is powerpc long double.
165boolisPPC_FP128Ty() const{returngetTypeID() ==PPC_FP128TyID; }
166
167 /// Return true if this is a well-behaved IEEE-like type, which has a IEEE
168 /// compatible layout as defined by APFloat::isIEEE(), and does not have
169 /// non-IEEE values, such as x86_fp80's unnormal values.
170boolisIEEELikeFPTy() const{
171switch (getTypeID()) {
172caseDoubleTyID:
173caseFloatTyID:
174caseHalfTyID:
175caseBFloatTyID:
176caseFP128TyID:
177returntrue;
178default:
179returnfalse;
180 }
181 }
182
183 /// Return true if this is one of the floating-point types
184boolisFloatingPointTy() const{
185returnisIEEELikeFPTy() ||getTypeID() ==X86_FP80TyID ||
186getTypeID() ==PPC_FP128TyID;
187 }
188
189 /// Returns true if this is a floating-point type that is an unevaluated sum
190 /// of multiple floating-point units.
191 /// An example of such a type is ppc_fp128, also known as double-double, which
192 /// consists of two IEEE 754 doubles.
193boolisMultiUnitFPType() const{
194returngetTypeID() ==PPC_FP128TyID;
195 }
196
197constfltSemantics &getFltSemantics()const;
198
199 /// Return true if this is X86 AMX.
200boolisX86_AMXTy() const{returngetTypeID() ==X86_AMXTyID; }
201
202 /// Return true if this is a target extension type.
203boolisTargetExtTy() const{returngetTypeID() ==TargetExtTyID; }
204
205 /// Return true if this is a target extension type with a scalable layout.
206boolisScalableTargetExtTy()const;
207
208 /// Return true if this is a type whose size is a known multiple of vscale.
209boolisScalableTy(SmallPtrSetImpl<const Type *> &Visited)const;
210boolisScalableTy()const;
211
212 /// Return true if this type is or contains a target extension type that
213 /// disallows being used as a global.
214bool
215containsNonGlobalTargetExtType(SmallPtrSetImpl<const Type *> &Visited)const;
216boolcontainsNonGlobalTargetExtType()const;
217
218 /// Return true if this type is or contains a target extension type that
219 /// disallows being used as a local.
220bool
221containsNonLocalTargetExtType(SmallPtrSetImpl<const Type *> &Visited)const;
222boolcontainsNonLocalTargetExtType()const;
223
224 /// Return true if this is a FP type or a vector of FP.
225boolisFPOrFPVectorTy() const{returngetScalarType()->isFloatingPointTy(); }
226
227 /// Return true if this is 'label'.
228boolisLabelTy() const{returngetTypeID() ==LabelTyID; }
229
230 /// Return true if this is 'metadata'.
231boolisMetadataTy() const{returngetTypeID() ==MetadataTyID; }
232
233 /// Return true if this is 'token'.
234boolisTokenTy() const{returngetTypeID() ==TokenTyID; }
235
236 /// True if this is an instance of IntegerType.
237boolisIntegerTy() const{returngetTypeID() ==IntegerTyID; }
238
239 /// Return true if this is an IntegerType of the given width.
240boolisIntegerTy(unsigned Bitwidth)const;
241
242 /// Return true if this is an integer type or a vector of integer types.
243boolisIntOrIntVectorTy() const{returngetScalarType()->isIntegerTy(); }
244
245 /// Return true if this is an integer type or a vector of integer types of
246 /// the given width.
247boolisIntOrIntVectorTy(unsignedBitWidth) const{
248returngetScalarType()->isIntegerTy(BitWidth);
249 }
250
251 /// Return true if this is an integer type or a pointer type.
252boolisIntOrPtrTy() const{returnisIntegerTy() ||isPointerTy(); }
253
254 /// True if this is an instance of FunctionType.
255boolisFunctionTy() const{returngetTypeID() ==FunctionTyID; }
256
257 /// True if this is an instance of StructType.
258boolisStructTy() const{returngetTypeID() ==StructTyID; }
259
260 /// True if this is an instance of ArrayType.
261boolisArrayTy() const{returngetTypeID() ==ArrayTyID; }
262
263 /// True if this is an instance of PointerType.
264boolisPointerTy() const{returngetTypeID() ==PointerTyID; }
265
266 /// Return true if this is a pointer type or a vector of pointer types.
267boolisPtrOrPtrVectorTy() const{returngetScalarType()->isPointerTy(); }
268
269 /// True if this is an instance of VectorType.
270inlineboolisVectorTy() const{
271returngetTypeID() ==ScalableVectorTyID ||getTypeID() ==FixedVectorTyID;
272 }
273
274// True if this is an instance of TargetExtType of RISC-V vector tuple.
275boolisRISCVVectorTupleTy()const;
276
277 /// Return true if this type could be converted with a lossless BitCast to
278 /// type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the
279 /// same size only where no re-interpretation of the bits is done.
280 /// Determine if this type could be losslessly bitcast to Ty
281boolcanLosslesslyBitCastTo(Type *Ty)const;
282
283 /// Return true if this type is empty, that is, it has no elements or all of
284 /// its elements are empty.
285boolisEmptyTy()const;
286
287 /// Return true if the type is "first class", meaning it is a valid type for a
288 /// Value.
289boolisFirstClassType() const{
290returngetTypeID() !=FunctionTyID &&getTypeID() !=VoidTyID;
291 }
292
293 /// Return true if the type is a valid type for a register in codegen. This
294 /// includes all first-class types except struct and array types.
295boolisSingleValueType() const{
296returnisFloatingPointTy() ||isIntegerTy() ||isPointerTy() ||
297isVectorTy() ||isX86_AMXTy() ||isTargetExtTy();
298 }
299
300 /// Return true if the type is an aggregate type. This means it is valid as
301 /// the first operand of an insertvalue or extractvalue instruction. This
302 /// includes struct and array types, but does not include vector types.
303boolisAggregateType() const{
304returngetTypeID() ==StructTyID ||getTypeID() ==ArrayTyID;
305 }
306
307 /// Return true if it makes sense to take the size of this type. To get the
308 /// actual size for a particular target, it is reasonable to use the
309 /// DataLayout subsystem to do this.
310boolisSized(SmallPtrSetImpl<Type*> *Visited =nullptr) const{
311// If it's a primitive, it is always sized.
312if (getTypeID() ==IntegerTyID ||isFloatingPointTy() ||
313getTypeID() ==PointerTyID ||getTypeID() ==X86_AMXTyID)
314returntrue;
315// If it is not something that can have a size (e.g. a function or label),
316// it doesn't have a size.
317if (getTypeID() !=StructTyID &&getTypeID() !=ArrayTyID &&
318 !isVectorTy() &&getTypeID() !=TargetExtTyID)
319returnfalse;
320// Otherwise we have to try harder to decide.
321return isSizedDerivedType(Visited);
322 }
323
324 /// Return the basic size of this type if it is a primitive type. These are
325 /// fixed by LLVM and are not target-dependent.
326 /// This will return zero if the type does not have a size or is not a
327 /// primitive type.
328 ///
329 /// If this is a scalable vector type, the scalable property will be set and
330 /// the runtime size will be a positive integer multiple of the base size.
331 ///
332 /// Note that this may not reflect the size of memory allocated for an
333 /// instance of the type or the number of bytes that are written when an
334 /// instance of the type is stored to memory. The DataLayout class provides
335 /// additional query functions to provide this information.
336 ///
337TypeSizegetPrimitiveSizeInBits()constLLVM_READONLY;
338
339 /// If this is a vector type, return the getPrimitiveSizeInBits value for the
340 /// element type. Otherwise return the getPrimitiveSizeInBits value for this
341 /// type.
342unsignedgetScalarSizeInBits()constLLVM_READONLY;
343
344 /// Return the width of the mantissa of this type. This is only valid on
345 /// floating-point types. If the FP type does not have a stable mantissa (e.g.
346 /// ppc long double), this method returns -1.
347intgetFPMantissaWidth()const;
348
349 /// Return whether the type is IEEE compatible, as defined by the eponymous
350 /// method in APFloat.
351boolisIEEE()const;
352
353 /// If this is a vector type, return the element type, otherwise return
354 /// 'this'.
355inlineType *getScalarType() const{
356if (isVectorTy())
357returngetContainedType(0);
358returnconst_cast<Type *>(this);
359 }
360
361//===--------------------------------------------------------------------===//
362// Type Iteration support.
363//
364usingsubtype_iterator =Type *const *;
365
366subtype_iteratorsubtype_begin() const{returnContainedTys; }
367subtype_iteratorsubtype_end() const{return &ContainedTys[NumContainedTys];}
368ArrayRef<Type*>subtypes() const{
369returnArrayRef(subtype_begin(),subtype_end());
370 }
371
372usingsubtype_reverse_iterator = std::reverse_iterator<subtype_iterator>;
373
374subtype_reverse_iteratorsubtype_rbegin() const{
375returnsubtype_reverse_iterator(subtype_end());
376 }
377subtype_reverse_iteratorsubtype_rend() const{
378returnsubtype_reverse_iterator(subtype_begin());
379 }
380
381 /// This method is used to implement the type iterator (defined at the end of
382 /// the file). For derived types, this returns the types 'contained' in the
383 /// derived type.
384Type *getContainedType(unsigned i) const{
385assert(i <NumContainedTys &&"Index out of range!");
386returnContainedTys[i];
387 }
388
389 /// Return the number of types in the derived type.
390unsignedgetNumContainedTypes() const{returnNumContainedTys; }
391
392//===--------------------------------------------------------------------===//
393// Helper methods corresponding to subclass methods. This forces a cast to
394// the specified subclass and calls its accessor. "getArrayNumElements" (for
395// example) is shorthand for cast<ArrayType>(Ty)->getNumElements(). This is
396// only intended to cover the core methods that are frequently used, helper
397// methods should not be added here.
398
399inlineunsignedgetIntegerBitWidth()const;
400
401inlineType *getFunctionParamType(unsigned i)const;
402inlineunsignedgetFunctionNumParams()const;
403inlineboolisFunctionVarArg()const;
404
405inlineStringRefgetStructName()const;
406inlineunsignedgetStructNumElements()const;
407inlineType *getStructElementType(unsignedN)const;
408
409inlineuint64_tgetArrayNumElements()const;
410
411Type *getArrayElementType() const{
412assert(getTypeID() ==ArrayTyID);
413returnContainedTys[0];
414 }
415
416inlineStringRefgetTargetExtName()const;
417
418 /// Given vector type, change the element type,
419 /// whilst keeping the old number of elements.
420 /// For non-vectors simply returns \p EltTy.
421inlineType *getWithNewType(Type *EltTy)const;
422
423 /// Given an integer or vector type, change the lane bitwidth to NewBitwidth,
424 /// whilst keeping the old number of lanes.
425inlineType *getWithNewBitWidth(unsigned NewBitWidth)const;
426
427 /// Given scalar/vector integer type, returns a type with elements twice as
428 /// wide as in the original type. For vectors, preserves element count.
429inlineType *getExtendedType()const;
430
431 /// Get the address space of this pointer or pointer vector type.
432inlineunsignedgetPointerAddressSpace()const;
433
434//===--------------------------------------------------------------------===//
435// Static members exported by the Type class itself. Useful for getting
436// instances of Type.
437//
438
439 /// Return a type based on an identifier.
440staticType *getPrimitiveType(LLVMContext &C,TypeID IDNumber);
441
442//===--------------------------------------------------------------------===//
443// These are the builtin types that are always available.
444//
445staticType *getVoidTy(LLVMContext &C);
446staticType *getLabelTy(LLVMContext &C);
447staticType *getHalfTy(LLVMContext &C);
448staticType *getBFloatTy(LLVMContext &C);
449staticType *getFloatTy(LLVMContext &C);
450staticType *getDoubleTy(LLVMContext &C);
451staticType *getMetadataTy(LLVMContext &C);
452staticType *getX86_FP80Ty(LLVMContext &C);
453staticType *getFP128Ty(LLVMContext &C);
454staticType *getPPC_FP128Ty(LLVMContext &C);
455staticType *getX86_AMXTy(LLVMContext &C);
456staticType *getTokenTy(LLVMContext &C);
457staticIntegerType *getIntNTy(LLVMContext &C,unsignedN);
458staticIntegerType *getInt1Ty(LLVMContext &C);
459staticIntegerType *getInt8Ty(LLVMContext &C);
460staticIntegerType *getInt16Ty(LLVMContext &C);
461staticIntegerType *getInt32Ty(LLVMContext &C);
462staticIntegerType *getInt64Ty(LLVMContext &C);
463staticIntegerType *getInt128Ty(LLVMContext &C);
464template <typename ScalarTy>staticType *getScalarTy(LLVMContext &C) {
465int noOfBits =sizeof(ScalarTy) * CHAR_BIT;
466if (std::is_integral<ScalarTy>::value) {
467return (Type*)Type::getIntNTy(C, noOfBits);
468 }elseif (std::is_floating_point<ScalarTy>::value) {
469switch (noOfBits) {
470case 32:
471returnType::getFloatTy(C);
472case 64:
473returnType::getDoubleTy(C);
474 }
475 }
476llvm_unreachable("Unsupported type in Type::getScalarTy");
477 }
478staticType *getFloatingPointTy(LLVMContext &C,constfltSemantics &S);
479
480//===--------------------------------------------------------------------===//
481// Convenience methods for getting pointer types.
482//
483staticType *getWasm_ExternrefTy(LLVMContext &C);
484staticType *getWasm_FuncrefTy(LLVMContext &C);
485
486 /// Return a pointer to the current type. This is equivalent to
487 /// PointerType::get(Ctx, AddrSpace).
488 /// TODO: Remove this after opaque pointer transition is complete.
489LLVM_DEPRECATED("Use PointerType::get instead","PointerType::get")
490PointerType *getPointerTo(unsigned AddrSpace = 0)const;
491
492private:
493 /// Derived types like structures and arrays are sized iff all of the members
494 /// of the type are sized as well. Since asking for their size is relatively
495 /// uncommon, move this operation out-of-line.
496bool isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited =nullptr)const;
497};
498
499// Printing of types.
500inlineraw_ostream &operator<<(raw_ostream &OS,constType &T) {
501T.print(OS);
502returnOS;
503}
504
505// allow isa<PointerType>(x) to work without DerivedTypes.h included.
506template <>structisa_impl<PointerType,Type> {
507staticinlinebooldoit(constType &Ty) {
508return Ty.getTypeID() == Type::PointerTyID;
509 }
510};
511
512// Create wrappers for C Binding types (see CBindingWrapping.h).
513DEFINE_ISA_CONVERSION_FUNCTIONS(Type,LLVMTypeRef)
514
515/* Specialized opaque type conversions.
516 */
517inlineType **unwrap(LLVMTypeRef* Tys) {
518returnreinterpret_cast<Type**>(Tys);
519}
520
521inlineLLVMTypeRef *wrap(Type **Tys) {
522returnreinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys));
523}
524
525}// end namespace llvm
526
527#endif// LLVM_IR_TYPE_H
const
aarch64 promote const
Definition:AArch64PromoteConstant.cpp:230
inline
always inline
Definition:AlwaysInliner.cpp:161
ArrayRef.h
CBindingWrapping.h
DEFINE_ISA_CONVERSION_FUNCTIONS
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
Definition:CBindingWrapping.h:28
Casting.h
Compiler.h
LLVM_DEPRECATED
#define LLVM_DEPRECATED(MSG, FIX)
Definition:Compiler.h:236
LLVM_READONLY
#define LLVM_READONLY
Definition:Compiler.h:306
TypeID
Type::TypeID TypeID
Definition:Mips16HardFloat.cpp:103
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
TypeSize.h
PointerType
Definition:ItaniumDemangle.h:627
T
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::IntegerType
Class to represent integer types.
Definition:DerivedTypes.h:42
llvm::LLVMContextImpl
Definition:LLVMContextImpl.h:1469
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:LLVMContext.h:67
llvm::PointerType
Class to represent pointers.
Definition:DerivedTypes.h:670
llvm::SmallPtrSetImpl
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition:SmallPtrSet.h:363
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::TypeSize
Definition:TypeSize.h:334
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::Type::~Type
~Type()=default
llvm::Type::isIntOrIntVectorTy
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:247
llvm::Type::getHalfTy
static Type * getHalfTy(LLVMContext &C)
llvm::Type::getIntegerBitWidth
unsigned getIntegerBitWidth() const
llvm::Type::getStructElementType
Type * getStructElementType(unsigned N) const
llvm::Type::getDoubleTy
static Type * getDoubleTy(LLVMContext &C)
llvm::Type::getFltSemantics
const fltSemantics & getFltSemantics() const
llvm::Type::isVectorTy
bool isVectorTy() const
True if this is an instance of VectorType.
Definition:Type.h:270
llvm::Type::getFloatingPointTy
static Type * getFloatingPointTy(LLVMContext &C, const fltSemantics &S)
llvm::Type::isX86_FP80Ty
bool isX86_FP80Ty() const
Return true if this is x86 long double.
Definition:Type.h:159
llvm::Type::getPointerTo
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
llvm::Type::containsNonLocalTargetExtType
bool containsNonLocalTargetExtType(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this type is or contains a target extension type that disallows being used as a local.
llvm::Type::isArrayTy
bool isArrayTy() const
True if this is an instance of ArrayType.
Definition:Type.h:261
llvm::Type::getX86_FP80Ty
static Type * getX86_FP80Ty(LLVMContext &C)
llvm::Type::isLabelTy
bool isLabelTy() const
Return true if this is 'label'.
Definition:Type.h:228
llvm::Type::getBFloatTy
static Type * getBFloatTy(LLVMContext &C)
llvm::Type::isIntOrIntVectorTy
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition:Type.h:243
llvm::Type::isPointerTy
bool isPointerTy() const
True if this is an instance of PointerType.
Definition:Type.h:264
llvm::Type::getInt1Ty
static IntegerType * getInt1Ty(LLVMContext &C)
llvm::Type::getArrayElementType
Type * getArrayElementType() const
Definition:Type.h:411
llvm::Type::isFloatTy
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition:Type.h:153
llvm::Type::isEmptyTy
bool isEmptyTy() const
Return true if this type is empty, that is, it has no elements or all of its elements are empty.
llvm::Type::dump
void dump() const
llvm::Type::isIntegerTy
bool isIntegerTy(unsigned Bitwidth) const
Return true if this is an IntegerType of the given width.
llvm::Type::getX86_AMXTy
static Type * getX86_AMXTy(LLVMContext &C)
llvm::Type::isBFloatTy
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition:Type.h:145
llvm::Type::getMetadataTy
static Type * getMetadataTy(LLVMContext &C)
llvm::Type::getStructName
StringRef getStructName() const
llvm::Type::subtype_iterator
Type *const * subtype_iterator
Definition:Type.h:364
llvm::Type::containsNonGlobalTargetExtType
bool containsNonGlobalTargetExtType(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this type is or contains a target extension type that disallows being used as a global...
llvm::Type::getStructNumElements
unsigned getStructNumElements() const
llvm::Type::getPointerAddressSpace
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
llvm::Type::getArrayNumElements
uint64_t getArrayNumElements() const
llvm::Type::containsNonLocalTargetExtType
bool containsNonLocalTargetExtType() const
llvm::Type::TypeID
TypeID
Definitions of all of the base types for the Type system.
Definition:Type.h:54
llvm::Type::X86_AMXTyID
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition:Type.h:66
llvm::Type::FunctionTyID
@ FunctionTyID
Functions.
Definition:Type.h:71
llvm::Type::ArrayTyID
@ ArrayTyID
Arrays.
Definition:Type.h:74
llvm::Type::TypedPointerTyID
@ TypedPointerTyID
Typed pointer used by some GPU targets.
Definition:Type.h:77
llvm::Type::HalfTyID
@ HalfTyID
16-bit floating point type
Definition:Type.h:56
llvm::Type::TargetExtTyID
@ TargetExtTyID
Target extension type.
Definition:Type.h:78
llvm::Type::VoidTyID
@ VoidTyID
type with no size
Definition:Type.h:63
llvm::Type::ScalableVectorTyID
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition:Type.h:76
llvm::Type::LabelTyID
@ LabelTyID
Labels.
Definition:Type.h:64
llvm::Type::FloatTyID
@ FloatTyID
32-bit floating point type
Definition:Type.h:58
llvm::Type::StructTyID
@ StructTyID
Structures.
Definition:Type.h:73
llvm::Type::IntegerTyID
@ IntegerTyID
Arbitrary bit width integers.
Definition:Type.h:70
llvm::Type::FixedVectorTyID
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition:Type.h:75
llvm::Type::BFloatTyID
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition:Type.h:57
llvm::Type::DoubleTyID
@ DoubleTyID
64-bit floating point type
Definition:Type.h:59
llvm::Type::X86_FP80TyID
@ X86_FP80TyID
80-bit floating point type (X87)
Definition:Type.h:60
llvm::Type::PPC_FP128TyID
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition:Type.h:62
llvm::Type::MetadataTyID
@ MetadataTyID
Metadata.
Definition:Type.h:65
llvm::Type::TokenTyID
@ TokenTyID
Tokens.
Definition:Type.h:67
llvm::Type::PointerTyID
@ PointerTyID
Pointers.
Definition:Type.h:72
llvm::Type::FP128TyID
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition:Type.h:61
llvm::Type::subtypes
ArrayRef< Type * > subtypes() const
Definition:Type.h:368
llvm::Type::isSingleValueType
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
Definition:Type.h:295
llvm::Type::print
void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
llvm::Type::getNumContainedTypes
unsigned getNumContainedTypes() const
Return the number of types in the derived type.
Definition:Type.h:390
llvm::Type::isPPC_FP128Ty
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
Definition:Type.h:165
llvm::Type::NumContainedTys
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
Definition:Type.h:106
llvm::Type::getIntNTy
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
llvm::Type::isFP128Ty
bool isFP128Ty() const
Return true if this is 'fp128'.
Definition:Type.h:162
llvm::Type::is16bitFPTy
bool is16bitFPTy() const
Return true if this is a 16-bit float type.
Definition:Type.h:148
llvm::Type::getTargetExtName
StringRef getTargetExtName() const
llvm::Type::getScalarSizeInBits
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
llvm::Type::getVoidTy
static Type * getVoidTy(LLVMContext &C)
llvm::Type::getLabelTy
static Type * getLabelTy(LLVMContext &C)
llvm::Type::isScalableTargetExtTy
bool isScalableTargetExtTy() const
Return true if this is a target extension type with a scalable layout.
llvm::Type::isMultiUnitFPType
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
llvm::Type::Type
Type(LLVMContext &C, TypeID tid)
Definition:Type.h:93
llvm::Type::isStructTy
bool isStructTy() const
True if this is an instance of StructType.
Definition:Type.h:258
llvm::Type::isFirstClassType
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value.
Definition:Type.h:289
llvm::Type::getFP128Ty
static Type * getFP128Ty(LLVMContext &C)
llvm::Type::getWithNewBitWidth
Type * getWithNewBitWidth(unsigned NewBitWidth) const
Given an integer or vector type, change the lane bitwidth to NewBitwidth, whilst keeping the old numb...
llvm::Type::isTargetExtTy
bool isTargetExtTy() const
Return true if this is a target extension type.
Definition:Type.h:203
llvm::Type::isSized
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
Definition:Type.h:310
llvm::Type::getInt16Ty
static IntegerType * getInt16Ty(LLVMContext &C)
llvm::Type::isAggregateType
bool isAggregateType() const
Return true if the type is an aggregate type.
Definition:Type.h:303
llvm::Type::isHalfTy
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition:Type.h:142
llvm::Type::isScalableTy
bool isScalableTy(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this is a type whose size is a known multiple of vscale.
llvm::Type::getWithNewType
Type * getWithNewType(Type *EltTy) const
Given vector type, change the element type, whilst keeping the old number of elements.
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition:Type.h:128
llvm::Type::getPrimitiveType
static Type * getPrimitiveType(LLVMContext &C, TypeID IDNumber)
Return a type based on an identifier.
llvm::Type::getFPMantissaWidth
int getFPMantissaWidth() const
Return the width of the mantissa of this type.
llvm::Type::ContainedTys
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
Definition:Type.h:113
llvm::Type::getSubclassData
unsigned getSubclassData() const
Definition:Type.h:97
llvm::Type::getInt8Ty
static IntegerType * getInt8Ty(LLVMContext &C)
llvm::Type::isIEEE
bool isIEEE() const
Return whether the type is IEEE compatible, as defined by the eponymous method in APFloat.
llvm::Type::subtype_reverse_iterator
std::reverse_iterator< subtype_iterator > subtype_reverse_iterator
Definition:Type.h:372
llvm::Type::getInt128Ty
static IntegerType * getInt128Ty(LLVMContext &C)
llvm::Type::isFunctionVarArg
bool isFunctionVarArg() const
llvm::Type::isDoubleTy
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition:Type.h:156
llvm::Type::setSubclassData
void setSubclassData(unsigned val)
Definition:Type.h:99
llvm::Type::getTokenTy
static Type * getTokenTy(LLVMContext &C)
llvm::Type::isFloatingPointTy
bool isFloatingPointTy() const
Return true if this is one of the floating-point types.
Definition:Type.h:184
llvm::Type::isPtrOrPtrVectorTy
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Definition:Type.h:267
llvm::Type::subtype_begin
subtype_iterator subtype_begin() const
Definition:Type.h:366
llvm::Type::isX86_AMXTy
bool isX86_AMXTy() const
Return true if this is X86 AMX.
Definition:Type.h:200
llvm::Type::getScalarTy
static Type * getScalarTy(LLVMContext &C)
Definition:Type.h:464
llvm::Type::isRISCVVectorTupleTy
bool isRISCVVectorTupleTy() const
llvm::Type::isFunctionTy
bool isFunctionTy() const
True if this is an instance of FunctionType.
Definition:Type.h:255
llvm::Type::isScalableTy
bool isScalableTy() const
llvm::Type::canLosslesslyBitCastTo
bool canLosslesslyBitCastTo(Type *Ty) const
Return true if this type could be converted with a lossless BitCast to type 'Ty'.
llvm::Type::isIntOrPtrTy
bool isIntOrPtrTy() const
Return true if this is an integer type or a pointer type.
Definition:Type.h:252
llvm::Type::getInt32Ty
static IntegerType * getInt32Ty(LLVMContext &C)
llvm::Type::getInt64Ty
static IntegerType * getInt64Ty(LLVMContext &C)
llvm::Type::getExtendedType
Type * getExtendedType() const
Given scalar/vector integer type, returns a type with elements twice as wide as in the original type.
llvm::Type::getFloatTy
static Type * getFloatTy(LLVMContext &C)
llvm::Type::isIntegerTy
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition:Type.h:237
llvm::Type::getTypeID
TypeID getTypeID() const
Return the type id for the type.
Definition:Type.h:136
llvm::Type::getWasm_FuncrefTy
static Type * getWasm_FuncrefTy(LLVMContext &C)
llvm::Type::isTokenTy
bool isTokenTy() const
Return true if this is 'token'.
Definition:Type.h:234
llvm::Type::getFunctionParamType
Type * getFunctionParamType(unsigned i) const
llvm::Type::subtype_rend
subtype_reverse_iterator subtype_rend() const
Definition:Type.h:377
llvm::Type::isFPOrFPVectorTy
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition:Type.h:225
llvm::Type::getPrimitiveSizeInBits
TypeSize getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
llvm::Type::subtype_rbegin
subtype_reverse_iterator subtype_rbegin() const
Definition:Type.h:374
llvm::Type::getContainedType
Type * getContainedType(unsigned i) const
This method is used to implement the type iterator (defined at the end of the file).
Definition:Type.h:384
llvm::Type::subtype_end
subtype_iterator subtype_end() const
Definition:Type.h:367
llvm::Type::isIEEELikeFPTy
bool isIEEELikeFPTy() const
Return true if this is a well-behaved IEEE-like type, which has a IEEE compatible layout as defined b...
Definition:Type.h:170
llvm::Type::containsNonGlobalTargetExtType
bool containsNonGlobalTargetExtType() const
llvm::Type::getPPC_FP128Ty
static Type * getPPC_FP128Ty(LLVMContext &C)
llvm::Type::getFunctionNumParams
unsigned getFunctionNumParams() const
llvm::Type::getWasm_ExternrefTy
static Type * getWasm_ExternrefTy(LLVMContext &C)
llvm::Type::isVoidTy
bool isVoidTy() const
Return true if this is 'void'.
Definition:Type.h:139
llvm::Type::getScalarType
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
Definition:Type.h:355
llvm::Type::isMetadataTy
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition:Type.h:231
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
uint64_t
unsigned
LLVMTypeRef
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
Definition:Types.h:68
ErrorHandling.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::unwrap
Attribute unwrap(LLVMAttributeRef Attr)
Definition:Attributes.h:335
llvm::BitWidth
constexpr unsigned BitWidth
Definition:BitmaskEnum.h:217
llvm::wrap
LLVMAttributeRef wrap(Attribute Attr)
Definition:Attributes.h:330
N
#define N
llvm::fltSemantics
Definition:APFloat.cpp:103
llvm::isa_impl< PointerType, Type >::doit
static bool doit(const Type &Ty)
Definition:Type.h:507
llvm::isa_impl
Definition:Casting.h:63

Generated on Thu Jul 17 2025 10:06:29 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp