C-Breeze
C Compiler Infrastructure

[ Project home page]
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

precisionAnalyzer Class Reference

#include <precision.h>

Inheritance diagram for precisionAnalyzer:

analysisProblem List of all members.

Public Member Functions

 precisionAnalyzer ()
 Create a new precision analyzer object.

virtual string name ()
 Name of the analysis.

virtual void at_field_access (stmtLocation *current, operandNode *operand, pointerValue &operand_value, pointerValue &result)
 At each field access.

virtual void at_dereference (stmtLocation *current, operandNode *operand, pointerValue &operand_value, pointerValue &result)
 At each dereference.

virtual void at_index (stmtLocation *current, operandNode *operand, pointerValue &left, pointerValue &right, pointerValue &result)
 At an array index.

void report (ostream &out)
 Report.

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.

Transfer functions
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_call (stmtLocation *current, operandNode *call, pointerValue &call_target, procNode *callee, pointervalue_list &arguments, pointerValue &return_val)
virtual void at_address (stmtLocation *current, operandNode *operand, pointerValue &operand_value, pointerValue &result)
virtual void at_assignment (stmtLocation *current, pointerValue &left, pointerValue &right, pointerValue &result, memoryblock_set &changes)
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_threeAddr (stmtLocation *stmt, threeAddrNode *threeaddr, pointerValue &result)
virtual void at_conditiongoto (stmtLocation *stmt, conditiongotoNode *c, pointerValue &result)
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_merge (Location *where, memoryBlock *block, memoryuse_list &phi_uses, pointerValue &result, memoryblock_set &changes)
virtual void at_basicblock_entry (basicblockLocation *block, procedureInfo *info, pointerValue &initial)
virtual void at_stmt_entry (stmtLocation *stmt, pointerValue &result)
virtual void at_stmt_exit (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)
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 Attributes

Direction _direction

Private Types

typedef pair< stmtLocation *,
memoryBlock * > 
stmt_pointer_pair
typedef map< stmt_pointer_pair,
memoryblock_set > 
pointer_targets_map
typedef pointer_targets_map::iterator pointer_targets_map_p

Private Member Functions

void record (stmtLocation *current, pointerValue &operand, pointerValue &result)

Private Attributes

pointer_targets_map _pointer_targets
 Pointer targets.

long int _derefs
 Dereference count.


Member Typedef Documentation

typedef map< stmt_pointer_pair, memoryblock_set > precisionAnalyzer::pointer_targets_map [private]
 

Definition at line 49 of file precision.h.

typedef pointer_targets_map::iterator precisionAnalyzer::pointer_targets_map_p [private]
 

Definition at line 50 of file precision.h.

Referenced by report().

typedef pair< stmtLocation *, memoryBlock * > precisionAnalyzer::stmt_pointer_pair [private]
 

Definition at line 47 of file precision.h.

Referenced by record(), and report().


Constructor & Destructor Documentation

precisionAnalyzer::precisionAnalyzer (    ) 
 

Create a new precision analyzer object.

Definition at line 43 of file precision.cc.

References Forward.


Member Function Documentation

virtual void analysisProblem::at_address (  stmtLocation *    current,
operandNode *    operand,
pointerValue &    operand_value,
pointerValue &    result
)  [inline, virtual, inherited]
 

Definition at line 151 of file ipanalysis.h.

Referenced by Pointers::eval().

