vrq
Public Member Functions | Static Public Member Functions | List of all members
CFunction Class Reference

Declaration object for functions and tasks. More...

#include <cfunction.h>

Inheritance diagram for CFunction:
CBlock CDecl CObject

Public Member Functions

 CFunction (CSymbol *symbol, Coord_t *aLoc, int automatic)
 Create function/task declaration object. More...
 
virtual void Dump (FILE *f)
 Dump function info to file descriptor. More...
 
virtual vector< CPortDir * > * GetPortDirList ()
 Get array of port declarations. More...
 
void SetPorts (CNode *n)
 Set function port list. More...
 
CNodeGetPorts ()
 Get function port list. More...
 
int InlinePortDecls ()
 Get inline declaration attribute. More...
 
void InlinePortDecls (int v)
 Set inline declaration attribute. More...
 
void SetOutput (CDecl *output)
 Set output declaration for function. More...
 
CDeclGetOutput ()
 Get output declaration. More...
 
int GetAutomatic ()
 Get automatic attribute. More...
 
- Public Member Functions inherited from CBlock
 CBlock (CSymbol *name, Coord_t *aLoc)
 Constructor for BLOCK declarations. More...
 
 CBlock (CSymbol *name, Coord_t *aLoc, Decl_t dtype)
 Constructor for BLOCK declarations. More...
 
virtual ~CBlock ()
 Object destructor. More...
 
virtual CDeclClone (CObstack *heap)
 Create a clone of this declaration. More...
 
virtual void Add (CInstance *instance)
 
virtual void Add (CParam *param)
 
virtual void Add (CNet *net)
 
virtual void Add (CVar *var)
 
virtual void Add (CBlock *child)
 
virtual void Add (CFref *fref)
 
virtual void Add (CGenvar *genvar)
 
virtual void Add (CNode *code)
 Add parse tree code to this block. More...
 
void SetParent (CBlock *parent)
 Set this block's parent block. More...
 
CBlockGetParent (void)
 Get this block's parent block. More...
 
void SetTrailingLabel (CSymbol *s)
 Set this block's end label. More...
 
CSymbolGetTrailingLabel (void)
 Get this block's end label. More...
 
vector< CNet * > * GetNetList ()
 Get list of object's nets. More...
 
vector< CVar * > * GetVarList ()
 Get list of object's registers. More...
 
vector< CParam * > * GetParamList ()
 Get list of object's parameters. More...
 
vector< CGenvar * > * GetGenvarList ()
 Get list of object's genvars. More...
 
virtual vector< CInstance * > * GetInstanceList ()
 Get list if module instances. More...
 
virtual CNodeGetCodeList ()
 Get blocks parse tree. More...
 
virtual void SetCodeList (CNode *list)
 Set block's parse tree. More...
 
vector< CBlock * > * GetChildList ()
 Get list of block's child blocks. More...
 
virtual void SetSymtab (CSymtab< CDecl > &symtab)
 Set block's symbol table. More...
 
virtual CSymtab< CDecl > & GetSymtab ()
 Get block's symbol table. More...
 
- Public Member Functions inherited from CDecl
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 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...
 
const char * GetTypeName (void)
 Get declaration type as a string. More...
 
void SetCoord (Coord_t *aLoc)
 Set declaration coordinate. More...
 
Coord_tGetCoord (void)
 Get file coordinates for declaration. 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 int Width (CSymbol *symbol, CNode *args, CBlock *block)
 Get width of function. More...
 
static CNodeWidthExp (CSymbol *symbol, CNode *args, CBlock *block)
 Get width of function as an expression. More...
 
static int WidthConstant (CSymbol *symbol, CNode *args, CBlock *block)
 Determine if width of function is constant. More...
 
static int WidthVolatile (CSymbol *symbol, CNode *args, CBlock *block)
 Determine if width of function is volatile. More...
 
static int WidthEvaluateable (CSymbol *symbol, CNode *args, CBlock *block)
 Determine if width of function is evaluateable. More...
 
static NodeType_t Type (CSymbol *symbol, CNode *args, CBlock *block)
 Determine if type of result of function. More...
 
static int Evaluateable (CSymbol *symbol, CNode *args, CBlock *block)
 Determine if function can be evaluated. More...
 
static void EvalVector (CVector &v, CSymbol *symbol, CNode *args, CBlock *block)
 Evaluate function as a vector and return result. More...
 
static double EvalReal (CSymbol *symbol, CNode *args, CBlock *block)
 Evaluate function as a real and return result. More...
 
- Static Public Member Functions inherited from CDecl
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...
 

Additional Inherited Members

- Public Types inherited from CDecl
enum  Flag { eFLAG_NONE = 0, eFLAG_PRAGMA = 1, eFLAG_ARRAY = 2, eFLAG_DATATYPE = 4 }
 
