Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
AtomicType represents basic types like floats, ints, etc. More...
#include <type.h>
Public Types | |
enum | BasicType { TYPE_VOID, TYPE_BOOL, TYPE_INT8, TYPE_UINT8, TYPE_INT16, TYPE_UINT16, TYPE_INT32, TYPE_UINT32, TYPE_FLOAT, TYPE_INT64, TYPE_UINT64, TYPE_DOUBLE, NUM_BASIC_TYPES } |
Public Member Functions | |
Variability | GetVariability () const |
bool | IsBoolType () const |
bool | IsFloatType () const |
bool | IsIntType () const |
bool | IsUnsignedType () const |
bool | IsConstType () const |
const AtomicType * | GetBaseType () const |
const AtomicType * | GetAsUniformType () const |
const AtomicType * | GetAsVaryingType () const |
const AtomicType * | GetAsUnboundVariabilityType () const |
const AtomicType * | GetAsSOAType (int width) const |
const AtomicType * | ResolveUnboundVariability (Variability v) const |
const AtomicType * | GetAsUnsignedType () const |
const AtomicType * | GetAsConstType () const |
const AtomicType * | GetAsNonConstType () const |
std::string | GetString () const |
std::string | Mangle () const |
std::string | GetCDeclaration (const std::string &name) const |
llvm::Type * | LLVMStorageType (llvm::LLVMContext *ctx) 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 * | GetReferenceTarget () const |
Public Attributes | |
const BasicType | basicType |
Public Attributes inherited from Type | |
const TypeId | typeId |
Private Member Functions | |
AtomicType (BasicType basicType, Variability v, bool isConst) | |
Private Attributes | |
const Variability | variability |
const bool | isConst |
const AtomicType * | asOtherConstType |
const AtomicType * | asUniformType |
const AtomicType * | asVaryingType |
Additional Inherited Members | |
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) |
Protected Member Functions inherited from Type | |
Type (TypeId id) | |
AtomicType represents basic types like floats, ints, etc.
AtomicTypes can be either uniform or varying. Unique instances of all of the possible AtomicType
s are available in the static members like AtomicType::UniformInt32. It is thus possible to compare AtomicTypes for equality with simple pointer equality tests; this is not true for the other Type implementations.
|
private |
Definition at line 153 of file type.cpp.
References asOtherConstType, asUniformType, and asVaryingType.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), 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 207 of file type.cpp.
References asOtherConstType, AtomicType(), basicType, isConst, and variability.
Referenced by ForeachActiveStmt::EmitCode(), and VectorType::GetAsConstType().
|
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 218 of file type.cpp.
References asOtherConstType, AtomicType(), basicType, isConst, and variability.
Referenced by VectorType::GetAsNonConstType().
|
virtual |
Implements Type.
Definition at line 288 of file type.cpp.
References Assert, AtomicType(), basicType, isConst, Variability::SOA, TYPE_VOID, and variability.
Referenced by VectorType::GetAsSOAType().
|
virtual |
Get an instance of the type with unbound variability.
Implements Type.
Definition at line 281 of file type.cpp.
References Assert, AtomicType(), basicType, isConst, TYPE_VOID, Variability::Unbound, and variability.
Referenced by VectorType::GetAsUnboundVariabilityType(), and DeclSpecs::GetBaseType().
|
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 244 of file type.cpp.
References Assert, asUniformType, asVaryingType, AtomicType(), basicType, FATAL, g, Target::getMaskBitCount(), isConst, Globals::target, TYPE_BOOL, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_VOID, Variability::Uniform, variability, and Variability::Varying.
Referenced by VectorType::GetAsUniformType(), GetDIType(), and lGetAtomicLLVMType().
|
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 185 of file type.cpp.
References AtomicType(), basicType, FATAL, isConst, IsIntType(), IsUnsignedType(), TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, and variability.
Referenced by VectorType::GetAsUnsignedType().
|
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 231 of file type.cpp.
References Assert, asUniformType, asVaryingType, AtomicType(), basicType, isConst, TYPE_VOID, Variability::Uniform, variability, and Variability::Varying.
Referenced by VectorType::GetAsVaryingType().
|
virtual |
For AtomicTypes, the base type is just the same as the AtomicType itself.
Implements Type.
|
virtual |
Returns a string that is the declaration of the same type in C syntax.
Implements Type.
Definition at line 403 of file type.cpp.
References Assert, basicType, Module::errorCount, FATAL, isConst, lShouldPrintName(), m, Variability::SOA, Variability::soaWidth, TYPE_BOOL, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, TYPE_VOID, Variability::Unbound, and variability.
Referenced by VectorType::GetCDeclaration().
|
virtual |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 512 of file type.cpp.
References Assert, basicType, Module::diBuilder, FATAL, g, GetAsUniformType(), GetDIType(), ArrayType::GetDIType(), Target::getVectorWidth(), m, Variability::SOA, Variability::soaWidth, Globals::target, Variability::type, TYPE_BOOL, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, TYPE_VOID, Variability::Unbound, Variability::Uniform, variability, and Variability::Varying.
Referenced by GetDIType(), EnumType::GetDIType(), and VectorType::GetDIType().
|
virtual |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 302 of file type.cpp.
References basicType, FATAL, Variability::GetString(), isConst, TYPE_BOOL, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, TYPE_VOID, and variability.
Referenced by Expr::GetBaseSymbol(), and VectorType::GetString().
|
virtual |
Returns the variability of the type.
Implements Type.
Definition at line 159 of file type.cpp.
References variability.
Referenced by VectorType::GetVariability(), lCheckTypeEquality(), and lGetAtomicLLVMType().
|
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.
Implements Type.
Definition at line 181 of file type.cpp.
References basicType, and TYPE_BOOL.
Referenced by TypeCastExpr::GetValue(), and VectorType::IsBoolType().
|
virtual |
Returns true if this type is 'const'-qualified.
Implements Type.
Definition at line 183 of file type.cpp.
References isConst.
Referenced by VectorType::IsConstType().
|
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.
Implements Type.
Definition at line 169 of file type.cpp.
References basicType, TYPE_DOUBLE, and TYPE_FLOAT.
Referenced by VectorType::IsFloatType().
|
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 171 of file type.cpp.
References basicType, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, and TYPE_UINT8.
Referenced by GetAsUnsignedType(), VectorType::IsIntType(), and TypeCastExpr::TypeCheck().
|
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.
Implements Type.
Definition at line 176 of file type.cpp.
References basicType, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, and TYPE_UINT8.
Referenced by GetAsUnsignedType(), and VectorType::IsUnsignedType().
|
virtual |
Returns the LLVM storage type corresponding to this ispc type.
Reimplemented from Type.
Definition at line 509 of file type.cpp.
References lGetAtomicLLVMType().
Referenced by TypeCastExpr::GetValue().
|
virtual |
Returns the LLVM type corresponding to this ispc type.
Implements Type.
Definition at line 510 of file type.cpp.
References lGetAtomicLLVMType().
|
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 354 of file type.cpp.
References basicType, FATAL, isConst, Variability::MangleString(), TYPE_BOOL, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT16, TYPE_INT32, TYPE_INT64, TYPE_INT8, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, TYPE_UINT8, TYPE_VOID, and variability.
Referenced by VectorType::Mangle().
|
virtual |
Implements Type.
Definition at line 295 of file type.cpp.
References Assert, AtomicType(), basicType, isConst, Variability::Unbound, and variability.
Referenced by VectorType::ResolveUnboundVariability().
|
mutableprivate |
Definition at line 340 of file type.h.
Referenced by AtomicType(), GetAsConstType(), and GetAsNonConstType().
|
mutableprivate |
Definition at line 340 of file type.h.
Referenced by AtomicType(), GetAsUniformType(), and GetAsVaryingType().
|
mutableprivate |
Definition at line 340 of file type.h.
Referenced by AtomicType(), GetAsUniformType(), and GetAsVaryingType().
const BasicType AtomicType::basicType |
Definition at line 320 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), Expr::GetBaseSymbol(), ConstExpr::getBasicType(), GetCDeclaration(), GetDIType(), GetString(), IsBoolType(), IsFloatType(), IsIntType(), IsUnsignedType(), lCheckTypeEquality(), lGetAtomicLLVMType(), lIsMatchWithTypeWidening(), lLLVMConstantValue(), lTypeConvAtomic(), Mangle(), TypeCastExpr::Optimize(), and ResolveUnboundVariability().
|
private |
Definition at line 337 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetCDeclaration(), GetString(), IsConstType(), Mangle(), and ResolveUnboundVariability().
|
static |
Definition at line 322 of file type.h.
Referenced by ConstExpr::ConstExpr(), SelectExpr::GetValue(), lConstFoldBinaryLogicalOp(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), lMatchingBoolType(), lProcessPrintArg(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), IfStmt::TypeCheck(), DoStmt::TypeCheck(), BinaryExpr::TypeCheck(), ForStmt::TypeCheck(), and AssertStmt::TypeCheck().
|
static |
Definition at line 332 of file type.h.
Referenced by ConstExpr::ConstExpr(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), and BinaryExpr::Optimize().
|
static |
Definition at line 329 of file type.h.
Referenced by ConstExpr::ConstExpr(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), and BinaryExpr::Optimize().
|
static |
Definition at line 324 of file type.h.
Referenced by ConstExpr::ConstExpr(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), lProcessPrintArg(), UnaryExpr::Optimize(), and BinaryExpr::Optimize().
|
static |
Definition at line 325 of file type.h.
Referenced by ConstExpr::ConstExpr(), DeclSpecs::GetBaseType(), BinaryExpr::GetType(), lArrayToPointer(), lDefineConstantInt(), lDefineConstantIntFunc(), lEmitPrePostIncDec(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), lProcessPrintArg(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), BinaryExpr::TypeCheck(), AssignExpr::TypeCheck(), ForeachStmt::TypeCheck(), FunctionCallExpr::TypeCheck(), IndexExpr::TypeCheck(), and SwitchStmt::TypeCheck().
|
static |
Definition at line 330 of file type.h.
Referenced by ConstExpr::ConstExpr(), ForeachActiveStmt::EmitCode(), BinaryExpr::GetType(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), BinaryExpr::TypeCheck(), AssignExpr::TypeCheck(), IndexExpr::TypeCheck(), and SwitchStmt::TypeCheck().
|
static |
Definition at line 323 of file type.h.
Referenced by ConstExpr::ConstExpr(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), lProcessPrintArg(), UnaryExpr::Optimize(), and BinaryExpr::Optimize().
|
static |
Definition at line 327 of file type.h.
Referenced by ConstExpr::ConstExpr(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), lProcessPrintArg(), UnaryExpr::Optimize(), and BinaryExpr::Optimize().
|
static |
Definition at line 328 of file type.h.
Referenced by ConstExpr::ConstExpr(), SizeOfExpr::GetType(), TypeCastExpr::GetValue(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), Type::MoreGeneralType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), and NewExpr::TypeCheck().
|
static |
Definition at line 331 of file type.h.
Referenced by ConstExpr::ConstExpr(), SizeOfExpr::GetType(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), IndexExpr::TypeCheck(), SwitchStmt::TypeCheck(), and NewExpr::TypeCheck().
|
static |
Definition at line 326 of file type.h.
Referenced by ConstExpr::ConstExpr(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), lProcessPrintArg(), UnaryExpr::Optimize(), and BinaryExpr::Optimize().
|
private |
Definition at line 336 of file type.h.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsUnsignedType(), GetAsVaryingType(), GetCDeclaration(), GetDIType(), GetString(), GetVariability(), lGetAtomicLLVMType(), Mangle(), and ResolveUnboundVariability().
|
static |
Definition at line 322 of file type.h.
Referenced by ConstExpr::ConstExpr(), SelectExpr::GetValue(), lConstFoldBinaryLogicalOp(), lCreateISPCSymbol(), lEmitLogicalOp(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), lMatchingBoolType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), SelectExpr::Optimize(), IfStmt::TypeCheck(), DoStmt::TypeCheck(), BinaryExpr::TypeCheck(), ForStmt::TypeCheck(), and AssertStmt::TypeCheck().
|
static |
Definition at line 332 of file type.h.
Referenced by ConstExpr::ConstExpr(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
|
static |
Definition at line 329 of file type.h.
Referenced by ConstExpr::ConstExpr(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
|
static |
Definition at line 324 of file type.h.
Referenced by ConstExpr::ConstExpr(), lCanImproveVectorDivide(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
|
static |
Definition at line 325 of file type.h.
Referenced by ConstExpr::ConstExpr(), lCanImproveVectorDivide(), lCreateISPCSymbol(), lDeclareSizeAndPtrIntTypes(), lDefineProgramIndex(), lEmitPrePostIncDec(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), lProcessPrintArg(), FunctionEmitContext::maskedStore(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), SelectExpr::Optimize(), IndexExpr::TypeCheck(), and SwitchStmt::TypeCheck().
|
static |
Definition at line 330 of file type.h.
Referenced by ConstExpr::ConstExpr(), lDeclareSizeAndPtrIntTypes(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), SelectExpr::Optimize(), and SwitchStmt::TypeCheck().
|
static |
Definition at line 323 of file type.h.
Referenced by ConstExpr::ConstExpr(), lCanImproveVectorDivide(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
|
static |
Definition at line 327 of file type.h.
Referenced by ConstExpr::ConstExpr(), lCanImproveVectorDivide(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
|
static |
Definition at line 328 of file type.h.
Referenced by ConstExpr::ConstExpr(), TypeCastExpr::GetValue(), lCanImproveVectorDivide(), lDeclareSizeAndPtrIntTypes(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), Type::MoreGeneralType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
|
static |
Definition at line 331 of file type.h.
Referenced by ConstExpr::ConstExpr(), lDeclareSizeAndPtrIntTypes(), lEncodeType(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
|
static |
Definition at line 326 of file type.h.
Referenced by ConstExpr::ConstExpr(), lCanImproveVectorDivide(), lGetConstExprConstant(), lLLVMTypeToISPCType(), Type::LLVMStorageType(), UnaryExpr::Optimize(), BinaryExpr::Optimize(), and SelectExpr::Optimize().
|
static |
Definition at line 333 of file type.h.
Referenced by SyncExpr::GetType(), lLLVMTypeToISPCType(), and Type::LLVMStorageType().