class Type

Declaration

class Type { /* full declaration omitted */ };

Description

The instances of the Type class are immutable: once they are created, they are never changed. Also note that only one instance of a particular type is ever created. Thus seeing if two types are equal is a matter of doing a trivial pointer comparison. To enforce that no two equal instances are created, Type instances can only be created via static factory methods in class Type and in derived classes. Once allocated, Types are never free'd.

Declared at: llvm/include/llvm/IR/Type.h:46

Member Variables

protected unsigned int NumContainedTys = 0
Keeps track of how many Type*'s there are in the ContainedTys list.
protected llvm::Type* const* ContainedTys = nullptr
A pointer to the array of Types contained by this Type. For example, this includes the arguments of a function type, the elements of a structure, the pointee of a pointer, the element type of an array, etc. This pointer may be 0 for types that don't contain other types (Integer, Double, Float).

Method Overview

Methods

Type(llvm::LLVMContext& C, llvm::Type::TypeID tid)

Declared at: llvm/include/llvm/IR/Type.h:91

Parameters

llvm::LLVMContext& C
llvm::Type::TypeID tid

bool canLosslesslyBitCastTo(llvm::Type* Ty) const

Description

Return true if this type could be converted with a lossless BitCast to type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the same size only where no re-interpretation of the bits is done. Determine if this type could be losslessly bitcast to Ty

Declared at: llvm/include/llvm/IR/Type.h:236

Parameters

llvm::Type* Ty

void dump() const

Declared at: llvm/include/llvm/IR/Type.h:127

llvm::Type* getArrayElementType() const

Declared at: llvm/include/llvm/IR/Type.h:368

inline uint64_t getArrayNumElements() const

Declared at: llvm/include/llvm/IR/Type.h:366

llvm::Type* getContainedType(unsigned int i) const

Description

This method is used to implement the type iterator (defined at the end of the file). For derived types, this returns the types 'contained' in the derived type.

Declared at: llvm/include/llvm/IR/Type.h:336

Parameters

unsigned int i

llvm::LLVMContext& getContext() const

Description

Return the LLVMContext in which this type was uniqued.

Declared at: llvm/include/llvm/IR/Type.h:130

