Intel® Implicit SPMD Program Compiler (Intel® ISPC)  1.13.0
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
AtomicType Class Reference

AtomicType represents basic types like floats, ints, etc. More...

#include <type.h>

Inheritance diagram for AtomicType:
Inheritance graph
[legend]
Collaboration diagram for AtomicType:
Collaboration graph
[legend]

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 AtomicTypeGetBaseType () const
 
const AtomicTypeGetAsUniformType () const
 
const AtomicTypeGetAsVaryingType () const
 
const AtomicTypeGetAsUnboundVariabilityType () const
 
const AtomicTypeGetAsSOAType (int width) const
 
const AtomicTypeResolveUnboundVariability (Variability v) const
 
const AtomicTypeGetAsUnsignedType () const
 
const AtomicTypeGetAsConstType () const
 
const AtomicTypeGetAsNonConstType () 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 TypeGetReferenceTarget () const
 

Public Attributes

const BasicType basicType
 
- Public Attributes inherited from Type
const TypeId typeId
 

Static Public Attributes

static const AtomicTypeUniformBool = new AtomicType(AtomicType::TYPE_BOOL, Variability::Uniform, false)
 
static const AtomicTypeVaryingBool = new AtomicType(AtomicType::TYPE_BOOL, Variability::Varying, false)
 
static const AtomicTypeUniformInt8 = new AtomicType(AtomicType::TYPE_INT8, Variability::Uniform, false)
 
static const AtomicTypeVaryingInt8 = new AtomicType(AtomicType::TYPE_INT8, Variability::Varying, false)
 
static const AtomicTypeUniformInt16 = new AtomicType(AtomicType::TYPE_INT16, Variability::Uniform, false)
 
static const AtomicTypeVaryingInt16 = new AtomicType(AtomicType::TYPE_INT16, Variability::Varying, false)
 
static const AtomicTypeUniformInt32 = new AtomicType(AtomicType::TYPE_INT32, Variability::Uniform, false)
 
static const AtomicTypeVaryingInt32 = new AtomicType(AtomicType::TYPE_INT32, Variability::Varying, false)
 
static const AtomicTypeUniformUInt8 = new AtomicType(AtomicType::TYPE_UINT8, Variability::Uniform, false)
 
static const AtomicTypeVaryingUInt8 = new AtomicType(AtomicType::TYPE_UINT8, Variability::Varying, false)
 
static const AtomicTypeUniformUInt16 = new AtomicType(AtomicType::TYPE_UINT16, Variability::Uniform, false)
 
static const AtomicTypeVaryingUInt16 = new AtomicType(AtomicType::TYPE_UINT16, Variability::Varying, false)
 
static const AtomicTypeUniformUInt32 = new AtomicType(AtomicType::TYPE_UINT32, Variability::Uniform, false)
 
static const AtomicTypeVaryingUInt32 = new AtomicType(AtomicType::TYPE_UINT32, Variability::Varying, false)
 
static const AtomicTypeUniformFloat = new AtomicType(AtomicType::TYPE_FLOAT, Variability::Uniform, false)
 
static const AtomicTypeVaryingFloat = new AtomicType(AtomicType::TYPE_FLOAT, Variability::Varying, false)
 
static const AtomicTypeUniformInt64 = new AtomicType(AtomicType::TYPE_INT64, Variability::Uniform, false)
 
static const AtomicTypeVaryingInt64 = new AtomicType(AtomicType::TYPE_INT64, Variability::Varying, false)
 
static const AtomicTypeUniformUInt64 = new AtomicType(AtomicType::TYPE_UINT64, Variability::Uniform, false)
 
static const AtomicTypeVaryingUInt64 = new AtomicType(AtomicType::TYPE_UINT64, Variability::Varying, false)
 
static const AtomicTypeUniformDouble = new AtomicType(AtomicType::TYPE_DOUBLE, Variability::Uniform, false)
 
static const AtomicTypeVaryingDouble = new AtomicType(AtomicType::TYPE_DOUBLE, Variability::Varying, false)
 
static const AtomicTypeVoid = new AtomicType(TYPE_VOID, Variability::Uniform, false)
 

Private Member Functions

 AtomicType (BasicType basicType, Variability v, bool isConst)
 

Private Attributes

const Variability variability
 
const bool isConst
 
const AtomicTypeasOtherConstType
 
const AtomicTypeasUniformType
 
