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

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>

Inheritance diagram for ActPass:
ActApplyPass ActBooleanizePass ActCHPArbiter ActCHPFuncInline ActCHPMemory ActCellPass ActDynamicPass ActNetlistPass ActSizingPass ActStatePass

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 ()
 
ActgetAct ()
 
ActPassgetPass (const char *name)
 
ProcessgetRoot ()
 
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
 
Acta
 
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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ActPass()

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.

Parameters
_athe Act data structure where this pass should be added
namethe name of the pass
dorootshould be set to 1 if any updates must propagate from the root of the entire design, rather than from the updated process.

◆ ~ActPass()

virtual ActPass::~ActPass ( )
virtual

release storage

Member Function Documentation

◆ _actual_update()

virtual void ActPass::_actual_update ( Process p)
protectedvirtual

This performs the actual pass re-computation for a particular process

Parameters
pis the process whose pass data is to be recomputed

◆ AddDependency()

int ActPass::AddDependency ( const char *  pass)
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.

Parameters
passis the name of the other ActPass this one depends on
Returns
should always return 1.

◆ clrStickyVisited()

void ActPass::clrStickyVisited ( )
inline

Clear the sticky visited flag (see ActPass::_sticky_visited)

◆ completed()

int ActPass::completed ( )
inline
Returns
1 if a pass has completed execution, 0 otherwise

◆ disableUpdate()

void ActPass::disableUpdate ( )
inline

Disables update propagation (see ActPass::update()).

◆ enableUpdate()

void ActPass::enableUpdate ( )
inline

Enables update propagation (see ActPass::update()).

◆ free_local()

virtual void ActPass::free_local ( void *  )
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.

◆ free_map()

void ActPass::free_map ( )
private

free memory associated with the user-defined type to data map

◆ getAct()

Act * ActPass::getAct ( )
inline
Returns
the Act pointer that this pass is attached to

◆ getGlobalInfo()

void * ActPass::getGlobalInfo ( )
inline
Returns
the global info field for this pass

◆ getMap()

void * ActPass::getMap ( UserDef u)

A pass computes a per-process data structure, and this method used to access it.

Parameters
uis the user-defined type whose information is to be queried
Returns
the data structure pointer associated with the process

◆ getName()

const char * ActPass::getName ( )

Used to determine which pass this might be.

Returns
the name of the pass

◆ getPass()

ActPass * ActPass::getPass ( const char *  name)
inline
Returns
the pass that has the specified name

◆ getRoot()

Process * ActPass::getRoot ( )
inline
Returns
the design root that this pass was invoked with.

◆ init()

int ActPass::init ( )
private

initialize or re-initialize

◆ init_map()

void ActPass::init_map ( )
private

initialize/re-initialize the map from user-defined types to the associated data structure

◆ local_op() [1/3]

virtual void * ActPass::local_op ( Channel c,
int  mode = 0 
)
privatevirtual

Same as local_op() for processes, except for channels.

Parameters
cis the channel type
modeis the mode flag passed to this call.
Returns
the data structure that is to be associated with this channel

Reimplemented in ActDynamicPass, and ActApplyPass.

◆ local_op() [2/3]

virtual void * ActPass::local_op ( Data d,
int  mode = 0 
)
privatevirtual

Same as local_op() for processes, except for data types

Parameters
dis the data type
modeis the mode flag passed to this call.
Returns
the data structure that is to be associated with this data type

Reimplemented in ActDynamicPass, and ActApplyPass.

◆ local_op() [3/3]

virtual void * ActPass::local_op ( Process p,
int  mode = 0 
)
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.

Parameters
pis the process type
modeis the mode flag passed to this call.
Returns
the data structure that is to be associated with this process

Reimplemented in ActDynamicPass, ActApplyPass, ActBooleanizePass, ActCellPass, ActCHPMemory, ActCHPArbiter, ActCHPFuncInline, ActNetlistPass, ActSizingPass, and ActStatePass.

◆ mkStickyVisited()

void ActPass::mkStickyVisited ( )
inline

Set the sticky visited flag (see ActPass::_sticky_visited)

◆ pending()

int ActPass::pending ( )
inline
Returns
1 if a pass is currently being executed, 0 otherwise

◆ pre_op() [1/3]

virtual void * ActPass::pre_op ( Channel c,
int  mode = 0 
)
privatevirtual

Same as pre_op() for processes, but for channels.

Parameters
cis the channel type
modeis the mode flag passed to this call.
Returns
the data structure that is to be associated with this channel

◆ pre_op() [2/3]

virtual void * ActPass::pre_op ( Data d,
int  mode = 0 
)
privatevirtual

Same as pre_op() for processes, but for data types.

Parameters
dis the data type
modeis the mode flag passed to this call.
Returns
the data structure that is to be associated with this data type

◆ pre_op() [3/3]

virtual void * ActPass::pre_op ( Process p,
int  mode = 0 
)
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.

Parameters
pis the process type
modeis the mode flag passed to this call.
Returns
the data structure that is to be associated with this process

◆ recursive_op()

void ActPass::recursive_op ( UserDef p,
int  mode = 0 
)
private

does the actual work for run_recursive()

◆ refreshAll()

static void ActPass::refreshAll ( Act a,
Process p = NULL 
)
static

This forces a complete recomputation of all passes that have been run so far.

Parameters
ais the Act design pointer
pis the process from which the recomputation is triggered.

◆ run()

virtual int ActPass::run ( Process p = NULL)
virtual

Run the entire pass with the specified top-level process name

Parameters
pis 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.
Returns
1 on success, 0 if any dependencies failed.

Reimplemented in ActDynamicPass, ActBooleanizePass, ActCellPass, ActCHPMemory, ActCHPArbiter, ActCHPFuncInline, ActApplyPass, ActNetlistPass, ActSizingPass, and ActStatePass.

◆ run_recursive()

virtual void ActPass::run_recursive ( Process p = NULL,
int  mode = 0 
)
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.

Parameters
pis the process for the recursive traversal
modeis a parameter passed to the leaf call.

Reimplemented in ActDynamicPass.

◆ rundeps()

int ActPass::rundeps ( Process p = NULL)

Run all passes that this one depends on.

Parameters
pis the process that is the root of the design where dependencies are computed.
Returns
should always return 1. If there is an error due to a cyclic dependency, then the library will exit.

◆ update()

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.

Parameters
pis the process in the design that was updated.

Member Data Documentation

◆ _finished

int ActPass::_finished
protected

has the pass finished execution?

◆ _global_info

void* ActPass::_global_info
protected

this space is for rent. It is used by the decomposition passes to save away type information.

◆ _root

Process* ActPass::_root
protected

the root of the design

◆ _root_dirty

int ActPass::_root_dirty
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.

◆ _sticky_visited

int ActPass::_sticky_visited
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.

◆ _update_propagate

int ActPass::_update_propagate
protected

flag used to suppress updates from propagating. The default is 1, which means any updates will automatically propagate.

◆ a

Act* ActPass::a
protected

main act data structure to which the pass is linked

◆ deps

list_t* ActPass::deps
protected

ActPass dependencies: these are passes that must be run prior to the pass being executed.

◆ fwdeps

list_t* ActPass::fwdeps
protected

passes that depend on me. These are passes whose operation might be influenced by the computation from this pass.

◆ name

const char* ActPass::name
protected

the name for the pass

◆ pmap

std::map<UserDef *, void *>* ActPass::pmap
private

the map from user-defined types to the data structure returned by local_op()/pre_op().

◆ visited_flag

std::unordered_set<UserDef *>* ActPass::visited_flag
private

used to keep track of what types have been visited so far.


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