15 #ifndef LLVM_IR_TYPE_H 16 #define LLVM_IR_TYPE_H 31 template<
class GraphType>
struct GraphTraits;
84 unsigned SubclassData : 24;
92 : Context(C),
ID(tid), SubclassData(0) {}
125 bool NoDetails =
false)
const;
277 return isSizedDerivedType(Visited);
307 return const_cast<Type*
>(
this);
334 assert(i < NumContainedTys &&
"Index out of range!");
335 return ContainedTys[i];
360 return ContainedTys[0];
367 return ContainedTys[0];
373 return ContainedTys[0];
378 return ContainedTys[0];
414 int noOfBits =
sizeof(ScalarTy) * CHAR_BIT;
415 if (std::is_integral<ScalarTy>::value) {
417 }
else if (std::is_floating_point<ScalarTy>::value) {
498 return reinterpret_cast<Type**
>(Tys);
507 #endif // LLVM_IR_TYPE_H Type * getVectorElementType() const
static const fltSemantics & IEEEquad() LLVM_READNONE
ArrayRef< Type * > subtypes() const
static Type * getDoubleTy(LLVMContext &C)
static IntegerType * getInt1Ty(LLVMContext &C)
bool isMetadataTy() const
Return true if this is 'metadata'.
This class represents lattice values for constants.
subtype_iterator subtype_begin() const
unsigned getFunctionNumParams() const
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
2: 32-bit floating point type
bool isFP128Ty() const
Return true if this is 'fp128'.
static PointerType * getInt32PtrTy(LLVMContext &C, unsigned AS=0)
bool isIntOrIntVectorTy(unsigned BitWidth) const
Return true if this is an integer type or a vector of integer types of the given width.
4: 80-bit floating point type (X87)
Type * getStructElementType(unsigned N) const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
1: 16-bit floating point type
static IntegerType * getInt64Ty(LLVMContext &C)
static Type * getMetadataTy(LLVMContext &C)
bool isVectorTy() const
True if this is an instance of VectorType.
static IntegerType * getInt16Ty(LLVMContext &C)
static Type * getX86_MMXTy(LLVMContext &C)
static PointerType * getX86_MMXPtrTy(LLVMContext &C, unsigned AS=0)
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
static PointerType * getInt64PtrTy(LLVMContext &C, unsigned AS=0)
static Type * getX86_FP80Ty(LLVMContext &C)
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
static bool isSequentialType(TypeID TyID)
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
static Type * getTokenTy(LLVMContext &C)
Type * getPointerElementType() const
Attribute unwrap(LLVMAttributeRef Attr)
static Type * getFloatTy(LLVMContext &C)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
TypeID getTypeID() const
Return the type id for the type.
bool isFloatingPointTy() const
Return true if this is one of the six floating-point types.
uint64_t getArrayNumElements() const
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
bool isIntegerTy() const
True if this is an instance of IntegerType.
TypeID
Definitions of all of the base types for the Type system.
static PointerType * getInt16PtrTy(LLVMContext &C, unsigned AS=0)
Type * getFunctionParamType(unsigned i) const
static Type * getPPC_FP128Ty(LLVMContext &C)
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
static Type * getLabelTy(LLVMContext &C)
bool isFirstClassType() const
Return true if the type is "first class", meaning it is a valid type for a Value. ...
static bool doit(const Type &Ty)
static PointerType * getDoublePtrTy(LLVMContext &C, unsigned AS=0)
bool isIntOrPtrTy() const
Return true if this is an integer type or a pointer type.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
int getFPMantissaWidth() const
Return the width of the mantissa of this type.
static const fltSemantics & IEEEdouble() LLVM_READNONE
subtype_iterator subtype_end() const
Type(LLVMContext &C, TypeID tid)
Type *const * subtype_iterator
Class to represent pointers.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
11: Arbitrary bit width integers
bool isVoidTy() const
Return true if this is 'void'.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
static ChildIteratorType child_end(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)
static IntegerType * getInt128Ty(LLVMContext &C)
bool isLabelTy() const
Return true if this is 'label'.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
static NodeRef getEntryNode(Type *T)
unsigned getNumContainedTypes() const
Return the number of types in the derived type.
bool isPointerTy() const
True if this is an instance of PointerType.
std::reverse_iterator< subtype_iterator > subtype_reverse_iterator
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static Type * getVoidTy(LLVMContext &C)
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
6: 128-bit floating point type (two 64-bits, PowerPC)
unsigned getStructNumElements() const
bool isX86_MMXTy() const
Return true if this is X86 MMX.
static const fltSemantics & x87DoubleExtended() LLVM_READNONE
Class to represent integer types.
static PointerType * getPPC_FP128PtrTy(LLVMContext &C, unsigned AS=0)
bool isFunctionVarArg() const
static PointerType * getFloatPtrTy(LLVMContext &C, unsigned AS=0)
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static Type * getFP128Ty(LLVMContext &C)
static PointerType * getX86_FP80PtrTy(LLVMContext &C, unsigned AS=0)
subtype_reverse_iterator subtype_rbegin() const
static Type * getHalfTy(LLVMContext &C)
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Type * getSequentialElementType() const
static const fltSemantics & IEEEsingle() LLVM_READNONE
static PointerType * getInt1PtrTy(LLVMContext &C, unsigned AS=0)
static const fltSemantics & IEEEhalf() LLVM_READNONE
static ChildIteratorType child_end(NodeRef N)
16: SIMD 'packed' format, or other vector type
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type...
bool isAggregateType() const
Return true if the type is an aggregate type.
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
static PointerType * getHalfPtrTy(LLVMContext &C, unsigned AS=0)
static Type * getPrimitiveType(LLVMContext &C, TypeID IDNumber)
Return a type based on an identifier.
static PointerType * getFP128PtrTy(LLVMContext &C, unsigned AS=0)
unsigned getVectorNumElements() const
Type::subtype_iterator ChildIteratorType
bool isX86_FP80Ty() const
Return true if this is x86 long double.
static const fltSemantics & PPCDoubleDouble() LLVM_READNONE
unsigned getSubclassData() const
bool isFunctionTy() const
True if this is an instance of FunctionType.
LLVMAttributeRef wrap(Attribute Attr)
static IntegerType * getInt32Ty(LLVMContext &C)
unsigned getIntegerBitWidth() const
void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
bool isTokenTy() const
Return true if this is 'token'.
subtype_reverse_iterator subtype_rend() const
bool canLosslesslyBitCastTo(Type *Ty) const
Return true if this type could be converted with a lossless BitCast to type 'Ty'. ...
static ChildIteratorType child_begin(NodeRef N)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
static PointerType * getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS=0)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
3: 64-bit floating point type
void setSubclassData(unsigned val)
Type::subtype_iterator ChildIteratorType
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static Type * getScalarTy(LLVMContext &C)
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
static NodeRef getEntryNode(NodeRef T)
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
Type * getArrayElementType() const
bool isEmptyTy() const
Return true if this type is empty, that is, it has no elements or all of its elements are empty...
9: MMX vectors (64 bits, X86 specific)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
static IntegerType * getInt8Ty(LLVMContext &C)
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
bool isStructTy() const
True if this is an instance of StructType.
bool isArrayTy() const
True if this is an instance of ArrayType.
Type * getContainedType(unsigned i) const
This method is used to implement the type iterator (defined at the end of the file).
const fltSemantics & getFltSemantics() const
5: 128-bit floating point type (112-bit mantissa)
StringRef getStructName() const