ACT Library
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Function Class Reference

This holds information about ACT functions. ACT functions are of two types: More...

#include <types.h>

Inheritance diagram for Function:
UserDef Type

Public Member Functions

 Function (UserDef *u)
 
 ~Function ()
 
void setRetType (InstType *i)
 
InstTypegetRetType ()
 
FunctionExpand (ActNamespace *ns, Scope *s, int nt, inst_param *u)
 
void Print (FILE *fp)
 
Expreval (ActNamespace *ns, int nargs, Expr **args)
 
Expr ** toInline (int nargs, Expr **args)
 
int isExternal ()
 
int isSimpleInline ()
 
void chkInline ()
 
- Public Member Functions inherited from UserDef
 UserDef (ActNamespace *ns)
 
 UserDef (UserDef *x)
 
virtual ~UserDef ()
 destructor, releases storage
 
const char * getFile ()
 
void setFile (const char *s)
 
int getLine ()
 
void setLine (int num)
 
int IsExported ()
 
void MkExported ()
 
int isExpanded () const
 
int AddMetaParam (InstType *t, const char *id)
 
int AddPort (InstType *t, const char *id)
 
int FindPort (const char *id)
 
const char * getPortName (int pos) const
 
InstTypegetPortType (int pos) const
 
void refinePortType (int pos, InstType *u)
 
const char * getName ()
 
char * getFullName ()
 
void printActName (FILE *fp)
 
int isEqual (const Type *t) const
 
void setName (const char *s)
 
void MkCopy (UserDef *u)
 
int isEqual (const UserDef *u) const
 
void SetParent (InstType *t)
 
InstTypegetParent () const
 
int isDefined ()
 
void MkDefined ()
 
int isPort (const char *name)
 
int getNumParams () const
 
int getRemainingParams () const
 
int getNumPorts () const
 
InstTypeLookup (ActId *id)
 
InstTypeLookup (const char *nm)
 
ScopeCurScope ()
 
int isStrictPort (const char *name)
 
virtual void Print (FILE *)
 
void PrintHeader (FILE *fp, const char *type)
 
void setBody (ActBody *x)
 
void AppendBody (ActBody *x)
 
ActBodygetBody ()
 
UserDefExpand (ActNamespace *, Scope *, int, inst_param *)
 
UserDefExpand (ActNamespace *ns, Scope *s, int nt, inst_param *u, int *cache_hit, int is_process=0)
 
ActNamespacegetns ()
 
InstTyperoot () const
 
act_prsgetprs ()
 
act_specgetspec ()
 
act_languagesgetlang ()
 
int isLeaf ()
 
void mkRefined ()
 
int hasRefinement ()
 
UserMacronewMacro (const char *name)
 
UserMacrogetMacro (const char *name)
 
- Public Member Functions inherited from Type
 Type ()
 
 ~Type ()
 constructor
 
virtual const char * getName ()=0
 destructor
 
virtual TypeExpand (ActNamespace *ns, Scope *s, int nt, inst_param *ip)=0
 
virtual int isEqual (const Type *t) const =0
 

Private Member Functions

void _chk_inline (Expr *e)
 used to check simple inline
 
void _chk_inline (struct act_chp_lang *c)
 used to check simple inline
 

Private Attributes

InstTyperet_type
 holds return type
 
int is_simple_inline
 holds the simple inline flag
 

Additional Inherited Members

- Public Types inherited from Type
enum  direction {
  NONE = 0 , IN = 1 , OUT = 2 , INOUT = 3 ,
  OUTIN = 4
}
 
- Static Public Member Functions inherited from Type
static void Init ()
 
static const char * dirstring (direction d)
 
- Protected Member Functions inherited from UserDef
int emitMacros (FILE *fp)
 
 A_DECL (UserMacro *, um)
 user-defined macros
 
- Protected Attributes inherited from UserDef
InstTypeparent
 implementation relationship, if any
 
unsigned int defined:1
 1 if this has been defined, 0 otherwise
 
unsigned int expanded:1
 1 if this has been expanded, 0 otherwise
 
unsigned int pending:1
 1 if this is currently being expanded, 0 otherwise
 
unsigned int exported:1
 1 if the type is exported, 0 otherwise
 
act_languageslang
 sub-languages within this type
 
int nt
 number of template parameters
 
InstType ** pt
 parameter types
 
const char ** pn
 parameter names
 
int nports
 number of ports
 
InstType ** port_t
 port types
 
const char ** port_n
 port names
 
ScopeI
 instances
 
const char * name
 Name of the user-defined type.
 
ActBodyb
 body of user-defined type
 
ActNamespace_ns
 namespace within which this type is defined
 
UserDefunexpanded
 unexpanded type, if any
 
int level
 default modeling level for the type
 
const char * file
 file name (if known) where this was defined
 
int lineno
 line number (if known) where this was defined
 
int has_refinement
 1 if there is a refinement body
 
int inherited_templ
 number of inherited template parameters
 
inst_param ** inherited_param
 the inherited parameters
 

Detailed Description

This holds information about ACT functions. ACT functions are of two types:

Functions can also be externally defined in C.

Looks like a process. The ActBody consists of a chp body, nothing else.

A function can be one that is amenable to a simple inlining operation. This is the case for any function that does not have an internal loop, since conditional assignments can be converted into a normal expression using the "? : " operator.

Constructor & Destructor Documentation

◆ Function()

Function::Function ( UserDef u)

◆ ~Function()

Function::~Function ( )

Member Function Documentation

◆ _chk_inline() [1/2]

void Function::_chk_inline ( Expr e)
private

used to check simple inline

◆ _chk_inline() [2/2]

void Function::_chk_inline ( struct act_chp_lang c)
private

used to check simple inline

◆ chkInline()

void Function::chkInline ( )

This computes the "simple inline" flag

◆ eval()

Expr * Function::eval ( ActNamespace ns,
int  nargs,
Expr **  args 
)

Evaluate the function. This should only be called for parameter functions. The arguments must all be constant values (i.e. already evaluated by the caller).

Parameters
nsis the namespace
nargsare the number of arguments passed into the function
argsis the list of arguments
Returns
the result of evaluating the expression

◆ Expand()

Function * Function::Expand ( ActNamespace ns,
Scope s,
int  nt,
inst_param u 
)
virtual

Expand the function

Reimplemented from UserDef.

◆ getRetType()

InstType * Function::getRetType ( )
inline
Returns
the function return type

◆ isExternal()

int Function::isExternal ( )
Returns
1 if this is an external function, 0 otherwise

◆ isSimpleInline()

int Function::isSimpleInline ( )
inline
Returns
1 if this is a simple inline—an inline that can be expressed as a simple expression.

◆ Print()

void Function::Print ( FILE *  fp)
virtual

Print the function

Reimplemented from UserDef.

◆ setRetType()

void Function::setRetType ( InstType i)
inline

Set the return type for the function

Parameters
iis the return type

◆ toInline()

Expr ** Function::toInline ( int  nargs,
Expr **  args 
)

Symbolic evaluation of a function. Returns an array of expressions. The # of expressions corresponds to the # of flattened components in a structure. This does not work if the function has an internal loop. The isSimpleInline() method can be used to determine if this function can be called.

Parameters
nargsare the number of arguments
argsare the arguments
Returns
the symbolic result

Member Data Documentation

◆ is_simple_inline

int Function::is_simple_inline
private

holds the simple inline flag

◆ ret_type

InstType* Function::ret_type
private

holds return type


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