Intel SPMD Program Compiler  1.12.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 * 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 = 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 278 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 314 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 247 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 258 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 304 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 297 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 284 of file type.cpp.

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

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

◆ 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 225 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 271 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 269 of file type.cpp.

◆ GetCDeclaration()

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

◆ GetDIType()

llvm::DIType AtomicType::GetDIType ( llvm::DIDescriptor  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 318 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 199 of file type.cpp.

References variability.

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

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

References basicType, and TYPE_BOOL.

Referenced by VectorType::IsBoolType().

◆ IsConstType()

bool AtomicType::IsConstType ( ) const
virtual

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

Implements Type.

Definition at line 223 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 209 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 211 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 216 of file type.cpp.

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

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

◆ LLVMType()

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

◆ 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 370 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 311 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 350 of file type.h.

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

◆ asUniformType

const AtomicType * AtomicType::asUniformType
mutableprivate

Definition at line 350 of file type.h.

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

◆ asVaryingType

const AtomicType * AtomicType::asVaryingType
mutableprivate

Definition at line 350 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

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