18 #ifndef LLVM_IR_DERIVEDTYPES_H 19 #define LLVM_IR_DERIVEDTYPES_H 118 static bool isValidReturnType(
Type *RetTy);
121 static bool isValidArgumentType(
Type *ArgTy);
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");
275 bool hasName()
const {
return SymbolTableEntry !=
nullptr; }
289 template <
typename... Tys>
292 assert(elt1 &&
"Cannot create a struct type with no elements with this");
294 setBody(StructFields);
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
CompositeType(LLVMContext &C, TypeID tid)
This class represents lattice values for constants.
Type * getParamType(unsigned i) const
Parameter type accessors.
Type * getElementType(unsigned N) const
unsigned getFunctionNumParams() const
bool isSized(SmallPtrSetImpl< Type *> *Visited=nullptr) const
Return true if it makes sense to take the size of this type.
ArrayRef< Type * > const elements() const
unsigned getNumElements() const
Random access to the elements.
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space...
Type * getStructElementType(unsigned N) const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
param_iterator param_end() const
bool isOpaque() const
Return true if this is a type with an identity that has no body specified yet.
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.
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are half as wide as the elements ...
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.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
unsigned getBitWidth() const
Return the number of bits in the Vector type.
amdgpu Simplify well known AMD library false Value Value const Twine & Name
APInt getMask() const
For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
TypeID getTypeID() const
Return the type id for the type.
uint64_t getArrayNumElements() const
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
Class to represent struct types.
static StringRef getName(Value *V)
TypeID
Definitions of all of the base types for the Type system.
Type * getFunctionParamType(unsigned i) const
uint64_t getNumElements() const
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Class to represent function types.
Class to represent array types.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
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...
Type(LLVMContext &C, TypeID tid)
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Type *const * subtype_iterator
Type::subtype_iterator element_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
Maximum number of bits that can be specified.
Minimum number of bits that can be specified.
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.
static std::enable_if< are_base_of< Type, Tys... >::value, StructType * >::type create(StringRef Name, Type *elt1, Tys *... elts)
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.
element_iterator element_end() const
ArrayRef< Type * > params() const
param_iterator param_begin() const
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type...
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
unsigned getStructNumElements() const
unsigned getAddressSpace() const
Return the address space of the Pointer type.
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...
bool isFunctionVarArg() const
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
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
Type * getReturnType() const
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
unsigned getVectorNumElements() const
Symbol info for RuntimeDyld.
bool isLiteral() const
Return true if this type is uniqued by structural equivalence, false if it is a struct definition...
Class to represent vector types.
Class for arbitrary precision integers.
element_iterator element_begin() const
Common super class of ArrayType, StructType and VectorType.
static bool classof(const Type *T)
Methods for support type inquiry through isa, cast, and dyn_cast.
std::enable_if< are_base_of< Type, Tys... >::value, void >::type setBody(Type *elt1, Tys *... elts)
unsigned getSubclassData() const
bool isPowerOf2ByteWidth() const
This method determines if the width of this IntegerType is a power-of-2 in terms of 8 bit bytes...
unsigned getIntegerBitWidth() const
static bool isValidElementType(Type *Ty)
Predicate for the element types that the SLP vectorizer supports.
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 ...
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)
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.
Type * getElementType() const
StringRef - Represent a constant reference to a string, i.e.
bool hasName() const
Return true if this is a named struct that has a non-empty name.
Type * getElementType() const
unsigned NumContainedTys
Keeps track of how many Type*'s there are in the ContainedTys list.
StringRef getStructName() const