|
Intel SPMD Program Compiler
1.3.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::DIDescriptor 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 |
Static Public Member Functions | |
| static const Type * | SizeUnsizedArrays (const Type *type, Expr *initExpr) |
Private Attributes | |
| const Type *const | child |
| const int | numElements |
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 1204 of file type.cpp.
References Assert, Type::Equal(), and numElements.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetSizedArray(), ResolveUnboundVariability(), and SizeUnsizedArrays().
| const ArrayType * ArrayType::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 1338 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsConstType(), m, NULL, and numElements.
| const ArrayType * ArrayType::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 1348 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsNonConstType(), m, NULL, and numElements.
| const ArrayType * ArrayType::GetAsSOAType | ( | int | width | ) | const [virtual] |
Implements Type.
Definition at line 1308 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsSOAType(), m, NULL, and numElements.
| const ArrayType * ArrayType::GetAsUnboundVariabilityType | ( | ) | const [virtual] |
Get an instance of the type with unbound variability.
Implements Type.
Definition at line 1298 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsUnboundVariabilityType(), m, NULL, and numElements.
| const ArrayType * ArrayType::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 1288 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsUniformType(), m, NULL, and numElements.
| const ArrayType * ArrayType::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 1328 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsUnsignedType(), m, NULL, and numElements.
| const ArrayType * ArrayType::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 1278 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, Type::GetAsVaryingType(), m, NULL, and numElements.
| const Type * ArrayType::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 1265 of file type.cpp.
References child.
Referenced by GetCDeclaration(), GetString(), and TypeCastExpr::GetValue().
| std::string ArrayType::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 1411 of file type.cpp.
References Assert, child, Module::errorCount, Type::GetAsUniformType(), GetBaseType(), Type::GetCDeclaration(), Type::GetSOAWidth(), m, NULL, numElements, and s.
| llvm::DIType ArrayType::GetDIType | ( | llvm::DIDescriptor | scope | ) | const [virtual] |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 1455 of file type.cpp.
References Assert, child, Module::errorCount, Type::GetDIType(), lCreateDIArray(), m, NULL, and numElements.
Referenced by AtomicType::GetDIType(), PointerType::GetDIType(), and VectorType::GetDIType().
| int ArrayType::GetElementCount | ( | ) | const [virtual] |
Returns the total number of elements in the collection.
Implements CollectionType.
Definition at line 1358 of file type.cpp.
References numElements.
Referenced by ReferenceType::GetCDeclaration(), GetStructTypesNamesPositions(), TypeCastExpr::GetValue(), Declarator::InitFromType(), lCheckTypeEquality(), lDoTypeConv(), lHasUnsizedArrays(), and SizeUnsizedArrays().
| const Type * ArrayType::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 1364 of file type.cpp.
References child.
Referenced by ReferenceType::GetCDeclaration(), Declarator::InitFromType(), lCheckTypeEquality(), lDoTypeConv(), lGetExportedTypes(), lHasUnsizedArrays(), lVaryingStructHasUniformMember(), and SizeUnsizedArrays().
| ArrayType * ArrayType::GetSizedArray | ( | int | length | ) | const [virtual] |
Returns a new array of the same child type, but with the given length.
Definition at line 1467 of file type.cpp.
References ArrayType(), Assert, child, and numElements.
Referenced by SizeUnsizedArrays().
| std::string ArrayType::GetString | ( | ) | const [virtual] |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 1370 of file type.cpp.
References Assert, child, Module::errorCount, GetBaseType(), Type::GetString(), m, NULL, numElements, and s.
| Variability ArrayType::GetVariability | ( | ) | const [virtual] |
Returns the variability of the type.
Implements Type.
Definition at line 1229 of file type.cpp.
References child, Type::GetVariability(), and Variability::Uniform.
| bool ArrayType::IsBoolType | ( | ) | const [virtual] |
| bool ArrayType::IsConstType | ( | ) | const [virtual] |
Returns true if this type is 'const'-qualified.
Implements Type.
Definition at line 1259 of file type.cpp.
References child, and Type::IsConstType().
| bool ArrayType::IsFloatType | ( | ) | const [virtual] |
| bool ArrayType::IsIntType | ( | ) | const [virtual] |
| bool ArrayType::IsUnsignedType | ( | ) | const [virtual] |
| llvm::ArrayType * ArrayType::LLVMType | ( | llvm::LLVMContext * | ctx | ) | const [virtual] |
Returns the LLVM type corresponding to this ispc type
Implements Type.
Definition at line 1213 of file type.cpp.
References Assert, child, Module::errorCount, Type::LLVMType(), m, NULL, and numElements.
Referenced by AtomicType::LLVMType(), EnumType::LLVMType(), and PointerType::LLVMType().
| std::string ArrayType::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 1395 of file type.cpp.
References Assert, child, Module::errorCount, m, Type::Mangle(), NULL, numElements, and s.
| const ArrayType * ArrayType::ResolveUnboundVariability | ( | Variability | v | ) | const [virtual] |
Implements Type.
Definition at line 1318 of file type.cpp.
References ArrayType(), Assert, child, Module::errorCount, m, NULL, 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 1474 of file type.cpp.
References ArrayType(), Assert, Error(), Module::errorCount, ExprList::exprs, GetElementCount(), GetElementType(), GetSizedArray(), m, NULL, 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 1445 of file type.cpp.
References child, NULL, numElements, and TotalElementCount().
Referenced by Module::AddGlobalVariable(), and TotalElementCount().
const Type* const ArrayType::child [private] |
Type of the elements of the array.
Definition at line 592 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().
const int ArrayType::numElements [private] |
Number of elements in the array.
Definition at line 594 of file type.h.
Referenced by ArrayType(), GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetCDeclaration(), GetDIType(), GetElementCount(), GetSizedArray(), GetString(), LLVMType(), Mangle(), ResolveUnboundVariability(), and TotalElementCount().
1.7.5.1