Intel SPMD Program Compiler  1.9.1
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 * LLVMType (llvm::LLVMContext *ctx) const
 
llvm::DIType GetDIType (llvm::DIDescriptor 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
 
static const AtomicTypeVaryingBool
 
static const AtomicTypeUniformInt8
 
static const AtomicTypeVaryingInt8
 
static const AtomicTypeUniformInt16
 
static const AtomicTypeVaryingInt16
 
static const AtomicTypeUniformInt32
 
static const AtomicTypeVaryingInt32
 
static const AtomicTypeUniformUInt8
 
static const AtomicTypeVaryingUInt8
 
static const AtomicTypeUniformUInt16
 
static const AtomicTypeVaryingUInt16
 
static const AtomicTypeUniformUInt32
 
static const AtomicTypeVaryingUInt32
 
static const AtomicTypeUniformFloat
 
static const AtomicTypeVaryingFloat
 
static const AtomicTypeUniformInt64
 
static const AtomicTypeVaryingInt64
 
static const AtomicTypeUniformUInt64
 
static const AtomicTypeVaryingUInt64
 
static const AtomicTypeUniformDouble
 
static const AtomicTypeVaryingDouble
 
static const AtomicTypeVoid
 

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 292 of file type.h.

Member Enumeration Documentation

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 328 of file type.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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 308 of file type.cpp.

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

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

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 321 of file type.cpp.

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

Referenced by VectorType::GetAsNonConstType().

const AtomicType * AtomicType::GetAsSOAType ( int  width) const
virtual

Implements Type.

Definition at line 379 of file type.cpp.

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

Referenced by VectorType::GetAsSOAType().

const AtomicType * AtomicType::GetAsUnboundVariabilityType ( ) const
virtual

Get an instance of the type with unbound variability.

Implements Type.

Definition at line 370 of file type.cpp.

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

Referenced by VectorType::GetAsUnboundVariabilityType(), and DeclSpecs::GetBaseType().

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 355 of file type.cpp.

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

Referenced by VectorType::GetAsUniformType(), GetDIType(), VectorType::getVectorMemoryCount(), and LLVMType().

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 284 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.

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 340 of file type.cpp.

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

Referenced by VectorType::GetAsVaryingType().

const AtomicType * AtomicType::GetBaseType ( ) const
virtual

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

Implements Type.

Definition at line 334 of file type.cpp.

std::string AtomicType::GetCDeclaration ( const std::string &  name) const
virtual
llvm::DIType AtomicType::GetDIType ( llvm::DIDescriptor  scope) const
virtual
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 397 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 VectorType::GetString().

Variability AtomicType::GetVariability ( ) const
virtual

Returns the variability of the type.

Implements Type.

Definition at line 224 of file type.cpp.

References variability.

Referenced by VectorType::GetVariability(), and lCheckTypeEquality().

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 272 of file type.cpp.

References basicType, and TYPE_BOOL.

Referenced by VectorType::IsBoolType().

bool AtomicType::IsConstType ( ) const
virtual

Returns true if this type is 'const'-qualified.

Implements Type.

Definition at line 278 of file type.cpp.

References isConst.

Referenced by VectorType::IsConstType().

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 251 of file type.cpp.

References basicType, TYPE_DOUBLE, and TYPE_FLOAT.

Referenced by VectorType::IsFloatType().

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 256 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().

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 265 of file type.cpp.

References basicType, TYPE_UINT16, TYPE_UINT32, TYPE_UINT64, and TYPE_UINT8.

Referenced by GetAsUnsignedType(), and VectorType::IsUnsignedType().

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

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

Implements Type.

Definition at line 388 of file type.cpp.

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

Referenced by VectorType::ResolveUnboundVariability().

Member Data Documentation

const AtomicType* AtomicType::asOtherConstType
mutableprivate

Definition at line 364 of file type.h.

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

const AtomicType * AtomicType::asUniformType
mutableprivate

Definition at line 364 of file type.h.

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

const AtomicType * AtomicType::asVaryingType
mutableprivate

Definition at line 364 of file type.h.

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

const BasicType AtomicType::basicType
const bool AtomicType::isConst
private
const AtomicType * AtomicType::UniformBool
static
const AtomicType * AtomicType::UniformDouble
static
const AtomicType * AtomicType::UniformFloat
static
const AtomicType * AtomicType::UniformInt16
static
const AtomicType * AtomicType::UniformInt32
static
const AtomicType * AtomicType::UniformInt64
static
const AtomicType * AtomicType::UniformInt8
static
const AtomicType * AtomicType::UniformUInt16
static
const AtomicType * AtomicType::UniformUInt32
static
const AtomicType * AtomicType::UniformUInt64
static
const AtomicType * AtomicType::UniformUInt8
static
const Variability AtomicType::variability
private
const AtomicType * AtomicType::VaryingBool
static
const AtomicType * AtomicType::VaryingDouble
static
const AtomicType * AtomicType::VaryingFloat
static
const AtomicType * AtomicType::VaryingInt16
static
const AtomicType * AtomicType::VaryingInt32
static
const AtomicType * AtomicType::VaryingInt64
static
const AtomicType * AtomicType::VaryingInt8
static
const AtomicType * AtomicType::VaryingUInt16
static
const AtomicType * AtomicType::VaryingUInt32
static
const AtomicType * AtomicType::VaryingUInt64
static
const AtomicType * AtomicType::VaryingUInt8
static
const AtomicType * AtomicType::Void
static
Initial value:

Definition at line 357 of file type.h.

Referenced by Module::AddFunctionDeclaration(), SyncExpr::GetType(), and lLLVMTypeToISPCType().


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