ACT Library
|
The main ActPass class used to implement an ACT analysis/synthesis pass. All the core tools use this framework to operate on the ACT data structures. Passes are called once the design has been expanded. More...
#include <act.h>
Public Member Functions | |
ActPass (Act *_a, const char *name, int doroot=0) | |
virtual | ~ActPass () |
release storage | |
void | update (Process *p) |
int | rundeps (Process *p=NULL) |
const char * | getName () |
virtual int | run (Process *p=NULL) |
int | completed () |
int | pending () |
void * | getMap (UserDef *u) |
void * | getGlobalInfo () |
Act * | getAct () |
ActPass * | getPass (const char *name) |
Process * | getRoot () |
virtual void | run_recursive (Process *p=NULL, int mode=0) |
void | disableUpdate () |
void | enableUpdate () |
void | mkStickyVisited () |
void | clrStickyVisited () |
Static Public Member Functions | |
static void | refreshAll (Act *a, Process *p=NULL) |
Protected Member Functions | |
virtual void | _actual_update (Process *p) |
int | AddDependency (const char *pass) |
Protected Attributes | |
int | _finished |
has the pass finished execution? | |
int | _sticky_visited |
Act * | a |
list_t * | deps |
list_t * | fwdeps |
const char * | name |
the name for the pass | |
int | _update_propagate |
int | _root_dirty |
Process * | _root |
the root of the design | |
void * | _global_info |
Private Member Functions | |
virtual void * | pre_op (Process *p, int mode=0) |
virtual void * | pre_op (Channel *c, int mode=0) |
virtual void * | pre_op (Data *d, int mode=0) |
virtual void * | local_op (Process *p, int mode=0) |
virtual void * | local_op (Channel *c, int mode=0) |
virtual void * | local_op (Data *d, int mode=0) |
virtual void | free_local (void *) |
int | init () |
initialize or re-initialize | |
void | recursive_op (UserDef *p, int mode=0) |
void | init_map () |
void | free_map () |
Private Attributes | |
std::map< UserDef *, void * > * | pmap |
std::unordered_set< UserDef * > * | visited_flag |
The main ActPass class used to implement an ACT analysis/synthesis pass. All the core tools use this framework to operate on the ACT data structures. Passes are called once the design has been expanded.
The basic operation of a pass can modify the internals of a user-defined type, and/or compute some auxillary information that is saved away in a data structure that is indexed by the user-defined type pointer. This data can be accessed after a pass has been run.
A pass operates recursively on the design/type hierarchy. If a user-defined type instantiates another user-defined type, then the types for each instance are processed before the parent type. Hence, information computed about the instances are available to the parent. Each user-defined type that is part of the design hierarchy is visited exactly once during the design traversal.
A pass can also depend on information computed by another pass. These dependencies are explicitly specified in the pass constructor using the AddDependency() call. This tracks both forward and backward dependencies—i.e. other passes that depend on the ActPass, and other passes that the ActPass depend on. A cyclic dependency is detected and reported as an error.
When a pass is run via ActPass::run() , any of its dependencies are automatically executed (if they have not already been run). Additionally, it is possible for a pass to run any passes that depend on what has been re-computed via the ActPass::update() call.
The standard passes that are included in the core ACT library are documented in the Act Pass library documentation.
ActPass::ActPass | ( | Act * | _a, |
const char * | name, | ||
int | doroot = 0 |
||
) |
Create, initialize, and register pass A pass sets "doroot" to 1 if any update to a process propagates all the way back up to the root of the design.
_a | the Act data structure where this pass should be added |
name | the name of the pass |
doroot | should be set to 1 if any updates must propagate from the root of the entire design, rather than from the updated process. |
|
virtual |
release storage
|
protectedvirtual |
This performs the actual pass re-computation for a particular process
p | is the process whose pass data is to be recomputed |
|
protected |
This function sould only be called in the constructor. It specifies that execution of the pass depends on data/transformations from another ActPass. This dependency is added to the dependency-tracking mechanism built-into the ActPass structures.
pass | is the name of the other ActPass this one depends on |
|
inline |
Clear the sticky visited flag (see ActPass::_sticky_visited)
|
inline |
|
inline |
Disables update propagation (see ActPass::update()).
|
inline |
Enables update propagation (see ActPass::update()).
|
privatevirtual |
Free the data structure allocated by calls to pre_op()/local_op().
Reimplemented in ActDynamicPass, ActBooleanizePass, ActCellPass, ActCHPMemory, ActCHPArbiter, ActCHPFuncInline, ActSizingPass, ActStatePass, and ActNetlistPass.
|
private |
free memory associated with the user-defined type to data map
|
inline |
void * ActPass::getMap | ( | UserDef * | u | ) |
A pass computes a per-process data structure, and this method used to access it.
u | is the user-defined type whose information is to be queried |
const char * ActPass::getName | ( | ) |
Used to determine which pass this might be.
|
inline |
|
inline |
|
private |
initialize or re-initialize
|
private |
initialize/re-initialize the map from user-defined types to the associated data structure
|
privatevirtual |
Same as local_op() for processes, except for channels.
c | is the channel type |
mode | is the mode flag passed to this call. |
Reimplemented in ActDynamicPass, and ActApplyPass.
|
privatevirtual |
Same as local_op() for processes, except for data types
d | is the data type |
mode | is the mode flag passed to this call. |
Reimplemented in ActDynamicPass, and ActApplyPass.
|
privatevirtual |
This function is called exactly once per process that is reachable from the root of the pass. It is called after all the types instantiated within the process are visited.
p | is the process type |
mode | is the mode flag passed to this call. |
Reimplemented in ActDynamicPass, ActApplyPass, ActBooleanizePass, ActCellPass, ActCHPMemory, ActCHPArbiter, ActCHPFuncInline, ActNetlistPass, ActSizingPass, and ActStatePass.
|
inline |
Set the sticky visited flag (see ActPass::_sticky_visited)
|
inline |
|
privatevirtual |
Same as pre_op() for processes, but for channels.
c | is the channel type |
mode | is the mode flag passed to this call. |
|
privatevirtual |
Same as pre_op() for processes, but for data types.
d | is the data type |
mode | is the mode flag passed to this call. |
|
privatevirtual |
This function is called exactly once per process that is reachable from the root of the pass. It is called before any types instantiated within the process are visited.
p | is the process type |
mode | is the mode flag passed to this call. |
|
private |
does the actual work for run_recursive()
This forces a complete recomputation of all passes that have been run so far.
a | is the Act design pointer |
p | is the process from which the recomputation is triggered. |
|
virtual |
Run the entire pass with the specified top-level process name
p | is the tyoe of the top-level process; NULL means that the top-level of the design is the global namespace and not a specific process. |
Reimplemented in ActDynamicPass, ActBooleanizePass, ActCellPass, ActCHPMemory, ActCHPArbiter, ActCHPFuncInline, ActApplyPass, ActNetlistPass, ActSizingPass, and ActStatePass.
|
virtual |
This is the core recursive call that is used to traverse the design hierarchy. It is invoked with the root of the design hierarchy, and operates recursively visiting each type once. Note that this does not invoke any dependencies of this pass; that functionality is provided by ActPass::run() only.
The mode parameter is passed along so that different actions can be implemented in a single pass, selected by the mode. When ActPass::run() is called, it eventually calls this function with mode set to 0. Negative modes are used internally by the library, so they should not be used.
p | is the process for the recursive traversal |
mode | is a parameter passed to the leaf call. |
Reimplemented in ActDynamicPass.
int ActPass::rundeps | ( | Process * | p = NULL | ) |
Run all passes that this one depends on.
p | is the process that is the root of the design where dependencies are computed. |
void ActPass::update | ( | Process * | p | ) |
Propagate the updates from the current pass to all passes that have previously been run and that are dependencies of this pass (either direct or indirect). This function runs all downstream dependencies in topological order. Passes with updates suppressed are omitted from the update operation.
p | is the process in the design that was updated. |
|
protected |
has the pass finished execution?
|
protected |
this space is for rent. It is used by the decomposition passes to save away type information.
|
protected |
the root of the design
|
protected |
if this flag is set, then even if an update propagates from a certain process in the design hierarchy, it influences the entire design so all data computed for all components of the design must be re-computed.
|
protected |
sticky visited flag. Normally when a pass is run, it keeps track of types that have been visited. When the run is complete, all the visited flags are cleared. Setting this flag forces the pass to preserve the visited flags across multiple runs. This is useful when used in conjunction with run_recursive(). In particular it is used when multiple run_recursive() calls are made rather than a single call at the root of the design hierarchy.
|
protected |
flag used to suppress updates from propagating. The default is 1, which means any updates will automatically propagate.
|
protected |
main act data structure to which the pass is linked
|
protected |
ActPass dependencies: these are passes that must be run prior to the pass being executed.
|
protected |
passes that depend on me. These are passes whose operation might be influenced by the computation from this pass.
|
protected |
the name for the pass
|
private |
the map from user-defined types to the data structure returned by local_op()/pre_op().
|
private |
used to keep track of what types have been visited so far.