Intel SPMD Program Compiler  1.3.0
Public Member Functions | Private Member Functions | Private Attributes
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]

List of all members.

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

Private Member Functions

int getVectorMemoryCount () const

Private Attributes

const AtomicType *const base
const int numElements

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 609 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 1614 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 1620 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 1602 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 1596 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 1590 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 1584 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 1578 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 1644 of file type.cpp.

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

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

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

int VectorType::GetElementCount ( ) const [virtual]

Returns the total number of elements in the collection.

Implements CollectionType.

Definition at line 1653 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 1659 of file type.cpp.

References base.

Referenced by 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 1626 of file type.cpp.

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

Variability VectorType::GetVariability ( ) const [virtual]

Returns the variability of the type.

Implements Type.

Definition at line 1542 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 1725 of file type.cpp.

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

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 1566 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 1572 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 1548 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 1554 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 1560 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 1665 of file type.cpp.

References Assert, base, Module::errorCount, FATAL, getVectorMemoryCount(), Type::IsSOAType(), Type::IsUniformType(), Type::IsVaryingType(), AtomicType::LLVMType(), m, NULL, 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 1635 of file type.cpp.

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

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

Implements Type.

Definition at line 1608 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: