PIPS
effects.c File Reference
#include <stdio.h>
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "effects.h"
#include "misc.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "properties.h"
#include "effects-util.h"
#include "text.h"
#include "text-util.h"
+ Include dependency graph for effects.c:

Go to the source code of this file.

Functions

entity effect_entity (effect e)
 Created by B. More...
 
entity cell_entity (cell c)
 
list cell_indices (cell c)
 
reference cell_any_reference (cell c)
 API for reference. More...
 
bool memory_dereferencing_p (reference r)
 Does the set of locations referenced by r depend on a pointer dereferencing? More...
 
effects list_to_effects (list l_eff)
 Future API for GAP, Generic Access Path. More...
 
list effects_to_list (effects efs)
 
statement_mapping listmap_to_effectsmap (statement_mapping l_map)
 
statement_mapping effectsmap_to_listmap (statement_mapping efs_map)
 
bool statement_has_a_module_formal_argument_write_effect_p (statement s, entity module, statement_mapping effects_list_map)
 Return true if the statement has a write effect on at least one of the argument (formal parameter) of the module. More...
 
bool cell_abstract_location_p (cell c)
 
bool effect_abstract_location_p (effect eff)
 
bool effects_abstract_location_p (list el)
 Returns true if at least one effect of effect list el is related to an abstract location. More...
 
effect anywhere_effect (action ac)
 Anywhere effect: an effect which can be related to any location of any areas. More...
 
static bool generic_anywhere_effect_p (effect e, int kind)
 Is it an anywhere effect (kind=0)? a typed anywhere effect (kind=1) ? or any kind of anywhere effect (kind=2)? More...
 
bool anywhere_effect_p (effect e)
 Is it an anywhere effect? ANYMMODULE:ANYWHERE More...
 
bool typed_anywhere_effect_p (effect e)
 Is it a typed anywhere effect? ANYMMODULE:ANYWHERE_b0, 1, 2. More...
 
bool any_anywhere_effect_p (effect e)
 Is it a typed or untyped anywhere effect? More...
 
bool anywhere_cell_p (cell c)
 Is it an anywhere cell? More...
 
bool anywhere_reference_p (reference r)
 
effect heap_effect (entity m, action ac)
 
bool heap_effect_p (effect e)
 
bool heap_cell_p (cell c)
 Any heap cell, more or less abstract or typed. More...
 
bool all_heap_locations_cell_p (cell c)
 
bool nowhere_cell_p (cell c)
 Target of an undefined pointer. More...
 
bool null_cell_p (cell c)
 
bool malloc_effect_p (effect e)
 
bool malloc_cell_p (cell c)
 
bool malloc_reference_p (reference r)
 
bool io_effect_entity_p (entity e)
 
bool io_effect_p (effect e)
 
bool io_cell_p (cell c)
 
bool io_effects_p (list effects)
 
bool std_file_effect_p (effect e)
 
bool std_file_cell_p (cell c)
 
bool std_file_effects_p (list effects)
 
bool FILE_star_effect_reference_p (reference ref)
 
bool effect_scalar_p (effect eff)
 
bool effect_comparable_p (effect e1, effect e2)
 Can we merge these two effects because they are equal or because they only differ by their approximations and their descriptors? More...
 
bool store_independent_effect_p (effect eff)
 Does this effect define the same set of memory locations regardless of the current (environment and) memory state? More...
 
bool effect_on_non_local_variable_p (effect eff)
 Test if an effect has a non local effect. More...
 
bool effects_on_non_local_variable_p (list effects)
 Test if a list of effects concerns non local variables. More...
 
bool effects_interfere_p (effect eff1, effect eff2)
 Two effects interfere if one of them modify the set of locations defined by the other one. More...
 
effect effect_to_store_independent (effect eff)
 
effect effect_to_pointer_store_independent_effect (effect eff, entity p)
 Modify eff so that the set of memory locations decribed after a write to some pointer p is still in the abstract location set of eff. More...
 
effect effect_to_non_pointer_store_independent_effect (effect eff)
 Modify eff so that the set of memory locations decribed after a write to some non pointer variable is still in the abstract location set of eff. More...
 
effect effect_interference (effect eff1, effect eff2)
 Modifies effect eff1 to make sure that any memory state modification abstracted by eff2 preserves the correctness of eff1: all memory locations included in eff1 at input are included in the memory locations abstracted by the new eff1 after the abstract state transition. More...
 
string action_to_string (action ac)
 Functions dealing with actions. More...
 
string full_action_to_string (action ac)
 
string full_action_to_short_string (action ac)
 
string action_kind_to_string (action_kind ak)
 
action make_action_write_memory (void)
 To ease the extension of action with action_kind. More...
 
action make_action_read_memory (void)
 
bool action_equal_p (action a1, action a2)
 
action_kind action_to_action_kind (action a)
 Without the consistency test, this function would certainly be inlined. More...
 
action_kind effect_action_kind (effect eff)
 
bool store_effect_p (effect e)
 
bool environment_effect_p (effect e)
 
bool type_declaration_effect_p (effect e)
 
bool effects_write_variable_p (list el, entity v)
 
bool effects_write_p (list el)
 
bool effects_read_variable_p (list el, entity v)
 
bool effects_all_read_p (list el)
 Check that all effects in el are read effects. More...
 
bool effect_list_can_be_safely_full_freed_p (list el)
 Check if some references might be freed with the effects. More...
 
tag approximation_and (tag t1, tag t2)
 tag approximation_and(tag t1, tag t2) input : two approximation tags. More...
 
tag approximation_or (tag t1, tag t2)
 tag approximation_or(tag t1, tag t2) input : two approximation tags. More...
 
bool cell_equal_p (cell c1, cell c2)
 CELLS. More...
 
bool cell_entity_equal_p (cell c1, cell c2)
 
bool points_to_reference_included_p (reference r1, reference r2)
 FI->FC/AM: some elements of the lattice must be exploited here... More...
 
bool cell_included_p (cell c1, cell c2)
 Check that all memory locations denoted by cell "c1" are included in cell "c2". More...
 
bool cell_equivalent_p (cell c1, cell c2)
 Check that memory locations denoted by cell "c1" can be reached by knowing cell "c2" and by using pointer arithmetic or subscripting. More...
 
reference cell_to_reference (cell c)
 FI: probably to be moved elsewhere in ri-util. More...
 
bool effect_list_consistent_p (list el)
 Debugging. More...
 
bool union_compatible_effects_p (effect ef1, effect ef2)
 DO NOT USE ANYMORE: NOT COMPATIBLE WITH ABSTRACT LOCATIONS. More...
 
entity effect_to_entity (effect ef)
 Returns the entity corresponding to the mutation. More...
 
bool vect_contains_phi_p (Pvecteur v)
 bool vect_contains_phi_p(Pvecteur v) input : a vector output : true if v contains a PHI variable, false otherwise modifies : nothing More...
 
cell points_to_cell_add_field_dimension (cell c, entity f)
 Functions about points-to cells - There is no cell.c file. More...
 
reference reference_add_field_dimension (reference r, entity f)
 add a field f as a subscript to a reference r if it is meaningful. More...
 
reference simple_reference_add_field_dimension (reference r, entity f)
 Do not check anything, just add f as a last subscript. More...
 
void points_to_cell_add_fixed_subscripts (cell c, bool zero_p)
 Convert a reference to an array into a reference to its first element. More...
 
void points_to_cell_add_zero_subscripts (cell c)
 
void points_to_cell_add_zero_subscript (cell c)
 
void points_to_cell_complete_with_zero_subscripts (cell c)
 
void points_to_cell_add_unbounded_subscripts (cell c)
 
void points_to_cell_update_last_subscript (cell c, expression s)
 Transform reference a[i]...[j] and expression s into reference a[i]..[j+s] if j and s are constant integer expressions, and into reference a[i]..[*] otherwise. More...
 
bool atomic_effect_p (effect e)
 
list recursive_cell_to_pointer_cells (cell c)
 
list cell_to_pointer_cells (cell c)
 If the reference in "c" is not a pointer, see if it can be transformed into a pointer reference by adding subscripts, field subscripts or a combination of both... More...
 

Function Documentation

◆ action_equal_p()

bool action_equal_p ( action  a1,
action  a2 
)

action_write_p(a1)

Parameters
a11
a22

Definition at line 1023 of file effects.c.

1024 {
1025  bool equal_p = false;
1026 
1027  if(action_tag(a1)==action_tag(a2)) {
1028  if(action_read_p(a1)) {
1029  action_kind ak1 = action_read(a1);
1030  action_kind ak2 = action_read(a2);
1031 
1032  equal_p = action_kind_tag(ak1)==action_kind_tag(ak2);
1033  }
1034  else /* action_write_p(a1) */ {
1035  action_kind ak1 = action_write(a1);
1036  action_kind ak2 = action_write(a2);
1037 
1038  equal_p = action_kind_tag(ak1)==action_kind_tag(ak2);
1039  }
1040  }
1041  return equal_p;
1042 
1043 }
#define action_write(x)
Definition: effects.h:316
#define action_kind_tag(x)
Definition: effects.h:258
#define action_read(x)
Definition: effects.h:313
#define action_tag(x)
Definition: effects.h:310
#define action_read_p(x)
Definition: effects.h:311

References action_kind_tag, action_read, action_read_p, action_tag, and action_write.

Referenced by combinable_regions_p(), and effect_comparable_p().

+ Here is the caller graph for this function:

◆ action_kind_to_string()

string action_kind_to_string ( action_kind  ak)
Parameters
akk

Definition at line 995 of file effects.c.

996 {
997  string s = string_undefined;
998 
999  if(action_kind_store_p(ak))
1000  s = "S";
1001  else if(action_kind_environment_p(ak))
1002  s = "E";
1003  else if(action_kind_type_declaration_p(ak))
1004  s = "T";
1005  else
1006  pips_internal_error("Unknown action kind.");
1007  return s;
1008 }
#define action_kind_environment_p(x)
Definition: effects.h:262
#define action_kind_store_p(x)
Definition: effects.h:259
#define action_kind_type_declaration_p(x)
Definition: effects.h:265
#define pips_internal_error
Definition: misc-local.h:149
#define string_undefined
Definition: newgen_types.h:40

References action_kind_environment_p, action_kind_store_p, action_kind_type_declaration_p, pips_internal_error, and string_undefined.

◆ action_to_action_kind()

action_kind action_to_action_kind ( action  a)

Without the consistency test, this function would certainly be inlined.

Macros are avoided to simplify debugging and maintenance.

Definition at line 1048 of file effects.c.

1049 {
1050  pips_assert("consistent action kind.",action_read_p(a) || action_write_p(a));
1052  return ak;
1053 }
#define action_write_p(x)
Definition: effects.h:314
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172

References action_read, action_read_p, action_write, action_write_p, and pips_assert.

Referenced by effect_action_kind(), effects_might_conflict_even_read_only_p(), region_sup_difference(), regions_may_convex_hull(), and union_compatible_effects_p().

+ Here is the caller graph for this function:

◆ action_to_string()

string action_to_string ( action  ac)

Functions dealing with actions.

This is correct, but imprecise when action_kinds are taken into account

Parameters
acc

Definition at line 936 of file effects.c.

937 {
938  /* This is correct, but imprecise when action_kinds are taken into
939  account */
940  return action_read_p(ac)? "read" : "write";
941 }

References action_read_p.

◆ all_heap_locations_cell_p()

bool all_heap_locations_cell_p ( cell  c)

Definition at line 432 of file effects.c.

433 {
434  bool heap_p;
436  entity v = reference_variable(r);
437 
438  heap_p = entity_all_heap_locations_p(v);
439 
440  return heap_p;
441 }
reference cell_any_reference(cell c)
API for reference.
Definition: effects.c:77
bool entity_all_heap_locations_p(entity e)
test if an entity is the set of all heap locations
#define reference_variable(x)
Definition: ri.h:2326

References cell_any_reference(), entity_all_heap_locations_p(), and reference_variable.

Referenced by points_to_cell_types_compatibility(), points_to_function_projection(), and subscript_to_points_to_sinks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ any_anywhere_effect_p()

bool any_anywhere_effect_p ( effect  e)

Is it a typed or untyped anywhere effect?

Definition at line 358 of file effects.c.

359 {
360  return generic_anywhere_effect_p(e, 2);
361 }
static bool generic_anywhere_effect_p(effect e, int kind)
Is it an anywhere effect (kind=0)? a typed anywhere effect (kind=1) ? or any kind of anywhere effect ...
Definition: effects.c:333

References generic_anywhere_effect_p().

+ Here is the call graph for this function:

◆ anywhere_cell_p()

