Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

livenessAnalyzer Class Reference

Liveness analyzer. More...

#include <liveness.h>

Inheritance diagram for livenessAnalyzer::

analysisProblem List of all members.

Public Methods

 livenessAnalyzer (bool debug)
 Create a liveness analysis object. More...

virtual string name ()
 Name of the analysis. More...

void clear ()
 Reset liveness information. More...

bool isLive (stmtNode *stmt)
 Is a particular statement live. More...

virtual void at_index (stmtLocation *current, binaryNode *binary, pointerValue &left, pointerValue &right, pointerValue &result, bool result_is_a_use)
virtual void at_call (stmtLocation *current, callNode *call, pointerValue &call_target, procNode *callee, pointervalue_list &arguments, pointerValue &return_val)
virtual void at_heap (stmtLocation *current, callNode *call, pointervalue_list &arguments, pointerValue &return_val, bool is_alloc)
virtual void at_assignment (stmtLocation *current, binaryNode *binary, pointerValue &left, pointerValue &right, pointerValue &result, bool result_is_a_use, memoryblock_set &changes)
virtual void at_return (stmtLocation *stmt, returnNode *ret, pointerValue &result, pointerValue &return_val)
virtual void at_exprstmt (stmtLocation *stmt, exprstmtNode *es, pointerValue &result)
virtual void at_if (stmtLocation *stmt, ifNode *ifnode, pointerValue &result)
virtual void at_merge (basicblockLocation *where, memoryBlock *block, memoryuse_list &phi_uses, pointerValue &result, memoryblock_set &changes)
virtual void at_stmt_exit (stmtLocation *stmt, pointerValue &result)
virtual void at_basicblock_entry (basicblockLocation *block, procedureInfo *info, pointerValue &initial)
virtual void at_procedure_entry (procLocation *proc, procedureInfo *info, pointerValue &return_val)
virtual void at_procedure_exit (procLocation *proc, procedureInfo *info, pointerValue &return_val)

Protected Methods

void collectDefs (pointerValue &pointer)
 Collect defs. More...

void addDef (memoryDef *def)
 Add one def. More...

bool determineLiveness ()
 Determine liveness. More...

bool isLive (memoryUse *use, memoryBlock *owner)
 Look up liveness. More...

void setLive (stmtLocation *where)
 Set live for statements. More...

void setLive (basicblockLocation *where, memoryBlock *block)
 Set live for merge-points. More...


Private Types

typedef set< stmtNode * > stmt_liveness_set
typedef stmt_liveness_set::iterator stmt_liveness_set_p
typedef set< stmtLocation * > stmtlocation_liveness_set
typedef stmtlocation_liveness_set::iterator stmtlocation_liveness_set_p
typedef pair< basicblockLocation *,
memoryBlock * > 
mergepoint_pair
typedef set< mergepoint_pairmergepoint_liveness_set
typedef mergepoint_liveness_set::iterator mergepoint_liveness_set_p
typedef list< bool > change_stack

Private Attributes

stmt_liveness_set _live_stmts
 Live statements. More...

stmtlocation_liveness_set _live_stmtlocations
 Live statement locations. More...

mergepoint_liveness_set _live_mergepoints
 Live merge points. More...

memorydef_set _defs
 Collect defs. More...

bool _change
 Record changes. More...

change_stack _change_stack
 Change stack. More...

bool _debug
 Debug flag. More...


Detailed Description

Liveness analyzer.

Liveness is a property of statements in the program. A statement is live if any of the defs created by the statement are live. A def is live if it has uses, and at least one of it's uses is live. A use is live if the statement in which it occurs is live.


Member Typedef Documentation

typedef list< bool > livenessAnalyzer::change_stack [private]
 

typedef set< mergepoint_pair > livenessAnalyzer::mergepoint_liveness_set [private]
 

typedef mergepoint_liveness_set::iterator livenessAnalyzer::mergepoint_liveness_set_p [private]
 

typedef pair< basicblockLocation *, memoryBlock * > livenessAnalyzer::mergepoint_pair [private]
 

typedef set< stmtNode * > livenessAnalyzer::stmt_liveness_set [private]
 

typedef stmt_liveness_set::iterator livenessAnalyzer::stmt_liveness_set_p [private]
 

typedef set< stmtLocation * > livenessAnalyzer::stmtlocation_liveness_set [private]
 

