Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
A (short) vector of atomic types. More...
#include <type.h>
Public Member Functions | |
VectorType (const AtomicType *base, int size) | |
Variability | GetVariability () const |
bool | IsBoolType () const |
bool | IsFloatType () const |
bool | IsIntType () const |
bool | IsUnsignedType () const |
bool | IsConstType () const |
const Type * | GetBaseType () const |
const VectorType * | GetAsVaryingType () const |
const VectorType * | GetAsUniformType () const |
const VectorType * | GetAsUnboundVariabilityType () const |
const VectorType * | GetAsSOAType (int width) const |
const VectorType * | ResolveUnboundVariability (Variability v) const |
const VectorType * | GetAsUnsignedType () const |
const VectorType * | GetAsConstType () const |
const VectorType * | GetAsNonConstType () const |
std::string | GetString () const |
std::string | Mangle () const |
std::string | GetCDeclaration (const std::string &name) const |
llvm::Type * | LLVMStorageType (llvm::LLVMContext *ctx) const |
llvm::Type * | LLVMType (llvm::LLVMContext *ctx) const |
llvm::DIType * | GetDIType (llvm::DIScope *scope) const |
int | GetElementCount () const |
const AtomicType * | GetElementType () const |
int | getVectorMemoryCount () const |
Public Member Functions inherited from SequentialType | |
const Type * | GetElementType (int index) const |
Public Member Functions inherited from Type | |
bool | IsPointerType () const |
bool | IsArrayType () const |
bool | IsReferenceType () const |
bool | IsVoidType () const |
bool | IsNumericType () const |
bool | IsUniformType () const |
bool | IsVaryingType () const |
bool | IsSOAType () const |
int | GetSOAWidth () const |
bool | HasUnboundVariability () const |
virtual const Type * | GetReferenceTarget () const |
Private Attributes | |
const AtomicType *const | base |
const int | numElements |
Additional Inherited Members | |
Static Public Member Functions inherited from Type | |
static bool | Equal (const Type *a, const Type *b) |
static bool | EqualIgnoringConst (const Type *a, const Type *b) |
static const Type * | MoreGeneralType (const Type *type0, const Type *type1, SourcePos pos, const char *reason, bool forceVarying=false, int vecSize=0) |
static bool | IsBasicType (const Type *type) |
Public Attributes inherited from Type | |
const TypeId | typeId |
Protected Member Functions inherited from SequentialType | |
SequentialType (TypeId id) | |
Protected Member Functions inherited from CollectionType | |
CollectionType (TypeId id) | |
Protected Member Functions inherited from Type | |
Type (TypeId id) | |
A (short) vector of atomic types.
VectorType is used to represent a fixed-size array of elements of an AtomicType. Vectors are similar to arrays in that they support indexing of the elements, but have two key differences. First, all arithmetic and logical operations that are value for the element type can be performed on corresponding VectorTypes (as long as the two VectorTypes have the same size). Second, VectorTypes of uniform elements are laid out in memory aligned to the target's vector size; this allows them to be packed 'horizontally' into vector registers.
VectorType::VectorType | ( | const AtomicType * | base, |
int | size | ||
) |
Definition at line 1346 of file type.cpp.
References Assert, base, and numElements.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), and ResolveUnboundVariability().
|
virtual |
Get a const version of this type. If it's already const, then the old Type pointer is returned.
Implements Type.
Definition at line 1389 of file type.cpp.
References base, AtomicType::GetAsConstType(), numElements, and VectorType().
|
virtual |
Get a non-const version of this type. If it's already not const, then the old Type pointer is returned.
Implements Type.
Definition at line 1391 of file type.cpp.
References base, AtomicType::GetAsNonConstType(), numElements, and VectorType().
Referenced by lEmitVectorTypedefs().
|
virtual |
Implements Type.
Definition at line 1373 of file type.cpp.
References base, AtomicType::GetAsSOAType(), numElements, and VectorType().
|
virtual |
Get an instance of the type with unbound variability.
Implements Type.
Definition at line 1369 of file type.cpp.
References base, AtomicType::GetAsUnboundVariabilityType(), numElements, and VectorType().
|
virtual |
Return a "uniform" instance of this type. If the type is already uniform, its "this" pointer will be returned.
Implements Type.
Definition at line 1367 of file type.cpp.
References base, AtomicType::GetAsUniformType(), numElements, and VectorType().
|
virtual |
If this is a signed integer type, return the unsigned version of the type. Otherwise, return the original type.
Reimplemented from Type.
Definition at line 1381 of file type.cpp.
References Assert, base, Module::errorCount, AtomicType::GetAsUnsignedType(), m, numElements, and VectorType().
|
virtual |
Return a "varying" instance of this type. If the type is already varying, its "this" pointer will be returned.
Implements Type.
Definition at line 1365 of file type.cpp.
References base, AtomicType::GetAsVaryingType(), numElements, and VectorType().
|
virtual |
Returns the basic root type of the given type. For example, for an array or short-vector, this returns the element type. For a struct or atomic type, it returns itself.
Implements Type.
Definition at line 1363 of file type.cpp.
References base.
Referenced by lEmitVectorTypedefs(), and lGetVectorLLVMType().
|
virtual |
Returns a string that is the declaration of the same type in C syntax.
Implements Type.
Definition at line 1409 of file type.cpp.
References base, AtomicType::GetCDeclaration(), and numElements.
|
virtual |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 1462 of file type.cpp.
References base, Globals::ctx, Module::diBuilder, FATAL, g, Target::getDataLayout(), AtomicType::GetDIType(), ArrayType::GetDIType(), Type::IsSOAType(), Type::IsUniformType(), Type::IsVaryingType(), LLVMType(), m, numElements, and Globals::target.
|
virtual |
Returns the total number of elements in the collection.
Implements CollectionType.
Definition at line 1416 of file type.cpp.
References numElements.
Referenced by SelectExpr::GetValue(), TypeCastExpr::GetValue(), lCheckTypeEquality(), lEmitVectorTypedefs(), lGetVectorLLVMType(), lMatchingBoolType(), lVectorConvert(), Type::MoreGeneralType(), and BinaryExpr::TypeCheck().
|
virtual |
Returns the Type of the elements that the sequence stores; for SequentialTypes, all elements have the same type .
Implements SequentialType.
Definition at line 1418 of file type.cpp.
References base.
Referenced by VectorMemberExpr::GetType(), SelectExpr::GetValue(), TypeCastExpr::GetValue(), VectorMemberExpr::GetValue(), lCheckTypeEquality(), FunctionEmitContext::LoadInst(), Type::MoreGeneralType(), FunctionEmitContext::StoreInst(), and VectorMemberExpr::VectorMemberExpr().
|
virtual |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 1395 of file type.cpp.
References base, AtomicType::GetString(), and numElements.
|
virtual |
Returns the variability of the type.
Implements Type.
Definition at line 1351 of file type.cpp.
References base, and AtomicType::GetVariability().
int VectorType::getVectorMemoryCount | ( | ) | const |
Returns the number of elements stored in memory for the vector. For uniform vectors, this is rounded up so that the number of elements evenly divides the target's native vector width.
Definition at line 1491 of file type.cpp.
References base, FATAL, g, Target::getDataTypeWidth(), Type::IsSOAType(), Type::IsUniformType(), Type::IsVaryingType(), numElements, and Globals::target.
Referenced by lGetExprListConstant(), and lGetVectorLLVMType().
|
virtual |
Returns true if the underlying type is boolean. In other words, this is true for individual bools and for short-vectors with underlying bool type, but not for arrays of bools.
Implements Type.
Definition at line 1359 of file type.cpp.
References base, and AtomicType::IsBoolType().
|
virtual |
Returns true if this type is 'const'-qualified.
Implements Type.
Definition at line 1361 of file type.cpp.
References base, and AtomicType::IsConstType().
|
virtual |
Returns true if the underlying type is float or double. In other words, this is true for individual floats/doubles and for short-vectors of them, but not for arrays of them.
Implements Type.
Definition at line 1353 of file type.cpp.
References base, and AtomicType::IsFloatType().
|
virtual |
Returns true if the underlying type is an integer type. In other words, this is true for individual integers and for short-vectors of integer types, but not for arrays of integer types.
Implements Type.
Definition at line 1355 of file type.cpp.
References base, and AtomicType::IsIntType().
|
virtual |
Returns true if the underlying type is unsigned. In other words, this is true for unsigned integers and short vectors of unsigned integer types.
Implements Type.
Definition at line 1357 of file type.cpp.
References base, and AtomicType::IsUnsignedType().
|
virtual |
Returns the LLVM storage type corresponding to this ispc type.
Reimplemented from Type.
Definition at line 1458 of file type.cpp.
References lGetVectorLLVMType().
|
virtual |
Returns the LLVM type corresponding to this ispc type.
Implements Type.
Definition at line 1460 of file type.cpp.
References lGetVectorLLVMType().
Referenced by GetDIType(), and lEmitVectorTypedefs().
|
virtual |
Returns a string that represents the mangled type (for use in mangling function symbol names for function overloading). The various Types implementations of this method should collectively ensure that all of them use mangling schemes that are guaranteed not to clash.
Implements Type.
Definition at line 1402 of file type.cpp.
References base, AtomicType::Mangle(), and numElements.
|
virtual |
Implements Type.
Definition at line 1377 of file type.cpp.
References base, numElements, AtomicType::ResolveUnboundVariability(), and VectorType().
|
private |
Base type that the vector holds elements of
Definition at line 637 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetBaseType(), GetCDeclaration(), GetDIType(), GetElementType(), GetString(), GetVariability(), getVectorMemoryCount(), IsBoolType(), IsConstType(), IsFloatType(), IsIntType(), IsUnsignedType(), lGetVectorLLVMType(), Mangle(), ResolveUnboundVariability(), and VectorType().
|
private |
Number of elements in the vector
Definition at line 639 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetCDeclaration(), GetDIType(), GetElementCount(), GetString(), getVectorMemoryCount(), lGetVectorLLVMType(), Mangle(), ResolveUnboundVariability(), and VectorType().