18 #ifndef LLVM_IR_DERIVEDTYPES_H
19 #define LLVM_IR_DERIVEDTYPES_H
118 static bool isValidReturnType(
Type *RetTy);
121 static bool isValidArgumentType(
Type *ArgTy);
146 static_assert(
alignof(FunctionType) >=
alignof(
Type *),
147 "Alignment sufficient for objects appended to FunctionType");
150 return cast<FunctionType>(
this)->isVarArg();
154 return cast<FunctionType>(
this)->getParamType(i);
158 return cast<FunctionType>(
this)->getNumParams();
168 Type *getTypeAtIndex(
const Value *V)
const;
169 Type *getTypeAtIndex(
unsigned Idx)
const;
170 bool indexValid(
const Value *V)
const;
171 bool indexValid(
unsigned Idx)
const;
227 bool isPacked =
false);
232 template <
class... Tys>
236 assert(elt1 &&
"Cannot create a struct type with no elements with this");
238 return create(StructFields, Name);
243 bool isPacked =
false);
251 template <
class... Tys>
254 get(
Type *elt1, Tys *... elts) {
255 assert(elt1 &&
"Cannot create a struct type with no elements with this");
289 template <
typename... Tys>
292 assert(elt1 &&
"Cannot create a struct type with no elements with this");
294 setBody(StructFields);
310 bool isLayoutIdentical(
StructType *Other)
const;
326 return cast<StructType>(
this)->
getName();
330 return cast<StructType>(
this)->getNumElements();
334 return cast<StructType>(
this)->getElementType(N);
345 uint64_t NumElements;
350 NumElements(NumElements) {
377 static ArrayType *
get(
Type *ElementType, uint64_t NumElements);
389 return cast<ArrayType>(
this)->getNumElements();
408 assert(EltBits &&
"Element size must be of a non-zero size");
425 assert((EltBits & 1) == 0 &&
426 "Cannot truncate vector element with odd bit-width");
435 assert ((NumElts & 1) == 0 &&
436 "Cannot halve vector with odd number of elements.");
453 return getNumElements() * getElementType()->getPrimitiveSizeInBits();
463 return cast<VectorType>(
this)->getNumElements();
492 static bool isLoadableOrStorableType(
Type *ElemTy);
504 return cast<PointerType>(
getScalarType())->getAddressSpace();
509 #endif // LLVM_IR_DERIVEDTYPES_H
std::enable_if< are_base_of< Type, Tys...>::value, void >::type setBody(Type *elt1, Tys *...elts)
CompositeType(LLVMContext &C, TypeID tid)
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
APInt getMask() const
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
unsigned getStructNumElements() const
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
ArrayRef< Type * > params() const
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
SequentialType(TypeID TID, Type *ElType, uint64_t NumElements)
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Type * getElementType() const
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are half as wide as the elements ...
Type * getFunctionParamType(unsigned i) const
Type *const * ContainedTys
A pointer to the array of Types contained by this Type.
uint64_t getArrayNumElements() const
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
element_iterator element_end() const
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Class to represent struct types.
param_iterator param_end() const
uint64_t getSignBit() const
Return a uint64_t with just the most significant bit set (the sign bit, if the value is treated as a ...
unsigned getBitWidth() const
Return the number of bits in the Vector type.
bool isLiteral() const
Return true if this type is uniqued by structural equivalence, false if it is a struct definition...
static StringRef getName(Value *V)
TypeID
Definitions of all of the base types for the Type system.
element_iterator element_begin() const
Class to represent function types.
Type * getStructElementType(unsigned N) const
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
ArrayRef< Type * > const elements() const
Class to represent array types.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
TypeID getTypeID() const
Return the type id for the type.
unsigned getSubclassData() const
Type(LLVMContext &C, TypeID tid)
Type *const * subtype_iterator
Type::subtype_iterator element_iterator
Type * getElementType() const
Class to represent pointers.
11: Arbitrary bit width integers
bool isSized(SmallPtrSetImpl< Type * > *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
Type * getParamType(unsigned i) const
Parameter type accessors.
static VectorType * getHalfElementsVectorType(VectorType *VTy)
This static method returns a VectorType with half as many elements as the input type and the same ele...
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.
Type * getElementType(unsigned N) const
param_iterator param_begin() const
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type...
uint64_t getNumElements() const
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
bool isFunctionVarArg() const
unsigned getIntegerBitWidth() const
Class to represent integer types.
static VectorType * getDoubleElementsVectorType(VectorType *VTy)
This static method returns a VectorType with twice as many elements as the input type and the same el...
static std::enable_if< are_base_of< Type, Tys...>::value, StructType * >::type create(StringRef Name, Type *elt1, Tys *...elts)
This is the superclass of the array and vector type classes.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the generic address space (address sp...
16: SIMD 'packed' format, or other vector type
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
bool hasName() const
Return true if this is a named struct that has a non-empty name.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Type::subtype_iterator param_iterator
StringRef getStructName() const
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
Symbol info for RuntimeDyld.
Class to represent vector types.
Class for arbitrary precision integers.
unsigned getVectorNumElements() const
Common super class of ArrayType, StructType and VectorType.
uint64_t getBitMask() const
Return a bitmask with ones set for all of the bits that can be set by an unsigned version of this typ...
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
unsigned getFunctionNumParams() const
Minimum number of bits that can be specified.
static bool isValidElementType(Type *Ty)
Predicate for the element types that the SLP vectorizer supports.
bool isPowerOf2ByteWidth() const
This method determines if the width of this IntegerType is a power-of-2 in terms of 8 bit bytes...
static bool classof(const Type *T)
Implement support type inquiry through isa, cast, and dyn_cast.
IntegerType(LLVMContext &C, unsigned NumBits)
void setSubclassData(unsigned val)
Type * getReturnType() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
traits class for checking whether type T is a base class for all the given types in the variadic list...
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
LLVM Value Representation.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
StringRef - Represent a constant reference to a string, i.e.
unsigned getNumElements() const
Random access to the elements.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Maximum number of bits that can be specified.
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.