livenessAnalyzer Class ReferenceLiveness analyzer.
More...
#include <liveness.h>
Inheritance diagram for livenessAnalyzer:
List of all members.
|
Public Member Functions |
| livenessAnalyzer () |
| Create a liveness analysis object.
|
virtual string | name () |
| Name of the analysis.
|
void | clear () |
| Reset liveness information.
|
bool | isLive (stmtNode *stmt) |
| Is a particular statement live.
|
const procedure_set & | visited_procedures () const |
virtual void | at_index (stmtLocation *current, operandNode *operand, pointerValue &left, pointerValue &right, pointerValue &result) |
virtual void | at_call (stmtLocation *current, operandNode *call, pointerValue &call_target, procNode *callee, pointervalue_list &arguments, pointerValue &return_val) |
virtual void | at_assignment (stmtLocation *current, pointerValue &left, pointerValue &right, pointerValue &result, memoryblock_set &changes) |
virtual void | at_return (stmtLocation *stmt, returnNode *ret, pointerValue &result, pointerValue &return_val) |
virtual void | at_threeAddr (stmtLocation *stmt, threeAddrNode *threeaddr, pointerValue &result) |
virtual void | at_conditiongoto (stmtLocation *stmt, conditiongotoNode *c, pointerValue &left, pointerValue &right, pointerValue &result) |
virtual void | at_merge (Location *where, memoryBlock *block, memoryuse_list &phi_uses, pointerValue &result, memoryblock_set &changes) |
virtual void | at_allocation (stmtLocation *stmt, pointervalue_list &arguments, memoryBlock *block, memoryblock_set &changes) |
virtual void | at_deallocation (stmtLocation *stmt, pointerValue &to_deallocate, 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) |
Direction | direction () const |
| Get the direction.
|
virtual bool | compare_property_value (Location *where, memoryBlock *property_block, procedureInfo *callee) |
| Compare current property value against the last input to callee.
|
virtual void | record_input_to_value (procedureInfo *callee, memoryBlock *property_block, stmtLocation *callsite) |
| Record the value of a property when it is used as an input_to/external_input value to a call to callee at a call site.
|
|
The rest of these functions are hooks for the pointer analyzer to call at various points in the analysis. They serve as the transfer functions for the dataflow analysis problem.
|
virtual void | at_id (stmtLocation *current, idNode *id, pointerValue &result) |
virtual void | at_unary (stmtLocation *current, threeAddrNode *r, pointerValue &operand, pointerValue &result) |
virtual void | at_sizeof (stmtLocation *current, threeAddrNode *r, pointerValue &operand, pointerValue &result) |
virtual void | at_binary (stmtLocation *current, stmtNode *r, pointerValue &left, pointerValue &right, pointerValue &result) |
virtual void | at_cast (stmtLocation *current, operandNode *operand, pointerValue &operand_value, pointerValue &result) |
virtual void | at_const (stmtLocation *current, constNode *cons, pointerValue &result) |
virtual void | at_field_access (stmtLocation *current, operandNode *operand, pointerValue &operand_value, pointerValue &result) |
virtual void | at_dereference (stmtLocation *current, operandNode *operand, pointerValue &operand_value, pointerValue &result) |
virtual void | at_address (stmtLocation *current, operandNode *operand, pointerValue &operand_value, pointerValue &result) |
virtual void | at_parameter_pass (Location *current, stmtLocation *parameter_callsite, pointerValue &left, pointerValue &right, memoryblock_set &changes) |
virtual void | at_self_assignment (Location *source, Location *target, memoryBlock *block, memoryblock_set &changes, bool is_input) |
virtual void | at_return (Location *current, pointerValue &left, pointerValue &right, memoryblock_set &changes) |
virtual void | at_stmt_entry (stmtLocation *stmt, pointerValue &result) |
virtual void | at_basicblock_exit (basicblockLocation *block, procedureInfo *info, pointerValue &final) |
virtual void | at_conservative_procedure_call (stmtLocation *current, operandNode *call, operand_list &args, pointerValue &call_target, pointervalue_list &arguments, memoryblock_set &reachable_blocks, pointerValue &return_val, memoryblock_set &changes) |
Protected Member Functions |
void | collectDefs (pointerValue &pointer) |
| Collect defs.
|
void | addDef (memoryDef *def) |
| Add one def.
|
bool | determineLiveness () |
| Determine liveness.
|
bool | isLive (memoryUse *use, memoryBlock *owner) |
| Look up liveness.
|
void | setLive (stmtLocation *where) |
| Set live for statements.
|
void | setLive (Location *where, memoryBlock *block) |
| Set live for merge-points.
|
Protected Attributes |
Direction | _direction |
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< Location *,
memoryBlock * > | mergepoint_pair |
typedef set< mergepoint_pair > | mergepoint_liveness_set |
typedef mergepoint_liveness_set::iterator | mergepoint_liveness_set_p |
typedef list< bool > | change_stack |
typedef change_stack::iterator | change_stack_p |
Private Attributes |
stmt_liveness_set | _live_stmts |
| Live statements.
|
stmtlocation_liveness_set | _live_stmtlocations |
| Live statement locations.
|
mergepoint_liveness_set | _live_mergepoints |
| Live merge points.
|
memorydef_set | _defs |
| Collect defs.
|
bool | _change |
| Record changes.
|
change_stack | _change_stack |
| Change stack.
|
procedure_set | _visited_procedures |
| Set of visited procedures.
|
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.
Definition at line 56 of file liveness.h.
Member Typedef Documentation
Constructor & Destructor Documentation
livenessAnalyzer::livenessAnalyzer |
( |
|
) |
|
|
|
Create a liveness analysis object.
|
Member Function Documentation
void livenessAnalyzer::addDef |
( |
memoryDef * |
def |
) |
[protected] |
|
void livenessAnalyzer::clear |
( |
|
) |
|
|
|
Reset liveness information.
Allow the liveness analyzer to be run again. |
void livenessAnalyzer::collectDefs |
( |
pointerValue & |
pointer |
) |
[protected] |
|
|
Compare current property value against the last input to callee.
Returns true if equal.
Definition at line 275 of file ipanalysis.h. |
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. |
Direction analysisProblem::direction |
( |
|
) |
const [inline, inherited] |
|
|
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] |
|
|
Record the value of a property when it is used as an input_to/external_input value to a call to callee at a call site.
Definition at line 282 of file ipanalysis.h. |
|
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 * |
where |
) |
[protected] |
|
|
Set live for statements.
Record the given statement location as live. |
const procedure_set& livenessAnalyzer::visited_procedures |
( |
|
) |
const [inline] |
|
Member Data Documentation
|
Change stack.
We need to record the state of the change boolean in procedures above the current one.
Definition at line 113 of file liveness.h. |
|
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.
Definition at line 102 of file liveness.h. |
|
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.
Definition at line 94 of file liveness.h. |
|
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.
Definition at line 86 of file liveness.h. |
|
Live statements.
This set records which statements are live. It is really context-insensitive summary of the live statement locations.
Definition at line 78 of file liveness.h. |
|
Set of visited procedures.
We record the visited procedures so that we don't remove dead code from uncalled procedures.
Definition at line 120 of file liveness.h.
Referenced by visited_procedures(). |
The documentation for this class was generated from the following file:
|