Intel SPMD Program Compiler  1.3.0
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
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]

List of all members.

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 Attributes

const BasicType basicType
static const AtomicTypeVaryingBool
static const AtomicTypeVaryingInt8
static const AtomicTypeVaryingInt16
static const AtomicTypeVaryingInt32
static const AtomicTypeVaryingUInt8
static const AtomicTypeVaryingUInt16
static const AtomicTypeVaryingUInt32
static const AtomicTypeVaryingFloat
static const AtomicTypeVaryingInt64
static const AtomicTypeVaryingUInt64
static const AtomicTypeVaryingDouble

Static Public Attributes

static const AtomicTypeUniformBool
static const AtomicTypeUniformInt8
static const AtomicTypeUniformInt16
static const AtomicTypeUniformInt32
static const AtomicTypeUniformUInt8
static const AtomicTypeUniformUInt16
static const AtomicTypeUniformUInt32
static const AtomicTypeUniformFloat
static const AtomicTypeUniformInt64
static const AtomicTypeUniformUInt64
static const AtomicTypeUniformDouble
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

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 281 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 313 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 282 of file type.cpp.

References asOtherConstType, AtomicType(), basicType, isConst, NULL, TYPE_VOID, 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 295 of file type.cpp.

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

Referenced by VectorType::GetAsNonConstType().

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

Implements Type.

Definition at line 353 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 344 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 329 of file type.cpp.

References Assert, asUniformType, asVaryingType, AtomicType(), basicType, isConst, NULL, 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 258 of file type.cpp.

References AtomicType(), basicType, FATAL, isConst, IsIntType(), IsUnsignedType(), NULL, 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 314 of file type.cpp.

References Assert, asUniformType, asVaryingType, AtomicType(), basicType, isConst, NULL, 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 308 of file type.cpp.

Referenced by IndexExpr::TypeCheck(), and PtrDerefExpr::TypeCheck().

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 371 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 198 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 246 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 252 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 225 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 230 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 239 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 399 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 362 of file type.cpp.

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

Referenced by VectorType::ResolveUnboundVariability().


Member Data Documentation

const AtomicType* AtomicType::asOtherConstType [mutable, private]

Definition at line 349 of file type.h.

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

const AtomicType * AtomicType::asUniformType [mutable, private]

Definition at line 349 of file type.h.

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

const AtomicType * AtomicType::asVaryingType [mutable, private]

Definition at line 349 of file type.h.

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

const bool AtomicType::isConst [private]
const AtomicType * AtomicType::Void [static]

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