PIPS
|
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "database.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "constants.h"
#include "misc.h"
#include "text-util.h"
#include "text.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "resources.h"
Go to the source code of this file.
Functions | |
list | ReferenceUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect) __attribute__((unused))) |
package effect: new version by Beatrice Creusillet More... | |
list | ReferenceTestUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect) __attribute__((unused))) |
list | EffectsMayUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect)) |
list EffectsMayUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, may union of the two initial lists modifies : l1 and l2 and their effects. More... | |
list | ProperEffectsMustUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect)) |
list EffectsMustUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, must union of the two initial lists modifies : l1 and l2 and their effects. More... | |
list | EffectsMustUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect)) |
list EffectsMustUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, must union of the two initial lists modifies : l1 and l2 and their effects. More... | |
list | effects_may_union (effect eff1, effect eff2) |
list | effects_must_union (effect eff1, effect eff2) |
effect | effect_may_union (effect eff1, effect eff2) |
Preserve store independent information as long as you can. More... | |
effect | effect_must_union (effect eff1, effect eff2) |
computes the must union of two combinable effects More... | |
static list | effect_sup_difference (effect eff1, effect eff2) |
static list | effect_inf_difference (effect eff1 __attribute__((unused)), effect eff2 __attribute__((unused))) |
list | EffectsSupDifference (list l1, list l2, bool(*difference_combinable_p)(effect, effect)) |
list EffectsSupDifference(list l1, l2) input : two lists of effects output : a list of effect, representing the sup_difference of the initial effects. More... | |
list | EffectsInfDifference (list l1, list l2, bool(*difference_combinable_p)(effect, effect)) |
list EffectsInfDifference(list l1, l2) input : two lists of effects output : a list of effect, representing the inf_difference of the initial effects. More... | |
effect | proper_to_summary_simple_effect (effect eff) |
FI: the goal is to get rid of array subscripts to handle the arrays atomically. More... | |
bool | simple_cells_intersection_p (cell c1, descriptor __attribute__((__unused__)) d1, cell c2, descriptor __attribute__((__unused__)) d2, bool *exact_p) |
bool | simple_cells_inclusion_p (cell c1, __attribute__((__unused__)) descriptor d1, cell c2, __attribute__((__unused__)) descriptor d2, bool *exact_p) |
Inclusion test : More... | |
|
static |
Definition at line 419 of file binary_operators.c.
References NIL.
Referenced by EffectsInfDifference().
Preserve store independent information as long as you can.
I should have some order on references to absorb, for instance, x[1] by x[*].
computes the may union of two combinable effects
[in] | eff1 | effect |
[in] | eff2 |
Abstract locations cases
In fact, we could have : if (al1_p || al_2_p) { entity e1 = effect_entity(e1); entity e2 = effect_entity(e2);
new_ent = entity_locations_max(e1, e2);
eff = make_simple_effect(make_reference(new_ent, NIL), copy_action(effect_action(eff1)), make_approximation(approximation_and(app1,app2), UU)); }
but entity_locations_max involves string manipulations, which are always costly. So we treat apart the cases where (al1_p and ! al2_p) and (al2_p and ! al1_p) because we already know that the abstract location is the max of both locations (because they are combinable (see effects_combinable_p))
concrete locations cases
it's a preference : we change for a reference cell
let us check the indices
eff1 | ff1 |
eff2 | ff2 |
Definition at line 163 of file binary_operators.c.
References approximation_and(), approximation_tag, CAR, cell_preference, cell_preference_p, copy_action(), copy_reference(), effect_abstract_location_p(), effect_action, effect_any_reference, effect_approximation, effect_approximation_tag, effect_cell, effect_entity(), effect_scalar_p(), ENDP, entity_locations_max(), EXPRESSION, EXPRESSION_, expression_equal_p(), free_cell(), is_approximation_may, make_approximation(), make_cell_reference(), make_reference(), make_simple_effect, make_unbounded_expression(), NIL, pips_debug, POP, preference_reference, ref, reference_indices, and UU.
Referenced by effects_may_union().
computes the must union of two combinable effects
[in] | eff1 | effect |
[in] | eff2 |
Abstract locations cases
In fact, we could have : if (al1_p || al_2_p) { entity e1 = effect_entity(e1); entity e2 = effect_entity(e2);
new_ent = entity_locations_max(e1, e2);
eff = make_simple_effect(make_reference(new_ent, NIL), copy_action(effect_action(eff1)), make_approximation(approximation_and(app1,app2), UU)); }
but entity_locations_max involves string manipulations, which are always costly. So we treat apart the cases where (al1_p and ! al2_p) and (al2_p and ! al1_p) because we already know that the abstract location is the max of both locations (because they are combinable (see effects_combinable_p))
concrete locations cases
it's a preference : we change for a reference cell
let us check the indices
eff1 | ff1 |
eff2 | ff2 |
Definition at line 272 of file binary_operators.c.
References approximation_and(), approximation_or(), CAR, cell_preference, cell_preference_p, copy_action(), copy_reference(), effect_abstract_location_p(), effect_action, effect_any_reference, effect_approximation_tag, effect_cell, effect_entity(), effect_scalar_p(), ENDP, entity_locations_max(), EXPRESSION, EXPRESSION_, expression_equal_p(), free_cell(), is_approximation_may, make_approximation(), make_cell_reference(), make_reference(), make_simple_effect, make_unbounded_expression(), NIL, pips_debug, POP, preference_reference, ref, reference_indices, and UU.
Referenced by effects_must_union().
We already know that effects are combinable and they are not abstract locations (or they are context_sensitive heap locations)
eff1 | const |
eff2 | const |
Definition at line 375 of file binary_operators.c.
References effect_any_reference, effect_dup_func, effect_exact_p, effect_may_p, effect_to_list(), effect_to_may_effect_list(), NIL, and reference_equal_p().
Referenced by EffectsSupDifference().
eff1 | ff1 |
eff2 | ff2 |
Definition at line 138 of file binary_operators.c.
References CONS, EFFECT, effect_may_union(), and NIL.
Referenced by EffectsMayUnion().
eff1 | ff1 |
eff2 | ff2 |
Definition at line 145 of file binary_operators.c.
References CONS, EFFECT, effect_must_union(), and NIL.
Referenced by EffectsMustUnion(), and ProperEffectsMustUnion().
list EffectsInfDifference(list l1, l2) input : two lists of effects output : a list of effect, representing the inf_difference of the initial effects.
modifies : the effects of l2 may be freed. comment : we keep the effects of l1 that are not combinable with those of l2, but we don't keep the effects of l2 that are not combinable with those of l_reg1.
l1 | 1 |
l2 | 2 |
Definition at line 462 of file binary_operators.c.
References debug(), effect_inf_difference(), list_of_effects_generic_inf_difference_op(), and NIL.
list EffectsMayUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, may union of the two initial lists modifies : l1 and l2 and their effects.
Effects that are not reused in the output list of effects are freed.nothing (no sharing introduced).
l1 | 1 |
l2 | 2 |
Definition at line 87 of file binary_operators.c.
References effect_to_may_sdfi_list(), effects_may_union(), and list_of_effects_generic_union_op().
Referenced by unstructured_to_effects().
list EffectsMustUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, must union of the two initial lists modifies : l1 and l2 and their effects.
Effects that are not reused in the output list of effects are freed.
l1 | 1 |
l2 | 2 |
Definition at line 126 of file binary_operators.c.
References effect_to_sdfi_list(), effects_must_union(), and list_of_effects_generic_union_op().
list EffectsSupDifference(list l1, l2) input : two lists of effects output : a list of effect, representing the sup_difference of the initial effects.
modifies : the effects of l2 may be freed. comment : we keep the effects of l1 that are not combinable with those of l2, but we don't keep the effects of l2 that are not combinable with those of l_reg1.
l1 | 1 |
l2 | 2 |
Definition at line 438 of file binary_operators.c.
References debug(), effect_sup_difference(), list_of_effects_generic_sup_difference_op(), and NIL.
FI: the goal is to get rid of array subscripts to handle the arrays atomically.
This is not possible with pointer indexing. For instance, p[0] is reduced the Fortran way into p, which is wrong. It could be reduced to p[*] and lead to an anywhere effects. Or we must preserve constant indices (store independent), which is the way to go with C since we transform lots of scalar accesses into array accesses.
FI: I do not understand the mix of side effects on eff, free and alloc conditionnaly for some fields. To be checked.
it's a preference : we change for a reference cell
it's a reference : let'us modify it
it may still be a field entity
eff | ff |
Definition at line 488 of file binary_operators.c.
References CAR, cell_preference, cell_preference_p, cell_reference, copy_reference(), effect_approximation_tag, effect_cell, effect_scalar_p(), ENDP, entity_field_p(), EXPRESSION, EXPRESSION_, expression_reference_p(), expression_variable(), extended_integer_constant_expression_p(), free_cell(), free_expression(), ifdebug, is_approximation_may, list_undefined, make_cell_reference(), make_unbounded_expression(), pips_debug, POP, preference_reference, print_expression(), ref, reference_indices, reference_undefined, unbounded_expression_p(), words_effect(), and words_to_string().
list EffectsMustUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, must union of the two initial lists modifies : l1 and l2 and their effects.
Effects that are not reused in the output list of effects are freed.
l1 | 1 |
l2 | 2 |
Definition at line 107 of file binary_operators.c.
References effect_to_list(), effects_must_union(), and list_of_effects_generic_union_op().
list ReferenceTestUnion | ( | list | l1, |
list | l2, | ||
bool(*)(effect, effect) __attribute__ union_combinable_p((unused)) | |||
) |
somthing more clever should be done here - bc.
Definition at line 67 of file binary_operators.c.
References effects_to_may_effects(), and gen_nconc().
list ReferenceUnion | ( | list | l1, |
list | l2, | ||
bool(*)(effect, effect) __attribute__ union_combinable_p((unused)) | |||
) |
package effect: new version by Beatrice Creusillet
This File contains several functions to combine effects
Definition at line 60 of file binary_operators.c.
References gen_nconc().
bool simple_cells_inclusion_p | ( | cell | c1, |
__attribute__((__unused__)) descriptor | d1, | ||
cell | c2, | ||
__attribute__((__unused__)) descriptor | d2, | ||
bool * | exact_p | ||
) |
Inclusion test :
returns true if c1 is included into c2, false otherwise. returns false if c1 may only be included into c2.
exact_p | target is set to true if the result is exact, false otherwise. |
In fact, this parameter would be useful only if there are overflows during the systems inclusion test. But it is not currently used.
default result
we have combinable concrete locations or assimilated (context sensitive heap locations)
Definition at line 644 of file binary_operators.c.
References abstract_locations_max(), CAR, cell_abstract_location_p(), cell_entity(), cell_indices(), cells_combinable_p(), ENDP, entity_flow_or_context_sentitive_heap_location_p(), EXPRESSION, expression_equal_p(), pips_debug, POP, same_entity_p(), and unbounded_expression_p().
Referenced by effect_find_aliased_paths_with_pointer_values(), effect_find_equivalent_pointer_values(), and kill_pointer_value().
bool simple_cells_intersection_p | ( | cell | c1, |
descriptor __attribute__((__unused__)) | d1, | ||
cell | c2, | ||
descriptor __attribute__((__unused__)) | d2, | ||
bool * | exact_p | ||
) |
default safe result
we have combinable concrete locations or assimilated (context sensitive heap locations)
they intersect if their corresponding indices are unbounded or equal
Definition at line 567 of file binary_operators.c.
References CAR, cell_abstract_location_p(), cell_entity(), cell_indices(), cells_combinable_p(), ENDP, entity_flow_or_context_sentitive_heap_location_p(), EXPRESSION, expression_equal_p(), POP, and unbounded_expression_p().
Referenced by effect_find_aliased_paths_with_pointer_values(), and effect_find_equivalent_pointer_values().