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  

memoryBlock Class Reference

#include <memoryblock.h>

Inheritance diagram for memoryBlock:

PerClassHeap< PointersHeap > List of all members.

Public Types

typedef map< Location *, DestructiveKinddestructive_assignment_map
typedef destructive_assignment_map::iterator destructive_assignment_map_p
typedef destructive_assignment_map::const_iterator destructive_assignment_map_cp
typedef map< Location *, memoryblock_setcomplicit_assignment_map
typedef complicit_assignment_map::iterator complicit_assignment_map_p
typedef complicit_assignment_map::const_iterator complicit_assignment_map_cp
enum  DestructiveKind { Control_flow, Parameter_pass, Weak_update, Additive }
enum  Output_mode { NAME_ONLY, CURRENT_VALUE, AFTER_ASSIGNMENT, ALL_VALUES }

Public Member Functions

void clear ()
 Clear.

declNodedecl () const
procNodelocal_to () const
bool is_synthetic_decl () const
bool write_protected () const
void set_write_protected ()
bool is_indexed () const
void set_indexed ()
stmtLocationallocation_site () const
bool is_heap_object () const
void set_heap_object (stmtLocation *alloc_site)
bool is_allocation_object () const
memoryUsecurrent_use () const
memoryDefcurrent_def () const
void reset_current_def_use (Location *unused)
void set_current_def_use (Location *where)
memoryBlock * container () const
bool is_flow_sensitive () const
void set_flow_sensitive ()
void set_flow_insensitive ()
bool is_unify () const
void set_unify (bool flag)
UnifyTypeunifyType () const
void unifyType (UnifyType *t)
bool is_single_assignment () const
bool is_return_value () const
bool set_return_value ()
procedureinfo_setinput_to ()
memoryDefdef_at (Location *where, bool &is_new)
 Create a definition.

memoryDefnearest_def_at (Location *where)
 Find the nearest dominating def.

memoryUseuse_at (Location *where)
 Find the nearest interprocedural dominating def Create a use.

memoryDeflast_def_at (basicblockLocation *block)
 Find the last def in a basic block.

memoryDeffind_def_at (Location *where)
 Find a def.

memoryUsefind_use_at (Location *where)
 Find a use.

void find_uses_at (Location *where, memoryuse_set &uses)
 Find uses.

const memorydef_listdefs () const
 List of defs.

void add_parameter_assignment (procNode *proc, stmtLocation *callsite, memoryBlock *block)
 Add a parameter-assignment.

void add_parameter_assignment (procNode *proc, stmtLocation *callsite, memoryblock_set &blocks)
 Add a parameter-assignment.

const callsite_objects_mapparameter_assignments (procNode *proc)
 Get parameter-assignments.

void apply_weak_update (Location *current, memoryDef *previous_def, memoryuse_set &uses)
 Apply weak update.

void setup_merge_uses_at (basicblockLocation *merge_location, memoryDef *reaching_def, basicblock_set &predecessors)
 Set up a merge point.

void merge_uses_at (basicblockLocation *where, memoryuse_list &uses, cfg_edge_set &active_edges, memoryDef *dominating_def, bool computePointers)
 Process a merge point.

void reachable_blocks (Location *where, bool has_use_here, memoryblock_list &worklist, memoryblock_set &already_seen, memoryBlock *null)
 Reachable blocks.

memoryBlock * get_allocation_object (memoryModel &Memory)
 Get the allocation object.

memoryBlock * allocation_object ()
 Return the allocation object.

Multiplicity at_allocation (Location *current, memoryDef *reaching_def, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes)
 At an allocation.

Multiplicity at_deallocation (Location *current, memoryDef *reaching_def, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes)
 At a deallocation.

memoryBlock * top_most_container ()
 Top-most container.

memoryblock_set containers () const
memoryblock_set top_most_containers ()
void def_uses (memoryDef *def, memoryuse_list &uses)
 Def uses.

void prune_defs_uses ()
void dot (const string &field_name, declNode *field_decl, memoryModel &Memory, memoryblock_set &results)
bool is_array () const
bool is_array_element () const
void set_array_element (memoryBlock *element)
memoryBlock * get_array_element ()
memoryDefsetup_array_def ()
bool in_scope (basicblockLocation *where) const
void print (ostream &o, Location *path, Output_mode mode=CURRENT_VALUE) const
string name () const
string generate_su_field_name (const string &field) const
void print_def_use (ostream &o) const
void update_def_use_chains ()
void stats (ostream &out, bool header, long int &global_defs, long int &global_merge_defs, long int &global_weak_defs, long int &global_uses, long int &global_merge_uses)
Precision analysis
void add_destructive_assignment (Location *where, DestructiveKind cause)
 Add destructive assignment.

void add_complicit_assignment (Location *where, memoryblock_set &objects)
 Add complicit assignment.

void add_complicit_assignment (Location *where, memoryBlock *object)
 Add complicit assignment.

const destructive_assignment_mapdestructive_assignments () const
 Get destructive assignment list.

const complicit_assignment_mapcomplicit_assignments () const
 Get the complicit assignment list.

void add_to_flow_sensitive_list (flow_sensitive_set &flow_sensitive_objects)
 Add to flow-sensitivity list.

bool is_in_flow_sensitive_list (flow_sensitive_set &flow_sensitive_objects)
 Find in flow-sensitivity list.

void set_flow_sensitivity (flow_sensitive_set &flow_sensitive_objects)
 Set flow sensivity.

void add_to_non_unify_list (UnifyTypes &non_unify_types)
 Add to non-unify list.

void set_unification (UnifyTypes &unify_types)
 Set unification.


Static Public Member Functions

void stats ()
void print_multiplicity (Multiplicity m, ostream &out)
 Print multiplicity values.


Public Attributes

enumPropertyAnn * property
 Property handle.

memoryblock_vector property_blocks
 Property blocks.


Static Public Attributes

int memoryblock_count = 0

Private Member Functions

 memoryBlock (declNode *decl, bool synthetic, memoryBlock *container, procNode *local_to)
 Create a new memoryBlock.

 ~memoryBlock ()
 Destructor.

memoryblock_set top_most_containers (memoryblock_set &visited)

Private Attributes

REF memoryBlock * _container
 The containing struct, if there is one.

parameter_assign_map _parameter_assignments
 Parameter-assignments.

REF memoryUse_current_use
 Current use.

REF memoryDef_current_def
 Current def.

component_map _components
 A list of things contained in this memory block.

declNode_decl
 The declaration of this object.

int _synthetic_decl:1
 Synthetic declaration flag.

int _write_protected:1
 Write protected.

int _is_array:1
 Is array.

int _is_array_element:1
 Is array element.

int _is_indexed:1
 Is indexed.

int _is_allocation_object:1
 Is alloc object.

int _flow_sensitive:1
 Flow sensitivity.

int _unify:1
 Unification.

int _single_assignment:1
 Single assignment.

int _is_return_value:1
 Is return value?

procNode_local_to
 Owner procedure.

stmtLocation_allocation_site
 Name Heap allocation site.

memoryBlock * _allocation_object
 Initializer def Allocation object.

procedureinfo_set _input_to
 Only def Only use Input to.

destructive_assignment_map _destructive_assignments
 Destructive assignments.

complicit_assignment_map _complicit_assignments
 Complicit assignments.

UnifyType_unifytype
 information on unified type, if this object is unified.

TREE orderedDefs Defs
TREE orderedUses Uses

Static Private Attributes

FieldNameDB FieldNames

Friends

class memoryModel
ostream & operator<< (ostream &o, const memoryBlock &mb)

Member Typedef Documentation

typedef map< Location *, memoryblock_set > memoryBlock::complicit_assignment_map
 

Definition at line 90 of file memoryblock.h.

typedef complicit_assignment_map::const_iterator memoryBlock::complicit_assignment_map_cp
 

Definition at line 92 of file memoryblock.h.

typedef complicit_assignment_map::iterator memoryBlock::complicit_assignment_map_p
 

Definition at line 91 of file memoryblock.h.

typedef map< Location *, DestructiveKind > memoryBlock::destructive_assignment_map
 

Definition at line 86 of file memoryblock.h.

typedef destructive_assignment_map::const_iterator memoryBlock::destructive_assignment_map_cp
 

Definition at line 88 of file memoryblock.h.

typedef destructive_assignment_map::iterator memoryBlock::destructive_assignment_map_p
 

Definition at line 87 of file memoryblock.h.


Member Enumeration Documentation

enum memoryBlock::DestructiveKind
 

Enumeration values:
Control_flow 
Parameter_pass 
Weak_update 
Additive 

Definition at line 84 of file memoryblock.h.

enum memoryBlock::Output_mode
 

Enumeration values:
NAME_ONLY 
CURRENT_VALUE 
AFTER_ASSIGNMENT 
ALL_VALUES 

Definition at line 732 of file memoryblock.h.


Constructor & Destructor Documentation

memoryBlock::memoryBlock declNode   decl,
bool    synthetic,
memoryBlock *    container,
procNode   local_to
[private]
 

Create a new memoryBlock.

The new memoryBlock is associated with the given declNode, which may have been synthetically created. Only the memoryModel class should be allocating new memoryBlocks.

Definition at line 54 of file memoryblock.cc.

References allocation_site(), is_heap_object(), is_indexed(), is_return_value(), memoryblock_count, set_heap_object(), set_indexed(), and set_return_value().

memoryBlock::~memoryBlock   [private]
 

Destructor.

Destroy the memoryBlock and all use/def information. This should only be called by the memoryModel class destructor.

Definition at line 107 of file memoryblock.cc.

References _decl, _synthetic_decl, UnifyType::block(), clear(), is_heap_object(), memoryblock_count, and unifyType().


Member Function Documentation

void memoryBlock::add_complicit_assignment Location   where,
memoryBlock *    object
 

Add complicit assignment.

Add one object to the complicit assignment set for the given location.

Definition at line 1339 of file memoryblock.cc.

References _complicit_assignments.

void memoryBlock::add_complicit_assignment Location   where,
memoryblock_set   objects
 

Add complicit assignment.

Add the given objects to the complicit assignment set for the given location.

Definition at line 1303 of file memoryblock.cc.

References _complicit_assignments, vector_set< memoryBlock * >::insert(), memoryblock_set_p, name(), and write_protected().

Referenced by Pointers::assignment_operator().

void memoryBlock::add_destructive_assignment Location   where,
DestructiveKind    cause
 

Add destructive assignment.

Add the given cause and location to the destructive assignment list. If it already exists, the cause is overwritten.

Definition at line 1277 of file memoryblock.cc.

References _destructive_assignments, Additive, Control_flow, name(), Parameter_pass, and Weak_update.

Referenced by Pointers::assignment_operator(), Pointers::merge_operator(), and Pointers::self_assignment().

void memoryBlock::add_parameter_assignment procNode   proc,
stmtLocation   callsite,
memoryblock_set   blocks
 

Add a parameter-assignment.

This version is used for regular formal parameter assignments, where there could be multiple actual parameters coming from different objects.

Definition at line 475 of file memoryblock.cc.

References _parameter_assignments.

void memoryBlock::add_parameter_assignment procNode   proc,
stmtLocation   callsite,
memoryBlock *    block
 

Add a parameter-assignment.

Record the procedure, callsite and reaching def. This version is used for self-assignments when there is just one reaching def and it belongs to this object.

Definition at line 460 of file memoryblock.cc.

References _parameter_assignments, and vector_set< memoryBlock * >::insert().

Referenced by Pointers::assignment_operator(), and Pointers::self_assignment().

void memoryBlock::add_to_flow_sensitive_list flow_sensitive_set   flow_sensitive_objects
 

Add to flow-sensitivity list.

This method adds the block to the given flow-sensitivity list. It does this by adding a flow_sensitive_pair object containing a statement and a declaration, which can be used to identify the block on subsequent analysis passes. We need this capability because the memoryBlocks themselves are destroyed and recreated on each pass.

Definition at line 1352 of file memoryblock.cc.

References allocation_site(), container(), decl(), flow_sensitive_set_p, is_heap_object(), is_synthetic_decl(), name(), declNode::name(), and stmtLocation::stmt().

void memoryBlock::add_to_non_unify_list UnifyTypes   non_unify_types
 

Add to non-unify list.

This method adds the block to the given flow-sensitivity list. It does this by adding a flow_sensitive_pair object containing a statement and a declaration, which can be used to identify the block on subsequent analysis passes. We need this capability because the memoryBlocks themselves are destroyed and recreated on each pass.

