Intel SPMD Program Compiler  1.9.1
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::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 TypeGetAsUnsignedType () const
 
virtual const TypeGetReferenceTarget () 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
 

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

Constructor & Destructor Documentation

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

Member Function Documentation

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

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

const PointerType * PointerType::GetAsFrozenSlice ( ) const
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 1114 of file type.cpp.

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

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

Implements Type.

Definition at line 1054 of file type.cpp.

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

const PointerType * PointerType::GetAsUnboundVariabilityType ( ) const
virtual

Get an instance of the type with unbound variability.

Implements Type.

Definition at line 1044 of file type.cpp.

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

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

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

Referenced by GetDIType(), and LLVMType().

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

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

const Type * PointerType::GetBaseType ( ) const
virtual
std::string PointerType::GetCDeclaration ( const std::string &  name) const
virtual
llvm::DIType PointerType::GetDIType ( llvm::DIDescriptor  scope) const
virtual
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 1123 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().

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

Returns the variability of the type.

Implements Type.

Definition at line 982 of file type.cpp.

References variability.

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

PointerType * PointerType::GetVarying ( const Type t)
static
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 988 of file type.cpp.

bool PointerType::IsConstType ( ) const
virtual

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

Implements Type.

Definition at line 1012 of file type.cpp.

References isConst.

Referenced by FunctionEmitContext::AddElementOffset().

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

bool PointerType::IsFrozenSlice ( ) const
inline

Definition at line 468 of file type.h.

References isFrozen.

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

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

Referenced by TypeCastExpr::TypeCheck().

bool PointerType::IsSlice ( ) const
inline
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 1006 of file type.cpp.

bool PointerType::IsVoidPointer ( const Type t)
static

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

Definition at line 975 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().

llvm::Type * PointerType::LLVMType ( llvm::LLVMContext *  ctx) const
virtual
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 1142 of file type.cpp.

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

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

Member Data Documentation

const Type* PointerType::baseType
private
const bool PointerType::isConst
private
const bool PointerType::isFrozen
private
const bool PointerType::isSlice
private
const Variability PointerType::variability
private
PointerType * PointerType::Void
static

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