vrq
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
CDecl Class Referenceabstract

Base class for describing declaration objects. More...

#include <cdecl.h>

Inheritance diagram for CDecl:
CObject CAttr CBlock CFref CGate CGenvar CInstance CMacro CNet CParam CPort CPortDir CVar

Public Types

enum  Flag { eFLAG_NONE = 0, eFLAG_PRAGMA = 1, eFLAG_ARRAY = 2, eFLAG_DATATYPE = 4 }
 

Public Member Functions

virtual CDeclClone (CObstack *heap)=0
 Create a deep copy of declaration. More...
 
virtual void SetDataType (CDataType *dt)
 Set declartion's data type property. More...
 
virtual CDataTypeGetDataType ()
 Get declartion's data type property. More...
 
virtual void SetWireAttr (Wire_t v)
 Set declaration's wire attribute. More...
 
virtual Wire_t GetWireAttr ()
 Get declartion's wire type property. More...
 
virtual int IsWidthConstant (void) const
 Determine if packed width of declaration is constant, ie dependent upon only constants and parameters. More...
 
virtual int IsWidthVolatile (void) const
 Determine if packed width of declaration is volatile, ie depend upon parameters or variables. More...
 
virtual int IsWidthEvaluateable (void) const
 Determine if packed width of declaration can be evaluated. More...
 
virtual INT32 GetWidth (void) const
 Evaluate packed width of declaration. More...
 
virtual CNodeGetWidthExp (void) const
 Get expression representing width of declaration. More...
 
virtual CNodeGetMsb () const
 Get expression for declaration's msb. More...
 
virtual CNodeGetLsb () const
 Get expression for declaration's lsb. More...
 
virtual int WidthDirection (void) const
 Evaluate current decl width direction. More...
 
virtual INT32 GetNumberOfUnpackedDimensions (void)
 Get number of unpacked dimensions of declaration. More...
 
virtual CNodeGetUnpackedMsi (INT32 dim)
 Get expression tree for upper limit of given packed array dimension. More...
 
virtual CNodeGetUnpackedLsi (INT32 dim)
 Get expression tree for lower limit of unpacked array dimension. More...
 
virtual void SetNumberOfUnpackedDimensions (INT32 dim)
 Set number of unpacked dimensions for declaration. More...
 
virtual CNodeGetUnpackedRange (INT32 dim)
 Get expression for range of array for dimension. More...
 
virtual void SetUnpackedRange (INT32 dim, CNode *v)
 Set expression for range of unpacked array for declaration. More...
 
virtual void SetConstAttr (int v)
 Set declaration's const attribute. More...
 
virtual int GetConstAttr ()
 Get declaration's const attribute. More...
 
virtual void SetVarAttr (int v)
 Set declaration's var attribute. More...
 
virtual int GetVarAttr ()
 Get declaration's var attribute. More...
 
virtual void SetAutomatic (int v)
 Set declaration's automatic property. More...
 
virtual int GetAutomatic ()
 Get declaration's automatic property. More...
 
virtual void SetVectored (int v)
 Set declartion's vectored property. More...
 
virtual int GetVectored ()
 Get declartion's vectored property. More...
 
virtual void SetScalared (int v)
 Set declartion's scalared property. More...
 
virtual int GetScalared ()
 Get declartion's scalared property. More...
 
void SetAttributes (CNode *attr)
 Set declarations's attributes. More...
 
CNodeGetAttributes ()
 Get declaration's attributes. More...
 
int HasAttribute (char *name, CNode *n=NULL, int init=1)
 Determine if declaration has the given attribute. More...
 
NodeType_t GetNodeType (void)
 Get node type of decl. More...
 
Decl_t GetClass (void)
 Get class of declaration. More...
 
void SetDeclStatementCreated (void)
 Set declaration statement created attribute. More...
 
int DeclStatementCreated (void)
 Get declaration statement create attibute. More...
 
Decl_t GetType (void)
 Get declaration type. More...
 
void SetCoord (Coord_t *aLoc)
 Set declaration coordinate. More...
 
Coord_tGetCoord (void)
 Get file coordinates for declaration. More...
 
virtual void Dump (FILE *f)
 Dump declaration info to file descriptor. More...
 
virtual void DumpDeclInfo (FILE *f)
 Dump declaration name, type and location to file descriptor. More...
 
const char * GetName (void)
 Shortcut to get declaration's name. More...
 
void SetSymbol (CSymbol *aSymbol)
 Set declaration's symbol. More...
 
CSymbolGetSymbol (void)
 Get declaration's symbol. More...
 
void SetPragmas (CNode *p)
 Set declaration pragmas. More...
 
CNodeGetPragmas ()
 Get declaration pragmas. More...
 
virtual void PreVisit1 (int(*func)(CNode *, void *), void *data)
 
virtual void PostVisit1 (void(*func)(CNode *, void *), void *data)
 
virtual void PostSubVisit1 (CNode *(*func)(CNode *, void *), void *data)
 
- 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...
 

Static Public Member Functions

static Flag Or (Flag f1, Flag f2)
 