Definition at line 1513 of file memoryblock.cc.

References name(), and unifyType().

memoryBlock * memoryBlock::allocation_object  
 

Return the allocation object.

Returns null if the block has no allocation object.

Definition at line 1033 of file memoryblock.cc.

References _allocation_object, and _container.

Referenced by Pointers::assignment_operator().

stmtLocation* memoryBlock::allocation_site   const [inline]
 

Definition at line 377 of file memoryblock.h.

Referenced by add_to_flow_sensitive_list(), is_in_flow_sensitive_list(), memoryBlock(), and Pointers::record_external_inputs_and_outputs().

void memoryBlock::apply_weak_update Location   current,
memoryDef   previous_def,
memoryuse_set   uses
 

Apply weak update.

This method is used to collect the previous points-to values in the case of a weak def. It assumes that a def has just been created for the given location.

Definition at line 481 of file memoryblock.cc.

References memoryDef::add_pointers(), current_def(), memoryDef::points_to(), memoryUse::reaching_def(), memoryAccess::set_weak(), and use_at().

Referenced by Pointers::assignment_operator().

Multiplicity memoryBlock::at_allocation Location   current,
memoryDef   reaching_def,
memoryblock_set   defs,
memoryuse_set   uses,
memoryblock_set   changes
 

At an allocation.

This method handles the multiplicity analysis for a heap allocation site. It should only be called on the special allocation object. The method returns the new multiplicity value.

Definition at line 1048 of file memoryblock.cc.

References _container, Bounded, Deallocated, def, def_at(), Error, vector_set< memoryBlock * >::insert(), is_flow_sensitive(), memoryAccess::multiplicity(), Multiplicity, name(), print_multiplicity(), Single, Unallocated, Unbounded, use, and use_at().

Referenced by Pointers::at_allocation().

Multiplicity memoryBlock::at_deallocation Location   current,
memoryDef   reaching_def,
memoryblock_set   defs,
memoryuse_set   uses,
memoryblock_set   changes
 

At a deallocation.

This method handles the multiplicity analysis for a heap deallocation site. The same conditions hold for this method as for at_allocation() above.

Definition at line 1147 of file memoryblock.cc.

References _container, Bounded, Deallocated, def, def_at(), Error, vector_set< memoryBlock * >::insert(), is_flow_sensitive(), memoryAccess::multiplicity(), Multiplicity, name(), print_multiplicity(), Single, Unallocated, Unbounded, use, and use_at().

Referenced by Pointers::at_deallocation().

void memoryBlock::clear  
 

Clear.

Remove all def and use information, preparing for reanalysis.

Definition at line 119 of file memoryblock.cc.

References _current_def, orderedUses::clear(), orderedDefs::clear(), orderedDefs::def_list(), Defs, defs(), is_array(), memorydef_list_cp, unifyType(), and Uses.

Referenced by memoryModel::clear(), and ~memoryBlock().

const complicit_assignment_map& memoryBlock::complicit_assignments   const [inline]
 

Get the complicit assignment list.

Definition at line 627 of file memoryblock.h.

memoryBlock* memoryBlock::container   const [inline]
 

Definition at line 390 of file memoryblock.h.

Referenced by add_to_flow_sensitive_list(), containers(), Pointers::current_multiplicity(), memoryModel::generate_su_field(), is_in_flow_sensitive_list(), name(), Pointers::self_assignment(), and top_most_containers().

memoryblock_set memoryBlock::containers   const
 

Definition at line 1605 of file memoryblock.cc.

References UnifyType::blank, BLANK, BOTTOM, container(), vector_set< memoryBlock * >::find(), vector_set< memoryBlock * >::insert(), name(), UnifyType::object, OBJECT, UnifyType::objTyp(), Unify_Object::p, Unify_Structure::p, Unify_Simple::p, Unify_Blank::p, Unify_Parents::parents(), UnifyType::simple, SIMPLE, UnifyType::structure, STRUCTURE, and unifyType().

Referenced by top_most_containers().

memoryDef* memoryBlock::current_def   const [inline]
 

Definition at line 384 of file memoryblock.h.

Referenced by procedureInfo::add_external_output(), apply_weak_update(), constantAnalyzer::at_assignment(), constantAnalyzer::at_conservative_procedure_call(), livenessAnalyzer::at_merge(), constantAnalyzer::at_merge(), constantAnalyzer::at_parameter_pass(), constantAnalyzer::at_self_assignment(), procedureInfo::check_merge_point(), livenessAnalyzer::collectDefs(), Pointers::nearest_def_at(), Pointers::print_memoryblock_def_set(), Pointers::process_local_changes(), Pointers::record_external_inputs_and_outputs(), and procedureInfo::setup_merge_point().

memoryUse* memoryBlock::current_use   const [inline]
 

Definition at line 383 of file memoryblock.h.

Referenced by Pointers::assignment_operator(), constantAnalyzer::at_assignment(), constantAnalyzer::at_self_assignment(), Pointers::conservative_procedure_call(), Pointers::dot_operator(), memoryModel::generate_array_elements_for(), memoryModel::initialize_struct(), constantAnalyzer::rebuild_flowvalue(), and Pointers::star_operator().

declNode* memoryBlock::decl   const [inline]
 

Definition at line 364 of file memoryblock.h.

Referenced by add_to_flow_sensitive_list(), Pointers::assignment_operator(), dot(), Pointers::dot_operator(), UnificationBasedPtr::ecrDeref(), UnificationBasedPtr::ensure_struct_obj(), Pointers::eval(), memoryModel::generate_array_elements_for(), memoryModel::generate_su_field(), generate_su_field_name(), Pointers::is_allocation(), Pointers::is_deallocation(), Pointers::is_exit(), is_in_flow_sensitive_list(), Pointers::is_reallocation(), Pointers::is_va_arg(), Pointers::is_va_start(), ipConstantPropagation::lookup(), name(), Pointers::procedure_call(), constantAnalyzer::rebuild_flowvalue(), Pointers::record_external_inputs_and_outputs(), Pointers::self_assignment(), Pointers::star_operator(), top_most_container(), and top_most_containers().

memoryDef * memoryBlock::def_at Location   where,
bool &    is_new
 

