15 #ifndef LLVM_IR_TYPE_H
16 #define LLVM_IR_TYPE_H
23 #include "llvm/Support/DataTypes.h"
33 class LLVMContextImpl;
35 template<
class GraphType>
struct GraphTraits;
85 uint32_t IDAndSubclassData;
90 : Context(C), IDAndSubclassData(0),
97 IDAndSubclassData = (ID & 0xFF) | (IDAndSubclassData & 0xFFFFFF00);
98 assert(
getTypeID() == ID &&
"TypeID data too large for field");
104 IDAndSubclassData = (IDAndSubclassData & 0xFF) | (val << 8);
106 assert(
getSubclassData() == val &&
"Subclass data too large for field");
280 return isSizedDerivedType(Visited);
480 return reinterpret_cast<Type**
>(Tys);
struct LLVMOpaqueType * LLVMTypeRef
Each value in the LLVM IR has a type, an LLVMTypeRef.
static Type * getDoubleTy(LLVMContext &C)
static IntegerType * getInt1Ty(LLVMContext &C)
unsigned getStructNumElements() const
Type * getSequentialElementType() const
static const fltSemantics IEEEdouble
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
2: 32-bit floating point type
static NodeType * getEntryNode(Type *T)
static PointerType * getInt32PtrTy(LLVMContext &C, unsigned AS=0)
static ChildIteratorType child_begin(NodeType *N)
bool isDoubleTy() const
isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
bool isPtrOrPtrVectorTy() const
isPtrOrPtrVectorTy - Return true if this is a pointer type or a vector of pointer types...
int getFPMantissaWidth() const
getFPMantissaWidth - Return the width of the mantissa of this type.
4: 80-bit floating point type (X87)
subtype_reverse_iterator subtype_rend() const
1: 16-bit floating point type
static IntegerType * getInt64Ty(LLVMContext &C)
static Type * getMetadataTy(LLVMContext &C)
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static IntegerType * getInt16Ty(LLVMContext &C)
static Type * getX86_MMXTy(LLVMContext &C)
static PointerType * getX86_MMXPtrTy(LLVMContext &C, unsigned AS=0)
subtype_iterator subtype_end() const
static PointerType * getInt64PtrTy(LLVMContext &C, unsigned AS=0)
static Type * getX86_FP80Ty(LLVMContext &C)
Type *const * ContainedTys
ContainedTys - A pointer to the array of Types contained by this Type.
Type * getPointerElementType() const
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
bool isSingleValueType() const
isSingleValueType - Return true if the type is a valid type for a register in codegen.
void print(raw_ostream &O) const
static const fltSemantics x87DoubleExtended
static Type * getFloatTy(LLVMContext &C)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Type * getArrayElementType() const
bool canLosslesslyBitCastTo(Type *Ty) const
canLosslesslyBitCastTo - Return true if this type could be converted with a lossless BitCast to type ...
TypeID
Definitions of all of the base types for the Type system.
bool isSized(SmallPtrSetImpl< const Type * > *Visited=nullptr) const
isSized - Return true if it makes sense to take the size of this type.
StringRef getStructName() const
static PointerType * getInt16PtrTy(LLVMContext &C, unsigned AS=0)
static const fltSemantics IEEEquad
Type * getVectorElementType() const
Type * getFunctionParamType(unsigned i) const
static Type * getPPC_FP128Ty(LLVMContext &C)
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)
LLVMTargetDataRef wrap(const DataLayout *P)
static Type * getLabelTy(LLVMContext &C)
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
bool isHalfTy() const
isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type.
static bool doit(const Type &Ty)
static PointerType * getDoublePtrTy(LLVMContext &C, unsigned AS=0)
bool isFirstClassType() const
isFirstClassType - Return true if the type is "first class", meaning it is a valid type for a Value...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
TypeID getTypeID() const
getTypeID - Return the type id for the type.
bool isFloatingPointTy() const
isFloatingPointTy - Return true if this is one of the six floating point types
bool isArrayTy() const
isArrayTy - True if this is an instance of ArrayType.
unsigned getSubclassData() const
Type(LLVMContext &C, TypeID tid)
bool isPPC_FP128Ty() const
isPPC_FP128Ty - Return true if this is powerpc long double.
PointerType - Class to represent pointers.
10: Arbitrary bit width integers
static ChildIteratorType child_begin(NodeType *N)
unsigned getFunctionNumParams() const
bool isX86_MMXTy() const
isX86_MMXTy - Return true if this is X86 MMX.
bool isIntOrIntVectorTy() const
isIntOrIntVectorTy - Return true if this is an integer type or a vector of integer types...
static IntegerType * getInt128Ty(LLVMContext &C)
DataLayout * unwrap(LLVMTargetDataRef P)
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.
bool isVectorTy() const
isVectorTy - True if this is an instance of VectorType.
static ChildIteratorType child_end(NodeType *N)
Type * getContainedType(unsigned i) const
getContainedType - This method is used to implement the type iterator (defined at the end of the file...
bool isFloatTy() const
isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
This file declares a class to represent arbitrary precision floating point values and provide a varie...
static Type * getVoidTy(LLVMContext &C)
6: 128-bit floating point type (two 64-bits, PowerPC)
Class to represent integer types.
Type::subtype_iterator ChildIteratorType
static PointerType * getPPC_FP128PtrTy(LLVMContext &C, unsigned AS=0)
Type::subtype_iterator ChildIteratorType
unsigned getNumContainedTypes() const
getNumContainedTypes - Return the number of types in the derived type.
bool isFP128Ty() const
isFP128Ty - Return true if this is 'fp128'.
bool isPointerTy() const
isPointerTy - True if this is an instance of PointerType.
static PointerType * getFloatPtrTy(LLVMContext &C, unsigned AS=0)
bool isFPOrFPVectorTy() const
isFPOrFPVectorTy - Return true if this is a FP type or a vector of FP.
PointerType * getPointerTo(unsigned AddrSpace=0)
getPointerTo - Return a pointer to the current type.
static PointerType * getInt8PtrTy(LLVMContext &C, unsigned AS=0)
static const fltSemantics IEEEhalf
static Type * getFP128Ty(LLVMContext &C)
static PointerType * getX86_FP80PtrTy(LLVMContext &C, unsigned AS=0)
static Type * getHalfTy(LLVMContext &C)
static const fltSemantics PPCDoubleDouble
static PointerType * getInt1PtrTy(LLVMContext &C, unsigned AS=0)
unsigned getIntegerBitWidth() const
bool isFunctionTy() const
isFunctionTy - True if this is an instance of FunctionType.
15: SIMD 'packed' format, or other vector type
unsigned getVectorNumElements() const
bool isFunctionVarArg() const
unsigned getScalarSizeInBits() const LLVM_READONLY
getScalarSizeInBits - If this is a vector type, return the getPrimitiveSizeInBits value for the eleme...
Type *const * subtype_iterator
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
static PointerType * getHalfPtrTy(LLVMContext &C, unsigned AS=0)
static Type * getPrimitiveType(LLVMContext &C, TypeID IDNumber)
getPrimitiveType - Return a type based on an identifier.
const fltSemantics & getFltSemantics() const
static PointerType * getFP128PtrTy(LLVMContext &C, unsigned AS=0)
bool isIntegerTy() const
isIntegerTy - True if this is an instance of IntegerType.
const Type * getScalarType() const LLVM_READONLY
getScalarType - If this is a vector type, return the element type, otherwise return 'this'...
bool isStructTy() const
isStructTy - True if this is an instance of StructType.
static const fltSemantics IEEEsingle
bool isX86_FP80Ty() const
isX86_FP80Ty - Return true if this is x86 long double.
bool isAggregateType() const
isAggregateType - Return true if the type is an aggregate type.
void setTypeID(TypeID ID)
static IntegerType * getInt32Ty(LLVMContext &C)
uint64_t getArrayNumElements() const
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
static PointerType * getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS=0)
3: 64-bit floating point type
void setSubclassData(unsigned val)
static NodeType * getEntryNode(NodeType *T)
bool isEmptyTy() const
isEmptyTy - Return true if this type is empty, that is, it has no elements or all its elements are em...
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
getPrimitiveSizeInBits - Return the basic size of this type if it is a primitive type.
bool isLabelTy() const
isLabelTy - Return true if this is 'label'.
This class implements an extremely fast bulk output stream that can only output to a stream...
static ChildIteratorType child_end(NodeType *N)
std::reverse_iterator< subtype_iterator > subtype_reverse_iterator
Type * getStructElementType(unsigned N) const
StringRef - Represent a constant reference to a string, i.e.
9: MMX vectors (64 bits, X86 specific)
subtype_reverse_iterator subtype_rbegin() const
static IntegerType * getInt8Ty(LLVMContext &C)
unsigned NumContainedTys
NumContainedTys - Keeps track of how many Type*'s there are in the ContainedTys list.
subtype_iterator subtype_begin() const
ArrayRef< Type * > subtypes() const
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.
5: 128-bit floating point type (112-bit mantissa)
bool isMetadataTy() const
isMetadataTy - Return true if this is 'metadata'.