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

constantAnalyzer Class Reference

#include <constants.h>

Inheritance diagram for constantAnalyzer::

analysisProblem List of all members.

Public Methods

 constantAnalyzer (bool debug=false)
 Create a new constant analysis. More...

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

void clear ()
 Clear. More...

 ~constantAnalyzer ()
 Destructor. More...

const constanttop () const
 TOP value. More...

const constantbottom () const
 BOTTOM value. More...

void set_debug (bool new_val)
 Turn debug on or off. More...

const constantlookup_expression (exprNode *expr)
 Look up an expression. More...

virtual void at_id (stmtLocation *current, idNode *id, pointerValue &value, bool result_is_a_use)
virtual void at_unary (stmtLocation *current, unaryNode *unary, pointerValue &operand, pointerValue &result, bool result_is_a_use)
virtual void at_binary (stmtLocation *current, binaryNode *binary, pointerValue &left, pointerValue &right, pointerValue &result, bool result_is_a_use)
virtual void at_cast (stmtLocation *current, castNode *cast, pointerValue &operand, pointerValue &result, bool result_is_a_use)
virtual void at_const (stmtLocation *current, constNode *cons, pointerValue &result, bool result_is_a_use)
virtual void at_field_access (stmtLocation *current, binaryNode *binary, pointerValue &operand, idNode *field, pointerValue &result, bool result_is_a_use)
virtual void at_dereference (stmtLocation *current, unaryNode *unary, pointerValue &operand, pointerValue &result, bool result_is_a_use)
virtual void at_address (stmtLocation *current, unaryNode *unary, pointerValue &operand, pointerValue &result, bool result_is_a_use)
virtual void at_index (stmtLocation *current, binaryNode *binary, pointerValue &left, pointerValue &right, pointerValue &result, bool result_is_a_use)
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_parameter_pass (Location *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_merge (basicblockLocation *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_conservative_procedure_call (stmtLocation *current, callNode *call, pointerValue &call_target, pointervalue_list &arguments, memoryblock_set &reachable_blocks, pointerValue &return_val, memoryblock_set &changes)
void print (ostream &o, const constant *val)

Protected Methods

const constantlookup (const constant &value)
 Lookup a constant value. More...

const constantlookup_flowvalue (memoryDef *def)
 Lookup a variable value. More...

bool update_flowvalue (const constant *val, memoryDef *def)
 Update a variable value. More...

const constantmeet (const constant *one, const constant *two)
 Meet function. More...

const constantrebuild_flowvalue (pointerValue &pointer)
 Rebuild the flow value. More...

const constantget_flowvalue (pointerValue &pointer)
 Get the flow value. More...

void * set_flowvalue (const constant *val, pointerValue &pointer)
 Set the flow value. More...

void record_expression (exprNode *expr, const constant *val)
 Record the value of an expression. More...


Private Types

typedef set< constantconstant_set
typedef constant_set::iterator constant_set_p
typedef map< memoryDef *,
const constant *> 
memorydef_constant_map
typedef memorydef_constant_map::iterator memorydef_constant_map_p
typedef set< procLocation * > change_set
typedef change_set::iterator change_set_p
typedef map< exprNode *, const
constant * > 
expr_value_map
typedef expr_value_map::iterator expr_value_map_p

Private Methods

void record_change (memoryDef *def)
 Obsolete: Record a value change. More...


Private Attributes

TREE constant_set _constants
 The set of all constants. More...

memorydef_constant_map _values
 Variables values. More...

const constant_top
 Unique lattice top element. More...

const constant_bottom
 Unique lattice bottom element. More...

change_set _changes
 Obsolete: Record changes. More...

expr_value_map _expr_values
 Record the value of each expression. More...

bool _debug
 Debug flag. More...


Member Typedef Documentation

typedef set< procLocation * > constantAnalyzer::change_set [private]
 

typedef change_set::iterator constantAnalyzer::change_set_p [private]
 

typedef set< constant > constantAnalyzer::constant_set [private]
 

typedef constant_set::iterator constantAnalyzer::constant_set_p [private]
 

typedef map< exprNode *, const constant * > constantAnalyzer::expr_value_map [private]
 

typedef expr_value_map::iterator constantAnalyzer::expr_value_map_p [private]
 

typedef map< memoryDef *, const constant *> constantAnalyzer::memorydef_constant_map [private]
 

typedef memorydef_constant_map::iterator constantAnalyzer::memorydef_constant_map_p [private]
 


Constructor & Destructor Documentation

constantAnalyzer::constantAnalyzer bool    debug = false
 

Create a new constant analysis.

constantAnalyzer::~constantAnalyzer  
 

Destructor.


Member Function Documentation

void constantAnalyzer::at_address stmtLocation   current,
unaryNode   unary,
pointerValue   operand,
pointerValue   result,
bool    result_is_a_use
[virtual]
 

Reimplemented from analysisProblem.

void constantAnalyzer::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 constantAnalyzer::at_basicblock_entry basicblockLocation   block,
procedureInfo   info,
pointerValue   initial
[virtual]
 

Reimplemented from analysisProblem.

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

Reimplemented from analysisProblem.

void constantAnalyzer::at_cast stmtLocation   current,
castNode   cast,
pointerValue   operand,
pointerValue   result,
bool    result_is_a_use
[virtual]
 

Reimplemented from analysisProblem.

void constantAnalyzer::at_conservative_procedure_call stmtLocation   current,
callNode   call,
pointerValue   call_target,
pointervalue_list   arguments,
memoryblock_set   reachable_blocks,
pointerValue   return_val,
memoryblock_set   changes
[virtual]
 

Reimplemented from analysisProblem.

void constantAnalyzer::at_const stmtLocation   current,
constNode   cons,
pointerValue   result,
bool    result_is_a_use
[virtual]
 

Reimplemented from analysisProblem.

void constantAnalyzer::at_dereference stmtLocation   current,
unaryNode   unary,
pointerValue   operand,
pointerValue   result,
bool    result_is_a_use
[virtual]
 

Reimplemented from analysisProblem.

void constantAnalyzer::at_field_access stmtLocation   current,
binaryNode   binary,
pointerValue   operand,
idNode   field,
pointerValue   result,
bool    result_is_a_use
[virtual]
 

Reimplemented from analysisProblem.

void constantAnalyzer::at_id stmtLocation   current,
idNode   id,
pointerValue   block,
bool    result_is_a_use
[virtual]
 

Reimplemented from analysisProblem.

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

Reimplemented from analysisProblem.

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

Reimplemented from analysisProblem.

void constantAnalyzer::at_parameter_pass Location   current,
pointerValue   left,
pointerValue   right,
pointerValue   result,
memoryblock_set   changes
[virtual]
 

Reimplemented from analysisProblem.

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

Reimplemented from analysisProblem.

void constantAnalyzer::at_stmt_entry stmtLocation   stmt,
pointerValue   result
[virtual]
 

Reimplemented from analysisProblem.

void constantAnalyzer::at_unary stmtLocation   current,
unaryNode   unary,
pointerValue   operand,
pointerValue   result,
bool    result_is_a_use
[virtual]
 

Reimplemented from analysisProblem.

const constant* constantAnalyzer::bottom   const [inline]
 

BOTTOM value.

void constantAnalyzer::clear  
 

Clear.

Re-initialize the data structures so that we can run the analysis again.

const constant * constantAnalyzer::get_flowvalue pointerValue   pointer [protected]
 

Get the flow value.

Get the flow value from the given pointer value object

const constant * constantAnalyzer::lookup const constant   value [protected]
 

Lookup a constant value.

All constants are stored in a set so that there is only one constant object for each unique value.

const constant * constantAnalyzer::lookup_expression exprNode   expr
 

Look up an expression.

const constant * constantAnalyzer::lookup_flowvalue memoryDef   def [protected]
 

Lookup a variable value.

Look for the constant value associated with a specific def. Default is TOP if none is found.

const constant * constantAnalyzer::meet const constant   one,
const constant   two
[protected]
 

Meet function.

virtual string constantAnalyzer::name   [inline, virtual]
 

Name of the analysis.

Just for debug purposes.

Reimplemented from analysisProblem.

void constantAnalyzer::print ostream &    o,
const constant   val
[inline]
 

const constant * constantAnalyzer::rebuild_flowvalue pointerValue   pointer [protected]
 

Rebuild the flow value.

Collect the current values of the given pointer using the meet function

void constantAnalyzer::record_change memoryDef   def [private]
 

Obsolete: Record a value change.

void constantAnalyzer::record_expression exprNode   expr,
const constant   val
[protected]
 

Record the value of an expression.

void constantAnalyzer::set_debug bool    new_val [inline]
 

Turn debug on or off.

void * constantAnalyzer::set_flowvalue const constant   val,
pointerValue   pointer
[protected]
 

Set the flow value.

Set the flow value in the given pointer value object

const constant* constantAnalyzer::top   const [inline]
 

TOP value.

bool constantAnalyzer::update_flowvalue const constant   val,
memoryDef   def
[protected]
 

Update a variable value.

Don't record any TOP values (because lookup_flowvalue() will return TOP by default). Also, return a boolean indicating if the update resulted in a change.


Member Data Documentation

const constant* constantAnalyzer::_bottom [private]
 

Unique lattice bottom element.

change_set constantAnalyzer::_changes [private]
 

Obsolete: Record changes.

TREE constant_set constantAnalyzer::_constants [private]
 

The set of all constants.

This set ensures that each unique constant value is represented by exactly one constant object. It "owns" all of the constant values. All other data structures refer to these.

bool constantAnalyzer::_debug [private]
 

Debug flag.

expr_value_map constantAnalyzer::_expr_values [private]
 

Record the value of each expression.

This ends up as the context insensitive information

const constant* constantAnalyzer::_top [private]
 

Unique lattice top element.

memorydef_constant_map constantAnalyzer::_values [private]
 

Variables values.

The value of each variable at the specified definition


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