Create a definition.

Create a def of the memoryBlock at the given location, if one doesn't already exist. Return the memoryDef object, and also set the current_def to this def.

Definition at line 167 of file memoryblock.cc.

References _current_def, _single_assignment, Location::BasicBlock, Defs, is_array(), is_flow_sensitive(), Location::kind(), orderedDefs::make_def_at(), name(), procLocation::proc(), Location::Procedure, setup_array_def(), Location::Statement, stmtLocation::stmt(), memoryAccess::where(), and write_protected().

Referenced by Pointers::assignment_operator(), at_allocation(), at_deallocation(), Pointers::conservative_procedure_call(), memoryModel::generate_array_elements_for(), memoryModel::initialize_struct(), Pointers::merge_operator(), and Pointers::self_assignment().

void memoryBlock::def_uses memoryDef   def,
memoryuse_list   uses
 

Def uses.

Collect all the uses reached by the given definition.

Definition at line 1703 of file memoryblock.cc.

References orderedUses::def_uses(), and Uses.

Referenced by livenessAnalyzer::determineLiveness().

const memorydef_list& memoryBlock::defs   const [inline]
 

List of defs.

Return a list of all the defs of this object.

Definition at line 483 of file memoryblock.h.

Referenced by clear().

const destructive_assignment_map& memoryBlock::destructive_assignments   const [inline]
 

Get destructive assignment list.

Definition at line 622 of file memoryblock.h.

void memoryBlock::dot const string &    field_name,
declNode   field_decl,
memoryModel   Memory,
memoryblock_set   results
 

Definition at line 776 of file memoryblock.cc.

References _components, _local_to, component_map_p, decl(), declNode::decl_location(), FieldNames, Func, memoryModel::generate_su_field(), memoryBlock::FieldNameDB::get_field(), vector_set< memoryBlock * >::insert(), is_unify(), declNode::name(), name(), declNode::no_tdef_type(), declNode::PROC, Node::typ(), and memoryModel::unification().

Referenced by Pointers::dot_operator(), and memoryModel::initialize_struct().

memoryDef * memoryBlock::find_def_at Location   where
 

Find a def.

See if there is a def at the given location, but return NULL if there isn't one.

Definition at line 398 of file memoryblock.cc.

References _current_def, Defs, orderedDefs::find_def(), is_array(), is_flow_sensitive(), and setup_array_def().

Referenced by Pointers::assignment_operator(), and precisionAnalyzer::report().

memoryUse * memoryBlock::find_use_at Location   where
 

Find a use.

See if there is a use of this block at the given location, returning NULL if there isn't. This version does not work for merge uses.

Definition at line 426 of file memoryblock.cc.

References _current_use, orderedUses::find_use(), is_flow_sensitive(), and Uses.

Referenced by reachable_blocks().

void memoryBlock::find_uses_at Location   where,
memoryuse_set   uses
 

Find uses.

Return any uses at this location. This version does work for merge uses.

Definition at line 449 of file memoryblock.cc.

References orderedUses::find_uses_at(), and Uses.

string memoryBlock::generate_su_field_name const string &    field const
 

Definition at line 2000 of file memoryblock.cc.

References _decl, decl(), typeNode::is_ellipsis(), declNode::name(), and declNode::type().

memoryBlock * memoryBlock::get_allocation_object memoryModel   Memory
 

Get the allocation object.

Get the allocation object, creating it if necessary. This object is used to track the state of heap allocated objects (multiplicity analysis).

Definition at line 975 of file memoryblock.cc.

References _allocation_object, _container, _is_allocation_object, memoryModel::generate_su_field(), is_flow_sensitive(), is_unify(), name(), set_flow_insensitive(), set_flow_sensitive(), set_flow_sensitivity(), set_unify(), and pointerOptions::Unify_objects.

Referenced by Pointers::at_allocation(), Pointers::at_deallocation(), and Pointers::current_multiplicity().

memoryBlock * memoryBlock::get_array_element  
 

Definition at line 862 of file memoryblock.cc.

References _components, and component_map_p.

Referenced by setup_array_def().

bool memoryBlock::in_scope basicblockLocation   where const
 

Definition at line 1734 of file memoryblock.cc.

References _local_to, procLocation::parent_proc(), procLocation::proc(), and basicblockLocation::proc_location().

Referenced by mergePoints::add_block_to_merge_point().

procedureinfo_set& memoryBlock::input_to   [inline]
 

Definition at line 412 of file memoryblock.h.

References procedureinfo_set.

Referenced by Pointers::process_local_changes(), and Pointers::record_external_inputs_and_outputs().

bool memoryBlock::is_allocation_object   const [inline]
 

Definition at line 381 of file memoryblock.h.

References _is_allocation_object.

Referenced by Pointers::merge_operator(), Pointers::self_assignment(), and top_most_containers().

bool memoryBlock::is_array   const [inline]
 

Definition at line 708 of file memoryblock.h.

References _is_array.

Referenced by clear(), def_at(), find_def_at(), last_def_at(), nearest_def_at(), reset_current_def_use(), set_current_def_use(), and use_at().

bool memoryBlock::is_array_element   const [inline]
 

Definition at line 710 of file memoryblock.h.

References _is_array_element.

Referenced by name().

bool memoryBlock::is_flow_sensitive   const [inline]
 

Definition at line 392 of file memoryblock.h.

References _flow_sensitive.

Referenced by Pointers::assignment_operator(), Pointers::at_allocation(), at_allocation(), Pointers::at_deallocation(), at_deallocation(), procedureInfo::check_merge_point(), Pointers::current_multiplicity(), def_at(), find_def_at(), find_use_at(), get_allocation_object(), last_def_at(), nearest_def_at(), Pointers::pass_one_external_input(), Pointers::pass_one_external_output(), Pointers::process_local_changes(), Pointers::process_merge_point(), Pointers::record_external_inputs_and_outputs(), reset_current_def_use(), Pointers::self_assignment(), set_current_def_use(), procedureInfo::setup_merge_point(), and use_at().

bool memoryBlock::is_heap_object   const [inline]
 

Definition at line 378 of file memoryblock.h.

Referenced by add_to_flow_sensitive_list(), Pointers::current_multiplicity(), constantAnalyzer::evaluate_points_to(), is_in_flow_sensitive_list(), memoryBlock(), Pointers::record_external_inputs_and_outputs(), stats(), and ~memoryBlock().

