Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages
memoryModel Class Reference#include <memorymodel.h>
List of all members.
|
Public Types |
typedef pair< Location *,
declNode * > | memorymodel_key |
typedef map< memorymodel_key,
memoryBlock * > | memorymodel_map |
typedef memorymodel_map::iterator | memorymodel_map_p |
typedef memorymodel_map::const_iterator | memorymodel_map_cp |
typedef map< procNode *, memorymodel_map > | proc_memorymodel_map |
typedef proc_memorymodel_map::iterator | proc_memorymodel_map_p |
typedef proc_memorymodel_map::const_iterator | proc_memorymodel_map_cp |
typedef pair< stmtNode *,
declNode * > | ci_memorymodel_key |
typedef map< ci_memorymodel_key,
memoryBlock * > | ci_memorymodel_map |
typedef ci_memorymodel_map::iterator | ci_memorymodel_map_p |
typedef ci_memorymodel_map::const_iterator | ci_memorymodel_map_cp |
typedef map< constNode *,
memoryBlock * > | string_constant_map |
typedef string_constant_map::iterator | string_constant_map_p |
Public Member Functions |
| memoryModel () |
| Create a new memory model.
|
| ~memoryModel () |
| Delete the memory model.
|
void | clear () |
| Clear.
|
int | size () |
| Get the number of memory blocks.
|
memoryBlock * | null () const |
| Get the list of memoryBlocks Return the null object.
|
UnificationBasedPtr * | unification () const |
| Get unification-based analyzer.
|
void | unification (UnificationBasedPtr *u) |
| Set unification-based analyzer.
|
memoryBlock * | lookup (Location *location, declNode *decl) |
| Look up a memoryBLock.
|
memoryBlock * | lookup (stmtNode *location, declNode *decl) |
| Look up a CI memoryBLock.
|
memoryBlock * | lookup_variable (Location *location, declNode *decl, procNode *local_to) |
| Look up a variable.
|
memoryBlock * | lookup_heap_object (const string &name, stmtLocation *allocation_site, stmtNode *allocation_stmt, declNode *decl, bool synthetic_decl) |
| Look up or create a heap object.
|
memoryBlock * | lookup_string_constant (constNode *the_string) |
| Look up string constant.
|
memoryBlock * | generate_su_field (const string &field_name, declNode *field_decl, memoryBlock *container) |
| Generate a struct/union field.
|
void | update_def_use_chains () |
| Update def-use chains.
|
int | counter () |
| Counter.
|
void | stats (ostream &out) |
| Print statistics.
|
void | print (ostream &o) const |
Static Public Member Functions |
bool | is_in_non_unify_list (UnifyTypes &non_unify_types, UnifyType *obj) |
| Find in unify list.
|
Private Member Functions |
memoryBlock * | create_memory_object (Location *location, declNode *decl, bool synthetic_decl, memoryBlock *container, procNode *local_to, declNode *org_field_decl=0, bool is_alloc=false, bool is_array_elt=false) |
| Create a new memory object.
|
memoryBlock * | create_memory_object (stmtNode *location, declNode *decl, bool synthetic_decl, memoryBlock *container, procNode *local_to, bool is_alloc=false) |
| Create a CI memory block.
|
void | generate_array_elements_for (memoryBlock *array_object) |
| Generate array elements.
|
void | initialize_struct (memoryBlock *struct_object, sueNode *sue_type, expr_list &inits) |
| Initialize struct.
|
Private Attributes |
TREE proc_memorymodel_map | _memory_blocks |
| the memoryBlocks
|
TREE ci_memorymodel_map | _ci_memory_blocks |
| Context-insensitive memory.
|
string_constant_map | _string_constants |
| String constants.
|
int | Counter |
| a counter to generate unique names
|
memoryBlock * | Null |
| special "null" object
|
memoryBlock * | _string_constant |
| String constant object.
|
UnificationBasedPtr * | _unification_based |
| Unification-based analyzer.
|
map< declNode *, declNode * > | _copy_decl |
| Remember where a copy declaration originates from.
|
Member Typedef Documentation
typedef ci_memorymodel_map::const_iterator memoryModel::ci_memorymodel_map_cp
|
|
typedef ci_memorymodel_map::iterator memoryModel::ci_memorymodel_map_p
|
|
typedef memorymodel_map::const_iterator memoryModel::memorymodel_map_cp
|
|
typedef memorymodel_map::iterator memoryModel::memorymodel_map_p
|
|
typedef proc_memorymodel_map::const_iterator memoryModel::proc_memorymodel_map_cp
|
|
typedef proc_memorymodel_map::iterator memoryModel::proc_memorymodel_map_p
|
|
typedef string_constant_map::iterator memoryModel::string_constant_map_p
|
|
Constructor & Destructor Documentation
memoryModel::memoryModel |
( |
|
) |
|
|
memoryModel::~memoryModel |
( |
|
) |
|
|
Member Function Documentation
void memoryModel::clear |
( |
|
) |
|
|
int memoryModel::counter |
( |
|
) |
[inline] |
|
|
Create a CI memory block.
Definition at line 659 of file memorymodel.cc.
References _ci_memory_blocks, _unification_based, UnifyType::block(), ci_memorymodel_key, declNode::decl_location(), UnificationBasedPtr::ecr(), Func, is_in_non_unify_list(), memoryBlock::local_to(), typeNode::no_tdef_type(), declNode::no_tdef_type(), declNode::PROC, Ptr, Node::typ(), Unify_ECR::type(), pointerOptions::Unification, and memoryBlock::unifyType(). |
|
Create a new memory object.
Create a new object that represents some entity in memory. These objects are indexed by the location and Node given. For regular variables, this Node will be the same as the declNode. However, for heap objects and strings constants, we will use other kinds of nodes to distinguish them. In addition, we need the declaration node for built-in arrays, so that we can create the objects to represent the elements.
This is the only function that creates new memoryBlocks and stores them in the memory model.
The synthetic_decl flag indicates that the declNode passed was created just to distinguish this object.
Definition at line 510 of file memorymodel.cc.
References _memory_blocks, _unification_based, UnifyType::block(), declNode::decl_location(), UnificationBasedPtr::ecr(), UnificationBasedPtr::ecrDeref(), UnificationBasedPtr::ecrField(), UnificationBasedPtr::ensure_no_bottom(), Func, UnifyType::is_bottom(), is_in_non_unify_list(), UnificationBasedPtr::isField(), Location::kind(), memoryBlock::local_to(), memorymodel_key, memorymodel_map, memoryBlock::name(), declNode::name(), typeNode::no_tdef_type(), declNode::no_tdef_type(), procLocation::proc(), declNode::PROC, Location::procedure(), Ptr, pointerOptions::Show_stack, Location::Statement, ThreeAddr, Node::typ(), Unify_ECR::type(), pointerOptions::Unification, memoryBlock::unifyType(), and pointerOptions::Verbose.
Referenced by generate_array_elements_for(), generate_su_field(), lookup_heap_object(), and lookup_variable(). |
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.
Definition at line 744 of file memorymodel.cc.
References _copy_decl, _unification_based, Operator::ADDRESS, Array, UnifyType::block(), ref_clone_changer::clone(), create_memory_object(), memoryBlock::current_use(), idNode::decl(), memoryBlock::decl(), def, memoryBlock::def_at(), UnificationBasedPtr::ecrDeref(), unaryNode::expr(), expr_list, expr_list_p, initializerNode::exprs(), Func, Operator::id(), Id, declNode::init(), initialize_struct(), Initializer, vector_set< memoryBlock * >::insert(), lookup_variable(), memoryBlock::name(), declNode::name(), typeNode::no_tdef_type(), declNode::no_tdef_type(), declNode::NONE, OBJECT, UnifyType::objTyp(), unaryNode::op(), memoryDef::points_to(), memoryUse::reaching_def(), memoryBlock::set_array_element(), memoryBlock::set_flow_sensitivity(), memoryBlock::set_indexed(), memoryBlock::set_unification(), SIMPLE, Struct, Node::typ(), Unify_ECR::type(), declNode::type(), typeNode::type(), Unary, pointerOptions::Unification, memoryBlock::unifyType(), and memoryBlock::use_at().
Referenced by generate_su_field(), and lookup_variable(). |
|
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.
Definition at line 408 of file memorymodel.cc.
References _copy_decl, _unification_based, Array, ref_clone_changer::clone(), memoryBlock::container(), create_memory_object(), memoryBlock::decl(), UnificationBasedPtr::ecr(), generate_array_elements_for(), memoryBlock::name(), declNode::name(), declNode::NONE, memoryBlock::set_flow_sensitivity(), memoryBlock::set_unification(), declNode::SU, declNode::type(), pointerOptions::Unification, memoryBlock::unifyType(), and pointerOptions::Verbose.
Referenced by memoryBlock::dot(), and memoryBlock::get_allocation_object(). |
|
Initialize struct.
Assign static initializers to a newly created struct.
Definition at line 1093 of file memorymodel.cc.
References _unification_based, Operator::ADDRESS, UnifyType::block(), memoryBlock::current_use(), idNode::decl(), decl_list, decl_list_p, def, memoryBlock::def_at(), memoryBlock::dot(), UnificationBasedPtr::ecrDeref(), unaryNode::expr(), expr_list, expr_list_p, initializerNode::exprs(), suespecNode::fields(), Func, Operator::id(), Id, Initializer, vector_set< memoryBlock * >::insert(), lookup_variable(), declNode::name(), memoryBlock::name(), OBJECT, UnifyType::objTyp(), unaryNode::op(), memoryDef::points_to(), memoryUse::reaching_def(), SIMPLE, sueNode::spec(), Node::typ(), Unify_ECR::type(), declNode::type(), Unary, pointerOptions::Unification, memoryBlock::unifyType(), and memoryBlock::use_at().
Referenced by generate_array_elements_for(), and lookup_variable(). |
bool memoryModel::is_in_non_unify_list |
( |
UnifyTypes & |
non_unify_types, |
|
|
UnifyType * |
obj |
|
) |
[static] |
|
|
Look up string constant.
String constants are indexed by their constNode.
Definition at line 307 of file memorymodel.cc.
References _string_constant, _string_constants, _unification_based, UnifyType::block(), Counter, declNode::NONE, memoryBlock::set_flow_insensitive(), memoryBlock::set_write_protected(), UnificationBasedPtr::string_alpha(), string_constant_map_p, Alpha::tao(), Unify_ECR::type(), and memoryBlock::unifyType().
Referenced by Pointers::eval(). |
|
Look up a variable.
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.
Definition at line 155 of file memorymodel.cc.
References _unification_based, Array, declNode::BLOCK, create_memory_object(), declNode::decl_location(), expr_list, declNode::FORMAL, generate_array_elements_for(), declNode::init(), initialize_struct(), lookup(), declNode::no_tdef_type(), declNode::STATIC, declNode::storage_class(), Struct, Node::typ(), and pointerOptions::Unification.
Referenced by UnificationBasedPtr::createProcBlock(), Pointers::eval(), generate_array_elements_for(), initialize_struct(), Pointers::pass_parameters(), Pointers::record_external_inputs_and_outputs(), and Pointers::setup_va_list_variables(). |
void memoryModel::print |
( |
ostream & |
o |
) |
const |
|
int memoryModel::size |
( |
|
) |
|
|
void memoryModel::stats |
( |
ostream & |
out |
) |
|
|
void memoryModel::update_def_use_chains |
( |
|
) |
|
|
Member Data Documentation
|
String constant object.
When we have the one-string-constant option trurned on, this holds a pointer to that object.
Definition at line 110 of file memorymodel.h.
Referenced by lookup_string_constant(). |
int memoryModel::Counter [private]
|
|
The documentation for this class was generated from the following files:
|