const AtomicTypeasVaryingType
 

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 TypeMoreGeneralType (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)
 

Detailed Description

AtomicType represents basic types like floats, ints, etc.

AtomicTypes can be either uniform or varying. Unique instances of all of the possible AtomicTypes 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.

Definition at line 270 of file type.h.

Member Enumeration Documentation

◆ BasicType

This enumerator records the basic types that AtomicTypes can be built from.

Enumerator
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 

Definition at line 304 of file type.h.

Constructor & Destructor Documentation

◆ AtomicType()

AtomicType::AtomicType ( BasicType  basicType,
Variability  v,
bool  isConst 
)
private

Member Function Documentation

◆ GetAsConstType()

const AtomicType * AtomicType::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 207 of file type.cpp.

References asOtherConstType, AtomicType(), basicType, isConst, and variability.

Referenced by ForeachActiveStmt::EmitCode(), and VectorType::GetAsConstType().

◆ GetAsNonConstType()

const AtomicType * AtomicType::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 218 of file type.cpp.

References asOtherConstType, AtomicType(), basicType, isConst, and variability.

Referenced by VectorType::GetAsNonConstType().

◆ GetAsSOAType()

const AtomicType * AtomicType::GetAsSOAType ( int  width) const
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().

◆ GetAsUnboundVariabilityType()

const AtomicType * AtomicType::GetAsUnboundVariabilityType ( ) const
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().

◆ GetAsUniformType()

const AtomicType * AtomicType::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 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().

◆ GetAsUnsignedType()

const AtomicType * AtomicType::GetAsUnsignedType ( ) const
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().

◆ GetAsVaryingType()

const AtomicType * AtomicType::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 231 of file type.cpp.

References Assert, asUniformType, asVaryingType, AtomicType(), basicType, isConst, TYPE_VOID, Variability::Uniform, variability, and Variability::Varying.

Referenced by VectorType::GetAsVaryingType().

◆ GetBaseType()

const AtomicType * AtomicType::GetBaseType ( ) const
virtual

For AtomicTypes, the base type is just the same as the AtomicType itself.

Implements Type.

Definition at line 229 of file type.cpp.

◆ GetCDeclaration()

std::string AtomicType::GetCDeclaration ( const std::string &  name) const
virtual

◆ GetDIType()

llvm::DIType * AtomicType::GetDIType ( llvm::DIScope *  scope) const
virtual

◆ GetString()

std::string AtomicType::GetString ( ) const
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().

◆ GetVariability()

Variability AtomicType::GetVariability ( ) const
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().

◆ IsBoolType()

bool AtomicType::IsBoolType ( ) const
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().

◆ IsConstType()

bool AtomicType::IsConstType ( ) const
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().

◆ IsFloatType()

bool AtomicType::IsFloatType ( ) const
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().

◆ IsIntType()

bool AtomicType::IsIntType ( ) const
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().

◆ IsUnsignedType()

bool AtomicType::IsUnsignedType ( ) const
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().

◆ LLVMStorageType()

llvm::Type * AtomicType::LLVMStorageType ( llvm::LLVMContext *  ctx) const
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().

◆ LLVMType()

llvm::Type * AtomicType::LLVMType ( llvm::LLVMContext *  ctx) const
virtual

Returns the LLVM type corresponding to this ispc type.

Implements Type.

Definition at line 510 of file type.cpp.

References lGetAtomicLLVMType().

◆ Mangle()

std::string AtomicType::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 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().

◆ ResolveUnboundVariability()

const AtomicType * AtomicType::ResolveUnboundVariability ( Variability  v) const
virtual

Implements Type.

Definition at line 295 of file type.cpp.

References Assert, AtomicType(), basicType, isConst, Variability::Unbound, and variability.

Referenced by VectorType::ResolveUnboundVariability().

Member Data Documentation

◆ asOtherConstType

const AtomicType* AtomicType::asOtherConstType
mutableprivate

Definition at line 340 of file type.h.

Referenced by AtomicType(), GetAsConstType(), and GetAsNonConstType().

◆ asUniformType

const AtomicType * AtomicType::asUniformType
mutableprivate

Definition at line 340 of file type.h.

Referenced by AtomicType(), GetAsUniformType(), and GetAsVaryingType().

◆ asVaryingType

const AtomicType * AtomicType::asVaryingType
mutableprivate

Definition at line 340 of file type.h.