static llvm::PointerType* getDoublePtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:447

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::Type* getDoubleTy(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:412

Parameters

llvm::LLVMContext& C

inline llvm::Type* getExtendedType() const

Description

Given scalar/vector integer type, returns a type with elements twice as wide as in the original type. For vectors, preserves element count.

Declared at: llvm/include/llvm/IR/Type.h:392

static llvm::PointerType* getFP128PtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:449

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::Type* getFP128Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:415

Parameters

llvm::LLVMContext& C

int getFPMantissaWidth() const

Description

Return the width of the mantissa of this type. This is only valid on floating-point types. If the FP type does not have a stable mantissa (e.g. ppc long double), this method returns -1.

Declared at: llvm/include/llvm/IR/Type.h:303

static llvm::PointerType* getFloatPtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:446

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::Type* getFloatTy(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:411

Parameters

llvm::LLVMContext& C

const llvm::fltSemantics& getFltSemantics() const

Declared at: llvm/include/llvm/IR/Type.h:169

inline unsigned int getFunctionNumParams() const

Declared at: llvm/include/llvm/IR/Type.h:354

inline llvm::Type* getFunctionParamType(
    unsigned int i) const

Declared at: llvm/include/llvm/IR/Type.h:353

Parameters

unsigned int i

static llvm::PointerType* getHalfPtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:445

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::Type* getHalfTy(llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:410

Parameters

llvm::LLVMContext& C

static llvm::IntegerType* getInt128Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:425

Parameters

llvm::LLVMContext& C

static llvm::PointerType* getInt16PtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:455

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::IntegerType* getInt16Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:422

Parameters

llvm::LLVMContext& C

static llvm::PointerType* getInt1PtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:453

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::IntegerType* getInt1Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:420

Parameters

llvm::LLVMContext& C

static llvm::PointerType* getInt32PtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:456

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::IntegerType* getInt32Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:423

Parameters

llvm::LLVMContext& C

static llvm::PointerType* getInt64PtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:457

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::IntegerType* getInt64Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:424

Parameters

llvm::LLVMContext& C

static llvm::PointerType* getInt8PtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:454

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::IntegerType* getInt8Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:421

Parameters

llvm::LLVMContext& C

static llvm::PointerType* getIntNPtrTy(
    llvm::LLVMContext& C,
    unsigned int N,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:452

Parameters

llvm::LLVMContext& C
unsigned int N
unsigned int AS = 0

static llvm::IntegerType* getIntNTy(
    llvm::LLVMContext& C,
    unsigned int N)

Declared at: llvm/include/llvm/IR/Type.h:419

Parameters

llvm::LLVMContext& C
unsigned int N

inline unsigned int getIntegerBitWidth() const

Declared at: llvm/include/llvm/IR/Type.h:351

static llvm::Type* getLabelTy(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:409

Parameters

llvm::LLVMContext& C

static llvm::Type* getMetadataTy(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:413

Parameters

llvm::LLVMContext& C

unsigned int getNumContainedTypes() const

Description

Return the number of types in the derived type.

Declared at: llvm/include/llvm/IR/Type.h:342

static llvm::PointerType* getPPC_FP128PtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:450

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::Type* getPPC_FP128Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:416

Parameters

llvm::LLVMContext& C

inline unsigned int getPointerAddressSpace() const

Description

Get the address space of this pointer or pointer vector type.

Declared at: llvm/include/llvm/IR/Type.h:395

llvm::Type* getPointerElementType() const

Declared at: llvm/include/llvm/IR/Type.h:381

llvm::PointerType* getPointerTo(
    unsigned int AddrSpace = 0) const

Description

Return a pointer to the current type. This is equivalent to PointerType::get(Foo, AddrSpace).

Declared at: llvm/include/llvm/IR/Type.h:461

Parameters

unsigned int AddrSpace = 0

llvm::TypeSize getPrimitiveSizeInBits() const

Description

Return the basic size of this type if it is a primitive type. These are fixed by LLVM and are not target-dependent. This will return zero if the type does not have a size or is not a primitive type. If this is a scalable vector type, the scalable property will be set and the runtime size will be a positive integer multiple of the base size. Note that this may not reflect the size of memory allocated for an instance of the type or the number of bytes that are written when an instance of the type is stored to memory. The DataLayout class provides additional query functions to provide this information.

Declared at: llvm/include/llvm/IR/Type.h:293

static llvm::Type* getPrimitiveType(
    llvm::LLVMContext& C,
    llvm::Type::TypeID IDNumber)

Description

Return a type based on an identifier.

Declared at: llvm/include/llvm/IR/Type.h:403

Parameters

llvm::LLVMContext& C
llvm::Type::TypeID IDNumber

unsigned int getScalarSizeInBits() const

Description

If this is a vector type, return the getPrimitiveSizeInBits value for the element type. Otherwise return the getPrimitiveSizeInBits value for this type.

Declared at: llvm/include/llvm/IR/Type.h:298

template <typename ScalarTy>
static llvm::Type* getScalarTy(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:426

Templates

ScalarTy

Parameters

llvm::LLVMContext& C

llvm::Type* getScalarType() const

Description

If this is a vector type, return the element type, otherwise return 'this'.

Declared at: llvm/include/llvm/IR/Type.h:307

inline llvm::Type* getSequentialElementType()
    const

Declared at: llvm/include/llvm/IR/Type.h:361

inline llvm::Type* getStructElementType(
    unsigned int N) const

Declared at: llvm/include/llvm/IR/Type.h:359

Parameters

unsigned int N

inline llvm::StringRef getStructName() const

Declared at: llvm/include/llvm/IR/Type.h:357

inline unsigned int getStructNumElements() const

Declared at: llvm/include/llvm/IR/Type.h:358

unsigned int getSubclassData() const

Declared at: llvm/include/llvm/IR/Type.h:95

static llvm::Type* getTokenTy(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:418

Parameters

llvm::LLVMContext& C

llvm::Type::TypeID getTypeID() const

Description

Return the type id for the type. This will return one of the TypeID enum elements defined above.

Declared at: llvm/include/llvm/IR/Type.h:138

inline llvm::ElementCount getVectorElementCount()
    const

Declared at: llvm/include/llvm/IR/Type.h:375

llvm::Type* getVectorElementType() const

Declared at: llvm/include/llvm/IR/Type.h:376

inline bool getVectorIsScalable() const

Declared at: llvm/include/llvm/IR/Type.h:373

inline unsigned int getVectorNumElements() const

Declared at: llvm/include/llvm/IR/Type.h:374

static llvm::Type* getVoidTy(llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:408

Parameters

llvm::LLVMContext& C

inline llvm::Type* getWithNewBitWidth(
    unsigned int NewBitWidth) const

Description

Given an integer or vector type, change the lane bitwidth to NewBitwidth, whilst keeping the old number of lanes.

Declared at: llvm/include/llvm/IR/Type.h:388

Parameters

unsigned int NewBitWidth

static llvm::PointerType* getX86_FP80PtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:448

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::Type* getX86_FP80Ty(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:414

Parameters

llvm::LLVMContext& C

static llvm::PointerType* getX86_MMXPtrTy(
    llvm::LLVMContext& C,
    unsigned int AS = 0)

Declared at: llvm/include/llvm/IR/Type.h:451

Parameters

llvm::LLVMContext& C
unsigned int AS = 0

static llvm::Type* getX86_MMXTy(
    llvm::LLVMContext& C)

Declared at: llvm/include/llvm/IR/Type.h:417

Parameters

llvm::LLVMContext& C

bool isAggregateType() const

Description

Return true if the type is an aggregate type. This means it is valid as the first operand of an insertvalue or extractvalue instruction. This includes struct and array types, but does not include vector types.

Declared at: llvm/include/llvm/IR/Type.h:258

bool isArrayTy() const

Description

True if this is an instance of ArrayType.

Declared at: llvm/include/llvm/IR/Type.h:221

bool isDoubleTy() const

Description

Return true if this is 'double', a 64-bit IEEE fp type.

Declared at: llvm/include/llvm/IR/Type.h:150

bool isEmptyTy() const

Description

Return true if this type is empty, that is, it has no elements or all of its elements are empty.

Declared at: llvm/include/llvm/IR/Type.h:240

bool isFP128Ty() const

Description

Return true if this is 'fp128'.

Declared at: llvm/include/llvm/IR/Type.h:156

bool isFPOrFPVectorTy() const

Description

Return true if this is a FP type or a vector of FP.

Declared at: llvm/include/llvm/IR/Type.h:185

bool isFirstClassType() const

Description

Return true if the type is "first class", meaning it is a valid type for a Value.

Declared at: llvm/include/llvm/IR/Type.h:244

bool isFloatTy() const

Description

Return true if this is 'float', a 32-bit IEEE fp type.

Declared at: llvm/include/llvm/IR/Type.h:147

bool isFloatingPointTy() const

Description

Return true if this is one of the six floating-point types

Declared at: llvm/include/llvm/IR/Type.h:162

bool isFunctionTy() const

Description

True if this is an instance of FunctionType.

Declared at: llvm/include/llvm/IR/Type.h:215

inline bool isFunctionVarArg() const

Declared at: llvm/include/llvm/IR/Type.h:355

bool isHalfTy() const

Description

Return true if this is 'half', a 16-bit IEEE fp type.

Declared at: llvm/include/llvm/IR/Type.h:144

bool isIntOrIntVectorTy(
    unsigned int BitWidth) const

Description

Return true if this is an integer type or a vector of integer types of the given width.

Declared at: llvm/include/llvm/IR/Type.h:207

Parameters

unsigned int BitWidth

bool isIntOrIntVectorTy() const

Description

Return true if this is an integer type or a vector of integer types.

Declared at: llvm/include/llvm/IR/Type.h:203

bool isIntOrPtrTy() const

Description

Return true if this is an integer type or a pointer type.

Declared at: llvm/include/llvm/IR/Type.h:212

bool isIntegerTy(unsigned int Bitwidth) const

Description

Return true if this is an IntegerType of the given width.

Declared at: llvm/include/llvm/IR/Type.h:200

Parameters

unsigned int Bitwidth

bool isIntegerTy() const

Description

True if this is an instance of IntegerType.

Declared at: llvm/include/llvm/IR/Type.h:197

bool isLabelTy() const

Description

Return true if this is 'label'.

Declared at: llvm/include/llvm/IR/Type.h:188

bool isMetadataTy() const

Description

Return true if this is 'metadata'.

Declared at: llvm/include/llvm/IR/Type.h:191

bool isPPC_FP128Ty() const

Description

Return true if this is powerpc long double.

Declared at: llvm/include/llvm/IR/Type.h:159

bool isPointerTy() const

Description

True if this is an instance of PointerType.

Declared at: llvm/include/llvm/IR/Type.h:224

bool isPtrOrPtrVectorTy() const

Description

Return true if this is a pointer type or a vector of pointer types.

Declared at: llvm/include/llvm/IR/Type.h:227

static bool isSequentialType(
    llvm::Type::TypeID TyID)

Declared at: llvm/include/llvm/IR/Type.h:113

Parameters

llvm::Type::TypeID TyID

bool isSingleValueType() const

Description

Return true if the type is a valid type for a register in codegen. This includes all first-class types except struct and array types.

Declared at: llvm/include/llvm/IR/Type.h:250

bool isSized(SmallPtrSetImpl<llvm::Type*>*
                 Visited = nullptr) const

Description

Return true if it makes sense to take the size of this type. To get the actual size for a particular target, it is reasonable to use the DataLayout subsystem to do this.

Declared at: llvm/include/llvm/IR/Type.h:265

Parameters

SmallPtrSetImpl<llvm::Type*>* Visited = nullptr

bool isStructTy() const

Description

True if this is an instance of StructType.

Declared at: llvm/include/llvm/IR/Type.h:218

bool isTokenTy() const

Description

Return true if this is 'token'.

Declared at: llvm/include/llvm/IR/Type.h:194

bool isVectorTy() const

Description

True if this is an instance of VectorType.

Declared at: llvm/include/llvm/IR/Type.h:230

bool isVoidTy() const

Description

Return true if this is 'void'.

Declared at: llvm/include/llvm/IR/Type.h:141

bool isX86_FP80Ty() const

Description

Return true if this is x86 long double.

Declared at: llvm/include/llvm/IR/Type.h:153

bool isX86_MMXTy() const

Description

Return true if this is X86 MMX.

Declared at: llvm/include/llvm/IR/Type.h:182

void print(llvm::raw_ostream& O,
           bool IsForDebug = false,
           bool NoDetails = false) const

Description

Print the current type. Omit the type details if \p NoDetails == true. E.g., let %st = type { i32, i16 } When \p NoDetails is true, we only print %st. Put differently, \p NoDetails prints the type as if inlined with the operands when printing an instruction.

Declared at: llvm/include/llvm/IR/Type.h:124

Parameters

llvm::raw_ostream& O
bool IsForDebug = false
bool NoDetails = false

void setSubclassData(unsigned int val)

Declared at: llvm/include/llvm/IR/Type.h:97

Parameters

unsigned int val

llvm::Type::subtype_iterator subtype_begin() const

Declared at: llvm/include/llvm/IR/Type.h:318

llvm::Type::subtype_iterator subtype_end() const

Declared at: llvm/include/llvm/IR/Type.h:319

llvm::Type::subtype_reverse_iterator
subtype_rbegin() const

Declared at: llvm/include/llvm/IR/Type.h:326

llvm::Type::subtype_reverse_iterator
subtype_rend() const

Declared at: llvm/include/llvm/IR/Type.h:329

ArrayRef<llvm::Type*> subtypes() const

Declared at: llvm/include/llvm/IR/Type.h:320

~Type()

Declared at: llvm/include/llvm/IR/Type.h:93