static Flag Or (Flag f1, Flag f2, Flag f3)
 
static void GetMembers (Decl_t type, list< Decl_t > &result)
 Get a list of members of the given declaration class/type. More...
 

Protected Member Functions

 CDecl (CSymbol *aSymbol, Coord_t *aLoc, Decl_t aType, CDataType *dataType, Flag flags)
 Create instance of declaration. More...
 
void Copy (CObstack *heap, const CDecl &o)
 Perform deep copy of given object to this one This should never be call directly, only by subclasses. More...
 

Detailed Description

Base class for describing declaration objects.

Member Enumeration Documentation

Enumerator
eFLAG_NONE 

no support flags

eFLAG_PRAGMA 

declaration accepts pragmas

eFLAG_ARRAY 

declaration can be unpacked array

eFLAG_DATATYPE 

declaration has datatype

Constructor & Destructor Documentation

CDecl::CDecl ( CSymbol aSymbol,
Coord_t aLoc,
Decl_t  aType,
CDataType dataType,
Flag  flags 
)
inlineprotected

Create instance of declaration.

This should never be call directly.

Parameters
aSymboldeclaration for symbol.
aLocfile coordinates of declaration.
aTypedeclaration type.
dataTypedeclaration data type
flagslist of supported constructs.

Member Function Documentation

virtual CDecl* CDecl::Clone ( CObstack heap)
pure virtual

Create a deep copy of declaration.

Parameters
heapheap to use for allocation.
Returns
new declaration.

Implemented in CModule, CBlock, CFref, CInstance, CMacro, CNet, CGate, CVar, CAttr, CParam, CPortDir, CPort, and CGenvar.

