Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages
Pointers Class ReferencePointer analyzer.
More...
#include <pointers.h>
List of all members.
|
Public Types |
typedef set< string > | string_set |
typedef string_set::iterator | string_set_p |
typedef pair< int, double > | count_accuracy_pair |
typedef map< stmtLocation *,
count_accuracy_pair > | accuracy_map |
typedef accuracy_map::iterator | accuracy_map_p |
Public Member Functions |
| Pointers (procNode *root, Linker &l, unitNode *unit) |
| Constructor.
|
virtual | ~Pointers () |
| Destructor.
|
Linker & | getLinker () const |
virtual void | run_unification () |
| Create and run unification, if in unification mode.
|
UnificationBasedPtr * | unification_analyzer () const |
| Get the unification analyzer.
|
void | use_unification_analyzer (UnificationBasedPtr *u) |
void | analyze () |
| Run the analyzer.
|
void | analyze (analysisProblem *problem) |
virtual void | initialize () |
| Initialize.
|
constantAnalyzer & | get_constants () |
| Constants.
|
void | clear () |
| Clear pointer information after a program change.
|
void | show_progress () |
| Turn on progress meter.
|
void | hide_progress () |
| Turn off progress meter.
|
void | turn_on_multiplicity () |
| Turn on multiplicity analysis.
|
void | turn_off_multiplicity () |
| Turn off multiplicity analysis.
|
void | analyze_procedure (procLocation *current, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes) |
| Analyze one procedure.
|
virtual void | procedure_call (procedureInfo *caller, stmtLocation *current, operandNode *call, operand_list &args, pointerValue &call_target, memoryBlock *target_mb, pointervalue_list &arguments, memoryblock_set &external_defs, memoryuse_set &external_uses, memoryblock_set &external_changes, pointerValue &return_val, bool &never_returns) |
| Process a procedure call.
|
void | analyze_procedure_at (procedureInfo *callee, stmtLocation *callsite, pointervalue_list &arguments, memoryblock_set &external_defs, memoryuse_set &external_uses, memoryblock_set &external_changes, pointerValue &return_val) |
| Analyze a procedure at a call.
|
void | pass_parameters (procedureInfo *info, stmtLocation *callsite, pointervalue_list &arguments, memoryblock_set ¶meters, memoryblock_set &changed_inputs) |
| Pass parameters.
|
void | pass_return_value (procedureInfo *info, stmtLocation *current_callsite, pointerValue &return_val, memoryblock_set &changes) |
| Pass return value.
|
void | process_merge_point (procedureInfo *info, basicblockLocation *current_block, pointerValue &result, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes) |
| Process a merge point.
|
void | process_local_changes (procedureInfo *info, basicblockLocation *current_block, memoryblock_set &local_changes, memoryblock_set &changes) |
| Process local changes.
|
void | pass_external_inputs (procedureInfo *info, stmtLocation *current_callsite, memoryuse_set &external_uses, memoryblock_set &changed_inputs) |
| Process external inputs.
|
void | pass_one_external_input (procedureInfo *callee, procedureInfo *caller, stmtLocation *current_callsite, memoryBlock *block_to_pass, memoryblock_set &changed_inputs) |
| Pass one external input.
|
void | pass_external_outputs (procedureInfo *info, stmtLocation *current_callsite) |
| Process external outputs.
|
void | pass_one_external_output (procedureInfo *info, stmtLocation *current_callsite, memoryBlock *block_to_pass, bool is_return_val) |
| Pass one external output.
|
void | record_external_inputs_and_outputs (procedureInfo *callee, procLocation *current, pointervalue_list &arguments, memoryblock_set ¶meters, memoryblock_set &defs, memoryblock_set &external_defs, memoryuse_set &uses, memoryuse_set &external_uses, memoryblock_set &changes, memoryblock_set &external_changes) |
| Record external inputs and outputs.
|
virtual void | conservative_procedure_call (procedureInfo *info, stmtLocation *current, pointervalue_list &arguments, memoryblock_set &reachable, memoryblock_set &external_defs, memoryuse_set &external_uses, memoryblock_set &external_changes, pointerValue &return_val) |
| Conservative procedure call.
|
void | eval (procedureInfo *info, stmtLocation *current, exprNode *E, stmtNode *cur_stmt, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes, pointerValue &result, bool &never_returns) |
| Expression evaluator.
|
void | eval (procedureInfo *info, stmtLocation *current, threeAddrNode *threeAddr, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes, pointerValue &result, bool &never_returns) |
void | star_operator (procedureInfo *info, Location *current, pointerValue &operand, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes, pointerValue &result) |
| Star "*" operator.
|
void | dot_operator (Location *current, const string &field_name, declNode *field_decl, pointerValue &operand, memoryuse_set &uses, pointerValue &result) |
| Dot "." operator.
|
void | struct_union_assignment (procedureInfo *info, stmtLocation *current, threeAddrNode *threeaddr, sueNode *suetype, pointerValue &left_hand_side, pointerValue &right_hand_side, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes) |
| Struct/union assignment.
|
virtual void | assignment_operator (procedureInfo *info, Location *current, stmtLocation *parameter_callsite, pointerValue &left_hand_side, pointerValue &right_hand_side, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes) |
| Assignment "=" operator.
|
void | merge_operator (procedureInfo *info, Location *current, memoryBlock *block_to_merge, memoryuse_list &phi_uses, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes) |
| Process a control-flow merge.
|
void | self_assignment (Location *from, Location *to, memoryBlock *block, memoryblock_set &changes) |
| Self-assignment.
|
void | call_operator (procedureInfo *caller, stmtLocation *current, operandNode *call, operand_list &args, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes, pointerValue &result, pointerValue &call_targets, bool &never_returns) |
| Function call operator.
|
void | determine_call_targets (procedureInfo *caller, stmtLocation *current, operandNode *call, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes, pointerValue &targets) |
| Determine call targets.
|
void | generate_uses (procedureInfo *info, Location *where, memoryuse_set &uses, pointerValue &pointer) |
| Generate memoryUses.
|
memoryDef * | nearest_def_at (procedureInfo *info, memoryBlock *block, Location *where) |
| Reaching def.
|
void | reachable_blocks (Location *where, memoryblock_list &worklist, memoryblock_set &already_seen) |
| Reachable blocks.
|
procedureInfo * | lookup_procedure (procNode *proc) |
| Lookup a procedure.
|
bool | is_pointer_expression (operandNode *operand) |
| Return true if the expression involves pointers.
|
void | stats (ostream &out) |
| Print some statistics.
|
void | uses_and_defs () |
| Print all uses and defs.
|
void | show_accuracy () |
| Compute accuracy.
|
void | progress_meter (procedureInfo *info, bool skipped) |
| Progress meter.
|
double | compute_accuracy (accuracy_map &accuracy_data) |
| Compute accuracy.
|
Static Public Member Functions |
void | merge (const memoryblock_set &source, memoryblock_set &dest) |
| Useful utilities.
|
void | print_memoryblock_set (const string &label, const memoryblock_set &the_set, ostream &o) |
void | print_memoryblock_def_set (const string &label, const memoryblock_set &the_set, ostream &o) |
void | print_memorydef_set (const string &label, const memorydef_set &the_set, ostream &o) |
Static Public Attributes |
long int | call_counter |
| Counter for call invocations.
|
Protected Member Functions |
memoryBlock * | at_allocation (const string &name, procedureInfo *info, stmtLocation *current, stmtNode *allocation_stmt, declNode *decl, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes, pointerValue &result) |
| At allocation site.
|
void | at_deallocation (procedureInfo *info, Location *current, pointerValue &to_deallocate, memoryblock_set &defs, memoryuse_set &uses, memoryblock_set &changes) |
| At deallocation site.
|
Multiplicity | current_multiplicity (procedureInfo *info, Location *current, memoryBlock *block, memoryuse_set &uses) |
| Current multiplicity.
|
void | mark_as_indexed (memoryblock_set &blocks) |
| Mark as indexed.
|
void | setup_va_list_variables (procedureInfo *info, procLocation *callee_path, stmtLocation *parameter_callsite, procNode *callee, memoryBlock *ellipsis) |
| Var args.
|
Static Protected Member Functions |
bool | is_allocation (pointerValue &call_targets) |
bool | is_deallocation (pointerValue &call_targets) |
bool | is_reallocation (pointerValue &call_targets) |
bool | is_va_list (declNode *decl) |
bool | is_va_list (exprNode *expr) |
bool | is_va_arg (pointerValue &call_targets) |
bool | is_va_start (pointerValue &call_targets) |
bool | is_va_end (pointerValue &call_targets) |
bool | is_exit (pointerValue &call_targets) |
| Exit procedures.
|
Protected Attributes |
memoryModel | Memory |
| Memory model.
|
heap_map | HeapMap |
| Heap decl map.
|
procNode * | Root |
| Analysis starting point.
|
procLocation * | root_location |
| Starting point in the location representation.
|
Linker & | linker |
| Linker.
|
procedureDB | Procedures |
| Procedure database.
|
constantAnalyzer | _constants |
| Constants.
|
analysisProblem * | Problem |
| Use-defined analysis problem.
|
bool | computePointers |
| Analysis mode switch.
|
Direction | _direction |
| Analysis direction.
|
int | _procedureCount |
| Progress counter.
|
int | _skipCount |
| Number of procedures skipped.
|
bool | _show_progress |
| Show progress counter.
|
bool | _use_multiplicity |
| Use multiplicity analysis.
|
string_set | _unknown_procedures |
| Unknown procedures.
|
accuracy_map | _def_accuracy |
| Accuracy at defs.
|
accuracy_map | _star_accuracy |
| Accuracy at star.
|
UnificationBasedPtr * | _unification_based |
| Unification-based analyzer.
|
Detailed Description
Pointer analyzer.
This class is the main pointer analyzer engine.
Definition at line 62 of file pointers.h.
Member Typedef Documentation
typedef accuracy_map::iterator Pointers::accuracy_map_p
|
|
typedef pair< int, double > Pointers::count_accuracy_pair
|
|
typedef set< string > Pointers::string_set
|
|
typedef string_set::iterator Pointers::string_set_p
|
|
Constructor & Destructor Documentation
Pointers::~Pointers |
( |
|
) |
[virtual] |
|
Member Function Documentation
|
Definition at line 452 of file pointers.cc.
References _direction, _procedureCount, _show_progress, _skipCount, _unknown_procedures, analyze_procedure(), analysisProblem::at_procedure_entry(), analysisProblem::at_procedure_exit(), procedureDB::build(), call_counter, procedureDB::call_to(), computePointers, Forward, initialize(), procedureDB::is_reanalysis_required(), procedureDB::lookup(), memoryuse_set, analysisProblem::name(), procedureDB::print_leftovers(), Problem, procLocation::proc(), Procedures, procedureDB::return_from(), root_location, procedureDB::setup_analysis(), pointerOptions::Show_unknown_procedures, procedureInfo::start_self_timer(), procedureInfo::start_total_timer(), procedureDB::stats(), procedureInfo::stop_self_timer(), procedureInfo::stop_total_timer(), and string_set_p. |
void Pointers::analyze |
( |
|
) |
|
|
|
Run the analyzer.
Definition at line 328 of file pointers.cc.
References _direction, _procedureCount, _show_progress, _skipCount, _unknown_procedures, analyze_procedure(), procedureDB::build(), call_counter, procedureDB::call_to(), memoryModel::clear(), computePointers, Forward, HeapMap, initialize(), procedureDB::is_reanalysis_required(), procedureDB::lookup(), Memory, memoryuse_set, Problem, procLocation::proc(), Procedures, procedureDB::return_from(), root_location, procedureDB::setup_analysis(), pointerOptions::Show_unknown_procedures, procedureInfo::start_self_timer(), procedureInfo::start_total_timer(), procedureInfo::stop_self_timer(), procedureInfo::stop_total_timer(), string_set_p, and memoryModel::update_def_use_chains().
Referenced by pointers_phase::run(). |
|
Analyze one procedure.
Definition at line 605 of file pointers.cc.
References _constants, _direction, procedureInfo::add_all_blocks(), procedureInfo::add_reachable_blocks(), analysisProblem::at_basicblock_entry(), analysisProblem::at_basicblock_exit(), constantAnalyzer::at_binary(), analysisProblem::at_conditiongoto(), analysisProblem::at_stmt_entry(), constantAnalyzer::at_stmt_entry(), analysisProblem::at_stmt_exit(), analysisProblem::at_threeAddr(), constantAnalyzer::at_unary(), Backward, constantAnalyzer::bottom(), basicblockNode::children(), Condition, pointerValue::constant_value, Node::coord(), Dominators::dominates(), eval(), procNode::exit(), Expr, Location::finish(), Forward, procedureInfo::get_next_block(), constantAnalyzer::has_truth_value(), If, procedureInfo::incr_analysis_count(), pointerValue::initialize_pointers(), pointerValue::is_a_use, procedureInfo::is_empty(), procedureInfo::is_verbose(), basicblockLocation::last(), conditiongotoNode::left(), procedureDB::lookup(), procLocation::lookup_block(), stmtNode::output(), print_memoryblock_def_set(), Problem, procLocation::proc(), Procedures, process_local_changes(), process_merge_point(), procedureInfo::qualified_name(), conditiongotoNode::right(), procedureInfo::set_never_returns(), basicblockLocation::statements(), stmt_list, stmt_list_p, blockNode::stmts(), ThreeAddr, constantAnalyzer::to_string(), Node::typ(), procedureInfo::update_conditional_worklist(), pointerOptions::Verbose, and Location::visit().
Referenced by analyze(), and analyze_procedure_at(). |
|
Analyze a procedure at a call.
This method provides the interface between procedure_call() and analyze(). It handles all of the parameter passing, as well as context sensitivity.
Definition at line 1216 of file pointers.cc.
References _direction, _procedureCount, analyze_procedure(), analysisProblem::at_procedure_entry(), analysisProblem::at_procedure_exit(), pointerValue::blocks, call_counter, procedureDB::call_to(), memoryAccess::def_count, Forward, procedureInfo::is_context_insensitive(), procedureDB::is_reanalysis_required(), procedureDB::is_recursive_call(), memoryuse_set, procedureInfo::name(), procedureInfo::never_returns(), pass_external_inputs(), pass_external_outputs(), pass_parameters(), pass_return_value(), procedureDB::print_call_stack(), print_memoryblock_set(), Problem, procedureInfo::procedure_location(), Procedures, progress_meter(), record_external_inputs_and_outputs(), procedureDB::return_from(), pointerOptions::Show_stack, pointerOptions::Verbose, and Location::visit().
Referenced by procedure_call(). |
|
Assignment "=" operator.
When the additive flag is set, the assignment will include the previous value of the pointer at this location. This allows us to say things like "p = &x and p = &y" without having to build a single pointerValue that contains both x and y.
Definition at line 3712 of file pointers.cc.
References _unification_based, memoryBlock::add_complicit_assignment(), memoryBlock::add_destructive_assignment(), memoryBlock::add_parameter_assignment(), memoryDef::add_pointers(), memoryBlock::allocation_object(), memoryBlock::apply_weak_update(), UnifyType::block(), pointerValue::blocks, pointerValue::constant_value, current_multiplicity(), memoryBlock::current_use(), Deallocated, memoryBlock::decl(), def, memoryBlock::def_at(), pointerValue::dereferenced, UnificationBasedPtr::ecrDeref(), memoryBlock::find_def_at(), Func, vector_set< memoryBlock * >::insert(), pointerValue::is_address, memoryBlock::is_flow_sensitive(), memoryBlock::is_unify(), is_va_list(), memoryAccess::is_weak(), Location::kind(), memoryblock_set_cp, memoryblock_set_p, Multiplicity, memoryBlock::name(), nearest_def_at(), typeNode::no_tdef_type(), declNode::no_tdef_type(), OBJECT, UnifyType::objTyp(), memoryDef::points_to(), memoryDef::print(), procedureDB::print_call_stack(), memoryBlock::print_def_use(), print_memoryblock_set(), memoryBlock::print_multiplicity(), procLocation::proc(), Location::Procedure, Procedures, Ptr, memoryUse::reaching_def(), SIMPLE, Single, Location::Statement, Node::typ(), Unify_ECR::type(), declNode::type(), Unallocated, pointerOptions::Unification, UnificationBasedPtr::unify_points_to_max, memoryBlock::unifyType(), use, memoryBlock::use_at(), memoryAccess::where(), and memoryBlock::write_protected().
Referenced by eval(), pass_parameters(), setup_va_list_variables(), star_operator(), and struct_union_assignment(). |
|
At allocation site.
Process a memory allocation. This method performs two important tasks: (1) it creates a representation of the heap object, and (2) it manages the multiplicity analysis. Allocation is considered a def of the newly allocated space.
Definition at line 5347 of file pointers.cc.
References memoryBlock::at_allocation(), pointerValue::blocks, memoryModel::counter(), memoryBlock::get_allocation_object(), heap_map_p, HeapMap, vector_set< memoryBlock * >::insert(), pointerValue::is_address, memoryBlock::is_flow_sensitive(), memoryModel::lookup_heap_object(), Memory, Multiplicity, nearest_def_at(), declNode::NONE, and stmtLocation::stmt().
Referenced by procedure_call(). |
|
Function call operator.
Evaluate the actual parameters, determine the call target and then call procedure_call().
Definition at line 4741 of file pointers.cc.
References pointerValue::blocks, Node::coord(), determine_call_targets(), eval(), pointerValue::is_a_use, memoryblock_set_p, operand_list_p, pointervalue_list, pointervalue_list_p, print_memoryblock_set(), and procedure_call().
Referenced by eval(). |
|
Clear pointer information after a program change.
|
double Pointers::compute_accuracy |
( |
accuracy_map & |
accuracy_data |
) |
|
|
|
Conservative procedure call.
This function is called when we encounter a procedure with no source code. It conservatively creates uses and defs for all blocks reachable from the input arguments.
Definition at line 5210 of file pointers.cc.
References pointerValue::blocks, memoryBlock::current_use(), def, memoryBlock::def_at(), generate_uses(), vector_set< memoryBlock * >::insert(), pointerValue::is_address, Memory, memoryblock_list, memoryblock_set_p, memoryModel::null(), pointervalue_list_p, memoryDef::points_to(), print_memoryblock_def_set(), reachable_blocks(), memoryUse::reaching_def(), and memoryBlock::write_protected().
Referenced by procedure_call(). |
|
Current multiplicity.
Get the allocation object for the given memoryBlock and use it to determine the current multiplicity value.
Definition at line 5501 of file pointers.cc.
References _unification_based, _use_multiplicity, Bounded, memoryBlock::container(), memoryBlock::get_allocation_object(), memoryBlock::is_flow_sensitive(), memoryBlock::is_heap_object(), memoryBlock::is_indexed(), memoryAccess::multiplicity(), Multiplicity, nearest_def_at(), Single, Unallocated, Unbounded, use, and memoryBlock::use_at().
Referenced by assignment_operator(), and record_external_inputs_and_outputs(). |
|
Determine call targets.
Evaluate the callNode subexpression that indicates which procedure we're calling. In most cases, this is just a single identifier. However, for calls through a function pointer, we need to evaluate the pointer expression to determine the target or targets.
Definition at line 4841 of file pointers.cc.
References _unification_based, UnifyType::block(), pointerValue::blocks, pointerValue::copy_pointers_from(), UnificationBasedPtr::createProcBlock(), idNode::decl(), eval(), operandNode::fields(), Func, Id, operandNode::index(), vector_set< memoryBlock * >::insert(), pointerValue::is_address, memoryblock_set_p, exprNode::no_tdef_type(), declNode::no_tdef_type(), procLocation::proc(), Location::procedure(), UnifyType::procs(), UnificationBasedPtr::proctype(), operandNode::star(), star_operator(), stmtLocation::stmt(), ThreeAddr, Node::typ(), pointerOptions::Unification, and operandNode::var().
Referenced by call_operator(). |
|
Dot "." operator.
Definition at line 3488 of file pointers.cc.
References _unification_based, UnifyType::block(), pointerValue::blocks, memoryBlock::current_use(), memoryBlock::decl(), pointerValue::dereferenced, memoryBlock::dot(), UnificationBasedPtr::ecrField(), Func, vector_set< memoryBlock * >::insert(), pointerValue::is_address, memoryBlock::is_return_value(), memoryBlock::is_unify(), Memory, memoryblock_set_p, memoryBlock::name(), typeNode::no_tdef_type(), declNode::no_tdef_type(), memoryModel::null(), OBJECT, UnifyType::objTyp(), Ptr, memoryBlock::set_indexed(), STRUCTURE, Node::typ(), Unify_ECR::type(), declNode::type(), pointerOptions::Unification, UnificationBasedPtr::unify_points_to_max, memoryBlock::unifyType(), use, memoryBlock::use_at(), and memoryBlock::write_protected().
Referenced by eval(), and struct_union_assignment(). |
|
Definition at line 3046 of file pointers.cc.
References _constants, pointerValue::add_blocks_from(), threeAddrNode::arg_list(), assignment_operator(), analysisProblem::at_assignment(), constantAnalyzer::at_assignment(), analysisProblem::at_binary(), constantAnalyzer::at_binary(), analysisProblem::at_sizeof(), constantAnalyzer::at_sizeof(), analysisProblem::at_unary(), constantAnalyzer::at_unary(), pointerValue::blocks, call_operator(), operandNode::cast(), pointerValue::constant_value, pointerValue::copy_pointers_from(), eval(), typeNode::follow_tdefs(), Func, Operator::FUNC_CALL, generate_uses(), Operator::id(), pointerValue::is_a_use, threeAddrNode::lhs(), memoryblock_set_p, threeAddrNode::op(), print_memoryblock_set(), Problem, threeAddrNode::rhs1(), threeAddrNode::rhs2(), Operator::SIZEOF, threeAddrNode::sizeof_type(), star_operator(), Struct, struct_union_assignment(), Node::typ(), typeNode::type(), declNode::type(), operandNode::type(), Union, and pointerOptions::Verbose. |
|
Expression evaluator.
Definition at line 2784 of file pointers.cc.
References _constants, operandNode::addr(), analysisProblem::at_address(), constantAnalyzer::at_address(), analysisProblem::at_cast(), constantAnalyzer::at_cast(), analysisProblem::at_const(), constantAnalyzer::at_const(), analysisProblem::at_dereference(), constantAnalyzer::at_dereference(), constantAnalyzer::at_field_access(), analysisProblem::at_field_access(), analysisProblem::at_id(), constantAnalyzer::at_id(), analysisProblem::at_index(), constantAnalyzer::at_index(), pointerValue::blocks, operandNode::cast(), Const, pointerValue::constant_value, pointerValue::copy_pointers_from(), memoryBlock::decl(), idNode::decl(), dot_operator(), operandNode::fields(), Func, generate_uses(), Id, id_list_p, operandNode::index(), vector_set< memoryBlock * >::insert(), pointerValue::is_a_use, pointerValue::is_address, constant::is_str(), memoryModel::lookup_string_constant(), memoryModel::lookup_variable(), mark_as_indexed(), Memory, declNode::no_tdef_type(), Operand, Problem, procLocation::proc(), Location::procedure(), procedureInfo::return_variable(), memoryBlock::set_return_value(), operandNode::star(), star_operator(), ThreeAddr, Node::typ(), exprNode::value(), and operandNode::var().
Referenced by analyze_procedure(), call_operator(), determine_call_targets(), eval(), and pass_return_value(). |
|
Generate memoryUses.
For each block in the set, generate a use at the given location. This also sets the "current_use" field on each memoryBlock, so that it can be accessed during other computations.
Definition at line 4995 of file pointers.cc.
References pointerValue::blocks, def, pointerValue::is_address, memoryBlock::is_return_value(), memoryblock_set_p, nearest_def_at(), use, and memoryBlock::use_at().
Referenced by conservative_procedure_call(), eval(), pass_parameters(), and struct_union_assignment(). |
|
Constants.
Return a reference to the constant propagation information. Be careful with this!
Definition at line 219 of file pointers.h. |
Linker& Pointers::getLinker |
( |
|
) |
const [inline] |
|
void Pointers::hide_progress |
( |
|
) |
[inline] |
|
|
Turn off progress meter.
Definition at line 231 of file pointers.h. |
virtual void Pointers::initialize |
( |
|
) |
[inline, virtual] |
|
|
Initialize.
Override this method in subclasses to do some initialization. The Broadway analyzer needs this to initialize some of the analyses.
Definition at line 212 of file pointers.h.
Referenced by analyze(). |
bool Pointers::is_allocation |
( |
pointerValue & |
call_targets |
) |
[static, protected] |
|
bool Pointers::is_deallocation |
( |
pointerValue & |
call_targets |
) |
[static, protected] |
|
bool Pointers::is_exit |
( |
pointerValue & |
call_targets |
) |
[static, protected] |
|
bool Pointers::is_pointer_expression |
( |
operandNode * |
operand |
) |
|
|
bool Pointers::is_reallocation |
( |
pointerValue & |
call_targets |
) |
[static, protected] |
|
bool Pointers::is_va_arg |
( |
pointerValue & |
call_targets |
) |
[static, protected] |
|
bool Pointers::is_va_end |
( |
pointerValue & |
call_targets |
) |
[static, protected] |
|
bool Pointers::is_va_list |
( |
exprNode * |
expr |
) |
[static, protected] |
|
bool Pointers::is_va_list |
( |
declNode * |
decl |
) |
[static, protected] |
|
bool Pointers::is_va_start |
( |
pointerValue & |
call_targets |
) |
[static, protected] |
|
|
Mark as indexed.
Mark all of the given objects as indexed, meaning that they conceptually represent many objects (as in an array). This is necessary when we discover that an object is being treated like an array (for example, the index operator is applied, or pointer arithmetic is used to access it).
Definition at line 5621 of file pointers.cc.
References memoryblock_set_p, and memoryBlock::set_indexed().
Referenced by eval(). |
|
Process a control-flow merge.
Definition at line 4259 of file pointers.cc.
References memoryBlock::add_destructive_assignment(), Deallocated, def, memoryBlock::def_at(), Error, vector_set< memoryBlock * >::insert(), memoryBlock::is_allocation_object(), memoryuse_list_p, memoryAccess::multiplicity(), Multiplicity, memoryBlock::name(), memoryDef::points_to(), procedureDB::print_call_stack(), memoryBlock::print_def_use(), print_memoryblock_set(), memoryBlock::print_multiplicity(), Procedures, Single, Unallocated, use, and memoryBlock::write_protected().
Referenced by process_merge_point(). |
|
Reaching def.
This is a special version of "nearest dominating def" that works across context insensitive boundaries. It handles the case where we discover an "input" to the current context that wasn't in previous analyses of the procedure.
Definition at line 5038 of file pointers.cc.
References procedureInfo::add_external_input(), procedureDB::callstack(), memoryBlock::current_def(), def, procedureInfo::is_context_insensitive(), memoryBlock::local_to(), procedureInfo::name(), memoryBlock::name(), memoryBlock::nearest_def_at(), pass_one_external_input(), memoryBlock::print_def_use(), procedureInfo::proc(), procedurecall_stack, procedurecall_stack_crp, and Procedures.
Referenced by assignment_operator(), at_allocation(), at_deallocation(), current_multiplicity(), generate_uses(), pass_one_external_input(), and process_merge_point(). |
|
Pass one external input.
This method is used right before entering a procedure to make sure that external inputs are fresh, and also during analysis when we discover a new external input during the Pointers::nearest_def_at() method.
Definition at line 1893 of file pointers.cc.
References _constants, analysisProblem::at_self_assignment(), constantAnalyzer::at_self_assignment(), def, memoryBlock::is_flow_sensitive(), procedureDB::is_visible_to_caller(), memoryBlock::name(), nearest_def_at(), Problem, procedureInfo::procedure_location(), Procedures, memoryBlock::property, analysisProblem::record_input_to_value(), self_assignment(), use, memoryBlock::use_at(), and memoryBlock::write_protected().
Referenced by nearest_def_at(), and pass_external_inputs(). |
|
Pass one external output.
Called by the above routine and by the pass_return_value() routine. It propagates the last value of the given memoryBlock from the callee procedure back to all of the places it's called. It does this by creating a use at the last statement of the procedure that holds the last reaching def in the procedure. It then assigns this use to a def at each target callsite. That way, the def will contain the right value, and dominate any uses of the object that follow. If any changes occur, they are stored in the pending_changes set of the caller.
Definition at line 2072 of file pointers.cc.
References _constants, analysisProblem::at_self_assignment(), constantAnalyzer::at_self_assignment(), procedureInfo::callsite_map, procedureInfo::callsite_map_cp, procedureInfo::callsites(), def, procedureInfo::get_context(), memoryBlock::is_flow_sensitive(), procedureDB::is_visible_to(), procLocation::last(), procedureDB::mark_for_reanalysis(), memoryBlock::name(), memoryBlock::nearest_def_at(), print_memoryblock_set(), Problem, Procedures, memoryBlock::reset_current_def_use(), self_assignment(), procedureInfo::set_pending_changes(), use, and memoryBlock::use_at().
Referenced by pass_external_outputs(). |
|
Pass parameters.
Definition at line 1457 of file pointers.cc.
References _constants, _direction, funcNode::args(), assignment_operator(), analysisProblem::at_parameter_pass(), constantAnalyzer::at_parameter_pass(), Backward, Node::coord(), procedureDB::current_caller(), procNode::decl(), decl_list, decl_list_p, Func, generate_uses(), vector_set< memoryBlock * >::insert(), typeNode::is_ellipsis(), is_va_list(), funcNode::is_void_args(), memoryModel::lookup_variable(), Memory, memoryuse_set, declNode::name(), memoryBlock::name(), declNode::no_tdef_type(), pointervalue_list_p, Problem, procedureInfo::proc(), procedureInfo::procedure_location(), Procedures, setup_va_list_variables(), Struct, Node::typ(), and Union.
Referenced by analyze_procedure_at(). |
void Pointers::print_memoryblock_def_set |
( |
const string & |
label, |
|
|
const memoryblock_set & |
the_set, |
|
|
ostream & |
o |
|
) |
[static] |
|
void Pointers::print_memoryblock_set |
( |
const string & |
label, |
|
|
const memoryblock_set & |
the_set, |
|
|
ostream & |
o |
|
) |
[static] |
|
void Pointers::print_memorydef_set |
( |
const string & |
label, |
|
|
const memorydef_set & |
the_set, |
|
|
ostream & |
o |
|
) |
[static] |
|
void Pointers::procedure_call |
( |
procedureInfo * |
caller, |
|
|
stmtLocation * |
current, |
|
|
operandNode * |
call, |
|
|
operand_list & |
args, |
|
|
pointerValue & |
call_target, |
|
|
memoryBlock * |
target_mb, |
|
|
pointervalue_list & |
arguments, |
|
|
memoryblock_set & |
external_defs, |
|
|
memoryuse_set & |
external_uses, |
|
|
memoryblock_set & |
external_changes, |
|
|
pointerValue & |
return_val, |
|
|
bool & |
never_returns |
|
) |
[virtual] |
|
|
Process a procedure call.
Definition at line 969 of file pointers.cc.
References _constants, _unknown_procedures, analyze_procedure_at(), analysisProblem::at_allocation(), at_allocation(), analysisProblem::at_call(), analysisProblem::at_conservative_procedure_call(), constantAnalyzer::at_conservative_procedure_call(), analysisProblem::at_deallocation(), at_deallocation(), pointerValue::blocks, conservative_procedure_call(), memoryBlock::decl(), procNode::decl(), procedureInfo::get_pending_changes(), vector_set< memoryBlock * >::insert(), pointerValue::is_address, is_allocation(), is_deallocation(), is_exit(), is_reallocation(), procedureDB::is_recursive_call(), is_va_arg(), is_va_end(), is_va_start(), linker, procedureDB::lookup(), Linker::lookup_procedure(), memoryBlock::name(), declNode::name(), procedureInfo::never_returns(), print_memoryblock_set(), Problem, procedureInfo::proc(), Procedures, reachable_blocks(), procedureInfo::setup_call_at(), star_operator(), procedureInfo::start_self_timer(), procedureInfo::start_total_timer(), stmtLocation::stmt(), procedureInfo::stop_self_timer(), and procedureInfo::stop_total_timer().
Referenced by call_operator(). |
|
Process local changes.
After analyzing a particular basic block, we process the blocks that have changed by inserting merge-points for those blocks.
Definition at line 1754 of file pointers.cc.
References analysisProblem::compare_property_value(), memoryBlock::current_def(), def, procedureInfo::external_inputs(), vector_set< memoryBlock * >::find(), memoryBlock::input_to(), vector_set< memoryBlock * >::insert(), memoryBlock::is_flow_sensitive(), memoryBlock::last_def_at(), procedureDB::mark_for_reanalysis(), memoryblock_set_p, memoryBlock::name(), Problem, procedureinfo_set, procedureinfo_set_p, Procedures, memoryBlock::property, procedureInfo::setup_merge_point(), and pointerOptions::Verbose.
Referenced by analyze_procedure(). |
|
Process a merge point.
Definition at line 1694 of file pointers.cc.
References _constants, procedureInfo::active_edges(), analysisProblem::at_merge(), constantAnalyzer::at_merge(), computePointers, memoryBlock::is_flow_sensitive(), procedureInfo::lookup_merge_point(), memoryblock_set_cp, merge_operator(), memoryBlock::merge_uses_at(), nearest_def_at(), and Problem.
Referenced by analyze_procedure(). |
void Pointers::progress_meter |
( |
procedureInfo * |
info, |
|
|
bool |
skipped |
|
) |
|
|
|
Record external inputs and outputs.
After a procedure has been analyzed, go through the uses and defs and determine which are external. That is, which uses are reached by defs outside the procedure, and which defs could reach uses outside the procedure.
Definition at line 2203 of file pointers.cc.
References _unification_based, procedureInfo::add_external_input(), procedureInfo::add_external_output(), memoryBlock::allocation_site(), stmtLocation::block_location(), Node::coord(), procedureDB::current_caller(), procedureDB::current_callsite(), memoryBlock::current_def(), current_multiplicity(), memoryBlock::decl(), procNode::decl(), declNode::decl_location(), def, procedureInfo::external_inputs(), vector_set< memoryBlock * >::find(), memoryBlock::input_to(), vector_set< memoryBlock * >::insert(), memoryBlock::is_flow_sensitive(), memoryBlock::is_heap_object(), Location::is_prefix(), memoryBlock::is_unify(), procedureDB::is_visible_to(), procLocation::last(), memoryBlock::local_to(), memoryModel::lookup_variable(), Memory, memoryblock_list, memoryblock_set_p, memoryuse_set, memoryuse_set_p, Multiplicity, procedureInfo::name(), memoryBlock::name(), declNode::name(), pointervalue_list_p, procedureDB::print_call_stack(), print_memoryblock_set(), procedureInfo::proc(), basicblockLocation::proc_location(), procedureInfo::procedure_location(), Procedures, reachable_blocks(), memoryBlock::reset_current_def_use(), procedureInfo::return_variable(), Single, stmtLocation::stmt(), procLocation::stmt_location(), declNode::TOP, memoryBlock::top_most_container(), memoryBlock::top_most_containers(), declNode::type(), use, memoryAccess::where(), and memoryBlock::write_protected().
Referenced by analyze_procedure_at(). |
void Pointers::run_unification |
( |
|
) |
[virtual] |
|
|
Self-assignment.
This method is used to pass an external input or output. It works like a hybrid of the assignment operator and the merge operator, except that it allows the use to be at a different location from the def.
Definition at line 4508 of file pointers.cc.
References _unification_based, memoryBlock::add_destructive_assignment(), memoryBlock::add_parameter_assignment(), memoryBlock::container(), memoryBlock::decl(), declNode::decl_location(), def, memoryBlock::def_at(), vector_set< memoryBlock * >::insert(), memoryBlock::is_allocation_object(), memoryBlock::is_flow_sensitive(), Location::kind(), memoryAccess::multiplicity(), Multiplicity, memoryBlock::name(), memoryDef::points_to(), procedureDB::print_call_stack(), print_memoryblock_set(), memoryBlock::print_multiplicity(), procLocation::proc(), Location::Procedure, Procedures, memoryBlock::property, Single, Location::Statement, declNode::TOP, Unallocated, Unbounded, use, memoryBlock::use_at(), and memoryBlock::write_protected().
Referenced by pass_one_external_input(), and pass_one_external_output(). |
|
Var args.
Definition at line 5754 of file pointers.cc.
References _constants, assignment_operator(), analysisProblem::at_parameter_pass(), constantAnalyzer::at_parameter_pass(), procNode::body(), decl_list, decl_list_p, blockNode::decls(), pointerValue::is_address, is_va_list(), memoryModel::lookup_variable(), Memory, memoryuse_set, Problem, and memoryBlock::set_indexed().
Referenced by pass_parameters(). |
void Pointers::show_accuracy |
( |
|
) |
|
|
void Pointers::show_progress |
( |
|
) |
[inline] |
|
|
Turn on progress meter.
Definition at line 227 of file pointers.h. |
|
Star "*" operator.
Definition at line 3260 of file pointers.cc.
References _unification_based, assignment_operator(), UnifyType::block(), pointerValue::blocks, pointerValue::copy_pointers_from(), memoryBlock::current_use(), memoryBlock::decl(), def, pointerValue::dereferenced, UnificationBasedPtr::ecrDeref(), Func, vector_set< memoryBlock * >::insert(), pointerValue::is_address, memoryBlock::is_return_value(), memoryBlock::is_unify(), is_va_list(), Location::kind(), Memory, memoryblock_set_cp, memoryblock_set_p, memoryBlock::name(), typeNode::no_tdef_type(), declNode::no_tdef_type(), memoryModel::null(), OBJECT, UnifyType::objTyp(), print_pt2_set, Ptr, SIMPLE, Location::Statement, Node::typ(), Unify_ECR::type(), declNode::type(), pointerOptions::Unification, UnificationBasedPtr::unify_points_to_max, memoryBlock::unifyType(), use, and memoryBlock::use_at().
Referenced by determine_call_targets(), eval(), and procedure_call(). |
void Pointers::stats |
( |
ostream & |
out |
) |
|
|
|
Struct/union assignment.
Direct assignments between structs and unions are allowed, so here we recursively descend through the fields assigning them in a pairwise fashion. NOTE: Here we are relying on having the correct types.
Definition at line 3626 of file pointers.cc.
References _constants, assignment_operator(), analysisProblem::at_assignment(), constantAnalyzer::at_assignment(), decl_list, decl_list_p, dot_operator(), suespecNode::fields(), generate_uses(), declNode::name(), suespecNode::name(), declNode::no_tdef_type(), Problem, sueNode::spec(), Struct, Node::typ(), and Union.
Referenced by eval(). |
void Pointers::turn_off_multiplicity |
( |
|
) |
[inline] |
|
void Pointers::turn_on_multiplicity |
( |
|
) |
[inline] |
|
|
Get the unification analyzer.
Definition at line 196 of file pointers.h. |
void Pointers::uses_and_defs |
( |
|
) |
|
|
Member Data Documentation
|
Accuracy at defs.
Store the size of the points-to set at each def.
Definition at line 169 of file pointers.h.
Referenced by show_accuracy(). |
int Pointers::_procedureCount [protected]
|
|
bool Pointers::_show_progress [protected]
|
|
int Pointers::_skipCount [protected]
|
|
|
Accuracy at star.
Store the size of the points-to set at every star operator.
Definition at line 175 of file pointers.h.
Referenced by show_accuracy(). |
string_set Pointers::_unknown_procedures [protected]
|
|
bool Pointers::_use_multiplicity [protected]
|
|
long int Pointers::call_counter [static]
|
|
bool Pointers::computePointers [protected]
|
|
|
Analysis mode switch.
This boolean is true during pointer analysis, which allows new defs and uses to be created. Once complete, the boolean is set false so that other analyses can call pointer methods without changing the dependence information.
Definition at line 135 of file pointers.h.
Referenced by analyze(), and process_merge_point(). |
|
Heap decl map.
Our pointer analysis keeps one heap object for each allocation site. This field maintains the mapping from allocation sites to synthetic declarations for those heap objects.
Definition at line 88 of file pointers.h.
Referenced by analyze(), at_allocation(), and ~Pointers(). |
Linker& Pointers::linker [protected]
|
|
|
Linker.
The linker object is used to connect external declaration across translation units. We need this, for example, so that accesses to a global variable in different source files are properly connected.
NOTE: the adaptive algorithm needs the linker to be the same for all iterations, that way the synthetic declNodes stay the same.
Definition at line 107 of file pointers.h.
Referenced by procedure_call(). |
|
Memory model.
This object holds all of the memoryBlocks, and is responsible for their creation, indexing and deletion.
Definition at line 80 of file pointers.h.
Referenced by analyze(), at_allocation(), conservative_procedure_call(), dot_operator(), eval(), pass_parameters(), Pointers(), reachable_blocks(), record_external_inputs_and_outputs(), run_unification(), setup_va_list_variables(), star_operator(), stats(), and uses_and_defs(). |
|
Use-defined analysis problem.
Definition at line 126 of file pointers.h.
Referenced by analyze(), analyze_procedure(), analyze_procedure_at(), eval(), pass_one_external_input(), pass_one_external_output(), pass_parameters(), procedure_call(), process_local_changes(), process_merge_point(), setup_va_list_variables(), and struct_union_assignment(). |
|
Procedure database.
This object holds per-procedure information used during analysis. In particular, each entry holds the worklist for that procedure.
Definition at line 114 of file pointers.h.
Referenced by analyze(), analyze_procedure(), analyze_procedure_at(), assignment_operator(), lookup_procedure(), merge_operator(), nearest_def_at(), pass_external_inputs(), pass_one_external_input(), pass_one_external_output(), pass_parameters(), procedure_call(), process_local_changes(), progress_meter(), record_external_inputs_and_outputs(), self_assignment(), and stats(). |
|
Analysis starting point.
Definition at line 92 of file pointers.h. |
The documentation for this class was generated from the following files:
|