vrq
Public Member Functions | Protected Member Functions | List of all members
CSimpleType Class Reference

class for describing simple builtin data types More...

#include <csimpletype.h>

Inheritance diagram for CSimpleType:
CDataType CObject

Public Member Functions

 CSimpleType (VarDataType_t vt)
 Create data type instance. More...
 
 CSimpleType (VarDataType_t vt, list< CNode * > &rangeList)
 Create data type instance. More...
 
virtual CDataTypeClone (CObstack *heap)
 Create a new copy with a deep copy. More...
 
virtual int GetSignedAttr () const
 Get declaration's signed attribute. More...
 
virtual int GetUnsignedAttr () const
 Get declaration's unsigned attribute. More...
 
virtual void SetSignedAttr (int v)
 Set declaration's signed attribute. More...
 
virtual void SetUnsignedAttr (int v)
 Set declaration's unsigned attribute. More...
 
virtual int GetSigned () const
 Get declartion's signed property. More...
 
virtual int GetTwoState () const
 Get declaration's 2 state property. More...
 
virtual NodeType_t GetNodeType (void) const
 Get data type. More...
 
virtual int IsBaseWidthConstant (void) const
 Determine if base width (sans packed dimensions) of declaration is constant, ie dependent upon only constants and parameters. More...
 
virtual int IsBaseWidthVolatile (void) const
 Determine if base width (sans packed dimensions) of declaration is volatile, ie depend upon parameters or variables. More...
 
virtual int IsBaseWidthEvaluateable (void) const
 Determine if base width (sans packed dimensions) of declaration can be evaluated. More...
 
virtual INT32 GetBaseWidth (void) const
 Evaluate base width (sans packed dimensions) of declaration. More...
 
virtual CNodeGetBaseWidthExp () const
 Get expression for datatype's base width (sans packed dimensions) More...
 
virtual int IsVector () const
 Determine if complete data structure is a vector. More...
 
virtual int IsPacked () const
 Determine if complete data structure is packed. More...
 
virtual CNodeGetPackedMsb () const
 Get expression for declaration's msb. More...
 
virtual CNodeGetPackedLsb () const
 Get expression for declaration's lsb. More...
 
virtual CNodeGetPackedRange () const
 Get expression for datatype's overall packed or vector range (msb/lsb) More...
 
virtual INT32 GetPackedWidth (void) const
 Evaluate packed or vector width of declaration. More...
 
virtual CNodeGetPackedWidthExp () const
 Get expression for datatype's overall packed or vetor width. More...
 
virtual int PackedWidthDirection (void) const
 Evaluate current decl width direction. More...
 
virtual INT32 GetNumberOfPackedDimensions (void) const
 Get number of packed dimensions of declaration. More...
 
virtual CNodeGetPackedMsi (INT32 dim) const
 Get expression tree for upper limit of given packed array dimension. More...
 
virtual CNodeGetPackedLsi (INT32 dim) const
 Get expression tree for lower limit of packed array dimension. More...
 
virtual CNodeGetPackedRange (INT32 dim) const
 Get expression for range of packed array for dimension. More...
 
virtual void Dump (FILE *f) const
 Dump data type info to file descriptor. More...
 
- Public Member Functions inherited from CDataType
 CDataType (VarDataType_t t)
 Create data type instance. More...
 
 CDataType (VarDataType_t t, list< CNode * > packedList)
 Create data type instance. More...
 
virtual void SetVarDataType (VarDataType_t v)
 Set declaration's variable data type. More...
 
virtual VarDataType_t GetVarDataType () const
 Get declaration's variable data type. More...
 
virtual void SetConst (int v)
 Set declaration's const property. More...
 
virtual int GetConst () const
 Get declaration's const property. More...
 
virtual int IsScalar () const
 Determine if complete data structure is a scalar. More...
 
virtual int IsPackedWidthConstant (void) const
 Determine if packed or vector width of declaration is constant, ie dependent upon only constants and parameters. More...
 
virtual int IsPackedWidthVolatile (void) const
 Determine if packed or vector width of declaration is volatile, ie depend upon parameters or variables. More...
 
virtual int IsPackedWidthEvaluateable (void) const
 Determine if packed or vector width of declaration can be evaluated. More...
 
virtual void PreVisit1 (int(*callback)(CNode *, void *), void *data)
 Walk tree invoking callback on each node before children have been visited. More...
 
virtual void PostVisit1 (void(*callback)(CNode *, void *), void *data)
 Walk tree invoking callback on each node after children have been visited. More...
 
virtual void PostSubVisit1 (CNode *(*callback)(CNode *, void *), void *data)
 Walk tree invoking callback on each node after children have been visited. More...
 
- Public Member Functions inherited from CObject
void * operator new (size_t size, CObstack *stack)
 Allocate object on CObstack heap. More...
 
void operator delete (void *object)
 Destroy object. More...
 

Protected Member Functions

void Copy (CObstack *heap, const CSimpleType &o)
 Perform deep copy of given object to this one This should never be call directly, only by subclasses. More...
 
int GetVectorWidth () const
 Get width of vector. More...
 
- Protected Member Functions inherited from CDataType
void Copy (CObstack *heap, const CDataType &o)
 Perform deep copy of given object to this one This should never be call directly, only by subclasses. More...
 

Detailed Description

class for describing simple builtin data types

Constructor & Destructor Documentation

CSimpleType::CSimpleType ( VarDataType_t  vt)

Create data type instance.

Parameters
vtvariable simple data type
CSimpleType::CSimpleType ( VarDataType_t  vt,
list< CNode * > &  rangeList 
)

Create data type instance.

Parameters
vtvariable simple data type
rangeListvector of packed ranges for declaration.

Member Function Documentation

