ACT Library
|
This is the data structure that holds all instances and their associated types within a scope. Each user-defined type has an associated Scope, and so does each ActNamespace. More...
#include <namespaces.h>
Public Member Functions | |
Scope (Scope *parent, int is_expanded=0) | |
~Scope () | |
Scope * | Parent () |
InstType * | Lookup (const char *s) |
InstType * | Lookup (ActId *id, int err=1) |
void | refineBaseType (const char *s, InstType *u) |
InstType * | FullLookup (const char *s) |
int | isGlobal (const char *s) |
InstType * | FullLookup (ActId *id, Array **aref) |
InstType * | localLookup (ActId *id, Array **aref) |
ValueIdx * | LookupVal (const char *s) |
ValueIdx * | FullLookupVal (const char *s) |
int | Add (const char *s, InstType *it) |
void | Del (const char *s) |
void | FlushExpand () |
void | Merge (Scope *s) |
void | Print (FILE *fp) |
void | setUserDef (UserDef *_u) |
void | mkFunction () |
int | isFunction () |
UserDef * | getUserDef () |
void | setNamespace (ActNamespace *_ns) |
ActNamespace * | getNamespace () |
unsigned long | AllocPInt (int count=1) |
void | DeallocPInt (unsigned long idx, int count=1) |
void | setPInt (unsigned long id, unsigned long val) |
int | issetPInt (unsigned long id) |
unsigned long | getPInt (unsigned long id) |
unsigned long | AllocPInts (int count=1) |
void | DeallocPInts (unsigned long idx, int count=1) |
int | issetPInts (unsigned long id) |
long | getPInts (unsigned long id) |
void | setPInts (unsigned long id, long val) |
unsigned long | AllocPReal (int count=1) |
void | DeallocPReal (unsigned long idx, int count=1) |
int | issetPReal (unsigned long id) |
double | getPReal (unsigned long id) |
void | setPReal (unsigned long id, double val) |
unsigned long | AllocPBool (int count=1) |
void | DeallocPBool (unsigned long idx, int count=1) |
int | issetPBool (unsigned long id) |
int | getPBool (unsigned long id) |
void | setPBool (unsigned long id, int val) |
unsigned long | AllocPType (int count=1) |
void | DeallocPType (unsigned long idx, int count=1) |
int | issetPType (unsigned long id) |
InstType * | getPType (unsigned long id) |
void | setPType (unsigned long id, InstType *val) |
int | isExpanded () |
void | BindParam (const char *s, InstType *tt) |
void | BindParam (ActId *id, InstType *tt) |
void | BindParam (const char *s, AExpr *ae) |
void | BindParam (ActId *id, AExpr *ae) |
void | BindParam (ActId *id, AExprstep *aes, int idx=-1) |
void | playBody (ActBody *b) |
const char * | getName () |
Static Public Member Functions | |
static void | printConnections (FILE *fp, act_connection *cx, bool force=false) |
Private Member Functions | |
A_DECL (unsigned long, vpint) | |
A_DECL (long, vpints) | |
A_DECL (double, vpreal) | |
A_DECL (InstType *, vptype) | |
Private Attributes | |
struct Hashtable * | H |
Scope * | up |
UserDef * | u |
unsigned int | expanded:1 |
ActNamespace * | ns |
int | is_function |
bitset_t * | vpint_set |
bitset_t * | vpints_set |
bitset_t * | vpreal_set |
bitset_t * | vptype_set |
unsigned long | vpbool_len |
bitset_t * | vpbool |
bitset_t * | vpbool_set |
Friends | |
class | ActInstiter |
class | ActUniqProcInstiter |
This is the data structure that holds all instances and their associated types within a scope. Each user-defined type has an associated Scope, and so does each ActNamespace.
Scopes also know about their parent (enclosing) scope. So a process definition would have a scope whose parent is the scope of the namespace in which it is defined. A namespace scope would have a parent scope that is the namespace within which it was created. The top-level scope of the entire design is the built-in global namespace.
Scopes can be either expanded or unexpanded. Expanded scopes and unexpanded scopes have different internals.
Scope::Scope | ( | Scope * | parent, |
int | is_expanded = 0 |
||
) |
parent | is the parent scope for this namespace |
is_expanded | is 1 if this is an expanded scope, 0 otherwise |
Scope::~Scope | ( | ) |
|
private |
|
private |
|
private |
|
private |
int Scope::Add | ( | const char * | s, |
InstType * | it | ||
) |
Add a new identifier to the scope.
s | is a string corresponding to the identifier being added to the scope |
it | is the instantiation type |
unsigned long Scope::AllocPBool | ( | int | count = 1 | ) |
Like AllocPInt(), but for pbools
unsigned long Scope::AllocPInt | ( | int | count = 1 | ) |
Allocate space to hold a pint in the scope
count | is the number of pints to allocate |
unsigned long Scope::AllocPInts | ( | int | count = 1 | ) |
unsigned long Scope::AllocPReal | ( | int | count = 1 | ) |
Like AllocPInt(), but for preals
unsigned long Scope::AllocPType | ( | int | count = 1 | ) |
Like AllocPInt(), but for ptypes
Bind a name to the array expression
id | is the name |
ae | is the array expression |
Bind a name to a type. Must be a local name
id | is the name |
tt | is the type to use |
void Scope::BindParam | ( | const char * | s, |
AExpr * | ae | ||
) |
Bind a name to the array expression
s | is the name to be set |
ae | contains the array expression |
void Scope::BindParam | ( | const char * | s, |
InstType * | tt | ||
) |
Bind a name to a type. Allocates space for it if needed.
s | is the name |
tt | is the type to bind to the name |
void Scope::DeallocPBool | ( | unsigned long | idx, |
int | count = 1 |
||
) |
Like DeallocPInt(), but for pbools
void Scope::DeallocPInt | ( | unsigned long | idx, |
int | count = 1 |
||
) |
De-allocate pints starting from the index. This only works if you are de-allocating from the end of the allocated pint array. Otherwise it is silently ignored.
idx | is index at which to de-allocate |
count | is the number to deallocate |
void Scope::DeallocPInts | ( | unsigned long | idx, |
int | count = 1 |
||
) |
void Scope::DeallocPReal | ( | unsigned long | idx, |
int | count = 1 |
||
) |
Like DeallocPInt(), but for preals
void Scope::DeallocPType | ( | unsigned long | idx, |
int | count = 1 |
||
) |
Like DeallocPInt(), but for ptypes
void Scope::Del | ( | const char * | s | ) |
Delete a name from the current scope. This is used to delete loop index variables.
s | is the name to be deleted. |
void Scope::FlushExpand | ( | ) |
Clear the scope table, and mark this as an expanded scope.
To a complete lookup of the ActId. The (possibly NULL) array reference at the end of the ID is returned in aref, if aref is non-NULL.
id | is the identifier to be looked up in the current scope (and its parents if necessary) |
aref | is used to return the array specifier in the ID |
InstType * Scope::FullLookup | ( | const char * | s | ) |
Similar to lookup, but instead of just looking in the local scope also look at the parent scopes as well—i.e. any visible scope where the name can be found
s | is the name to be looked up |
ValueIdx * Scope::FullLookupVal | ( | const char * | s | ) |
Like LookupVal(), but also looks in the parent scope if you can't find the specified name in the current scope.
s | is the name to lookup |
const char * Scope::getName | ( | ) |
|
inline |
int Scope::getPBool | ( | unsigned long | id | ) |
Like getPInt(), but for pbools
unsigned long Scope::getPInt | ( | unsigned long | id | ) |
id | is the index of the pint |
long Scope::getPInts | ( | unsigned long | id | ) |
double Scope::getPReal | ( | unsigned long | id | ) |
Like getPInt(), but for preals
|
inline |
|
inline |
|
inline |
Check if this is a function scope
int Scope::isGlobal | ( | const char * | s | ) |
Do a lookup and see if the lookup succeeded in a namespace or in a user-defined type
s | is the name to be looked up |
int Scope::issetPBool | ( | unsigned long | id | ) |
Like issetPInt(), but for pbools
int Scope::issetPInt | ( | unsigned long | id | ) |
Check if the pint is in fact set
id | is the index of the pint |
int Scope::issetPInts | ( | unsigned long | id | ) |
int Scope::issetPReal | ( | unsigned long | id | ) |
Like issetPInt(), but for preals
int Scope::issetPType | ( | unsigned long | id | ) |
Like issetPInt(), but for ptypes
Only looks in the current scope for the ID. However, the type returned is the actual type of the full ID (not just the root), and aref is used to return any array reference associated with the specified id.
id | is the ID to lookup in the local scope |
aref | returns the array reference in the id, if any |
Similar to Lookup(), but takes an ActId as a parameter. Only looks up the root of the identifier. By default this reports an error if the ActId has a sub-identifier. This error is suppressed by the err flag.
id | the ActId to lookup in the local scope |
err | 1 if a fatal error should be reported, 0 to ignore the error |
InstType * Scope::Lookup | ( | const char * | s | ) |
Lookup an identifier in the specified scope only. Restrict the scope to a local lookup—don't look in parent scopes.
s | is the name to lookup |
ValueIdx * Scope::LookupVal | ( | const char * | s | ) |
void Scope::Merge | ( | Scope * | s | ) |
Merge in instances into the scope. This must be called before any other instances have been created.
|
inline |
Use to indicate that this scope is part of a function
|
inline |
void Scope::playBody | ( | ActBody * | b | ) |
Create instances given the body
b | is the body to be processed. |
void Scope::Print | ( | FILE * | fp | ) |
Print out the scope
fp | is the output file |
|
static |
Print the connections specified by the cx pointer. Normally this only prints the essential connections—i.e. if cx is a primary. The force flag can be used to override this, forcing redundant connections to be printed.
fp | is the output file |
cx | is the connection |
force | is used to force the printing of non-primary connections |
void Scope::refineBaseType | ( | const char * | s, |
InstType * | u | ||
) |
Look up the local variable specified, and if it exists then refine its base type using the new type information. Used to update scope tables while processing overrides.
s | is the name of the instance whose type is to be updated |
u | is the updated type for the instance |
|
inline |
Set the namespace associated with this scope
_ns | is the namespace to be associated with the scope |
void Scope::setPBool | ( | unsigned long | id, |
int | val | ||
) |
Like setPInt(), but for pbools
void Scope::setPInt | ( | unsigned long | id, |
unsigned long | val | ||
) |
Set the pint at index id to the specified value
id | is the index of the pint |
val | is the value to set |
void Scope::setPInts | ( | unsigned long | id, |
long | val | ||
) |
void Scope::setPReal | ( | unsigned long | id, |
double | val | ||
) |
Like setPInt(), but for preals
|
inline |
Associate scope with a user defined type.
_u | is the user-defined type to be associated with this scope |
|
friend |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |