PIPS
impact_check.c File Reference
#include "local.h"
#include "prettyprint.h"
+ Include dependency graph for impact_check.c:

Go to the source code of this file.

Macros

#define DEP_FLOW   0
 
#define DEP_ANTI   1
 
#define DEP_OUTP   2
 
#define MUST_APPROXIMATION   0
 
#define MAY_APPROXIMATION   1
 
#define NOT_APPROXIMATION   2
 

Functions

static void display_impact_alias_statistics ()
 
static bool same_call_site_p (call_site cs1, call_site cs2)
 
static bool included_call_chain_p (list l1, list l2)
 
static bool tail_call_path_p (call_site cs, list l1, list l2)
 
static expression storage_ram_offset (storage s, expression subval)
 
static expression storage_formal_offset (call_site cs, entity actual_var, expression subval, list path)
 
static expression offset_in_caller (entity e, call_site cs, list path)
 
static bool search_statement_by_ordering_flt (statement s)
 
static bool statement_equal_p (statement s1, statement s2)
 
static vertex statement_to_vertex (statement s, graph g)
 
bool find_covering_reference_path (set arcs_processed_set, statement s_src, action act_src, entity ent_src, statement s_dest, action act_dest, entity ent_dest)
 Check to see if new dependence is covered by arcs in dependence graph at reference level. More...
 
bool check_way_between_two_statements (statement s1, statement s2, graph g)
 Check to see if there is a directed way between 2 statements in the graph specified. More...
 
static string print_call_path (list path)
 This function prints the call path , including names of caller functions and orderings of call sites in their corresponding functions. More...
 
static void insert_impact_description_as_comment (statement s1, statement s2, bool impact_must_p, int dep_type)
 
list union_list (list l1, list l2)
 Union is not typed... More...
 
static effect get_effect_read_of_statement_on_variable (statement s, entity var)
 
static effect get_effect_write_of_statement_on_variable (statement s, entity var)
 
static int __attribute__ ((unused))
 
static int loop_executed_approximation (statement s)
 
static set create_or_get_a_set_from_control (control c, hash_table control_to_set_of_dominators)
 
static void check_for_effected_statement (statement s, list le)
 
static void check_new_arc_for_structured_statement (statement s)
 
static void impact_check_two_scalar_variables_in_path (entity e1, entity e2, expression off1, expression off2, list path)
 
static void impact_check_in_path (entity e1, entity e2, expression off1, expression off2, list path)
 
static bool variable_is_written_by_statement_flt (statement s)
 This function returns true if the variable is written directly in the current module, or by its callees. More...
 
static bool variable_is_written_p (entity ent)
 
static void set_dynamic_checked (entity e1, entity e2)
 
static bool dynamic_checked_p (entity e1, entity e2)
 
static void init_dynamic_check_list (entity current_mod)
 
static void impact_check_two_variables (entity e1, entity e2, expression off1, expression off2, list path)
 
bool impact_check (char *module_name)
 

Variables

static statement mod_stat = statement_undefined
 We want to keep track of the current statement inside the recurse. More...
 
static entity current_mod = entity_undefined
 
static graph dg = NULL
 
static entity alias_ent1 = entity_undefined
 data dependence graph More...
 
static entity alias_ent2 = entity_undefined
 
static list stat_reads1 = NIL
 
static list stat_writes1 = NIL
 list of statement_approximation_p More...
 
static list stat_reads2 = NIL
 list of statement_approximation_p More...
 
static list stat_writes2 = NIL
 list of statement_approximation_p More...
 
static list current_path = NIL
 list of statement_approximation_p More...
 
static list l_dynamic_check = NIL
 This list tells us if two variables have been checked dynamically or not. More...
 
static int statement_in_caller_ordering = 0
 
static statement statement_in_caller = statement_undefined
 
static const char * caller_name
 
static call current_call = call_undefined
 
static int number_of_processed_modules = 0
 
static int number_of_impact_alias = 0
 
static bool written = false
 
static entity current_entity = entity_undefined
 

Macro Definition Documentation

◆ DEP_ANTI

#define DEP_ANTI   1

Definition at line 31 of file impact_check.c.

◆ DEP_FLOW

#define DEP_FLOW   0

Definition at line 30 of file impact_check.c.

◆ DEP_OUTP

#define DEP_OUTP   2

Definition at line 32 of file impact_check.c.

◆ MAY_APPROXIMATION

#define MAY_APPROXIMATION   1

Definition at line 35 of file impact_check.c.

◆ MUST_APPROXIMATION

#define MUST_APPROXIMATION   0

Definition at line 34 of file impact_check.c.

◆ NOT_APPROXIMATION

#define NOT_APPROXIMATION   2

Definition at line 36 of file impact_check.c.

Function Documentation

◆ __attribute__()

static int __attribute__ ( (unused)  )
static

Automatic variables read in a CATCH block need to be declared volatile as specified by the documentation

compute the set N of nodes in flowgraph

Initialization D(n) = N

control_graph does not work until load_ctrl_graph is called control c1 = unstructured_control(control_graph(s1)), c2 = unstructured_control(control_graph(s2));

load_ctrl_graph work only if full_control_graph is called before and clean_ctrl_graph is called after

printf(stderr, "TEST......\n");

printf(stderr, "START.....\n"); safe_print_statement(s1); safe_print_statement(s); statement_exec_appro = expression_approximation(s, whileloop_condition(instruction_whileloop(statement_instruction(s))));

consideration of parameters here

printf(stderr, "TEST......\n");

printf(stderr, "START.....\n"); safe_print_statement(s2); safe_print_statement(s); statement_exec_appro = expression_approximation(s, whileloop_condition(instruction_whileloop(statement_instruction(s))));

consideration of parameters here

Definition at line 408 of file impact_check.c.

409 {
412  Psysteme precondition_ps = predicate_system(transformer_relation(pre));
413  if (normalized_linear_p(n))
414  {
416  Pcontrainte volatile pc = contrainte_make(pv);
417  /* Automatic variables read in a CATCH block need to be declared volatile as
418  * specified by the documentation*/
419  Psysteme volatile ps = sc_dup(precondition_ps);
420  sc_add_ineg(ps, pc);
422  sc_rm(ps);
423  return MAY_APPROXIMATION;
424  }
425  TRY {
426  bool n_positif, n_negatif;
427  n_negatif = sc_rational_feasibility_ofl_ctrl(ps,FWD_OFL_CTRL,true);
428  (void) vect_chg_sgn(pv);
429  n_positif = sc_rational_feasibility_ofl_ctrl(ps,FWD_OFL_CTRL,true);
430  fprintf(stderr, "n_negatif : %s\n", n_negatif ? "TRUE" : "FALSE");
431  fprintf(stderr, "n_positif : %s\n", n_positif ? "TRUE" : "FALSE");
433  }
434  sc_rm(ps);
435  }
436  return MAY_APPROXIMATION;
437 }
#define CATCH(what)
@ overflow_error
#define UNCATCH(what)
#define TRY
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
#define MAY_APPROXIMATION
Definition: impact_check.c:35
#define NORMALIZE_EXPRESSION(e)
#define normalized_linear_p(x)
Definition: ri.h:1779
#define transformer_relation(x)
Definition: ri.h:2873
#define normalized_linear(x)
Definition: ri.h:1781
#define predicate_system(x)
Definition: ri.h:2069
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Definition: sc_alloc.c:277
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
transformer load_statement_precondition(statement)
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
#define FWD_OFL_CTRL
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51

References CATCH, contrainte_make(), fprintf(), FWD_OFL_CTRL, load_statement_precondition(), MAY_APPROXIMATION, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, overflow_error, predicate_system, sc_dup(), sc_rational_feasibility_ofl_ctrl(), sc_rm(), transformer_relation, TRY, UNCATCH, vect_chg_sgn(), and vect_dup().

+ Here is the call graph for this function:

◆ check_for_effected_statement()

static void check_for_effected_statement ( statement  s,
list  le 
)
static

default value of dependence : MAY

used for remember to rebuild the list of read statements for alias_ent1

new flow-dependence created

