PIPS
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "misc.h"
#include "properties.h"
#include "text-util.h"
#include "newgen_set.h"
#include "effects-generic.h"
#include "transformer.h"
#include "semantics.h"
#include "pips-libs.h"
Go to the source code of this file.
Macros | |
#define | print_points_to_relations(l) NULL |
Functions | |
static list | use_default_sink_cell (reference input_ref, descriptor input_desc __attribute__((__unused__)), void(*cell_reference_with_address_of_cell_reference_translation_func)(reference, descriptor, reference, descriptor, int, reference *, descriptor *, bool *) __attribute__((__unused__)), void(*cell_reference_conversion_func)(reference, reference *, descriptor *) __attribute__((__unused__))) |
In case, the points-to information is not complete, use anywhere locations to convert the reference. More... | |
static list | generic_transform_sink_cells_from_matching_list (list matching_list, size_t current_max_path_length, bool *exact_p, reference input_ref, descriptor input_desc, void(*cell_reference_with_address_of_cell_reference_translation_func)(reference, descriptor, reference, descriptor, int, reference *, descriptor *, bool *), void(*cell_reference_conversion_func)(reference, reference *, descriptor *)) |
Build the return list with the points-to sinks to which we add/append the indices of input_ref which are not in the points-to source reference. More... | |
int | effects_statement_line_number (void) |
To provide information when a but is encountered in the source file or within PIPS. More... | |
list | generic_reference_to_points_to_matching_list (reference input_ref, descriptor input_desc, size_t *p_current_max_path_length, bool *exact_p, transformer current_precondition, list ptl, void(*cell_reference_conversion_func)(reference, reference *, descriptor *), bool(*cell_reference_preceding_p_func)(reference, descriptor, reference, descriptor, transformer, bool, bool *)) |
This function has been outlined from generic_eval_cell_with_points_to() to reduce the size of a function to about one page. More... | |
list | generic_eval_cell_with_points_to (cell input_cell, descriptor input_desc, list ptl, bool *exact_p, transformer current_precondition, bool(*cell_reference_preceding_p_func)(reference, descriptor, reference, descriptor, transformer, bool, bool *), void(*cell_reference_with_address_of_cell_reference_translation_func)(reference, descriptor, reference, descriptor, int, reference *, descriptor *, bool *), void(*cell_reference_conversion_func)(reference, reference *, descriptor *)) |
list | generic_effect_find_equivalent_simple_pointer_values (effect eff, list l_in, cell_relation *exact_aliased_pv, list *l_in_remnants, bool(*cells_intersection_p_func)(cell, descriptor, cell, descriptor, bool *), bool(*cells_inclusion_p_func)(cell, descriptor, cell, descriptor, bool *), void(*simple_cell_conversion_func)(cell, cell *, descriptor *)) |
find pointer_values in l_in which give (possible or exact) paths equivalent to eff. More... | |
list | generic_effect_find_aliases_with_simple_pointer_values (effect eff, list l_pv, bool *exact_p, transformer current_precondition, bool(*cell_preceding_p_func)(cell, descriptor, cell, descriptor, transformer, bool, bool *), void(*cell_with_address_of_cell_translation_func)(cell, descriptor, cell, descriptor, int, cell *, descriptor *, bool *), void(*cell_with_value_of_cell_translation_func)(cell, descriptor, cell, descriptor, int, cell *, descriptor *, bool *), bool(*cells_intersection_p_func)(cell, descriptor, cell, descriptor, bool *), bool(*cells_inclusion_p_func)(cell, descriptor, cell, descriptor, bool *), void(*simple_cell_conversion_func)(cell, cell *, descriptor *)) |
int effects_statement_line_number | ( | void | ) |
To provide information when a but is encountered in the source file or within PIPS.
eval.c
Definition at line 208 of file eval.c.
References effects_private_current_stmt_head(), and statement_number.
Referenced by generic_reference_to_points_to_matching_list().
list generic_effect_find_aliases_with_simple_pointer_values | ( | effect | eff, |
list | l_pv, | ||
bool * | exact_p, | ||
transformer | current_precondition, | ||
bool(*)(cell, descriptor, cell, descriptor, transformer, bool, bool *) | cell_preceding_p_func, | ||
void(*)(cell, descriptor, cell, descriptor, int, cell *, descriptor *, bool *) | cell_with_address_of_cell_translation_func, | ||
void(*)(cell, descriptor, cell, descriptor, int, cell *, descriptor *, bool *) | cell_with_value_of_cell_translation_func, | ||
bool(*)(cell, descriptor, cell, descriptor, bool *) | cells_intersection_p_func, | ||
bool(*)(cell, descriptor, cell, descriptor, bool *) | cells_inclusion_p_func, | ||
void(*)(cell, cell *, descriptor *) | simple_cell_conversion_func | ||
) |
should it be turned into entity_abstract_location_p (?)
first we must find in eff intermediary paths to pointers
and find if this gives equivalent paths in l_pv
this is valid only if the first value_of corresponds to eff_intermediary
This test is valid here because by construction either c1 or c2 is an equivalent for eff_intermediary
use second cell as equivalent value for intermediary path
cell_relation_second_address_of_p is true
use first cell as equivalent value for intermediary path
FOREACH
Then we must find if there are address_of second cells which are preceding paths of eff path in which case they must be used to generate other aliased paths
for the translation, add a dereferencing_dimension to pv_remnant_first_cell
FOREACH
if (!anywhere_p)
else branche of if (anywhere_effect_p(eff))
eff | ff |
l_pv | _pv |
exact_p | xact_p |
current_precondition | urrent_precondition |
Definition at line 673 of file eval.c.
References anywhere_effect_p(), cell_entity(), cell_indices(), cell_preceding_p_func, cell_reference, CELL_RELATION, cell_relation_exact_p, cell_relation_first_cell, cell_relation_may_p, cell_relation_second_address_of_p, cell_relation_second_cell, cell_relation_second_value_of_p, cell_relation_undefined, cell_relation_undefined_p, cell_undefined, CONS, copy_action(), copy_reference(), current_precondition, descriptor_undefined, descriptor_undefined_p, EFFECT, effect_action, effect_any_reference, effect_cell, effect_descriptor, effect_entity(), effect_exact_p, effect_intermediary_pointer_paths_effect(), effect_to_list(), effects_to_may_effects(), ENDP, EXPRESSION, FOREACH, free_cell(), gen_full_free_list(), gen_length(), gen_nconc(), generic_effect_find_aliases_with_simple_pointer_values(), generic_effect_find_equivalent_simple_pointer_values(), int, int_to_expression(), make_action_write_memory(), make_approximation_exact(), make_approximation_may(), make_cell_reference(), make_descriptor_none(), make_effect(), make_null_pointer_value_effect(), make_undefined_pointer_value_effect(), NIL, null_pointer_value_cell_p(), pips_assert, pips_debug, pips_debug_effect, pips_debug_effects, pips_debug_pv, pips_debug_pvs, reference_indices, same_entity_p(), transformer_undefined, and undefined_pointer_value_cell_p().
Referenced by convex_effect_find_aliased_paths_with_pointer_values(), effect_find_aliased_paths_with_pointer_values(), and generic_effect_find_aliases_with_simple_pointer_values().
list generic_effect_find_equivalent_simple_pointer_values | ( | effect | eff, |
list | l_in, | ||
cell_relation * | exact_aliased_pv, | ||
list * | l_in_remnants, | ||
bool(*)(cell, descriptor, cell, descriptor, bool *) | cells_intersection_p_func, | ||
bool(*)(cell, descriptor, cell, descriptor, bool *) | cells_inclusion_p_func, | ||
void(*)(cell, cell *, descriptor *) | simple_cell_conversion_func | ||
) |
find pointer_values in l_in which give (possible or exact) paths equivalent to eff.
eff | is the considered input path. |
l_in | is the input pointer values list. |
exact_aliased_pv | gives an exact equivalent path found in l_in if it exists. |
l_in_remnants | contains the elemnts of l_in which are neither exact_aliased_pv nor in the returned list. |
eff characteristics
first, search for the (exact/possible) values of eff cell in l_in
we search for the cell_relations where ref appears as a first cell, or the exact value_of pointer_values where ref appears as a second cell. If an exact value_of relation is found, it is retained in exact_aliased_pv
eff | ff |
l_in | _in |
exact_aliased_pv | xact_aliased_pv |
l_in_remnants | _in_remnants |
Definition at line 506 of file eval.c.
References CELL_RELATION, cell_relation_exact_p, cell_relation_first_cell, cell_relation_second_address_of_p, cell_relation_second_cell, cell_relation_second_value_of_p, cell_relation_undefined, cell_relation_undefined_p, cell_undefined, CONS, descriptor_undefined, effect_cell, effect_descriptor, FOREACH, NIL, null_pointer_value_cell_p(), pips_debug, pips_debug_effect, pips_debug_pv, pips_debug_pvs, and undefined_pointer_value_cell_p().
Referenced by effect_find_equivalent_pointer_values(), and generic_effect_find_aliases_with_simple_pointer_values().
list generic_eval_cell_with_points_to | ( | cell | input_cell, |
descriptor | input_desc, | ||
list | ptl, | ||
bool * | exact_p, | ||
transformer | current_precondition, | ||
bool(*)(reference, descriptor, reference, descriptor, transformer, bool, bool *) | cell_reference_preceding_p_func, | ||
void(*)(reference, descriptor, reference, descriptor, int, reference *, descriptor *, bool *) | cell_reference_with_address_of_cell_reference_translation_func, | ||
void(*)(reference, reference *, descriptor *) | cell_reference_conversion_func | ||
) |
iterer sur le path p[0][1][2][0] et tester chaque fois si on peut dereferencer le pointeur
simple scalar case. I think this should not happen, because there is no dereferencing dimension.
first build a temporary list with matching points-to of maximum length
the current maximum length
else branche of if (input_path_length == 0)
If the results contain dereferencing dimensions, we must eval them recursively
if eff is a may effect, the resulting effects must be may effects
input_cell | nput_cell |
input_desc | nput_desc |
ptl | tl |
exact_p | xact_p |
current_precondition | urrent_precondition |
Definition at line 361 of file eval.c.
References cell_to_reference(), CONS, current_precondition, debug_off, debug_on, EFFECT, effect_any_reference, effect_cell, effect_descriptor, effect_may_p, effect_reference_dereferencing_p(), effect_reference_to_string(), effects_to_may_effects(), ENDP, entity_abstract_location_p(), entity_heap_location_p(), FOREACH, fprintf(), free_effect(), gen_free_list(), gen_length(), gen_nconc(), gen_nreverse(), generic_eval_cell_with_points_to(), generic_reference_to_points_to_matching_list(), generic_transform_sink_cells_from_matching_list(), ifdebug, make_action_write_memory(), make_anywhere_reference(), make_approximation_may(), make_reference_simple_effect, NIL, pips_debug, pips_debug_effects, points_to_reference_to_concrete_type(), print_points_to_relations, ref, reference_indices, reference_to_string(), reference_variable, semantics_user_warning, and use_default_sink_cell().
Referenced by eval_convex_cell_with_points_to(), eval_simple_cell_with_points_to(), and generic_eval_cell_with_points_to().
list generic_reference_to_points_to_matching_list | ( | reference | input_ref, |
descriptor | input_desc, | ||
size_t * | p_current_max_path_length, | ||
bool * | exact_p, | ||
transformer | current_precondition, | ||
list | ptl, | ||
void(*)(reference, reference *, descriptor *) | cell_reference_conversion_func, | ||
bool(*)(reference, descriptor, reference, descriptor, transformer, bool, bool *) | cell_reference_preceding_p_func | ||
) |
This function has been outlined from generic_eval_cell_with_points_to() to reduce the size of a function to about one page.
It computes a list of points-to arcs whose source is compatible with the input reference, "input_ref". It provides information about the number of common indices, "p_current_max_path_length" and about the approximation of the points-to informationx(?).
assume exactness
eligible points-to candidates must have a path length greater or equal to the current maximum length and their path must be a predecessor of the input_ref path.
if the candidate has a path length strictly greater than the current maximum length, the list of previously found matching candidates must be cleared
I keep the whole points_to and not only the sink because I will need the approximation to further test the exactness
FI: I try adding the stripping...
end of FOREACH
input_ref | nput_ref |
input_desc | nput_desc |
p_current_max_path_length | _current_max_path_length |
exact_p | xact_p |
current_precondition | urrent_precondition |
ptl | tl |
Definition at line 223 of file eval.c.
References cell_to_reference(), CONS, current_precondition, effects_statement_line_number(), ENDP, FOREACH, free_cell(), gen_free_list(), gen_length(), get_bool_property(), is_descriptor_none, make_descriptor(), NIL, nowhere_cell_p(), null_cell_p(), pips_debug, POINTS_TO, points_to_sink, points_to_source, points_to_with_stripped_sink(), reference_indices, reference_undefined, UU, word_points_to(), and words_to_string().
Referenced by generic_eval_cell_with_points_to().
|
static |
Build the return list with the points-to sinks to which we add/append the indices of input_ref which are not in the points-to source reference.
This is comparable to an interprocedural translation where the input_ref is a path from the formal parameter, the source the formal parameter and the sink the actual parameter preceded by a & operator.
Let the remaining indices be the indices from input_ref which are not in common with the sources of the points-to (which by construction have all the same path length). For each points-to, the new path is built from the sink reference. If the latter has indices, we add to the value of its last index the value of the first index of the remaining indices. Then we append to the new path the last indices of the reamining indices. If the sink reference has no indices, then the first index of the remaining indices must be equal to zero, and be skipped. And we simply append to the new path the last indices of the remaining indices.
The part of the code inside of the FOREACH could certainely be shared with the interprocedural translation. Besides, it should be made generic to handle convex input paths as well. Only simple paths are currently taken into account.
This function has been outlined from generic_eval_cell_with_points_to() to reduce its size to about one page.
Transform each sink reference to add it in the return list
Here, we should analyse the source remaining indices to know if there are remaining dereferencing dimensions. This would imply keeping track of the indices types. In case there are no more dereferencing dimensions, we would then reuse the sink abstract location. Otherwise (which is presently the only default case), we return an all location cell
the approximation tag of the points-to is taken into account for the exactness of the result except if the matching list has been reduced to one element and if the target is atomic.
It should be false as soon as mll>1...
end of else branch of if (entity_abstract_location_p(sink_ent) && ! entity_flow_or_context_sentitive_heap_location_p(sink_ent))
end of FOREACH(POINTS_TO,...)
Definition at line 114 of file eval.c.
References approximation_exact_p, approximation_may_p, cell_any_reference(), cell_to_reference(), CONS, EFFECT, effect_reference_to_string(), entity_abstract_location_p(), entity_flow_or_context_sentitive_heap_location_p(), entity_null_locations_p(), FOREACH, free_cell(), gen_length(), generic_atomic_points_to_reference_p(), int, is_approximation_exact, is_approximation_may, is_cell_reference, is_descriptor_none, make_action_write_memory(), make_anywhere_cell(), make_approximation(), make_approximation_may(), make_cell(), make_descriptor(), make_descriptor_none(), make_effect(), NIL, pips_debug, POINTS_TO, points_to_approximation, points_to_reference_to_concrete_type(), points_to_sink, reference_undefined, reference_variable, UU, word_points_to(), and words_to_string().
Referenced by generic_eval_cell_with_points_to().
|
static |
In case, the points-to information is not complete, use anywhere locations to convert the reference.
The action will be fixed by a caller or a caller's caller function.
Definition at line 67 of file eval.c.
References CONS, EFFECT, make_action_write_memory(), make_anywhere_cell(), make_approximation_may(), make_descriptor_none(), make_effect(), NIL, and points_to_reference_to_concrete_type().
Referenced by generic_eval_cell_with_points_to().