bool anywhere_cell_p ( cell  c)

◆ anywhere_effect()

effect anywhere_effect ( action  ac)

Anywhere effect: an effect which can be related to any location of any areas.

Allocate a new anywhere effect, and the anywhere entity on demand which may not be best if we want to express it's aliasing with all module areas. In the later case, the anywhere entity should be generated by bootstrap and be updated each time new areas are declared by the parsers. I do not use a persistant anywhere reference to avoid trouble with convex-effect nypassing of the persistant pointer.

Action a is integrated in the new effect (aliasing). NOT GENERIC AT ALL. USE make_anywhere_effect INSTEAD (BC).

Parameters
acc

Definition at line 317 of file effects.c.

318 {
319  entity anywhere = entity_all_locations();
320  effect any = effect_undefined;
321 
323  ac,
326 
327  return any;
328 }
cell make_cell_reference(reference _field_)
Definition: effects.c:293
approximation make_approximation_may(void)
Definition: effects.c:179
effect make_effect(cell a1, action a2, approximation a3, descriptor a4)
Definition: effects.c:484
descriptor make_descriptor_none(void)
Definition: effects.c:442
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
entity entity_all_locations()
eturn ANY_MODULE:ANYWHERE (the top of the lattice)
#define effect_undefined
Definition: effects.h:614
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47

References effect_undefined, entity_all_locations(), make_approximation_may(), make_cell_reference(), make_descriptor_none(), make_effect(), make_reference(), and NIL.

Referenced by effect_to_pointer_store_independent_effect(), and effect_to_store_independent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ anywhere_effect_p()

◆ anywhere_reference_p()

bool anywhere_reference_p ( reference  r)

Definition at line 378 of file effects.c.

379 {
380  bool anywhere_p;
381  entity v = reference_variable(r);
382 
383  anywhere_p = entity_all_locations_p(v);
384 
385  return anywhere_p;
386 }

References entity_all_locations_p(), and reference_variable.

Referenced by any_assign_to_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ approximation_and()

tag approximation_and ( tag  t1,
tag  t2 
)

tag approximation_and(tag t1, tag t2) input : two approximation tags.

output : the tag representing their "logical and", assuming that must = true and may = false. modifies : nothing

Parameters
t11
t22

Definition at line 1198 of file effects.c.

1199 {
1200  if ((t1 == is_approximation_exact) && (t2 == is_approximation_exact))
1201  return(is_approximation_exact);
1202  else
1203  return(is_approximation_may);
1204 }
@ is_approximation_may
Definition: effects.h:341
@ is_approximation_exact
Definition: effects.h:343

References is_approximation_exact, and is_approximation_may.

Referenced by effect_may_union(), effect_must_union(), make_simple_pv_from_simple_effects(), region_intersection(), region_union(), and regions_may_convex_hull().

+ Here is the caller graph for this function:

◆ approximation_or()

tag approximation_or ( tag  t1,
tag  t2 
)

tag approximation_or(tag t1, tag t2) input : two approximation tags.

output : the tag representing their "logical or", assuming that must = true and may = false. modifies : nothing

Parameters
t11
t22

Definition at line 1213 of file effects.c.

1214 {
1215  if ((t1 == is_approximation_exact) || (t2 == is_approximation_exact))
1216  return(is_approximation_exact);
1217  else
1218  return(is_approximation_may);
1219 }

References is_approximation_exact, and is_approximation_may.

Referenced by effect_must_union(), region_union(), and regions_must_convex_hull().

+ Here is the caller graph for this function:

◆ atomic_effect_p()

bool atomic_effect_p ( effect  e)

Maybe it is an effect on a structure field

Definition at line 1668 of file effects.c.

1669 {
1670  bool atomic_p = effect_scalar_p(e);
1671  if(!atomic_p) {
1672  /* Maybe it is an effect on a structure field */
1673  cell c = effect_cell(e);
1674  atomic_p = atomic_points_to_cell_p(c);
1675  }
1676  return atomic_p;
1677 }
bool effect_scalar_p(effect eff)
Definition: effects.c:567
bool atomic_points_to_cell_p(cell)
Is it a unique concrete memory location?
Definition: points_to.c:423
#define effect_cell(x)
Definition: effects.h:640

References atomic_points_to_cell_p(), effect_cell, and effect_scalar_p().

+ Here is the call graph for this function:

◆ cell_abstract_location_p()

bool cell_abstract_location_p ( cell  c)

Definition at line 273 of file effects.c.

274 {
275  pips_assert("cell is not a GAP", !cell_gap_p(c));
276 
278 }
bool entity_abstract_location_p(entity al)
#define cell_gap_p(x)
Definition: effects.h:473

References cell_any_reference(), cell_gap_p, entity_abstract_location_p(), pips_assert, and reference_variable.

Referenced by cells_to_read_or_write_effects(), convex_cells_inclusion_p(), convex_cells_intersection_p(), effect_abstract_location_p(), simple_cells_inclusion_p(), simple_cells_intersection_p(), and upgrade_approximations_in_points_to_set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cell_any_reference()

reference cell_any_reference ( cell  c)

API for reference.

Definition at line 77 of file effects.c.

78 {
79  if (cell_gap_p(c)) return reference_undefined;
80 
81  return (cell_reference_p(c)) ? cell_reference(c) :
83 }
#define cell_reference(x)
Definition: effects.h:469
#define cell_preference(x)
Definition: effects.h:472
#define cell_reference_p(x)
Definition: effects.h:467
#define reference_undefined
Definition: ri.h:2302
#define preference_reference(x)
Definition: ri.h:2102

References cell_gap_p, cell_preference, cell_reference, cell_reference_p, preference_reference, and reference_undefined.

Referenced by aliased_translation_p(), all_heap_locations_cell_p(), any_assign_to_transformer(), anywhere_cell_p(), anywhere_source_to_sinks(), array_formal_parameter_to_stub_points_to(), atomic_constant_path_p(), atomic_points_to_cell_p(), binary_intrinsic_call_to_points_to_sinks(), cell_abstract_location_p(), cell_entity(), cell_equivalent_p(), cell_included_p(), cell_indices(), cell_is_xxx_p(), cell_to_pointer_cells(), cell_typed_anywhere_locations_p(), cells_to_read_or_write_effects(), check_type_of_points_to_cells(), compute_points_to_binded_set(), compute_points_to_gen_set(), compute_points_to_kill_set(), consistent_points_to_arc_p(), convex_cell_preceding_p(), create_pointer_to_array_stub_points_to(), create_stub_points_to(), dereferencing_subscript_to_points_to(), dereferencing_to_sinks(), derived_formal_parameter_to_stub_points_to(), equal_must_vreference(), expand_points_to_domain(), expression_to_points_to_cells(), extended_source_to_sinks(), filter_formal_context_according_to_actual_context(), filter_formal_out_context_according_to_formal_in_context(), find_points_to_subscript_for_type(), formal_parameter_points_to_cell_p(), formal_source_to_sinks(), fprint_points_to_cell(), freeable_points_to_cells(), freed_list_to_points_to(), gen_may_constant_paths(), gen_may_set(), gen_must_constant_paths(), gen_must_set(), generic_apply_effects_to_transformer(), generic_atomic_points_to_cell_p(), generic_points_to_cells_translation(), generic_points_to_set_to_stub_cell_list(), generic_remove_unreachable_vertices_in_points_to_graph(), generic_stub_source_to_sinks(), generic_transform_sink_cells_from_matching_list(), generic_unary_operation_to_transformer(), global_source_to_sinks(), heap_cell_p(), io_cell_p(), k_limit_points_to(), lhs_expression_to_transformer(), list_assignment_to_points_to(), malloc_to_points_to_sinks(), max_module(), module_to_value_mappings(), new_array_elements_backward_substitution_in_transformer(), new_array_elements_forward_substitution_in_transformer(), new_filter_formal_context_according_to_actual_context(), nowhere_cell_p(), nowhere_source_to_sinks(), null_cell_p(), null_source_to_sinks(), offset_cell(), offset_points_to_cell(), opkill_may_constant_path(), opkill_may_module(), opkill_may_name(), opkill_may_vreference(), opkill_must_constant_path(), opkill_must_module(), opkill_must_name(), opkill_must_reference(), opkill_must_vreference(), pointer_arithmetic_to_points_to(), pointer_source_to_sinks(), pointer_subscript_to_expression(), points_to_anywhere_typed(), points_to_binding(), points_to_cell_add_fixed_subscripts(), points_to_cell_add_zero_subscript(), points_to_cell_complete_with_zero_subscripts(), points_to_cell_equal_p(), points_to_cell_to_number_of_unbounded_dimensions(), points_to_cell_to_string(), points_to_cell_to_type(), points_to_cell_to_upper_bound_points_to_cells(), points_to_cell_translation(), points_to_cell_types_compatibility(), points_to_cell_update_last_subscript(), points_to_cells_intersect_p(), points_to_function_projection(), points_to_reference_to_translation(), points_to_set_block_projection(), points_to_set_sharing_p(), points_to_source_projection(), points_to_source_to_translations(), points_to_translation_mapping_is_typed_p(), points_to_translation_of_formal_parameters(), points_to_with_stripped_sink(), potential_to_effective_memory_leaks(), print_points_to_cells(), process_casted_sinks(), process_casted_sources(), pv_cells_mergeable_p(), reduce_cell_to_pointer_type(), reference_to_points_to_translations(), refine_points_to_cell_subscripts(), related_points_to_cell_in_list_p(), related_points_to_cells_p(), relevant_translation_pair_p(), simple_cell_preceding_p(), simple_cell_to_convex_cell_conversion(), simple_pv_may_union(), simple_pv_must_union(), sinks_fully_matches_source_p(), source_to_sinks(), struct_assignment_to_points_to(), struct_initialization_to_points_to(), struct_reference_assignment_or_equality_to_transformer(), struct_variable_to_pointer_subscripts(), stub_points_to_cell_p(), stub_source_to_sinks(), subscript_to_points_to_sinks(), subscripted_reference_to_points_to(), substitute_stubs_in_transformer(), substitute_stubs_in_transformer_with_translation_binding(), type_compatible_super_cell(), type_compatible_with_points_to_cell_p(), typedef_formal_parameter_to_stub_points_to(), unique_location_cell_p(), user_call_to_points_to_sinks(), and variable_to_sinks().

◆ cell_entity()

◆ cell_entity_equal_p()

bool cell_entity_equal_p ( cell  c1,
cell  c2 
)

Has to be extended for GAPs

Parameters
c11
c22

Definition at line 1234 of file effects.c.

1235 {
1236  /* Has to be extended for GAPs */
1237  reference r1 = cell_to_reference(c1);
1238  reference r2 = cell_to_reference(c2);
1239  return reference_variable(r1)==reference_variable(r2);
1240 }
reference cell_to_reference(cell c)
FI: probably to be moved elsewhere in ri-util.
Definition: effects.c:1326

References cell_to_reference(), and reference_variable.

Referenced by points_to_binding().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cell_equal_p()

bool cell_equal_p ( cell  c1,
cell  c2 
)

◆ cell_equivalent_p()

bool cell_equivalent_p ( cell  c1,
cell  c2 
)

Check that memory locations denoted by cell "c1" can be reached by knowing cell "c2" and by using pointer arithmetic or subscripting.

In other words, the two cells only differ by their subscripts... Which might be reducible to "based on the same entity".

FI: experimental...

Has to be extended for GAPs

Parameters
c11
c22

Definition at line 1311 of file effects.c.

1312 {
1313  /* Has to be extended for GAPs */
1314  reference r1 = cell_any_reference(c1);
1315  reference r2 = cell_any_reference(c2);
1316  entity v1 = reference_variable(r1);
1317  entity v2 = reference_variable(r2);
1318  return v1==v2;
1319 }

References cell_any_reference(), and reference_variable.

Referenced by points_to_sink_to_sources().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cell_included_p()

bool cell_included_p ( cell  c1,
cell  c2 
)

Check that all memory locations denoted by cell "c1" are included in cell "c2".

Has to be extended for GAPs

Parameters
c11
c22

Definition at line 1294 of file effects.c.

1295 {
1296  /* Has to be extended for GAPs */
1297  reference r1 = cell_any_reference(c1);
1298  reference r2 = cell_any_reference(c2);
1299  return points_to_reference_included_p(r1, r2);
1300 }
bool points_to_reference_included_p(reference r1, reference r2)
FI->FC/AM: some elements of the lattice must be exploited here...
Definition: effects.c:1243

References cell_any_reference(), and points_to_reference_included_p().

Referenced by generic_points_to_source_to_sinks(), points_to_sink_to_sources(), and source_subset_in_set_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cell_indices()