bool memoryBlock::is_in_flow_sensitive_list flow_sensitive_set   flow_sensitive_objects
 

Find in flow-sensitivity list.

Return true if the block is identified in the given list.

Definition at line 1411 of file memoryblock.cc.

References allocation_site(), container(), decl(), flow_sensitive_set_p, is_heap_object(), is_synthetic_decl(), name(), declNode::name(), and stmtLocation::stmt().

Referenced by set_flow_sensitivity().

bool memoryBlock::is_indexed   const [inline]
 

Definition at line 372 of file memoryblock.h.

References _is_indexed.

Referenced by Pointers::current_multiplicity(), and memoryBlock().

bool memoryBlock::is_return_value   const [inline]
 

Definition at line 406 of file memoryblock.h.

References _is_return_value.

Referenced by Pointers::dot_operator(), Pointers::generate_uses(), memoryBlock(), and Pointers::star_operator().

bool memoryBlock::is_single_assignment   const [inline]
 

Definition at line 404 of file memoryblock.h.

References _single_assignment.

bool memoryBlock::is_synthetic_decl   const [inline]
 

Definition at line 367 of file memoryblock.h.

References _synthetic_decl.

Referenced by add_to_flow_sensitive_list(), and is_in_flow_sensitive_list().

bool memoryBlock::is_unify   const [inline]
 

Definition at line 399 of file memoryblock.h.

References _unify.

Referenced by Pointers::assignment_operator(), dot(), Pointers::dot_operator(), get_allocation_object(), Pointers::record_external_inputs_and_outputs(), set_unification(), Pointers::star_operator(), and top_most_container().

memoryDef * memoryBlock::last_def_at basicblockLocation   block
 

Find the last def in a basic block.

This is used when processing merge (phi function) to find the reaching definition for each input to the merge. It finds the def that dominates the last statement of the basic block.

Definition at line 365 of file memoryblock.cc.

References _current_def, def, Defs, orderedDefs::find_dominating_def(), is_array(), is_flow_sensitive(), basicblockLocation::last(), orderedDefs::make_def_at(), and setup_array_def().

Referenced by procedureInfo::check_merge_point(), and Pointers::process_local_changes().

procNode* memoryBlock::local_to   const [inline]
 

Definition at line 365 of file memoryblock.h.

Referenced by memoryModel::create_memory_object(), procedureDB::is_visible_to(), procedureDB::is_visible_to_caller(), Pointers::nearest_def_at(), Pointers::record_external_inputs_and_outputs(), and top_most_containers().

void memoryBlock::merge_uses_at basicblockLocation   where,
memoryuse_list   uses,
cfg_edge_set   active_edges,
memoryDef   dominating_def,
bool    computePointers
 

Process a merge point.

