Intel® Implicit SPMD Program Compiler (Intel® ISPC)  1.13.0
Public Member Functions | Private Attributes | List of all members
VectorType Class Reference

A (short) vector of atomic types. More...

#include <type.h>

Inheritance diagram for VectorType:
Inheritance graph
[legend]
Collaboration diagram for VectorType:
Collaboration graph
[legend]

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 TypeGetBaseType () const
 
const VectorTypeGetAsVaryingType () const
 
const VectorTypeGetAsUniformType () const
 
const VectorTypeGetAsUnboundVariabilityType () const
 
const VectorTypeGetAsSOAType (int width) const
 
const VectorTypeResolveUnboundVariability (Variability v) const
 
const VectorTypeGetAsUnsignedType () const
 
const VectorTypeGetAsConstType () const
 
const VectorTypeGetAsNonConstType () 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 AtomicTypeGetElementType () const
 
int getVectorMemoryCount () const
 
- Public Member Functions inherited from SequentialType
const TypeGetElementType (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 TypeGetReferenceTarget () 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 TypeMoreGeneralType (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)
 

Detailed Description

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.

Definition at line 600 of file type.h.

Constructor & Destructor Documentation

◆ VectorType()

VectorType::VectorType ( const AtomicType base,
int  size 
)

Member Function Documentation

◆ GetAsConstType()

const VectorType * VectorType::GetAsConstType ( ) const
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().

◆ GetAsNonConstType()

const VectorType * VectorType::GetAsNonConstType ( ) const
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().

◆ GetAsSOAType()

const VectorType * VectorType::GetAsSOAType ( int  width) const
virtual

Implements Type.

Definition at line 1373 of file type.cpp.

References base, AtomicType::GetAsSOAType(), numElements, and VectorType().

◆ GetAsUnboundVariabilityType()

const VectorType * VectorType::GetAsUnboundVariabilityType ( ) const
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().

◆ GetAsUniformType()

const VectorType * VectorType::GetAsUniformType ( ) const
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().

◆ GetAsUnsignedType()

const VectorType * VectorType::GetAsUnsignedType ( ) const
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().

◆ GetAsVaryingType()

const VectorType * VectorType::GetAsVaryingType ( ) const
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().

◆ GetBaseType()

const Type * VectorType::GetBaseType ( ) const
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().

◆ GetCDeclaration()

std::string VectorType::GetCDeclaration ( const std::string &  name) const
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.

◆ GetDIType()

llvm::DIType * VectorType::GetDIType ( llvm::DIScope *  scope) const
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.

◆ GetElementCount()

int VectorType::GetElementCount ( ) const
virtual

◆ GetElementType()

const AtomicType * VectorType::GetElementType ( ) const
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().

◆ GetString()

std::string VectorType::GetString ( ) const
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.

◆ GetVariability()

Variability VectorType::GetVariability ( ) const
virtual

Returns the variability of the type.

Implements Type.

Definition at line 1351 of file type.cpp.

References base, and AtomicType::GetVariability().

◆ getVectorMemoryCount()

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().

◆ IsBoolType()

bool VectorType::IsBoolType ( ) const
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().

◆ IsConstType()

bool VectorType::IsConstType ( ) const
virtual

Returns true if this type is 'const'-qualified.

Implements Type.

Definition at line 1361 of file type.cpp.

References base, and AtomicType::IsConstType().

◆ IsFloatType()

bool VectorType::IsFloatType ( ) const
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().

◆ IsIntType()

bool VectorType::IsIntType ( ) const
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().

◆ IsUnsignedType()

bool VectorType::IsUnsignedType ( ) const
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().

◆ LLVMStorageType()

llvm::Type * VectorType::LLVMStorageType ( llvm::LLVMContext *  ctx) const
virtual

Returns the LLVM storage type corresponding to this ispc type.

Reimplemented from Type.

Definition at line 1458 of file type.cpp.

References lGetVectorLLVMType().

◆ LLVMType()

llvm::Type * VectorType::LLVMType ( llvm::LLVMContext *  ctx) const
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().

◆ Mangle()

std::string VectorType::Mangle ( ) const
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.

◆ ResolveUnboundVariability()

const VectorType * VectorType::ResolveUnboundVariability ( Variability  v) const
virtual

Implements Type.

Definition at line 1377 of file type.cpp.

References base, numElements, AtomicType::ResolveUnboundVariability(), and VectorType().

Member Data Documentation

◆ base

const AtomicType* const VectorType::base
private

◆ numElements

const int VectorType::numElements
private

The documentation for this class was generated from the following files: