Intel SPMD Program Compiler  1.3.0
Public Member Functions | Public Attributes | Private Attributes
EnumType Class Reference

Type implementation for enumerated types. More...

#include <type.h>

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

List of all members.

Public Member Functions

 EnumType (SourcePos pos)
 EnumType (const char *name, SourcePos pos)
Variability GetVariability () const
bool IsBoolType () const
bool IsFloatType () const
bool IsIntType () const
bool IsUnsignedType () const
bool IsConstType () const
const EnumTypeGetBaseType () const
const EnumTypeGetAsVaryingType () const
const EnumTypeGetAsUniformType () const
const EnumTypeGetAsUnboundVariabilityType () const
const EnumTypeGetAsSOAType (int width) const
const EnumTypeResolveUnboundVariability (Variability v) const
const EnumTypeGetAsConstType () const
const EnumTypeGetAsNonConstType () 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
void SetEnumerators (const std::vector< Symbol * > &enumerators)
int GetEnumeratorCount () const
const SymbolGetEnumerator (int i) const

Public Attributes

const SourcePos pos

Private Attributes

const std::string name
Variability variability
bool isConst
std::vector< Symbol * > enumerators

Detailed Description

Type implementation for enumerated types.

Definition at line 355 of file type.h.


Constructor & Destructor Documentation

EnumType::EnumType ( SourcePos  pos)

Constructor for anonymous enumerated types

Definition at line 580 of file type.cpp.

References isConst, Variability::Unbound, and variability.

Referenced by GetAsConstType(), GetAsNonConstType(), GetAsSOAType(), GetAsUnboundVariabilityType(), GetAsUniformType(), GetAsVaryingType(), and ResolveUnboundVariability().

EnumType::EnumType ( const char *  name,
SourcePos  pos 
)

Constructor for named enumerated types

Definition at line 588 of file type.cpp.

References isConst, Variability::Unbound, and variability.


Member Function Documentation

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

References EnumType(), and isConst.

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

References EnumType(), and isConst.

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

Implements Type.

Definition at line 686 of file type.cpp.

References EnumType(), Type::GetSOAWidth(), Variability::SOA, and variability.

const EnumType * EnumType::GetAsUnboundVariabilityType ( ) const [virtual]

Get an instance of the type with unbound variability.

Implements Type.

Definition at line 674 of file type.cpp.

References EnumType(), Type::HasUnboundVariability(), Variability::Unbound, and variability.

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

References EnumType(), Type::IsUniformType(), Variability::Uniform, and variability.

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

References EnumType(), Type::IsVaryingType(), variability, and Variability::Varying.

const EnumType * EnumType::GetBaseType ( ) const [virtual]

Returns the basic root type of the given type. For example, for an array or short-vector, this returns the element type. For a struct or atomic type, it returns itself.

Implements Type.

Definition at line 632 of file type.cpp.

std::string EnumType::GetCDeclaration ( const std::string &  name) const [virtual]

Returns a string that is the declaration of the same type in C syntax.

Implements Type.

Definition at line 747 of file type.cpp.

References Assert, Module::errorCount, isConst, lShouldPrintName(), m, name, Variability::SOA, Variability::soaWidth, Variability::Uniform, and variability.

llvm::DIType EnumType::GetDIType ( llvm::DIDescriptor  scope) const [virtual]

Returns the DIType (LLVM's debugging information structure), corresponding to this type.

Implements Type.

Definition at line 796 of file type.cpp.

References Assert, Module::diBuilder, enumerators, FATAL, SourcePos::first_line, g, SourcePos::GetDIFile(), lCreateDIArray(), m, name, NULL, pos, Variability::SOA, Variability::soaWidth, Globals::target, Variability::type, Variability::Uniform, variability, Variability::Varying, and Target::vectorWidth.

const Symbol * EnumType::GetEnumerator ( int  i) const

Returns the symbol for the given enumerator number.

Definition at line 856 of file type.cpp.

References enumerators.

int EnumType::GetEnumeratorCount ( ) const

Returns the total number of enuemrators in this enum type.

Definition at line 850 of file type.cpp.

References enumerators.

std::string EnumType::GetString ( ) const [virtual]

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

Implements Type.

Definition at line 722 of file type.cpp.

References Variability::GetString(), isConst, name, and variability.

Variability EnumType::GetVariability ( ) const [virtual]

Returns the variability of the type.

Implements Type.

Definition at line 596 of file type.cpp.

References variability.

Referenced by lCheckTypeEquality().

bool EnumType::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 602 of file type.cpp.

bool EnumType::IsConstType ( ) const [virtual]

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

Implements Type.

Definition at line 626 of file type.cpp.

References isConst.

bool EnumType::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 608 of file type.cpp.

bool EnumType::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 614 of file type.cpp.

bool EnumType::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 620 of file type.cpp.

llvm::Type * EnumType::LLVMType ( llvm::LLVMContext *  ctx) const [virtual]
std::string EnumType::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 735 of file type.cpp.

References Assert, isConst, Variability::MangleString(), name, Variability::Unbound, and variability.

const EnumType * EnumType::ResolveUnboundVariability ( Variability  v) const [virtual]

Implements Type.

Definition at line 650 of file type.cpp.

References EnumType(), Variability::Unbound, and variability.

void EnumType::SetEnumerators ( const std::vector< Symbol * > &  enumerators)

Provides the enumerators defined in the enum definition.

Definition at line 844 of file type.cpp.

References enumerators.


Member Data Documentation

std::vector<Symbol *> EnumType::enumerators [private]

Definition at line 400 of file type.h.

Referenced by GetDIType(), GetEnumerator(), GetEnumeratorCount(), and SetEnumerators().

bool EnumType::isConst [private]
const std::string EnumType::name [private]

Definition at line 397 of file type.h.

Referenced by GetCDeclaration(), GetDIType(), GetString(), and Mangle().

Definition at line 394 of file type.h.

Referenced by GetDIType(), and lCheckTypeEquality().


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