When a merge point is actually encountered, this function returns the list of merge uses (inputs to the phi function), which will have been previously set up by the setup_merge_uses_at() method above. In addition, during the computation of def-use chains, this method finds the reaching def for each merge use (I believe that I've found a clever way to do this).

Definition at line 591 of file memoryblock.cc.

References basicblock_list, basicblockLocation::block(), cfg_edge_pair, basicblockNode::dfn(), orderedUses::make_merge_uses_at(), name(), pred_use_map, pred_use_map_cp, basicblockNode::preds(), basicblockLocation::proc_location(), use, and Uses.

Referenced by Pointers::process_merge_point().

string memoryBlock::name   const
 

Definition at line 1956 of file memoryblock.cc.

References _decl, _local_to, container(), procNode::decl(), decl(), declNode::decl_location(), is_array_element(), typeNode::is_ellipsis(), declNode::name(), procLocation::proc(), Location::procedure(), procLocation::stmt_location(), declNode::type(), and declNode::UNKNOWN.

Referenced by mergePoints::add_block_to_merge_point(), add_complicit_assignment(), add_destructive_assignment(), procedureInfo::add_external_input(), procedureInfo::add_external_output(), add_to_flow_sensitive_list(), add_to_non_unify_list(), Pointers::assignment_operator(), at_allocation(), Pointers::at_deallocation(), at_deallocation(), containers(), memoryModel::create_memory_object(), def_at(), livenessAnalyzer::determineLiveness(), dot(), Pointers::dot_operator(), memoryModel::generate_array_elements_for(), memoryModel::generate_su_field(), get_allocation_object(), memoryModel::initialize_struct(), is_in_flow_sensitive_list(), Pointers::merge_operator(), merge_uses_at(), Pointers::nearest_def_at(), Pointers::pass_external_outputs(), Pointers::pass_one_external_input(), Pointers::pass_one_external_output(), Pointers::pass_parameters(), print(), print_def_use(), Pointers::print_memoryblock_def_set(), Pointers::print_memorydef_set(), Pointers::procedure_call(), Pointers::process_local_changes(), constantAnalyzer::rebuild_flowvalue(), Pointers::record_external_inputs_and_outputs(), precisionAnalyzer::report(), Pointers::self_assignment(), set_unification(), procedureInfo::setup_merge_point(), Pointers::star_operator(), stats(), top_most_container(), top_most_containers(), UnificationBasedPtr::unify(), and use_at().

memoryDef * memoryBlock::nearest_def_at Location   where
 

Find the nearest dominating def.

This requires a dominance-based search through the ordered defs list to determine the nearest dominating definition. It is guaranteed to be unique by the placement of the merge nodes (phi functions).

Definition at line 251 of file memoryblock.cc.

References _current_def, def, Defs, orderedDefs::find_strictly_dominating_def(), is_array(), is_flow_sensitive(), orderedDefs::make_def_at(), and setup_array_def().

Referenced by Pointers::nearest_def_at(), Pointers::pass_one_external_output(), reachable_blocks(), and procedureInfo::setup_merge_point().

const callsite_objects_map& memoryBlock::parameter_assignments procNode   proc [inline]
 

Get parameter-assignments.

Return the reaching defs for a particular context-insensitive call.

Definition at line 507 of file memoryblock.h.

References callsite_objects_map.

void memoryBlock::print ostream &    o,
Location   path,
Output_mode    mode = CURRENT_VALUE
const
 

Definition at line 1884 of file memoryblock.cc.

References _components, ALL_VALUES, component_map_cp, memoryBlock::FieldNameDB::field_name(), FieldNames, memoryblock_list, memoryblock_list_p, name(), and NAME_ONLY.

void memoryBlock::print_def_use ostream &    o const
 

Definition at line 1860 of file memoryblock.cc.

References _components, component_map_cp, Defs, memoryBlock::FieldNameDB::field_name(), FieldNames, name(), orderedUses::print(), orderedDefs::print(), and Uses.

Referenced by Pointers::assignment_operator(), Pointers::merge_operator(), and Pointers::nearest_def_at().

void memoryBlock::print_multiplicity Multiplicity    m,
ostream &    out
[static]
 

Print multiplicity values.

Definition at line 1246 of file memoryblock.cc.

References Bounded, Deallocated, Error, Single, Top, Unallocated, and Unbounded.

Referenced by Pointers::assignment_operator(), at_allocation(), at_deallocation(), Pointers::merge_operator(), and Pointers::self_assignment().

void memoryBlock::prune_defs_uses  
 

Definition at line 1721 of file memoryblock.cc.

References Defs, and orderedDefs::prune().

void memoryBlock::reachable_blocks Location   where,
bool    has_use_here,
memoryblock_list   worklist,
memoryblock_set   already_seen,
memoryBlock *    null
 

Reachable blocks.

In the given context, return all of the memoryBlocks reachable by traversing pointers (the closure of the points-to relation).

Definition at line 907 of file memoryblock.cc.

References _components, component_map_p, def, vector_set< memoryBlock * >::find(), find_use_at(), vector_set< memoryBlock * >::insert(), memoryblock_set_cp, nearest_def_at(), and use.

Referenced by Pointers::reachable_blocks().

void memoryBlock::reset_current_def_use Location   unused
 

Definition at line 720 of file memoryblock.cc.

References _current_def, _current_use, is_array(), is_flow_sensitive(), and unifyType().

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

void memoryBlock::set_array_element memoryBlock *    element
 

Definition at line 833 of file memoryblock.cc.

References _components, _is_array, _local_to, set_write_protected(), and unifyType().

Referenced by memoryModel::generate_array_elements_for().

void memoryBlock::set_current_def_use Location   where
 

Definition at line 744 of file memoryblock.cc.

References _current_def, _current_use, Defs, orderedDefs::find_def(), orderedUses::find_use(), is_array(), is_flow_sensitive(), and Uses.

Referenced by procedureInfo::get_pending_changes().

void memoryBlock::set_flow_insensitive   [inline]
 

Definition at line 397 of file memoryblock.h.

References _flow_sensitive.

Referenced by get_allocation_object(), memoryModel::lookup_string_constant(), and set_flow_sensitivity().

void memoryBlock::set_flow_sensitive   [inline]
 

Definition at line 393 of file memoryblock.h.

References _flow_sensitive.

Referenced by get_allocation_object(), and set_flow_sensitivity().

void memoryBlock::set_flow_sensitivity flow_sensitive_set   flow_sensitive_objects
 

Set flow sensivity.

Check the given list of flow-sensitive objects to see if this block is identified on the list. Depending on the analysis mode, set the flow-sensitivity accordingly.

Definition at line 1474 of file memoryblock.cc.

References is_in_flow_sensitive_list(), set_flow_insensitive(), and set_flow_sensitive().

Referenced by memoryModel::generate_array_elements_for(), memoryModel::generate_su_field(), and get_allocation_object().

void memoryBlock::set_heap_object stmtLocation   alloc_site [inline]
 

Definition at line 379 of file memoryblock.h.

Referenced by memoryBlock().

void memoryBlock::set_indexed   [inline]
 

Definition at line 373 of file memoryblock.h.

References _is_indexed.

Referenced by Pointers::dot_operator(), memoryModel::generate_array_elements_for(), Pointers::mark_as_indexed(), memoryBlock(), and Pointers::setup_va_list_variables().

bool memoryBlock::set_return_value   [inline]
 

Definition at line 407 of file memoryblock.h.

References _is_return_value.

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

void memoryBlock::set_unification UnifyTypes   unify_types
 

Set unification.

Check the given list of unify objects to see if this block is identified on the list. Depending on the analysis mode, set the flow-sensitivity accordingly.

Definition at line 1528 of file memoryblock.cc.

References _unifytype, memoryModel::is_in_non_unify_list(), is_unify(), name(), set_unify(), pointerOptions::Unification, pointerOptions::Unify_objects, and unifyType().

Referenced by memoryModel::generate_array_elements_for(), and memoryModel::generate_su_field().

void memoryBlock::set_unify bool    flag [inline]
 

Definition at line 400 of file memoryblock.h.

References _unify.

Referenced by get_allocation_object(), and set_unification().

void memoryBlock::set_write_protected   [inline]
 

Definition at line 370 of file memoryblock.h.

References _write_protected.

Referenced by memoryModel::lookup_string_constant(), memoryModel::memoryModel(), and set_array_element().

memoryDef * memoryBlock::setup_array_def  
 

Definition at line 877 of file memoryblock.cc.

References _current_def, memoryDef::add_pointers(), get_array_element(), and vector_set< memoryBlock * >::insert().

Referenced by def_at(), find_def_at(), last_def_at(), nearest_def_at(), and use_at().

void memoryBlock::setup_merge_uses_at basicblockLocation   merge_location,
memoryDef   reaching_def,
basicblock_set   predecessors
 

Set up a merge point.

After encountering a def of the memoryBlock, set up the merge uses (inputs to the phi function) at the given merge location. The merge location will be a member of the dominance frontier of the def location.

Definition at line 516 of file memoryblock.cc.

References basicblock_set_p, basicblockLocation::block(), orderedUses::make_merge_uses_at(), pred_use_map, pred_use_map_cp, Location::strictly_dominates(), use, Uses, and memoryAccess::where().

Referenced by procedureInfo::setup_merge_point().

void memoryBlock::stats ostream &    out,
bool    header,
long int &    global_defs,
long int &    global_merge_defs,
long int &    global_weak_defs,
long int &    global_uses,
long int &    global_merge_uses
 

Definition at line 1755 of file memoryblock.cc.

References _local_to, procNode::decl(), Defs, is_heap_object(), declNode::name(), name(), orderedUses::stats(), orderedDefs::stats(), and Uses.

void memoryBlock::stats   [static]
 

Definition at line 148 of file memoryblock.cc.

References FieldNames, memoryblock_count, and memoryBlock::FieldNameDB::stats().

Referenced by memoryModel::stats().

memoryBlock * memoryBlock::top_most_container  
 

Top-most container.

Traverse the container chain up to find the top-most container.

Definition at line 1577 of file memoryblock.cc.

References _container, decl(), vector_set< memoryBlock * >::find(), is_unify(), memoryblock_set_p, name(), top_most_containers(), declNode::type(), pointerOptions::Unification, and unifyType().

Referenced by Pointers::record_external_inputs_and_outputs().

memoryblock_set memoryBlock::top_most_containers memoryblock_set   visited [private]
 

Definition at line 1666 of file memoryblock.cc.

References containers(), vector_set< memoryBlock * >::find(), vector_set< memoryBlock * >::insert(), memoryblock_set, memoryblock_set_p, and name().

memoryblock_set memoryBlock::top_most_containers  
 

Definition at line 1636 of file memoryblock.cc.

References container(), Node::coord(), procNode::decl(), decl(), declNode::decl_location(), declNode::ENUM, Func, vector_set< memoryBlock * >::insert(), is_allocation_object(), local_to(), declNode::name(), name(), typeNode::no_tdef_type(), declNode::no_tdef_type(), property, Ptr, Node::typ(), declNode::type(), and unifyType().

Referenced by Pointers::record_external_inputs_and_outputs(), and top_most_container().

void memoryBlock::unifyType UnifyType   t [inline]
 

Definition at line 402 of file memoryblock.h.

UnifyType* memoryBlock::unifyType   const [inline]
 

Definition at line 401 of file memoryblock.h.

Referenced by add_to_non_unify_list(), Pointers::assignment_operator(), clear(), containers(), memoryModel::create_memory_object(), Pointers::dot_operator(), memoryModel::generate_array_elements_for(), memoryModel::generate_su_field(), memoryModel::initialize_struct(), memoryModel::lookup_string_constant(), reset_current_def_use(), set_array_element(), set_unification(), UnificationBasedPtr::settype(), Pointers::star_operator(), top_most_container(), top_most_containers(), and ~memoryBlock().

void memoryBlock::update_def_use_chains  
 

Definition at line 1712 of file memoryblock.cc.

References orderedUses::update_def_use_chains(), and Uses.

memoryUse * memoryBlock::use_at Location   where
 

Find the nearest interprocedural dominating def Create a use.

Create a use of the memoryBlock at the given location, if one doesn't already exist. Return the memoryUse object and set the current_use to the use.

Definition at line 333 of file memoryblock.cc.

References _current_use, def, is_array(), is_flow_sensitive(), orderedUses::make_use_at(), name(), setup_array_def(), and Uses.

Referenced by apply_weak_update(), Pointers::assignment_operator(), at_allocation(), at_deallocation(), Pointers::current_multiplicity(), Pointers::dot_operator(), memoryModel::generate_array_elements_for(), Pointers::generate_uses(), memoryModel::initialize_struct(), Pointers::pass_one_external_input(), Pointers::pass_one_external_output(), Pointers::self_assignment(), and Pointers::star_operator().

bool memoryBlock::write_protected   const [inline]
 

Definition at line 369 of file memoryblock.h.

References _write_protected.

Referenced by add_complicit_assignment(), Pointers::assignment_operator(), constantAnalyzer::at_assignment(), constantAnalyzer::at_conservative_procedure_call(), Pointers::at_deallocation(), constantAnalyzer::at_self_assignment(), livenessAnalyzer::collectDefs(), Pointers::conservative_procedure_call(), def_at(), Pointers::dot_operator(), Pointers::merge_operator(), Pointers::pass_one_external_input(), Pointers::record_external_inputs_and_outputs(), and Pointers::self_assignment().


Friends And Related Function Documentation

friend class memoryModel [friend]
 

Definition at line 335 of file memoryblock.h.

ostream& operator<< ostream &    o,
const memoryBlock &    mb
[friend]
 

Definition at line 724 of file memoryblock.h.


Member Data Documentation

memoryBlock* memoryBlock::_allocation_object [private]
 

Initializer def Allocation object.

This is a pointer to a special memoryBlock that represents the allocation state of heap allocated objects. This object is used for the multiplicity analysis (which is a very sparse analysis problem).

Definition at line 273 of file memoryblock.h.

Referenced by allocation_object(), and get_allocation_object().

stmtLocation* memoryBlock::_allocation_site [private]
 

Name Heap allocation site.

For heap allocated objects, this field holds the statement that generate the allocation (typically malloc() or calloc()).

Definition at line 255 of file memoryblock.h.

complicit_assignment_map memoryBlock::_complicit_assignments [private]
 

Complicit assignments.

This map is used by the precision monitor to record complicit assignments: where they occur and the objects that are responsible.

Definition at line 309 of file memoryblock.h.

Referenced by add_complicit_assignment().

component_map memoryBlock::_components [private]
 

A list of things contained in this memory block.

Definition at line 153 of file memoryblock.h.

Referenced by dot(), get_array_element(), print(), print_def_use(), reachable_blocks(), and set_array_element().

REF memoryBlock* memoryBlock::_container [private]
 

The containing struct, if there is one.

Definition at line 101 of file memoryblock.h.

Referenced by allocation_object(), at_allocation(), at_deallocation(), get_allocation_object(), and top_most_container().

REF memoryDef* memoryBlock::_current_def [private]
 

Current def.

This pointer is used during expression evaluation to hold the current def of this block. It is set by the def_at() method. THIS WAS A BUG: we need to at least reset these values when a memoryBlock def leaves a procedure. The reason is that we can leave a procedure at any time (when it converges), which doesn't necessarily leave the most recent def in current_def.

NEW: for flow insensitive objects, we use this field to store the only def (at main).

Definition at line 149 of file memoryblock.h.

Referenced by clear(), def_at(), find_def_at(), last_def_at(), nearest_def_at(), reset_current_def_use(), set_current_def_use(), and setup_array_def().

REF memoryUse* memoryBlock::_current_use [private]
 

Current use.

This pointer is used during expression evaluation to hold the current use of this block. It is set by the use_at() method. I'm not sure where (or whether) it should be reset.

NEW: for flow insensitive objects, we use this field to store the only use (at main).

Definition at line 135 of file memoryblock.h.

Referenced by find_use_at(), reset_current_def_use(), set_current_def_use(), and use_at().

declNode* memoryBlock::_decl [private]
 

The declaration of this object.

This can be a synthetically created declNode for things that are not explicitly represented (like heap objects).

Definition at line 160 of file memoryblock.h.

Referenced by generate_su_field_name(), name(), and ~memoryBlock().

destructive_assignment_map memoryBlock::_destructive_assignments [private]
 

Destructive assignments.

This map is used by the precision monitor to record destructive assignments: where they occur and the cause.

Definition at line 302 of file memoryblock.h.

Referenced by add_destructive_assignment().

int memoryBlock::_flow_sensitive [private]
 

Flow sensitivity.

We can control flow-sensitivity on a per-object basis. When this flag is true this object is flow-sensitive. The default will be determined by the memoryModel.

Definition at line 210 of file memoryblock.h.

Referenced by is_flow_sensitive(), set_flow_insensitive(), and set_flow_sensitive().

procedureinfo_set memoryBlock::_input_to [private]
 

Only def Only use Input to.

This set contains all the procedures for which this object is an external input. We need this list for flow-insensitive objects so that we can force reanalysis of those procedures.

Definition at line 295 of file memoryblock.h.

int memoryBlock::_is_allocation_object [private]
 

Is alloc object.

This flag is set to true for the allocation object (see above).

Definition at line 202 of file memoryblock.h.

Referenced by get_allocation_object(), and is_allocation_object().

int memoryBlock::_is_array [private]
 

Is array.

This flag is set to true if this object is a C array.

Definition at line 181 of file memoryblock.h.

Referenced by is_array(), and set_array_element().

int memoryBlock::_is_array_element [private]
 

Is array element.

This flag is set to true if this object represents the elements of a C array.

Definition at line 188 of file memoryblock.h.

Referenced by is_array_element().

int memoryBlock::_is_indexed [private]
 

Is indexed.

This flag is set to true for objects that are indexed (array elements) or any memory that is accessed by pointer arithmetic. Such objects represent more than one actual objects.

Definition at line 196 of file memoryblock.h.

Referenced by is_indexed(), and set_indexed().

int memoryBlock::_is_return_value [private]
 

Is return value?

Return value variables are never recorded as uses.

Definition at line 233 of file memoryblock.h.

Referenced by is_return_value(), and set_return_value().

procNode* memoryBlock::_local_to [private]
 

Owner procedure.

For local variables, this points to the procedure that contains the declaration. This allows us to detect non-local access to local variables.

Definition at line 241 of file memoryblock.h.

Referenced by dot(), in_scope(), name(), set_array_element(), and stats().

parameter_assign_map memoryBlock::_parameter_assignments [private]
 

Parameter-assignments.

When this object is an input to a context-insensitive procedure, we merge its state from each of the possible call sites. This map keeps track of the reaching def for each callsite according to the procedure being called. If there is no reaching def, then the memoryDef pointer is null.

Definition at line 124 of file memoryblock.h.

Referenced by add_parameter_assignment().

int memoryBlock::_single_assignment [private]
 

Single assignment.

For flow-insensitive objects, record if there is only one assignment ever made to the object. This helps the adaptive algorithm avoid making too many variables flow sensitive.

Definition at line 227 of file memoryblock.h.

Referenced by def_at(), and is_single_assignment().

int memoryBlock::_synthetic_decl [private]
 

Synthetic declaration flag.

Set to true if the declNode object is synthetic (that is, created just so that there is something to put there). In this case, the destructor will also destroy the declNode.

Definition at line 168 of file memoryblock.h.

Referenced by is_synthetic_decl(), and ~memoryBlock().

int memoryBlock::_unify [private]
 

Unification.

We can control unification on a per-object basis. When this flag is true this object can be unified with another object. The default will be determined by the memoryModel.

Definition at line 219 of file memoryblock.h.

Referenced by is_unify(), and set_unify().

UnifyType* memoryBlock::_unifytype [private]
 

information on unified type, if this object is unified.

Definition at line 312 of file memoryblock.h.

Referenced by set_unification().

int memoryBlock::_write_protected [private]
 

Write protected.

We can mark objects as "write protected", which prevents any defs on them. For now, this is only used on the null object.

Definition at line 175 of file memoryblock.h.

Referenced by set_write_protected(), and write_protected().

TREE orderedDefs memoryBlock::Defs [private]
 

The defs are maintained in the dominating order described in memoryaccess.h. The uses are maintained as a multi-map from the program location to the memoryUse object. It's a multimap because a merge (phi) will return multiple uses.

Definition at line 111 of file memoryblock.h.

Referenced by clear(), def_at(), find_def_at(), last_def_at(), nearest_def_at(), print_def_use(), prune_defs_uses(), set_current_def_use(), and stats().

memoryBlock::FieldNameDB memoryBlock::FieldNames [static, private]
 

Definition at line 2023 of file memoryblock.cc.

Referenced by dot(), print(), print_def_use(), and stats().

int memoryBlock::memoryblock_count = 0 [static]
 

Definition at line 49 of file memoryblock.cc.

Referenced by memoryBlock(), stats(), and ~memoryBlock().

enumPropertyAnn* memoryBlock::property
 

Property handle.

In Broadway, we create special memoryBlocks that represent the value of a particular property. This handle allows us to get from the memoryBlock to the property it represents.

Definition at line 324 of file memoryblock.h.

Referenced by Pointers::pass_one_external_input(), Pointers::process_local_changes(), Pointers::self_assignment(), and top_most_containers().

memoryblock_vector memoryBlock::property_blocks
 

Property blocks.

Each regular memoryBlock has a vector of pointers to the property blocks.

Definition at line 331 of file memoryblock.h.

TREE orderedUses memoryBlock::Uses [private]
 

Definition at line 112 of file memoryblock.h.

Referenced by clear(), def_uses(), find_use_at(), find_uses_at(), merge_uses_at(), print_def_use(), set_current_def_use(), setup_merge_uses_at(), stats(), update_def_use_chains(), and use_at().


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

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