list cell_indices ( cell  c)

Definition at line 64 of file effects.c.

65 {
66  list l_res = NIL;
67  if (cell_gap_p(c))
68  pips_internal_error("GAPs not implemented yet\n");
69  else
71  return l_res;
72 }
#define reference_indices(x)
Definition: ri.h:2328
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References cell_any_reference(), cell_gap_p, NIL, pips_internal_error, and reference_indices.

Referenced by c_convex_effects_on_actual_parameter_forward_translation(), generic_effect_find_aliases_with_simple_pointer_values(), simple_cells_inclusion_p(), and simple_cells_intersection_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cell_to_pointer_cells()

list cell_to_pointer_cells ( cell  c)

If the reference in "c" is not a pointer, see if it can be transformed into a pointer reference by adding subscripts, field subscripts or a combination of both...

The "children" list is built with new cells. No sharing is created between "c" and "children".

Definition at line 1739 of file effects.c.

1740 {
1741  list children = NIL;
1742  pips_assert("Cell \"c\" has no subscripts.",
1744 
1745  children = recursive_cell_to_pointer_cells(c);
1746 
1747  pips_assert("Cell \"c\" has children, "
1748  "or this function would not have been called.", !ENDP(children));
1749  return children;
1750 }
list recursive_cell_to_pointer_cells(cell c)
Definition: effects.c:1680
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66

References cell_any_reference(), ENDP, NIL, pips_assert, recursive_cell_to_pointer_cells(), and reference_indices.

+ Here is the call graph for this function:

◆ cell_to_reference()

reference cell_to_reference ( cell  c)

FI: probably to be moved elsewhere in ri-util.

Here, we only know how to cope (for the time being) with cell_reference and cell_preference, not with cell_gap and other future fields. A bit safer than macro cell_any_reference().

Definition at line 1326 of file effects.c.

1326  {
1328 
1329  if (cell_reference_p(c))
1330  r = cell_reference(c);
1331  else if (cell_preference_p(c))
1333  else
1334  pips_internal_error("GAPs not implemented yet or unexpected cell tag.\n");
1335 
1336  return r;
1337 }
#define cell_preference_p(x)
Definition: effects.h:470

References cell_preference, cell_preference_p, cell_reference, cell_reference_p, pips_internal_error, preference_reference, and reference_undefined.

Referenced by cell_entity_equal_p(), cell_equal_p(), cell_out_of_scope_p(), compute_points_to_kill_set(), first_cell_certainly_includes_second_cell_p(), formal_points_to_parameter(), generic_eval_cell_with_points_to(), generic_reference_to_points_to_matching_list(), generic_transform_sink_cells_from_matching_list(), location_entity(), points_to_cell_name(), points_to_cell_translation(), points_to_compare_cell(), points_to_compare_cells(), points_to_compare_location(), points_to_compare_ptr_cell(), points_to_name(), points_to_rank(), points_to_set_block_projection(), points_to_source_projection(), print_or_dump_points_to(), and word_points_to().

+ Here is the caller graph for this function:

◆ effect_abstract_location_p()

bool effect_abstract_location_p ( effect  eff)
Parameters
effff

Definition at line 280 of file effects.c.

281 {
283 }
bool cell_abstract_location_p(cell c)
Definition: effects.c:273

References cell_abstract_location_p(), and effect_cell.

Referenced by effect_may_union(), effect_must_union(), effects_abstract_location_p(), and region_union().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effect_action_kind()

action_kind effect_action_kind ( effect  eff)
Parameters
effff

Definition at line 1055 of file effects.c.

1056 {
1057  action ac = effect_action(eff);
1058  return action_to_action_kind(ac);
1059 }
action_kind action_to_action_kind(action a)
Without the consistency test, this function would certainly be inlined.
Definition: effects.c:1048
#define effect_action(x)
Definition: effects.h:642

References action_to_action_kind(), and effect_action.

Referenced by entity_written_p(), functionnal_on_effects(), no_write_effects_on_var(), and some_conflicts_between().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effect_comparable_p()

bool effect_comparable_p ( effect  e1,
effect  e2 
)

Can we merge these two effects because they are equal or because they only differ by their approximations and their descriptors?

Check the subscript lists because p and p[0] do not refer the same memory locations at all

Parameters
e11
e22

Definition at line 587 of file effects.c.

588 {
589  bool comparable_p = false;
592  entity v1 = reference_variable(r1);
593  entity v2 = reference_variable(r2);
594 
595  if(v1==v2) {
596  action a1 = effect_action(e1);
597  action a2 = effect_action(e2);
598  if(action_equal_p(a1, a2))
599  {
600 
601  /* Check the subscript lists because p and p[0] do not refer
602  the same memory locations at all */
603  list sl1 = reference_indices(r1);
604  list sl2 = reference_indices(r2);
605  if(gen_length(sl1)==gen_length(sl2))
606  {
607  list csl1 = list_undefined;
608  list csl2 = list_undefined;
609  bool equal_p = true;
610 
611  for(csl1=sl1, csl2=sl2; !ENDP(csl1) && equal_p; POP(csl1), POP(csl2))
612  {
613  expression e1 = EXPRESSION(CAR(csl1));
614  expression e2 = EXPRESSION(CAR(csl2));
615  equal_p = expression_equal_p(e1, e2);
616  }
617  comparable_p = equal_p;
618  }
619 
620  }
621  }
622 
623  return comparable_p;
624 }
bool action_equal_p(action a1, action a2)
Definition: effects.c:1023
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
size_t gen_length(const list l)
Definition: list.c:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
Definition: expression.c:1347
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217

References action_equal_p(), CAR, effect_action, effect_any_reference, ENDP, EXPRESSION, expression_equal_p(), gen_length(), list_undefined, POP, reference_indices, and reference_variable.

Referenced by concerned_entity_p(), and step_get_comparable_effects().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effect_entity()

◆ effect_interference()

effect effect_interference ( effect  eff1,
effect  eff2 
)

Modifies effect eff1 to make sure that any memory state modification abstracted by eff2 preserves the correctness of eff1: all memory locations included in eff1 at input are included in the memory locations abstracted by the new eff1 after the abstract state transition.

FI: seems to extend naturally to new kinds of effects...

default value

nothing to worry about

pointer-dependence write, indexed or not

The base address for the write is constant, the indices should be be checked

The write effect is a direct effet, the other effect may be direct or indirect, indexed or not.

FI: should be very similar to reference_with_store_independent_indices()?

Does the write impact some indices of the read?

May be shared because of persistant references

Parameters
eff1ff1
eff2ff2

Definition at line 863 of file effects.c.

864 {
865  //action ac1 = effect_action(eff1);
866  action ac2 = effect_action(eff2);
867  effect n_eff1 = eff1; /* default value */
868 
869  ifdebug(1) {
870  pips_assert("The new effect is consistent", effect_consistent_p(eff1));
871  pips_assert("The new effect is consistent", effect_consistent_p(eff2));
872  }
873 
874  if(store_independent_effect_p(eff1)) {
875  /* nothing to worry about */
876  ;
877  }
878  else if(action_write_p(ac2)) {
879  if(anywhere_effect_p(eff2)) {
880  // free_effect(eff1);
881  n_eff1 = effect_to_store_independent(eff1);
882  }
883  else {
884  reference r2 = effect_any_reference(eff2);
885  entity v2 = reference_variable(r2);
886  type t2 = ultimate_type(entity_type(v2));
887 
888  if(pointer_type_p(t2)) {
889  /* pointer-dependence write, indexed or not */
891  }
892  else {
893  /* The base address for the write is constant, the indices should be be checked */
894  /* The write effect is a direct effet, the other effect may be
895  direct or indirect, indexed or not. */
896  reference r1 = effect_any_reference(eff1);
897  list ind1 = reference_indices(r1);
898  list cind1 = list_undefined;
899 
900  /* FI: should be very similar to reference_with_store_independent_indices()? */
901 
902  /* Does the write impact some indices of the read? */
903  for(cind1 = ind1; !ENDP(ind1); POP(ind1)) {
904  expression s = EXPRESSION(CAR(cind1));
905  list rl = NIL;
906  list crl = list_undefined;
907  bool interfere_p = false;
908 
909  rl = expression_to_reference_list(s, rl);
910  for(crl=rl; !ENDP(rl); POP(rl)) {
911  reference r = REFERENCE(CAR(crl));
912  entity v = reference_variable(r);
913  if(v2==v) {
914  interfere_p = true;
915  break;
916  }
917  }
918 
919  if(interfere_p) {
920  pips_debug(8, "Interference detected\n");
921  /* May be shared because of persistant references */
922  //free_expression(s);
924  }
925  }
926  }
927  }
928  }
929  ifdebug(1)
930  pips_assert("The new effect is consistent", effect_consistent_p(n_eff1));
931  return n_eff1;
932 }
bool anywhere_effect_p(effect e)
Is it an anywhere effect? ANYMMODULE:ANYWHERE
Definition: effects.c:346
effect effect_to_pointer_store_independent_effect(effect eff, entity p)
Modify eff so that the set of memory locations decribed after a write to some pointer p is still in t...
Definition: effects.c:815
bool store_independent_effect_p(effect eff)
Does this effect define the same set of memory locations regardless of the current (environment and) ...
Definition: effects.c:636
effect effect_to_store_independent(effect eff)
Definition: effects.c:772
bool effect_consistent_p(effect p)
Definition: effects.c:457
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
expression make_unbounded_expression()
Definition: expression.c:4339
list expression_to_reference_list(expression e, list lr)
conversion of an expression into a list of references; references are appended to list lr as they are...
Definition: expression.c:1263
type ultimate_type(type)
Definition: type.c:3466
bool pointer_type_p(type)
Check for scalar pointers.
Definition: type.c:2993
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
#define EXPRESSION_(x)
Definition: ri.h:1220
#define entity_type(x)
Definition: ri.h:2792
return(s1)
#define ifdebug(n)
Definition: sg.c:47

References action_write_p, anywhere_effect_p(), CAR, effect_action, effect_any_reference, effect_consistent_p(), effect_to_pointer_store_independent_effect(), effect_to_store_independent(), ENDP, entity_type, EXPRESSION, EXPRESSION_, expression_to_reference_list(), ifdebug, list_undefined, make_unbounded_expression(), NIL, pips_assert, pips_debug, pointer_type_p(), POP, REFERENCE, reference_indices, reference_variable, store_independent_effect_p(), and ultimate_type().

+ Here is the call graph for this function:

◆ effect_list_can_be_safely_full_freed_p()

bool effect_list_can_be_safely_full_freed_p ( list  el)

Check if some references might be freed with the effects.

This may lead to disaster if the references are part of another PIPS data structure. This information is not fully accurate, but conservative.

The free is very likely to be unsafe

Is it a possible C reference or is it a synthetic reference generated by the effect analysis? Hard to decide...

Parameters
ell

Definition at line 1159 of file effects.c.

1160 {
1161  bool safe_p = true;
1162  FOREACH(EFFECT, e, el) {
1163  cell c = effect_cell(e);
1164  if(cell_reference_p(c)) {
1165  reference r = cell_reference(c);
1166  list inds = reference_indices(r);
1167 
1168  if(ENDP(inds)) {
1169  /* The free is very likely to be unsafe */
1170  //entity v = reference_variable(r);
1171  safe_p = false;
1172  //fprintf(stderr, "cell_reference for %s", entity_name(v));
1173  }
1174  else {
1175  /* Is it a possible C reference or is it a synthetic reference
1176  generated by the effect analysis? Hard to decide... */
1177  //entity v = reference_variable(r);
1178  //fprintf(stderr, "cell_reference for %s", entity_name(v));
1179  //print_reference(r);
1180  }
1181  break;
1182  }
1183  }
1184  return safe_p;
1185 }
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179

References cell_reference, cell_reference_p, EFFECT, effect_cell, ENDP, FOREACH, and reference_indices.

Referenced by safe_any_expression_to_transformer().

+ Here is the caller graph for this function:

◆ effect_list_consistent_p()

bool effect_list_consistent_p ( list  el)

Debugging.

Parameters
ell

Definition at line 1340 of file effects.c.

1341 {
1342  bool ok_p = true;
1343 
1344  FOREACH(EFFECT, e, el)
1345  ok_p = ok_p && effect_consistent_p(e);
1346 
1347  return ok_p;
1348 }

References EFFECT, effect_consistent_p(), and FOREACH.

+ Here is the call graph for this function:

◆ effect_on_non_local_variable_p()

bool effect_on_non_local_variable_p ( effect  eff)

Test if an effect has a non local effect.

Parameters
[in]effis the effect to analyse
Returns
true if the effect is on a non local effect
Parameters
effff

Definition at line 674 of file effects.c.

674  {
675  return !same_string_p(
678  );
679 }
const char * get_current_module_name(void)
Get the name of the current module.
Definition: static.c:121
#define same_string_p(s1, s2)
const char * entity_module_name(entity e)
See comments about module_name().
Definition: entity.c:1092

References effect_any_reference, entity_module_name(), get_current_module_name(), reference_variable, and same_string_p.

Referenced by effects_on_non_local_variable_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effect_scalar_p()

bool effect_scalar_p ( effect  eff)
Parameters
effff

Definition at line 567 of file effects.c.

568 {
569  bool scalar_p = false;
571  list sl = reference_indices(r);
572  if(ENDP(sl)) {
573  entity v = reference_variable(r);
574  type t = entity_type(v); // basic_concrete_type?
575  int d = type_depth(t);
576  if(d==0)
577  scalar_p = true;
578  else {
579  scalar_p = pointer_type_p(t);
580  }
581  }
582  return scalar_p;
583 }
size_t type_depth(type)
Number of steps to access the lowest leave of type t without dereferencing.
Definition: type.c:4880

References effect_any_reference, ENDP, entity_type, pointer_type_p(), reference_indices, reference_variable, and type_depth().

Referenced by atomic_effect_p(), effect_may_union(), effect_must_union(), first_effect_certainly_includes_second_effect_p(), first_exact_scalar_effect_certainly_includes_second_effect_p(), kill_effects(), and proper_to_summary_simple_effect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effect_to_entity()

entity effect_to_entity ( effect  ef)

Returns the entity corresponding to the mutation.

It could be called effect_to_variable(), but effects are sometimes summarized with abstract locations, i.e. sets of locations.

FI unlikely to work with GAPs

Parameters
eff

Definition at line 1413 of file effects.c.

1414 {
1415  /* FI unlikely to work with GAPs */
1417  entity e = reference_variable(r);
1418 
1419  return e;
1420 }

References effect_any_reference, and reference_variable.

Referenced by add_conflicts().

+ Here is the caller graph for this function:

◆ effect_to_non_pointer_store_independent_effect()

effect effect_to_non_pointer_store_independent_effect ( effect  eff)

Modify eff so that the set of memory locations decribed after a write to some non pointer variable is still in the abstract location set of eff.

\n_eff i = ...; \ eff of stmt s: p[j], q[i],.. s;

Parameters
effff

Definition at line 844 of file effects.c.

845 {
847  //entity v = reference_variable(r);
848  //type t = ultimate_type(entity_type(v));
849 
851 
852  return eff;
853 }
reference reference_with_store_independent_indices(reference r)
Return by side effect a reference whose memory locations includes the memory locations of r in case t...
Definition: expression.c:3045

References effect_any_reference, and reference_with_store_independent_indices().

+ Here is the call graph for this function:

◆ effect_to_pointer_store_independent_effect()

effect effect_to_pointer_store_independent_effect ( effect  eff,
entity  p 
)

Modify eff so that the set of memory locations decribed after a write to some pointer p is still in the abstract location set of eff.

\n_eff p = ...; \ eff of stmt s s;

If p is undefined, assumed that any pointer may have been updated.

As a pointer could be used in indexing, the current implementation is not correct/sufficient

p[i][j] cannot be preserved

No problem: direct scalar reference

Parameters
effff

Definition at line 815 of file effects.c.

816 {
818  entity v = reference_variable(r);
819  //type t = ultimate_type(entity_type(v));
820 
821  if(entity_undefined_p(p) || v==p) {
822  if(!ENDP(reference_indices(r))) {
823  /* p[i][j] cannot be preserved */
825  free_effect(eff);
826  eff = n_eff;
827  }
828  else {
829  /* No problem: direct scalar reference */
830  ;
831  }
832  }
833  return eff;
834 }
effect anywhere_effect(action ac)
Anywhere effect: an effect which can be related to any location of any areas.
Definition: effects.c:317
action copy_action(action p)
ACTION.
Definition: effects.c:77
void free_effect(effect p)
Definition: effects.c:451
#define entity_undefined_p(x)
Definition: ri.h:2762

References anywhere_effect(), copy_action(), effect_action, effect_any_reference, ENDP, entity_undefined_p, free_effect(), reference_indices, and reference_variable.

Referenced by effect_interference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effect_to_store_independent()

effect effect_to_store_independent ( effect  eff)
Parameters
effff

Definition at line 772 of file effects.c.

773 {
775  entity v = reference_variable(r);
777 
778  if(pointer_type_p(t)) {
780  free_effect(eff);
781  eff = n_eff;
782  }
783  else{
784  list ind = reference_indices(r);
785  list cind = list_undefined;
786 
787  for(cind = ind; !ENDP(cind); POP(cind)) {
788  expression e = EXPRESSION(CAR(cind));
789 
790  if(!unbounded_expression_p(e)) {
792  free_expression(e);
794  }
795  }
796  }
797  }
798 
799  return eff;
800 }
void free_expression(expression p)
Definition: ri.c:853
bool extended_integer_constant_expression_p(expression e)
More extensive than next function.
Definition: expression.c:858
bool unbounded_expression_p(expression e)
Definition: expression.c:4329