- Protected Member Functions inherited from CDecl
 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...
 
- Protected Attributes inherited from CBlock
vector< CParam * > paramList
 
vector< CVar * > varList
 
vector< CGenvar * > genvarList
 
vector< CFref * > frefList
 
vector< CNet * > netList
 
vector< CInstance * > instanceList
 list of module instances. More...
 
CBlockparent
 
vector< CBlock * > children
 
CSymtab< CDeclsymtab
 
CSymboltrailingLabel
 

Detailed Description

Declaration object for functions and tasks.

Constructor & Destructor Documentation

CFunction::CFunction ( CSymbol symbol,
Coord_t aLoc,
int  automatic 
)

Create function/task declaration object.

Parameters
symbolname of function/task.
aLocfile coordinates of declaration.
automaticnon-zero if function is automatic.

Member Function Documentation

virtual void CFunction::Dump ( FILE *  f)
virtual

Dump function info to file descriptor.

Parameters
ffile descriptor.

Reimplemented from CBlock.

static double CFunction::EvalReal ( CSymbol symbol,
CNode args,
CBlock block 
)
static

Evaluate function as a real and return result.

Parameters
symbolname of function.
argsfunction argument list
blockscope of function instantation
Returns
result of function evaluation
static int CFunction::Evaluateable ( CSymbol symbol,
CNode args,
CBlock block 
)
static

Determine if function can be evaluated.

Parameters
symbolname of function.
argsfunction argument list
blockscope of function instantation
Returns
non-zero if function can be evaluated
static void CFunction::EvalVector ( CVector v,
CSymbol symbol,
CNode args,
CBlock block 
)
static

Evaluate function as a vector and return result.

Parameters
vcontainer for result
symbolname of function.
argsfunction argument list
blockscope of function instantation
int CFunction::GetAutomatic ( )
inlinevirtual

Get automatic attribute.

Returns
non-zero if function has been declare with automatic attribute.

Reimplemented from CDecl.

CDecl* CFunction::GetOutput ( )
inline

Get output declaration.

Returns
output declaration.
virtual vector<CPortDir*>* CFunction::GetPortDirList ( )
virtual

Get array of port declarations.

Returns
vector of portdir declarations.

Reimplemented from CBlock.

CNode* CFunction::GetPorts ( )
inline

Get function port list.

Returns
port list.
int CFunction::InlinePortDecls ( )
inline

Get inline declaration attribute.

Returns
non-zero if port declarations are inline.
void CFunction::InlinePortDecls ( int  v)
inline

Set inline declaration attribute.

Parameters
vnon-zero if port declarations are inline.
void CFunction::SetOutput ( CDecl output)
inline

Set output declaration for function.

Parameters
outputoutput declaration.
void CFunction::SetPorts ( CNode n)
inline

Set function port list.

Parameters
nport list.
static NodeType_t CFunction::Type ( CSymbol symbol,
CNode args,
CBlock block 
)
static

Determine if type of result of function.

Todo:
This routine needs to be implemented to support proper evaluation of constant functions.
Parameters
symbolname of function.
argsfunction argument list
blockscope of function instantation
Returns
type of return result of function.
static int CFunction::Width ( CSymbol symbol,
CNode args,
CBlock block 
)
static

Get width of function.

Todo:
This routine needs to be implemented to support proper evaluation of constant functions.
Parameters
symbolname of function.
argsfunction argument list
blockscope of function instantation
Returns
width of function.
static int CFunction::WidthConstant ( CSymbol symbol,
CNode args,
CBlock block 
)
static

Determine if width of function is constant.

ie dependent upon constants and parameters only.

Todo:
This routine needs to be implemented to support proper evaluation of constant functions.
Parameters
symbolname of function.
argsfunction argument list
blockscope of function instantation
Returns
non-zero of function's width is constant.
static int CFunction::WidthEvaluateable ( CSymbol symbol,
CNode args,
CBlock block 
)
static

Determine if width of function is evaluateable.

Todo:
This routine needs to be implemented to support proper evaluation of constant functions.
Parameters
symbolname of function.
argsfunction argument list
blockscope of function instantation
Returns
non-zero of function's width is evaluateable.
static CNode* CFunction::WidthExp ( CSymbol symbol,
CNode args,
CBlock block 
)
static

Get width of function as an expression.

Todo:
This routine needs to be implemented to support proper evaluation of constant functions.
Parameters
symbolname of function.
argsfunction argument list
blockscope of function instantation
Returns
width expression.
static int CFunction::WidthVolatile ( CSymbol symbol,
CNode args,
CBlock block 
)
static

Determine if width of function is volatile.

ie dependent upon variables and parameters.

Todo:
This routine needs to be implemented to support proper evaluation of constant functions.
Parameters
symbolname of function.
argsfunction argument list
blockscope of function instantation
Returns
non-zero of function's width is volatile.

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