PIPS
|
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects.h"
#include "effects-util.h"
#include "text-util.h"
#include "effects-simple.h"
#include "effects-generic.h"
#include "misc.h"
#include "pointer_values.h"
Go to the source code of this file.
list cell_relation_to_list | ( | cell_relation | cr | ) |
cr | r |
Definition at line 800 of file pointer_values_operators.c.
References CELL_RELATION, CONS, and NIL.
Referenced by simple_pvs_must_union().
list cell_relation_to_may_list | ( | cell_relation | cr | ) |
cr | r |
Definition at line 805 of file pointer_values_operators.c.
References CELL_RELATION, cell_relation_approximation_tag, CONS, is_approximation_may, and NIL.
Referenced by simple_pvs_may_union().
list effect_find_aliased_paths_with_pointer_values | ( | effect | eff, |
list | l_pv, | ||
pv_context * | ctxt | ||
) |
find all paths equivalent to eff cell in l_pv by performing a transitive closure
eff | is the input effect |
l_pv | is the list of current pointer_values relations |
ctxt | is the pv analysis context |
eff | ff |
l_pv | _pv |
ctxt | txt |
Definition at line 678 of file pointer_values_operators.c.
References generic_effect_find_aliases_with_simple_pointer_values(), pips_assert, simple_cell_preceding_p(), simple_cell_to_simple_cell_conversion(), simple_cell_with_address_of_cell_translation(), simple_cell_with_value_of_cell_translation(), simple_cells_inclusion_p(), simple_cells_intersection_p(), and transformer_undefined.
Referenced by simple_effect_to_constant_path_effects_with_pointer_values(), and single_pointer_assignment_to_post_pv().
list effect_find_equivalent_pointer_values | ( | effect | eff, |
list | l_in, | ||
cell_relation * | exact_aliased_pv, | ||
list * | l_in_remnants | ||
) |
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 | ff |
l_in | _in |
exact_aliased_pv | xact_aliased_pv |
l_in_remnants | _in_remnants |
Definition at line 658 of file pointer_values_operators.c.
References generic_effect_find_equivalent_simple_pointer_values(), simple_cell_to_simple_cell_conversion(), simple_cells_inclusion_p(), and simple_cells_intersection_p().
Referenced by free_to_post_pv(), kill_pointer_value(), and make_simple_pv_from_simple_effects().
list kill_pointer_value | ( | effect | eff_kill, |
list | l_in, | ||
pv_context * | ctxt | ||
) |
eliminate the cell of eff_kill from l_in
eff_kill | is the effect describing the cell to be killed |
l_in | is the input list of pointer_values. |
ctxt | is a pointer on the pointer values analysis contex. |
all pointers may be killed
eff_kill characteristics
using old_values, take into account the impact of eff_kill on l_in pointer values second cells which must be expressed in terms of unchanged paths.
should we translate the first or the second pv_in cell
must it be translated ?
pv_in first cell characteristics
pv_in second cell characteristics
pointer value relation is still valid
This should be made generic
we must translate ref_in using the old_values
if there is an exact candidate, it is ranked first and we can use it
generate a new pv for each element of old_values
FOREACH(CELL_RELATION, old_pv, l_old_values)
else branch of if (exact_first_pv)
if (to_be_translated)
FOREACH (CELL_RELATION, pv_in, l_remnants)
Second, take into account the impact of eff_kill on l_old_values relations. We only have to keep those which are not completely killed by kill_eff, and set their approximation to may (this is also true for exact_old_pv)
first use exact_old_pv to translate exact old_values
Then the other old_values
we already know that there may be a non-empty intersection with cell_kill
some more work is necessary
some more precise work could be done here by computing the difference between the pv_old first cell and cell_kill. I don't know if it would be really useful. So let us avoid too complex things for the moment.
some more precise work could be done here by computing the difference between the pv_old first cell and cell_kill. I don't know if it would be really useful. So let us avoid too complex things for the moment.
eff_kill | ff_kill |
l_in | of cell_relations |
ctxt | txt |
Definition at line 193 of file pointer_values_operators.c.
References abstract_pointer_value_cell_p(), anywhere_effect_p(), cell_reference, CELL_RELATION, cell_relation_approximation_tag, cell_relation_first_cell, cell_relation_second_address_of_p, cell_relation_second_cell, cell_relation_undefined, cell_relation_undefined_p, CONS, copy_cell(), copy_cell_relation(), descriptor_undefined, effect_any_reference, effect_approximation_tag, effect_cell, effect_find_equivalent_pointer_values(), FOREACH, free_cell_relation(), gen_free_list(), gen_length(), is_approximation_may, make_descriptor_none(), make_value_of_pointer_value(), NIL, pips_debug, pips_debug_effect, pips_debug_pv, pips_debug_pvs, pv_context::pvs_must_union_func, reference_indices, reference_variable, same_entity_p(), simple_cell_reference_preceding_p(), simple_cells_inclusion_p(), simple_pv_translate(), and transformer_undefined.
Referenced by kill_pointer_values().
list kill_pointer_values | ( | list | l_in, |
list | l_kill, | ||
pv_context * | ctxt | ||
) |
eliminate the cells of l_kill from l_in
l_kill | is the list of effects describing the cells to eliminated from l_in |
l_in | is the input list of pointer_values. |
ctxt | is a pointer on the pointer values analysis contex. |
l_in | of cell_relations |
l_kill | of effects |
ctxt | txt |
Definition at line 155 of file pointer_values_operators.c.
References EFFECT, ENDP, FOREACH, gen_full_copy_list(), gen_full_free_list(), kill_pointer_value(), NIL, pips_debug_effects, and pips_debug_pvs.
Referenced by single_pointer_assignment_to_post_pv().
list make_simple_pv_from_simple_effects | ( | effect | lhs_eff, |
effect | rhs_eff, | ||
cell_interpretation | ci, | ||
list | l_in | ||
) |
lhs_eff | hs_eff |
rhs_eff | hs_eff |
ci | i |
l_in | _in |
Definition at line 57 of file pointer_values_operators.c.
References approximation_and(), cell_interpretation_value_of_p, cell_reference, CELL_RELATION, cell_relation_undefined, cell_relation_undefined_p, CONS, copy_reference(), descriptor_undefined, effect_any_reference, effect_approximation_tag, effect_cell, effect_find_equivalent_pointer_values(), FOREACH, free_cell_relation(), gen_free_list(), is_approximation_exact, is_approximation_may, is_cell_reference, make_address_of_pointer_value(), make_cell(), make_descriptor_none(), make_undefined_pointer_value_cell(), make_value_of_pointer_value(), NIL, pips_debug, pips_debug_effect, pips_debug_pvs, simple_cell_reference_preceding_p(), simple_cell_to_store_independent_cell(), simple_pv_translate(), transformer_undefined, and undefined_pointer_value_cell_p().
Referenced by make_simple_pv_context().
void pointer_values_remove_var | ( | entity | e, |
bool | may_p, | ||
list | l_in, | ||
pv_results * | pv_res, | ||
pv_context * | ctxt | ||
) |
possibly assign an undefined value to pointers reachable from e without dereferencements)
Then replace all occurrences of e by an undefined value if it's not a may kill
may_p | ay_p |
l_in | _in |
pv_res | v_res |
ctxt | txt |
Definition at line 693 of file pointer_values_operators.c.
References assignment_to_post_pv(), cell_reference, CELL_RELATION, cell_relation_first_cell, cell_relation_second_cell, cell_relation_second_interpretation_tag, CONS, copy_cell_relation(), entity_name, entity_to_expression(), exp, expression_undefined, FOREACH, free_cell(), free_cell_relation(), free_expression(), gen_full_free_list(), is_cell_interpretation_value_of, keep, pv_results::l_out, make_undefined_pointer_value_cell(), NIL, pips_debug, pips_debug_pv, pips_debug_pvs, reference_variable, same_entity_p(), and undefined_pointer_value_cell_p().
Referenced by free_to_post_pv(), and sequence_to_post_pv().
list pvs_composition_with_transformer | ( | list | l_pv, |
transformer | t, | ||
pv_context * | ctxt | ||
) |
l_pv | _pv |
ctxt | txt |
Definition at line 788 of file pointer_values_operators.c.
References CELL_RELATION, FOREACH, and pv_context::pv_composition_with_transformer_func.
Referenced by statement_to_post_pv().
bool pvs_union_combinable_p | ( | cell_relation | pv1, |
cell_relation | pv2 | ||
) |
pv1 | v1 |
pv2 | v2 |
Definition at line 965 of file pointer_values_operators.c.
References cell_compare(), cell_entity(), cell_relation_first_cell, cell_relation_second_cell, cell_relation_second_value_of_p, cell_relation_undefined_p, entity_all_locations_p(), pips_assert, and pv_cells_mergeable_p().
Referenced by simple_pvs_may_union(), and simple_pvs_must_union().
cell_relation simple_pv_composition_with_transformer | ( | cell_relation | pv, |
transformer __attribute__((unused)) | t | ||
) |
Definition at line 766 of file pointer_values_operators.c.
References b1, b2, cell_relation_approximation_tag, cell_relation_exact_p, cell_relation_first_cell, cell_relation_second_cell, is_approximation_may, and simple_cell_to_store_independent_cell().
list simple_pv_may_union | ( | cell_relation | pv1, |
cell_relation | pv2 | ||
) |
pv1 | v1 |
pv2 | v2 |
Definition at line 891 of file pointer_values_operators.c.
References CAR, cell_any_reference(), cell_compare(), cell_entity(), CELL_RELATION, cell_relation_approximation_tag, cell_relation_first_cell, cell_relation_second_cell, CONS, copy_cell(), copy_cell_relation(), ENDP, entity_all_locations_p(), EXPRESSION, EXPRESSION_, expression_equal_p(), is_approximation_may, make_address_of_pointer_value(), make_descriptor_none(), make_unbounded_expression(), NIL, pips_debug, pips_debug_pvs, POP, and reference_indices.
Referenced by simple_pvs_may_union().
list simple_pv_must_union | ( | cell_relation | pv1, |
cell_relation | pv2 | ||
) |
pv1 | v1 |
pv2 | v2 |
Definition at line 811 of file pointer_values_operators.c.
References CAR, cell_any_reference(), cell_compare(), cell_entity(), CELL_RELATION, cell_relation_approximation_tag, cell_relation_first_cell, cell_relation_second_cell, cell_relation_undefined, CONS, copy_cell(), copy_cell_relation(), ENDP, entity_all_locations_p(), EXPRESSION, EXPRESSION_, expression_equal_p(), is_approximation_exact, is_approximation_may, make_address_of_pointer_value(), make_descriptor_none(), make_unbounded_expression(), NIL, pips_debug, pips_debug_pv, pips_debug_pvs, POP, and reference_indices.
Referenced by simple_pvs_must_union().
cell_relation simple_pv_translate | ( | cell_relation | pv_in, |
bool | in_first_p, | ||
cell_relation | pv_old | ||
) |
pv_in | a the input pointer_value relation |
in_first_p | is true (false) if the first (second) cell of pv_in has to be translated |
pv_old | is the cell relation that gives the value of a prefix path of the first (second) cell of pv_in |
pv_in first or second cell characteristics
pv_old characteristics
is the first cell of pv_old the prefix of ref_in?
act as if there were a [0] indice at the end of ref_old_1
not generic here
not generic here
not generic here
not generic here
not generic here
not generic here
pv_in | v_in |
in_first_p | n_first_p |
pv_old | v_old |
Definition at line 513 of file pointer_values_operators.c.
References cell_reference, cell_relation_first_cell, cell_relation_may_p, cell_relation_second_address_of_p, cell_relation_second_cell, cell_relation_second_value_of_p, copy_cell(), copy_reference(), descriptor_undefined, entity_all_locations_p(), gen_length(), int, is_approximation_exact, is_approximation_may, make_address_of_pointer_value(), make_cell_reference(), make_descriptor_none(), make_value_of_pointer_value(), pips_assert, pips_debug, pips_debug_pv, ref, reference_indices, reference_to_string(), reference_variable, same_entity_p(), simple_cell_reference_with_address_of_cell_reference_translation(), and simple_cell_reference_with_value_of_cell_reference_translation().
Referenced by kill_pointer_value(), and make_simple_pv_from_simple_effects().
l_pv1 | _pv1 |
l_pv2 | _pv2 |
Definition at line 1029 of file pointer_values_operators.c.
References cell_relation_to_may_list(), cell_relations_generic_binary_op(), pvs_union_combinable_p(), simple_pv_may_union(), and simple_pvs_must_union().
Referenced by make_simple_pv_context().
l_pv1 | _pv1 |
l_pv2 | _pv2 |
Definition at line 1010 of file pointer_values_operators.c.
References cell_relation_to_list(), cell_relations_generic_binary_op(), pvs_union_combinable_p(), simple_pv_must_union(), and simple_pvs_must_union().
Referenced by make_simple_pv_context(), simple_pvs_may_union(), and simple_pvs_must_union().
first sort lists
then compare members syntactically
l_pv1 | _pv1 |
l_pv2 | _pv2 |
Definition at line 1042 of file pointer_values_operators.c.
References CAR, CELL_RELATION, ENDP, gen_length(), gen_sort_list(), pointer_value_compare(), POP, and pv_cells_syntactically_equal_p().
Referenced by make_simple_pv_context().