References anywhere_effect(), CAR, copy_action(), effect_action, effect_any_reference, ENDP, entity_type, EXPRESSION, EXPRESSION_, extended_integer_constant_expression_p(), free_effect(), free_expression(), list_undefined, make_unbounded_expression(), pointer_type_p(), POP, reference_indices, reference_variable, ultimate_type(), and unbounded_expression_p().

Referenced by effect_interference().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effects_abstract_location_p()

bool effects_abstract_location_p ( list  el)

Returns true if at least one effect of effect list el is related to an abstract location.

Parameters
ell

Definition at line 288 of file effects.c.

289 {
290  bool abstract_p = false;
291 
292  FOREACH(EFFECT, e, el) {
294  abstract_p = true;
295  break;
296  }
297  }
298  return abstract_p;
299 }
bool effect_abstract_location_p(effect eff)
Definition: effects.c:280

References EFFECT, effect_abstract_location_p(), and FOREACH.

Referenced by statement_to_transformer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effects_all_read_p()

bool effects_all_read_p ( list  el)

Check that all effects in el are read effects.

Parameters
ell

Definition at line 1141 of file effects.c.

1142 {
1143  bool result = true;
1144  FOREACH(EFFECT, e, el) {
1145  action a = effect_action(e);
1146  //entity ev = effect_entity(e);
1147  if (action_write_p(a)) {
1148  result = false;
1149  break;
1150  }
1151  }
1152  return result;
1153 }

References action_write_p, EFFECT, effect_action, and FOREACH.

Referenced by regenerate_call().

+ Here is the caller graph for this function:

◆ effects_interfere_p()

bool effects_interfere_p ( effect  eff1,
effect  eff2 
)

Two effects interfere if one of them modify the set of locations defined by the other one.

For instance, an index or a pointer may be used by one effect and changed by the other one.

If a subscript expression is changed, the corresponding subscript must be replaced by an unbounded expression.

If a pointer is written, any indirect effect thru this pointer must be changed into a read or write anywhere.

This function is conservative: it is always correct to declare an interference.

FI: I'm not sure what you can do when you know two effects interfere...

dealing with standard effects

start with complex cases

The write effect is a direct effet, the other effect may be direct or indirect, indexed or not.

Does the write impact the indices of the read?

Parameters
eff1ff1
eff2ff2

Definition at line 714 of file effects.c.

715 {
716  action ac1 = effect_action(eff1);
717  action ac2 = effect_action(eff2);
718  bool interfere_p = false;
719 
720  if(action_write_p(ac1)||action_write_p(ac2)) {
721  if(anywhere_effect_p(eff1) && action_write_p(ac1)) {
722  interfere_p = !store_independent_effect_p(eff2);
723  }
724  else if(anywhere_effect_p(eff2) && action_write_p(ac2)) {
725  interfere_p = !store_independent_effect_p(eff1);
726  }
727  else { /* dealing with standard effects */
728 
729  /* start with complex cases */
730  /* The write effect is a direct effet, the other effect may be
731  direct or indirect, indexed or not. */
735 
736  list rind = list_undefined;
737 
738  if(action_write_p(ac1)) {
739  wr = effect_any_reference(eff1);
740  rr = effect_any_reference(eff2);
741  }
742  else {
743  wr = effect_any_reference(eff2);
744  rr = effect_any_reference(eff1);
745  }
746 
747  wv = reference_variable(wr);
748  rind = reference_indices(rr);
749 
750  /* Does the write impact the indices of the read? */
751  MAP(EXPRESSION, s, {
752  list rl = NIL;
753 
754  rl = expression_to_reference_list(s, rl);
755  MAP(REFERENCE, r, {
756  entity v = reference_variable(r);
757  if(wv==v) {
758  interfere_p = true;
759  break;
760  }
761  }, rl);
762  if(interfere_p)
763  break;
764  }, rind);
765 
766  //interfere_p = true;
767  }
768  }
769  return interfere_p;
770 }
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226

References action_write_p, anywhere_effect_p(), effect_action, effect_any_reference, entity_undefined, EXPRESSION, expression_to_reference_list(), list_undefined, MAP, NIL, REFERENCE, reference_indices, reference_undefined, reference_variable, and store_independent_effect_p().

+ Here is the call graph for this function:

◆ effects_on_non_local_variable_p()

bool effects_on_non_local_variable_p ( list  effects)

Test if a list of effects concerns non local variables.

Parameters
[in]effectsis the effect list to scan
Returns
true if there is an effect on a global variable

Definition at line 687 of file effects.c.

687  {
688  FOREACH(EFFECT,eff,effects)
690  //char * seffect = effect_to_string(eff);
691  //pips_user_warning("effect on non local variable: %s\n",seffect);
692  //free(seffect);
693  return true;
694  }
695  return false;
696 }
bool effect_on_non_local_variable_p(effect eff)
Test if an effect has a non local effect.
Definition: effects.c:674

References EFFECT, effect_on_non_local_variable_p(), and FOREACH.

+ Here is the call graph for this function:

◆ effects_read_variable_p()

bool effects_read_variable_p ( list  el,
entity  v 
)
Parameters
ell

Definition at line 1123 of file effects.c.

1124 {
1125  bool result = false;
1126  if(v) {
1127  FOREACH(EFFECT, e, el) {
1128  action a = effect_action(e);
1129  entity ev = effect_entity(e);
1130  if (action_read_p(a) && store_effect_p(e)
1131  && entities_may_conflict_p(ev,v) ) {
1132  result = true;
1133  break;
1134  }
1135  }
1136  }
1137  return result;
1138 }
entity effect_entity(effect e)
Created by B.
Definition: effects.c:52
bool store_effect_p(effect e)
Definition: effects.c:1062
bool entities_may_conflict_p(entity e1, entity e2)
Check if two entities may conflict.
Definition: conflicts.c:984

References action_read_p, EFFECT, effect_action, effect_entity(), entities_may_conflict_p(), FOREACH, and store_effect_p().

Referenced by entity_used_somewhere_walker(), graph_to_live_writes(), loop_annotate(), and vertex_to_chains().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effects_to_list()

◆ effects_write_p()

bool effects_write_p ( list  el)
Parameters
ell

Definition at line 1108 of file effects.c.

1109 {
1110  bool result = false;
1111 
1112  FOREACH(EFFECT, e, el) {
1113  action a = effect_action(e);
1114  if (action_write_p(a) && store_effect_p(e)) {
1115  result = true;
1116  break;
1117  }
1118  }
1119 
1120  return result;
1121 }

References action_write_p, EFFECT, effect_action, FOREACH, and store_effect_p().

+ Here is the call graph for this function:

◆ effects_write_variable_p()

bool effects_write_variable_p ( list  el,
entity  v 
)
Parameters
ell

Definition at line 1091 of file effects.c.

1092 {
1093  bool result = false;
1094  if(v) {
1095  FOREACH(EFFECT, e, el) {
1096  action a = effect_action(e);
1097  entity ev = effect_entity(e);
1098  if (action_write_p(a) && store_effect_p(e)
1099  && entities_may_conflict_p(ev,v) ) {
1100  result = true;
1101  break;
1102  }
1103  }
1104  }
1105  return result;
1106 }

References action_write_p, EFFECT, effect_action, effect_entity(), entities_may_conflict_p(), FOREACH, and store_effect_p().

Referenced by block_to_complexity(), graph_to_live_writes(), prune_non_constant(), and vertex_to_chains().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ effectsmap_to_listmap()

statement_mapping effectsmap_to_listmap ( statement_mapping  efs_map)
Parameters
efs_mapfs_map

Definition at line 228 of file effects.c.

230 {
232 
233  STATEMENT_MAPPING_MAP(s,val,{
234  hash_put((hash_table) l_map, (char *) s, (char *) effects_to_list((effects) val));
235  }, efs_map);
236 
237  return l_map;
238 }
list effects_to_list(effects efs)
Definition: effects.c:209
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
#define STATEMENT_MAPPING_MAP(s, v, code, h)
Definition: newgen-local.h:53

References effects_to_list(), hash_put(), MAKE_STATEMENT_MAPPING, and STATEMENT_MAPPING_MAP.

+ Here is the call graph for this function:

◆ environment_effect_p()

bool environment_effect_p ( effect  e)

Definition at line 1071 of file effects.c.

1072 {
1073  action a = effect_action(e);
1075  bool env_p = action_kind_environment_p(ak);
1076 
1077  return env_p;
1078 }

References action_kind_environment_p, action_read, action_read_p, action_write, and effect_action.

Referenced by find_effect_actions_for_entity().

+ Here is the caller graph for this function:

◆ FILE_star_effect_reference_p()

bool FILE_star_effect_reference_p ( reference  ref)
Parameters
refef

Definition at line 536 of file effects.c.

537 {
538  bool res = false;
540  pips_debug(8, "begin with type %s\n", string_of_type(t));
541  if (type_variable_p(t))
542  {
544  if (basic_pointer_p(b))
545  {
546  t = basic_pointer(b);
547  if (type_variable_p(t))
548  {
550  if (basic_derived_p(b))
551  {
552  entity te = basic_derived(b);
553  if (same_string_p(entity_user_name(te), "_IO_FILE"))
554  {
555  res = true;
556  }
557  }
558  }
559  }
560  }
561  pips_debug(8, "end with : %s\n", res? "true":"false");
562  return res;
563 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
string string_of_type(const type)
Definition: type.c:56
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487
type entity_basic_concrete_type(entity)
retrieves or computes and then returns the basic concrete type of an entity
Definition: type.c:3677
#define basic_pointer(x)
Definition: ri.h:637
#define basic_derived(x)
Definition: ri.h:640
#define type_variable(x)
Definition: ri.h:2949
#define basic_pointer_p(x)
Definition: ri.h:635
#define basic_derived_p(x)
Definition: ri.h:638
#define type_variable_p(x)
Definition: ri.h:2947
#define variable_basic(x)
Definition: ri.h:3120

References basic_derived, basic_derived_p, basic_pointer, basic_pointer_p, entity_basic_concrete_type(), entity_user_name(), pips_debug, ref, reference_variable, same_string_p, string_of_type(), type_variable, type_variable_p, and variable_basic.

Referenced by create_step_regions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ full_action_to_short_string()

string full_action_to_short_string ( action  ac)
Parameters
acc

Definition at line 969 of file effects.c.

970 {
971  string s = string_undefined;
972  if(action_read_p(ac)) {
973  action_kind ak = action_read(ac);
974 
975  if(action_kind_store_p(ak))
976  s = "R";
977  else if(action_kind_environment_p(ak))
978  s = "RE";
979  else if(action_kind_type_declaration_p(ak))
980  s = "RT";
981  }
982  else {
983  action_kind ak = action_write(ac);
984 
985  if(action_kind_store_p(ak))
986  s = "W";
987  else if(action_kind_environment_p(ak))
988  s = "WE";
989  else if(action_kind_type_declaration_p(ak))
990  s = "WT";
991  }
992  return s;
993 }

References action_kind_environment_p, action_kind_store_p, action_kind_type_declaration_p, action_read, action_read_p, action_write, and string_undefined.

Referenced by conflicts_sort_callback(), prettyprint_dependence_graph(), and prettyprint_dot_dependence_graph().

+ Here is the caller graph for this function:

◆ full_action_to_string()

string full_action_to_string ( action  ac)
Parameters
acc

Definition at line 943 of file effects.c.

944 {
945  string s = string_undefined;
946  if(action_read_p(ac)) {
947  action_kind ak = action_read(ac);
948 
949  if(action_kind_store_p(ak))
950  s = "read memory";
951  else if(action_kind_environment_p(ak))
952  s = "read environment";
953  else if(action_kind_type_declaration_p(ak))
954  s = "read type";
955  }
956  else {
957  action_kind ak = action_write(ac);
958 
959  if(action_kind_store_p(ak))
960  s = "write memory";
961  else if(action_kind_environment_p(ak))
962  s = "write environment";
963  else if(action_kind_type_declaration_p(ak))
964  s = "write type";
965  }
966  return s;
967 }

References action_kind_environment_p, action_kind_store_p, action_kind_type_declaration_p, action_read, action_read_p, action_write, and string_undefined.

◆ generic_anywhere_effect_p()

static bool generic_anywhere_effect_p ( effect  e,
int  kind 
)
static

Is it an anywhere effect (kind=0)? a typed anywhere effect (kind=1) ? or any kind of anywhere effect (kind=2)?

Definition at line 333 of file effects.c.

334 {
335  bool anywhere_p;
337  entity v = reference_variable(r);
338 
339  anywhere_p = (entity_all_locations_p(v) && (kind==0||kind==2))
340  || (entity_typed_anywhere_locations_p(v) && (kind==1||kind==2));
341 
342  return anywhere_p;
343 }
bool entity_typed_anywhere_locations_p(entity e)
Test if an entity is the bottom of the lattice.

References effect_any_reference, entity_all_locations_p(), entity_typed_anywhere_locations_p(), and reference_variable.

Referenced by any_anywhere_effect_p(), anywhere_effect_p(), and typed_anywhere_effect_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ heap_cell_p()

bool heap_cell_p ( cell  c)

Any heap cell, more or less abstract or typed.

Definition at line 420 of file effects.c.

421 {
422  bool heap_p;
424  entity v = reference_variable(r);
425 
426  heap_p = (strstr(entity_local_name(v), HEAP_AREA_LOCAL_NAME)
427  ==entity_local_name(v));
428 
429  return heap_p;
430 }
#define HEAP_AREA_LOCAL_NAME
Definition: naming-local.h:71
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453

References cell_any_reference(), entity_local_name(), HEAP_AREA_LOCAL_NAME, and reference_variable.

Referenced by binary_intrinsic_call_to_points_to_sinks(), compute_points_to_binded_set(), compute_points_to_gen_set(), compute_points_to_kill_set(), freeable_points_to_cells(), freed_list_to_points_to(), freed_pointer_to_points_to(), list_assignment_to_points_to(), memory_leak_to_more_memory_leaks(), points_to_cell_translation(), points_to_cell_types_compatibility(), points_to_function_projection(), points_to_set_block_projection(), points_to_source_projection(), points_to_with_stripped_sink(), remove_points_to_cell(), and unique_location_cell_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ heap_effect()

effect heap_effect ( entity  m,
action  ac 
)
Parameters
acc

Definition at line 391 of file effects.c.

392 {
394  effect any = effect_undefined;
395 
396  if(entity_undefined_p(heap)) {
397  pips_internal_error("Heap for module \"%s\" not found", entity_name(m));
398  }
399 
401  ac,
404 
405  return any;
406 }
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
Definition: entity.c:1503
#define entity_name(x)
Definition: ri.h:2790

References effect_undefined, entity_local_name(), entity_name, entity_undefined_p, FindEntity(), HEAP_AREA_LOCAL_NAME, make_approximation_may(), make_cell_reference(), make_descriptor_none(), make_effect(), make_reference(), NIL, and pips_internal_error.

+ Here is the call graph for this function:

◆ heap_effect_p()

bool heap_effect_p ( effect  e)

Definition at line 408 of file effects.c.

409 {
410  bool heap_p;
412  entity v = reference_variable(r);
413 
415 
416  return heap_p;
417 }

References effect_any_reference, entity_local_name(), HEAP_AREA_LOCAL_NAME, reference_variable, and same_string_p.

+ Here is the call graph for this function:

◆ io_cell_p()

bool io_cell_p ( cell  c)

Definition at line 506 of file effects.c.

507 {
509 }
bool io_effect_entity_p(entity e)
Definition: effects.c:496

References cell_any_reference(), io_effect_entity_p(), and reference_variable.

+ Here is the call graph for this function:

◆ io_effect_entity_p()

bool io_effect_entity_p ( entity  e)

Definition at line 496 of file effects.c.

497 {
498  return io_luns_entity_p(e);
499 }
bool io_luns_entity_p(entity e)
Definition: entity.c:1146

References io_luns_entity_p().

Referenced by io_cell_p(), io_effect_p(), io_efficient_compile(), pure_function_p(), and safe_effects_for_reductions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ io_effect_p()

bool io_effect_p ( effect  e)

Definition at line 501 of file effects.c.

References effect_any_reference, io_effect_entity_p(), and reference_variable.

Referenced by create_step_regions(), do_check_isolate_statement_preconditions_on_call(), effects_to_dma(), guard_expanded_statement_if_needed(), io_effects_p(), and potential_out_effects_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ io_effects_p()

bool io_effects_p ( list  effects)

Definition at line 512 of file effects.c.

513 {
514  FOREACH(EFFECT,eff,effects)
515  if(io_effect_p(eff)) return true;
516  return false;
517 }
bool io_effect_p(effect e)
Definition: effects.c:501

References EFFECT, FOREACH, and io_effect_p().

+ Here is the call graph for this function:

◆ list_to_effects()

effects list_to_effects ( list  l_eff)

Future API for GAP, Generic Access Path.


list-effects conversion functions


Parameters
l_eff_eff

Definition at line 202 of file effects.c.

204 {
205  effects res = make_effects(l_eff);
206  return res;
207 }
effects make_effects(list a)
Definition: effects.c:568

References make_effects().

Referenced by listmap_to_effectsmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listmap_to_effectsmap()

statement_mapping listmap_to_effectsmap ( statement_mapping  l_map)
Parameters
l_map_map

Definition at line 216 of file effects.c.

218 {
220 
221  STATEMENT_MAPPING_MAP(s,val,{
222  hash_put((hash_table) efs_map, (char *) s, (char *) list_to_effects((list) val));
223  }, l_map);
224 
225  return efs_map;
226 }
effects list_to_effects(list l_eff)
Future API for GAP, Generic Access Path.
Definition: effects.c:202

References hash_put(), list_to_effects(), MAKE_STATEMENT_MAPPING, and STATEMENT_MAPPING_MAP.

+ Here is the call graph for this function:

◆ make_action_read_memory()

action make_action_read_memory ( void  )

Definition at line 1017 of file effects.c.

1018 {
1020  return a;
1021 }
action make_action_read(action_kind _field_)
Definition: effects.c:123
action_kind make_action_kind_store(void)
Definition: effects.c:65

References make_action_kind_store(), and make_action_read().

Referenced by c_convex_effects_on_formal_parameter_backward_translation(), call_to_post_pv(), cells_to_read_or_write_effects(), check_for_effected_statement(), create_step_regions(), expression_to_post_pv(), live_out_paths_from_loop_to_body(), and real_regions_forward_translation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_action_write_memory()

◆ malloc_cell_p()

bool malloc_cell_p ( cell  c)

Definition at line 483 of file effects.c.

484 {
486 }
bool malloc_effect_entity_p(entity e)
Definition: entity.c:1158

References cell_entity(), and malloc_effect_entity_p().

+ Here is the call graph for this function:

◆ malloc_effect_p()

bool malloc_effect_p ( effect  e)

Definition at line 478 of file effects.c.

479 {
481 }

References effect_entity(), and malloc_effect_entity_p().

Referenced by set_add_scalars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ malloc_reference_p()

bool malloc_reference_p ( reference  r)

Definition at line 488 of file effects.c.

489 {
491 }

References malloc_effect_entity_p(), and reference_variable.

+ Here is the call graph for this function:

◆ memory_dereferencing_p()

bool memory_dereferencing_p ( reference  r)

Does the set of locations referenced by r depend on a pointer dereferencing?

Let's hope that all Fortran 77 references will return false...

See effect_reference_dereferencing_p()

Get rid of simple Fortran-like array accesses

This is a simple array access

cycle with alias-classes library: import explictly

entity_heap_variable_p(v)

Heap modelization is behind

Let's walk the subscript list and see if the type associated to the nth subscript is a pointer type and if the (n+1)th subscript is a zero.

Since it is subscripted, there is dereferencing

No dereferencing

Definition at line 92 of file effects.c.

93 {
94  bool dereferencing_p = false;
96  type vt = entity_type(v);
98  list sl = reference_indices(r); // subscript list
99 
100  // FI: constant string such as "hello world" are used ni reference
101  // although they are 0-ary functions
102  if(! type_functional_p(vt)) {
103 
104  /* Get rid of simple Fortran-like array accesses */
106  /* This is a simple array access */
107  dereferencing_p = false;
108  }
109  else if(!ENDP(sl)) {
110  /* cycle with alias-classes library: import explictly */
113  pips_internal_error("Do we want to subscript abstract locations?");
114  }
115  else if(false /* entity_heap_variable_p(v)*/) {
116  /* Heap modelization is behind*/
117  }
118  else if(entity_variable_p(v)) {
119  /* Let's walk the subscript list and see if the type associated
120  * to the nth subscript is a pointer type and if the (n+1)th
121  * subscript is a zero.
122  */
123  list csl = sl; // current subscript list
124  type ct = uvt; // current type
125  if(pointer_type_p(uvt)) {
126  /* Since it is subscripted, there is dereferencing */
127  dereferencing_p = true;
128  csl = NIL;
129  }
130  else if(array_type_p(uvt)) {
131  variable v = type_variable(uvt);
132  int d = (int) gen_length(variable_dimensions(v));
133  int sn = (int) gen_length(sl);
134  if(sn<=d) {
135  dereferencing_p = false;
136  csl = NIL;
137  }
138  else {
139  ct = array_type_to_element_type(uvt);
140  int i;
141  for(i=1;i<=d;i++)
142  POP(csl);
143  }
144  }
145  else if(struct_type_p(uvt)) {
146  int sn = (int) gen_length(sl);
147  if(sn<=1) {
148  dereferencing_p = false;
149  csl = NIL;
150  }
151  else {
152  expression s = EXPRESSION(CAR(sl));
154  POP(csl);
155  }
156  }
157  else {
158  ; // FI: do nothing but acceleration possible with struct_type_p()
159  }
160  while(!dereferencing_p && !ENDP(csl)) {
161  expression se = EXPRESSION(CAR(csl));
163  if(pointer_type_p(ct) && !ENDP(CDR(csl))) {
164  dereferencing_p = true;
165  }
166  else if(array_type_p(ct)) {
167  int n = (int) array_type_dimension(ct);
168  for(int i = 0; i<n && !ENDP(csl); i++) {
169  POP(csl);
170  if(i>0) {
171  // Update ct
172  expression se = EXPRESSION(CAR(csl));
174  }
175  }
176  }
177  else {
178  POP(csl);
179  }
180  }
181  }
182  else {
183  pips_internal_error("Unexpected entity kind \"%s\"", entity_name(v));
184  }
185  }
186  else {
187  /* No dereferencing */
188  ;
189  }
190  }
191 
192  return dereferencing_p;
193 }
void const char const char const int
type points_to_expression_to_concrete_type(expression)
The type returned is stored in a hash-table.
Definition: type.c:617
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
bool array_type_p(type)
Definition: type.c:2942
type subscripted_type_to_type(type, expression)
Returns the type of an object of type t subscripted by expression se.
Definition: type.c:5562
unsigned int array_type_dimension(type)
Definition: type.c:2947
bool struct_type_p(type)
Returns true if t is of type derived and if the derived type is a struct.
Definition: type.c:3121
type array_type_to_element_type(type)
returns the type of the elements of an array type, as a newly allocated type.
Definition: type.c:5700
#define type_functional_p(x)
Definition: ri.h:2950
#define variable_dimensions(x)
Definition: ri.h:3122