Referenced by AtomicType(), GetAsUniformType(), and GetAsVaryingType().

◆ basicType

const BasicType AtomicType::basicType

◆ isConst

const bool AtomicType::isConst
private

◆ UniformBool

const AtomicType * AtomicType::UniformBool = new AtomicType(AtomicType::TYPE_BOOL, Variability::Uniform, false)
static

◆ UniformDouble

const AtomicType * AtomicType::UniformDouble = new AtomicType(AtomicType::TYPE_DOUBLE, Variability::Uniform, false)
static

◆ UniformFloat

const AtomicType * AtomicType::UniformFloat = new AtomicType(AtomicType::TYPE_FLOAT, Variability::Uniform, false)
static

◆ UniformInt16

const AtomicType * AtomicType::UniformInt16 = new AtomicType(AtomicType::TYPE_INT16, Variability::Uniform, false)
static

◆ UniformInt32

const AtomicType * AtomicType::UniformInt32 = new AtomicType(AtomicType::TYPE_INT32, Variability::Uniform, false)
static

◆ UniformInt64

const AtomicType * AtomicType::UniformInt64 = new AtomicType(AtomicType::TYPE_INT64, Variability::Uniform, false)
static

◆ UniformInt8

const AtomicType * AtomicType::UniformInt8 = new AtomicType(AtomicType::TYPE_INT8, Variability::Uniform, false)
static

◆ UniformUInt16

const AtomicType * AtomicType::UniformUInt16 = new AtomicType(AtomicType::TYPE_UINT16, Variability::Uniform, false)
static

◆ UniformUInt32

const AtomicType * AtomicType::UniformUInt32 = new AtomicType(AtomicType::TYPE_UINT32, Variability::Uniform, false)
static

◆ UniformUInt64

const AtomicType * AtomicType::UniformUInt64 = new AtomicType(AtomicType::TYPE_UINT64, Variability::Uniform, false)
static

◆ UniformUInt8

const AtomicType * AtomicType::UniformUInt8 = new AtomicType(AtomicType::TYPE_UINT8, Variability::Uniform, false)
static

◆ variability

const Variability AtomicType::variability
private

◆ VaryingBool

const AtomicType * AtomicType::VaryingBool = new AtomicType(AtomicType::TYPE_BOOL, Variability::Varying, false)
static

◆ VaryingDouble

const AtomicType * AtomicType::VaryingDouble = new AtomicType(AtomicType::TYPE_DOUBLE, Variability::Varying, false)
static

◆ VaryingFloat

const AtomicType * AtomicType::VaryingFloat = new AtomicType(AtomicType::TYPE_FLOAT, Variability::Varying, false)
static

◆ VaryingInt16

const AtomicType * AtomicType::VaryingInt16 = new AtomicType(AtomicType::TYPE_INT16, Variability::Varying, false)
static

◆ VaryingInt32

const AtomicType * AtomicType::VaryingInt32 = new AtomicType(AtomicType::TYPE_INT32, Variability::Varying, false)
static

◆ VaryingInt64

const AtomicType * AtomicType::VaryingInt64 = new AtomicType(AtomicType::TYPE_INT64, Variability::Varying, false)
static

◆ VaryingInt8

const AtomicType * AtomicType::VaryingInt8 = new AtomicType(AtomicType::TYPE_INT8, Variability::Varying, false)
static

◆ VaryingUInt16

const AtomicType * AtomicType::VaryingUInt16 = new AtomicType(AtomicType::TYPE_UINT16, Variability::Varying, false)
static

◆ VaryingUInt32

const AtomicType * AtomicType::VaryingUInt32 = new AtomicType(AtomicType::TYPE_UINT32, Variability::Varying, false)
static

◆ VaryingUInt64

const AtomicType * AtomicType::VaryingUInt64 = new AtomicType(AtomicType::TYPE_UINT64, Variability::Varying, false)
static

◆ VaryingUInt8

const AtomicType * AtomicType::VaryingUInt8 = new AtomicType(AtomicType::TYPE_UINT8, Variability::Varying, false)
static

◆ Void

const AtomicType * AtomicType::Void = new AtomicType(TYPE_VOID, Variability::Uniform, false)
static

Definition at line 333 of file type.h.

Referenced by SyncExpr::GetType(), lLLVMTypeToISPCType(), and Type::LLVMStorageType().


The documentation for this class was generated from the following files: