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

memoryBlock Class Reference

#include <memoryblock.h>

Inheritance diagram for memoryBlock::

PerClassHeap< PointersHeap > List of all members.

Public Types

enum  Output_mode { NAME_ONLY, CURRENT_VALUE, AFTER_ASSIGNMENT, ALL_VALUES }

Public Methods

void clear ()
 Clear. More...

declNodedecl () const
procNodelocal_to () const
bool multiplicity () const
void set_multiplicity ()
bool write_protected () const
void set_write_protected ()
memoryUsecurrent_use () const
memoryDefcurrent_def () const
void reset_current_def_use (Location *unused)
void set_current_def_use (Location *where)
memoryDefdef_at (Location *where, bool &is_new)
memoryDefnearest_def_at (Location *where)
memoryUseuse_at (Location *where)
memoryDeflast_def_at (basicblockLocation *block)
memoryDeffind_def_at (Location *where)
void set_current_to_nearest_def_at (Location *where)
void setup_merge_uses_at (basicblockLocation *merge_location, memoryDef *reaching_def, basicblock_set &predecessors)
void merge_uses_at (basicblockLocation *where, memoryuse_list &uses, bool computePointers)
void reachable_blocks (Location *where, memoryblock_list &worklist, memoryblock_set &already_seen, memoryBlock *null)
void prune_defs_uses ()
void dot (const string &field_name, declNode *field_decl, memoryModel &Memory, memoryblock_set &results)
bool is_array () 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
void print_def_use (ostream &o) const
void update_def_use_chains ()
int num_defs () const

Static Public Methods

void stats ()

Private Methods

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

 ~memoryBlock ()
 Destructor. More...


Private Attributes

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

REF memoryUse_current_use
 Current use. More...

REF memoryDef_current_def
 Current def. More...

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

declNode_decl
 The declaration of this object. More...

bool _synthetic_decl
 Synthetic declaration flag. More...

procNode_local_to
 Owner procedure. More...

bool _multiplicity
 Multiplicity flag. More...

bool _write_protected
 Write protected. More...

bool _is_array
 Is array. More...

memoryDef_initializer_def
 Initializer def. More...

TREE orderedDefs Defs
TREE orderedUses Uses

Static Private Attributes

FieldNameDB FieldNames

Friends

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

Member Enumeration Documentation

enum memoryBlock::Output_mode
 

Enumeration values:
NAME_ONLY 
CURRENT_VALUE 
AFTER_ASSIGNMENT 
ALL_VALUES 


Constructor & Destructor Documentation

memoryBlock::memoryBlock declNode   decl,
bool    synthetic,
memoryBlock *    container,
procNode   local_to = 0
[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.

memoryBlock::~memoryBlock   [private]
 

Destructor.

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


Member Function Documentation

void memoryBlock::clear  
 

Clear.

Remove all def and use information, preparing for reanalysis.

memoryDef* memoryBlock::current_def   const [inline]
 

memoryUse* memoryBlock::current_use   const [inline]
 

declNode* memoryBlock::decl   const [inline]
 

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

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

memoryDef * memoryBlock::find_def_at Location   where
 

memoryBlock * memoryBlock::get_array_element  
 

bool memoryBlock::in_scope basicblockLocation   where const
 

bool memoryBlock::is_array   const [inline]
 

memoryDef * memoryBlock::last_def_at basicblockLocation   block
 

procNode* memoryBlock::local_to   const [inline]
 

void memoryBlock::merge_uses_at basicblockLocation   where,
memoryuse_list   uses,
bool    computePointers
 

bool memoryBlock::multiplicity   const [inline]
 

string memoryBlock::name   const
 

memoryDef * memoryBlock::nearest_def_at Location   where
 

int memoryBlock::num_defs   const [inline]
 

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

void memoryBlock::print_def_use ostream &    o const
 

void memoryBlock::prune_defs_uses  
 

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

void memoryBlock::reset_current_def_use Location   unused
 

void memoryBlock::set_array_element memoryBlock *    element
 

void memoryBlock::set_current_def_use Location   where
 

void memoryBlock::set_current_to_nearest_def_at Location   where
 

void memoryBlock::set_multiplicity   [inline]
 

void memoryBlock::set_write_protected   [inline]
 

memoryDef * memoryBlock::setup_array_def  
 

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

void memoryBlock::stats   [static]
 

void memoryBlock::update_def_use_chains  
 

memoryUse * memoryBlock::use_at Location   where
 

bool memoryBlock::write_protected   const [inline]
 


Friends And Related Function Documentation

friend class memoryModel [friend]
 

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


Member Data Documentation

component_map memoryBlock::_components [private]
 

A list of things contained in this memory block.

REF const memoryBlock* memoryBlock::_container [private]
 

The containing struct, if there is one.

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.

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.

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

memoryDef* memoryBlock::_initializer_def [private]
 

Initializer def.

This special def is not in the orderedDefs container. It represents any initial value for this memoryBlock. Right now, we only use it to represent the structure of arrays. If this object is an array, then this field will hold a pointer to the element.

bool memoryBlock::_is_array [private]
 

Is array.

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

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.

bool memoryBlock::_multiplicity [private]
 

Multiplicity flag.

Some memoryBlocks represent multiple memory locations in the actual program. For example, array elements or heap allocated objects. Assignments through these points are never strong updates.

bool 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.

bool 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.

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.

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

TREE orderedUses memoryBlock::Uses [private]
 


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