#include <memoryblock.h>
Inheritance diagram for memoryBlock::
Public Types | |
enum | Output_mode { NAME_ONLY, CURRENT_VALUE, AFTER_ASSIGNMENT, ALL_VALUES } |
Public Methods | |
void | clear () |
Clear. More... | |
declNode * | decl () const |
procNode * | local_to () const |
bool | multiplicity () const |
void | set_multiplicity () |
bool | write_protected () const |
void | set_write_protected () |
memoryUse * | current_use () const |
memoryDef * | current_def () const |
void | reset_current_def_use (Location *unused) |
void | set_current_def_use (Location *where) |
memoryDef * | def_at (Location *where, bool &is_new) |
memoryDef * | nearest_def_at (Location *where) |
memoryUse * | use_at (Location *where) |
memoryDef * | last_def_at (basicblockLocation *block) |
memoryDef * | find_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 () |
memoryDef * | setup_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) |
|
|
|
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. |
|
Destructor. Destroy the memoryBlock and all use/def information. This should only be called by the memoryModel class destructor. |
|
Clear. Remove all def and use information, preparing for reanalysis. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A list of things contained in this memory block.
|
|
The containing struct, if there is one.
|
|
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. |
|
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. |
|
The declaration of this object. This can be a synthetically created declNode for things that are not explicitly represented (like heap objects). |
|
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. |
|
Is array. This flag is set to true if this object is a C array. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
|
|
|