virtual CDataType* CSimpleType::Clone ( CObstack heap)
virtual

Create a new copy with a deep copy.

Parameters
heapheap to use for allocation.

Implements CDataType.

void CSimpleType::Copy ( CObstack heap,
const CSimpleType o 
)
protected

Perform deep copy of given object to this one This should never be call directly, only by subclasses.

Parameters
heapheap to use for allocation.
odeclaration to copy.
virtual void CSimpleType::Dump ( FILE *  f) const
virtual

Dump data type info to file descriptor.

Parameters
ffile descriptor.

Implements CDataType.

virtual INT32 CSimpleType::GetBaseWidth ( void  ) const
virtual

Evaluate base width (sans packed dimensions) of declaration.

Returns
packed or vector width of declaration.

Implements CDataType.

virtual CNode* CSimpleType::GetBaseWidthExp ( ) const
virtual

Get expression for datatype's base width (sans packed dimensions)

Returns
width expression

Implements CDataType.

virtual NodeType_t CSimpleType::GetNodeType ( void  ) const
virtual

Get data type.

Returns
node type

Implements CDataType.

virtual INT32 CSimpleType::GetNumberOfPackedDimensions ( void  ) const
virtual

Get number of packed dimensions of declaration.

Returns
number of dimensions, 0 if non-array.

Reimplemented from CDataType.

virtual CNode* CSimpleType::GetPackedLsb ( ) const
virtual

Get expression for declaration's lsb.

Valid only for Packed and Vector declarations.

Returns
lsb expression, NULL if scalar.

Reimplemented from CDataType.

virtual CNode* CSimpleType::GetPackedLsi ( INT32  dim) const
virtual

Get expression tree for lower limit of packed array dimension.

Parameters
dimdimension.
Returns
expression tree for packed lower limit.

Reimplemented from CDataType.

virtual CNode* CSimpleType::GetPackedMsb ( ) const
virtual

Get expression for declaration's msb.

Valid only for Packed and Vector declarations.

Returns
msb expression, NULL if scalar.

Reimplemented from CDataType.

virtual CNode* CSimpleType::GetPackedMsi ( INT32  dim) const
virtual

Get expression tree for upper limit of given packed array dimension.

Parameters
dimdimension.
Returns
expression tree for packed upper limit.

Reimplemented from CDataType.

virtual CNode* CSimpleType::GetPackedRange ( ) const
virtual

Get expression for datatype's overall packed or vector range (msb/lsb)

Returns
range expression, NULL if scalar.

Reimplemented from CDataType.

virtual CNode* CSimpleType::GetPackedRange ( INT32  dim) const
virtual

Get expression for range of packed array for dimension.

Parameters
dimdimension to get.
Returns
range expression for limit.

Reimplemented from CDataType.

virtual INT32 CSimpleType::GetPackedWidth ( void  ) const
virtual

Evaluate packed or vector width of declaration.

Returns
packed or vector width of declaration.

Reimplemented from CDataType.

virtual CNode* CSimpleType::GetPackedWidthExp ( ) const
virtual

Get expression for datatype's overall packed or vetor width.

Returns
width expression

Reimplemented from CDataType.

virtual int CSimpleType::GetSigned ( ) const
virtual

Get declartion's signed property.

Returns
value of signed property.

Implements CDataType.

virtual int CSimpleType::GetSignedAttr ( ) const
inlinevirtual

Get declaration's signed attribute.

Returns
value of signed attribute.
virtual int CSimpleType::GetTwoState ( ) const
virtual

Get declaration's 2 state property.

Returns
value of 2 state property.

Implements CDataType.

virtual int CSimpleType::GetUnsignedAttr ( ) const
inlinevirtual

Get declaration's unsigned attribute.

Returns
value of unsigned attribute.
int CSimpleType::GetVectorWidth ( ) const
protected

Get width of vector.

Only valid for vector types

Returns
width of vector in bits.
virtual int CSimpleType::IsBaseWidthConstant ( void  ) const
inlinevirtual

Determine if base width (sans packed dimensions) of declaration is constant, ie dependent upon only constants and parameters.

Returns
non-zero if vector or packed width of declaration is constant.

Implements CDataType.

virtual int CSimpleType::IsBaseWidthEvaluateable ( void  ) const
inlinevirtual

Determine if base width (sans packed dimensions) of declaration can be evaluated.

Returns
non-zero of packed or vector width of declaration can be evaluated.

Implements CDataType.

virtual int CSimpleType::IsBaseWidthVolatile ( void  ) const
inlinevirtual

Determine if base width (sans packed dimensions) of declaration is volatile, ie depend upon parameters or variables.

Returns
non-zero of vector or packed width of declaration is volatile.

Implements CDataType.

virtual int CSimpleType::IsPacked ( ) const
virtual

Determine if complete data structure is packed.

Packed data structures can be treated as a single vector.

Returns
non-zero if complete data structure is packed.

Implements CDataType.

virtual int CSimpleType::IsVector ( ) const
virtual

Determine if complete data structure is a vector.

Vectors are a multi-bit intergal type.

Returns
non-zero if complete data structure is a vector.

Implements CDataType.

virtual int CSimpleType::PackedWidthDirection ( void  ) const
virtual

Evaluate current decl width direction.

Expression must be constant.

Returns
1 - big endian, -1 - little endian, 0 - cannot be determined

Reimplemented from CDataType.

virtual void CSimpleType::SetSignedAttr ( int  v)
inlinevirtual

Set declaration's signed attribute.

Parameters
vvalue of signed attribute.
virtual void CSimpleType::SetUnsignedAttr ( int  v)
inlinevirtual

Set declaration's unsigned attribute.

Parameters
vvalue of unsigned attribute.

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