PIPS
binary_operators.c File Reference
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "database.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "constants.h"
#include "misc.h"
#include "text-util.h"
#include "text.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "resources.h"
+ Include dependency graph for binary_operators.c:

Go to the source code of this file.

Functions

list ReferenceUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect) __attribute__((unused)))
 package effect: new version by Beatrice Creusillet More...
 
list ReferenceTestUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect) __attribute__((unused)))
 
list EffectsMayUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect))
 list EffectsMayUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, may union of the two initial lists modifies : l1 and l2 and their effects. More...
 
list ProperEffectsMustUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect))
 list EffectsMustUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, must union of the two initial lists modifies : l1 and l2 and their effects. More...
 
list EffectsMustUnion (list l1, list l2, bool(*union_combinable_p)(effect, effect))
 list EffectsMustUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, must union of the two initial lists modifies : l1 and l2 and their effects. More...
 
list effects_may_union (effect eff1, effect eff2)
 
list effects_must_union (effect eff1, effect eff2)
 
effect effect_may_union (effect eff1, effect eff2)
 Preserve store independent information as long as you can. More...
 
effect effect_must_union (effect eff1, effect eff2)
 computes the must union of two combinable effects More...
 
static list effect_sup_difference (effect eff1, effect eff2)
 
static list effect_inf_difference (effect eff1 __attribute__((unused)), effect eff2 __attribute__((unused)))
 
list EffectsSupDifference (list l1, list l2, bool(*difference_combinable_p)(effect, effect))
 list EffectsSupDifference(list l1, l2) input : two lists of effects output : a list of effect, representing the sup_difference of the initial effects. More...
 
list EffectsInfDifference (list l1, list l2, bool(*difference_combinable_p)(effect, effect))
 list EffectsInfDifference(list l1, l2) input : two lists of effects output : a list of effect, representing the inf_difference of the initial effects. More...
 
effect proper_to_summary_simple_effect (effect eff)
 FI: the goal is to get rid of array subscripts to handle the arrays atomically. More...
 
bool simple_cells_intersection_p (cell c1, descriptor __attribute__((__unused__)) d1, cell c2, descriptor __attribute__((__unused__)) d2, bool *exact_p)
 
bool simple_cells_inclusion_p (cell c1, __attribute__((__unused__)) descriptor d1, cell c2, __attribute__((__unused__)) descriptor d2, bool *exact_p)
 Inclusion test : More...
 

Function Documentation

◆ effect_inf_difference()

static list effect_inf_difference ( effect eff1   __attribute__(unused),
effect eff2   __attribute__(unused) 
)
static

Definition at line 419 of file binary_operators.c.

421 {
422  list l_res = NIL;
423  return(l_res);
424 }
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References NIL.

Referenced by EffectsInfDifference().

+ Here is the caller graph for this function:

◆ effect_may_union()

effect effect_may_union ( effect  eff1,
effect  eff2 
)

Preserve store independent information as long as you can.

I should have some order on references to absorb, for instance, x[1] by x[*].

computes the may union of two combinable effects

Parameters
[in]eff1effect
[in]eff2
See also
effects_combinable_p
Returns
a new effect with no sharing with the input effects

Abstract locations cases

In fact, we could have : if (al1_p || al_2_p) { entity e1 = effect_entity(e1); entity e2 = effect_entity(e2);

new_ent = entity_locations_max(e1, e2);

eff = make_simple_effect(make_reference(new_ent, NIL), copy_action(effect_action(eff1)), make_approximation(approximation_and(app1,app2), UU)); }

but entity_locations_max involves string manipulations, which are always costly. So we treat apart the cases where (al1_p and ! al2_p) and (al2_p and ! al1_p) because we already know that the abstract location is the max of both locations (because they are combinable (see effects_combinable_p))

concrete locations cases

it's a preference : we change for a reference cell

let us check the indices

Parameters
eff1ff1
eff2ff2

Definition at line 163 of file binary_operators.c.

