PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "effects-util.h"
#include "misc.h"
#include "properties.h"
#include "effects-generic.h"
#include "pipsdbm.h"
#include "points-to.h"
Go to the source code of this file.
Macros | |
#define | FRANCOIS 1 |
Variables | |
static pt_map | points_to_context = pt_map_undefined |
static bool | interprocedural_points_to_p = true |
static bool | fast_interprocedural_points_to_p = true |
void add_arc_to_points_to_context | ( | points_to | pt | ) |
FI: it should rather work the other way round, with add_arc_to_statement_points_to_context() calling add_arc_to_points_to_context().
pt | t |
Definition at line 268 of file passes.c.
References add_arc_to_pt_map, add_arc_to_statement_points_to_context(), consistent_pt_map_p, copy_points_to(), pips_assert, points_to_context, and pt_map_undefined_p.
Referenced by dereferencing_subscript_to_points_to(), formal_source_to_sinks(), generic_stub_source_to_sinks(), global_source_to_sinks(), and null_to_sinks().
void clean_up_points_to_stubs | ( | entity | module | ) |
Beware of location entities that might depend on the soon to be deleted stub entities.
module | odule |
Definition at line 303 of file passes.c.
References code_declarations, CONS, ENDP, ENTITY, entity_heap_location_p(), entity_initial, entity_name, FOREACH, fprintf(), gen_free_list(), gen_in_list_p(), gen_list_and_not(), GenericCleanEntities(), get_bool_property(), location_entity_of_module_p(), module, NIL, reference_variable, stub_entity_of_module_p(), value_code, and value_reference.
Referenced by generic_points_to_analysis().
bool fast_interprocedural_points_to_analysis | ( | char * | module_name | ) |
module_name | odule_name |
Definition at line 574 of file passes.c.
References fast_interprocedural_points_to_p, generic_points_to_analysis(), interprocedural_points_to_p, and module_name().
bool fast_interprocedural_points_to_analysis_p | ( | void | ) |
Definition at line 555 of file passes.c.
References fast_interprocedural_points_to_p.
Referenced by user_call_to_points_to(), and user_call_to_points_to_sinks().
ptm | tm |
store | tore |
Definition at line 97 of file passes.c.
References gen_free_list(), gen_full_copy_list(), make_points_to_list(), NIL, points_to_compare_cells(), points_to_graph_bottom, points_to_graph_set, points_to_list_consistent_p(), points_to_list_undefined, set_empty_p(), set_to_sorted_list(), and store_or_update_pt_to_list().
Referenced by statement_to_points_to().
|
static |
Pass INTRAPROCEDURAL_POINTS_TO_ANALYSIS.
In case we need effects to generate all necessary points-to information
Clean-up formal context stubs and heap model variables
Stack for on-demand update of in points-to information
Necessary to compute memory effects
Memory effects may be computed to avoid issues with side effects Three possible options: 1) a new expression_to_points_to() that does not take side effects into account, 2) an extension of condition_to_points_to() to take care of dereferencing as in expression_to_points_to(), or use memory effects to deal with side effect free expressions only.
Store the points-to relations
Remove dangling stubs... before the formal parameters are projected as the projection will create lots of dangling stubs. In fact, they are not dangling from a formal context view point.
Filter OUT points-to by deleting local variables, including the formal paprameters
FI: you would have to be much more specific about was is kept or not when the main function is exited... I am not sure it is a good idea. Potentially useful information about argv is lost. As well as useless information about memory leaks occuring at the end of the execution. Motsly an issue for validation.
Save IN points-to relations
Save OUT points-to relations
Definition at line 345 of file passes.c.
References clean_up_points_to_stubs(), clear_pt_map, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, entity_main_module_p(), free_statement_global_stack(), gen_free_list(), gen_full_copy_list(), get_current_module_statement(), get_points_to_context(), get_pt_to_list(), graph_assign_list(), init_points_to_context(), init_pt_to_list(), init_statement_points_to_context(), make_effects_private_current_context_stack(), make_points_to_list(), make_statement_global_stack(), module, module_name(), module_name_to_entity(), new_pt_map, NIL, pips_debug, points_to_function_projection(), points_to_graph_bottom, points_to_graph_set, points_to_list_list, reset_current_module_entity(), reset_current_module_statement(), reset_effects_private_current_context_stack(), reset_points_to_context(), reset_pt_to_list(), reset_statement_points_to_context(), set_assign_list(), set_current_module_entity(), set_current_module_statement(), set_to_list(), and statement_to_points_to().
Referenced by fast_interprocedural_points_to_analysis(), interprocedural_points_to_analysis(), and intraprocedural_points_to_analysis().
pt_map get_points_to_context | ( | void | ) |
Definition at line 298 of file passes.c.
References points_to_context.
Referenced by generic_points_to_analysis().
bool init_points_to_analysis | ( | char * | module_name | ) |
Properties
module_name | odule_name |
Definition at line 483 of file passes.c.
References code_declarations, DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, ENTITY, entity_initial, entity_type, FOREACH, formal_parameter_p(), formal_points_to_parameter(), get_bool_property(), get_current_module_entity(), make_cell_reference(), make_points_to_list(), make_reference(), module, module_name(), module_name_to_entity(), NIL, pips_debug, pips_user_error, pips_user_warning, points_to_compare_cells(), points_to_equal_p(), points_to_list_consistent_p(), points_to_rank(), reset_current_module_entity(), set_clear(), set_current_module_entity(), set_free(), set_generic_make(), set_private, set_to_sorted_list(), set_union(), type_functional_p, and value_code.
void init_points_to_context | ( | pt_map | init | ) |
init | nit |
Definition at line 151 of file passes.c.
References full_copy_pt_map(), init, pips_assert, points_to_context, and pt_map_undefined_p.
Referenced by generic_points_to_analysis().
bool initial_points_to | ( | char * | name | ) |
Retrieve points-to that are statically initialized, especially in compilation units.
At least, useful for debugging
Could we retrieve initializations of static variables?
name | ame |
Definition at line 582 of file passes.c.
References compilation_unit_p(), copy_points_to_list(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, make_points_to_list(), module, module_name_to_entity(), NIL, points_to_list_undefined, reset_current_module_entity(), set_current_module_entity(), and strdup().
bool interprocedural_points_to_analysis | ( | char * | module_name | ) |
module_name | odule_name |
Definition at line 567 of file passes.c.
References fast_interprocedural_points_to_p, generic_points_to_analysis(), interprocedural_points_to_p, and module_name().
bool interprocedural_points_to_analysis_p | ( | void | ) |
Definition at line 550 of file passes.c.
References interprocedural_points_to_p.
Referenced by user_call_to_points_to(), and user_call_to_points_to_sinks().
bool intraprocedural_points_to_analysis | ( | char * | module_name | ) |
module_name | odule_name |
Definition at line 560 of file passes.c.
References fast_interprocedural_points_to_p, generic_points_to_analysis(), interprocedural_points_to_p, and module_name().
Store a sorted copy of the points-to pts_to_set associated to a statement s in the points-to hash-table.
In case s is a loop, do, while or for, the parameter "store" is set to false to prevent key redefinitions in the underlying points-to hash-table. This entry condition is not checked.
In case s is a sequence, the sorted copy pts_to_set is associated to each substatement and shared by s and all its substatement.
Note: the function is called with store==true from points_to_whileloop(). And the hash-table can be updated (hash_update()).
pts_to_set | ts_to_set |
store | tore |
Definition at line 67 of file passes.c.
References FOREACH, gen_free_list(), gen_full_copy_list(), instruction_sequence, instruction_sequence_p, make_points_to_list(), NIL, points_to_compare_cells(), points_to_list_consistent_p(), points_to_list_undefined, sequence_statements, set_empty_p(), set_to_sorted_list(), statement_instruction, and store_or_update_pt_to_list().
Return the subset of "in" that is related to formal parameters and stubs.
More care should be taken about formal parameter modifications. Dummy initial variables should be allocated to preserve the values of formal parameters on entry.
in | n |
Definition at line 127 of file passes.c.
References add_arc_to_simple_pt_map, copy_points_to(), formal_parameter_points_to_cell_p(), new_pt_map, out, points_to_graph_set, points_to_sink, points_to_source, SET_FOREACH, and stub_points_to_cell_p().
bool program_points_to | ( | char * | name | ) |
name | ame |
Definition at line 613 of file passes.c.
References copy_points_to_list(), db_get_memory_resource(), db_get_module_list(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, entity_undefined, gen_array_full_free(), gen_array_item(), gen_array_nitems(), gen_nconc(), get_main_entity_name(), make_points_to_list(), module_local_name(), module_name_to_entity(), NIL, pips_assert, pips_debug, points_to_list_bottom, points_to_list_list, reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), and set_current_module_statement().
void reset_points_to_context | ( | void | ) |
Definition at line 158 of file passes.c.
References pips_assert, points_to_context, pt_map_undefined, and pt_map_undefined_p.
Referenced by generic_points_to_analysis().
void update_points_to_context_with_arc | ( | points_to | pt | ) |
Same as , but be careful about the arc before adding it to the points-to context.
This function is used to update the contexts when dealing with global variables at a call site.
pt | t |
Definition at line 285 of file passes.c.
References consistent_pt_map_p, copy_points_to(), pips_assert, points_to_context, pt_map_undefined_p, update_points_to_graph_with_arc(), and update_statement_points_to_context_with_arc().
Referenced by filter_formal_context_according_to_actual_context(), new_filter_formal_context_according_to_actual_context(), and new_recursive_filter_formal_context_according_to_actual_context_for_pointer_pair().
Instead of simply adding the new arc, make sure the consistency is not broken.
If "a" is an exact arc starting from source "s_a" and pointing to destination "d_a" and if "pt" contains may arcs or an exact arc s->d, these arcs must be removed. Vice-versa, if "a=(s_a,d_a)" is a may arc and if "pt" contain an exact arc (s,d)...
FI: I am cheating and doing exactly what I need to deal with global variables at call sites...
FI: issue with the commented out free() below: the caller doesn't know that the object may be freed and may reuse it later, for instance to make a copy of it...
Argument a is either included in pt or freed. it cannot be used after the call.
Arc a is already in relation pt
ap_b must be exact
Same source, different destinations
We are in trouble if both arcs carry approximation exact...
Arc b is less precise and mut be removed to avoid a conflict
Two may arcs: they are compatible but this may be invalidated later by another arc in pt, for isntance making a redundant.
The sources are different
pt | t |
Definition at line 183 of file passes.c.
References add_arc_to_pt_map, approximation_exact_p, approximation_may_p, approximation_tag, CONS, FOREACH, NIL, pips_internal_error, POINTS_TO, points_to_approximation, points_to_cell_equal_p(), points_to_graph_set, points_to_sink, points_to_source, remove_arc_from_pt_map, and SET_FOREACH.
Referenced by update_points_to_context_with_arc(), and update_statement_points_to_context_with_arc().
Definition at line 549 of file passes.c.
Referenced by fast_interprocedural_points_to_analysis(), fast_interprocedural_points_to_analysis_p(), interprocedural_points_to_analysis(), and intraprocedural_points_to_analysis().
Definition at line 548 of file passes.c.
Referenced by fast_interprocedural_points_to_analysis(), interprocedural_points_to_analysis(), interprocedural_points_to_analysis_p(), and intraprocedural_points_to_analysis().
|
static |
Definition at line 149 of file passes.c.
Referenced by add_arc_to_points_to_context(), get_points_to_context(), init_points_to_context(), reset_points_to_context(), and update_points_to_context_with_arc().