Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages
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 &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, Location *where) |
| 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
typedef list< bool > livenessAnalyzer::change_stack [private]
|
|
typedef change_stack::iterator livenessAnalyzer::change_stack_p [private]
|
|
typedef set< mergepoint_pair > livenessAnalyzer::mergepoint_liveness_set [private]
|
|
typedef mergepoint_liveness_set::iterator livenessAnalyzer::mergepoint_liveness_set_p [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 |
( |
|
) |
|
|
Member Function Documentation
void livenessAnalyzer::addDef |
( |
memoryDef * |
def |
) |
[protected] |
|
void livenessAnalyzer::clear |
( |
|
) |
|
|
void livenessAnalyzer::collectDefs |
( |
pointerValue & |
pointer |
) |
[protected] |
|
bool livenessAnalyzer::determineLiveness |
( |
|
) |
[protected] |
|
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.
Definition at line 144 of file liveness.cc.
References _live_mergepoints, _live_stmtlocations, Location::BasicBlock, Location::kind(), mergepoint_liveness_set_p, mergepoint_pair, Location::Procedure, Location::Statement, stmtlocation_liveness_set_p, and use. |
bool livenessAnalyzer::isLive |
( |
stmtNode * |
stmt |
) |
|
|
virtual string livenessAnalyzer::name |
( |
|
) |
[inline, virtual] |
|
|
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.
Definition at line 194 of file liveness.cc.
References _change, _live_mergepoints, and mergepoint_pair. |
void livenessAnalyzer::setLive |
( |
stmtLocation * |
where |
) |
[protected] |
|
|
Set live for statements.
Record the given statement location as live.
Definition at line 205 of file liveness.cc.
References _change, _live_stmtlocations, _live_stmts, and stmtLocation::stmt().
Referenced by at_allocation(), at_call(), at_conditiongoto(), at_deallocation(), at_index(), at_merge(), at_return(), and at_threeAddr(). |
const procedure_set& livenessAnalyzer::visited_procedures |
( |
|
) |
const [inline] |
|
Member Data Documentation
bool livenessAnalyzer::_change [private]
|
|
Direction analysisProblem::_direction [protected, inherited]
|
|
|
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.
Referenced by clear(), isLive(), and setLive(). |
|
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.
Referenced by clear(), isLive(), and setLive(). |
|
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.
Referenced by clear(), isLive(), and setLive(). |
|
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 at_procedure_entry(). |
The documentation for this class was generated from the following files:
|