virtual void analysisProblem::at_allocation (  stmtLocation *    stmt,
pointervalue_list &    arguments,
memoryBlock *    block,
memoryblock_set &    changes
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 206 of file ipanalysis.h.

Referenced by Pointers::procedure_call().

virtual void analysisProblem::at_assignment (  stmtLocation *    current,
pointerValue &    left,
pointerValue &    right,
pointerValue &    result,
memoryblock_set &    changes
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 166 of file ipanalysis.h.

Referenced by Pointers::eval(), and Pointers::struct_union_assignment().

virtual void analysisProblem::at_basicblock_entry (  basicblockLocation *    block,
procedureInfo *    info,
pointerValue &    initial
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 228 of file ipanalysis.h.

Referenced by Pointers::analyze_procedure().

virtual void analysisProblem::at_basicblock_exit (  basicblockLocation *    block,
procedureInfo *    info,
pointerValue &    final
)  [inline, virtual, inherited]
 

Definition at line 241 of file ipanalysis.h.

Referenced by Pointers::analyze_procedure().

virtual void analysisProblem::at_binary (  stmtLocation *    current,
stmtNode *    r,
pointerValue &    left,
pointerValue &    right,
pointerValue &    result
)  [inline, virtual, inherited]
 

Definition at line 112 of file ipanalysis.h.

Referenced by Pointers::eval().

virtual void analysisProblem::at_call (  stmtLocation *    current,
operandNode *    call,
pointerValue &    call_target,
procNode *    callee,
pointervalue_list &    arguments,
pointerValue &    return_val
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 130 of file ipanalysis.h.

Referenced by Pointers::procedure_call().

virtual void analysisProblem::at_cast (  stmtLocation *    current,
operandNode *    operand,
pointerValue &    operand_value,
pointerValue &    result
)  [inline, virtual, inherited]
 

Definition at line 119 of file ipanalysis.h.

Referenced by Pointers::eval().

virtual void analysisProblem::at_conditiongoto (  stmtLocation *    stmt,
conditiongotoNode *    c,
pointerValue &    result
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 200 of file ipanalysis.h.

Referenced by Pointers::analyze_procedure().

virtual void analysisProblem::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
)  [inline, virtual, inherited]
 

Definition at line 248 of file ipanalysis.h.

Referenced by Pointers::procedure_call().

virtual void analysisProblem::at_const (  stmtLocation *    current,
constNode *    cons,
pointerValue &    result
)  [inline, virtual, inherited]
 

Definition at line 124 of file ipanalysis.h.

Referenced by Pointers::eval().

virtual void analysisProblem::at_deallocation (  stmtLocation *    stmt,
pointerValue &    to_deallocate,
memoryblock_set &    changes
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 212 of file ipanalysis.h.

Referenced by Pointers::procedure_call().

void precisionAnalyzer::at_dereference (  stmtLocation *    current,
operandNode *    operand,
pointerValue &    operand_value,
pointerValue &    result
)  [virtual]
 

At each dereference.

Count the number of targets and store it in the deref map.

Reimplemented from analysisProblem.

Definition at line 67 of file precision.cc.

References record().

void precisionAnalyzer::at_field_access (  stmtLocation *    current,
operandNode *    operand,
pointerValue &    operand_value,
pointerValue &    result
)  [virtual]
 

At each field access.

Count the number of targets if this is an -> operator.

Reimplemented from analysisProblem.

Definition at line 53 of file precision.cc.

References record().

virtual void analysisProblem::at_id (  stmtLocation *    current,
idNode *    id,
pointerValue &    result
)  [inline, virtual, inherited]
 

Definition at line 96 of file ipanalysis.h.

Referenced by Pointers::eval().

void precisionAnalyzer::at_index (  stmtLocation *    current,
operandNode *    operand,
pointerValue &    left,
pointerValue &    right,
pointerValue &    result
)  [virtual]
 

At an array index.

Array index is a dereference.

Reimplemented from analysisProblem.

Definition at line 79 of file precision.cc.

References record().

virtual void analysisProblem::at_merge (  Location *    where,
memoryBlock *    block,
memoryuse_list &    phi_uses,
pointerValue &    result,
memoryblock_set &    changes
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 219 of file ipanalysis.h.

Referenced by Pointers::process_merge_point().

virtual void analysisProblem::at_parameter_pass (  Location *    current,
stmtLocation *    parameter_callsite,
pointerValue &    left,
pointerValue &    right,
memoryblock_set &    changes
)  [inline, virtual, inherited]
 

Definition at line 173 of file ipanalysis.h.

Referenced by Pointers::pass_parameters(), and Pointers::setup_va_list_variables().

virtual void analysisProblem::at_procedure_entry (  procLocation *    proc,
procedureInfo *    info,
pointerValue &    return_val
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 258 of file ipanalysis.h.

Referenced by Pointers::analyze(), and Pointers::analyze_procedure_at().

virtual void analysisProblem::at_procedure_exit (  procLocation *    proc,
procedureInfo *    info,
pointerValue &    return_val
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 263 of file ipanalysis.h.

Referenced by Pointers::analyze(), and Pointers::analyze_procedure_at().

virtual void analysisProblem::at_return (  Location *    current,
pointerValue &    left,
pointerValue &    right,
memoryblock_set &    changes
)  [inline, virtual, inherited]
 

Definition at line 189 of file ipanalysis.h.

virtual void analysisProblem::at_self_assignment (  Location *    source,
Location *    target,
memoryBlock *    block,
memoryblock_set &    changes,
bool    is_input
)  [inline, virtual, inherited]
 

Definition at line 180 of file ipanalysis.h.

Referenced by Pointers::pass_one_external_input(), and Pointers::pass_one_external_output().

virtual void analysisProblem::at_sizeof (  stmtLocation *    current,
threeAddrNode *    r,
pointerValue &    operand,
pointerValue &    result
)  [inline, virtual, inherited]
 

Definition at line 106 of file ipanalysis.h.

Referenced by Pointers::eval().

virtual void analysisProblem::at_stmt_entry (  stmtLocation *    stmt,
pointerValue &    result
)  [inline, virtual, inherited]
 

Definition at line 233 of file ipanalysis.h.

Referenced by Pointers::analyze_procedure().

virtual void analysisProblem::at_stmt_exit (  stmtLocation *    stmt,
pointerValue &    result
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 237 of file ipanalysis.h.

Referenced by Pointers::analyze_procedure().

virtual void analysisProblem::at_threeAddr (  stmtLocation *    stmt,
threeAddrNode *    threeaddr,
pointerValue &    result
)  [inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer.

Definition at line 196 of file ipanalysis.h.

Referenced by Pointers::analyze_procedure().

virtual void analysisProblem::at_unary (  stmtLocation *    current,
threeAddrNode *    r,
pointerValue &    operand,
pointerValue &    result
)  [inline, virtual, inherited]
 

Definition at line 100 of file ipanalysis.h.

Referenced by Pointers::eval().

virtual bool analysisProblem::compare_property_value (  Location *    where,
memoryBlock *    property_block,
procedureInfo *    callee
)  [inline, virtual, inherited]
 

Compare current property value against the last input to callee.

Returns true if equal.

Definition at line 273 of file ipanalysis.h.

Referenced by Pointers::process_local_changes().

Direction analysisProblem::direction (    )  const [inline, inherited]
 

Get the direction.

Definition at line 78 of file ipanalysis.h.

References Direction.

Referenced by analysisProblem::analysisProblem().

virtual string precisionAnalyzer::name (    )  [inline, virtual]
 

Name of the analysis.

Just for debug purposes.

Implements analysisProblem.

Definition at line 74 of file precision.h.

void precisionAnalyzer::record (  stmtLocation *    current,
pointerValue &    operand,
pointerValue &    result
)  [private]
 

Definition at line 214 of file precision.cc.

References _derefs, _pointer_targets, pointerValue::blocks, vector_set< memoryBlock * >::insert(), pointerValue::is_address, memoryblock_set_p, stmtNode::output(), stmtLocation::stmt(), and stmt_pointer_pair.

Referenced by at_dereference(), at_field_access(), and at_index().

virtual void analysisProblem::record_input_to_value (  procedureInfo *    callee,
memoryBlock *    property_block,
Location *    where
)  [inline, virtual, inherited]
 

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 280 of file ipanalysis.h.

Referenced by Pointers::pass_one_external_input().

void precisionAnalyzer::report (  ostream &    out ) 
 

Report.

Print the results of the precision analysis.

Definition at line 92 of file precision.cc.

References _derefs, _pointer_targets, memoryBlock::find_def_at(), memoryblock_set_p, memoryBlock::name(), stmtNode::output(), pointer_targets_map_p, stmtLocation::stmt(), and stmt_pointer_pair.


Member Data Documentation

long int precisionAnalyzer::_derefs [private]
 

Dereference count.

Definition at line 62 of file precision.h.

Referenced by record(), and report().

Direction analysisProblem::_direction [protected, inherited]
 

Definition at line 64 of file ipanalysis.h.

pointer_targets_map precisionAnalyzer::_pointer_targets [private]
 

Pointer targets.

For each dereference, store the targets of the pointer according to the pointer variable itself and location.

Definition at line 57 of file precision.h.

Referenced by record(), and report().


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

Generated on August 27, 2003
Back to the C-Breeze home page