Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Type implementation for enumerated types. More...
#include <type.h>
Public Member Functions | |
EnumType (SourcePos pos) | |
EnumType (const char *name, SourcePos pos) | |
Variability | GetVariability () const |
bool | IsBoolType () const |
bool | IsFloatType () const |
bool | IsIntType () const |
bool | IsUnsignedType () const |
bool | IsConstType () const |
const EnumType * | GetBaseType () const |
const EnumType * | GetAsVaryingType () const |
const EnumType * | GetAsUniformType () const |
const EnumType * | GetAsUnboundVariabilityType () const |
const EnumType * | GetAsSOAType (int width) const |
const EnumType * | ResolveUnboundVariability (Variability v) const |
const EnumType * | GetAsConstType () const |
const EnumType * | GetAsNonConstType () const |
std::string | GetString () const |
std::string | Mangle () const |
std::string | GetCDeclaration (const std::string &name) const |
const std::string & | GetEnumName () const |
llvm::Type * | LLVMType (llvm::LLVMContext *ctx) const |
llvm::DIType * | GetDIType (llvm::DIScope *scope) const |
void | SetEnumerators (const std::vector< Symbol *> &enumerators) |
int | GetEnumeratorCount () const |
const Symbol * | GetEnumerator (int i) 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 |
Public Attributes | |
const SourcePos | pos |
Public Attributes inherited from Type | |
const TypeId | typeId |
Private Attributes | |
const std::string | name |
Variability | variability |
bool | isConst |
std::vector< Symbol * > | enumerators |
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) | |
Type implementation for enumerated types.
Note that ISPC enum assumes 32 bit int as underlying type.
EnumType::EnumType | ( | SourcePos | pos | ) |
Constructor for anonymous enumerated types
Definition at line 578 of file type.cpp.
References isConst, Variability::Unbound, and variability.
Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), and ResolveUnboundVariability().
EnumType::EnumType | ( | const char * | name, |
SourcePos | pos | ||
) |
Constructor for named enumerated types
Definition at line 584 of file type.cpp.
References isConst, Variability::Unbound, and variability.
|
virtual |
|
virtual |
|
virtual |
Implements Type.
Definition at line 643 of file type.cpp.
References EnumType(), Type::GetSOAWidth(), Variability::SOA, and variability.
|
virtual |
Get an instance of the type with unbound variability.
Implements Type.
Definition at line 633 of file type.cpp.
References EnumType(), Type::HasUnboundVariability(), 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 603 of file type.cpp.
References EnumType(), Type::IsUniformType(), Variability::Uniform, and variability.
|
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 623 of file type.cpp.
References EnumType(), Type::IsVaryingType(), variability, and Variability::Varying.
|
virtual |
|
virtual |
Returns a string that is the declaration of the same type in C syntax.
Implements Type.
Definition at line 697 of file type.cpp.
References Assert, Module::errorCount, g, Target::getVectorWidth(), isConst, lShouldPrintName(), m, name, Variability::SOA, Variability::soaWidth, Globals::target, Variability::Unbound, variability, and Variability::Varying.
|
virtual |
Returns the DIType (LLVM's debugging information structure), corresponding to this type.
Implements Type.
Definition at line 743 of file type.cpp.
References Assert, Module::diBuilder, enumerators, FATAL, SourcePos::first_line, g, SourcePos::GetDIFile(), AtomicType::GetDIType(), Target::getVectorWidth(), lCreateDIArray(), m, name, pos, Variability::SOA, Variability::soaWidth, Globals::target, Variability::type, Variability::Uniform, variability, and Variability::Varying.
const Symbol * EnumType::GetEnumerator | ( | int | i | ) | const |
Returns the symbol for the given enumerator number.
Definition at line 787 of file type.cpp.
References enumerators, Variability::Uniform, and PointerType::Void.
int EnumType::GetEnumeratorCount | ( | ) | const |
Returns the total number of enuemrators in this enum type.
Definition at line 785 of file type.cpp.
References enumerators.
|
inline |
|
virtual |
Returns a text representation of the type (for example, for use in warning and error messages).
Implements Type.
Definition at line 673 of file type.cpp.
References Variability::GetString(), isConst, name, and variability.
|
virtual |
Returns the variability of the type.
Implements Type.
Definition at line 589 of file type.cpp.
References variability.
Referenced by lCheckTypeEquality().
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Returns the LLVM type corresponding to this ispc type.
Implements Type.
Definition at line 725 of file type.cpp.
References Assert, FATAL, LLVMTypes::Int32Type, LLVMTypes::Int32VectorType, ArrayType::LLVMType(), Variability::SOA, Variability::soaWidth, Variability::type, Variability::Unbound, Variability::Uniform, variability, and Variability::Varying.
|
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 685 of file type.cpp.
References Assert, isConst, Variability::MangleString(), name, Variability::Unbound, and variability.
|
virtual |
Implements Type.
Definition at line 613 of file type.cpp.
References EnumType(), Variability::Unbound, and variability.
void EnumType::SetEnumerators | ( | const std::vector< Symbol *> & | enumerators | ) |
Provides the enumerators defined in the enum definition.
Definition at line 783 of file type.cpp.
References enumerators.
|
private |
Definition at line 396 of file type.h.
Referenced by GetDIType(), GetEnumerator(), GetEnumeratorCount(), and SetEnumerators().
|
private |
Definition at line 395 of file type.h.
Referenced by EnumType(), GetAsConstType(), GetAsNonConstType(), GetCDeclaration(), GetString(), IsConstType(), and Mangle().
|
private |
Definition at line 393 of file type.h.
Referenced by GetCDeclaration(), GetDIType(), GetString(), and Mangle().
const SourcePos EnumType::pos |
Definition at line 390 of file type.h.
Referenced by GetDIType(), and lCheckTypeEquality().
|
private |
Definition at line 394 of file type.h.
Referenced by EnumType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), GetCDeclaration(), GetDIType(), GetString(), GetVariability(), LLVMType(), Mangle(), and ResolveUnboundVariability().