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  

ipConstantPropagation Class Reference

Controls data for management of constant propagation problem. More...

#include <ipconstants.h>

Inheritance diagram for ipConstantPropagation:

analysisProblem List of all members.

Public Member Functions

 ipConstantPropagation (bool debug=false)
virtual bool assignment (const Path *where, memoryDef *left_hand_side, analysisVal *right_hand_side, bool is_strong_update)
 Process an assignment, return true if the state of the defined object changes.

virtual analysisVallookup (memoryBlock *block, memoryUse *use)
virtual analysisVallookup (constNode *con)
virtual analysisVallookup (const string &field_name)
virtual void free (analysisVal *to_free)
 Free: must be able to accept 0 as an argument.

virtual analysisValtop ()
 Return a *COPY* of the TOP flow value.

virtual analysisValbottom ()
 Return a *COPY* the BOTTOM flow value.

virtual analysisValbinary_operator (const Operator *op, const analysisVal *left_operand, const analysisVal *right_operand)
virtual analysisValunary_operator (const Operator *op, const analysisVal *operand)
virtual analysisValcast_operator (const typeNode *type, const analysisVal *operand)
void stats ()
 Print some statistics.

Direction direction () const
 Get the direction.

virtual string name ()=0
 Name of the analysis.

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_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_index (stmtLocation *current, operandNode *operand, pointerValue &left, pointerValue &right, 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 Member Functions

void allocate (ipConstant *ic)
ipConstantclone (analysisVal *to_clone)

Private Attributes

const_variables_map _values
constants_map _constants
enums_map _enums
ipConstant_top
ipConstant_bottom
bool _debug
ipconstant_set _deleted
int _count

Detailed Description

Controls data for management of constant propagation problem.

This class controls the constant propagation algorithm by holding the current states of all objects, looking them up when needed, and setting their values at assignments.

Definition at line 145 of file ipconstants.h.


Constructor & Destructor Documentation

ipConstantPropagation::ipConstantPropagation bool    debug = false [inline]
 

Definition at line 161 of file ipconstants.h.

References ipConstant::to_bottom().


Member Function Documentation

void ipConstantPropagation::allocate ipConstant   ic [inline, private]
 

Definition at line 235 of file ipconstants.h.

Referenced by assignment(), clone(), and lookup().

bool ipConstantPropagation::assignment const Path   where,
memoryDef   left_hand_side,
analysisVal   right_hand_side,
bool    is_strong_update
[virtual]
 

Process an assignment, return true if the state of the defined object changes.

Definition at line 236 of file ipconstants.cc.

References _values, allocate(), ipConstant::assign(), const_variables_map_p, ipConstant::diff(), ipConstant::intern(), and ipConstant::is_bottom().

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().

virtual void analysisProblem::at_dereference stmtLocation   current,
operandNode   operand,
pointerValue   operand_value,
pointerValue   result
[inline, virtual, inherited]
 

Reimplemented in precisionAnalyzer.

Definition at line 145 of file ipanalysis.h.

Referenced by Pointers::eval().

virtual void analysisProblem::at_field_access stmtLocation   current,
operandNode   operand,
pointerValue   operand_value,
pointerValue   result
[inline, virtual, inherited]
 

Reimplemented in precisionAnalyzer.

Definition at line 139 of file ipanalysis.h.

Referenced by Pointers::eval().

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().

virtual void analysisProblem::at_index stmtLocation   current,
operandNode   operand,
pointerValue   left,
pointerValue   right,
pointerValue   result
[inline, virtual, inherited]
 

Reimplemented in livenessAnalyzer, and precisionAnalyzer.

Definition at line 157 of file ipanalysis.h.

Referenced by Pointers::eval().

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().

analysisVal * ipConstantPropagation::bottom   [virtual]
 

Return a *COPY* the BOTTOM flow value.

Must satisfy : x ^ B = B

Definition at line 392 of file ipconstants.cc.

References clone().

Referenced by ipConstantsChanger::at_expr().

ipConstant * ipConstantPropagation::clone analysisVal   to_clone [private]
 

Definition at line 352 of file ipconstants.cc.

References allocate().

Referenced by bottom(), lookup(), and top().

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().

void ipConstantPropagation::free analysisVal   to_free [virtual]
 

Free: must be able to accept 0 as an argument.

Definition at line 361 of file ipconstants.cc.

References _count, _deleted, and ipconstant_set_p.

Referenced by ipConstantsChanger::at_expr().

virtual string analysisProblem::name   [pure virtual, inherited]
 

Name of the analysis.

Just for debug purposes.

Implemented in livenessAnalyzer, and precisionAnalyzer.

Referenced by Pointers::analyze().

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 ipConstantPropagation::stats  
 

Print some statistics.

Definition at line 443 of file ipconstants.cc.

References _count, _values, const_variables_map_p, def, and ipConstant::print().

analysisVal * ipConstantPropagation::top   [virtual]
 

Return a *COPY* of the TOP flow value.

Must satisfy : x ^ T = x

Definition at line 385 of file ipconstants.cc.

References clone().

Referenced by ipConstantsChanger::at_expr().


Member Data Documentation

ipConstant* ipConstantPropagation::_bottom [private]
 

Definition at line 153 of file ipconstants.h.

constants_map ipConstantPropagation::_constants [private]
 

Definition at line 150 of file ipconstants.h.

int ipConstantPropagation::_count [private]
 

Definition at line 157 of file ipconstants.h.

Referenced by free(), and stats().

bool ipConstantPropagation::_debug [private]
 

Definition at line 154 of file ipconstants.h.

ipconstant_set ipConstantPropagation::_deleted [private]
 

Definition at line 156 of file ipconstants.h.

Referenced by free().

Direction analysisProblem::_direction [protected, inherited]
 

Definition at line 64 of file ipanalysis.h.

enums_map ipConstantPropagation::_enums [private]
 

Definition at line 151 of file ipconstants.h.

ipConstant* ipConstantPropagation::_top [private]
 

Definition at line 152 of file ipconstants.h.

const_variables_map ipConstantPropagation::_values [private]
 

Definition at line 149 of file ipconstants.h.

Referenced by assignment(), lookup(), and stats().


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

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