void CDecl::Copy ( CObstack heap,
const CDecl 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.
int CDecl::DeclStatementCreated ( void  )
inline

Get declaration statement create attibute.

Returns
non-zero if declaration statement has been created.
virtual void CDecl::Dump ( FILE *  f)
inlinevirtual

Dump declaration info to file descriptor.

Parameters
ffile descriptor.

Reimplemented in CFref, CModule, CBlock, CNet, CParam, CMacro, CAttr, CInstance, CGenvar, CGate, CVar, CFunction, CPortDir, CPort, and CSpecify.

virtual void CDecl::DumpDeclInfo ( FILE *  f)
inlinevirtual

Dump declaration name, type and location to file descriptor.

Parameters
ffile descriptor.
CNode* CDecl::GetAttributes ( )
inline

Get declaration's attributes.

Returns
attribute list.
virtual int CDecl::GetAutomatic ( )
inlinevirtual

Get declaration's automatic property.

Returns
value of automatic property.

Reimplemented in CFunction.

Decl_t CDecl::GetClass ( void  )
inline

Get class of declaration.

Returns
declaration class for this object.
virtual int CDecl::GetConstAttr ( )
inlinevirtual

Get declaration's const attribute.

Returns
value of const attribute.
Coord_t* CDecl::GetCoord ( void  )
inline

Get file coordinates for declaration.

Returns
file coordinates.
virtual CDataType* CDecl::GetDataType ( )
inlinevirtual

Get declartion's data type property.

Returns
value of data type property.
virtual CNode* CDecl::GetLsb ( void  ) const
inlinevirtual

Get expression for declaration's lsb.

Returns
lsb expression, NULL if scalar.

Reimplemented in CParam, and CFref.

static void CDecl::GetMembers ( Decl_t  type,
list< Decl_t > &  result 
)
inlinestatic

Get a list of members of the given declaration class/type.

Parameters
typetype/class of declaration.
resultlist to return members.
virtual CNode* CDecl::GetMsb ( void  ) const
inlinevirtual

Get expression for declaration's msb.

Returns
msb expression, NULL if scalar.

Reimplemented in CParam, and CFref.

const char* CDecl::GetName ( void  )
inline

Shortcut to get declaration's name.

Returns
char pointer to name.
NodeType_t CDecl::GetNodeType ( void  )
inline

Get node type of decl.

Returns
node type of decl.
virtual INT32 CDecl::GetNumberOfUnpackedDimensions ( void  )
inlinevirtual

Get number of unpacked dimensions of declaration.

Returns
number of dimensions, 0 if non-array.
CNode* CDecl::GetPragmas ( )
inline

Get declaration pragmas.

Returns
declaration's pragma list.
virtual int CDecl::GetScalared ( )
inlinevirtual

Get declartion's scalared property.

Returns
value of scalared property.

Reimplemented in CNet.

CSymbol* CDecl::GetSymbol ( void  )
inline

Get declaration's symbol.

Returns
declaration's symbol.
Decl_t CDecl::GetType ( void  )
inline

Get declaration type.

Returns
declaration type.
virtual CNode* CDecl::GetUnpackedLsi ( INT32  dim)
virtual

Get expression tree for lower limit of unpacked array dimension.

Parameters
dimdimension.
Returns
expression tree for unpacked lower limit.
virtual CNode* CDecl::GetUnpackedMsi ( INT32  dim)
virtual

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

Parameters
dimdimension.
Returns
expression tree for unpacked upper limit.
virtual CNode* CDecl::GetUnpackedRange ( INT32  dim)
inlinevirtual

Get expression for range of array for dimension.

Parameters
dimdimension to get.
Returns
range expression for limit.
virtual int CDecl::GetVarAttr ( )
inlinevirtual

Get declaration's var attribute.

Returns
value of var attribute.
virtual int CDecl::GetVectored ( )
inlinevirtual

Get declartion's vectored property.

Returns
value of vectored property.

Reimplemented in CNet.

virtual INT32 CDecl::GetWidth ( void  ) const
inlinevirtual

Evaluate packed width of declaration.

Returns
packed width of declaration.
virtual CNode* CDecl::GetWidthExp ( void  ) const
inlinevirtual

Get expression representing width of declaration.

Returns
expression representing width of declaration.

Reimplemented in CGenvar.

virtual Wire_t CDecl::GetWireAttr ( )
inlinevirtual

Get declartion's wire type property.

Returns
value of wire type property.
int CDecl::HasAttribute ( char *  name,
CNode n = NULL,
int  init = 1 
)

Determine if declaration has the given attribute.

Parameters
namename of attribute to search for.
ndon't supply this argument.
initdon't supply this argument.
virtual int CDecl::IsWidthConstant ( void  ) const
inlinevirtual

Determine if packed width of declaration is constant, ie dependent upon only constants and parameters.

Returns
non-zero of packed width of declaration is constant.
virtual int CDecl::IsWidthEvaluateable ( void  ) const
inlinevirtual

Determine if packed width of declaration can be evaluated.

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

Reimplemented in CGenvar.

virtual int CDecl::IsWidthVolatile ( void  ) const
inlinevirtual

Determine if packed width of declaration is volatile, ie depend upon parameters or variables.

Returns
non-zero of packed width of declaration is volatile.
static Flag CDecl::Or ( Flag  f1,
Flag  f2 
)
inlinestatic
static Flag CDecl::Or ( Flag  f1,
Flag  f2,
Flag  f3 
)
inlinestatic
virtual void CDecl::PostSubVisit1 ( CNode *(*)(CNode *, void *)  func,
void *  data 
)
virtual

Reimplemented in CPortDir.

virtual void CDecl::PostVisit1 ( void(*)(CNode *, void *)  func,
void *  data 
)
virtual

Reimplemented in CPortDir.

virtual void CDecl::PreVisit1 ( int(*)(CNode *, void *)  func,
void *  data 
)
virtual

Reimplemented in CPortDir.

void CDecl::SetAttributes ( CNode attr)
inline

Set declarations's attributes.

Parameters
attrattribute list.
virtual void CDecl::SetAutomatic ( int  v)
inlinevirtual

Set declaration's automatic property.

Use to indicate type is a automatic variable.

Parameters
vvalue to automatic property.
virtual void CDecl::SetConstAttr ( int  v)
inlinevirtual

Set declaration's const attribute.

Use to indicate type is a constant variable.

Parameters
vvalue to const attribute.
void CDecl::SetCoord ( Coord_t aLoc)
inline

Set declaration coordinate.

Parameters
aLocset file coordinates for declaration
virtual void CDecl::SetDataType ( CDataType dt)
inlinevirtual

Set declartion's data type property.

Parameters
dtnew data type property.
void CDecl::SetDeclStatementCreated ( void  )
inline

Set declaration statement created attribute.

Todo:
This call will be deprecated when the Block:Add(*) is removed.
virtual void CDecl::SetNumberOfUnpackedDimensions ( INT32  dim)
inlinevirtual

Set number of unpacked dimensions for declaration.

Parameters
dimnumber of unpacked dimensions.
void CDecl::SetPragmas ( CNode p)
inline

Set declaration pragmas.

Parameters
ppragma list.
virtual void CDecl::SetScalared ( int  v)
inlinevirtual

Set declartion's scalared property.

Parameters
vvalue of scalared property.

Reimplemented in CNet.

void CDecl::SetSymbol ( CSymbol aSymbol)
inline

Set declaration's symbol.

Parameters
aSymbolnew symbol for declaration.
virtual void CDecl::SetUnpackedRange ( INT32  dim,
CNode v 
)
inlinevirtual

Set expression for range of unpacked array for declaration.

Parameters
dimdimension to set.
vrange expression for limit.
virtual void CDecl::SetVarAttr ( int  v)
inlinevirtual

Set declaration's var attribute.

Use to indicate type was declared with var keyword.

Parameters
vvalue to var attribute.
virtual void CDecl::SetVectored ( int  v)
inlinevirtual

Set declartion's vectored property.

Parameters
vvalue of vectored property.

Reimplemented in CNet.

virtual void CDecl::SetWireAttr ( Wire_t  v)
inlinevirtual

Set declaration's wire attribute.

Parameters
vwire type
virtual int CDecl::WidthDirection ( void  ) const
inlinevirtual

Evaluate current decl width direction.

Expression must be constant.

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

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