|
Intel SPMD Program Compiler
1.3.0
|
Type implementation for pointers to other types. More...
#include <type.h>


Public Member Functions | |
| PointerType (const Type *t, Variability v, bool isConst, bool isSlice=false, bool frozen=false) | |
| Variability | GetVariability () const |
| bool | IsBoolType () const |
| bool | IsFloatType () const |
| bool | IsIntType () const |
| bool | IsUnsignedType () const |
| bool | IsConstType () const |
| bool | IsSlice () const |
| bool | IsFrozenSlice () const |
| const PointerType * | GetAsSlice () const |
| const PointerType * | GetAsNonSlice () const |
| const PointerType * | GetAsFrozenSlice () const |
| const Type * | GetBaseType () const |
| const PointerType * | GetAsVaryingType () const |
| const PointerType * | GetAsUniformType () const |
| const PointerType * | GetAsUnboundVariabilityType () const |
| const PointerType * | GetAsSOAType (int width) const |
| const PointerType * | ResolveUnboundVariability (Variability v) const |
| const PointerType * | GetAsConstType () const |
| const PointerType * | 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 |
Static Public Member Functions | |
| static PointerType * | GetUniform (const Type *t) |
| static PointerType * | GetVarying (const Type *t) |
| static bool | IsVoidPointer (const Type *t) |
Static Public Attributes | |
| static PointerType * | Void |
Private Attributes | |
| const Variability | variability |
| const bool | isConst |
| const bool | isSlice |
| const bool | isFrozen |
| const Type * | baseType |
Type implementation for pointers to other types.
Pointers can have two additional properties beyond their variability and the type of object that they are pointing to. Both of these properties are used for internal bookkeeping and aren't directly accessible from the language.
| PointerType::PointerType | ( | const Type * | t, |
| Variability | v, | ||
| bool | isConst, | ||
| bool | isSlice = false, |
||
| bool | frozen = false |
||
| ) |
Definition at line 868 of file type.cpp.
References baseType.
Referenced by GetAsConstType(), GetAsFrozenSlice(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetUniform(), GetVarying(), and ResolveUnboundVariability().
| const PointerType * PointerType::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 1018 of file type.cpp.
References baseType, isConst, isSlice, PointerType(), and variability.
| const PointerType * PointerType::GetAsFrozenSlice | ( | ) | const |
Definition at line 993 of file type.cpp.
References baseType, isConst, isFrozen, PointerType(), and variability.
Referenced by StructMemberExpr::GetLValueType(), and VectorMemberExpr::GetLValueType().
| const PointerType * PointerType::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 1027 of file type.cpp.
References baseType, isConst, isSlice, PointerType(), and variability.
| const PointerType * PointerType::GetAsNonSlice | ( | ) | const |
Definition at line 985 of file type.cpp.
References baseType, isConst, isSlice, PointerType(), and variability.
Referenced by FunctionEmitContext::GetElementPtrInst(), lEmitBinaryPointerArith(), LLVMType(), and FunctionEmitContext::maskedStore().
| const PointerType * PointerType::GetAsSlice | ( | ) | const |
Definition at line 977 of file type.cpp.
References baseType, isConst, isSlice, PointerType(), and variability.
Referenced by IndexExpr::GetLValueType(), lConvertPtrToSliceIfNeeded(), and FunctionEmitContext::scatter().
| const PointerType * PointerType::GetAsSOAType | ( | int | width | ) | const [virtual] |
Implements Type.
Definition at line 967 of file type.cpp.
References baseType, Type::GetSOAWidth(), isConst, isFrozen, isSlice, PointerType(), and Variability::SOA.
| const PointerType * PointerType::GetAsUnboundVariabilityType | ( | ) | const [virtual] |
Get an instance of the type with unbound variability.
Implements Type.
Definition at line 957 of file type.cpp.
References baseType, isConst, isFrozen, isSlice, PointerType(), Variability::Unbound, and variability.
| const PointerType * PointerType::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 947 of file type.cpp.
References baseType, isConst, isFrozen, isSlice, PointerType(), Variability::Uniform, and variability.
Referenced by GetDIType(), and LLVMType().
| const PointerType * PointerType::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 937 of file type.cpp.
References baseType, isConst, isFrozen, isSlice, PointerType(), variability, and Variability::Varying.
| const Type * PointerType::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 931 of file type.cpp.
References baseType.
Referenced by FunctionEmitContext::AddElementOffset(), MemberExpr::create(), FunctionEmitContext::gather(), FunctionType::GetCDeclaration(), AddressOfExpr::GetConstant(), FunctionEmitContext::GetElementPtrInst(), IndexExpr::GetLValueType(), StructMemberExpr::getStructType(), IndexExpr::GetType(), lAddVaryingOffsetsIfNeeded(), lCheckTypeEquality(), lConvertPtrToSliceIfNeeded(), lDeconstifyType(), lEmitBinaryPointerArith(), FunctionEmitContext::LoadInst(), FunctionEmitContext::loadUniformFromSOA(), lVaryingStructHasUniformMember(), FunctionEmitContext::scatter(), FunctionEmitContext::StoreInst(), FunctionEmitContext::storeUniformToSOA(), UnaryExpr::TypeCheck(), BinaryExpr::TypeCheck(), FunctionCallExpr::TypeCheck(), and VectorMemberExpr::VectorMemberExpr().
| std::string PointerType::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 1072 of file type.cpp.
References Assert, baseType, Module::errorCount, Type::GetCDeclaration(), isConst, isSlice, m, NULL, Variability::SOA, Variability::soaWidth, Variability::Uniform, and variability.
| llvm::DIType PointerType::GetDIType | ( | llvm::DIDescriptor | scope | ) | const [virtual] |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 1163 of file type.cpp.
References Assert, baseType, Module::diBuilder, Module::errorCount, FATAL, g, GetAsUniformType(), Type::GetDIType(), ArrayType::GetDIType(), Target::is32Bit, lCreateDIArray(), m, NULL, Variability::SOA, Variability::soaWidth, Globals::target, Variability::type, Variability::Uniform, variability, Variability::Varying, and Target::vectorWidth.
| std::string PointerType::GetString | ( | ) | const [virtual] |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 1036 of file type.cpp.
References Assert, baseType, Module::errorCount, Variability::GetString(), Type::GetString(), isConst, isFrozen, isSlice, m, NULL, and variability.
Referenced by BinaryExpr::TypeCheck().
| PointerType * PointerType::GetUniform | ( | const Type * | t | ) | [static] |
Helper method to return a uniform pointer to the given type.
Definition at line 876 of file type.cpp.
References PointerType(), and Variability::Uniform.
Referenced by FunctionEmitContext::AddElementOffset(), FunctionEmitContext::CallInst(), FunctionEmitContext::CurrentLanesReturned(), ForeachUniqueStmt::EmitCode(), FunctionEmitContext::GetElementPtrInst(), IndexExpr::GetLValue(), IndexExpr::GetLValueType(), ReferenceExpr::GetLValueType(), SymbolExpr::GetLValueType(), StructMemberExpr::GetLValueType(), VectorMemberExpr::GetLValueType(), AddressOfExpr::GetType(), NewExpr::GetType(), IndexExpr::GetValue(), MemberExpr::GetValue(), VectorMemberExpr::GetValue(), Declarator::InitFromType(), InitSymbol(), lDoTypeConv(), lEmitVaryingSelect(), lFinalSliceOffset(), lLLVMTypeToISPCType(), FunctionEmitContext::LoadInst(), FunctionEmitContext::maskedStore(), Type::MoreGeneralType(), and FunctionEmitContext::StoreInst().
| Variability PointerType::GetVariability | ( | ) | const [virtual] |
Returns the variability of the type.
Implements Type.
Definition at line 895 of file type.cpp.
References variability.
Referenced by FunctionEmitContext::AddElementOffset(), and lDeconstifyType().
| PointerType * PointerType::GetVarying | ( | const Type * | t | ) | [static] |
Helper method to return a varying pointer to the given type.
Definition at line 882 of file type.cpp.
References PointerType(), and Variability::Varying.
Referenced by FunctionEmitContext::GetElementPtrInst(), IndexExpr::GetLValueType(), StructMemberExpr::GetLValueType(), VectorMemberExpr::GetLValueType(), NewExpr::GetType(), VectorMemberExpr::GetValue(), lAddVaryingOffsetsIfNeeded(), lFinalSliceOffset(), and FunctionEmitContext::scatter().
| bool PointerType::IsBoolType | ( | ) | const [virtual] |
| bool PointerType::IsConstType | ( | ) | const [virtual] |
Returns true if this type is 'const'-qualified.
Implements Type.
Definition at line 925 of file type.cpp.
References isConst.
Referenced by FunctionEmitContext::AddElementOffset().
| bool PointerType::IsFloatType | ( | ) | const [virtual] |
| bool PointerType::IsFrozenSlice | ( | ) | const [inline] |
Definition at line 446 of file type.h.
References isFrozen.
Referenced by FunctionEmitContext::GetElementPtrInst(), and lCheckTypeEquality().
| bool PointerType::IsIntType | ( | ) | const [virtual] |
| bool PointerType::IsSlice | ( | ) | const [inline] |
Definition at line 445 of file type.h.
References isSlice.
Referenced by FunctionEmitContext::AddElementOffset(), FunctionEmitContext::gather(), FunctionEmitContext::GetElementPtrInst(), TypeCastExpr::GetValue(), lAddVaryingOffsetsIfNeeded(), lCheckTypeEquality(), lConvertPtrToSliceIfNeeded(), lEmitBinaryPointerArith(), FunctionEmitContext::LoadInst(), FunctionEmitContext::maskedStore(), FunctionEmitContext::scatter(), and FunctionEmitContext::StoreInst().
| bool PointerType::IsUnsignedType | ( | ) | const [virtual] |
| bool PointerType::IsVoidPointer | ( | const Type * | t | ) | [static] |
Returns true if the given type is a void * type.
Definition at line 888 of file type.cpp.
References Type::EqualIgnoringConst(), Type::GetAsUniformType(), and Void.
Referenced by TypeCastExpr::GetValue(), lDoTypeConv(), Type::MoreGeneralType(), UnaryExpr::TypeCheck(), BinaryExpr::TypeCheck(), and AssignExpr::TypeCheck().
| llvm::Type * PointerType::LLVMType | ( | llvm::LLVMContext * | ctx | ) | const [virtual] |
Returns the LLVM type corresponding to this ispc type
Implements Type.
Definition at line 1102 of file type.cpp.
References Assert, baseType, Globals::ctx, Module::errorCount, FATAL, g, GetAsNonSlice(), GetAsUniformType(), LLVMTypes::Int32Type, LLVMTypes::Int32VectorType, isSlice, FunctionType::LLVMFunctionType(), Type::LLVMType(), LLVMType(), ArrayType::LLVMType(), m, NULL, Variability::SOA, Variability::soaWidth, Variability::type, Variability::Uniform, variability, Variability::Varying, LLVMTypes::VoidPointerType, and LLVMTypes::VoidPointerVectorType.
Referenced by lConvertToSlicePointer(), lEmitVaryingSelect(), and LLVMType().
| std::string PointerType::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 1055 of file type.cpp.
References Assert, baseType, Module::errorCount, isFrozen, isSlice, m, Type::Mangle(), Variability::MangleString(), NULL, Variability::Unbound, and variability.
| const PointerType * PointerType::ResolveUnboundVariability | ( | Variability | v | ) | const [virtual] |
Implements Type.
Definition at line 1001 of file type.cpp.
References Assert, baseType, Module::errorCount, isConst, isFrozen, isSlice, m, NULL, PointerType(), Type::ResolveUnboundVariability(), Variability::Unbound, Variability::Uniform, and variability.
const Type* PointerType::baseType [private] |
Definition at line 474 of file type.h.
Referenced by GetAsConstType(), GetAsFrozenSlice(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetBaseType(), GetCDeclaration(), GetDIType(), GetString(), LLVMType(), Mangle(), PointerType(), and ResolveUnboundVariability().
const bool PointerType::isConst [private] |
Definition at line 472 of file type.h.
Referenced by GetAsConstType(), GetAsFrozenSlice(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetString(), IsConstType(), and ResolveUnboundVariability().
const bool PointerType::isFrozen [private] |
Definition at line 473 of file type.h.
Referenced by GetAsFrozenSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetString(), IsFrozenSlice(), Mangle(), and ResolveUnboundVariability().
const bool PointerType::isSlice [private] |
Definition at line 473 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetString(), IsSlice(), LLVMType(), Mangle(), and ResolveUnboundVariability().
const Variability PointerType::variability [private] |
Definition at line 471 of file type.h.
Referenced by GetAsConstType(), GetAsFrozenSlice(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetDIType(), GetString(), GetVariability(), LLVMType(), Mangle(), and ResolveUnboundVariability().
PointerType * PointerType::Void [static] |
new PointerType(AtomicType::Void, Variability(Variability::Uniform), false)
Definition at line 468 of file type.h.
Referenced by NullPointerExpr::GetType(), IsVoidPointer(), and lDoTypeConv().
1.7.5.1