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

memoryModel Class Reference

#include <memorymodel.h>

List of all members.

Public Methods

 memoryModel ()
 Create a new memory model. More...

 ~memoryModel ()
 Delete the memory model. More...

void clear ()
 Clear. More...

const memoryblock_mapmemory () const
 Get the list of memoryBlocks. More...

memoryBlocknull () const
 Return the null object. More...

memoryBlocklookup (Location *location, declNode *decl)
 Look up a memory memoryBLock. More...

memoryBlocklookup_variable (Location *location, declNode *decl, procNode *local_to)
 Look up or create a memoryBlock. More...

memoryBlockgenerate_heap_object (const string &name, Location *location)
 Generate a heap object. More...

memoryBlockgenerate_su_field (const string &field_name, declNode *field_decl, memoryBlock *container)
 Generate a struct/union field. More...

void update_def_use_chains ()
 Update def-use chains. More...

void stats (ostream &out)
 Print statistics. More...

void print (ostream &o) const

Private Types

typedef pair< Location *,
declNode * > 
memorymodel_key
typedef map< memorymodel_key,
memoryBlock *> 
memoryblock_map
typedef memoryblock_map::iterator memoryblock_map_p
typedef memoryblock_map::const_iterator memoryblock_map_cp

Private Methods

memoryBlockcreate_memory_object (Location *location, declNode *decl, bool synthetic_decl, memoryBlock *container, procNode *local_to)
 Create a new memory object. More...

void generate_array_elements_for (memoryBlock *array_object)
 Generate array elements. More...


Private Attributes

TREE memoryblock_map Memory
 the memoryBlocks. More...

int Counter
 a counter to generate unique names. More...

memoryBlockNull
 special "null" object. More...


Member Typedef Documentation

typedef map< memorymodel_key , memoryBlock *> memoryModel::memoryblock_map [private]
 

typedef memoryblock_map::const_iterator memoryModel::memoryblock_map_cp [private]
 

typedef memoryblock_map::iterator memoryModel::memoryblock_map_p [private]
 

typedef pair< Location *, declNode * > memoryModel::memorymodel_key [private]
 


Constructor & Destructor Documentation

memoryModel::memoryModel  
 

Create a new memory model.

memoryModel::~memoryModel  
 

Delete the memory model.

This also deallocates all memoryBlock objects created in this model.


Member Function Documentation

void memoryModel::clear  
 

Clear.

Visit all memoryBlocks and call clear, preparing for reanalysis.

memoryBlock * memoryModel::create_memory_object Location   location,
declNode   decl,
bool    synthetic_decl,
memoryBlock   container,
procNode   local_to
[private]
 

Create a new memory object.

Create a new object that represents some entity in memory. These objects are indexed by the declaration node and the location given. In addition, we need the declaration node for built-in arrays, so that we can create the objects to represent the elements.

The synthetic_decl flag indicates that the declNode passed was created just to distinguish this object.

void memoryModel::generate_array_elements_for memoryBlock   array_object [private]
 

Generate array elements.

For built-in arrays, we generate a single object for each dimension of the array. For example,

int A[3][4][5]

Results in

A --> A_el_1 --> A_el_2 --> A_el_3

That way A[1][3] evaluates to A_el_2, as does *(A[1]) and **A.

This structure is represented by storing the element as a field of the array object. We then add a special def that also causes the array to point-to it's element.

memoryBlock * memoryModel::generate_heap_object const string &    name,
Location   location
 

Generate a heap object.

Create a new memoryBlock that represents a memory object without an explicit declaration in the program. For example, heap allocated memory. This routine creates a synthetic declNode for the object.

memoryBlock * memoryModel::generate_su_field const string &    field_name,
declNode   field_decl,
memoryBlock   container
 

Generate a struct/union field.

Given a field declaration and the container object, generate an object for the field. We use the type information from the field declaration to detect and handle fields that are arrays.

The field_decl can be ommited.

The method actually generates a new unique declNode for the object.

memoryBlock * memoryModel::lookup Location   location,
declNode   decl
 

Look up a memory memoryBLock.

Look up a memoryblock, returning "null" if it's not found.

memoryBlock * memoryModel::lookup_variable Location   location,
declNode   decl,
procNode   local_to
 

Look up or create a memoryBlock.

Create the memory block if it's not found. Also, when creating a new memory block, if it's a built-in array, then create objects for the elements.

const memoryblock_map& memoryModel::memory   const [inline]
 

Get the list of memoryBlocks.

memoryBlock* memoryModel::null   const [inline]
 

Return the null object.

void memoryModel::print ostream &    o const
 

void memoryModel::stats ostream &    out
 

Print statistics.

void memoryModel::update_def_use_chains  
 

Update def-use chains.

At the end of pointer analysis, call this method to populate the definition uses on each memoryDef. Only call this once!


Member Data Documentation

int memoryModel::Counter [private]
 

a counter to generate unique names.

TREE memoryblock_map memoryModel::Memory [private]
 

the memoryBlocks.

All memoryBlocks are stored and managed by the memoryModel object. They are indexed by combining their declaration with a program location. A synthetic declaration is generated for dynamic objects.

memoryBlock* memoryModel::Null [private]
 

special "null" object.


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