References array_type_dimension(), array_type_p(), array_type_to_element_type(), CAR, CDR, ENDP, entity_abstract_location_p(), entity_basic_concrete_type(), entity_name, entity_type, entity_variable_p, EXPRESSION, gen_length(), int, NIL, pips_internal_error, pointer_type_p(), points_to_expression_to_concrete_type(), POP, reference_indices, reference_variable, struct_type_p(), subscripted_type_to_type(), type_functional_p, type_variable, ultimate_type(), and variable_dimensions.

Referenced by consistent_points_to_arc_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nowhere_cell_p()

bool nowhere_cell_p ( cell  c)

Target of an undefined pointer.

Definition at line 455 of file effects.c.

456 {
457  bool nowhere_p;
459  entity v = reference_variable(r);
460 
461  nowhere_p = entity_typed_nowhere_locations_p(v);
462 
463  return nowhere_p;
464 }
bool entity_typed_nowhere_locations_p(entity e)
test if an entity is the bottom of the lattice

References cell_any_reference(), entity_typed_nowhere_locations_p(), and reference_variable.

Referenced by atomic_points_to_cell_p(), binary_intrinsic_call_to_points_to_sinks(), cell_must_point_to_nowhere_sink_in_set_p(), cell_points_to_non_null_sink_in_set_p(), cell_points_to_nowhere_sink_in_set_p(), cells_may_not_point_to_null_p(), cells_to_read_or_write_effects(), check_type_of_points_to_cells(), compute_points_to_gen_set(), dereferencing_to_sinks(), equal_condition_to_points_to(), extended_source_to_sinks(), filter_formal_context_according_to_actual_context(), filter_formal_out_context_according_to_formal_in_context(), freed_list_to_points_to(), fuse_points_to_sink_cells(), generic_points_to_source_to_sinks(), generic_reference_to_points_to_matching_list(), internal_pointer_assignment_to_points_to(), intrinsic_call_to_points_to(), list_assignment_to_points_to(), merge_actual_and_formal_sinks(), new_filter_formal_context_according_to_actual_context(), new_recursive_filter_formal_context_according_to_actual_context_for_pointer_pair(), non_equal_condition_to_points_to(), offset_cell(), offset_points_to_cell(), pointer_arithmetic_to_points_to(), points_to_binding_arguments(), points_to_cell_types_compatibility(), points_to_function_projection(), points_to_reference_to_translation(), points_to_source_cell_compatible_p(), points_to_source_to_translations(), points_to_with_stripped_sink(), print_or_dump_points_to(), process_casted_sinks(), process_casted_sources(), recursive_filter_formal_context_according_to_actual_context(), reference_dereferencing_to_points_to(), reference_to_points_to_translations(), remove_impossible_arcs_to_null(), source_to_sinks(), subscript_to_points_to_sinks(), and words_points_to().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ null_cell_p()

bool null_cell_p ( cell  c)

Definition at line 466 of file effects.c.

467 {
468  bool null_p;
470  entity v = reference_variable(r);
471 
472  null_p = entity_null_locations_p(v);
473 
474  return null_p;
475 }
bool entity_null_locations_p(entity e)
test if an entity is the NULL POINTER

References cell_any_reference(), entity_null_locations_p(), and reference_variable.

Referenced by atomic_points_to_cell_p(), binary_intrinsic_call_to_points_to_sinks(), cell_must_point_to_nowhere_sink_in_set_p(), cell_points_to_non_null_sink_in_set_p(), cell_points_to_nowhere_sink_in_set_p(), cell_points_to_null_sink_in_set_p(), cells_may_not_point_to_null_p(), cells_must_point_to_null_p(), cells_to_read_or_write_effects(), check_type_of_points_to_cells(), compute_points_to_gen_set(), dereferencing_subscript_to_points_to(), dereferencing_to_sinks(), expression_to_points_to_cells(), expression_to_points_to_sources(), extended_source_to_sinks(), filter_formal_context_according_to_actual_context(), freed_list_to_points_to(), freed_pointer_to_points_to(), fuse_points_to_sink_cells(), generic_atomic_points_to_cell_p(), generic_points_to_source_to_sinks(), generic_reference_to_points_to_matching_list(), list_assignment_to_points_to(), merge_actual_and_formal_sinks(), new_filter_formal_context_according_to_actual_context(), new_recursive_filter_formal_context_according_to_actual_context(), null_equal_condition_to_points_to(), null_non_equal_condition_to_points_to(), offset_cell(), offset_cells(), offset_points_to_cell(), pointer_arithmetic_to_points_to(), points_to_binding_arguments(), points_to_cell_types_compatibility(), points_to_reference_to_translation(), points_to_source_cell_compatible_p(), points_to_source_to_translations(), points_to_with_stripped_sink(), print_or_dump_points_to(), process_casted_sinks(), process_casted_sources(), recursive_filter_formal_context_according_to_actual_context(), reduce_cells_to_pointer_type(), reference_dereferencing_to_points_to(), reference_may_points_to_null_p(), reference_must_points_to_null_p(), reference_to_points_to_translations(), remove_impossible_arcs_to_null(), source_to_sinks(), and subscript_to_points_to_sinks().

+ Here is the call graph for this function:

◆ points_to_cell_add_field_dimension()

cell points_to_cell_add_field_dimension ( cell  c,
entity  f 
)

Functions about points-to cells - There is no cell.c file.

add a field to a cell if it is meaningful

FI: should we also add the necessary zero subscripts when the field is an array?

Definition at line 1444 of file effects.c.

1445 {
1446  if(cell_reference_p(c)) {
1447  reference r = cell_reference(c);
1449  }
1450  else if(cell_preference_p(c)) {
1451  preference pr = cell_preference(c);
1454  }
1455  else if(cell_gap_p(c))
1456  pips_internal_error("Not applicable on gaps.\n");
1457  else
1458  pips_internal_error("Unknown kind of cell.\n");
1459  return c;
1460 }
reference reference_add_field_dimension(reference r, entity f)
add a field f as a subscript to a reference r if it is meaningful.
Definition: effects.c:1475
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15

References cell_gap_p, cell_preference, cell_preference_p, cell_reference, cell_reference_p, f(), pips_internal_error, preference_reference, and reference_add_field_dimension().

Referenced by any_source_to_sinks(), anywhere_source_to_sinks(), binary_intrinsic_call_to_points_to_sinks(), generic_points_to_cell_to_useful_pointer_cells(), new_recursive_filter_formal_context_according_to_actual_context(), points_to_translation_of_struct_formal_parameter(), and recursive_cell_to_pointer_cells().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ points_to_cell_add_fixed_subscripts()

void points_to_cell_add_fixed_subscripts ( cell  c,
bool  zero_p 
)

Convert a reference to an array into a reference to its first element.

Note: is this unconditional? Do you add the right number of subscripts according to the type?

Parameters
zero_pero_p

Definition at line 1594 of file effects.c.

1595 {
1596  bool to_be_freed = false;
1597  type t = type_undefined;
1600  //type at = points_to_array_reference_to_type(r);
1601  //t = array_type_to_element_type(at);
1603  // partial memory leak with "at"?
1604  }
1605  else
1606  t = points_to_cell_to_type(c, &to_be_freed);
1607 
1608  if(zero_p)
1610  else
1612  if(to_be_freed) free_type(t);
1613 }
void free_type(type p)
Definition: ri.c:2658
type points_to_cell_to_type(cell, bool *)
FI: I need more generality than is offered by cell_to_type()
Definition: type.c:665
bool points_to_array_reference_p(reference)
Is this a reference to an array or a reference to a pointer? This is not linked to the type of the re...
Definition: points_to.c:599
type points_to_array_reference_to_type(reference)
If this is an array reference, what is the type of the underlying array type?
Definition: points_to.c:657
void reference_add_zero_subscripts(reference r, type t)
Definition: expression.c:261
void reference_add_unbounded_subscripts(reference r, type t)
Definition: expression.c:300
#define type_undefined
Definition: ri.h:2883

References cell_any_reference(), free_type(), points_to_array_reference_p(), points_to_array_reference_to_type(), points_to_cell_to_type(), reference_add_unbounded_subscripts(), reference_add_zero_subscripts(), and type_undefined.

Referenced by points_to_cell_add_unbounded_subscripts(), and points_to_cell_add_zero_subscripts().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ points_to_cell_add_unbounded_subscripts()

void points_to_cell_add_unbounded_subscripts ( cell  c)

Definition at line 1632 of file effects.c.

1633 {
1635 }
void points_to_cell_add_fixed_subscripts(cell c, bool zero_p)
Convert a reference to an array into a reference to its first element.
Definition: effects.c:1594

References points_to_cell_add_fixed_subscripts().

Referenced by any_source_to_sinks(), assignment_to_points_to(), generic_points_to_cell_to_useful_pointer_cells(), generic_stub_source_to_sinks(), internal_pointer_assignment_to_points_to(), new_recursive_filter_formal_context_according_to_actual_context(), points_to_translation_of_struct_formal_parameter(), recursive_cell_to_pointer_cells(), and variable_to_pointer_locations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ points_to_cell_add_zero_subscript()

void points_to_cell_add_zero_subscript ( cell  c)

Definition at line 1620 of file effects.c.

1621 {
1624 }
void reference_add_zero_subscript(reference r)
No check on reference r.
Definition: expression.c:267

References cell_any_reference(), and reference_add_zero_subscript().

Referenced by filter_formal_context_according_to_actual_context(), new_filter_formal_context_according_to_actual_context(), points_to_translation_of_formal_parameters(), and recursive_filter_formal_context_according_to_actual_context().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ points_to_cell_add_zero_subscripts()

void points_to_cell_add_zero_subscripts ( cell  c)

Definition at line 1615 of file effects.c.

1616 {
1618 }

References points_to_cell_add_fixed_subscripts().

Referenced by binary_intrinsic_call_to_points_to_sinks(), generic_stub_source_to_sinks(), internal_pointer_assignment_to_points_to(), points_to_cell_types_compatibility(), and reference_to_points_to_sinks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ points_to_cell_complete_with_zero_subscripts()

void points_to_cell_complete_with_zero_subscripts ( cell  c)

Definition at line 1626 of file effects.c.

1627 {
1630 }
void reference_complete_with_zero_subscripts(reference r)
Reference r to an array maybe partial, as is possible in C: with declaration "int a[10][10]",...
Definition: expression.c:278

References cell_any_reference(), and reference_complete_with_zero_subscripts().

Referenced by filter_formal_context_according_to_actual_context(), and new_filter_formal_context_according_to_actual_context().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ points_to_cell_update_last_subscript()

void points_to_cell_update_last_subscript ( cell  c,
expression  s 
)

Transform reference a[i]...[j] and expression s into reference a[i]..[j+s] if j and s are constant integer expressions, and into reference a[i]..[*] otherwise.

Cell c is updated by side effect.

This has been implemented in several places...

Definition at line 1643 of file effects.c.

1644 {
1646  list sl = reference_indices(r);
1647  if(ENDP(sl)) {
1648  // FI: we could do something special for heap abstract locations...
1649  // entity v = reference_variable(r);
1650  pips_internal_error("Wrong argument c.\n");
1651  }
1652  else {
1653  list lsl = gen_last(sl);
1654  expression is = EXPRESSION(CAR(lsl));
1655  intptr_t c1, c2;
1657  if(expression_integer_value(is, &c1) && expression_integer_value(s, &c2)) {
1658  ns = int_to_expression((int) c1+c2);
1659  }
1660  else {
1662  }
1663  EXPRESSION_(CAR(lsl)) = ns;
1664  }
1665 }
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
#define expression_undefined
Definition: ri.h:1223
#define intptr_t
Definition: stdint.in.h:294

References CAR, cell_any_reference(), ENDP, EXPRESSION, EXPRESSION_, expression_integer_value(), expression_undefined, gen_last(), int_to_expression(), intptr_t, make_unbounded_expression(), pips_internal_error, and reference_indices.

Referenced by subscripted_reference_to_points_to().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ points_to_reference_included_p()

bool points_to_reference_included_p ( reference  r1,
reference  r2 
)

FI->FC/AM: some elements of the lattice must be exploited here...

Parameters
r11
r22

Definition at line 1243 of file effects.c.

1244 {
1245  bool included_p = true;
1246  entity v1 = reference_variable(r1);
1247  entity v2 = reference_variable(r2);
1248 
1249  list dims1 = reference_indices(r1);
1250  list dims2 = reference_indices(r2);
1251 
1252  if(v1 == v2) {
1253  if(gen_length(dims1)==gen_length(dims2)) {
1254  list cdims2 = dims2;
1255  FOREACH(EXPRESSION, s1, dims1) {
1256  expression s2 = EXPRESSION(CAR(cdims2));
1257  if(!expression_equal_p(s1,s2)) {
1258  if(!unbounded_expression_p(s2)) {
1259  included_p = false;
1260  break;
1261  }
1262  }
1263  cdims2 = CDR(cdims2);
1264  }
1265  }
1266  else if(gen_length(dims1)>gen_length(dims2)) {
1267  list cdims1 = dims1;
1268  FOREACH(EXPRESSION, s2, dims2) {
1269  expression s1 = EXPRESSION(CAR(cdims1));
1270  if(!expression_equal_p(s1,s2)) {
1271  if(!unbounded_expression_p(s2)) {
1272  included_p = false;
1273  break;
1274  }
1275  }
1276  cdims1 = CDR(cdims1);
1277  }
1278  }
1279  else {
1280  included_p = false;
1281  }
1282  }
1283  else {
1284  // pips_internal_error("Abstract location lattice not implemented here.\n");
1285  // FI->AM/FC: you should check the inclusion of abstract_location(v1) and
1286  // abstract_location(v2)...
1287  included_p = false;
1288  }
1289  return included_p;
1290 }
s1
Definition: set.c:247

References CAR, CDR, EXPRESSION, expression_equal_p(), FOREACH, gen_length(), reference_indices, reference_variable, s1, and unbounded_expression_p().

Referenced by cell_included_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ recursive_cell_to_pointer_cells()

list recursive_cell_to_pointer_cells ( cell  c)

Go down if it is an array of pointers or an array of struct

add indices to cell c

Add subscripts to reach array elements

Look for fields that are either pointers, or arrays or structs

Add field subscript to reference

Definition at line 1680 of file effects.c.

1681 {
1682  list children = NIL;
1683  // Too strong for recursive calls
1684  //pips_assert("Cell \"c\" has no subscripts.",
1685  // ENDP(reference_indices(cell_any_reference(c))));
1686  bool to_be_freed;
1687  type ct = points_to_cell_to_type(c, &to_be_freed);
1688 
1689  if(pointer_type_p(ct)) {
1690  children = CONS(CELL, copy_cell(c), NIL);
1691  }
1692  else if(array_type_p(ct)) {
1693  /* Go down if it is an array of pointers or an array of struct */
1695  /* add indices to cell c */
1696  cell n_c = copy_cell(c);
1697  /* Add subscripts to reach array elements */
1699  children = recursive_cell_to_pointer_cells(n_c);
1700  free_cell(n_c);
1701  }
1702  else {
1703  ; // No children
1704  }
1705  }
1706  else if(struct_type_p(ct)) {
1707  /* Look for fields that are either pointers, or arrays or structs */
1709  entity dte = basic_derived(b);
1710  type dt = entity_type(dte);
1711  list fields = type_struct(dt);
1712  FOREACH(ENTITY, f, fields) {
1714  if(pointer_type_p(ft)
1715  || array_type_p(ft)
1716  || struct_type_p(ft)) {
1717  cell n_c = copy_cell(c);
1718  /* Add field subscript to reference */
1720  children = recursive_cell_to_pointer_cells(n_c);
1721  free_cell(n_c);
1722  }
1723  }
1724  }
1725 
1726  // Too strong for recursive calls
1727  //pips_assert("Cell \"c\" has children, "
1728  // "or this function would not have been called.", !ENDP(children));
1729  return children;
1730 }
void points_to_cell_add_unbounded_subscripts(cell c)
Definition: effects.c:1632
cell points_to_cell_add_field_dimension(cell c, entity f)
Functions about points-to cells - There is no cell.c file.
Definition: effects.c:1444
void free_cell(cell p)
Definition: effects.c:249
cell copy_cell(cell p)
CELL.
Definition: effects.c:246
#define CELL(x)
CELL.
Definition: effects.h:424
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
bool array_of_pointers_type_p(type)
Definition: type.c:3025
bool array_of_struct_type_p(type)
Definition: type.c:3133
#define type_struct(x)
Definition: ri.h:2964
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755

References array_of_pointers_type_p(), array_of_struct_type_p(), array_type_p(), basic_derived, CELL, CONS, copy_cell(), ENTITY, entity_basic_concrete_type(), entity_type, f(), FOREACH, free_cell(), NIL, pointer_type_p(), points_to_cell_add_field_dimension(), points_to_cell_add_unbounded_subscripts(), points_to_cell_to_type(), recursive_cell_to_pointer_cells(), struct_type_p(), type_struct, type_variable, and variable_basic.

Referenced by cell_to_pointer_cells(), points_to_binding_arguments(), and recursive_cell_to_pointer_cells().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reference_add_field_dimension()

reference reference_add_field_dimension ( reference  r,
entity  f 
)

add a field f as a subscript to a reference r if it is meaningful.

Leave r unchanged if not.

This function cannot be located in ri-util because it does need to know about abstract locations.

This does not build a standard reference, but a reference used within effects computation. Field accesses are replaced by subscripts.

Note that the reference generated may contain extra 0 subscripts to make it scalar...

No fields can be added to some special abstract locations.

FI: a problem due to typedefs apparently

Take care of special cases

Nothing done when the heap is modeled by a unique entity

This kind of entity cannot support a concrete access path but the type must be updated according to the field "f"

FI: This piece of code should be useless because the all_heap_locations entity is used only when ALIASING_ACROSS_TYPES is true.

Definition at line 1475 of file effects.c.

1476 {
1477  entity v = reference_variable(r);
1478 
1479  /* No fields can be added to some special abstract locations. */
1485  || entity_all_heap_locations_p(v) // Not typed, hopefully...
1486  )) {
1487  bool to_be_freed = false;
1488  type t = points_to_reference_to_type(r, &to_be_freed);
1489  //type t = ultimate_type(entity_type(v));
1491 
1492  if(struct_type_p(ut)) {
1494  type st = ultimate_type(entity_type(ste)); // FI: should be concrete_basic_type
1495  list fl = list_undefined;
1496  /* FI: a problem due to typedefs apparently */
1497  if(type_struct_p(st))
1498  fl = type_struct(st);
1499  else if(struct_type_p(st)) {
1501  type nst = ultimate_type(entity_type(nste));
1502  fl = type_struct(nst);
1503  }
1504  else
1505  pips_internal_error("Misunderstanding of struct typing.\n");
1506  entity nf = find_field_in_field_list(f, fl);
1507  if(!entity_undefined_p(nf)) {
1510  CONS(EXPRESSION, s, NIL));
1511  // FI: in case the field is an array
1513  }
1514  else {
1515  entity v = reference_variable(r);
1516  pips_internal_error("No field \"%s\" (\"%s\") for struct \"%s\"(\"%s\")\n",
1518  }
1519  }
1520  else {
1521  /* Take care of special cases */
1524  /* Nothing done when the heap is modeled by a unique entity */
1525  ; // FI: could be useful for unions as well
1526  }
1527  else if(array_of_struct_type_p(ut)) {
1528  extern bool get_int_property(const char *);
1529  bool strict_p = get_bool_property("POINTS_TO_STRICT_POINTER_TYPES");
1530  if(!strict_p) {
1531  // An implicit 0 subscript should be added
1533  // FI: This should be guarded as for the other structures
1534  // Some code should be factorized out
1536  pips_assert("No indices yet.\n", ENDP(reference_indices(r)));
1538  }
1539  }
1542  pips_assert("No indices yet.\n", ENDP(reference_indices(r)));
1544  }
1545  else
1546  pips_internal_error("Attempt at adding a field to an object that is not"
1547  " a struct.\n");
1548  }
1549  if(to_be_freed) free_type(t);
1550  }
1552  || entity_all_heap_locations_p(v) // Not typed, hopefully...?
1553  ) {
1554  /* This kind of entity cannot support a concrete access path but
1555  * the type must be updated according to the field "f"
1556  */
1557  type nt = entity_type(f); // concrete/ultimate_type()?
1560  reference_variable(r) = ne;
1562  }
1563  else if(entity_all_heap_locations_p(v)
1564  && !get_bool_property("ALIASING_ACROSS_TYPES")) {
1565  /* FI: This piece of code should be useless because the
1566  all_heap_locations entity is used only when
1567  ALIASING_ACROSS_TYPES is true. */
1569  reference_variable(r) = ne;
1571  }
1572  }
1573 
1574  return r;
1575 }
int get_int_property(const string)
entity entity_typed_anywhere_locations(type t)
bool entity_nowhere_locations_p(entity e)
test if an entity is the bottom of the lattice
bool entity_anywhere_locations_p(entity e)
test if an entity is the bottom of the lattice
bool entity_all_module_heap_locations_p(entity e)
test if an entity is the a heap area
entity entity_all_heap_locations_typed(type t)
type points_to_reference_to_type(reference, bool *)
FI: I need more generality than is offered by cell_to_type()
Definition: type.c:527
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
type compute_basic_concrete_type(type)
computes a new type which is the basic concrete type of the input type (this new type is not stored i...
Definition: type.c:3556
bool overloaded_type_p(type)
Returns true if t is a variable type with a basic overloaded.
Definition: type.c:2666
entity find_field_in_field_list(entity, list)
To deal with fields declared in different C files.
Definition: type.c:5401
#define type_struct_p(x)
Definition: ri.h:2962

References array_of_struct_type_p(), basic_derived, compute_basic_concrete_type(), CONS, ENDP, entity_all_heap_locations_p(), entity_all_heap_locations_typed(), entity_all_module_heap_locations_p(), entity_anywhere_locations_p(), entity_basic_concrete_type(), entity_name, entity_nowhere_locations_p(), entity_null_locations_p(), entity_to_expression(), entity_type, entity_typed_anywhere_locations(), entity_typed_anywhere_locations_p(), entity_typed_nowhere_locations_p(), entity_undefined_p, entity_user_name(), EXPRESSION, f(), find_field_in_field_list(), free_type(), gen_nconc(), get_bool_property(), get_int_property(), int_to_expression(), list_undefined, NIL, overloaded_type_p(), pips_assert, pips_internal_error, points_to_reference_to_type(), reference_add_zero_subscripts(), reference_indices, reference_variable, struct_type_p(), type_struct, type_struct_p, type_variable, ultimate_type(), and variable_basic.

Referenced by points_to_cell_add_field_dimension(), and struct_assignment_to_points_to().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simple_reference_add_field_dimension()

reference simple_reference_add_field_dimension ( reference  r,
entity  f 
)

Do not check anything, just add f as a last subscript.

See above

Definition at line 1581 of file effects.c.

1582 {
1585  CONS(EXPRESSION, s, NIL));
1586  return r;
1587 }

