Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
One-dimensional array type. More...
#include <type.h>
Public Member Functions | |
ArrayType (const Type *elementType, int numElements) | |
Variability | GetVariability () const |
bool | IsBoolType () const |
bool | IsFloatType () const |
bool | IsIntType () const |
bool | IsUnsignedType () const |
bool | IsConstType () const |
const Type * | GetBaseType () const |
const ArrayType * | GetAsVaryingType () const |
const ArrayType * | GetAsUniformType () const |
const ArrayType * | GetAsUnboundVariabilityType () const |
const ArrayType * | GetAsSOAType (int width) const |
const ArrayType * | ResolveUnboundVariability (Variability v) const |
const ArrayType * | GetAsUnsignedType () const |
const ArrayType * | GetAsConstType () const |
const ArrayType * | GetAsNonConstType () const |
std::string | GetString () const |
std::string | Mangle () const |
std::string | GetCDeclaration (const std::string &name) const |
llvm::DIType * | GetDIType (llvm::DIScope *scope) const |
llvm::ArrayType * | LLVMType (llvm::LLVMContext *ctx) const |
int | TotalElementCount () const |
int | GetElementCount () const |
const Type * | GetElementType () const |
virtual ArrayType * | GetSizedArray (int length) 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 |
virtual llvm::Type * | LLVMStorageType (llvm::LLVMContext *ctx) const |
Static Public Member Functions | |
static const Type * | SizeUnsizedArrays (const Type *type, Expr *initExpr) |
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) |
Private Attributes | |
const Type *const | child |
const int | numElements |
Additional Inherited Members | |
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) | |
One-dimensional array type.
ArrayType represents a one-dimensional array of instances of some other type. (Multi-dimensional arrays are represented by ArrayTypes that in turn hold ArrayTypes as their child types.)
ArrayType::ArrayType | ( | const Type * | elementType, |
int | numElements | ||
) |
An ArrayType is created by providing the type of the elements that it stores, and the SOA width to use in laying out the array in memory.
elementType | Type of the array elements |
numElements | Total number of elements in the array. This parameter may be zero, in which case this is an "unsized" array type. (Arrays of specific size can be converted to unsized arrays to be passed to functions that take array parameters, for example). |
Definition at line 1074 of file type.cpp.
References Assert, Type::IsVoidType(), and numElements.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetSizedArray(), ResolveUnboundVariability(), and SizeUnsizedArrays().
|
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 1167 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsConstType(), m, and numElements.
|
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 1175 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsNonConstType(), m, and numElements.
|
virtual |
Implements Type.
Definition at line 1143 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsSOAType(), m, and numElements.
|
virtual |
Get an instance of the type with unbound variability.
Implements Type.
Definition at line 1135 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsUnboundVariabilityType(), m, and numElements.
|
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 1127 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsUniformType(), m, and numElements.
|
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 1159 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsUnsignedType(), m, and numElements.
|
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 1119 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsVaryingType(), m, and numElements.
|
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 1108 of file type.cpp.
References child.
Referenced by GetCDeclaration(), GetString(), and TypeCastExpr::GetValue().
|
virtual |
Returns a string that is the declaration of the same type in C syntax.
Implements Type.
Definition at line 1226 of file type.cpp.
References Assert, child, Module::errorCount, g, Type::GetAsUniformType(), GetBaseType(), Type::GetCDeclaration(), Type::GetSOAWidth(), Target::getVectorWidth(), Type::IsVaryingType(), m, numElements, and Globals::target.
|
virtual |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 1274 of file type.cpp.
References Assert, child, Module::errorCount, Type::GetDIType(), lCreateDIArray(), m, and numElements.
Referenced by AtomicType::GetDIType(), PointerType::GetDIType(), and VectorType::GetDIType().
|
virtual |
Returns the total number of elements in the collection.
Implements CollectionType.
Definition at line 1183 of file type.cpp.
References numElements.
Referenced by ReferenceType::GetCDeclaration(), GetStructTypesNamesPositions(), TypeCastExpr::GetValue(), lCheckTypeEquality(), lDoTypeConv(), lHasUnsizedArrays(), and SizeUnsizedArrays().
|
virtual |
Returns the Type of the elements that the sequence stores; for SequentialTypes, all elements have the same type .
Implements SequentialType.
Definition at line 1185 of file type.cpp.
References child.
Referenced by ReferenceType::GetCDeclaration(), Declarator::InitFromType(), lCheckTypeEquality(), lDoTypeConv(), lGetElementStructType(), lGetExportedTypes(), lHasUnsizedArrays(), lVaryingStructHasUniformMember(), and SizeUnsizedArrays().
|
virtual |
Returns a new array of the same child type, but with the given length.
Definition at line 1283 of file type.cpp.
References ArrayType(), Assert, child, and numElements.
Referenced by SizeUnsizedArrays().
|
virtual |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 1187 of file type.cpp.
References Assert, child, Module::errorCount, GetBaseType(), Type::GetString(), m, and numElements.
|
virtual |
Returns the variability of the type.
Implements Type.
Definition at line 1094 of file type.cpp.
References child, Type::GetVariability(), and Variability::Uniform.
|
virtual |
|
virtual |
Returns true if this type is 'const'-qualified.
Implements Type.
Definition at line 1106 of file type.cpp.
References child, and Type::IsConstType().
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Returns the LLVM type corresponding to this ispc type.
Implements Type.
Definition at line 1080 of file type.cpp.
References Assert, child, Module::errorCount, Type::LLVMStorageType(), m, and numElements.
Referenced by lGetAtomicLLVMType(), EnumType::LLVMType(), and PointerType::LLVMType().
|
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 1211 of file type.cpp.
References Assert, child, Module::errorCount, m, Type::Mangle(), and numElements.
|
virtual |
Implements Type.
Definition at line 1151 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, m, numElements, and Type::ResolveUnboundVariability().
If the given type is a (possibly multi-dimensional) array type and the initializer expression is an expression list, set the size of any array dimensions that are unsized according to the number of elements in the corresponding sectoin of the initializer expression.
Definition at line 1288 of file type.cpp.
References ArrayType(), Assert, Error(), Module::errorCount, ExprList::exprs, GetElementCount(), GetElementType(), GetSizedArray(), m, and Union().
Referenced by Module::AddGlobalVariable(), and DeclStmt::EmitCode().
int ArrayType::TotalElementCount | ( | ) | const |
This method returns the total number of elements in the array, including all dimensions if this is a multidimensional array.
Definition at line 1266 of file type.cpp.
References child, numElements, and TotalElementCount().
Referenced by Module::AddGlobalVariable(), and TotalElementCount().
|
private |
Type of the elements of the array.
Definition at line 584 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetBaseType(), GetCDeclaration(), GetDIType(), GetElementType(), GetSizedArray(), GetString(), GetVariability(), IsConstType(), LLVMType(), Mangle(), ResolveUnboundVariability(), and TotalElementCount().
|
private |
Number of elements in the array.
Definition at line 586 of file type.h.
Referenced by ArrayType(), GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetCDeclaration(), GetDIType(), GetElementCount(), GetSizedArray(), GetString(), LLVMType(), Mangle(), ResolveUnboundVariability(), and TotalElementCount().