26 #include "pips_config.h"
70 pips_debug(5,
"approximation before converting to store independent cells: %s\n",
78 bool changed_rhs_p =
false;
79 bool changed_lhs_p =
false;
90 if (changed_lhs_p || changed_rhs_p)
92 pips_debug(5,
"approximation set to may after change to store independent cell\n");
107 bool exact_preceding_p;
112 & exact_preceding_p))
118 pips_debug(4,
"lhs path is a predecessor of rhs path, looking for an exact old value for rhs_eff\n");
233 pips_debug(4,
"begin, looking for an exact old value for eff_orig\n");
245 bool first_p =
false;
246 bool to_be_translated =
false;
247 bool exact_preceding_test =
true;
267 if (
same_entity_p(e_kill, e_in_2) && nb_ind_kill <= nb_ind_in_2)
272 pips_debug(3,
"address_of case, and nb_ind_in == nb_ind_kill_2\n");
273 to_be_translated =
false;
277 pips_debug(3,
"second cell is candidate for translation\n");
279 bool inclusion_test_exact_p =
false;
280 if ( (nb_ind_kill == nb_ind_in_2 &&
284 (nb_ind_kill < nb_ind_in_2 &&
289 &exact_preceding_test)))
290 to_be_translated =
true;
291 else to_be_translated =
false;
294 else if (
same_entity_p(e_kill, e_in_1) && nb_ind_kill <= nb_ind_in_1)
296 pips_debug(3,
"first cell is candidate for translation\n");
298 bool inclusion_test_exact_p =
false;
299 if ( (nb_ind_kill == nb_ind_in_1 &&
302 &inclusion_test_exact_p) )
304 (nb_ind_kill < nb_ind_in_1 &&
309 &exact_preceding_test)))
310 to_be_translated =
true;
311 else to_be_translated =
false;
315 to_be_translated =
false;
318 if (to_be_translated)
320 pips_debug(3,
"%s cell must be translated\n", first_p ?
"first" :
"second");
344 pips_debug(3,
"non matching case, keep as is\n");
368 pips_debug(3,
"exact_old_pv is inverted -> translate\n");
377 pips_debug(3,
"exact_old_pv is not inverted\n");
391 pips_debug(3,
"may kill, just change the approximation\n");
399 bool exact_inclusion_p =
false;
404 if (inclusion_p && exact_inclusion_p)
406 pips_debug(3,
"first_cell_old exactly included in cell_kill"
407 " -> pv_old is translated or killed\n");
423 bool exact_inclusion_p =
false;
427 if (inclusion_p && exact_inclusion_p)
429 pips_debug(3,
"second_cell_old exactly included in "
430 "cell_kill -> pv_old is translated or killed\n");
444 " -> keep with may approximation\n");
465 bool exact_inclusion_p =
false;
469 "may kill, keep exact_old_pv with may approximation\n");
477 && exact_inclusion_p)
479 pips_debug(3,
"first cell of exact_old_pv exactly included in cell_kill "
480 "-> exact_old_pv is killed\n");
485 " -> keep with may approximation\n");
518 pips_debug(5,
"translating %s cell\n", in_first_p?
"first":
"second");
546 reference target_ref = old_first_p ? ref_old_2 : ref_old_1;
550 bool exact_translation_p;
551 int nb_common_indices;
552 bool address_of_ref =
false;
554 if (old_first_p && anywhere_old_p)
567 nb_common_indices = (
int) nb_ind_old_1 + 1;
573 &
ref, &d, &exact_translation_p);
578 nb_common_indices = old_first_p ? (
int) nb_ind_old_1 : (
int) nb_ind_old_2;
585 exact_translation_p =
true;
586 address_of_ref =
true;
593 &
ref, &d, &exact_translation_p);
600 &
ref, &d, &exact_translation_p);
623 pips_assert(
"pointer values do not have two address of cells\n", !address_of_ref);
660 list * l_in_remnants)
704 false, l_in, pv_res, ctxt);
705 l_in = pv_res->
l_out;
753 pv_res->
l_out = l_out;
825 pips_debug(5,
"pv1 second cell is anywhere\n");
833 pips_debug(5,
"pv2 second cell is anywhere\n");
853 if (t1 == t2) t = t1;
872 for(; !
ENDP(l_ind_c_second_pv);
POP(l_ind_c_second_pv),
POP(l_ind_c_second_2))
902 pips_debug(5,
"pv1 second cell is anywhere\n");
910 pips_debug(5,
"pv2 second cell is anywhere\n");
929 if (t1 == t2) t = t1;
947 for(; !
ENDP(l_ind_c_second_pv);
POP(l_ind_c_second_pv),
POP(l_ind_c_second_2))
970 pips_assert(
"error: there should be no undefined cell_relations in lists\n", !(undef1 && undef2));
972 if (undef1 || undef2)
return true;
985 int n_first_first =
cell_compare(&c_first_1, &c_first_2);
986 if (n_first_first == 0)
return true;
987 int n_first_second =
cell_compare(&c_first_1, &c_second_2);
988 if (n_first_second == 0)
return true;
993 int n_first_first =
cell_compare(&c_first_1, &c_first_2);
994 if (n_first_first == 0)
return true;
995 int n_second_first =
cell_compare(&c_second_1, &c_first_2);
996 if (n_second_first == 0)
return true;
1056 while(result && !
ENDP(l_pv1))
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
cell make_cell_reference(reference _field_)
void free_cell_relation(cell_relation p)
cell make_cell(enum cell_utype tag, void *val)
cell_relation copy_cell_relation(cell_relation p)
CELL_RELATION.
descriptor make_descriptor_none(void)
cell copy_cell(cell p)
CELL.
void free_expression(expression p)
reference copy_reference(reference p)
REFERENCE.
static reference ref
Current stmt (an integer)
bool entity_all_locations_p(entity e)
test if an entity is the top of the lattice
void const char const char const int
list cell_relations_generic_binary_op(list l1, list l2, bool(*cr1_cr2_combinable_p)(cell_relation, cell_relation), list(*cr1_cr2_binary_op)(cell_relation, cell_relation), list(*cr1_unary_op)(cell_relation), list(*cr2_unary_op)(cell_relation), list(*union_op)(list, list))
functions specific to cell_relations
int cell_compare(cell *c1, cell *c2)
int pointer_value_compare(cell_relation *ppv1, cell_relation *ppv2)
Compares two pointer values for sorting.
#define pips_debug_effects(level, message, l_eff)
#define pips_debug_effect(level, message, eff)
for debug
list generic_effect_find_aliases_with_simple_pointer_values(effect, list, bool *, transformer, bool(*)(cell, descriptor, cell, descriptor, transformer, bool, bool *), void(*)(cell, descriptor, cell, descriptor, int, cell *, descriptor *, bool *), void(*)(cell, descriptor, cell, descriptor, int, cell *, descriptor *, bool *), bool(*)(cell, descriptor, cell, descriptor, bool *), bool(*)(cell, descriptor, cell, descriptor, bool *), void(*)(cell, cell *, descriptor *))
list generic_effect_find_equivalent_simple_pointer_values(effect, list, cell_relation *, list *, bool(*)(cell, descriptor, cell, descriptor, bool *), bool(*)(cell, descriptor, cell, descriptor, bool *), void(*)(cell, cell *, descriptor *))
find pointer_values in l_in which give (possible or exact) paths equivalent to eff.
bool simple_cells_inclusion_p(cell c1, __attribute__((__unused__)) descriptor d1, cell c2, __attribute__((__unused__)) descriptor d2, bool *exact_p)
Inclusion test :
bool simple_cells_intersection_p(cell c1, descriptor __attribute__((__unused__)) d1, cell c2, descriptor __attribute__((__unused__)) d2, bool *exact_p)
void simple_cell_reference_with_address_of_cell_reference_translation(reference, descriptor, reference, descriptor, int, reference *, descriptor *, bool *)
bool simple_cell_reference_preceding_p(reference, descriptor, reference, descriptor, transformer, bool, bool *)
eval.c
bool simple_cell_preceding_p(cell, descriptor, cell, descriptor, transformer, bool, bool *)
void simple_cell_with_value_of_cell_translation(cell, descriptor, cell, descriptor, int, cell *, descriptor *, bool *)
cell simple_cell_to_store_independent_cell(cell, bool *)
void simple_cell_to_simple_cell_conversion(cell, cell *, descriptor *)
void simple_cell_reference_with_value_of_cell_reference_translation(reference, descriptor, reference, descriptor, int, reference *, descriptor *, bool *)
void simple_cell_with_address_of_cell_translation(cell, descriptor, cell, descriptor, int, cell *, descriptor *, bool *)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define cell_relation_approximation_tag(cr)
#define pips_debug_pv(level, message, pv)
#define effect_approximation_tag(eff)
#define cell_relation_may_p(cr)
#define cell_relation_second_cell(cr)
#define cell_relation_second_interpretation_tag(cr)
#define pips_debug_pvs(level, message, l_pv)
#define cell_relation_exact_p(cr)
#define cell_relation_second_address_of_p(cr)
#define cell_relation_second_value_of_p(cr)
#define cell_relation_first_cell(cr)
bool undefined_pointer_value_cell_p(cell)
bool pv_cells_syntactically_equal_p(cell_relation, cell_relation)
tag approximation_and(tag, tag)
tag approximation_and(tag t1, tag t2) input : two approximation tags.
bool pv_cells_mergeable_p(cell_relation, cell_relation)
reference cell_any_reference(cell)
API for reference.
bool abstract_pointer_value_cell_p(cell)
cell_relation make_address_of_pointer_value(cell, cell, tag, descriptor)
cell_relation make_value_of_pointer_value(cell, cell, tag, descriptor)
bool anywhere_effect_p(effect)
Is it an anywhere effect? ANYMMODULE:ANYWHERE
cell make_undefined_pointer_value_cell(void)
#define cell_reference(x)
#define CELL_RELATION(x)
CELL_RELATION.
@ is_cell_interpretation_value_of
#define cell_relation_undefined
#define cell_interpretation_value_of_p(x)
#define descriptor_undefined
#define cell_relation_undefined_p(x)
void gen_full_free_list(list l)
#define ENDP(l)
Test if a list is empty.
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
#define CAR(pcons)
Get the value of the first element of a list.
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
list gen_full_copy_list(list l)
Copy a list structure with element copy.
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
int(* gen_cmp_func_t)(const void *, const void *)
void assignment_to_post_pv(expression, bool, expression, bool, list, pv_results *, pv_context *)
list make_simple_pv_from_simple_effects(effect lhs_eff, effect rhs_eff, cell_interpretation ci, list l_in)
pointer_values_operators.c
list simple_pvs_may_union(list l_pv1, list l_pv2)
bool pvs_union_combinable_p(cell_relation pv1, cell_relation pv2)
list simple_pv_may_union(cell_relation pv1, cell_relation pv2)
list pvs_composition_with_transformer(list l_pv, transformer t, pv_context *ctxt)
list simple_pv_must_union(cell_relation pv1, cell_relation pv2)
list kill_pointer_value(effect eff_kill, list l_in, pv_context *ctxt)
eliminate the cell of eff_kill from l_in
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
cell_relation simple_pv_translate(cell_relation pv_in, bool in_first_p, cell_relation pv_old)
list cell_relation_to_list(cell_relation cr)
list simple_pvs_must_union(list l_pv1, list l_pv2)
bool simple_pvs_syntactically_equal_p(list l_pv1, list l_pv2)
list cell_relation_to_may_list(cell_relation cr)
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.
list kill_pointer_values(list l_in, list l_kill, pv_context *ctxt)
eliminate the cells of l_kill from l_in
cell_relation simple_pv_composition_with_transformer(cell_relation pv, transformer __attribute__((unused)) t)
void pointer_values_remove_var(entity e, bool may_p, list l_in, pv_results *pv_res, pv_context *ctxt)
string reference_to_string(reference r)
bool same_entity_p(entity e1, entity e2)
predicates on entities
expression make_unbounded_expression()
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
#define transformer_undefined
#define reference_variable(x)
#define EXPRESSION(x)
EXPRESSION.
#define expression_undefined
#define reference_indices(x)
Value b1
booleen indiquant quel membre est en cours d'analyse
The structure used to build lists in NewGen.
pv_context is a structure holding the methods to use during pointer values analyses
list(* pvs_must_union_func)(list, list)
BINARY OPERATORS.
cell_relation(* pv_composition_with_transformer_func)(cell_relation, transformer)
UNARY OPERATORS.
pv_results is a structure holding the different results of an expression pointer values analysis
@ keep
bj > b1 -> h1/hj = h1
#define exp
Avoid some warnings from "gcc -Wshadow".