Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.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::DIScope *scope) 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 * | GetAsUnsignedType () const |
virtual const Type * | GetReferenceTarget () const |
virtual llvm::Type * | LLVMStorageType (llvm::LLVMContext *ctx) const |
Static Public Member Functions | |
static PointerType * | GetUniform (const Type *t, bool isSlice=false) |
static PointerType * | GetVarying (const Type *t) |
static bool | IsVoidPointer (const Type *t) |
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) |
Static Public Attributes | |
static PointerType * | Void = new PointerType(AtomicType::Void, Variability(Variability::Uniform), false) |
Private Attributes | |
const Variability | variability |
const bool | isConst |
const bool | isSlice |
const bool | isFrozen |
const Type * | baseType |
Additional Inherited Members | |
Public Attributes inherited from Type | |
const TypeId | typeId |
Protected Member Functions inherited from Type | |
Type (TypeId id) | |
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 794 of file type.cpp.
References baseType.
Referenced by GetAsConstType(), GetAsFrozenSlice(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetUniform(), GetVarying(), and ResolveUnboundVariability().
|
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 883 of file type.cpp.
References baseType, isConst, isSlice, PointerType(), and variability.
const PointerType * PointerType::GetAsFrozenSlice | ( | ) | const |
Definition at line 865 of file type.cpp.
References baseType, isConst, isFrozen, PointerType(), and variability.
Referenced by StructMemberExpr::GetLValueType(), and VectorMemberExpr::GetLValueType().
|
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 890 of file type.cpp.
References baseType, isConst, isSlice, PointerType(), and variability.
const PointerType * PointerType::GetAsNonSlice | ( | ) | const |
Definition at line 859 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 853 of file type.cpp.
References baseType, isConst, isSlice, PointerType(), and variability.
Referenced by IndexExpr::GetLValueType(), lConvertPtrToSliceIfNeeded(), and FunctionEmitContext::scatter().
|
virtual |
Implements Type.
Definition at line 846 of file type.cpp.
References baseType, Type::GetSOAWidth(), isConst, isFrozen, isSlice, PointerType(), and Variability::SOA.
|
virtual |
Get an instance of the type with unbound variability.
Implements Type.
Definition at line 839 of file type.cpp.
References baseType, isConst, isFrozen, isSlice, PointerType(), Variability::Unbound, and variability.
|
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 832 of file type.cpp.
References baseType, isConst, isFrozen, isSlice, PointerType(), Variability::Uniform, and variability.
Referenced by GetDIType(), and LLVMType().
|
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 825 of file type.cpp.
References baseType, isConst, isFrozen, isSlice, PointerType(), variability, and Variability::Varying.
|
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 823 of file type.cpp.
References baseType.
Referenced by FunctionEmitContext::AddElementOffset(), MemberExpr::create(), FunctionEmitContext::gather(), FunctionType::GetCDeclaration(), FunctionType::GetCDeclarationForDispatch(), FunctionEmitContext::GetElementPtrInst(), IndexExpr::GetLValueType(), StructMemberExpr::getStructType(), IndexExpr::GetType(), lAddVaryingOffsetsIfNeeded(), lCheckAllOffSafety(), lCheckTypeEquality(), lConvertPtrToSliceIfNeeded(), lDeconstifyType(), lEmitBinaryPointerArith(), FunctionEmitContext::LoadInst(), FunctionEmitContext::loadUniformFromSOA(), lVaryingStructHasUniformMember(), FunctionEmitContext::scatter(), FunctionEmitContext::StoreInst(), FunctionEmitContext::storeUniformToSOA(), UnaryExpr::TypeCheck(), BinaryExpr::TypeCheck(), FunctionCallExpr::TypeCheck(), and VectorMemberExpr::VectorMemberExpr().
|
virtual |
Returns a string that is the declaration of the same type in C syntax.
Implements Type.
Definition at line 936 of file type.cpp.
References Assert, baseType, Module::errorCount, g, Type::GetCDeclaration(), Target::getVectorWidth(), Type::IsBasicType(), isConst, isSlice, Type::IsVaryingType(), m, Variability::SOA, Variability::soaWidth, Globals::target, Variability::Unbound, and variability.
Referenced by FunctionType::GetCDeclarationForDispatch().
|
virtual |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 1040 of file type.cpp.
References Assert, baseType, Module::diBuilder, Module::errorCount, FATAL, g, GetAsUniformType(), Type::GetDIType(), ArrayType::GetDIType(), Target::getVectorWidth(), Target::is32Bit(), lCreateDIArray(), m, Variability::SOA, Variability::soaWidth, Globals::target, Variability::type, Variability::Uniform, variability, and Variability::Varying.
|
virtual |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 897 of file type.cpp.
References Assert, baseType, Module::errorCount, Variability::GetString(), Type::GetString(), isConst, isFrozen, isSlice, m, and variability.
Referenced by FunctionType::GetCDeclarationForDispatch(), and BinaryExpr::TypeCheck().
|
static |
Helper method to return a uniform pointer to the given type.
Definition at line 799 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(), AddressOfExpr::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(), FunctionEmitContext::StoreInst(), and SelectExpr::TypeCheck().
|
virtual |
Returns the variability of the type.
Implements Type.
Definition at line 811 of file type.cpp.
References variability.
Referenced by FunctionEmitContext::AddElementOffset(), and lDeconstifyType().
|
static |
Helper method to return a varying pointer to the given type.
Definition at line 803 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().
|
virtual |
|
virtual |
Returns true if this type is 'const'-qualified.
Implements Type.
Definition at line 821 of file type.cpp.
References isConst.
Referenced by FunctionEmitContext::AddElementOffset().
|
virtual |
|
inline |
Definition at line 440 of file type.h.
References Variability::GetString().
Referenced by FunctionEmitContext::GetElementPtrInst(), and lCheckTypeEquality().
|
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 817 of file type.cpp.
Referenced by TypeCastExpr::TypeCheck().
|
inline |
Definition at line 439 of file type.h.
Referenced by FunctionEmitContext::AddElementOffset(), FunctionEmitContext::gather(), FunctionEmitContext::GetElementPtrInst(), TypeCastExpr::GetValue(), lAddVaryingOffsetsIfNeeded(), lCheckTypeEquality(), lConvertPtrToSliceIfNeeded(), lEmitBinaryPointerArith(), FunctionEmitContext::LoadInst(), FunctionEmitContext::maskedStore(), FunctionEmitContext::scatter(), and FunctionEmitContext::StoreInst().
|
virtual |
|
static |
Returns true if the given type is a void * type.
Definition at line 807 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().
|
virtual |
Returns the LLVM type corresponding to this ispc type.
Implements Type.
Definition at line 983 of file type.cpp.
References Assert, baseType, Globals::ctx, Module::errorCount, FATAL, g, GetAsNonSlice(), GetAsUniformType(), LLVMTypes::Int32Type, LLVMTypes::Int32VectorType, isSlice, Type::IsVoidType(), FunctionType::LLVMFunctionType(), Type::LLVMStorageType(), ArrayType::LLVMType(), m, Variability::SOA, Variability::soaWidth, Variability::type, Variability::Uniform, variability, Variability::Varying, LLVMTypes::VoidPointerType, and LLVMTypes::VoidPointerVectorType.
Referenced by lConvertToSlicePointer().
|
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 917 of file type.cpp.
References Assert, baseType, Module::errorCount, isFrozen, isSlice, m, Type::Mangle(), Variability::MangleString(), Variability::Unbound, and variability.
|
virtual |
Implements Type.
Definition at line 871 of file type.cpp.
References Assert, baseType, Module::errorCount, isConst, isFrozen, isSlice, m, PointerType(), Type::ResolveUnboundVariability(), Variability::Unbound, Variability::Uniform, and variability.
|
private |
Definition at line 469 of file type.h.
Referenced by GetAsConstType(), GetAsFrozenSlice(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetBaseType(), GetCDeclaration(), GetDIType(), GetString(), LLVMType(), Mangle(), PointerType(), and ResolveUnboundVariability().
|
private |
Definition at line 467 of file type.h.
Referenced by GetAsConstType(), GetAsFrozenSlice(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetString(), IsConstType(), and ResolveUnboundVariability().
|
private |
Definition at line 468 of file type.h.
Referenced by GetAsFrozenSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetString(), Mangle(), and ResolveUnboundVariability().
|
private |
Definition at line 468 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetString(), LLVMType(), Mangle(), and ResolveUnboundVariability().
|
private |
Definition at line 466 of file type.h.
Referenced by GetAsConstType(), GetAsFrozenSlice(), GetAsNonConstType(), GetAsNonSlice(), GetAsSlice(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetDIType(), GetString(), GetVariability(), LLVMType(), Mangle(), and ResolveUnboundVariability().
|
static |
Definition at line 463 of file type.h.
Referenced by FunctionType::GetCDeclarationForDispatch(), EnumType::GetEnumerator(), NullPointerExpr::GetType(), IsVoidPointer(), and lDoTypeConv().