|
Intel SPMD Program Compiler
1.3.0
|
Representation of a structure holding a number of members. More...
#include <type.h>


Public Member Functions | |
| StructType (const std::string &name, const llvm::SmallVector< const Type *, 8 > &elts, const llvm::SmallVector< std::string, 8 > &eltNames, const llvm::SmallVector< SourcePos, 8 > &eltPositions, bool isConst, Variability variability, SourcePos pos) | |
| Variability | GetVariability () const |
| bool | IsBoolType () const |
| bool | IsFloatType () const |
| bool | IsIntType () const |
| bool | IsUnsignedType () const |
| bool | IsConstType () const |
| const Type * | GetBaseType () const |
| const StructType * | GetAsVaryingType () const |
| const StructType * | GetAsUniformType () const |
| const StructType * | GetAsUnboundVariabilityType () const |
| const StructType * | GetAsSOAType (int width) const |
| const StructType * | ResolveUnboundVariability (Variability v) const |
| const StructType * | GetAsConstType () const |
| const StructType * | GetAsNonConstType () 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 |
| const Type * | GetElementType (const std::string &name) const |
| const Type * | GetElementType (int i) const |
| int | GetElementNumber (const std::string &name) const |
| const std::string & | GetElementName (int i) const |
| int | GetElementCount () const |
| const SourcePos & | GetElementPosition (int i) const |
| const std::string & | GetStructName () const |
Static Private Member Functions | |
| static bool | checkIfCanBeSOA (const StructType *st) |
Private Attributes | |
| std::string | name |
| const llvm::SmallVector< const Type *, 8 > | elementTypes |
| const llvm::SmallVector < std::string, 8 > | elementNames |
| const llvm::SmallVector < SourcePos, 8 > | elementPositions |
| const Variability | variability |
| const bool | isConst |
| const SourcePos | pos |
| llvm::SmallVector< const Type *, 8 > | finalElementTypes |
| const StructType * | oppositeConstStructType |
| StructType::StructType | ( | const std::string & | name, |
| const llvm::SmallVector< const Type *, 8 > & | elts, | ||
| const llvm::SmallVector< std::string, 8 > & | eltNames, | ||
| const llvm::SmallVector< SourcePos, 8 > & | eltPositions, | ||
| bool | isConst, | ||
| Variability | variability, | ||
| SourcePos | pos | ||
| ) |
Definition at line 1800 of file type.cpp.
References Assert, Globals::ctx, elementPositions, elementTypes, Error(), Module::errorCount, finalElementTypes, g, GetElementCount(), GetElementType(), LLVMTypes::Int8Type, Type::LLVMType(), lMangleStructName(), m, name, NULL, oppositeConstStructType, Variability::Unbound, and variability.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), and ResolveUnboundVariability().
| bool StructType::checkIfCanBeSOA | ( | const StructType * | st | ) | [static, private] |
Definition at line 2176 of file type.cpp.
References elementNames, elementPositions, elementTypes, Error(), Type::GetString(), Type::HasUnboundVariability(), Type::IsUniformType(), and NULL.
Referenced by GetAsSOAType().
| const StructType * StructType::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 1972 of file type.cpp.
References elementNames, elementPositions, elementTypes, isConst, name, NULL, oppositeConstStructType, pos, StructType(), and variability.
| const StructType * StructType::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 1988 of file type.cpp.
References elementNames, elementPositions, elementTypes, isConst, name, NULL, oppositeConstStructType, pos, StructType(), and variability.
| const StructType * StructType::GetAsSOAType | ( | int | width | ) | const [virtual] |
Implements Type.
Definition at line 1943 of file type.cpp.
References checkIfCanBeSOA(), elementNames, elementPositions, elementTypes, Type::GetSOAWidth(), isConst, name, NULL, pos, Variability::SOA, and StructType().
Referenced by DeclSpecs::GetBaseType().
| const StructType * StructType::GetAsUnboundVariabilityType | ( | ) | const [virtual] |
Get an instance of the type with unbound variability.
Implements Type.
Definition at line 1933 of file type.cpp.
References elementNames, elementPositions, elementTypes, Type::HasUnboundVariability(), isConst, name, pos, StructType(), and Variability::Unbound.
| const StructType * StructType::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 1923 of file type.cpp.
References elementNames, elementPositions, elementTypes, isConst, Type::IsUniformType(), name, pos, StructType(), and Variability::Uniform.
| const StructType * StructType::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 1913 of file type.cpp.
References elementNames, elementPositions, elementTypes, isConst, Type::IsVaryingType(), name, pos, StructType(), and Variability::Varying.
Referenced by TypeCastExpr::GetValue().
| const Type * StructType::GetBaseType | ( | ) | const [virtual] |
| std::string StructType::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 2054 of file type.cpp.
References isConst, lShouldPrintName(), name, Variability::soaWidth, and variability.
| llvm::DIType StructType::GetDIType | ( | llvm::DIDescriptor | scope | ) | const [virtual] |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 2087 of file type.cpp.
References Assert, Module::diBuilder, elementNames, elementPositions, elementTypes, SourcePos::first_line, SourcePos::GetDIFile(), Type::GetDIType(), GetElementType(), m, name, and pos.
| int StructType::GetElementCount | ( | ) | const [inline, virtual] |
Returns the total number of elements in the structure.
Implements CollectionType.
Definition at line 704 of file type.h.
References elementTypes.
Referenced by MemberExpr::getCandidateNearMatches(), lCheckForConstStructMember(), lEmitStructDecl(), lRecursiveCheckValidParamType(), lVaryingStructHasUniformMember(), and StructType().
| const std::string& StructType::GetElementName | ( | int | i | ) | const [inline] |
Returns the name of the i'th element of the structure.
Definition at line 701 of file type.h.
References elementNames.
Referenced by MemberExpr::getCandidateNearMatches(), lCheckForConstStructMember(), lEmitStructDecl(), and lVaryingStructHasUniformMember().
| int StructType::GetElementNumber | ( | const std::string & | name | ) | const |
Returns which structure element number (starting from zero) that has the given name. If there is no such element, return -1.
Definition at line 2167 of file type.cpp.
References elementNames.
Referenced by StructMemberExpr::getElementNumber().
| const SourcePos& StructType::GetElementPosition | ( | int | i | ) | const [inline] |
Definition at line 706 of file type.h.
References elementPositions.
| const Type * StructType::GetElementType | ( | const std::string & | name | ) | const |
Returns the type of the structure element with the given name (if any). Returns NULL if there is no such named element.
Definition at line 2158 of file type.cpp.
References elementNames, and NULL.
Referenced by GetDIType(), StructMemberExpr::getElementType(), StructMemberExpr::GetType(), lCheckForConstStructMember(), lEmitStructDecl(), lRecursiveCheckValidParamType(), lVaryingStructHasUniformMember(), and StructType().
| const Type * StructType::GetElementType | ( | int | i | ) | const [virtual] |
Returns the type of the i'th structure element. The value of i must be between 0 and NumElements()-1.
Implements CollectionType.
Definition at line 2134 of file type.cpp.
References Assert, elementTypes, Module::errorCount, finalElementTypes, Type::GetAsConstType(), isConst, m, NULL, Type::ResolveUnboundVariability(), Variability::Unbound, and variability.
| std::string StructType::GetString | ( | ) | const [virtual] |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 2004 of file type.cpp.
References elementNames, elementTypes, Variability::GetString(), isConst, name, and variability.
Referenced by StructMemberExpr::getElementNumber(), StructMemberExpr::GetType(), lCheckForConstStructMember(), lVaryingStructHasUniformMember(), and AssignExpr::TypeCheck().
| const std::string& StructType::GetStructName | ( | ) | const [inline] |
Returns the name of the structure type. (e.g. struct Foo -> "Foo".)
Definition at line 709 of file type.h.
References name.
Referenced by lCheckTypeEquality(), and lEmitStructDecl().
| Variability StructType::GetVariability | ( | ) | const [virtual] |
Returns the variability of the type.
Implements Type.
Definition at line 1871 of file type.cpp.
References variability.
| bool StructType::IsBoolType | ( | ) | const [virtual] |
| bool StructType::IsConstType | ( | ) | const [virtual] |
| bool StructType::IsFloatType | ( | ) | const [virtual] |
| bool StructType::IsIntType | ( | ) | const [virtual] |
| bool StructType::IsUnsignedType | ( | ) | const [virtual] |
| llvm::Type * StructType::LLVMType | ( | llvm::LLVMContext * | ctx | ) | const [virtual] |
Returns the LLVM type corresponding to this ispc type
Implements Type.
Definition at line 2075 of file type.cpp.
References Assert, Module::errorCount, lMangleStructName(), m, name, NULL, Variability::Unbound, and variability.
Referenced by FunctionEmitContext::AddElementOffset().
| std::string StructType::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 2048 of file type.cpp.
References isConst, lMangleStruct(), name, and variability.
| const StructType * StructType::ResolveUnboundVariability | ( | Variability | v | ) | const [virtual] |
Implements Type.
Definition at line 1956 of file type.cpp.
References Assert, elementNames, elementPositions, elementTypes, isConst, name, pos, StructType(), Variability::Unbound, and variability.
const llvm::SmallVector<std::string, 8> StructType::elementNames [private] |
Definition at line 726 of file type.h.
Referenced by checkIfCanBeSOA(), GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetDIType(), GetElementName(), GetElementNumber(), GetElementType(), GetString(), and ResolveUnboundVariability().
const llvm::SmallVector<SourcePos, 8> StructType::elementPositions [private] |
Source file position at which each structure element declaration appeared.
Definition at line 729 of file type.h.
Referenced by checkIfCanBeSOA(), GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetDIType(), GetElementPosition(), ResolveUnboundVariability(), and StructType().
const llvm::SmallVector<const Type *, 8> StructType::elementTypes [private] |
The types of the struct elements. Note that we store these with uniform/varying exactly as they were declared in the source file. (In other words, even if this struct has a varying qualifier and thus all of its members are going to be widened out to be varying, we still store any members that were declared as uniform as uniform types in the elementTypes array, converting them to varying as needed in the implementation.) This is so that if we later need to make a uniform version of the struct, we've maintained the original information about the member types.
Definition at line 725 of file type.h.
Referenced by checkIfCanBeSOA(), GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetDIType(), GetElementCount(), GetElementType(), GetString(), ResolveUnboundVariability(), and StructType().
llvm::SmallVector<const Type *, 8> StructType::finalElementTypes [mutable, private] |
Definition at line 734 of file type.h.
Referenced by GetElementType(), and StructType().
const bool StructType::isConst [private] |
Definition at line 731 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetElementType(), GetString(), IsConstType(), Mangle(), and ResolveUnboundVariability().
std::string StructType::name [private] |
Definition at line 714 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetDIType(), GetString(), GetStructName(), LLVMType(), Mangle(), ResolveUnboundVariability(), and StructType().
const StructType* StructType::oppositeConstStructType [mutable, private] |
Definition at line 736 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), and StructType().
const SourcePos StructType::pos [private] |
Definition at line 732 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetDIType(), and ResolveUnboundVariability().
const Variability StructType::variability [private] |
Definition at line 730 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetCDeclaration(), GetElementType(), GetString(), GetVariability(), LLVMType(), Mangle(), ResolveUnboundVariability(), and StructType().
1.7.5.1