164 {
165  effect eff;
166  tag app1 = effect_approximation_tag(eff1);
167  tag app2 = effect_approximation_tag(eff2);
168 
169  bool al1_p = effect_abstract_location_p(eff1);
170  bool al2_p = effect_abstract_location_p(eff2);
171 
172  /* Abstract locations cases */
173  /* In fact, we could have :
174  if (al1_p || al_2_p)
175  {
176  entity e1 = effect_entity(e1);
177  entity e2 = effect_entity(e2);
178 
179  new_ent = entity_locations_max(e1, e2);
180 
181  eff = make_simple_effect(make_reference(new_ent, NIL),
182  copy_action(effect_action(eff1)),
183  make_approximation(approximation_and(app1,app2), UU));
184  }
185 
186  but entity_locations_max involves string manipulations, which are always costly.
187  So we treat apart the cases where (al1_p and ! al2_p) and (al2_p and ! al1_p) because
188  we already know that the abstract location is the max of both locations
189  (because they are combinable (see effects_combinable_p))
190 
191  */
192  if (al1_p && al2_p)
193  {
194  entity e1 = effect_entity(eff1);
195  entity e2 = effect_entity(eff2);
196 
197  entity new_ent = entity_locations_max(e1, e2);
198 
199  eff = make_simple_effect(make_reference(new_ent, NIL),
200  copy_action(effect_action(eff1)),
202  }
203  else if (al1_p) {
204  // functions that can be pointed by effect_dup_func:
205  // simple_effect_dup
206  // region_dup
207  // copy_effect
208  eff = (*effect_dup_func)(eff1);
209  }
210  else if (al2_p) {
211  // functions that can be pointed by effect_dup_func:
212  // simple_effect_dup
213  // region_dup
214  // copy_effect
215  eff = (*effect_dup_func)(eff2);
216  }
217 
218  /* concrete locations cases */
219  else if (effect_scalar_p(eff1))
220  {
222  copy_action(effect_action(eff1)),
224  }
225  else
226  {
227  // functions that can be pointed by effect_dup_func:
228  // simple_effect_dup
229  // region_dup
230  // copy_effect
231  eff = (*effect_dup_func)(eff1);
232  cell eff_c = effect_cell(eff);
233 
234  if (cell_preference_p(eff_c))
235  {
236  /* it's a preference : we change for a reference cell */
237  pips_debug(8, "It's a preference\n");
239  free_cell(eff_c);
241  }
242 
243  /* let us check the indices */
246 
247  tag app_tag = approximation_and(app1,app2);
248 
249  for(; !ENDP(l1); POP(l1), POP(l2))
250  {
251  expression exp1 = EXPRESSION(CAR(l1));
252  expression exp2 = EXPRESSION(CAR(l2));
253  if (!expression_equal_p(exp1, exp2))
254  {
256  app_tag = is_approximation_may;
257  }
258  }
259 
260  approximation_tag(effect_approximation(eff)) = app_tag;
261  }
262  return(eff);
263 }
cell make_cell_reference(reference _field_)
Definition: effects.c:293
action copy_action(action p)
ACTION.
Definition: effects.c:77
void free_cell(cell p)
Definition: effects.c:249
approximation make_approximation(enum approximation_utype tag, void *val)
Definition: effects.c:176
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
reference copy_reference(reference p)
REFERENCE.
Definition: ri.c:2047
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
entity entity_locations_max(entity al1, entity al2)
Here, entity al1 and entity al2 can be program variables.
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_approximation_tag(eff)
#define make_simple_effect(reference, action, approximation)
tag approximation_and(tag, tag)
tag approximation_and(tag t1, tag t2) input : two approximation tags.
Definition: effects.c:1198
bool effect_abstract_location_p(effect)
Definition: effects.c:280
entity effect_entity(effect)
cproto-generated files
Definition: effects.c:52
bool effect_scalar_p(effect)
Definition: effects.c:567
#define cell_preference(x)
Definition: effects.h:472
#define approximation_tag(x)
Definition: effects.h:362
#define effect_action(x)
Definition: effects.h:642
#define cell_preference_p(x)
Definition: effects.h:470
@ is_approximation_may
Definition: effects.h:341
#define effect_approximation(x)
Definition: effects.h:644
#define effect_cell(x)
Definition: effects.h:640
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
int tag
TAG.
Definition: newgen_types.h:92
#define UU
Definition: newgen_types.h:98
expression make_unbounded_expression()
Definition: expression.c:4339
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
Definition: expression.c:1347
#define EXPRESSION_(x)
Definition: ri.h:1220
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define reference_indices(x)
Definition: ri.h:2328
#define preference_reference(x)
Definition: ri.h:2102

References approximation_and(), approximation_tag, CAR, cell_preference, cell_preference_p, copy_action(), copy_reference(), effect_abstract_location_p(), effect_action, effect_any_reference, effect_approximation, effect_approximation_tag, effect_cell, effect_entity(), effect_scalar_p(), ENDP, entity_locations_max(), EXPRESSION, EXPRESSION_, expression_equal_p(), free_cell(), is_approximation_may, make_approximation(), make_cell_reference(), make_reference(), make_simple_effect, make_unbounded_expression(), NIL, pips_debug, POP, preference_reference, ref, reference_indices, and UU.

Referenced by effects_may_union().

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

◆ effect_must_union()

effect effect_must_union ( effect  eff1,
effect  eff2 
)

computes the must union of two combinable effects

Parameters
[in]eff1effect
[in]eff2
See also
effects_combinable_p
Returns
a new effect with no sharing with the input effects

Abstract locations cases

In fact, we could have : if (al1_p || al_2_p) { entity e1 = effect_entity(e1); entity e2 = effect_entity(e2);

new_ent = entity_locations_max(e1, e2);

eff = make_simple_effect(make_reference(new_ent, NIL), copy_action(effect_action(eff1)), make_approximation(approximation_and(app1,app2), UU)); }

but entity_locations_max involves string manipulations, which are always costly. So we treat apart the cases where (al1_p and ! al2_p) and (al2_p and ! al1_p) because we already know that the abstract location is the max of both locations (because they are combinable (see effects_combinable_p))

concrete locations cases

it's a preference : we change for a reference cell

let us check the indices

Parameters
eff1ff1
eff2ff2

Definition at line 272 of file binary_operators.c.

273 {
274  effect eff;
275  tag app1 = effect_approximation_tag(eff1);
276  tag app2 = effect_approximation_tag(eff2);
277 
278  bool al1_p = effect_abstract_location_p(eff1);
279  bool al2_p = effect_abstract_location_p(eff2);
280 
281  /* Abstract locations cases */
282  /* In fact, we could have :
283  if (al1_p || al_2_p)
284  {
285  entity e1 = effect_entity(e1);
286  entity e2 = effect_entity(e2);
287 
288  new_ent = entity_locations_max(e1, e2);
289 
290  eff = make_simple_effect(make_reference(new_ent, NIL),
291  copy_action(effect_action(eff1)),
292  make_approximation(approximation_and(app1,app2), UU));
293  }
294 
295  but entity_locations_max involves string manipulations, which are always costly.
296  So we treat apart the cases where (al1_p and ! al2_p) and (al2_p and ! al1_p) because
297  we already know that the abstract location is the max of both locations
298  (because they are combinable (see effects_combinable_p))
299 
300  */
301  if (al1_p && al2_p)
302  {
303  entity e1 = effect_entity(eff1);
304  entity e2 = effect_entity(eff2);
305 
306  entity new_ent = entity_locations_max(e1, e2);
307 
308  eff = make_simple_effect(make_reference(new_ent, NIL),
309  copy_action(effect_action(eff1)),
311  }
312  else if (al1_p) {
313  // functions that can be pointed by effect_dup_func:
314  // simple_effect_dup
315  // region_dup
316  // copy_effect
317  eff = (*effect_dup_func)(eff1);
318  }
319  else if (al2_p) {
320  // functions that can be pointed by effect_dup_func:
321  // simple_effect_dup
322  // region_dup
323  // copy_effect
324  eff = (*effect_dup_func)(eff2);
325  }
326 
327  /* concrete locations cases */
328  else if (effect_scalar_p(eff1))
329  {
331  copy_action(effect_action(eff1)),
332  make_approximation(approximation_or(app1,app2), UU));
333  }
334  else
335  {
336  // functions that can be pointed by effect_dup_func:
337  // simple_effect_dup
338  // region_dup
339  // copy_effect
340  eff = (*effect_dup_func)(eff1);
341  cell eff_c = effect_cell(eff);
342  if (cell_preference_p(eff_c))
343  {
344  /* it's a preference : we change for a reference cell */
345  pips_debug(8, "It's a preference\n");
347  free_cell(eff_c);
349  }
350 
351  /* let us check the indices */
354 
355  tag app_tag = approximation_or(app1,app2);
356 
357  for(; !ENDP(l1); POP(l1), POP(l2))
358  {
359  expression exp1 = EXPRESSION(CAR(l1));
360  expression exp2 = EXPRESSION(CAR(l2));
361  if (!expression_equal_p(exp1, exp2))
362  {
364  app_tag = is_approximation_may;
365  }
366  }
367 
368  effect_approximation_tag(eff) = app_tag;
369  }
370  return(eff);
371 }
tag approximation_or(tag, tag)
tag approximation_or(tag t1, tag t2) input : two approximation tags.
Definition: effects.c:1213

References approximation_and(), approximation_or(), CAR, cell_preference, cell_preference_p, copy_action(), copy_reference(), effect_abstract_location_p(), effect_action, effect_any_reference, effect_approximation_tag, effect_cell, effect_entity(), effect_scalar_p(), ENDP, entity_locations_max(), EXPRESSION, EXPRESSION_, expression_equal_p(), free_cell(), is_approximation_may, make_approximation(), make_cell_reference(), make_reference(), make_simple_effect, make_unbounded_expression(), NIL, pips_debug, POP, preference_reference, ref, reference_indices, and UU.

Referenced by effects_must_union().

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

◆ effect_sup_difference()

static list effect_sup_difference ( effect  eff1,
effect  eff2 
)
static

We already know that effects are combinable and they are not abstract locations (or they are context_sensitive heap locations)

Parameters
eff1const
eff2const

Definition at line 375 of file binary_operators.c.

376 {
377  list l_res = NIL;
378  reference ref1 = effect_any_reference(eff1);
379  reference ref2 = effect_any_reference(eff2);
380 
381  /* We already know that effects are combinable and they are not abstract locations
382  * (or they are context_sensitive heap locations)
383  */
384  if (reference_equal_p(ref1, ref2)) // a[1] - a[1] or a[*] - a[*]_may
385  {
386  if (effect_may_p(eff2)) {
387  // functions that can be pointed by effect_dup_func:
388  // simple_effect_dup
389  // region_dup
390  // copy_effect
391  l_res = effect_to_may_effect_list((*effect_dup_func)(eff1));
392  }
393  // else: empty list
394  }
395  else
396  {
397  if (effect_exact_p(eff1) && effect_exact_p(eff2)) {// a[1] - a[2]
398  // functions that can be pointed by effect_dup_func:
399  // simple_effect_dup
400  // region_dup
401  // copy_effect
402  l_res = effect_to_list((*effect_dup_func)(eff1));
403  }
404  else
405  {
406  // a[*] - a[1] or a[1] - a[*]_may for instance
407  // functions that can be pointed by effect_dup_func:
408  // simple_effect_dup
409  // region_dup
410  // copy_effect
411  l_res = effect_to_may_effect_list((*effect_dup_func)(eff1));
412  }
413  }
414 
415  return(l_res);
416 }
list effect_to_may_effect_list(effect)
effect(* effect_dup_func)(effect eff)
list effect_to_list(effect)
#define effect_may_p(eff)
#define effect_exact_p(eff)
bool reference_equal_p(reference r1, reference r2)
Definition: expression.c:1500

References effect_any_reference, effect_dup_func, effect_exact_p, effect_may_p, effect_to_list(), effect_to_may_effect_list(), NIL, and reference_equal_p().

Referenced by EffectsSupDifference().

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

◆ effects_may_union()

list effects_may_union ( effect  eff1,
effect  eff2 
)
Parameters
eff1ff1
eff2ff2

Definition at line 138 of file binary_operators.c.

139 {
140  list l_res = NIL;
141  l_res = CONS(EFFECT, effect_may_union(eff1,eff2), NIL);
142  return(l_res);
143 }
effect effect_may_union(effect eff1, effect eff2)
Preserve store independent information as long as you can.
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150

References CONS, EFFECT, effect_may_union(), and NIL.

Referenced by EffectsMayUnion().

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

◆ effects_must_union()

list effects_must_union ( effect  eff1,
effect  eff2 
)
Parameters
eff1ff1
eff2ff2

Definition at line 145 of file binary_operators.c.

146 {
147  list l_res = NIL;
148  l_res = CONS(EFFECT, effect_must_union(eff1,eff2), NIL);
149  return(l_res);
150 }
effect effect_must_union(effect eff1, effect eff2)
computes the must union of two combinable effects

References CONS, EFFECT, effect_must_union(), and NIL.

Referenced by EffectsMustUnion(), and ProperEffectsMustUnion().

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

◆ EffectsInfDifference()

list EffectsInfDifference ( list  l1,
list  l2,
bool(*)(effect, effect difference_combinable_p 
)

list EffectsInfDifference(list l1, l2) input : two lists of effects output : a list of effect, representing the inf_difference of the initial effects.

modifies : the effects of l2 may be freed. comment : we keep the effects of l1 that are not combinable with those of l2, but we don't keep the effects of l2 that are not combinable with those of l_reg1.

Parameters
l11
l22

Definition at line 462 of file binary_operators.c.

464 {
465  list l_res = NIL;
466 
467  debug(3, "EffectsInfDifference", "begin\n");
469  difference_combinable_p,
471  debug(3, "EffectsInfDifference", "end\n");
472 
473  return l_res;
474 }
list list_of_effects_generic_inf_difference_op(list, list, bool(*)(effect, effect), list(*)(effect, effect))
static list effect_inf_difference(effect eff1 __attribute__((unused)), effect eff2 __attribute__((unused)))
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189

References debug(), effect_inf_difference(), list_of_effects_generic_inf_difference_op(), and NIL.

+ Here is the call graph for this function:

◆ EffectsMayUnion()

list EffectsMayUnion ( list  l1,
list  l2,
bool(*)(effect, effect union_combinable_p 
)

list EffectsMayUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, may union of the two initial lists modifies : l1 and l2 and their effects.

Effects that are not reused in the output list of effects are freed.nothing (no sharing introduced).

Parameters
l11
l22

Definition at line 87 of file binary_operators.c.

89 {
90  list lr;
91 
93  union_combinable_p,
96  return(lr);
97 }
list list_of_effects_generic_union_op(list, list, bool(*)(effect, effect), list(*)(effect, effect), list(*)(effect))
list effects_may_union(effect eff1, effect eff2)
list effect_to_may_sdfi_list(effect)

References effect_to_may_sdfi_list(), effects_may_union(), and list_of_effects_generic_union_op().

Referenced by unstructured_to_effects().

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

◆ EffectsMustUnion()

list EffectsMustUnion ( list  l1,
list  l2,
bool(*)(effect, effect union_combinable_p 
)

list EffectsMustUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, must union of the two initial lists modifies : l1 and l2 and their effects.

Effects that are not reused in the output list of effects are freed.

Parameters
l11
l22

Definition at line 126 of file binary_operators.c.

128 {
129  list lr;
130 
132  union_combinable_p,
135  return(lr);
136 }
list effects_must_union(effect eff1, effect eff2)
list effect_to_sdfi_list(effect)

References effect_to_sdfi_list(), effects_must_union(), and list_of_effects_generic_union_op().

+ Here is the call graph for this function:

◆ EffectsSupDifference()

list EffectsSupDifference ( list  l1,
list  l2,
bool(*)(effect, effect difference_combinable_p 
)

list EffectsSupDifference(list l1, l2) input : two lists of effects output : a list of effect, representing the sup_difference of the initial effects.

modifies : the effects of l2 may be freed. comment : we keep the effects of l1 that are not combinable with those of l2, but we don't keep the effects of l2 that are not combinable with those of l_reg1.

Parameters
l11
l22

Definition at line 438 of file binary_operators.c.

440 {
441  list l_res = NIL;
442 
443  debug(3, "EffectsSupDifference", "begin\n");
445  difference_combinable_p,
447  debug(3, "EffectsSupDifference", "end\n");
448 
449  return l_res;
450 }
list list_of_effects_generic_sup_difference_op(list, list, bool(*)(effect, effect), list(*)(effect, effect))
static list effect_sup_difference(effect eff1, effect eff2)

References debug(), effect_sup_difference(), list_of_effects_generic_sup_difference_op(), and NIL.

+ Here is the call graph for this function:

◆ proper_to_summary_simple_effect()

effect proper_to_summary_simple_effect ( effect  eff)

FI: the goal is to get rid of array subscripts to handle the arrays atomically.

This is not possible with pointer indexing. For instance, p[0] is reduced the Fortran way into p, which is wrong. It could be reduced to p[*] and lead to an anywhere effects. Or we must preserve constant indices (store independent), which is the way to go with C since we transform lots of scalar accesses into array accesses.

FI: I do not understand the mix of side effects on eff, free and alloc conditionnaly for some fields. To be checked.

it's a preference : we change for a reference cell

it's a reference : let'us modify it

it may still be a field entity

Parameters
effff

Definition at line 488 of file binary_operators.c.

489 {
490  if (!effect_scalar_p(eff)) {
491  cell eff_c = effect_cell(eff);
492  bool may_p = false;
494 
495  if (cell_preference_p(eff_c))
496  {
497  /* it's a preference : we change for a reference cell */
498  pips_debug(8, "It's a preference\n");
500  free_cell(eff_c);
502  }
503  else
504  {
505  /* it's a reference : let'us modify it */
506  ref = cell_reference(eff_c);
507  }
508 
509  ifdebug(8) {
510  pips_debug(8, "Proper effect %p with reference %p: %s\n", eff, ref,
512  }
513 
514  list inds = reference_indices(ref);
515  list cind = list_undefined;
516  for(cind = inds; !ENDP(cind); POP(cind)) {
517  expression se = EXPRESSION(CAR(cind));
518 
519  ifdebug(8) {
520  pips_debug(8, "Subscript expression :\n");
521  print_expression(se);
522  }
523 
525  if(!unbounded_expression_p(se))
526  {
527  /* it may still be a field entity */
528  if (!(expression_reference_p(se) &&
530  {
531  may_p = true;
532  free_expression(se);
534  }
535  }
536  }
537  }
538 
539  if(may_p)
541 
542  ifdebug(8) {
543  pips_debug(8, "Summary simple effect %p with reference %p: %s\n", eff, ref,
545  }
546 
547  /*
548  if(!reference_with_constant_indices_p(r)) {
549  reference nr = pointer_type_p(ut)?
550  make_reference(e, CONS(EXPRESSION, make_unbounded_expression(), NIL))
551  : make_reference(e, NIL);
552  free_reference(effect_any_reference(eff));
553  if(cell_preference_p(c)) {
554  preference p = cell_preference(c);
555  preference_reference(p) = nr;
556  }
557  else {
558  cell_reference(c) = nr;
559  }
560  }
561  */
562  }
563  return(eff);
564 }
void free_expression(expression p)
Definition: ri.c:853
list words_effect(effect)
#define cell_reference(x)
Definition: effects.h:469
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
bool entity_field_p(entity e)
e is the field of a structure
Definition: entity.c:857
bool extended_integer_constant_expression_p(expression e)
More extensive than next function.
Definition: expression.c:858
bool expression_reference_p(expression e)
Test if an expression is a reference.
Definition: expression.c:528
bool unbounded_expression_p(expression e)
Definition: expression.c:4329
entity expression_variable(expression e)
Definition: expression.c:532
#define reference_undefined
Definition: ri.h:2302
#define ifdebug(n)
Definition: sg.c:47
string words_to_string(cons *lw)
Definition: print.c:211

References CAR, cell_preference, cell_preference_p, cell_reference, copy_reference(), effect_approximation_tag, effect_cell, effect_scalar_p(), ENDP, entity_field_p(), EXPRESSION, EXPRESSION_, expression_reference_p(), expression_variable(), extended_integer_constant_expression_p(), free_cell(), free_expression(), ifdebug, is_approximation_may, list_undefined, make_cell_reference(), make_unbounded_expression(), pips_debug, POP, preference_reference, print_expression(), ref, reference_indices, reference_undefined, unbounded_expression_p(), words_effect(), and words_to_string().

+ Here is the call graph for this function:

◆ ProperEffectsMustUnion()

list ProperEffectsMustUnion ( list  l1,
list  l2,
bool(*)(effect, effect union_combinable_p 
)

list EffectsMustUnion(list l1, list l2, union_combinable_p) input : two lists of effects output : a list of effects, must union of the two initial lists modifies : l1 and l2 and their effects.

Effects that are not reused in the output list of effects are freed.

Parameters
l11
l22

Definition at line 107 of file binary_operators.c.

109 {
110  list lr;
111 
113  union_combinable_p,
116  return(lr);
117 }

References effect_to_list(), effects_must_union(), and list_of_effects_generic_union_op().

+ Here is the call graph for this function:

◆ ReferenceTestUnion()

list ReferenceTestUnion ( list  l1,
list  l2,
bool(*)(effect, effect) __attribute__ union_combinable_p((unused))   
)

somthing more clever should be done here - bc.

Definition at line 67 of file binary_operators.c.

69 {
70  list l_res;
71 
72  /* somthing more clever should be done here - bc. */
73  l_res = gen_nconc(l1,l2);
75  return l_res;
76 }
void effects_to_may_effects(list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344

References effects_to_may_effects(), and gen_nconc().

+ Here is the call graph for this function:

◆ ReferenceUnion()

list ReferenceUnion ( list  l1,
list  l2,
bool(*)(effect, effect) __attribute__ union_combinable_p((unused))   
)

package effect: new version by Beatrice Creusillet

This File contains several functions to combine effects

Definition at line 60 of file binary_operators.c.

62 {
63  return gen_nconc(l1,l2);
64 }

References gen_nconc().

+ Here is the call graph for this function:

◆ simple_cells_inclusion_p()

bool simple_cells_inclusion_p ( cell  c1,
__attribute__((__unused__)) descriptor  d1,
cell  c2,
__attribute__((__unused__)) descriptor  d2,
bool exact_p 
)

Inclusion test :

returns true if c1 is included into c2, false otherwise. returns false if c1 may only be included into c2.

Parameters
exact_ptarget is set to true if the result is exact, false otherwise.

In fact, this parameter would be useful only if there are overflows during the systems inclusion test. But it is not currently used.

default result

we have combinable concrete locations or assimilated (context sensitive heap locations)

Definition at line 644 of file binary_operators.c.

647 {
648  bool res = true; /* default result */
649  *exact_p = true;
650 
651  bool concrete_locations_p = true;
652 
653  if (cells_combinable_p(c1, c2))
654  {
655  bool c1_abstract_location_p = cell_abstract_location_p(c1);
656  bool c2_abstract_location_p = cell_abstract_location_p(c2);
657 
658  if (c1_abstract_location_p || c2_abstract_location_p)
659  {
660  entity e1 = cell_entity(c1);
661  entity e2 = cell_entity(c2);
662  bool heap1_context_sensitive_p = c1_abstract_location_p && entity_flow_or_context_sentitive_heap_location_p(e1);
663  bool heap2_context_sensitive_p = c2_abstract_location_p && entity_flow_or_context_sentitive_heap_location_p(e2);
664 
665  if (heap1_context_sensitive_p && heap2_context_sensitive_p)
666  {
667  concrete_locations_p = true;
668  }
669  else
670  {
671  entity al_max = abstract_locations_max(e1, e2);
672  res = same_entity_p(e2, al_max);
673  concrete_locations_p = false;
674  }
675  }
676 
677  if (concrete_locations_p)
678  {
679  /* we have combinable concrete locations or assimilated (context sensitive heap locations) */
680  list inds1 = cell_indices(c1);
681  list inds2 = cell_indices(c2);
682 
683 
684  for(;!ENDP(inds1) && res == true; POP(inds1), POP(inds2))
685  {
686  expression exp1 = EXPRESSION(CAR(inds1));
687  expression exp2 = EXPRESSION(CAR(inds2));
688 
689  if (unbounded_expression_p(exp1))
690  {
691  pips_debug(8, "case 4.1\n");
692  if (!unbounded_expression_p(exp2))
693  {
694  pips_debug(8, "case 4.2\n");
695  res = false;
696  }
697  }
698  else if (!unbounded_expression_p(exp2) && !expression_equal_p(exp1, exp2) )
699  {
700  pips_debug(8, "case 4.3\n");
701  res = false;
702  }
703  }
704  }
705  }
706  else
707  {
708  res = false;
709  }
710  return res;
711 }
bool entity_flow_or_context_sentitive_heap_location_p(entity e)
entity abstract_locations_max(entity al1, entity al2)
eturns the smallest abstract location set greater than or equalt to al1 and al2.
bool cells_combinable_p(cell, cell)
list cell_indices(cell)
Definition: effects.c:64
bool cell_abstract_location_p(cell)
Definition: effects.c:273
entity cell_entity(cell)
Definition: effects.c:57
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321

References abstract_locations_max(), CAR, cell_abstract_location_p(), cell_entity(), cell_indices(), cells_combinable_p(), ENDP, entity_flow_or_context_sentitive_heap_location_p(), EXPRESSION, expression_equal_p(), pips_debug, POP, same_entity_p(), and unbounded_expression_p().

Referenced by effect_find_aliased_paths_with_pointer_values(), effect_find_equivalent_pointer_values(), and kill_pointer_value().

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

◆ simple_cells_intersection_p()

bool simple_cells_intersection_p ( cell  c1,
descriptor __attribute__((__unused__))  d1,
cell  c2,
descriptor __attribute__((__unused__))  d2,
bool exact_p 
)

default safe result

we have combinable concrete locations or assimilated (context sensitive heap locations)

they intersect if their corresponding indices are unbounded or equal

Definition at line 567 of file binary_operators.c.

570 {
571  bool res = true; /* default safe result */
572  bool concrete_locations_p = true;
573 
574  if (cells_combinable_p(c1, c2))
575  {
576  bool c1_abstract_location_p = cell_abstract_location_p(c1);
577  bool c2_abstract_location_p = cell_abstract_location_p(c2);
578 
579  if (c1_abstract_location_p || c2_abstract_location_p)
580  {
581  entity e1 = cell_entity(c1);
582  entity e2 = cell_entity(c2);
583  bool heap1_context_sensitive_p = c1_abstract_location_p && entity_flow_or_context_sentitive_heap_location_p(e1);
584  bool heap2_context_sensitive_p = c2_abstract_location_p && entity_flow_or_context_sentitive_heap_location_p(e2);
585 
586  if (heap1_context_sensitive_p && heap2_context_sensitive_p)
587  {
588  concrete_locations_p = true;
589  }
590  else
591  {
592  concrete_locations_p = false;
593 
594  res = true;
595  *exact_p = true;
596  }
597  }
598 
599  if (concrete_locations_p)
600  {
601  /* we have combinable concrete locations or assimilated (context sensitive heap locations) */
602  list l1 = cell_indices(c1);
603  list l2 = cell_indices(c2);
604 
605  /* they intersect if their corresponding indices are unbounded or equal */
606  res = true; *exact_p = true;
607  while(res && !ENDP(l1))
608  {
609  expression exp1 = EXPRESSION(CAR(l1));
610  expression exp2 = EXPRESSION(CAR(l2));
611 
613  *exact_p = false;
614  else if (!expression_equal_p(exp1, exp2))
615  {
616  res = false;
617  *exact_p = true;
618  }
619  POP(l1);
620  POP(l2);
621  }
622  }
623  }
624  else
625  {
626  res = false;
627  *exact_p = true;
628  }
629  return res;
630 }

References CAR, cell_abstract_location_p(), cell_entity(), cell_indices(), cells_combinable_p(), ENDP, entity_flow_or_context_sentitive_heap_location_p(), EXPRESSION, expression_equal_p(), POP, and unbounded_expression_p().

Referenced by effect_find_aliased_paths_with_pointer_values(), and effect_find_equivalent_pointer_values().

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