Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Interface class that defines the type abstraction. More...
#include <type.h>
Public Member Functions | |
virtual bool | IsBoolType () const =0 |
virtual bool | IsFloatType () const =0 |
virtual bool | IsIntType () const =0 |
virtual bool | IsUnsignedType () const =0 |
bool | IsPointerType () const |
bool | IsArrayType () const |
bool | IsReferenceType () const |
bool | IsVoidType () const |
virtual bool | IsConstType () const =0 |
bool | IsNumericType () const |
virtual Variability | GetVariability () const =0 |
bool | IsUniformType () const |
bool | IsVaryingType () const |
bool | IsSOAType () const |
int | GetSOAWidth () const |
bool | HasUnboundVariability () const |
virtual const Type * | ResolveUnboundVariability (Variability v) const =0 |
virtual const Type * | GetAsUniformType () const =0 |
virtual const Type * | GetAsVaryingType () const =0 |
virtual const Type * | GetAsUnboundVariabilityType () const =0 |
virtual const Type * | GetAsSOAType (int width) const =0 |
virtual const Type * | GetAsUnsignedType () const |
virtual const Type * | GetBaseType () const =0 |
virtual const Type * | GetReferenceTarget () const |
virtual const Type * | GetAsConstType () const =0 |
virtual const Type * | GetAsNonConstType () const =0 |
virtual std::string | GetString () const =0 |
virtual std::string | Mangle () const =0 |
virtual std::string | GetCDeclaration (const std::string &name) const =0 |
virtual llvm::Type * | LLVMType (llvm::LLVMContext *ctx) const =0 |
virtual llvm::Type * | LLVMStorageType (llvm::LLVMContext *ctx) const |
virtual llvm::DIType * | GetDIType (llvm::DIScope *scope) const =0 |
Static Public Member Functions | |
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) |
Public Attributes | |
const TypeId | typeId |
Protected Member Functions | |
Type (TypeId id) | |
Interface class that defines the type abstraction.
Abstract base class that defines the interface that must be implemented for all types in the language.
Checks two types for equality. Returns true if they are exactly the same, false otherwise.
Definition at line 2853 of file type.cpp.
References lCheckTypeEquality().
Referenced by Module::AddFunctionDeclaration(), Module::AddGlobalVariable(), FunctionSymbolExpr::computeOverloadCost(), ConstExpr::ConstExpr(), ForeachActiveStmt::EmitCode(), FunctionSymbolExpr::GetConstant(), StructMemberExpr::GetType(), SelectExpr::GetValue(), InitSymbol(), lAddTypeIfNew(), lCreateISPCSymbol(), lDoTypeConv(), lEncodeType(), lGetConstExprConstant(), SymbolTable::LookupFunction(), lProcessPrintArg(), MoreGeneralType(), DeclStmt::Optimize(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
Checks two types for equality. Returns true if they are exactly the same (ignoring const-ness of the type), false otherwise.
Definition at line 2855 of file type.cpp.
References lCheckTypeEquality().
Referenced by FunctionSymbolExpr::computeOverloadCost(), TypeCastExpr::GetValue(), PointerType::IsVoidPointer(), IsVoidType(), lCanImproveVectorDivide(), lDoTypeConv(), lEmitBinaryArith(), lEmitBinaryPointerArith(), lEmitStructDecl(), MoreGeneralType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), FunctionEmitContext::storeUniformToSOA(), IndexExpr::TypeCheck(), and SwitchStmt::TypeCheck().
|
pure virtual |
Get a const version of this type. If it's already const, then the old Type pointer is returned.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by ConstExpr::ConstExpr(), ArrayType::GetAsConstType(), ReferenceType::GetAsConstType(), StructType::GetElementType(), lApplyTypeQualifiers(), lDoTypeConv(), and SwitchStmt::TypeCheck().
|
pure virtual |
Get a non-const version of this type. If it's already not const, then the old Type pointer is returned.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by FunctionSymbolExpr::computeOverloadCost(), emitOffloadParamStruct(), ArrayType::GetAsNonConstType(), ReferenceType::GetAsNonConstType(), ReferenceType::GetCDeclaration(), SelectExpr::GetValue(), lAddTypeIfNew(), lDeconstifyType(), lDoTypeConv(), lEmitStructDecl(), lGetConstExprConstant(), lProcessPrintArg(), MoreGeneralType(), BinaryExpr::Optimize(), SelectExpr::Optimize(), and Module::writeDevStub().
|
pure virtual |
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by ArrayType::GetAsSOAType().
|
pure virtual |
Get an instance of the type with unbound variability.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by ArrayType::GetAsUnboundVariabilityType(), ReferenceType::GetAsUnboundVariabilityType(), lApplyTypeQualifiers(), and lDeclareSizeAndPtrIntTypes().
|
pure virtual |
Return a "uniform" instance of this type. If the type is already uniform, its "this" pointer will be returned.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by FunctionEmitContext::addVaryingOffsetsIfNeeded(), ArrayType::GetAsUniformType(), ReferenceType::GetAsUniformType(), ArrayType::GetCDeclaration(), TypeCastExpr::GetConstant(), IndexExpr::GetType(), StructMemberExpr::GetType(), VectorMemberExpr::GetType(), NewExpr::GetValue(), InitSymbol(), PointerType::IsVoidPointer(), lAddVaryingOffsetsIfNeeded(), lApplyTypeQualifiers(), lDoTypeConv(), lFinalSliceOffset(), lGetExprListConstant(), FunctionEmitContext::loadUniformFromSOA(), lProcessPrintArg(), FunctionEmitContext::storeUniformToSOA(), IndexExpr::TypeCheck(), SwitchStmt::TypeCheck(), and TypeCastExpr::TypeCheck().
|
virtual |
If this is a signed integer type, return the unsigned version of the type. Otherwise, return the original type.
Reimplemented in VectorType, ArrayType, and AtomicType.
Definition at line 2569 of file type.cpp.
Referenced by ArrayType::GetAsUnsignedType(), lApplyTypeQualifiers(), and lDeclareSizeAndPtrIntTypes().
|
pure virtual |
Return a "varying" instance of this type. If the type is already varying, its "this" pointer will be returned.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by FunctionSymbolExpr::computeOverloadCost(), FunctionEmitContext::gather(), ArrayType::GetAsVaryingType(), ReferenceType::GetAsVaryingType(), BinaryExpr::GetType(), IndexExpr::GetType(), PtrDerefExpr::GetType(), StructMemberExpr::GetType(), VectorMemberExpr::GetType(), TypeCastExpr::GetValue(), lApplyTypeQualifiers(), lUniformValueToVarying(), lVaryingStructHasUniformMember(), MoreGeneralType(), FunctionEmitContext::scatter(), BinaryExpr::TypeCheck(), AssignExpr::TypeCheck(), and NewExpr::TypeCheck().
|
pure 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.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by FunctionEmitContext::addVaryingOffsetsIfNeeded(), FunctionEmitContext::AllocaInst(), FunctionEmitContext::applyVaryingGEP(), FunctionCallExpr::EstimateCost(), ReferenceType::GetBaseType(), IndexExpr::GetLValueType(), VectorMemberExpr::GetLValueType(), PtrDerefExpr::GetType(), StructMemberExpr::GetType(), SelectExpr::GetValue(), TypeCastExpr::GetValue(), lCheckExportedParameterTypes(), lCheckTypeEquality(), lDoTypeConv(), lFinalSliceOffset(), lGetExportedTypes(), lGetFunctionType(), lLLVMConstantValue(), FunctionEmitContext::LoadInst(), FunctionEmitContext::maskedStore(), PossiblyResolveFunctionOverloads(), and FunctionCallExpr::TypeCheck().
|
pure virtual |
Returns a string that is the declaration of the same type in C syntax.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by emitOffloadParamStruct(), PointerType::GetCDeclaration(), ArrayType::GetCDeclaration(), ReferenceType::GetCDeclaration(), FunctionType::GetCDeclaration(), FunctionType::GetCDeclarationForDispatch(), lEmitStructDecl(), lEmitVectorTypedefs(), and Module::writeDevStub().
|
pure virtual |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by Module::AddGlobalVariable(), FunctionEmitContext::EmitFunctionParameterDebugInfo(), FunctionEmitContext::EmitVariableDebugInfo(), PointerType::GetDIType(), ArrayType::GetDIType(), StructType::GetDIType(), ReferenceType::GetDIType(), FunctionType::GetDIType(), lDefineConstantInt(), and lDefineProgramIndex().
|
virtual |
If this is a reference type, returns the type it is referring to. For all other types, just returns its own type.
Reimplemented in ReferenceType.
Definition at line 2564 of file type.cpp.
Referenced by FunctionEmitContext::AddElementOffset(), FunctionSymbolExpr::computeOverloadCost(), MemberExpr::create(), FunctionEmitContext::GetElementPtrInst(), IndexExpr::GetLValue(), IndexExpr::GetLValueType(), SymbolExpr::GetLValueType(), VectorMemberExpr::GetLValueType(), IndexExpr::GetType(), RefDerefExpr::GetType(), AddressOfExpr::GetType(), TypeCastExpr::GetValue(), VectorMemberExpr::GetValue(), lCheckAllOffSafety(), lCheckTypeEquality(), lDoTypeConv(), lEmitPrePostIncDec(), lGetExportedTypes(), FunctionEmitContext::LoadInst(), MoreGeneralType(), FunctionEmitContext::StoreInst(), SelectExpr::TypeCheck(), IndexExpr::TypeCheck(), and VectorMemberExpr::VectorMemberExpr().
|
inline |
Returns the structure of arrays width for SOA types. This method returns zero for types with non-SOA variability.
Definition at line 145 of file type.h.
Referenced by EnumType::GetAsSOAType(), PointerType::GetAsSOAType(), StructType::GetAsSOAType(), ArrayType::GetCDeclaration(), FunctionEmitContext::GetElementPtrInst(), GetStructTypesNamesPositions(), InitSymbol(), lCheckIndicesVersusBounds(), lConvertPointerConstant(), lDoTypeConv(), lEmitBinaryPointerArith(), lEmitStructDecl(), and BinaryExpr::TypeCheck().
|
pure virtual |
Returns a text representation of the type (for example, for use in warning and error messages).
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by StructType::checkIfCanBeSOA(), MemberExpr::create(), FunctionEmitContext::CurrentLanesReturned(), ReturnStmt::EmitCode(), emitOffloadParamStruct(), DeclSpecs::GetBaseType(), FunctionType::GetCDeclaration(), FunctionType::GetCDeclarationForDispatch(), FunctionSymbolExpr::GetConstant(), FunctionType::GetReturnTypeString(), PointerType::GetString(), ArrayType::GetString(), ReferenceType::GetString(), FunctionCallExpr::GetValue(), Declarator::InitFromDeclSpecs(), Declarator::InitFromType(), InitSymbol(), lApplyTypeQualifiers(), lCheckForConstStructMember(), lCreateBinaryOperatorCall(), lDoTypeConv(), lGetConstExprConstant(), lGetExprListConstant(), FunctionEmitContext::LoadInst(), lProcessPrintArg(), lVaryingStructHasUniformMember(), lVectorConvert(), MoreGeneralType(), DeclSpecs::Print(), SymbolTable::Print(), ForeachActiveStmt::Print(), ForeachUniqueStmt::Print(), SizeOfExpr::Print(), NewExpr::Print(), FunctionEmitContext::StoreInst(), UnaryExpr::TypeCheck(), BinaryExpr::TypeCheck(), AssignExpr::TypeCheck(), FunctionCallExpr::TypeCheck(), ForeachUniqueStmt::TypeCheck(), IndexExpr::TypeCheck(), TypeCastExpr::TypeCheck(), DeleteStmt::TypeCheck(), PtrDerefExpr::TypeCheck(), SizeOfExpr::TypeCheck(), NewExpr::TypeCheck(), TypeConvertExpr(), and Module::writeDevStub().
|
pure virtual |
Returns the variability of the type.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by ArrayType::GetVariability(), ReferenceType::GetVariability(), InitSymbol(), lCheckTypeEquality(), and lDoTypeConv().
|
inline |
Returns true if the underlying type's uniform/varying-ness is unbound.
Definition at line 149 of file type.h.
References Variability::GetString(), Variability::type, and Variability::Unbound.
Referenced by StructType::checkIfCanBeSOA(), EnumType::GetAsUnboundVariabilityType(), StructType::GetAsUnboundVariabilityType(), ReferenceType::GetAsUnboundVariabilityType(), TypeCastExpr::GetLValueType(), TypeCastExpr::GetType(), and TypeCastExpr::TypeCheck().
bool Type::IsArrayType | ( | ) | const |
Returns true if the underlying type is a array type
Definition at line 163 of file type.cpp.
Referenced by emitOffloadParamStruct(), lEmitStructDecl(), Module::writeDevStub(), and Module::writeHostStub().
|
static |
Returns true if the given type is an atomic, enum, or pointer type (i.e. not an aggregation of multiple instances of a type or types.)
Definition at line 2762 of file type.cpp.
Referenced by FunctionEmitContext::addVaryingOffsetsIfNeeded(), PointerType::GetCDeclaration(), InitSymbol(), lAddVaryingOffsetsIfNeeded(), lFinalSliceOffset(), lMatchingBoolType(), FunctionEmitContext::maskedStore(), FunctionEmitContext::scatter(), FunctionEmitContext::storeUniformToSOA(), and ForeachUniqueStmt::TypeCheck().
|
pure virtual |
Returns true if the underlying type is boolean. In other words, this is true for individual bools and for short-vectors with underlying bool type, but not for arrays of bools.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by FunctionEmitContext::AllocaInst(), TypeCastExpr::GetValue(), ReferenceType::IsBoolType(), lDoTypeConv(), FunctionEmitContext::LoadInst(), lUniformValueToVarying(), FunctionEmitContext::scatter(), FunctionEmitContext::StoreInst(), and BinaryExpr::TypeCheck().
|
pure virtual |
Returns true if this type is 'const'-qualified.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by Module::AddGlobalVariable(), FunctionSymbolExpr::computeOverloadCost(), DeclStmt::EmitCode(), emitOffloadParamStruct(), ArrayType::IsConstType(), ReferenceType::IsConstType(), lCheckForConstStructMember(), lCheckTypeEquality(), lDoTypeConv(), DeclStmt::Optimize(), UnaryExpr::TypeCheck(), AssignExpr::TypeCheck(), and Module::writeDevStub().
|
pure virtual |
Returns true if the underlying type is float or double. In other words, this is true for individual floats/doubles and for short-vectors of them, but not for arrays of them.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by ReferenceType::IsFloatType(), lEmitBinaryArith(), lEmitBinaryCmp(), lEmitNegate(), lEmitPrePostIncDec(), BinaryExpr::TypeCheck(), and AssignExpr::TypeCheck().
|
pure 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.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by ReferenceType::IsIntType(), lApplyTypeQualifiers(), lEmitNegate(), lIsAllIntZeros(), UnaryExpr::TypeCheck(), and BinaryExpr::TypeCheck().
|
inline |
Returns true if the underlying type is a float or integer type.
Definition at line 128 of file type.h.
Referenced by UnaryExpr::TypeCheck(), and BinaryExpr::TypeCheck().
bool Type::IsPointerType | ( | ) | const |
Returns true if the underlying type is either a pointer type
Definition at line 161 of file type.cpp.
Referenced by emitOffloadParamStruct(), FunctionCallExpr::GetLValueType(), lEmitStructDecl(), lGetVaryingDispatchType(), Module::writeDevStub(), and Module::writeHostStub().
bool Type::IsReferenceType | ( | ) | const |
Returns true if the underlying type is a array type
Definition at line 165 of file type.cpp.
Referenced by emitOffloadParamStruct(), FunctionCallExpr::GetLValueType(), lMatchingBoolType(), and Module::writeDevStub().
|
inline |
Returns true if the type is laid out in "structure of arrays" layout.
Definition at line 141 of file type.h.
References Variability::SOA.
Referenced by VectorType::GetDIType(), IndexExpr::GetLValueType(), IndexExpr::GetType(), StructMemberExpr::GetType(), VectorType::getVectorMemoryCount(), Declarator::InitFromType(), InitSymbol(), lConvertPointerConstant(), lConvertPtrToSliceIfNeeded(), lGetVectorLLVMType(), and UnaryExpr::TypeCheck().
|
inline |
Returns true if the underlying type is uniform
Definition at line 134 of file type.h.
References Variability::Uniform.
Referenced by FunctionEmitContext::AddElementOffset(), Module::AddFunctionDeclaration(), StructType::checkIfCanBeSOA(), FunctionSymbolExpr::computeOverloadCost(), ConstExpr::ConstExpr(), FunctionEmitContext::CurrentLanesReturned(), DeclSpecs::DeclSpecs(), DeclStmt::EmitCode(), IfStmt::EmitCode(), DoStmt::EmitCode(), ForStmt::EmitCode(), ReturnStmt::EmitCode(), SwitchStmt::EmitCode(), AssertStmt::EmitCode(), DeleteStmt::EmitCode(), IfStmt::EstimateCost(), DoStmt::EstimateCost(), ForStmt::EstimateCost(), FunctionCallExpr::EstimateCost(), FunctionEmitContext::gather(), EnumType::GetAsUniformType(), StructType::GetAsUniformType(), ReferenceType::GetAsUniformType(), DeclSpecs::GetBaseType(), VectorType::GetDIType(), FunctionEmitContext::GetElementPtrInst(), IndexExpr::GetLValueType(), StructMemberExpr::GetLValueType(), VectorMemberExpr::GetLValueType(), GetStructTypesNamesPositions(), IndexExpr::GetType(), PtrDerefExpr::GetType(), StructMemberExpr::GetType(), VectorMemberExpr::GetType(), SelectExpr::GetValue(), TypeCastExpr::GetValue(), VectorMemberExpr::GetValue(), VectorType::getVectorMemoryCount(), lAddVaryingOffsetsIfNeeded(), lCheckAllOffSafety(), lCheckTypeEquality(), lConstFoldBinaryLogicalOp(), lConvertPointerConstant(), lDoTypeConv(), lEmitBinaryPointerArith(), lEmitLogicalOp(), lEmitPrePostIncDec(), lEmitVectorTypedefs(), lEncodeType(), lFinalSliceOffset(), lGetConstExprConstant(), lGetExprListConstant(), lGetVectorLLVMType(), lIsDifficultShiftAmount(), lIsMatchWithTypeWidening(), lLLVMConstantValue(), lMatchingBoolType(), FunctionEmitContext::LoadInst(), lProcessPrintArg(), lTypeConvAtomic(), lUniformValueToVarying(), lVaryingStructHasUniformMember(), FunctionEmitContext::maskedStore(), FunctionEmitContext::scatter(), FunctionEmitContext::StoreInst(), IfStmt::TypeCheck(), DoStmt::TypeCheck(), BinaryExpr::TypeCheck(), ForStmt::TypeCheck(), FunctionCallExpr::TypeCheck(), IndexExpr::TypeCheck(), SwitchStmt::TypeCheck(), TypeCastExpr::TypeCheck(), and AssertStmt::TypeCheck().
|
pure virtual |
Returns true if the underlying type is unsigned. In other words, this is true for unsigned integers and short vectors of unsigned integer types.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by BinaryExpr::GetValue(), ReferenceType::IsUnsignedType(), lEmitBinaryArith(), lEmitBinaryCmp(), and lEmitOpAssign().
|
inline |
Returns true if the underlying type is varying
Definition at line 137 of file type.h.
References Variability::Varying.
Referenced by FunctionEmitContext::addVaryingOffsetsIfNeeded(), FunctionSymbolExpr::computeOverloadCost(), ConstExpr::Count(), DeclSpecs::DeclSpecs(), IndexExpr::EstimateCost(), MemberExpr::EstimateCost(), SwitchStmt::EstimateCost(), PtrDerefExpr::EstimateCost(), FunctionEmitContext::gather(), EnumType::GetAsVaryingType(), StructType::GetAsVaryingType(), ReferenceType::GetAsVaryingType(), DeclSpecs::GetBaseType(), PointerType::GetCDeclaration(), ArrayType::GetCDeclaration(), FunctionType::GetCDeclarationForDispatch(), SizeOfExpr::GetConstant(), VectorType::GetDIType(), FunctionEmitContext::GetElementPtrInst(), IndexExpr::GetLValueType(), GetStructTypesNamesPositions(), BinaryExpr::GetType(), SelectExpr::GetType(), StructMemberExpr::GetType(), VectorMemberExpr::GetType(), FunctionCallExpr::GetValue(), IndexExpr::GetValue(), ConstExpr::GetValue(), TypeCastExpr::GetValue(), VectorType::getVectorMemoryCount(), InitSymbol(), lAddVaryingOffsetsIfNeeded(), lContainsPtrToVarying(), lConvertPointerConstant(), lDoTypeConv(), lEmitBinaryArith(), lEmitBinaryCmp(), lEmitBinaryPointerArith(), lEmitLogicalOp(), lEmitStructDecl(), lGetConstExprConstant(), lGetExprListConstant(), lGetVaryingDispatchType(), lGetVectorLLVMType(), lIsDifficultShiftAmount(), lIsVaryingFor(), FunctionEmitContext::LoadInst(), lRecursiveCheckValidParamType(), lTypeConvAtomic(), lUniformValueToVarying(), lVaryingStructHasUniformMember(), FunctionEmitContext::maskedStore(), MoreGeneralType(), SelectExpr::Optimize(), TypeCastExpr::Optimize(), FunctionEmitContext::scatter(), FunctionEmitContext::StoreInst(), BinaryExpr::TypeCheck(), AssignExpr::TypeCheck(), SelectExpr::TypeCheck(), FunctionCallExpr::TypeCheck(), ForeachUniqueStmt::TypeCheck(), and NewExpr::TypeCheck().
bool Type::IsVoidType | ( | ) | const |
Returns true if the underlying type is either a pointer or an array
Definition at line 167 of file type.cpp.
References EqualIgnoringConst().
Referenced by Module::AddFunctionDeclaration(), Module::AddGlobalVariable(), ArrayType::ArrayType(), FunctionEmitContext::CurrentLanesReturned(), Function::emitCode(), FunctionEmitContext::FunctionEmitContext(), GetStructTypesNamesPositions(), FunctionCallExpr::GetValue(), TypeCastExpr::GetValue(), Declaration::GetVariableDeclarations(), Declarator::InitFromType(), lApplyTypeQualifiers(), lDoTypeConv(), FunctionType::LLVMFunctionType(), PointerType::LLVMType(), FunctionCallExpr::TypeCheck(), TypeCastExpr::TypeCheck(), Module::writeDevStub(), and Module::writeHostStub().
|
virtual |
Returns the LLVM storage type corresponding to this ispc type.
Reimplemented in VectorType, and AtomicType.
Definition at line 125 of file type.cpp.
References AtomicType::TYPE_BOOL, AtomicType::TYPE_DOUBLE, AtomicType::TYPE_FLOAT, AtomicType::TYPE_INT16, AtomicType::TYPE_INT32, AtomicType::TYPE_INT64, AtomicType::TYPE_INT8, AtomicType::TYPE_UINT16, AtomicType::TYPE_UINT32, AtomicType::TYPE_UINT64, AtomicType::TYPE_UINT8, Variability::Uniform, AtomicType::UniformBool, AtomicType::UniformDouble, AtomicType::UniformFloat, AtomicType::UniformInt16, AtomicType::UniformInt32, AtomicType::UniformInt64, AtomicType::UniformInt8, AtomicType::UniformUInt16, AtomicType::UniformUInt32, AtomicType::UniformUInt64, AtomicType::UniformUInt8, Variability::Varying, AtomicType::VaryingBool, AtomicType::VaryingDouble, AtomicType::VaryingFloat, AtomicType::VaryingInt16, AtomicType::VaryingInt32, AtomicType::VaryingInt64, AtomicType::VaryingInt8, AtomicType::VaryingUInt16, AtomicType::VaryingUInt32, AtomicType::VaryingUInt64, AtomicType::VaryingUInt8, and AtomicType::Void.
Referenced by Module::AddGlobalVariable(), FunctionEmitContext::AllocaInst(), StructType::GetDIType(), TypeCastExpr::GetValue(), InitSymbol(), lEmitVaryingSelect(), lGetVectorLLVMType(), PointerType::LLVMType(), ArrayType::LLVMType(), ReferenceType::LLVMType(), lUniformValueToVarying(), FunctionEmitContext::StoreInst(), and StructType::StructType().
|
pure virtual |
Returns the LLVM type corresponding to this ispc type.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by FunctionEmitContext::AddElementOffset(), FunctionEmitContext::addVaryingOffsetsIfNeeded(), FunctionEmitContext::AllocaInst(), FunctionEmitContext::applyVaryingGEP(), FunctionEmitContext::CallInst(), DeclStmt::EmitCode(), ForeachUniqueStmt::EmitCode(), FunctionEmitContext::gather(), TypeCastExpr::GetConstant(), AddressOfExpr::GetConstant(), SizeOfExpr::GetConstant(), NullPointerExpr::GetConstant(), SelectExpr::GetValue(), TypeCastExpr::GetValue(), ReferenceExpr::GetValue(), SizeOfExpr::GetValue(), NewExpr::GetValue(), lEmitBinaryPointerArith(), lEmitNegate(), lEmitStructDecl(), lGetConstExprConstant(), lGetExprListConstant(), lGetVectorLLVMType(), FunctionType::LLVMFunctionType(), FunctionEmitContext::LoadInst(), and FunctionEmitContext::loadUniformFromSOA().
|
pure 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.
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by PointerType::Mangle(), ArrayType::Mangle(), and ReferenceType::Mangle().
|
static |
Given two types, returns the least general Type that is more general than both of them. (i.e. that can represent their values without any loss of data.) If there is no such Type, return NULL.
type0 | First of the two types |
type1 | Second of the two types |
pos | Source file position where the general type is needed. |
reason | String describing the context of why the general type is needed (e.g. "+ operator"). |
forceVarying | If true , then make sure that the returned type is "varying". |
vecSize | The vector size of the returned type. If non-zero, the returned type will be a VectorType of the more general type with given length. If zero, this parameter has no effect. |
Definition at line 2602 of file type.cpp.
References Assert, Equal(), EqualIgnoringConst(), Error(), GetAsNonConstType(), GetAsVaryingType(), VectorType::GetElementCount(), VectorType::GetElementType(), GetReferenceTarget(), GetString(), PointerType::GetUniform(), IsVaryingType(), PointerType::IsVoidPointer(), lVectorConvert(), AtomicType::UniformUInt32, and AtomicType::VaryingUInt32.
Referenced by BinaryExpr::GetType(), SelectExpr::GetType(), lEmitLogicalOp(), BinaryExpr::TypeCheck(), and SelectExpr::TypeCheck().
|
pure virtual |
Implemented in FunctionType, ReferenceType, UndefinedStructType, StructType, VectorType, ArrayType, PointerType, EnumType, and AtomicType.
Referenced by StructType::GetElementType(), TypeCastExpr::GetType(), Declaration::GetVariableDeclarations(), Declarator::InitFromType(), lApplyTypeQualifiers(), NewExpr::NewExpr(), PointerType::ResolveUnboundVariability(), ArrayType::ResolveUnboundVariability(), ReferenceType::ResolveUnboundVariability(), FunctionType::ResolveUnboundVariability(), SizeOfExpr::SizeOfExpr(), and TypeCastExpr::TypeCheck().
const TypeId Type::typeId |
Indicates which Type implementation this type is. This value can be used to determine the actual type much more efficiently than using dynamic_cast.
Definition at line 256 of file type.h.
Referenced by CastType().