References CONS, entity_to_expression(), EXPRESSION, f(), gen_nconc(), NIL, and reference_indices.

Referenced by add_inter_or_intraprocedural_field_entities(), and struct_assignment_to_points_to().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ statement_has_a_module_formal_argument_write_effect_p()

bool statement_has_a_module_formal_argument_write_effect_p ( statement  s,
entity  module,
statement_mapping  effects_list_map 
)

Return true if the statement has a write effect on at least one of the argument (formal parameter) of the module.

Note that the return variable of a function is also considered here as a formal parameter.

Parameters
moduleodule
effects_list_mapffects_list_map

Definition at line 247 of file effects.c.

250 {
251  bool write_effect_on_a_module_argument_found = false;
252  list effects_list = (list) GET_STATEMENT_MAPPING(effects_list_map, s);
253 
254  FOREACH(EFFECT, an_effect, effects_list)
255  {
257 
258  if (action_write_p(effect_action(an_effect))
261  module))) {
262  write_effect_on_a_module_argument_found = true;
263  break;
264  }
265  }
266 
267  return write_effect_on_a_module_argument_found;
268 
269 }
static entity a_variable
#define GET_STATEMENT_MAPPING(map, stat)
Definition: newgen-local.h:49
struct cons * list
Definition: newgen_types.h:106
static char * module
Definition: pips.c:74
bool variable_is_a_module_formal_parameter_p(entity, entity)
Definition: variable.c:1547
bool variable_return_p(entity)
True if a variable is the pseudo-variable used to store value returned by a function:
Definition: variable.c:1522

References a_variable, action_write_p, EFFECT, effect_action, effect_any_reference, FOREACH, GET_STATEMENT_MAPPING, module, reference_variable, variable_is_a_module_formal_parameter_p(), and variable_return_p().

+ Here is the call graph for this function:

◆ std_file_cell_p()

bool std_file_cell_p ( cell  c)

Definition at line 524 of file effects.c.

525 {
526  return(std_file_entity_p(cell_entity(c)));
527 }
bool std_file_entity_p(entity e)
Definition: entity.c:1232

References cell_entity(), and std_file_entity_p().

+ Here is the call graph for this function:

◆ std_file_effect_p()

bool std_file_effect_p ( effect  e)

Definition at line 519 of file effects.c.

520 {
521  return(std_file_entity_p(effect_entity(e)));
522 }

References effect_entity(), and std_file_entity_p().

Referenced by create_step_regions(), do_check_isolate_statement_preconditions_on_call(), effects_to_dma(), and std_file_effects_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ std_file_effects_p()

bool std_file_effects_p ( list  effects)

Definition at line 529 of file effects.c.

530 {
531  FOREACH(EFFECT,eff,effects)
532  if(std_file_effect_p(eff)) return true;
533  return false;
534 }
bool std_file_effect_p(effect e)
Definition: effects.c:519

References EFFECT, FOREACH, and std_file_effect_p().

+ Here is the call graph for this function:

◆ store_effect_p()

bool store_effect_p ( effect  e)

Definition at line 1062 of file effects.c.

1063 {
1064  action a = effect_action(e);
1066  bool store_p = action_kind_store_p(ak);
1067 
1068  return store_p;
1069 }

References action_kind_store_p, action_read, action_read_p, action_write, and effect_action.

Referenced by add_conflicts(), add_values_for_simple_effects_of_statement(), array_must_fully_written_by_regions_p(), c_convex_effects_on_formal_parameter_backward_translation(), create_values_for_simple_effect(), cumul_and_update_effects_of_statement(), DistArraysEffects(), effect_may_read_or_write_memory_paths_from_entity_p(), effects_read_variable_p(), effects_write_p(), effects_write_variable_p(), find_effect_actions_for_entity(), generic_apply_effects_to_transformer(), generic_effects_maymust_read_or_write_scalar_entity_p(), get_written_entities(), invariant_expression_p(), kill_effects(), loop_flt(), loop_regions_normalize(), module_to_value_mappings(), no_other_effects_on_references(), prettyprint_dependence_graph(), project_regions_along_loop_index(), project_regions_along_parameters(), pure_function_p(), region_exact_projection_along_variable(), region_intersection(), region_sup_difference(), region_union(), regions_dynamic_elim(), regions_may_convex_hull(), regions_must_convex_hull(), regions_transformer_apply(), safe_effects_for_reductions(), simple_switch_old_to_new(), update_compatible_reduction(), update_reduction_under_effect(), vars_read_and_written(), written_effect_p(), written_effects_to_dist_arrays_p(), xml_Chain_Graph(), xml_Compute_and_Need(), xml_Region_Parameter(), xml_TaskParameter(), and xml_TaskParameters().

+ Here is the caller graph for this function:

◆ store_independent_effect_p()

bool store_independent_effect_p ( effect  eff)

Does this effect define the same set of memory locations regardless of the current (environment and) memory state?

This function works only for standard references, not for points-to references, but is partially extended to cope with one anywhere...

FI: I do not understand why pointers could be indexed in standard references.

Parameters
effff

Definition at line 636 of file effects.c.

637 {
638  bool independent_p = false;
639 
640  ifdebug(1) {
642  pips_assert("Effect eff is consistent", effect_consistent_p(eff));
643  pips_assert("The reference is consistent", reference_consistent_p(r));
644  }
645 
646  if(anywhere_effect_p(eff))
647  independent_p = true;
648  else {
650  entity v = reference_variable(r);
652 
653  if(pointer_type_p(t)) {
654  list inds = reference_indices(r);
655 
656  independent_p = ENDP(inds);
657  }
658  else {
659  pips_assert("The reference is consistent", reference_consistent_p(r));
660 
661  independent_p = reference_with_constant_indices_p(r);
662  }
663  }
664 
665  return independent_p;
666 }
bool reference_consistent_p(reference p)
Definition: ri.c:2056
bool reference_with_constant_indices_p(reference r)
Definition: expression.c:3022

References anywhere_effect_p(), effect_any_reference, effect_consistent_p(), ENDP, entity_basic_concrete_type(), ifdebug, pips_assert, pointer_type_p(), reference_consistent_p(), reference_indices, reference_variable, and reference_with_constant_indices_p().

Referenced by add_values_for_simple_effects_of_statement(), effect_interference(), and effects_interfere_p().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ type_declaration_effect_p()

bool type_declaration_effect_p ( effect  e)

Definition at line 1080 of file effects.c.

1081 {
1082  action a = effect_action(e);
1084  bool decl_p = action_kind_type_declaration_p(ak);
1085 
1086  return decl_p;
1087 }

References action_kind_type_declaration_p, action_read, action_read_p, action_write, and effect_action.

◆ typed_anywhere_effect_p()

bool typed_anywhere_effect_p ( effect  e)

Is it a typed anywhere effect? ANYMMODULE:ANYWHERE_b0, 1, 2.

Definition at line 352 of file effects.c.

353 {
354  return generic_anywhere_effect_p(e, 1);
355 }

References generic_anywhere_effect_p().

+ Here is the call graph for this function:

◆ union_compatible_effects_p()

bool union_compatible_effects_p ( effect  ef1,
effect  ef2 
)

DO NOT USE ANYMORE: NOT COMPATIBLE WITH ABSTRACT LOCATIONS.

besides, I do not see the interest after having called effects_compatible_p. BC Check compatibility conditions for effect union

In general, you do not want to union a read and a write, but you might want to do so to generate the set of referenced elements, for instance to generate communications or to allocate memory

You do not want to union an effect on store with an effect on environment or type declaration

Here we know: at1==at2 and akt1==akt2

The code below could be further unified, but it would not make it easier to understand

Beware: that's not true anymore because of abstract locations

For environment and type declaration, the descriptor is useless for the time being

Parameters
ef1f1
ef2f2

Definition at line 1354 of file effects.c.

1355 {
1356  action a1 = effect_action(ef1);
1357  tag at1 = action_tag(a1);
1359  tag akt1 = action_kind_tag(ak1);
1360  entity e1 = effect_variable(ef1);
1361  descriptor d1 = effect_descriptor(ef1);
1362  action a2 = effect_action(ef2);
1363  tag at2 = action_tag(a2);
1365  tag akt2 = action_kind_tag(ak2);
1366  entity e2 = effect_variable(ef2);
1367  descriptor d2 = effect_descriptor(ef2);
1368  bool compatible_p = true;
1369 
1370  pips_assert("effect e1 is consistent", effect_consistent_p(ef1));
1371  pips_assert("effect e2 is consistent", effect_consistent_p(ef2));
1372 
1373  if(at1!=at2) {
1374  /* In general, you do not want to union a read and a write, but
1375  you might want to do so to generate the set of referenced
1376  elements, for instance to generate communications or to
1377  allocate memory */
1378  compatible_p = false;
1379  }
1380  else if(akt1!=akt2) {
1381  /* You do not want to union an effect on store with an effect on
1382  environment or type declaration */
1383  compatible_p = false;
1384  }
1385  else {
1386  /* Here we know: at1==at2 and akt1==akt2 */
1387  /* The code below could be further unified, but it would not make
1388  it easier to understand */
1389  if(akt1==is_action_kind_store) {
1390  if(e1!=e2) /* Beware: that's not true anymore because of abstract locations */
1391  compatible_p = false;
1392  else {
1393  tag dt1 = descriptor_tag(d1);
1394  tag dt2 = descriptor_tag(d2);
1395 
1396  if(dt1!=dt2)
1397  compatible_p = false;
1398  }
1399  }
1400  else {
1401  /* For environment and type declaration, the descriptor is
1402  useless for the time being */
1403  compatible_p = e1==e2;
1404  }
1405  }
1406 
1407  return compatible_p;
1408 }
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
#define descriptor_tag(x)
Definition: effects.h:595
@ is_action_kind_store
Definition: effects.h:237
#define effect_descriptor(x)
Definition: effects.h:646
int tag
TAG.
Definition: newgen_types.h:92

References action_kind_tag, action_tag, action_to_action_kind(), descriptor_tag, effect_action, effect_consistent_p(), effect_descriptor, effect_variable, is_action_kind_store, and pips_assert.

+ Here is the call graph for this function:

◆ vect_contains_phi_p()

bool vect_contains_phi_p ( Pvecteur  v)

bool vect_contains_phi_p(Pvecteur v) input : a vector output : true if v contains a PHI variable, false otherwise modifies : nothing

Definition at line 1427 of file effects.c.

1428 {
1429  for(; !VECTEUR_NUL_P(v); v = v->succ)
1430  if (variable_phi_p((entity) var_of(v)))
1431  return(true);
1432 
1433  return(false);
1434 }
#define variable_phi_p(e)
true if e is a phi variable PHI entities have a name like: REGIONS:PHI#, where # is a number.
struct Svecteur * succ
Definition: vecteur-local.h:92
#define VECTEUR_NUL_P(v)
#define var_of(varval)

References Svecteur::succ, var_of, variable_phi_p, and VECTEUR_NUL_P.

Referenced by constraints_nb_phi_eq(), eq_var_nophi_min_coeff(), eq_var_phi(), some_phi_variable(), text_pointer_value(), text_points_to_relation(), and text_region_no_action().

+ Here is the caller graph for this function: