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

Type implementation for pointers to other types. More...

#include <type.h>

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

Public Member Functions

 PointerType (const Type *t, Variability v, bool isConst, bool isSlice=false, bool frozen=false)
 
Variability GetVariability () const
 
bool IsBoolType () const
 
bool IsFloatType () const
 
bool IsIntType () const
 
bool IsUnsignedType () const
 
bool IsConstType () const
 
bool IsSlice () const
 
bool IsFrozenSlice () const
 
const PointerTypeGetAsSlice () const
 
const PointerTypeGetAsNonSlice () const
 
const PointerTypeGetAsFrozenSlice () const
 
const TypeGetBaseType () const
 
const PointerTypeGetAsVaryingType () const
 
const PointerTypeGetAsUniformType () const
 
const PointerTypeGetAsUnboundVariabilityType () const
 
const PointerTypeGetAsSOAType (int width) const
 
const PointerTypeResolveUnboundVariability (Variability v) const
 
const PointerTypeGetAsConstType () const
 
const PointerTypeGetAsNonConstType () 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::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 TypeGetAsUnsignedType () const
 
virtual const TypeGetReferenceTarget () const
 
virtual llvm::Type * LLVMStorageType (llvm::LLVMContext *ctx) const
 

Static Public Member Functions

static PointerTypeGetUniform (const Type *t, bool isSlice=false)
 
static PointerTypeGetVarying (const Type *t)
 
static bool IsVoidPointer (const Type *t)
 
- 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)
 

Static Public Attributes

static PointerTypeVoid = new PointerType(AtomicType::Void, Variability(Variability::Uniform), false)
 

Private Attributes

const Variability variability
 
const bool isConst
 
const bool isSlice
 
const bool isFrozen
 
const TypebaseType
 

Additional Inherited Members

- Public Attributes inherited from Type
const TypeId typeId
 
- Protected Member Functions inherited from Type
 Type (TypeId id)
 

Detailed Description

Type implementation for pointers to other types.

Pointers can have two additional properties beyond their variability and the type of object that they are pointing to. Both of these properties are used for internal bookkeeping and aren't directly accessible from the language.

Definition at line 419 of file type.h.

Constructor & Destructor Documentation

◆ PointerType()

PointerType::PointerType ( const Type t,
Variability  v,
bool  isConst,
bool  isSlice = false,
bool  frozen = false 
)

Member Function Documentation

◆ GetAsConstType()

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

References baseType, isConst, isSlice, PointerType(), and variability.

◆ GetAsFrozenSlice()

const PointerType * PointerType::GetAsFrozenSlice ( ) const

◆ GetAsNonConstType()

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

References baseType, isConst, isSlice, PointerType(), and variability.

◆ GetAsNonSlice()

const PointerType * PointerType::GetAsNonSlice ( ) const

◆ GetAsSlice()

const PointerType * PointerType::GetAsSlice ( ) const

◆ GetAsSOAType()

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

Implements Type.

Definition at line 846 of file type.cpp.

References baseType, Type::GetSOAWidth(), isConst, isFrozen, isSlice, PointerType(), and Variability::SOA.

◆ GetAsUnboundVariabilityType()

const PointerType * PointerType::GetAsUnboundVariabilityType ( ) const
virtual

Get an instance of the type with unbound variability.

Implements Type.

Definition at line 839 of file type.cpp.

References baseType, isConst, isFrozen, isSlice, PointerType(), Variability::Unbound, and variability.

◆ GetAsUniformType()

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

References baseType, isConst, isFrozen, isSlice, PointerType(), Variability::Uniform, and variability.

Referenced by GetDIType(), and LLVMType().

◆ GetAsVaryingType()

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

References baseType, isConst, isFrozen, isSlice, PointerType(), variability, and Variability::Varying.

◆ GetBaseType()

const Type * PointerType::GetBaseType ( ) const
virtual

◆ GetCDeclaration()

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

◆ GetDIType()

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

◆ GetString()

std::string PointerType::GetString ( ) const
virtual

Returns a text representation of the type (for example, for use in warning and error messages).

Implements Type.

Definition at line 897 of file type.cpp.

References Assert, baseType, Module::errorCount, Variability::GetString(), Type::GetString(), isConst, isFrozen, isSlice, m, and variability.

Referenced by FunctionType::GetCDeclarationForDispatch(), and BinaryExpr::TypeCheck().

◆ GetUniform()

PointerType * PointerType::GetUniform ( const Type t,
bool  isSlice = false 
)
static

◆ GetVariability()

Variability PointerType::GetVariability ( ) const
virtual

Returns the variability of the type.

Implements Type.

Definition at line 811 of file type.cpp.

References variability.

Referenced by FunctionEmitContext::AddElementOffset(), and lDeconstifyType().

◆ GetVarying()

PointerType * PointerType::GetVarying ( const Type t)
static

◆ IsBoolType()

bool PointerType::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 813 of file type.cpp.

◆ IsConstType()

bool PointerType::IsConstType ( ) const
virtual

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

Implements Type.

Definition at line 821 of file type.cpp.

References isConst.

Referenced by FunctionEmitContext::AddElementOffset().

◆ IsFloatType()

bool PointerType::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 815 of file type.cpp.

◆ IsFrozenSlice()

bool PointerType::IsFrozenSlice ( ) const
inline

Definition at line 440 of file type.h.

References Variability::GetString().

Referenced by FunctionEmitContext::GetElementPtrInst(), and lCheckTypeEquality().

◆ IsIntType()

bool PointerType::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 817 of file type.cpp.

Referenced by TypeCastExpr::TypeCheck().

◆ IsSlice()

bool PointerType::IsSlice ( ) const
inline

◆ IsUnsignedType()

bool PointerType::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 819 of file type.cpp.

◆ IsVoidPointer()

bool PointerType::IsVoidPointer ( const Type t)
static

Returns true if the given type is a void * type.

Definition at line 807 of file type.cpp.

References Type::EqualIgnoringConst(), Type::GetAsUniformType(), and Void.

Referenced by TypeCastExpr::GetValue(), lDoTypeConv(), Type::MoreGeneralType(), UnaryExpr::TypeCheck(), BinaryExpr::TypeCheck(), and AssignExpr::TypeCheck().

◆ LLVMType()

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

◆ Mangle()

std::string PointerType::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 917 of file type.cpp.

References Assert, baseType, Module::errorCount, isFrozen, isSlice, m, Type::Mangle(), Variability::MangleString(), Variability::Unbound, and variability.

◆ ResolveUnboundVariability()

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

Member Data Documentation

◆ baseType

const Type* PointerType::baseType
private

◆ isConst

const bool PointerType::isConst
private

◆ isFrozen

const bool PointerType::isFrozen
private

◆ isSlice

const bool PointerType::isSlice
private

◆ variability

const Variability PointerType::variability
private

◆ Void

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

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