Intel SPMD Program Compiler  1.9.1
Public Member Functions | Private 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 VectorTypeGetAsConstType () const
 
const VectorTypeGetAsNonConstType () const
 
std::string GetString () const
 
std::string Mangle () const
 
std::string GetCDeclaration (const std::string &name) const
 
llvm::Type * LLVMType (llvm::LLVMContext *ctx) const
 
llvm::DIType GetDIType (llvm::DIDescriptor scope) const
 
int GetElementCount () const
 
const AtomicTypeGetElementType () 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 TypeGetAsUnsignedType () const
 
virtual const TypeGetReferenceTarget () const
 

Private Member Functions

int getVectorMemoryCount () 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 639 of file type.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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 1741 of file type.cpp.

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

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 1747 of file type.cpp.

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

Referenced by lEmitVectorTypedefs().

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

Implements Type.

Definition at line 1729 of file type.cpp.

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

const VectorType * VectorType::GetAsUnboundVariabilityType ( ) const
virtual

Get an instance of the type with unbound variability.

Implements Type.

Definition at line 1723 of file type.cpp.

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

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 1717 of file type.cpp.

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

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 1711 of file type.cpp.

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

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 1705 of file type.cpp.

References base.

Referenced by lEmitVectorTypedefs().

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 1771 of file type.cpp.

References base, AtomicType::GetCDeclaration(), and numElements.

llvm::DIType VectorType::GetDIType ( llvm::DIDescriptor  scope) const
virtual

Returns the DIType (LLVM's debugging information structure), corresponding to this type.

Implements Type.

Definition at line 1824 of file type.cpp.

References base, Module::diBuilder, FATAL, g, AtomicType::GetDIType(), ArrayType::GetDIType(), Target::getNativeVectorWidth(), Type::IsSOAType(), Type::IsUniformType(), Type::IsVaryingType(), m, numElements, and Globals::target.

int VectorType::GetElementCount ( ) const
virtual

Returns the total number of elements in the collection.

Implements CollectionType.

Definition at line 1780 of file type.cpp.

References numElements.

Referenced by SelectExpr::GetValue(), TypeCastExpr::GetValue(), lCheckTypeEquality(), lEmitVectorTypedefs(), lMatchingBoolType(), lVectorConvert(), Type::MoreGeneralType(), and BinaryExpr::TypeCheck().

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 1786 of file type.cpp.

References base.

Referenced by ExprList::GetConstant(), VectorMemberExpr::GetType(), SelectExpr::GetValue(), TypeCastExpr::GetValue(), VectorMemberExpr::GetValue(), lCheckTypeEquality(), Type::MoreGeneralType(), and VectorMemberExpr::VectorMemberExpr().

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 1753 of file type.cpp.

References base, AtomicType::GetString(), and numElements.

Variability VectorType::GetVariability ( ) const
virtual

Returns the variability of the type.

Implements Type.

Definition at line 1669 of file type.cpp.

References base, and AtomicType::GetVariability().

int VectorType::getVectorMemoryCount ( ) const
private

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 1872 of file type.cpp.

References base, Type::Equal(), FATAL, g, AtomicType::GetAsUniformType(), Target::getNativeVectorWidth(), Type::IsSOAType(), Type::IsUniformType(), Type::IsVaryingType(), numElements, Globals::target, AtomicType::UniformDouble, AtomicType::UniformInt64, and AtomicType::UniformUInt64.

Referenced by LLVMType().

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 1693 of file type.cpp.

References base, and AtomicType::IsBoolType().

bool VectorType::IsConstType ( ) const
virtual

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

Implements Type.

Definition at line 1699 of file type.cpp.

References base, and AtomicType::IsConstType().

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 1675 of file type.cpp.

References base, and AtomicType::IsFloatType().

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 1681 of file type.cpp.

References base, and AtomicType::IsIntType().

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 1687 of file type.cpp.

References base, and AtomicType::IsUnsignedType().

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

Returns the LLVM type corresponding to this ispc type

Implements Type.

Definition at line 1792 of file type.cpp.

References Assert, base, Module::errorCount, FATAL, getVectorMemoryCount(), Type::IsSOAType(), Type::IsUniformType(), Type::IsVaryingType(), AtomicType::LLVMType(), m, and numElements.

Referenced by VectorMemberExpr::GetValue().

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 1762 of file type.cpp.

References base, AtomicType::Mangle(), and numElements.

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

Implements Type.

Definition at line 1735 of file type.cpp.

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

Member Data Documentation

const AtomicType* const VectorType::base
private
const int VectorType::numElements
private

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