witch (control_approximation_between_statement_p(sw2, s)) {

dependence does not exist so no impact alias

used for remember to rebuild the list of write statements for alias_ent1

new anti-dependence created

witch (control_approximation_between_statement_p(sr2, s)) {

dependence does not exist so don't the impact alias

new output-dependence created

witch (control_approximation_between_statement_p(sw2, s)) {

dependence does not exist so don't the impact alias

rebuild the list of read statements for alias_ent2

new flow-dependence created

witch (control_approximation_between_statement_p(sw1, s)) {

dependence does not exist so don't the impact alias

rebuild the list of write statements for alias_ent2

new anti-dependence created

witch(control_approximation_between_statement_p(sr1, s)) {

dependence does not exist so don't the impact alias

new output-dependence created

witch (control_approximation_between_statement_p(sw1, s)) {

dependence does not exist so don't the impact alias

Definition at line 707 of file impact_check.c.

708 {
709  set arcs_processed_set = set_make(set_pointer);
710  list stat_reads1_old = gen_copy_seq(stat_reads1);
711  list stat_writes1_old = gen_copy_seq(stat_writes1);
712  list stat_reads2_old = gen_copy_seq(stat_reads2);
713  list stat_writes2_old = gen_copy_seq(stat_writes2);
714 
715  MAP(EFFECT, eff, {
717  action act_dest = effect_action(eff);
718  bool impact_must_p = false; /* default value of dependence : MAY */
719  effect eff_tmp;
720 
721  if (entities_may_conflict_p(ent_dest, alias_ent1)) {
722  if (action_read_p(act_dest)) {
724  /* used for remember to rebuild the list of read statements for alias_ent1 */
725  stat_reads1 = CONS(STATEMENT, s, NIL);
726  MAP(STATEMENT, sw2, {
727  if (!statement_undefined_p(sw2)) { /* new flow-dependence created */
728  set_clear(arcs_processed_set);
729  if (!find_covering_reference_path(arcs_processed_set,
731  s, act_dest, alias_ent1))
732  {
734  /*switch (control_approximation_between_statement_p(sw2, s)) {*/
735  switch(MUST_APPROXIMATION) {
736  case MUST_APPROXIMATION:
738  if (!effect_undefined_p(eff_tmp))
739  impact_must_p = approximation_exact_p(effect_approximation(eff_tmp));
740  impact_must_p = impact_must_p &&
742  insert_impact_description_as_comment(sw2, s, impact_must_p, DEP_FLOW);
743  break;
744  case MAY_APPROXIMATION:
746  break;
747  case NOT_APPROXIMATION:
748  /* dependence does not exist so no impact alias*/
749  break;
750  }
751  }
752  }
753  }, stat_writes2_old);
754  } else {
756  /* used for remember to rebuild the list of write statements for alias_ent1 */
758  MAP(STATEMENT, sr2, {
759  if (!statement_undefined_p(sr2)) { /* new anti-dependence created */
760  set_clear(arcs_processed_set);
761  if (!find_covering_reference_path(arcs_processed_set,
763  s, act_dest, alias_ent1))
764  {
766  /*switch (control_approximation_between_statement_p(sr2, s)) {*/
767  switch(MUST_APPROXIMATION) {
768  case MUST_APPROXIMATION:
770  if (!effect_undefined_p(eff_tmp))
771  impact_must_p = approximation_exact_p(effect_approximation(eff_tmp));
772  impact_must_p = impact_must_p &&
774  insert_impact_description_as_comment(sr2, s, impact_must_p, DEP_ANTI);
775  break;
776  case MAY_APPROXIMATION:
778  break;
779  case NOT_APPROXIMATION:
780  /* dependence does not exist so don't the impact alias*/
781  break;
782  }
783  }
784  }
785  }, stat_reads2_old);
786  MAP(STATEMENT, sw2, {
787  if (!statement_undefined_p(sw2)) { /* new output-dependence created */
788  set_clear(arcs_processed_set);
789  if (!find_covering_reference_path(arcs_processed_set,
791  s, act_dest, alias_ent1))
792  {
794  /*switch (control_approximation_between_statement_p(sw2, s)) {*/
795  switch(MUST_APPROXIMATION) {
796  case MUST_APPROXIMATION:
798  if (!effect_undefined_p(eff_tmp))
799  impact_must_p = approximation_exact_p(effect_approximation(eff_tmp));
800  impact_must_p = impact_must_p &&
802  insert_impact_description_as_comment(sw2, s, impact_must_p, DEP_OUTP);
803  break;
804  case MAY_APPROXIMATION:
806  break;
807  case NOT_APPROXIMATION:
808  /* dependence does not exist so don't the impact alias*/
809  break;
810  }
811  }
812  }
813  }, stat_writes2_old);
814  }
815  }
816  if (entities_may_conflict_p(ent_dest, alias_ent2)) {
817  if (action_read_p(act_dest)) {
819  /* rebuild the list of read statements for alias_ent2 */
820  stat_reads2 = CONS(STATEMENT, s, NIL);
821  MAP(STATEMENT, sw1, {
822  if (!statement_undefined_p(sw1)) { /* new flow-dependence created */
823  set_clear(arcs_processed_set);
824  if (!find_covering_reference_path(arcs_processed_set,
826  s, act_dest, alias_ent2))
827  {
829  /*switch (control_approximation_between_statement_p(sw1, s)) {*/
830  switch(MUST_APPROXIMATION) {
831  case MUST_APPROXIMATION:
833  if (!effect_undefined_p(eff_tmp))
834  impact_must_p = approximation_exact_p(effect_approximation(eff_tmp));
835  impact_must_p = impact_must_p &&
837  insert_impact_description_as_comment(sw1, s, impact_must_p, DEP_FLOW);
838  break;
839  case MAY_APPROXIMATION:
841  break;
842  case NOT_APPROXIMATION:
843  /* dependence does not exist so don't the impact alias*/
844  break;
845  }
846  }
847  }
848  }, stat_writes1_old);
849  } else {
851  /* rebuild the list of write statements for alias_ent2 */
853  MAP(STATEMENT, sr1, {
854  if (!statement_undefined_p(sr1)) { /* new anti-dependence created */
855  set_clear(arcs_processed_set);
856  if (!find_covering_reference_path(arcs_processed_set,
858  s, act_dest, alias_ent2))
859  {
861  /*switch(control_approximation_between_statement_p(sr1, s)) {*/
862  switch(MUST_APPROXIMATION) {
863  case MUST_APPROXIMATION:
865  if (!effect_undefined_p(eff_tmp))
866  impact_must_p = approximation_exact_p(effect_approximation(eff_tmp));
867  impact_must_p = impact_must_p &&
869  insert_impact_description_as_comment(sr1, s, impact_must_p, DEP_ANTI);
870  break;
871  case MAY_APPROXIMATION:
873  break;
874  case NOT_APPROXIMATION:
875  /* dependence does not exist so don't the impact alias*/
876  break;
877  }
878  }
879  }
880  }, stat_reads1_old);
881  MAP(STATEMENT, sw1, {
882  if (!statement_undefined_p(sw1)) { /* new output-dependence created */
883  set_clear(arcs_processed_set);
884  if (!find_covering_reference_path(arcs_processed_set,
886  s, act_dest, alias_ent2))
887  {
889  /*switch (control_approximation_between_statement_p(sw1, s)) {*/
890  switch(MUST_APPROXIMATION) {
891  case MUST_APPROXIMATION:
893  if (!effect_undefined_p(eff_tmp))
894  impact_must_p = approximation_exact_p(effect_approximation(eff_tmp));
895  impact_must_p = impact_must_p &&
897  insert_impact_description_as_comment(sw1, s, impact_must_p, DEP_OUTP);
898  break;
899  case MAY_APPROXIMATION:
901  break;
902  case NOT_APPROXIMATION:
903  /* dependence does not exist so don't the impact alias*/
904  break;
905  }
906  }
907  }
908  }, stat_writes1_old);
909  }
910  }
911  }, le);
912  set_free(arcs_processed_set);
913  gen_free_list(stat_reads1_old);
914  gen_free_list(stat_writes1_old);
915  gen_free_list(stat_reads2_old);
916  gen_free_list(stat_writes2_old);
917  return;
918 }
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
action make_action_write_memory(void)
To ease the extension of action with action_kind.
Definition: effects.c:1011
action make_action_read_memory(void)
Definition: effects.c:1017
#define effect_undefined_p(x)
Definition: effects.h:615
#define approximation_exact_p(x)
Definition: effects.h:369
#define effect_action(x)
Definition: effects.h:642
#define action_read_p(x)
Definition: effects.h:311
#define effect_approximation(x)
Definition: effects.h:644
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
bool entities_may_conflict_p(entity e1, entity e2)
Check if two entities may conflict.
Definition: conflicts.c:984
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#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
static list stat_reads2
list of statement_approximation_p
Definition: impact_check.c:48
#define MUST_APPROXIMATION
Definition: impact_check.c:34
static effect get_effect_read_of_statement_on_variable(statement s, entity var)
Definition: impact_check.c:388
#define DEP_OUTP
Definition: impact_check.c:32
static entity alias_ent1
data dependence graph
Definition: impact_check.c:44
static void insert_impact_description_as_comment(statement s1, statement s2, bool impact_must_p, int dep_type)
Definition: impact_check.c:338
bool find_covering_reference_path(set arcs_processed_set, statement s_src, action act_src, entity ent_src, statement s_dest, action act_dest, entity ent_dest)
Check to see if new dependence is covered by arcs in dependence graph at reference level.
Definition: impact_check.c:238
#define DEP_ANTI
Definition: impact_check.c:31
static list stat_writes1
list of statement_approximation_p
Definition: impact_check.c:47
static int number_of_impact_alias
Definition: impact_check.c:59
static entity alias_ent2
Definition: impact_check.c:45
static effect get_effect_write_of_statement_on_variable(statement s, entity var)
Definition: impact_check.c:398
#define DEP_FLOW
Definition: impact_check.c:30
static list stat_reads1
Definition: impact_check.c:46
#define NOT_APPROXIMATION
Definition: impact_check.c:36
static list stat_writes2
list of statement_approximation_p
Definition: impact_check.c:49
void set_free(set)
Definition: set.c:332
set set_clear(set)
Assign the empty set to s s := {}.
Definition: set.c:326
@ set_pointer
Definition: newgen_set.h:44
set set_make(set_type)
Create an empty set of any type but hash_private.
Definition: set.c:102
#define reference_variable(x)
Definition: ri.h:2326
#define statement_undefined_p(x)
Definition: ri.h:2420
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References action_read_p, alias_ent1, alias_ent2, approximation_exact_p, CONS, DEP_ANTI, DEP_FLOW, DEP_OUTP, EFFECT, effect_action, effect_any_reference, effect_approximation, effect_undefined_p, entities_may_conflict_p(), find_covering_reference_path(), gen_copy_seq(), gen_free_list(), get_effect_read_of_statement_on_variable(), get_effect_write_of_statement_on_variable(), insert_impact_description_as_comment(), make_action_read_memory(), make_action_write_memory(), MAP, MAY_APPROXIMATION, MUST_APPROXIMATION, NIL, NOT_APPROXIMATION, number_of_impact_alias, reference_variable, set_clear(), set_free(), set_make(), set_pointer, stat_reads1, stat_reads2, stat_writes1, stat_writes2, STATEMENT, and statement_undefined_p.

Referenced by check_new_arc_for_structured_statement().

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

◆ check_new_arc_for_structured_statement()

static void check_new_arc_for_structured_statement ( statement  s)
static

of effects

of effects

precondition is used to determine if the statement is executed

f (!statement_feasible_p(s)) return;

save the old read, write statements

read, write statements may be modified after the line below

store the new version

restore the old version

read, write statements may be modified after the line below

afe_print_statement(s); switch (loop_executed_approximation(s)) { case MUST_BE_EXECUTED: fprintf(stderr, "MUST_BE_EXECUTED\n"); break; case MAY_BE_EXECUTED: fprintf(stderr, "MAY_BE_EXECUTED\n"); break; case MUST_NOT_BE_EXECUTED: fprintf(stderr, "MUST_NOT_BE_EXECUTED\n"); break; }

consideration of parameters here

Definition at line 920 of file impact_check.c.

921 {
922  instruction istat;
923  list /* of effects */ le = NIL;
924  list /* of effects */ l = NIL;
925  list blocs = NIL;
926 
927  if ((statement_undefined_p(s)) || (s == NULL)) return;
928 
929  /* precondition is used to determine if the statement is executed */
930  /*if (!statement_feasible_p(s)) return;*/
931 
932  istat = statement_instruction(s);
933 
934  switch(instruction_tag(istat)) {
936  MAP(STATEMENT, s,
938  instruction_block(istat));
939  break;
940  case is_instruction_test:
941  {
942  list stat_reads1_true = NIL;
943  list stat_reads2_true = NIL;
944  list stat_writes1_true = NIL;
945  list stat_writes2_true = NIL;
946 
947  list stat_reads1_old = NIL;
948  list stat_reads2_old = NIL;
949  list stat_writes1_old = NIL;
950  list stat_writes2_old = NIL;
951 
954 
955  /* save the old read, write statements */
956  stat_reads1_old = gen_copy_seq(stat_reads1);
957  stat_reads2_old = gen_copy_seq(stat_reads2);
958  stat_writes1_old = gen_copy_seq(stat_writes1);
959  stat_writes2_old = gen_copy_seq(stat_writes2);
960 
961  /* read, write statements may be modified after the line below */
963 
964  /* store the new version */
965  stat_reads1_true = stat_reads1;
966  stat_reads2_true = stat_reads2;
967  stat_writes1_true = stat_writes1;
968  stat_writes2_true = stat_writes2;
969 
970  /* restore the old version */
971  stat_reads1 = stat_reads1_old;
972  stat_reads2 = stat_reads2_old;
973  stat_writes1 = stat_writes1_old;
974  stat_writes2 = stat_writes2_old;
975 
976  stat_reads1_old = NIL;
977  stat_reads2_old = NIL;
978  stat_writes1_old = NIL;
979  stat_writes2_old = NIL;
980 
981  /* read, write statements may be modified after the line below */
983 
984  stat_reads1 = union_list(stat_reads1, stat_reads1_true);
985  stat_reads2 = union_list(stat_reads2, stat_reads2_true);
986  stat_writes1 = union_list(stat_writes1, stat_writes1_true);
987  stat_writes2 = union_list(stat_writes2, stat_writes2_true);
988 
989  gen_free_list(stat_reads1_true);
990  gen_free_list(stat_reads2_true);
991  gen_free_list(stat_writes1_true);
992  gen_free_list(stat_writes2_true);
993 
994  break;
995  }
996  case is_instruction_loop:
997  /*safe_print_statement(s);
998  switch (loop_executed_approximation(s)) {
999  case MUST_BE_EXECUTED:
1000  fprintf(stderr, "MUST_BE_EXECUTED\n");
1001  break;
1002  case MAY_BE_EXECUTED:
1003  fprintf(stderr, "MAY_BE_EXECUTED\n");
1004  break;
1005  case MUST_NOT_BE_EXECUTED:
1006  fprintf(stderr, "MUST_NOT_BE_EXECUTED\n");
1007  break;
1008  }*/
1011  le = union_list(le, l);
1013  le = union_list(le, l);
1016  break;
1021  break;
1022  case is_instruction_goto:
1024  break;
1026  CONTROL_MAP(c, {
1027  fprintf(stderr, "i am here UNSTRUCTURED ");
1031  gen_free_list(blocs);
1032  break;
1033  case is_instruction_call:
1034  /* consideration of parameters here */
1036  break;
1037  default:
1038  pips_internal_error("case default reached");
1039  break;
1040  }
1041 }
list proper_effects_of_expression(expression)
list statement_to_effects(statement)
#define CONTROL_MAP(ctl, code, c, list)
Macro to walk through all the controls reachable from a given control node of an unstructured.
static void check_new_arc_for_structured_statement(statement s)
Definition: impact_check.c:920
static void check_for_effected_statement(statement s, list le)
Definition: impact_check.c:707
list union_list(list l1, list l2)
Union is not typed...
Definition: impact_check.c:376
#define pips_internal_error
Definition: misc-local.h:149
void safe_print_statement(statement)
Definition: statement.c:140
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
#define loop_body(x)
Definition: ri.h:1644
#define range_upper(x)
Definition: ri.h:2290
#define instruction_loop(x)
Definition: ri.h:1520
#define instruction_goto(x)
Definition: ri.h:1526
#define test_false(x)
Definition: ri.h:2837
#define range_increment(x)
Definition: ri.h:2292
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define test_true(x)
Definition: ri.h:2835
#define test_condition(x)
Definition: ri.h:2833
#define instruction_whileloop(x)
Definition: ri.h:1523
#define range_lower(x)
Definition: ri.h:2288
#define whileloop_body(x)
Definition: ri.h:3162
#define statement_instruction(x)
Definition: ri.h:2458
#define loop_range(x)
Definition: ri.h:1642
#define control_statement(x)
Definition: ri.h:941
#define instruction_test(x)
Definition: ri.h:1517
#define whileloop_condition(x)
Definition: ri.h:3160
#define instruction_unstructured(x)
Definition: ri.h:1532

References check_for_effected_statement(), CONTROL_MAP, control_statement, fprintf(), gen_copy_seq(), gen_free_list(), instruction_block, instruction_goto, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, loop_body, loop_range, MAP, NIL, pips_internal_error, proper_effects_of_expression(), range_increment, range_lower, range_upper, safe_print_statement(), stat_reads1, stat_reads2, stat_writes1, stat_writes2, STATEMENT, statement_instruction, statement_to_effects(), statement_undefined_p, test_condition, test_false, test_true, union_list(), unstructured_control, whileloop_body, and whileloop_condition.

Referenced by impact_check_two_scalar_variables_in_path().

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

◆ check_way_between_two_statements()

bool check_way_between_two_statements ( statement  s1,
statement  s2,
graph  g 
)

Check to see if there is a directed way between 2 statements in the graph specified.

Parameters
s11
s22

Definition at line 290 of file impact_check.c.

291 {
292  vertex v1 = statement_to_vertex(s1, g);
293  list vertex_processed_list = NIL;
294  list vertex_rest_list = NIL;
295  ADD_ELEMENT_TO_LIST(vertex_rest_list, VERTEX, v1);
296 
297  while(!ENDP(vertex_rest_list)) {
298  vertex v = VERTEX(CAR(vertex_rest_list));
299  POP(vertex_rest_list);
300  if (!gen_in_list_p(v, vertex_processed_list)) {
302  if (statement_equal_p(sv, s2))
303  return true;
304  else {
305  ADD_ELEMENT_TO_LIST(vertex_processed_list, VERTEX, v);
306  MAP(SUCCESSOR, su, {
307  vertex v2 = successor_vertex(su);
308  if (!gen_in_list_p(v2, vertex_processed_list) && !gen_in_list_p(v2, vertex_rest_list))
309  ADD_ELEMENT_TO_LIST(vertex_rest_list, VERTEX, v2);
310  }, vertex_successors(v));
311  }
312  }
313  }
314  return false;
315 }
#define successor_vertex(x)
Definition: graph.h:118
#define vertex_successors(x)
Definition: graph.h:154
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
#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
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
Definition: list.c:734
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
Definition: util.c:45
static bool statement_equal_p(statement s1, statement s2)
Definition: impact_check.c:222
static vertex statement_to_vertex(statement s, graph g)
Definition: impact_check.c:227
s1
Definition: set.c:247

References ADD_ELEMENT_TO_LIST, CAR, ENDP, gen_in_list_p(), MAP, NIL, POP, s1, statement_equal_p(), statement_to_vertex(), SUCCESSOR, successor_vertex, VERTEX, vertex_successors, and vertex_to_statement().

+ Here is the call graph for this function:

◆ create_or_get_a_set_from_control()

static set create_or_get_a_set_from_control ( control  c,
hash_table  control_to_set_of_dominators 
)
static

Definition at line 513 of file impact_check.c.

515 {
516  if (!hash_defined_p(control_to_set_of_dominators, (char *)c))
517  {
518  set dominator = set_make(set_pointer);
519  hash_put(control_to_set_of_dominators, (char *)c, (char *)dominator);
520  return dominator;
521  }
522  else
523  return (set) hash_get(control_to_set_of_dominators, (char *)c);
524 }
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
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
bool hash_defined_p(const hash_table htp, const void *key)
true if key has e value in htp.
Definition: hash.c:484

References hash_defined_p(), hash_get(), hash_put(), set_make(), and set_pointer.

+ Here is the call graph for this function:

◆ display_impact_alias_statistics()

static void display_impact_alias_statistics ( )
static

Definition at line 61 of file impact_check.c.

62 {
63  user_log("\n Number of processed modules: %d", number_of_processed_modules);
64  user_log("\n Number of impact alias: %d\n", number_of_impact_alias);
65 }
void user_log(const char *format,...)
Definition: message.c:234
static int number_of_processed_modules
Definition: impact_check.c:58

References number_of_impact_alias, number_of_processed_modules, and user_log().

Referenced by impact_check().

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

◆ dynamic_checked_p()

static bool dynamic_checked_p ( entity  e1,
entity  e2 
)
static

Definition at line 1153 of file impact_check.c.

1154 {
1155  MAP(DYNAMIC_CHECK, dc, {
1156  if ((dynamic_check_first(dc)==e1)&&(dynamic_check_second(dc)==e2))
1157  return dynamic_check_checked(dc);
1158  }, l_dynamic_check);
1159  return false;
1160 }
#define dynamic_check_second(x)
#define dynamic_check_checked(x)
#define dynamic_check_first(x)
#define DYNAMIC_CHECK(x)
DYNAMIC_CHECK.
static list l_dynamic_check
This list tells us if two variables have been checked dynamically or not.
Definition: impact_check.c:53

References DYNAMIC_CHECK, dynamic_check_checked, dynamic_check_first, dynamic_check_second, l_dynamic_check, and MAP.

Referenced by impact_check().

+ Here is the caller graph for this function:

◆ find_covering_reference_path()

bool find_covering_reference_path ( set  arcs_processed_set,
statement  s_src,
action  act_src,
entity  ent_src,
statement  s_dest,
action  act_dest,
entity  ent_dest 
)

Check to see if new dependence is covered by arcs in dependence graph at reference level.

impact_check.c

Parameters
arcs_processed_setrcs_processed_set
s_src_src
act_srcct_src
ent_srcnt_src
s_dest_dest
act_destct_dest
ent_destnt_dest

Definition at line 238 of file impact_check.c.

245 {
246  if (statement_equal_p(s_src, s_dest))
247  {
248  if (entities_may_conflict_p(ent_src, ent_dest))
249  return (action_write_p(act_dest) || action_read_p(act_src));
250  else
251  return (action_write_p(act_dest) && action_read_p(act_src));
252  }
253  else
254  {
255  vertex ver_src = statement_to_vertex(s_src, dg);
256  MAP(SUCCESSOR, su, {
259  MAP(CONFLICT, c, {
260  effect e_tmp_src = conflict_source(c);
261  effect e_tmp_dest = conflict_sink(c);
262  entity ent_tmp_src = reference_variable(effect_any_reference(e_tmp_src));
263  entity ent_tmp_dest = reference_variable(effect_any_reference(e_tmp_dest));
264  action act_tmp_src = effect_action(e_tmp_src);
265  action act_tmp_dest = effect_action(e_tmp_dest);
266  set arcs_processed_tmp_set = set_make(set_pointer);
267  if (set_belong_p(arcs_processed_set, (char *)c)) continue;
268  arcs_processed_tmp_set = set_add_element(arcs_processed_tmp_set, arcs_processed_set, (char *)c);
269  if (entities_may_conflict_p(ent_src, ent_tmp_src))
270  {
271  if (action_write_p(act_tmp_src) || action_read_p(act_src))
272  if (find_covering_reference_path(arcs_processed_tmp_set,
273  s_tmp, act_tmp_dest, ent_tmp_dest,
274  s_dest, act_dest, ent_dest)) return true;
275  }
276  else
277  {
278  if (action_write_p(act_tmp_src) && action_read_p(act_src))
279  if (find_covering_reference_path(arcs_processed_tmp_set,
280  s_tmp, act_tmp_dest, ent_tmp_dest,
281  s_dest, act_dest, ent_dest)) return true;
282  }
283  }, dg_arc_label_conflicts(dal));
284  }, vertex_successors(ver_src));
285  }
286  return false;
287 }
struct _newgen_struct_dg_arc_label_ * dg_arc_label
Definition: dg.h:60
#define conflict_sink(x)
Definition: dg.h:167
#define CONFLICT(x)
CONFLICT.
Definition: dg.h:134
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define conflict_source(x)
Definition: dg.h:165
#define action_write_p(x)
Definition: effects.h:314
#define successor_arc_label(x)
Definition: graph.h:116
static graph dg
Definition: impact_check.c:43
bool set_belong_p(const set, const void *)
Definition: set.c:194
set set_add_element(set, const set, const void *)
Definition: set.c:152

References action_read_p, action_write_p, CONFLICT, conflict_sink, conflict_source, dg, dg_arc_label_conflicts, effect_action, effect_any_reference, entities_may_conflict_p(), MAP, reference_variable, set_add_element(), set_belong_p(), set_make(), set_pointer, statement_equal_p(), statement_to_vertex(), SUCCESSOR, successor_arc_label, successor_vertex, vertex_successors, and vertex_to_statement().

Referenced by check_for_effected_statement().

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

◆ get_effect_read_of_statement_on_variable()

static effect get_effect_read_of_statement_on_variable ( statement  s,
entity  var 
)
static

Definition at line 388 of file impact_check.c.

389 {
390  MAP(EFFECT, eff, {
393  return eff;
394  }, statement_to_effects(s));
395  return NULL;
396 }

References action_read_p, EFFECT, effect_action, effect_any_reference, entities_may_conflict_p(), MAP, reference_variable, and statement_to_effects().

Referenced by check_for_effected_statement().

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

◆ get_effect_write_of_statement_on_variable()

static effect get_effect_write_of_statement_on_variable ( statement  s,
entity  var 
)
static

Definition at line 398 of file impact_check.c.

399 {
400  MAP(EFFECT, eff, {
403  return eff;
404  }, statement_to_effects(s));
405  return NULL;
406 }

References action_write_p, EFFECT, effect_action, effect_any_reference, entities_may_conflict_p(), MAP, reference_variable, and statement_to_effects().

Referenced by check_for_effected_statement().

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

◆ impact_check()

bool impact_check ( char *  module_name)

ash_table control_to_set_of_dominators = hash_table_make(hash_pointer, 0);

ull_control_graph(module_name);

omputing_dominators(control_to_set_of_dominators, load_ctrl_graph(mod_stat));

set_precondition_map((statement_mapping) db_get_memory_resource(DBR_PRECONDITIONS, module_name, true));

Looking for another formal variable in the list of alias associations that has same section and included call path. If this variable is checked dynamically with e1 => no need to continue

Looking for common variables in module or callee of modules to check for alias impact ...

formal parameter has a same section with other common variable

If u1 is defined (different to -1) and u1<l2, there is no alias impact The same for: l1 is defined (different to -1) and u2<l1

The common variable always have a good offset off2

ash_table_free(control_to_set_of_dominators);

lean_ctrl_graph();

eset_precondition_map();

Parameters
module_nameodule_name

Definition at line 1242 of file impact_check.c.

1243 {
1245  /*hash_table control_to_set_of_dominators = hash_table_make(hash_pointer, 0);*/
1246 
1249 
1250  debug_on("RICEDG_DEBUG_LEVEL");
1251 
1252 
1254  db_get_memory_resource(DBR_ALIAS_ASSOCIATIONS,
1255  module_name, true));
1256 
1257  if (l_module_aliases != NIL) {
1258  dg = (graph) db_get_memory_resource(DBR_DG, module_name, true);
1259  /*full_control_graph(module_name);*/
1262 
1265 
1266  /*computing_dominators(control_to_set_of_dominators, load_ctrl_graph(mod_stat));
1267 
1268  set_precondition_map((statement_mapping)
1269  db_get_memory_resource(DBR_PRECONDITIONS,
1270  module_name,
1271  true));*/
1272  while (!ENDP(l_module_aliases)) {
1275  entity sec1 = alias_association_section(aa1);
1276  list path1 = alias_association_call_chain(aa1);
1278  int l1 = alias_association_lower_offset(aa1);
1279  int u1 = alias_association_upper_offset(aa1);
1281 
1282  /* Looking for another formal variable in the list of alias
1283  associations that has same section and included call path.
1284  If this variable is checked dynamically with e1 => no need
1285  to continue */
1286  MAP(ALIAS_ASSOCIATION, aa2, {
1288  entity sec2 = alias_association_section(aa2);
1289  list path2 = alias_association_call_chain(aa2);
1290  if (!same_entity_p(e1,e2) && same_entity_p(sec1,sec2) &&
1291  !dynamic_checked_p(e1, e2) && included_call_chain_p(path1,path2)) {
1292 
1293  int l2 = alias_association_lower_offset(aa2);
1294  int u2 = alias_association_upper_offset(aa2);
1295 
1296  if (((u1==-1)||(u1>=l2))&&((u2==-1)||(u2>=l1))) {
1298  if (gen_length(path1) < gen_length(path2))
1299  impact_check_two_variables(e1, e2, off1, off2, path2);
1300  else
1301  impact_check_two_variables(e1, e2, off1, off2, path1);
1302  }
1303  }
1304  }, l_module_aliases);
1305 
1306  /* Looking for common variables in module or callee of modules
1307  to check for alias impact ... */
1308  MAP(ENTITY, e2, {
1309  if (variable_in_common_p(e2)) {
1310  ram ra = storage_ram(entity_storage(e2));
1311  entity sec2 = ram_section(ra);
1312  if (!dynamic_checked_p(e1, e2) && same_entity_p(sec1,sec2)) {
1313  /* formal parameter has a same section with other common variable */
1314  int l2 = ram_offset(ra);
1315  int u2 = l2;
1316  if (array_entity_p(e2))
1317  {
1318  int tmp;
1319  if (SizeOfArray(e2, &tmp))
1320  u2 = tmp - SizeOfElements(variable_basic(type_variable(entity_type(e2)))) + l2;
1321  else
1322  user_log("Varying size of common variable");
1323  }
1324  /* If u1 is defined (different to -1) and u1<l2, there is no alias impact
1325  The same for: l1 is defined (different to -1) and u2<l1 */
1326  if (((u1==-1)||(u1>=l2)) && (u2>=l1)) {
1327  expression off2 = int_to_expression(l2);
1328  /* The common variable always have a good offset off2 */
1329  impact_check_two_variables(e1, e2, off1, off2, path1);
1330  }
1331  }
1332  }
1334  }
1335  l_dynamic_check = NIL;
1336 
1338 
1339  /*hash_table_free(control_to_set_of_dominators);*/
1340  /*clean_ctrl_graph();*/
1343  /*reset_precondition_map();*/
1345  }
1349 
1350  debug_off();
1351  return true;
1352 }
static list l_module_aliases
Definition: alias_check.c:124
#define alias_associations_list(x)
Definition: alias_private.h:86
#define alias_association_lower_offset(x)
#define alias_association_upper_offset(x)
#define alias_association_section(x)
#define alias_association_variable(x)
#define ALIAS_ASSOCIATION(x)
ALIAS_ASSOCIATION.
Definition: alias_private.h:90
#define alias_association_call_chain(x)
#define alias_association_offset(x)
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
size_t gen_length(const list l)
Definition: list.c:150
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
static void display_impact_alias_statistics()
Definition: impact_check.c:61
static void impact_check_two_variables(entity e1, entity e2, expression off1, expression off2, list path)
static bool dynamic_checked_p(entity e1, entity e2)
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
static void init_dynamic_check_list(entity current_mod)
static bool included_call_chain_p(list l1, list l2)
Definition: impact_check.c:80
static entity current_mod
Definition: impact_check.c:42
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
bool array_entity_p(entity e)
Definition: entity.c:793
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
code entity_code(entity e)
Definition: entity.c:1098
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
bool SizeOfArray(entity, int *)
This function computes the total size of a variable in bytes, ie.
Definition: size.c:87
bool variable_in_common_p(entity)
true if v is in a common.
Definition: variable.c:1570
_int SizeOfElements(basic)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
Definition: size.c:297
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define type_variable(x)
Definition: ri.h:2949
#define entity_storage(x)
Definition: ri.h:2794
#define code_declarations(x)
Definition: ri.h:784
#define ram_section(x)
Definition: ri.h:2249
#define entity_undefined
Definition: ri.h:2761
#define storage_ram(x)
Definition: ri.h:2521
#define entity_type(x)
Definition: ri.h:2792
#define variable_basic(x)
Definition: ri.h:3120
#define statement_undefined
Definition: ri.h:2419
#define ram_offset(x)
Definition: ri.h:2251

References ALIAS_ASSOCIATION, alias_association_call_chain, alias_association_lower_offset, alias_association_offset, alias_association_section, alias_association_upper_offset, alias_association_variable, alias_associations_list, array_entity_p(), CAR, CDR, code_declarations, current_mod, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dg, display_impact_alias_statistics(), dynamic_checked_p(), ENDP, ENTITY, entity_code(), entity_storage, entity_type, entity_undefined, gen_length(), impact_check_two_variables(), included_call_chain_p(), init_dynamic_check_list(), int_to_expression(), l_dynamic_check, l_module_aliases, local_name_to_top_level_entity(), MAP, mod_stat, module_name(), NIL, number_of_processed_modules, ram_offset, ram_section, reset_current_module_entity(), reset_ordering_to_statement(), same_entity_p(), set_current_module_entity(), set_ordering_to_statement(), SizeOfArray(), SizeOfElements(), statement_undefined, storage_ram, type_variable, user_log(), variable_basic, and variable_in_common_p().

+ Here is the call graph for this function:

◆ impact_check_in_path()

static void impact_check_in_path ( entity  e1,
entity  e2,
expression  off1,
expression  off2,
list  path 
)
static

Definition at line 1083 of file impact_check.c.

1084 {
1086  impact_check_two_scalar_variables_in_path(e1, e2, off1, off2, path);
1088  {
1089  fprintf(stderr, "alias entre variable scalaire e1 et variable tableau e2\n");
1090  impact_check_two_scalar_variables_in_path(e1, e2, off1, off2, path);
1091  }
1093  {
1094  fprintf(stderr, "alias entre variable tableau e1 et variable scalaire e2\n");
1095  impact_check_two_scalar_variables_in_path(e1, e2, off1, off2, path);
1096  }
1098  {
1099  fprintf(stderr, "alias entre 2 variables tableau\n");
1100  impact_check_two_scalar_variables_in_path(e1, e2, off1, off2, path);
1101  }
1102 }
static void impact_check_two_scalar_variables_in_path(entity e1, entity e2, expression off1, expression off2, list path)
bool entity_atomic_reference_p(entity)
Any reference r such that reference_variable(r)==e accesses all bytes (or bits) allocated to variable...
Definition: variable.c:1163

References entity_atomic_reference_p(), fprintf(), and impact_check_two_scalar_variables_in_path().

Referenced by impact_check_two_variables().

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

◆ impact_check_two_scalar_variables_in_path()

static void impact_check_two_scalar_variables_in_path ( entity  e1,
entity  e2,
expression  off1,
expression  off2,
list  path 
)
static

off1 != off2 => Okay, no alias between these 2 variables

alias

en_recurse(mod_stat, statement_domain, check_new_arc_for_structured_statement, gen_null);

Definition at line 1043 of file impact_check.c.

1044 {
1045  expression diff = eq_expression(off1, off2);
1046  clean_all_normalized(diff);
1047  ifdebug(3) {
1048  fprintf(stderr, "entity1 local name: %s\n", entity_local_name(e1));
1049  fprintf(stderr, "entity2 local name: %s\n", entity_local_name(e2));
1050  print_expression(off1);
1051  print_expression(off2);
1052  fprintf(stderr, "call path: %s\n", print_call_path(path));
1053  }
1054  if (trivial_expression_p(diff) == -1)
1055  /* off1 != off2 => Okay, no alias between these 2 variables */
1056  return;
1057  else {
1058  /* alias */
1059 
1060  alias_ent1 = e1;
1061  alias_ent2 = e2;
1062  current_path = path;
1063 
1065  /*gen_recurse(mod_stat, statement_domain, check_new_arc_for_structured_statement, gen_null);*/
1066 
1071  stat_reads1 = NIL;
1072  stat_reads2 = NIL;
1073  stat_writes1 = NIL;
1074  stat_writes2 = NIL;
1075 
1078  current_path = NIL;
1079  }
1080  return;
1081 }
static string print_call_path(list path)
This function prints the call path , including names of caller functions and orderings of call sites ...
Definition: impact_check.c:319
static list current_path
list of statement_approximation_p
Definition: impact_check.c:51
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
#define eq_expression(e1, e2)
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
void clean_all_normalized(expression e)
Definition: expression.c:4102
int trivial_expression_p(expression e)
This function returns:
Definition: expression.c:679
#define ifdebug(n)
Definition: sg.c:47

References alias_ent1, alias_ent2, check_new_arc_for_structured_statement(), clean_all_normalized(), current_path, entity_local_name(), entity_undefined, eq_expression, fprintf(), gen_free_list(), ifdebug, mod_stat, NIL, print_call_path(), print_expression(), stat_reads1, stat_reads2, stat_writes1, stat_writes2, and trivial_expression_p().

Referenced by impact_check_in_path().

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

◆ impact_check_two_variables()

static void impact_check_two_variables ( entity  e1,
entity  e2,
expression  off1,
expression  off2,
list  path 
)
static

good offset --> check

As we do not have exact offsets of variables, we have to go to the caller's frame to check for alias impact. The direct caller is CAR(call_path) because of the following concatenation in alias_propagation: path = CONS(CALL_SITE,cs,gen_full_copy_list(alias_association_call_chain(aa)));

To find a call site from its ordering, we have to do a gen_recurse in the caller module.

good offset --> check

Try with special cases : CALL FOO(R(TR(K)),R(TR(K))) ??????? Does this case exist when we create special section + offset for same actual arguments ???

use dynamic alias check

Definition at line 1192 of file impact_check.c.

1193 {
1195  if (!expression_undefined_p(off1) && !expression_undefined_p(off2)) {
1196  /* good offset --> check */
1197  impact_check_in_path(e1, e2, off1, off2, path);
1198  } else {
1199  /* As we do not have exact offsets of variables, we have to go to the
1200  caller's frame to check for alias impact. The direct caller is
1201  CAR(call_path) because of the following concatenation in alias_propagation:
1202  path = CONS(CALL_SITE,cs,gen_full_copy_list(alias_association_call_chain(aa)));
1203 
1204  To find a call site from its ordering, we have to do a gen_recurse
1205  in the caller module. */
1206  call_site cs = CALL_SITE(CAR(path));
1207  statement caller_statement;
1210  caller_statement = (statement)db_get_memory_resource(DBR_CODE,caller_name,true);
1211 
1214  gen_recurse(caller_statement,statement_domain,
1216 
1219  expression new_off1, new_off2;
1221  new_off1 = offset_in_caller(e1, cs, path);
1222  new_off2 = offset_in_caller(e2, cs, path);
1223  if (!expression_undefined_p(new_off1) && !expression_undefined_p(new_off2)) {
1224  /* good offset --> check */
1225  impact_check_in_path(e1, e2, new_off1, new_off2, path);
1226  } else {
1227  /* Try with special cases : CALL FOO(R(TR(K)),R(TR(K))) ???????
1228  Does this case exist when we create special section + offset
1229  for same actual arguments ??? */
1230  /* use dynamic alias check*/
1231  set_dynamic_checked(e1, e2);
1232  }
1234  } else
1235  pips_user_warning("Problem with statement ordering *\n");
1238  }
1239  }
1240 }
static entity current_caller
Definition: alias_check.c:121
#define CALL_SITE(x)
CALL_SITE.
#define call_site_function(x)
#define call_site_ordering(x)
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
call statement_call(statement)
Get the call of a statement.
Definition: statement.c:1406
bool statement_call_p(statement)
Definition: statement.c:364
static statement statement_in_caller
Definition: impact_check.c:55
static expression offset_in_caller(entity e, call_site cs, list path)
Definition: impact_check.c:182
static int statement_in_caller_ordering
Definition: impact_check.c:54
static bool search_statement_by_ordering_flt(statement s)
Definition: impact_check.c:213
static void impact_check_in_path(entity e1, entity e2, expression off1, expression off2, list path)
static void set_dynamic_checked(entity e1, entity e2)
static bool variable_is_written_p(entity ent)
static call current_call
Definition: impact_check.c:57
static const char * caller_name
Definition: impact_check.c:56
#define pips_user_warning
Definition: misc-local.h:146
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define expression_undefined_p(x)
Definition: ri.h:1224
#define call_undefined
Definition: ri.h:685

References CALL_SITE, call_site_function, call_site_ordering, call_undefined, caller_name, CAR, current_call, current_caller, db_get_memory_resource(), expression_undefined_p, gen_null(), gen_recurse, impact_check_in_path(), module_local_name(), offset_in_caller(), pips_user_warning, search_statement_by_ordering_flt(), set_dynamic_checked(), statement_call(), statement_call_p(), statement_domain, statement_in_caller, statement_in_caller_ordering, statement_undefined, statement_undefined_p, and variable_is_written_p().

Referenced by impact_check().

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

◆ included_call_chain_p()

static bool included_call_chain_p ( list  l1,
list  l2 
)
static

Definition at line 80 of file impact_check.c.

81 {
82  while (!ENDP(l1) && !ENDP(l2))
83  {
84  call_site cs1 = CALL_SITE(CAR(l1));
85  call_site cs2 = CALL_SITE(CAR(l2));
86  if (!same_call_site_p(cs1,cs2)) return false;
87  l1 = CDR(l1);
88  l2 = CDR(l2);
89  }
90  return true;
91 }
static bool same_call_site_p(call_site cs1, call_site cs2)
Definition: impact_check.c:70

References CALL_SITE, CAR, CDR, ENDP, and same_call_site_p().

Referenced by impact_check(), and tail_call_path_p().

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

◆ init_dynamic_check_list()

static void init_dynamic_check_list ( entity  current_mod)
static

search for formal parameters in the declaration list

Definition at line 1162 of file impact_check.c.

1163 {
1165  list l_formals = NIL;
1166  list l_commons = NIL;
1167 
1168  /* search for formal parameters in the declaration list */
1169  MAP(ENTITY, e, {
1170  if (formal_parameter_p(e))
1171  l_formals = gen_nconc(l_formals,CONS(ENTITY,e,NIL));
1172  }, l_decls);
1173 
1174  MAP(ENTITY, e, {
1175  if (variable_in_common_p(e))
1177  }, l_decls);
1178 
1179  MAP(ENTITY,e1, {
1180  MAP(ENTITY,e2, {
1181  dynamic_check dc = make_dynamic_check(e1,e2,false);
1183  }, l_formals);
1184 
1185  MAP(ENTITY,e2, {
1186  dynamic_check dc = make_dynamic_check(e1,e2,false);
1188  }, l_commons);
1189  }, l_formals);
1190 }
dynamic_check make_dynamic_check(entity a1, entity a2, bool a3)
static list l_commons
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
bool formal_parameter_p(entity)
Definition: variable.c:1489

References code_declarations, CONS, current_mod, DYNAMIC_CHECK, ENTITY, entity_code(), formal_parameter_p(), gen_nconc(), l_commons, l_dynamic_check, make_dynamic_check(), MAP, NIL, and variable_in_common_p().

Referenced by impact_check().

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

◆ insert_impact_description_as_comment()

static void insert_impact_description_as_comment ( statement  s1,
statement  s2,
bool  impact_must_p,
int  dep_type 
)
static

Definition at line 338 of file impact_check.c.

339 {
341  switch(dep_type) {
342  case DEP_FLOW:
343  insert_comments_to_statement(s2, "C\tNew flow-dependence with statement\n");
344  break;
345  case DEP_ANTI:
346  insert_comments_to_statement(s2, "C\tNew anti-dependence with statement\n");
347  break;
348  case DEP_OUTP:
349  insert_comments_to_statement(s2, "C\tNew output-dependence with statement\n");
350  break;
351  }
352  insert_comments_to_statement(s2, strdup(concatenate("C\tAttention: impact alias ",
353  impact_must_p ? "MUST":"MAY",
354  " at ",
356  " between ",
358  " and ",
360  "\n",
361  NULL)));
362  return;
363 }
void insert_comments_to_statement(statement, const char *)
Insert a comment string (if non empty) at the beginning of the comments of a statement.
Definition: statement.c:1916
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
text statement_to_text(statement)
Definition: statement.c:124
int dep_type(action, action)
int dep_type(action ac1,action ac2) This function test the type of the dependence.
Definition: testdep_util.c:378
char * strdup()
string text_to_string(text t)
SG: moved here from ricedg.
Definition: print.c:239

References alias_ent1, alias_ent2, concatenate(), current_path, DEP_ANTI, DEP_FLOW, DEP_OUTP, dep_type(), entity_local_name(), insert_comments_to_statement(), print_call_path(), s1, statement_to_text(), strdup(), and text_to_string().

Referenced by check_for_effected_statement().

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

◆ loop_executed_approximation()

static int loop_executed_approximation ( statement  s)
static

Tester le signe de l'incrï¿œment en fonction des prï¿œconditions :

Automatic variables read in a CATCH block need to be declared volatile as specified by the documentation

Vire aussi pv3 & pc3 :

le signe est dᅵterminᅵ et diffᅵrent de 0

pv = m1 - m2

pv_inverse = m2 - m1

??? on overflows, go next ...

??? on overflows, should assume MAY_BE_EXECUTED...

Definition at line 439 of file impact_check.c.

440 {
442  normalized
443  n_m1 = NORMALIZE_EXPRESSION(range_lower(rg)),
444  n_m2 = NORMALIZE_EXPRESSION(range_upper(rg)),
446 
448  Psysteme precondition_ps = predicate_system(transformer_relation(pre));
449 
450  if (normalized_linear_p(n_m1) && normalized_linear_p(n_m2) && normalized_linear_p(n_m3))
451  {
452  bool m3_negatif, m3_positif;
453  /* Tester le signe de l'incrï¿œment en fonction des prï¿œconditions : */
454  Pvecteur pv3 = vect_dup(normalized_linear(n_m3));
455  Pcontrainte pc3 = contrainte_make(pv3);
456  /* Automatic variables read in a CATCH block need to be declared volatile as
457  * specified by the documentation*/
458  Psysteme volatile ps = sc_dup(precondition_ps);
459  sc_add_ineg(ps, pc3);
461  sc_rm(ps);
462  return MAY_APPROXIMATION;
463  }
464  TRY {
465  m3_negatif = sc_rational_feasibility_ofl_ctrl(ps,FWD_OFL_CTRL,true);
466  (void) vect_chg_sgn(pv3);
467  m3_positif = sc_rational_feasibility_ofl_ctrl(ps,FWD_OFL_CTRL,true);
469  }
470  pips_debug(2, "loop_increment_value positif = %d, negatif = %d\n",
471  m3_positif, m3_negatif);
472 
473  /* Vire aussi pv3 & pc3 : */
474  sc_rm(ps);
475 
476  /* le signe est dï¿œterminï¿œ et diffï¿œrent de 0 */
477  if (m3_positif ^ m3_negatif)
478  {
479  Pvecteur pv1, pv2, pv, pv_inverse;
480  Pcontrainte c, c_inverse;
481 
482  pv1 = normalized_linear(n_m1);
483  pv2 = normalized_linear(n_m2);
484 
485  /* pv = m1 - m2 */
486  pv = vect_substract(pv1, pv2);
487  pv_inverse = vect_dup(pv);
488  /* pv_inverse = m2 - m1 */
489  (void)vect_chg_sgn(pv_inverse);
490 
491  c = contrainte_make(pv);
492  c_inverse = contrainte_make(pv_inverse);
493 
494  /* ??? on overflows, go next ... */
495  if(ineq_redund_with_sc_p(precondition_ps, c)) {
496  contrainte_free(c);
497  return (m3_positif ? MUST_APPROXIMATION : NOT_APPROXIMATION);
498  }
499  contrainte_free(c);
500 
501  /* ??? on overflows, should assume MAY_BE_EXECUTED... */
502  if(ineq_redund_with_sc_p(precondition_ps, c_inverse)) {
503  contrainte_free(c_inverse);
504  return (m3_positif ? NOT_APPROXIMATION : MUST_APPROXIMATION);
505  }
506  contrainte_free(c_inverse);
507  return MAY_APPROXIMATION;
508  }
509  }
510  return MAY_APPROXIMATION;
511 }
Pcontrainte contrainte_free(Pcontrainte c)
Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c a...
Definition: alloc.c:184
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
bool ineq_redund_with_sc_p(Psysteme sc, Pcontrainte ineq)
This function returns true if the inequation ineq is redundant for the system ps and false otherwise.
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
Definition: binaires.c:75

References CATCH, contrainte_free(), contrainte_make(), FWD_OFL_CTRL, ineq_redund_with_sc_p(), load_statement_precondition(), loop_range, MAY_APPROXIMATION, MUST_APPROXIMATION, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, NOT_APPROXIMATION, overflow_error, pips_debug, predicate_system, range_increment, range_lower, range_upper, sc_dup(), sc_rational_feasibility_ofl_ctrl(), sc_rm(), statement_loop(), transformer_relation, TRY, UNCATCH, vect_chg_sgn(), vect_dup(), and vect_substract().

+ Here is the call graph for this function:

◆ offset_in_caller()

static expression offset_in_caller ( entity  e,
call_site  cs,
list  path 
)
static

compute the subscript value, return expression_undefined if if the actual argument is a scalar variable or array name

The actual argument has a ram storage

The actual argument is a formal parameter of the current caller, we must take the alias_associations of the caller

Definition at line 182 of file impact_check.c.

183 {
184  ram ra ;
185  if (formal_parameter_p(e))
186  {
188  int rank = formal_offset(f);
189  list l_args = call_arguments(current_call);
190  expression actual_arg = find_ith_argument(l_args,rank);
191  reference actual_ref = expression_reference(actual_arg);
192  entity actual_var = reference_variable(actual_ref);
193  list l_actual_inds = reference_indices(actual_ref);
194  /* compute the subscript value, return expression_undefined if
195  if the actual argument is a scalar variable or array name*/
196  expression subval = subscript_value_stride(actual_var,l_actual_inds);
197  storage s = entity_storage(actual_var);
198  ifdebug(3)
199  fprintf(stderr, " \n Current actual argument %s",entity_name(actual_var));
200  if (storage_ram_p(s))
201  /* The actual argument has a ram storage */
202  return storage_ram_offset(s,subval);
203  if (storage_formal_p(s))
204  /* The actual argument is a formal parameter of the current caller,
205  we must take the alias_associations of the caller */
206  return storage_formal_offset(cs,actual_var,subval,path);
207  }
208  // common variable
209  ra = storage_ram(entity_storage(e));
211 }
if(!(yy_init))
Definition: genread_lex.c:1029
static expression storage_formal_offset(call_site cs, entity actual_var, expression subval, list path)
Definition: impact_check.c:142
static expression storage_ram_offset(storage s, expression subval)
Definition: impact_check.c:116
static entity rank
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
expression find_ith_argument(list args, int n)
Definition: expression.c:1147
expression subscript_value_stride(entity arr, list l_inds)
Definition: expression.c:4127
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832
#define formal_offset(x)
Definition: ri.h:1408
#define storage_formal_p(x)
Definition: ri.h:2522
#define storage_ram_p(x)
Definition: ri.h:2519
#define storage_formal(x)
Definition: ri.h:2524
#define entity_name(x)
Definition: ri.h:2790
#define reference_indices(x)
Definition: ri.h:2328
#define call_arguments(x)
Definition: ri.h:711
return(s1)
Polymorphic argument.
Definition: printf-args.h:92

References call_arguments, current_call, entity_name, entity_storage, expression_reference(), f(), find_ith_argument(), formal_offset, formal_parameter_p(), fprintf(), ifdebug, int_to_expression(), ram_offset, rank, reference_indices, reference_variable, storage_formal, storage_formal_offset(), storage_formal_p, storage_ram, storage_ram_offset(), storage_ram_p, and subscript_value_stride().

Referenced by impact_check_two_variables().

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

◆ print_call_path()

static string print_call_path ( list  path)
static

This function prints the call path , including names of caller functions and orderings of call sites in their corresponding functions.

Definition at line 319 of file impact_check.c.

320 {
321  list pc = NIL;
322  MAP(CALL_SITE,casi,
323  {
324  entity casifunc = call_site_function(casi);
325  int casiord = call_site_ordering(casi);
326  pc = CHAIN_SWORD(pc,"(");
327  pc = CHAIN_SWORD(pc,module_local_name(casifunc));
328  pc = CHAIN_SWORD(pc,":(");
329  pc = CHAIN_SWORD(pc,int2a(ORDERING_NUMBER(casiord)));
330  pc = CHAIN_SWORD(pc,",");
331  pc = CHAIN_SWORD(pc,int2a(ORDERING_STATEMENT(casiord)));
332  pc = CHAIN_SWORD(pc,")) ");
333  },path);
334  return words_to_string(pc);
335 }
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define CHAIN_SWORD(l, s)
string words_to_string(cons *lw)
Definition: print.c:211
char * int2a(int)
util.c
Definition: util.c:42

References CALL_SITE, call_site_function, call_site_ordering, CHAIN_SWORD, int2a(), MAP, module_local_name(), NIL, ORDERING_NUMBER, ORDERING_STATEMENT, and words_to_string().

Referenced by impact_check_two_scalar_variables_in_path(), and insert_impact_description_as_comment().

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

◆ same_call_site_p()

static bool same_call_site_p ( call_site  cs1,
call_site  cs2 
)
static

Definition at line 70 of file impact_check.c.

71 {
72  entity f1 = call_site_function(cs1);
74  int o1 = call_site_ordering(cs1);
75  int o2 = call_site_ordering(cs2);
76  return (same_entity_p(f1,f2) && (o1==o2));
77 }
int f2(int off1, int off2, int w, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:1

References call_site_function, call_site_ordering, f2(), and same_entity_p().

Referenced by included_call_chain_p(), and tail_call_path_p().

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

◆ search_statement_by_ordering_flt()

static bool search_statement_by_ordering_flt ( statement  s)
static

Definition at line 213 of file impact_check.c.

214 {
217  return false;
218  }
219  return true;
220 }
#define statement_ordering(x)
Definition: ri.h:2454

References statement_in_caller, statement_in_caller_ordering, and statement_ordering.

Referenced by impact_check_two_variables().

+ Here is the caller graph for this function:

◆ set_dynamic_checked()

static void set_dynamic_checked ( entity  e1,
entity  e2 
)
static

Definition at line 1144 of file impact_check.c.

1145 {
1146  MAP(DYNAMIC_CHECK,dc,
1147  {
1148  if ((dynamic_check_first(dc)==e1) && (dynamic_check_second(dc)==e2))
1149  dynamic_check_checked(dc) = true;
1150  }, l_dynamic_check);
1151 }

References DYNAMIC_CHECK, dynamic_check_checked, dynamic_check_first, dynamic_check_second, l_dynamic_check, and MAP.

Referenced by impact_check_two_variables().

+ Here is the caller graph for this function:

◆ statement_equal_p()

static bool statement_equal_p ( statement  s1,
statement  s2 
)
static

Definition at line 222 of file impact_check.c.

223 {
224  return (statement_number(s1) == statement_number(s2));
225 }
#define statement_number(x)
Definition: ri.h:2452

References s1, and statement_number.

Referenced by check_way_between_two_statements(), find_covering_reference_path(), and statement_to_vertex().

+ Here is the caller graph for this function:

◆ statement_to_vertex()

static vertex statement_to_vertex ( statement  s,
graph  g 
)
static

Definition at line 227 of file impact_check.c.

228 {
229  MAP(VERTEX, v, {
231  if (statement_equal_p(s, sv))
232  return v;
233  }, graph_vertices(g));
234  return vertex_undefined;
235 }
#define vertex_undefined
Definition: graph.h:128
#define graph_vertices(x)
Definition: graph.h:82

References graph_vertices, MAP, statement_equal_p(), VERTEX, vertex_to_statement(), and vertex_undefined.

Referenced by allocate_task_to_cluster(), bdsc_code_instrumentation(), check_way_between_two_statements(), communications_construction(), end_idle_clusters(), find_covering_reference_path(), MCW(), move_task_to_cluster(), parse_instrumented_file(), update_priority_values(), and zeroing_multiple_edges().

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

◆ storage_formal_offset()

static expression storage_formal_offset ( call_site  cs,
entity  actual_var,
expression  subval,
list  path 
)
static

Definition at line 142 of file impact_check.c.

144 {
145  list l_caller_aliases = alias_associations_list((alias_associations)
146  db_get_memory_resource(DBR_ALIAS_ASSOCIATIONS,caller_name,true));
149  {
150  entity caller_var = alias_association_variable(aa);
151  list caller_path = alias_association_call_chain(aa);
152  if (same_entity_p(caller_var,actual_var) && tail_call_path_p(cs,caller_path,path))
153  {
154  expression initial_off = alias_association_offset(aa);
155  if (!expression_undefined_p(initial_off))
156  {
157  if (expression_equal_integer_p(subval,0))
158  exp = copy_expression(initial_off);
159  else
161  copy_expression(initial_off),
162  copy_expression(subval));
163  }
164  return exp;
165  }
166  },
167  l_caller_aliases);
168  return exp;
169 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
static bool tail_call_path_p(call_site cs, list l1, list l2)
Definition: impact_check.c:99
#define PLUS_OPERATOR_NAME
#define binary_intrinsic_expression(name, e1, e2)
bool expression_equal_integer_p(expression exp, int i)
================================================================
Definition: expression.c:1977
#define expression_undefined
Definition: ri.h:1223
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References ALIAS_ASSOCIATION, alias_association_call_chain, alias_association_offset, alias_association_variable, alias_associations_list, binary_intrinsic_expression, caller_name, copy_expression(), db_get_memory_resource(), exp, expression_equal_integer_p(), expression_undefined, expression_undefined_p, MAP, PLUS_OPERATOR_NAME, same_entity_p(), and tail_call_path_p().

Referenced by offset_in_caller().

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

◆ storage_ram_offset()

static expression storage_ram_offset ( storage  s,
expression  subval 
)
static

Definition at line 116 of file impact_check.c.

117 {
118  ram r = storage_ram(s);
119  int initial_off = ram_offset(r);
120  expression exp = int_to_expression(initial_off);
121  if (!expression_equal_integer_p(subval,0))
122  {
123  if (initial_off == 0)
124  exp = copy_expression(subval);
125  else
127  int_to_expression(initial_off),
128  copy_expression(subval));
129  }
130  return exp;
131 }

References binary_intrinsic_expression, copy_expression(), exp, expression_equal_integer_p(), int_to_expression(), PLUS_OPERATOR_NAME, ram_offset, and storage_ram.

Referenced by offset_in_caller().

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

◆ tail_call_path_p()

static bool tail_call_path_p ( call_site  cs,
list  l1,
list  l2 
)
static

Definition at line 99 of file impact_check.c.

100 {
101  if (gen_length(l1) == gen_length(l2)+1)
102  {
103  call_site cs1 = CALL_SITE(CAR(l1));
104  return (same_call_site_p(cs,cs1) && included_call_chain_p(l2,CDR(l1)));
105  }
106  return false;
107 }

References CALL_SITE, CAR, CDR, gen_length(), included_call_chain_p(), and same_call_site_p().

Referenced by storage_formal_offset().

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

◆ union_list()

list union_list ( list  l1,
list  l2 
)

Union is not typed...

Parameters
l11
l22

Definition at line 376 of file impact_check.c.

376  {
377  list cl = list_undefined;
378 
379  for(cl=l2; !ENDP(cl); POP(cl)) {
380  gen_chunk * gcp = CHUNK(CAR(cl));
381  if(!gen_in_list_p(gcp , l1))
382  l1 = gen_nconc(l1, gen_cons(gcp, NIL));
383  }
384 
385  return l1;
386 }
#define CHUNK(x)
Definition: genC.h:90
list gen_cons(const void *item, const list next)
Definition: list.c:888
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
A gen_chunk is used to store every object.
Definition: genC.h:58

References CAR, CHUNK, ENDP, gen_cons(), gen_in_list_p(), gen_nconc(), list_undefined, NIL, and POP.

Referenced by check_new_arc_for_structured_statement().

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

◆ variable_is_written_by_statement_flt()

static bool variable_is_written_by_statement_flt ( statement  s)
static

This function returns true if the variable is written directly in the current module, or by its callees.

gen_recurse_stop(NULL);

Definition at line 1109 of file impact_check.c.

1110 {
1111  if (statement_call_p(s)) {
1112  list l_rw = statement_to_effects(s);
1113  MAP(EFFECT, eff, {
1114  action a = effect_action(eff);
1115  if (action_write_p(a)) {
1117  entity e = reference_variable(r);
1118  if (same_entity_p(e,current_entity)) {
1119  ifdebug(3) {
1120  fprintf(stderr,"\n Write on entity %s :\n",entity_name(e));
1121  fprintf(stderr,"\n Current entity %s :\n",entity_name(current_entity));
1122  }
1123  written = true;
1124  /* gen_recurse_stop(NULL); */
1125  return false;
1126  }
1127  }
1128  }, l_rw);
1129  return false;
1130  }
1131  return true;
1132 }
static entity current_entity
static bool written

References action_write_p, current_entity, EFFECT, effect_action, effect_any_reference, entity_name, fprintf(), ifdebug, MAP, reference_variable, same_entity_p(), statement_call_p(), statement_to_effects(), and written.

Referenced by variable_is_written_p().

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

◆ variable_is_written_p()

static bool variable_is_written_p ( entity  ent)
static

Definition at line 1134 of file impact_check.c.

1135 {
1136  written = false;
1137  current_entity = ent;
1141  return written;
1142 }
static bool variable_is_written_by_statement_flt(statement s)
This function returns true if the variable is written directly in the current module,...

References current_entity, entity_undefined, gen_null(), gen_recurse, mod_stat, statement_domain, variable_is_written_by_statement_flt(), and written.

Referenced by impact_check_two_variables().

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

Variable Documentation

◆ alias_ent1

◆ alias_ent2

◆ caller_name

const char* caller_name
static

Definition at line 56 of file impact_check.c.

Referenced by impact_check_two_variables(), and storage_formal_offset().

◆ current_call

call current_call = call_undefined
static

Definition at line 57 of file impact_check.c.

Referenced by impact_check_two_variables(), and offset_in_caller().

◆ current_entity

entity current_entity = entity_undefined
static

Definition at line 1105 of file impact_check.c.

Referenced by variable_is_written_by_statement_flt(), and variable_is_written_p().

◆ current_mod

entity current_mod = entity_undefined
static

Definition at line 42 of file impact_check.c.

Referenced by impact_check(), and init_dynamic_check_list().

◆ current_path

list current_path = NIL
static

list of statement_approximation_p

Definition at line 51 of file impact_check.c.

Referenced by impact_check_two_scalar_variables_in_path(), and insert_impact_description_as_comment().

◆ dg

graph dg = NULL
static

Definition at line 43 of file impact_check.c.

Referenced by find_covering_reference_path(), and impact_check().

◆ l_dynamic_check

list l_dynamic_check = NIL
static

This list tells us if two variables have been checked dynamically or not.

Definition at line 53 of file impact_check.c.

Referenced by dynamic_checked_p(), impact_check(), init_dynamic_check_list(), and set_dynamic_checked().

◆ mod_stat

◆ number_of_impact_alias

int number_of_impact_alias = 0
static

Definition at line 59 of file impact_check.c.

Referenced by check_for_effected_statement(), and display_impact_alias_statistics().

◆ number_of_processed_modules

int number_of_processed_modules = 0
static

Definition at line 58 of file impact_check.c.

Referenced by display_impact_alias_statistics(), and impact_check().

◆ stat_reads1

◆ stat_reads2

list stat_reads2 = NIL
static

list of statement_approximation_p

Definition at line 48 of file impact_check.c.

Referenced by check_for_effected_statement(), check_new_arc_for_structured_statement(), and impact_check_two_scalar_variables_in_path().

◆ stat_writes1

list stat_writes1 = NIL
static

list of statement_approximation_p

Definition at line 47 of file impact_check.c.

Referenced by check_for_effected_statement(), check_new_arc_for_structured_statement(), and impact_check_two_scalar_variables_in_path().

◆ stat_writes2

list stat_writes2 = NIL
static

list of statement_approximation_p

Definition at line 49 of file impact_check.c.

Referenced by check_for_effected_statement(), check_new_arc_for_structured_statement(), and impact_check_two_scalar_variables_in_path().

◆ statement_in_caller

statement statement_in_caller = statement_undefined
static

Definition at line 55 of file impact_check.c.

Referenced by impact_check_two_variables(), and search_statement_by_ordering_flt().

◆ statement_in_caller_ordering

int statement_in_caller_ordering = 0
static

Definition at line 54 of file impact_check.c.

Referenced by impact_check_two_variables(), and search_statement_by_ordering_flt().

◆ written

bool written = false
static

Definition at line 1104 of file impact_check.c.

Referenced by variable_is_written_by_statement_flt(), and variable_is_written_p().