typedef stmtlocation_liveness_set::iterator livenessAnalyzer::stmtlocation_liveness_set_p [private]
 


Constructor & Destructor Documentation

livenessAnalyzer::livenessAnalyzer bool    debug
 

Create a liveness analysis object.


Member Function Documentation

void livenessAnalyzer::addDef memoryDef   def [protected]
 

Add one def.

void livenessAnalyzer::at_assignment stmtLocation   current,
binaryNode   binary,
pointerValue   left,
pointerValue   right,
pointerValue   result,
bool    result_is_a_use,
memoryblock_set   changes
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_basicblock_entry basicblockLocation   blockloc,
procedureInfo   info,
pointerValue   initial
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_call stmtLocation   current,
callNode   call,
pointerValue   call_target,
procNode   callee,
pointervalue_list   arguments,
pointerValue   return_val
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_exprstmt stmtLocation   stmt,
exprstmtNode   es,
pointerValue   result
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_heap stmtLocation   current,
callNode   call,
pointervalue_list   arguments,
pointerValue   return_val,
bool    is_alloc
[virtual]
 

void livenessAnalyzer::at_if stmtLocation   stmt,
ifNode   ifnode,
pointerValue   result
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_index stmtLocation   current,
binaryNode   binary,
pointerValue   left,
pointerValue   right,
pointerValue   result,
bool    result_is_a_use
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_merge basicblockLocation   where,
memoryBlock   block,
memoryuse_list   phi_uses,
pointerValue   result,
memoryblock_set   changes
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_procedure_entry procLocation   proc,
procedureInfo   info,
pointerValue   return_val
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_procedure_exit procLocation   proc,
procedureInfo   info,
pointerValue   return_val
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_return stmtLocation   stmt,
returnNode   ret,
pointerValue   result,
pointerValue   return_val
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::at_stmt_exit stmtLocation   stmt,
pointerValue   result
[virtual]
 

Reimplemented from analysisProblem.

void livenessAnalyzer::clear  
 

Reset liveness information.

Allow the liveness analyzer to be run again.

void livenessAnalyzer::collectDefs pointerValue   pointer [protected]
 

Collect defs.

bool livenessAnalyzer::determineLiveness   [protected]
 

Determine liveness.

Given the set of defs collected earlier, visit each def and each use that it reaches to see if any of them are live.

bool livenessAnalyzer::isLive memoryUse   use,
memoryBlock   owner
[protected]
 

Look up liveness.

Look up the liveness of a memoryUse. This depends on the kind of location it comes from. As a special case, procLocations are always considered live.

bool livenessAnalyzer::isLive stmtNode   stmt
 

Is a particular statement live.

This is the context insensitive query

virtual string livenessAnalyzer::name   [inline, virtual]
 

Name of the analysis.

Just for debug purposes.

Reimplemented from analysisProblem.

void livenessAnalyzer::setLive basicblockLocation   where,
memoryBlock   block
[protected]
 

Set live for merge-points.

Record the given merge-point as live. Since all blocks share a single merge-point location, we need to distinguish which ones are live by the specific block being merged.

void livenessAnalyzer::setLive stmtLocation   stmt_loc [protected]
 

Set live for statements.

Record the given statement location as live.


Member Data Documentation

bool livenessAnalyzer::_change [private]
 

Record changes.

change_stack livenessAnalyzer::_change_stack [private]
 

Change stack.

We need to record the state of the change boolean in procedures above the current one.

bool livenessAnalyzer::_debug [private]
 

Debug flag.

memorydef_set livenessAnalyzer::_defs [private]
 

Collect defs.

This set is used on a per-statement basis to collect memoryDef objects. Once we have the set of defs, we can decide whether or not the current statement is live.

mergepoint_liveness_set livenessAnalyzer::_live_mergepoints [private]
 

Live merge points.

This set records which merge points are live. A merge point is specified by the basic block in which it occurs, and the memoryBlock being merged.

stmtlocation_liveness_set livenessAnalyzer::_live_stmtlocations [private]
 

Live statement locations.

Set of live statements. Note that some kinds of statements are automatically live (for example, the return statement and all if statements.

stmt_liveness_set livenessAnalyzer::_live_stmts [private]
 

Live statements.

This set records which statements are live. It is really context-insensitive summary of the live statement locations.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 12:06:29 2002 for C-Breeze by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001