PIPS
ricedg.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INFAISABLE   0
 Warning! Do not modify this file that is automatically generated! More...
 
#define FAISABLE   1
 
#define MAXDEPTH   9
 maximun number of nested loops More...
 
#define MAXSV   1024
 maximum number of scalar variables More...
 
#define FLOW_DEPENDANCE   1
 Definition for the dependance_verticies_p function. More...
 
#define ANTI_DEPENDANCE   2
 
#define OUTPUT_DEPENDANCE   4
 
#define INPUT_DEPENDANCE   8
 

Functions

statement vertex_to_statement (vertex)
 cproto-generated files More...
 
int vertex_ordering (vertex)
 
int compare_vertex (const void *, const void *)
 compare two vertices based on their ordering More...
 
hash_table compute_ordering_to_dg_mapping (graph)
 Define a mapping from the statement ordering to the dependence graph vertices: More...
 
int vertex_sort_callback (const vertex *, const vertex *)
 This is a callback for qsort function, it compares two vertex. More...
 
int successor_sort_callback (const successor *, const successor *)
 This is a callback for qsort function, it compares two successor. More...
 
int conflicts_sort_callback (conflict *, conflict *)
 This is a callback for qsort function, it compares two conflicts. More...
 
void prettyprint_dependence_graph (FILE *, statement, graph)
 Print all edges and arcs. More...
 
void prettyprint_dot_dependence_graph (FILE *, statement, graph)
 Output dependence graph in a file in graphviz dot format. More...
 
void prettyprint_dependence_graph_view (FILE *, statement, graph)
 Do not print vertices and arcs ignored by the parallelization algorithms. More...
 
void print_vect_in_vertice_val (FILE *, Pvecteur, Pbase)
 
void print_dependence_cone (FILE *, Ptsg, Pbase)
 
hash_table statements_to_successors (list, graph)
 creates a hash_table containing statements from statements as keys and their respective succesors according to dg as values More...
 
statement_mapping contexts_mapping_of_nest (statement)
 contexts.c More...
 
entity MakeDiVar (int)
 This function creates di variables. More...
 
entity GetDiVar (int)
 This functions looks up a di variable of nesting level l in table DiVars. More...
 
entity MakeLiVar (int)
 This function creates li variables(thee ith loop index variable). More...
 
entity GetLiVar (int)
 
entity MakeDsiVar (int)
 This function creates dsi variables. More...
 
entity GetDsiVar (int)
 
int DiVarLevel (entity)
 this function returns the nesting level of a given di variable e. More...
 
void sc_add_di (int, entity, Psysteme, int)
 
void sc_add_dsi (int, entity, Psysteme)
 
int sc_proj_on_di (int, Psysteme)
 
Pbase MakeDibaseinorder (int)
 Pbase MakeDibaseinorder(int n) make a base of D#1 ... More...
 
int FindMaximumCommonLevel (cons *, cons *)
 
void ResetLoopCounter (void)
 
entity MakeLoopCounter (void)
 Create a new loop counter variable. More...
 
int dep_type (action, action)
 int dep_type(action ac1,action ac2) This function test the type of the dependence. More...
 
int sc_proj_optim_on_di_ofl (int, Psysteme *)
 int sc_proj_optim_on_di_ofl(cl, sc)
More...
 
bool sc_faisabilite_optim (Psysteme)
 bool sc_faisabilite_optim (Psysteme sc) : More...
 
Psysteme sc_projection_optim_along_vecteur_ofl (Psysteme, Pvecteur)
 Psysteme sc_projection_optim_along_vecteur_ofl(Psysteme sc, Pvecteur pv) More...
 
bool sc_minmax_of_variable_optim (Psysteme volatile, Variable, Value *, Value *)
 void sc_minmax_of_variable_optim(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour trouver le minimum et le maximum d'une variable apparaissant dans ce systeme par projection a la Fourier-Motzkin. More...
 
Psysteme sc_invers (Psysteme)
 Psysteme sc_invers(Psysteme ps): calcul un systeme des contraintes qui est l'invers du systeme initial. More...
 
void vect_chg_var_sign (Pvecteur *, Variable)
 void vect_chg_var_sign(Pvecteur *ppv, Variable var) changement de signe de la coordonnee var du vecteur *ppv More...
 
bool context_map_undefined_p (void)
 
void set_context_map (statement_mapping)
 
statement_mapping get_context_map (void)
 
void reset_context_map (void)
 
void free_context_map (void)
 
void make_context_map (void)
 
Psysteme load_statement_context (statement)
 
void delete_statement_context (statement)
 
bool statement_context_undefined_p (statement)
 
void store_statement_context (statement, Psysteme)
 
void update_statement_context (statement, Psysteme)
 
bool rice_fast_dependence_graph (char *)
 
bool rice_full_dependence_graph (char *)
 
bool rice_semantics_dependence_graph (char *)
 
bool rice_regions_dependence_graph (char *)
 
list TestCoupleOfReferences (list, Psysteme, statement, effect, reference, list, Psysteme, statement, effect, reference, list, Ptsg *, list *, Ptsg *)
 
void writeresult (char *)
 
graph compute_dg_on_statement_from_chains_in_place (statement, graph)
 
graph compute_dg_on_statement_from_chains (statement, graph)
 
bool print_whole_dependence_graph (const string)
 prettyprint.c More...
 
bool print_filtered_dependence_graph (const string)
 
bool print_filtered_dependence_daVinci_graph (const string)
 
bool print_effective_dependence_graph (const string)
 
bool print_loop_carried_dependence_graph (const string)
 
bool print_dependence_graph (string)
 
bool print_chains_graph (string)
 
bool print_dot_chains_graph (string)
 This pipmake pass output the chains in a file usable by the graphviz tool dot. More...
 
bool print_dot_dependence_graph (string)
 This pipmake pass output the DG in a file usable by graphviz tool dot. More...
 
void quick_privatize_graph (graph)
 quick_privatize.c More...
 
vertex get_vertex_in_list (list, string)
 trace.c More...
 
void prettyprint_graph_text (FILE *, list)
 print a graph to text format More...
 
void prettyprint_graph_daVinci (FILE *, list)
 print a graph to daVinci format, each label of successor is represented by a circular node, each vertex is represented by a square node More...
 
list make_filtered_dg_or_dvdg (statement, graph)
 
bool print_filtered_dg_or_dvdg (string, bool)
 
bool print_loopnest_dependence_cone (const char *)
 
bool find_covering_reference_path (set, statement, action, entity, statement, action, entity)
 impact_check.c More...
 
bool check_way_between_two_statements (statement, statement, graph)
 Check to see if there is a directed way between 2 statements in the graph specified. More...
 
list union_list (list, list)
 Union is not typed... More...
 
bool impact_check (char *)
 

Variables

int NbrArrayDepInit
 he variables for the statistics of test of dependence and parallelization More...
 
int NbrIndepFind
 
int NbrAllEquals
 
int NbrDepCnst
 
int NbrDepExact
 
int NbrDepInexactEq
 
int NbrDepInexactFM
 
int NbrDepInexactEFM
 
int NbrScalDep
 
int NbrIndexDep
 
int deptype [5][3]
 
int constdep [5][3]
 
int NbrTestCnst
 
int NbrTestGcd
 
int NbrTestSimple
 
int NbrTestDiCnst
 by sc_normalize() More...
 
int NbrTestProjEqDi
 
int NbrTestProjFMDi
 
int NbrTestProjEq
 
int NbrTestProjFM
 
int NbrTestDiVar
 
int NbrProjFMTotal
 
int NbrFMSystNonAug
 
int FMComp [18]
 
bool is_test_exact
 or counting the number of F-M complexity less than 16. More...
 
bool is_test_inexact_eq
 
bool is_test_inexact_fm
 
bool is_dep_cnst
 
bool is_test_Di
 
bool Finds2s1
 
int Nbrdo
 loop.c More...
 
entity DiVars [9]
 testdep_util.c More...
 
entity LiVars [9]
 
entity DsiVars [1024]
 
int NbrTestExact
 

Macro Definition Documentation

◆ ANTI_DEPENDANCE

#define ANTI_DEPENDANCE   2

Definition at line 79 of file ricedg.h.

◆ FAISABLE

#define FAISABLE   1

Definition at line 33 of file ricedg.h.

◆ FLOW_DEPENDANCE

#define FLOW_DEPENDANCE   1

Definition for the dependance_verticies_p function.

Definition at line 78 of file ricedg.h.

◆ INFAISABLE

#define INFAISABLE   0

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/ricedg/ricedg-local.h instead, to add your own modifications. header file built by cproto ricedg-local.h

Definition at line 32 of file ricedg.h.

◆ INPUT_DEPENDANCE

#define INPUT_DEPENDANCE   8

Definition at line 81 of file ricedg.h.

◆ MAXDEPTH

#define MAXDEPTH   9

maximun number of nested loops

Definition at line 36 of file ricedg.h.

◆ MAXSV

#define MAXSV   1024

maximum number of scalar variables

Definition at line 38 of file ricedg.h.

◆ OUTPUT_DEPENDANCE

#define OUTPUT_DEPENDANCE   4

Definition at line 80 of file ricedg.h.

Function Documentation

◆ 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 NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#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 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
#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
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

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:

◆ compare_vertex()

int compare_vertex ( const void *  v0,
const void *  v1 
)

compare two vertices based on their ordering

Parameters
v00
v11

Definition at line 58 of file util.c.

59 {
60  const vertex V0 = *(const vertex *)v0,
61  V1 = *(const vertex *)v1;
62  if (V0==V1) return 0;
63  return vertex_ordering(V0) > vertex_ordering(V1);
64 }
int vertex_ordering(vertex v)
Definition: util.c:51

References vertex_ordering().

Referenced by do_scalar_renaming_in_graph().

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

◆ compute_dg_on_statement_from_chains()

graph compute_dg_on_statement_from_chains ( statement  s,
graph  chains 
)
Parameters
chainshains

Definition at line 2363 of file ricedg.c.

2363  {
2364  dg = copy_graph(chains);
2366 }
graph copy_graph(graph p)
GRAPH.
Definition: graph.c:20
static bool chains(char *module_name, enum chain_type use)
Compute chain dependence for a module according different kinds of store-like effects.
Definition: chains.c:1397
graph compute_dg_on_statement_from_chains_in_place(statement s, graph chains)
Definition: ricedg.c:2342
static graph dg
to map statements to enclosing loops
Definition: ricedg.c:110

References chains(), compute_dg_on_statement_from_chains_in_place(), copy_graph(), and dg.

+ Here is the call graph for this function:

◆ compute_dg_on_statement_from_chains_in_place()

graph compute_dg_on_statement_from_chains_in_place ( statement  s,
graph  chains 
)
Parameters
chainshains

Definition at line 2342 of file ricedg.c.

2342  {
2343  dg = chains;
2344  dg_type = DG_FAST; //FIXME
2345 
2346  debug_on("QUICK_PRIVATIZER_DEBUG_LEVEL");
2348  debug_off();
2349 
2350  memset(deptype,0,sizeof(deptype));
2351  memset(constdep,0,sizeof(deptype));
2352 
2353  rdg_statement(s);
2354 
2355  return dg;
2356 }
void * memset(void *str, int c, size_t len)
memset.c – set an area of memory to a given value Copyright (C) 1991, 2003, 2009-2011 Free Software F...
Definition: memset.c:23
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
void quick_privatize_graph(graph dep_graph)
quick_privatize.c
int constdep[5][3]
Definition: ricedg.c:74
static int dg_type
Definition: ricedg.c:128
#define DG_FAST
Different types of dependence tests:
Definition: ricedg.c:124
int deptype[5][3]
Definition: ricedg.c:74
static void rdg_statement(statement)
Definition: ricedg.c:409

References chains(), constdep, debug_off, debug_on, deptype, dg, DG_FAST, dg_type, memset(), quick_privatize_graph(), and rdg_statement().

Referenced by compute_dg_on_statement_from_chains().

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

◆ compute_ordering_to_dg_mapping()

hash_table compute_ordering_to_dg_mapping ( graph  dependance_graph)

Define a mapping from the statement ordering to the dependence graph vertices:

Parameters
dependance_graphependance_graph

Definition at line 70 of file util.c.

71 {
72  hash_table ordering_to_dg_mapping = hash_table_make(hash_int, 0);
73 
74  FOREACH(VERTEX, a_vertex, graph_vertices(dependance_graph))
75  {
76  pips_debug(7, "\tSuccessor list: %p for statement ordering %lld\n",
77  vertex_successors(a_vertex),
78  (long long int) dg_vertex_label_statement(vertex_vertex_label(a_vertex)));
79 
80  hash_put(ordering_to_dg_mapping,
82  (char *) a_vertex);
83  }
84 
85  return ordering_to_dg_mapping;
86 }
#define dg_vertex_label_statement(x)
Definition: dg.h:235
#define vertex_vertex_label(x)
Definition: graph.h:152
#define graph_vertices(x)
Definition: graph.h:82
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
@ hash_int
Definition: newgen_hash.h:32

References dg_vertex_label_statement, FOREACH, graph_vertices, hash_int, hash_put(), hash_table_make(), pips_debug, VERTEX, vertex_successors, and vertex_vertex_label.

+ Here is the call graph for this function:

◆ conflicts_sort_callback()

int conflicts_sort_callback ( conflict c1,
conflict c2 
)

This is a callback for qsort function, it compares two conflicts.

Returns
0 if conflicts are equals, -1 if first is lower, 1 if second is lower
Parameters
c11
c22

Definition at line 126 of file util.c.

126  {
127  int r_value = 0;
128  effect e1_sink = conflict_sink((*c1));
129  effect e2_sink = conflict_sink((*c2));
130  action a1_sink = effect_action(e1_sink);
131  action a2_sink = effect_action(e2_sink);
132  effect e1_source = conflict_source((*c1));
133  effect e2_source = conflict_source((*c2));
134  action a1_source = effect_action(e1_source);
135  action a2_source = effect_action(e2_source);
136 
137 
138 
139  string s1 = strdup(concatenate(full_action_to_short_string(a1_source),
141  NULL));
142  string s2 = strdup(concatenate(full_action_to_short_string(a2_source),
144  NULL));
145 
146  // Compare Action in lexical order
147  r_value = strcmp( s1, s2 );
148  free( s1 );
149  free( s2 );
150 
151  if ( r_value == 0 ) {
152  // Compare string representing source reference
153  reference r1_source = effect_any_reference(e1_source);
154  string s1 = words_to_string( effect_words_reference( r1_source ) );
155  reference r2_source = effect_any_reference(e2_source);
156  string s2 = words_to_string( effect_words_reference( r2_source ) );
157  r_value = strcmp( s1, s2 );
158  free( s1 );
159  free( s2 );
160  }
161  if ( r_value == 0 ) {
162  // Compare string representing sink reference
163  reference r1_sink = effect_any_reference(e1_sink);
164  string s1 = words_to_string( effect_words_reference( r1_sink ) );
165  reference r2_sink = effect_any_reference(e2_sink);
166  string s2 = words_to_string( effect_words_reference( r2_sink ) );
167  r_value = strcmp( s1, s2 );
168  free( s1 );
169  free( s2 );
170  }
171 
172  return r_value;
173 }
#define conflict_sink(x)
Definition: dg.h:167
#define conflict_source(x)
Definition: dg.h:165
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
list effect_words_reference(reference)
prettyprint.c
Definition: prettyprint.c:68
string full_action_to_short_string(action)
Definition: effects.c:969
#define effect_action(x)
Definition: effects.h:642
void free(void *)
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
char * strdup()
string words_to_string(cons *lw)
Definition: print.c:211

References concatenate(), conflict_sink, conflict_source, effect_action, effect_any_reference, effect_words_reference(), free(), full_action_to_short_string(), s1, strdup(), and words_to_string().

Referenced by prettyprint_dependence_graph(), prettyprint_dependence_graph_view(), and xml_Chain_Graph().

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

◆ context_map_undefined_p()

bool context_map_undefined_p ( void  )

◆ contexts_mapping_of_nest()

statement_mapping contexts_mapping_of_nest ( statement  stat)

contexts.c

Parameters
stattat

Definition at line 162 of file contexts.c.

164 {
165  statement_mapping contexts_map;
166 
167  pips_assert("contexts_mapping_of_nest", statement_loop_p(stat));
168 
169  contexts_map = MAKE_STATEMENT_MAPPING();
170 
171  contexts_mapping_of_statement(contexts_map, NULL, stat);
172 
173  ifdebug(8) {
175  statement stp = (statement) st;
176 
177  if (statement_call_p(stp)) {
178  fprintf(stderr, "Execution context of statement %td :\n",
179  statement_number(stp));
181  }
182  }, contexts_map);
183  }
184 
185  return(contexts_map);
186 }
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
static void contexts_mapping_of_statement(statement_mapping m, Psysteme c, statement s)
Definition: contexts.c:105
bool statement_call_p(statement)
Definition: statement.c:364
bool statement_loop_p(statement)
Definition: statement.c:349
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
#define STATEMENT_MAPPING_MAP(s, v, code, h)
Definition: newgen-local.h:53
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
#define statement_number(x)
Definition: ri.h:2452
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define ifdebug(n)
Definition: sg.c:47
Definition: delay.c:253
char *(* get_variable_name_t)(Variable)
Definition: vecteur-local.h:62

References contexts_mapping_of_statement(), entity_local_name(), fprintf(), ifdebug, MAKE_STATEMENT_MAPPING, pips_assert, sc_fprint(), statement_call_p(), statement_loop_p(), STATEMENT_MAPPING_MAP, and statement_number.

Referenced by rice_update_dependence_graph().

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

◆ delete_statement_context()

void delete_statement_context ( statement  )

◆ dep_type()

int dep_type ( action  ac1,
action  ac2 
)

int dep_type(action ac1,action ac2) This function test the type of the dependence.

ac1, ac2 are the action of two references.The representations of the result are as follows. 0 -— def-use dependence 1 -— use-def dependence 2 -— def-def dependence 3 -— use-use dependence (added in 20/01/92) FI->YY: we also have use-use dependence (also called input dependence); there is no reason to abort here; input dependences should just be ignored for parallelization, but not for tiling or cache optimization

to please gcc

Parameters
ac1c1
ac2c2

Definition at line 378 of file testdep_util.c.

379  {
380  if(action_write_p(ac1) && action_read_p(ac2))
381  return (0);
382  else if(action_read_p(ac1) && action_write_p(ac2))
383  return (1);
384  else if(action_write_p(ac1) && action_write_p(ac2))
385  return (2);
386  else if(action_read_p(ac1) && action_read_p(ac2))
387  return (3);
388  else
389  pips_internal_error("A undefined chain ---chains fault");
390 
391  /* to please gcc */
392  return -1;
393 }
#define action_write_p(x)
Definition: effects.h:314
#define action_read_p(x)
Definition: effects.h:311
#define pips_internal_error
Definition: misc-local.h:149

References action_read_p, action_write_p, and pips_internal_error.

Referenced by insert_impact_description_as_comment(), and TestCoupleOfReferences().

+ Here is the caller graph for this function:

◆ DiVarLevel()

int DiVarLevel ( entity  e)

this function returns the nesting level of a given di variable e.

Definition at line 185 of file testdep_util.c.

186  {
187  int i;
188 
189  for (i = 0; i < MAXDEPTH; i++)
190  if(e == DiVars[i])
191  return (i + 1);
192 
193  return (0);
194 }
#define MAXDEPTH
maximun number of nested loops
Definition: ricedg-local.h:28
entity DiVars[MAXDEPTH]
here is a collection of function intended to create and manipulate "di" variables and test of depende...
Definition: testdep_util.c:53

References DiVars, and MAXDEPTH.

Referenced by sc_proj_on_di(), sc_proj_optim_on_di_ofl(), and TestDependence().

+ 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 
)

impact_check.c

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(x)
CONFLICT.
Definition: dg.h:134
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define successor_arc_label(x)
Definition: graph.h:116
bool entities_may_conflict_p(entity e1, entity e2)
Check if two entities may conflict.
Definition: conflicts.c:984
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
static graph dg
Definition: impact_check.c:43
bool set_belong_p(const set, const void *)
Definition: set.c:194
@ 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
set set_add_element(set, const set, const void *)
Definition: set.c:152
#define reference_variable(x)
Definition: ri.h:2326
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59

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:

◆ FindMaximumCommonLevel()

int FindMaximumCommonLevel ( cons n1,
cons n2 
)
Parameters
n11
n22

Definition at line 307 of file testdep_util.c.

308  {
309  int cl = 0;
310 
311  while(n1 != NIL && n2 != NIL) {
312  if(LOOP(CAR(n1)) != LOOP(CAR(n2)))
313  break;
314  n1 = CDR(n1);
315  n2 = CDR(n2);
316  cl += 1;
317  }
318 
319  return (cl);
320 }
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define LOOP(x)
LOOP.
Definition: ri.h:1606

References CAR, CDR, LOOP, and NIL.

Referenced by prettyprint_dependence_graph_view(), prettyprint_dot_dependence_graph(), search_parallel_loops(), TestCoupleOfReferences(), and TestDependence().

+ Here is the caller graph for this function:

◆ free_context_map()

void free_context_map ( void  )

◆ get_context_map()

statement_mapping get_context_map ( void  )

◆ get_vertex_in_list()

vertex get_vertex_in_list ( list  in_l,
string  in_s 
)

trace.c

trace.c

Parameters
in_ln_l
in_sn_s

Definition at line 35 of file trace.c.

36 {
37  MAP(VERTEX, ver, {
38  string s = (string)vertex_vertex_label(ver);
39  if (same_string_p(in_s, s)) return ver;
40  }, in_l);
41  return vertex_undefined;
42 }
#define vertex_undefined
Definition: graph.h:128
#define same_string_p(s1, s2)
char * string
STRING.
Definition: newgen_types.h:39

References MAP, same_string_p, VERTEX, vertex_undefined, and vertex_vertex_label.

Referenced by make_filtered_dg_or_dvdg().

+ Here is the caller graph for this function:

◆ GetDiVar()

entity GetDiVar ( int  l)

This functions looks up a di variable of nesting level l in table DiVars.

di variables are created if they do not exist.

Definition at line 79 of file testdep_util.c.

80  {
81  entity e;
82 
83  if(l < 1 || l > MAXDEPTH)
84  user_error("parallelize", "too many nested loops\n");
85 
86  if((e = DiVars[l - 1]) == (entity)0) {
87  int i;
88  for (i = 0; i < MAXDEPTH; i++)
89  DiVars[i] = MakeDiVar(i + 1);
90 
91  e = DiVars[l - 1];
92  }
93 
94  return (e);
95 }
#define user_error(fn,...)
Definition: misc-local.h:265
entity MakeDiVar(int l)
This function creates di variables.
Definition: testdep_util.c:63

References DiVars, MakeDiVar(), MAXDEPTH, and user_error.

Referenced by dependence_system_add_lci_and_di(), gcd_and_constant_dependence_test(), MakeDibaseinorder(), sc_add_di(), TestDiCnst(), and TestDiVariables().

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

◆ GetDsiVar()

entity GetDsiVar ( int  l)

Definition at line 164 of file testdep_util.c.

165  {
166  entity e;
167 
168  if(l < 1 || l > MAXSV)
169  user_error("parallelize", "too many scalar variables\n");
170 
171  if((e = DsiVars[l - 1]) == (entity)0) {
172  int i;
173  for (i = 0; i < MAXSV; i++)
174  DsiVars[i] = MakeDsiVar(i + 1);
175 
176  e = DsiVars[l - 1];
177  }
178 
179  return (e);
180 }
#define MAXSV
maximum number of scalar variables
Definition: ricedg-local.h:30
entity DsiVars[MAXSV]
Definition: testdep_util.c:55
entity MakeDsiVar(int l)
This function creates dsi variables.
Definition: testdep_util.c:146

References DsiVars, MakeDsiVar(), MAXSV, and user_error.

Referenced by gcd_and_constant_dependence_test(), and sc_add_dsi().

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

◆ GetLiVar()

entity GetLiVar ( int  l)

Definition at line 121 of file testdep_util.c.

122  {
123  entity e;
124 
125  if(l < 1 || l > MAXDEPTH)
126  user_error("parallelize", "too many nested loops\n");
127 
128  if((e = LiVars[l - 1]) == (entity)0) {
129  int i;
130  for (i = 0; i < MAXDEPTH; i++)
131  LiVars[i] = MakeLiVar(i + 1);
132 
133  e = LiVars[l - 1];
134  }
135 
136  return (e);
137 }
entity MakeLiVar(int l)
This function creates li variables(thee ith loop index variable).
Definition: testdep_util.c:103
entity LiVars[MAXDEPTH]
Definition: testdep_util.c:54

References LiVars, MakeLiVar(), MAXDEPTH, and user_error.

Referenced by build_and_test_dependence_context(), dependence_system_add_lci_and_di(), and gcd_and_constant_dependence_test().

+ 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 }
void user_log(const char *format,...)
Definition: message.c:234
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)
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
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 int number_of_processed_modules
Definition: impact_check.c:58
static bool included_call_chain_p(list l1, list l2)
Definition: impact_check.c:80
static list l_dynamic_check
This list tells us if two variables have been checked dynamically or not.
Definition: impact_check.c:53
static entity current_mod
Definition: impact_check.c:42
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:

◆ load_statement_context()

Psysteme load_statement_context ( statement  )

Referenced by TestCoupleOfEffects().

+ Here is the caller graph for this function:

◆ make_context_map()

void make_context_map ( void  )

◆ make_filtered_dg_or_dvdg()

list make_filtered_dg_or_dvdg ( statement  mod_stat,
graph  mod_graph 
)

for computing the line numbers of statements

Additional information for EDF prettyprint. Instruction calls are given with statement numbers

Parameters
mod_statod_stat
mod_graphod_graph

Definition at line 101 of file trace.c.

102 {
103  list verlist = NIL;
104  list vars_ent_list = get_list_of_variable_to_filter();
105 
107  int dl = -1;
108 
110  /* for computing the line numbers of statements */
113  }
114 
115  MAP(VERTEX, v1, {
117 
118  MAP(SUCCESSOR, su, {
119  vertex v2 = successor_vertex(su);
122 
123  MAP(CONFLICT, c, {
126  if (gen_in_list_p(conflict_var, vars_ent_list) || vars_ent_list == NIL) {
127  string succ_label = (string)malloc(sizeof(string)*30);
128  int l1 = dl + apply_persistant_statement_to_int(s_to_l, s1);
129  int l2 = dl + apply_persistant_statement_to_int(s_to_l, s2);
130 
131  vertex vertex_parent = NULL;
132  vertex vertex_child = NULL;
133  char statement_action_parent = action_read_p(effect_action(conflict_source(c))) ? 'R' : 'W';
134  char statement_action_child = action_read_p(effect_action(conflict_sink(c))) ? 'R' : 'W';
137  string node_name_parent = (string)malloc(sizeof(string)*strlen(variable_name_parent) + 30);
138  string node_name_child = (string)malloc(sizeof(string)*strlen(variable_name_child) + 30);
139 
140  successor succ = NULL;
141  memset(node_name_parent, 0, sizeof(string)*strlen(variable_name_parent) + 30);
142  memset(node_name_child, 0, sizeof(string)*strlen(variable_name_child) + 30);
143  sprintf(node_name_parent, "%d-<%s>-%c", l1, variable_name_parent, statement_action_parent);
144  sprintf(node_name_child, "%d-<%s>-%c", l2, variable_name_child, statement_action_child);
145 
146  /* Additional information for EDF prettyprint.
147  Instruction calls are given with statement numbers
148  */
149  if (get_bool_property("PRETTYPRINT_WITH_COMMON_NAMES")) {
151  sprintf(node_name_parent + strlen(node_name_parent), " %td-%s", statement_number(s1),
153  else sprintf(node_name_parent + strlen(node_name_parent), " %td", statement_number(s1));
155  sprintf(node_name_child + strlen(node_name_child), " %td-%s", statement_number(s2),
157  else sprintf(node_name_child + strlen(node_name_child), " %td", statement_number(s2));
158  }
159 
160  memset(succ_label, 0, strlen(succ_label));
161  if (conflict_cone(c) != cone_undefined) {
163  strcat(succ_label, "levels(");
164  MAPL(pl, {
165  sprintf(succ_label + strlen(succ_label),
166  pl == cone_levels(conflict_cone(c)) ? "%td" : ",%td", INT(CAR(pl)));
167  }, cone_levels(conflict_cone(c)));
168  strcat(succ_label, ")");
169  }
170  }
171 
172  vertex_parent = get_vertex_in_list(verlist, node_name_parent);
173  if (vertex_undefined_p(vertex_parent)) {
174  vertex_parent = make_vertex((vertex_label)node_name_parent, NIL);
175  ADD_ELEMENT_TO_LIST(verlist, VERTEX, vertex_parent);
176  }
177 
178  vertex_child = get_vertex_in_list(verlist, node_name_child);
179  if (vertex_undefined_p(vertex_child)) {
180  vertex_child = make_vertex((vertex_label)node_name_child, NIL);
181  ADD_ELEMENT_TO_LIST(verlist, VERTEX, vertex_child);
182  }
183 
184  succ = make_successor((dg_arc_label)succ_label, vertex_child);
185  ADD_ELEMENT_TO_LIST(vertex_successors(vertex_parent), SUCCESSOR, succ);
186  }
187  }
188  }, dg_arc_label_conflicts(dal));
189 
190  }, vertex_successors(v1));
191 
192  }, graph_vertices(mod_graph));
193 
194  gen_free_list(vars_ent_list);
195 
198 
199  return verlist;
200 }
successor make_successor(arc_label a1, vertex a2)
Definition: graph.c:98
vertex make_vertex(vertex_label a1, list a2)
Definition: graph.c:140
intptr_t apply_persistant_statement_to_int(persistant_statement_to_int f, statement k)
Definition: ri.c:1654
void free_persistant_statement_to_int(persistant_statement_to_int p)
Definition: ri.c:1618
@ INT
Definition: atomic.c:48
#define cone_levels(x)
Definition: dg.h:128
#define cone_undefined
Definition: dg.h:104
#define conflict_cone(x)
Definition: dg.h:169
list get_list_of_variable_to_filter(void)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void * malloc(YYSIZE_T)
#define vertex_undefined_p(x)
Definition: graph.h:129
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
persistant_statement_to_int statement_to_line_number(statement)
Definition: statement.c:2460
static list verlist
of vertex
Definition: icfg_scan.c:107
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
Definition: properties.c:783
int module_to_declaration_length(entity func)
Number of user declaration lines for a module.
Definition: module.c:352
#define call_function(x)
Definition: ri.h:709
#define instruction_call_p(x)
Definition: ri.h:1527
#define statement_instruction(x)
Definition: ri.h:2458
#define persistant_statement_to_int_undefined
Definition: ri.h:1915
#define instruction_call(x)
Definition: ri.h:1529
#define statement_undefined_p(x)
Definition: ri.h:2420
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: trace.c:30
vertex get_vertex_in_list(list in_l, string in_s)
get vertex in a list by the vertex's label
Definition: trace.c:35

References action_read_p, ADD_ELEMENT_TO_LIST, apply_persistant_statement_to_int(), call_function, CAR, cone_levels, cone_undefined, CONFLICT, conflict_cone, conflict_sink, conflict_source, dg_arc_label_conflicts, effect_action, effect_any_reference, effect_words_reference(), entity_local_name(), free_persistant_statement_to_int(), gen_free_list(), gen_in_list_p(), get_bool_property(), get_current_module_entity(), get_list_of_variable_to_filter(), get_vertex_in_list(), graph_vertices, instruction_call, instruction_call_p, INT, make_successor(), make_vertex(), malloc(), MAP, MAPL, memset(), mod_stat, module_to_declaration_length(), NIL, persistant_statement_to_int_undefined, pl, reference_variable, s1, statement_instruction, statement_number, statement_to_line_number(), statement_undefined_p, SUCCESSOR, successor_arc_label, successor_vertex, verlist, VERTEX, vertex_successors, vertex_to_statement(), vertex_undefined_p, and words_to_string().

Referenced by print_filtered_dg_or_dvdg().

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

◆ MakeDibaseinorder()

Pbase MakeDibaseinorder ( int  n)

Pbase MakeDibaseinorder(int n) make a base of D#1 ...

D::n in order of D#1-> D#2, ...-> D::n.

Definition at line 296 of file testdep_util.c.

297  {
298  Pbase Dibase = BASE_NULLE;
299  int i;
300 
301  for (i = 1; i <= n; i++) {
302  Dibase = vect_add_variable(Dibase, (Variable)GetDiVar(n - i + 1));
303  }
304  return (Dibase);
305 }
Pbase vect_add_variable(Pbase b, Variable v)
package vecteur - routines sur les bases
Definition: base.c:61
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
entity GetDiVar(int l)
This functions looks up a di variable of nesting level l in table DiVars.
Definition: testdep_util.c:79
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
#define BASE_NULLE
MACROS SUR LES BASES.

References BASE_NULLE, GetDiVar(), and vect_add_variable().

Referenced by TestDependence().

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

◆ MakeDiVar()

entity MakeDiVar ( int  l)

This function creates di variables.

There are MAXDEPTH di variables which means that programs with more than MAXDEPTH nested loops cannot be parallelized by pips.

Parameters
lis the nesting level of the variable to create

Create a variable of this format: "d#X"

Definition at line 63 of file testdep_util.c.

63  {
64  entity e;
65  string s;
66  /* Create a variable of this format: "d#X" */
67  asprintf(&s, "%s%sd#%d", DI_VAR_MODULE_NAME, MODULE_SEP_STRING, l);
68 
71  else
72  free(s);
73 
74  return (e);
75 }
#define asprintf
Definition: misc-local.h:225
#define MODULE_SEP_STRING
Definition: naming-local.h:30
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define make_entity(n, t, s, i)
#define DI_VAR_MODULE_NAME
#define value_undefined
Definition: ri.h:3016
#define type_undefined
Definition: ri.h:2883
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
#define storage_undefined
Definition: ri.h:2476

References asprintf, DI_VAR_MODULE_NAME, entity_domain, entity_undefined, free(), gen_find_tabulated(), make_entity, MODULE_SEP_STRING, storage_undefined, type_undefined, and value_undefined.

Referenced by GetDiVar().

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

◆ MakeDsiVar()

entity MakeDsiVar ( int  l)

This function creates dsi variables.

There are MAXSV dsi variables which means that programs with more than MAXSV scalar variables cannot be parallelized by PIPS.

Parameters
lmeans to create Dsi[l] variable

Create a variable of this format: "ds#XXXX"

Definition at line 146 of file testdep_util.c.

146  {
147  entity e;
148  string s;
149  /* Create a variable of this format: "ds#XXXX" */
150  asprintf(&s, "%s%sds#%.4d", DI_VAR_MODULE_NAME, MODULE_SEP_STRING, l);
151 
154  else
155  free(s);
156 
157  return (e);
158 }

References asprintf, DI_VAR_MODULE_NAME, entity_domain, entity_undefined, free(), gen_find_tabulated(), make_entity, MODULE_SEP_STRING, storage_undefined, type_undefined, and value_undefined.

Referenced by GetDsiVar().

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

◆ MakeLiVar()

entity MakeLiVar ( int  l)

This function creates li variables(thee ith loop index variable).

There are MAXDEPTH li variables which means that programs with more than MAXDEPTH nested loops cannot be parallelized by pips.

Parameters
lis the nesting level of the variable to create

Create a variable of this format: "l#X"

Definition at line 103 of file testdep_util.c.

103  {
104  entity e;
105  string s;
106  /* Create a variable of this format: "l#X" */
107  asprintf(&s, "%s%sl#%d", DI_VAR_MODULE_NAME, MODULE_SEP_STRING, l);
108 
111  else
112  free(s);
113 
114  return (e);
115 }

References asprintf, DI_VAR_MODULE_NAME, entity_domain, entity_undefined, free(), gen_find_tabulated(), make_entity, MODULE_SEP_STRING, storage_undefined, type_undefined, and value_undefined.

Referenced by GetLiVar().

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

◆ MakeLoopCounter()

entity MakeLoopCounter ( void  )

Create a new loop counter variable.

Create a variable of this format: "lc#XXXXXX"

Try a new free one:

Definition at line 334 of file testdep_util.c.

334  {
335  entity e;
336  string s;
337  //static char lcn[] = "lc#XXXXXX";
338 
339  while(1) {
340  /* Create a variable of this format: "lc#XXXXXX" */
341  asprintf(&s,
342  "%s%slc#%06d",
345  ilc);
346 
348  pips_debug(8, "loop counter is %s\n", s);
349  return make_entity(strdup(s),
353  } else
354  free(s);
355 
356  /* Try a new free one: */
357  if((ilc += 1) == ILCMAX)
358  break;
359  }
360 
361  pips_internal_error("too many loop counters");
362  return (entity_undefined);
363 }
#define LOOP_COUNTER_MODULE_NAME
moved from ricedg-local.h
static int ilc
Definition: testdep_util.c:327
#define ILCMAX
Management of loop counters.
Definition: testdep_util.c:325

References asprintf, entity_domain, entity_undefined, free(), gen_find_tabulated(), ilc, ILCMAX, LOOP_COUNTER_MODULE_NAME, make_entity, MODULE_SEP_STRING, pips_debug, pips_internal_error, storage_undefined, strdup(), type_undefined, and value_undefined.

Referenced by dependence_system_add_lci_and_di().

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

◆ prettyprint_dependence_graph()

void prettyprint_dependence_graph ( FILE *  fd,
statement  mod_stat,
graph  mod_graph 
)

Print all edges and arcs.

There is no guarantee that the ordering_to_statement() hash table is the proper one

compute line numbers for statements

If we have zero printable conflicts, move on.

If we have more than one conflict, let's sort them !

FI: the number of conflicts should take into account the filtering due to PRETTYPRINT_MEMORY_EFFECTS_ONLY

Modification at revision 12484 because statement numbers were not initialized by C parser, with no validation of ricedg available at that time

factorize line numbers

FI: I should use another property, specific to the use-def chains, but this is quite close

if (!entity_scalar_p(reference_variable (effect_any_reference(conflict_source(c))))) {

Additional information for EDF prettyprint. Instruction calls are given with statement numbers

uniform dependence

sg_fprint(fd,gs,entity_local_name);

FI: almost print_dependence_cone:-(

Parameters
fdd
mod_statod_stat
mod_graphod_graph

Definition at line 177 of file util.c.

180 {
181  cons *pv1, *ps, *pc;
182  Ptsg gs;
183  int banner_number = 0;
184  bool sru_format_p =
185  get_bool_property( "PRINT_DEPENDENCE_GRAPH_USING_SRU_FORMAT" );
187  int dl = -1;
188  debug_on("RICEDG_DEBUG_LEVEL");
189 
190  ifdebug(8) {
191  /* There is no guarantee that the ordering_to_statement()
192  * hash table is the proper one */
194  }
195 
196  if ( sru_format_p && !statement_undefined_p(mod_stat) ) {
197  /* compute line numbers for statements */
200  } else {
201  banner_number
202  = get_bool_property( "PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS" )
203  + 2 * get_bool_property( "PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS" )
204  + 4 * get_bool_property( "PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES" );
205  fprintf( fd, "%s\n", dependence_graph_banner[banner_number] );
206  }
207 
209  for ( pv1 = graph_vertices(mod_graph); !ENDP(pv1); pv1 = CDR(pv1) ) {
210  vertex v1 = VERTEX(CAR(pv1));
213  for ( ps = vertex_successors(v1); !ENDP(ps); ps = CDR(ps) ) {
214  successor su = SUCCESSOR(CAR(ps));
215  vertex v2 = successor_vertex(su);
216  statement s2 = vertex_to_statement( v2 );
218 
219  /* If we have zero printable conflicts, move on.
220  *
221  * If we have more than one conflict, let's sort them !
222  *
223  * FI: the number of conflicts should take into account the
224  * filtering due to PRETTYPRINT_MEMORY_EFFECTS_ONLY
225  */
226  list cl = dg_arc_label_conflicts(dal);
227  int nb_conflicts = gen_length(cl);
228  if(get_bool_property("PRETTYPRINT_MEMORY_EFFECTS_ONLY")) {
229  FOREACH(CONFLICT, c, cl) {
230  effect efsrc = conflict_source(c);
231  if(!store_effect_p(efsrc))
232  nb_conflicts--;
233  }
234  }
235 
236  if(nb_conflicts==0)
237  continue;
238 
239  if ( !sru_format_p || statement_undefined_p(mod_stat) ) {
240  /* Modification at revision 12484 because statement
241  numbers were not initialized by C parser, with no
242  validation of ricedg available at that time*/
243  /* factorize line numbers */
244  //fprintf(fd, "\t%s -->",
245  // external_statement_identification(s1)
246  // Revision 10893: %02d and statement_number (Pham Dat)
247  fprintf( fd, "\t%02td -->", statement_number(s1) );
248  //fprintf(fd, " %s with conflicts\n",
249  // external_statement_identification(s2)
250  fprintf( fd, " %02td with conflicts\n", statement_number(s2) );
251  }
252 
253  if ( nb_conflicts > 1 ) {
254  /*
255  * Convert the list to an array for sorting
256  * 20 is the initial size, should be enough for most cases
257  *
258  * FI: should generate a bug anytime when calls are
259  * involved. At least use dependent types... or pass gen_length()
260  */
261  gen_array_t conflicts_array = gen_array_make( 20 );
262  list_to_array( dg_arc_label_conflicts(dal), conflicts_array );
263  qsort( gen_array_pointer( conflicts_array ),
264  gen_array_nitems( conflicts_array ),
265  sizeof(void *),
267  list conflicts_list = NIL;
268  GEN_ARRAY_FOREACH(conflict, s, conflicts_array)
269  conflicts_list = CONS(conflict, s, conflicts_list);
270  gen_array_free(conflicts_array);
271  dg_arc_label_conflicts(dal)=conflicts_list;
272  }
273 
274  /*
275  * Loop over conflict and print them
276  */
277  for ( pc = dg_arc_label_conflicts(dal); !ENDP(pc); pc = CDR(pc) ) {
278  conflict c = CONFLICT(CAR(pc));
279  effect efsrc = conflict_source(c);
280 
281  /* FI: I should use another property, specific to the use-def
282  chains, but this is quite close */
283  if(store_effect_p(efsrc)
284  || !get_bool_property("PRETTYPRINT_MEMORY_EFFECTS_ONLY")) {
285 
286  /* if (!entity_scalar_p(reference_variable
287  (effect_any_reference(conflict_source(c))))) {
288  */
289  if ( sru_format_p && !statement_undefined_p(mod_stat) ) {
290  int l1 = dl + apply_persistant_statement_to_int( s_to_l, s1 );
291  int l2 = dl + apply_persistant_statement_to_int( s_to_l, s2 );
292 
293  fprintf( fd, "%d %d ", l1, l2 );
294  /*
295  fprintf(fd, "%d %d ",
296  statement_number(s1), statement_number(s2));
297  */
298  fprintf( fd,
299  "%s %s ",
302  fprintf( fd, "<" );
303  print_words( fd,
306  fprintf( fd, "> - <" );
307  print_words( fd,
310  fprintf( fd, ">" );
311 
312  /* Additional information for EDF prettyprint.
313  Instruction calls are given with statement numbers
314  */
315  if ( get_bool_property( "PRETTYPRINT_WITH_COMMON_NAMES" ) ) {
317  fprintf( fd,
318  " %td-%s",
323  else
324  fprintf( fd, " %td", statement_number(s1) );
326  fprintf( fd,
327  " %td-%s",
328  statement_number(s2),
332  else
333  fprintf( fd, " %td", statement_number(s2) );
334  }
335 
336  } else {
337  fprintf( fd, "\t\tfrom " );
339 
340  fprintf( fd, " to " );
342  }
343 
344  if ( conflict_cone(c) != cone_undefined ) {
345  if ( sru_format_p && !statement_undefined_p(mod_stat) ) {
346  fprintf( fd, " levels(" );
347  MAPL(pl, {
348  fprintf(fd, pl==cone_levels(conflict_cone(c))? "%td" : ",%td",
349  INT(CAR(pl)));
350  }, cone_levels(conflict_cone(c)));
351  fprintf( fd, ") " );
352  } else {
353  fprintf( fd, " at levels " );
354  MAPL(pl, {
355  fprintf(fd, " %td", INT(CAR(pl)));
356  }, cone_levels(conflict_cone(c)));
357  fprintf( fd, "\n" );
358  }
359 
360  if( get_bool_property( "PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES" ) ) {
362  if( !SG_UNDEFINED_P( gs ) ) {
363  if( sru_format_p && !statement_undefined_p(mod_stat) ) {
364  if( sg_nbre_sommets( gs ) == 1 && sg_nbre_rayons( gs ) == 0
365  && sg_nbre_droites( gs ) == 0 ) {
366  /* uniform dependence */
367  fprintf( fd, "uniform" );
368  fprint_lsom_as_dense( fd, sg_sommets( gs ), gs->base );
369  } else {
370  sg_fprint_as_ddv( fd, gs );
371  }
372  } else {
373  /* sg_fprint(fd,gs,entity_local_name); */
374  /* FI: almost print_dependence_cone:-( */
375  sg_fprint_as_dense( fd, gs, gs->base );
376  ifdebug(2) {
377  Psysteme sc1 = sc_new( );
378  sc1 = sg_to_sc_chernikova( gs );
379  (void) fprintf( fd,
380  "syst. lin. correspondant au syst. gen.:\n" );
382  }
383  }
384  }
385  }
386  } else {
387  if ( sru_format_p && !statement_undefined_p(mod_stat) )
388  fprintf( fd, " levels()" );
389  }
390  fprintf( fd, "\n" );
391  }
392  }
393  }
394  }
395 
396  if ( sru_format_p && !statement_undefined_p(mod_stat) ) {
398  } else {
399  fprintf( fd,
400  "\n****************** End of Dependence Graph ******************\n" );
401  }
402 
403  debug_off();
404 }
void list_to_array(list l, gen_array_t a)
args.c
Definition: args.c:38
size_t gen_array_nitems(const gen_array_t a)
Definition: array.c:131
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
void ** gen_array_pointer(const gen_array_t a)
Observers...
Definition: array.c:125
void gen_array_free(gen_array_t a)
Definition: array.c:70
Psysteme sg_to_sc_chernikova(Ptsg sg)
Definition: chernikova.c:58
#define cone_generating_system(x)
Definition: dg.h:130
list words_effect(effect)
bool store_effect_p(effect)
Definition: effects.c:1062
#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_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
Definition: list.c:796
#define GEN_ARRAY_FOREACH(type, s, array)
Definition: newgen_array.h:50
int(* gen_cmp_func_t)(const void *, const void *)
Definition: newgen_types.h:114
void print_ordering_to_statement(void)
Dump the ordering with the corresponding statement address.
Definition: ordering.c:71
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 string dependence_graph_banner[8]
Definition: util.c:89
int vertex_sort_callback(const vertex *v1, const vertex *v2)
This is a callback for qsort function, it compares two vertex.
Definition: util.c:105
int conflicts_sort_callback(conflict *c1, conflict *c2)
This is a callback for qsort function, it compares two conflicts.
Definition: util.c:126
int successor_sort_callback(const successor *succ1, const successor *succ2)
This is a callback for qsort function, it compares two successor.
Definition: util.c:116
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
#define sg_sommets(sg)
vieilles definitions des fonctions d'impression void sg_fprint(); #define print_sg(sg) sg_fprint(stdo...
Definition: sg-local.h:85
struct type_sg * Ptsg
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
#define sg_nbre_sommets(sg)
nombre de sommets: int sg_nbre_sommets(Ptsg)
Definition: sg-local.h:96
#define SG_UNDEFINED_P(sg)
Definition: sg-local.h:74
#define sg_nbre_droites(sg)
nombre de droites: int sg_nbre_droites(Ptsg)
Definition: sg-local.h:102
#define sg_nbre_rayons(sg)
nombre de rayons: int sg_nbre_rayons(Ptsg)
Definition: sg-local.h:99
void sg_fprint_as_dense(FILE *f, Ptsg sg, Pbase b)
void sg_fprint_as_dense(FILE * f, Ptsg sg): impression d'un systeme generateur
Definition: sg.c:298
void sg_fprint_as_ddv(FILE *fd, Ptsg sg)
Definition: sg.c:341
void fprint_lsom_as_dense(FILE *f, Psommet ls, Pbase b)
void fprint_lsom_as_dense(FILE * f, Psommet s): impression d'une liste de sommets
Definition: sommet.c:191
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
Definition: sg-local.h:66
Pbase base
Definition: sg-local.h:70
void print_words(FILE *fd, cons *lw)
Definition: print.c:263

References apply_persistant_statement_to_int(), type_sg::base, call_function, CAR, CDR, cone_generating_system, cone_levels, cone_undefined, CONFLICT, conflict_cone, conflict_sink, conflict_source, conflicts_sort_callback(), CONS, debug_off, debug_on, dependence_graph_banner, dg_arc_label_conflicts, effect_action, effect_any_reference, effect_words_reference(), ENDP, entity_local_name(), FOREACH, fprint_lsom_as_dense(), fprintf(), free_persistant_statement_to_int(), full_action_to_short_string(), GEN_ARRAY_FOREACH, gen_array_free(), gen_array_make(), gen_array_nitems(), gen_array_pointer(), gen_length(), gen_sort_list(), get_bool_property(), get_current_module_entity(), graph_vertices, ifdebug, instruction_call, instruction_call_p, INT, list_to_array(), MAPL, mod_stat, module_to_declaration_length(), NIL, persistant_statement_to_int_undefined, pl, print_ordering_to_statement(), print_words(), s1, sc_fprint(), sc_new(), sg_fprint_as_ddv(), sg_fprint_as_dense(), sg_nbre_droites, sg_nbre_rayons, sg_nbre_sommets, sg_sommets, sg_to_sc_chernikova(), SG_UNDEFINED_P, statement_instruction, statement_number, statement_to_line_number(), statement_undefined_p, store_effect_p(), SUCCESSOR, successor_arc_label, successor_sort_callback(), successor_vertex, VERTEX, vertex_sort_callback(), vertex_successors, vertex_to_statement(), and words_effect().

Referenced by chains(), FindAndTopSortSccs(), icm_codegen(), print_dependence_or_chains_graph(), rice_dependence_graph(), and rice_update_dependence_graph().

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

◆ prettyprint_dependence_graph_view()

void prettyprint_dependence_graph_view ( FILE *  fd,
statement  mod_stat,
graph  mod_graph 
)

Do not print vertices and arcs ignored by the parallelization algorithms.

At least, hopefully...

f (! entity_scalar_p(reference_variable (effect_any_reference(conflict_source(c))))) {

sg_fprint(fd,gs,entity_local_name);

Parameters
fdd
mod_statod_stat
mod_graphod_graph

Definition at line 833 of file util.c.

836 {
837  cons *pv1, *ps, *pc;
838  Ptsg gs;
839  int banner_number = 0;
840 
841  banner_number =
842  get_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS") +
844  ("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS") +
846  ("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES");
847 
848  fprintf(fd, "%s\n", dependence_graph_banner[banner_number]);
849 
851 
852  debug_on("RICEDG_DEBUG_LEVEL");
853 
854  for (pv1 = graph_vertices(mod_graph); !ENDP(pv1); pv1 = CDR(pv1)) {
855  vertex v1 = VERTEX(CAR(pv1));
858 
859  for (ps = vertex_successors(v1); !ENDP(ps); ps = CDR(ps)) {
860  successor su = SUCCESSOR(CAR(ps));
861  vertex v2 = successor_vertex(su);
865 
866  /*
867  * If we have more than one conflict, let's sort them !
868  */
869  int nb_conflicts = gen_length(dg_arc_label_conflicts(dal));
870  if ( nb_conflicts > 1 ) {
871  /*
872  * Convert the list to an array for sorting
873  * 20 is the initial size, should be enough for most of the case
874  */
875  gen_array_t conflicts_array = gen_array_make( 20 );
876  list_to_array( dg_arc_label_conflicts(dal), conflicts_array );
877  qsort( gen_array_pointer( conflicts_array ),
878  gen_array_nitems( conflicts_array ),
879  sizeof(void *),
881  list conflicts_list = NIL;
882  GEN_ARRAY_FOREACH(conflict, s, conflicts_array)
883  conflicts_list = CONS(conflict, s, conflicts_list);
884  gen_array_free(conflicts_array);
885  dg_arc_label_conflicts(dal)=conflicts_list;
886  }
887  int nbrcomloops = FindMaximumCommonLevel(loops1, loops2);
888  for (pc = dg_arc_label_conflicts(dal); !ENDP(pc); pc = CDR(pc)) {
889  conflict c = CONFLICT(CAR(pc));
890 
891  if(conflict_cone(c) == cone_undefined) continue;
892  else {
893  cons * lls = cone_levels(conflict_cone(c));
894  cons *llsred =NIL;
895  if (get_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS")){
896  MAPL(pl,{
897  _int level = INT(CAR(pl));
898  if (level <= nbrcomloops) {
899  if (! ignore_this_conflict(v1,v2,c,level)) {
900  llsred = gen_nconc(llsred, CONS(INT, level, NIL));
901  }
902  }
903  else {
905  ("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS")) {
906  continue;
907  }
908  else llsred = gen_nconc(llsred, CONS(INT, level, NIL));
909  }
910  }, lls);
911  }
912  if (llsred == NIL) continue;
913  else {
914  /*if (! entity_scalar_p(reference_variable
915  (effect_any_reference(conflict_source(c))))) { */
916 
917  fprintf(fd, "\t%02td --> %02td with conflicts\n",
919 
920  fprintf(fd, "\t\tfrom ");
922 
923  fprintf(fd, " to ");
925 
926  fprintf(fd, " at levels ");
927  MAPL(pl, {
928  fprintf(fd, " %td", INT(CAR(pl)));
929  }, llsred);
930 
931  fprintf(fd, "\n");
933  ("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES")) {
935  if (!SG_UNDEFINED_P(gs)) {
936  /* sg_fprint(fd,gs,entity_local_name); */
937  sg_fprint_as_dense(fd, gs, gs->base);
938  ifdebug(2) {
939  Psysteme sc1 = sc_new();
940  sc1 = sg_to_sc_chernikova(gs);
941  (void) fprintf(fd,"syst. lin. correspondant au syst. gen.:\n");
943  }
944  }
945  fprintf(fd, "\n");
946  }
947  }
948  }
949  }
950  }
951  }
953  debug_off();
954  fprintf(fd, "\n****************** End of Dependence Graph "
955  "******************\n");
956 }
void clean_enclosing_loops(void)
Definition: loop.c:58
statement_mapping loops_mapping_of_statement(statement stat)
Definition: loop.c:155
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
intptr_t _int
_INT
Definition: newgen_types.h:53
list load_statement_enclosing_loops(statement)
void set_enclosing_loops_map(statement_mapping)
bool ignore_this_conflict(vertex v1, vertex v2, conflict c, int l)
This function checks if conflict c between vertices v1 and v2 should be ignored at level l.
Definition: codegen.c:163
int FindMaximumCommonLevel(cons *, cons *)
Definition: testdep_util.c:307
#define level

References type_sg::base, CAR, CDR, clean_enclosing_loops(), cone_generating_system, cone_levels, cone_undefined, CONFLICT, conflict_cone, conflict_sink, conflict_source, conflicts_sort_callback(), CONS, debug_off, debug_on, dependence_graph_banner, dg_arc_label_conflicts, ENDP, entity_local_name(), prettyprint_dot_context::fd, FindMaximumCommonLevel(), fprintf(), GEN_ARRAY_FOREACH, gen_array_free(), gen_array_make(), gen_array_nitems(), gen_array_pointer(), gen_length(), gen_nconc(), get_bool_property(), graph_vertices, ifdebug, ignore_this_conflict(), INT, level, list_to_array(), load_statement_enclosing_loops(), loops_mapping_of_statement(), MAPL, mod_stat, NIL, pl, print_words(), s1, sc_fprint(), sc_new(), set_enclosing_loops_map(), sg_fprint_as_dense(), sg_to_sc_chernikova(), SG_UNDEFINED_P, statement_number, SUCCESSOR, successor_arc_label, successor_vertex, VERTEX, vertex_successors, vertex_to_statement(), and words_effect().

Referenced by print_dependence_or_chains_graph().

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

◆ prettyprint_dot_dependence_graph()

void prettyprint_dot_dependence_graph ( FILE *  fd,
statement  mod_stat,
graph  mod_graph 
)

Output dependence graph in a file in graphviz dot format.

Parameters
fdis the file descriptor where to output
mod_statis the module statement (not necessary module, it can be a block statement for instance
graphis the dependence graph to print

There is no guarantee that the ordering_to_statement() hash table is the proper one

graph style

Nodes style

uniform dependence

Parameters
fdd
mod_statod_stat
mod_graphod_graph

Definition at line 583 of file util.c.

585  {
586  debug_on( "RICEDG_DEBUG_LEVEL" );
587 
588  ifdebug(8) {
589  /* There is no guarantee that the ordering_to_statement()
590  * hash table is the proper one */
592  }
593  // Begin graph
594  fprintf( fd, "digraph {\n" );
595 
596 
597  bool centered = get_bool_property( "PRINT_DOTDG_CENTERED" );
598  const char* title = get_string_property( "PRINT_DOTDG_TITLE" );
599  const char* title_position = get_string_property( "PRINT_DOTDG_TITLE_POSITION" );
600  const char* background = get_string_property( "PRINT_DOTDG_BACKGROUND" );
601  const char* nodeshape= get_string_property( "PRINT_DOTDG_NODE_SHAPE" );
602  const char* nodeshapecolor = get_string_property( "PRINT_DOTDG_NODE_SHAPE_COLOR" );
603  const char* nodefillcolor = get_string_property( "PRINT_DOTDG_NODE_FILL_COLOR" );
604  const char* nodefontcolor = get_string_property( "PRINT_DOTDG_NODE_FONT_COLOR" );
605  const char* nodefontsize = get_string_property( "PRINT_DOTDG_NODE_FONT_SIZE" );
606  const char* nodefontface = get_string_property( "PRINT_DOTDG_NODE_FONT_FACE" );
607 
608 
609  /* graph style */
610  fprintf( fd,
611  "\n"
612  " /* graph style */\n");
613  // Print title if not empty
614  if( !same_string_p( title, "" ) ) {
615  fprintf( fd, " label=\"%s\";\n", title);
616  }
617  // Print title location if not empty
618  if( !same_string_p( title_position, "" ) ) {
619  fprintf( fd, " labelloc=\"%s\";\n", title_position);
620  }
621  // Print background color if not empty
622  if( !same_string_p( background, "" ) ) {
623  fprintf( fd, " bgcolor=\"%s\";\n", background);
624  }
625  if( centered ) {
626  fprintf( fd, " center=\"true\";\n");
627  }
628  fprintf( fd, "\n\n");
629 
630 
631 
632  /* Nodes style */
633  fprintf( fd,
634  "\n"
635  " /* Nodes style */\n"
636  " node [shape=\"%s\",color=\"%s\",fillcolor=\"%s\","
637  "fontcolor=\"%s\",fontsize=\"%s\",fontname=\"%s\"];\n\n",
638  nodeshape,
639  nodeshapecolor,
640  nodefillcolor,
641  nodefontcolor,
642  nodefontsize,
643  nodefontface );
644 
645 
646 
647 
648  // Should we print the statement or only its ordering ?
649  bool print_statement = get_bool_property( "PRINT_DOTDG_STATEMENT" );
650  // Should node be ordered top down according to the statement ordering ?
651  bool ordered = get_bool_property( "PRINT_DOTDG_TOP_DOWN_ORDERED" );
652 
653  if( ordered || print_statement ) {
654  fprintf( fd,
655  "\n {\n /* Print nodes for statements %s order them */\n\n",
656  ordered ? "and" : "but don't" );
657 
658  if ( ordered ) {
659  fprintf( fd,
660  " /* ordering edges must be invisible, so set background color */\n"
661  " edge [weight=100,color=%s];\n\n",
662  background );
663  }
664 
665  // Generate nodes
666  struct prettyprint_dot_context ctx;
667  ctx.fd = fd;
668  ctx.current = NULL;
669  ctx.ordered = ordered;
670  ctx.print_statement = print_statement;
671  ctx.previous_ordering = 0;
672 
675  fprintf( fd, " }\n\n" );
676  }
677 
678 
679  fprintf( fd, " /* Print arcs between statements */\n\n" );
680  fprintf( fd, " /* Dependence arcs won't constrain node positions */\nedge [constraint=false];\n\n" );
681 
682 
683 
684  const char* flowdep_color = get_string_property( "PRINT_DOTDG_FLOW_DEP_COLOR" );
685  const char* flowdep_style = get_string_property( "PRINT_DOTDG_FLOW_DEP_STYLE" );
686  const char* antidep_color = get_string_property( "PRINT_DOTDG_ANTI_DEP_COLOR" );
687  const char* antidep_style = get_string_property( "PRINT_DOTDG_ANTI_DEP_STYLE" );
688  const char* outputdep_color = get_string_property( "PRINT_DOTDG_OUTPUT_DEP_COLOR" );
689  const char* outputdep_style = get_string_property( "PRINT_DOTDG_OUTPUT_DEP_STYLE" );
690  const char* inputdep_color = get_string_property( "PRINT_DOTDG_INPUT_DEP_COLOR" );
691  const char* inputdep_style = get_string_property( "PRINT_DOTDG_INPUT_DEP_STYLE" );
692 
693  bool mask_loop_carried = get_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS");
694  bool mask_loop_privatized = get_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS");
696 
697  // Loop over the graph and print all dependences
698  FOREACH( vertex, v1 , graph_vertices( mod_graph ) ) {
702  {
703  vertex v2 = successor_vertex( su );
704  statement s2 = vertex_to_statement( v2 );
707  int nbrcomloops = FindMaximumCommonLevel(loops1, loops2);
709  {
710  action source_act = effect_action( conflict_source( c ) );
711  action sink_act = effect_action( conflict_sink( c ) );
712  reference sink_ref = effect_any_reference( conflict_sink( c ) );
713  reference source_ref = effect_any_reference( conflict_source( c ) );
714  const char* color = inputdep_color;
715  const char* style = inputdep_style;
716 
717  /*
718  * Here we check if this arc is only loop carried or not and we might
719  * skip it if required by property
720  */
721  bool keep_this_conflict = true;
722  if(mask_loop_carried && conflict_cone(c) != cone_undefined) {
723  list lls = cone_levels(conflict_cone(c));
724  keep_this_conflict = false;
725  FOREACH(int, level, lls) {
726  if(level > nbrcomloops ) {
727  keep_this_conflict = true;
728  break;
729  }
730  }
731  }
732  bool keep_this_conflict_privatized = true;
733  if(mask_loop_privatized && conflict_cone(c) != cone_undefined) {
734  list lls = cone_levels(conflict_cone(c));
735  keep_this_conflict_privatized = true;
736  FOREACH(int, level, lls) {
737  if(level > nbrcomloops || ignore_this_conflict(v1,v2,c,level)) {
738  keep_this_conflict_privatized=false;
739  //break;
740  }
741  }
742  }
743 
744  keep_this_conflict = keep_this_conflict && keep_this_conflict_privatized;
745  //verify also for level = 0
746  if(mask_loop_privatized && ignore_this_conflict(v1,v2,c,0))
747  keep_this_conflict=false;
748 
749  if(!keep_this_conflict) {
750  continue;
751  }
752 
753 
754  // Ok let's display it now.
755 
756  if( action_read_p( source_act ) && action_write_p( sink_act ) ) {
757  color = antidep_color;
758  style = antidep_style;
759  } else if( action_write_p( source_act ) && action_write_p( sink_act ) ) {
760  color = outputdep_color;
761  style = outputdep_style;
762  } else if( action_write_p( source_act ) && action_read_p( sink_act ) ) {
763  color = flowdep_color;
764  style = flowdep_style;
765  }
766  fprintf( fd,
767  "%d -> %d [color=%s,style=%s,label=\"",
768  (int) statement_ordering(s1),
769  (int) statement_ordering(s2),
770  color,
771  style );
772  fprintf( fd,
773  "%s <",
774  full_action_to_short_string( source_act ));
775  print_words( fd,
776  effect_words_reference( source_ref ) );
777  fprintf( fd, ">\\n" );
778  fprintf( fd,
779  "%s <",
780  full_action_to_short_string( sink_act ));
781  print_words( fd,
782  effect_words_reference( sink_ref ) );
783  fprintf( fd, ">\\n" );
784 
785 
786  // Print the levels and the cone
787  if ( conflict_cone( c ) != cone_undefined ) {
788  fprintf( fd, " levels(" );
789  MAPL(pl, {
790  fprintf(fd, pl==cone_levels(conflict_cone(c))? "%td" : ",%td",
791  INT(CAR(pl)));
792  }, cone_levels(conflict_cone(c)));
793  fprintf( fd, ") " );
794 
795  if ( get_bool_property( "PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES" ) ) {
797  if ( !SG_UNDEFINED_P( gs ) ) {
798  if ( sg_nbre_sommets( gs ) == 1 && sg_nbre_rayons( gs ) == 0
799  && sg_nbre_droites( gs ) == 0 ) {
800  /* uniform dependence */
801  fprintf( fd, "uniform" );
802  fprint_lsom_as_dense( fd, sg_sommets( gs ), gs->base );
803  } else {
804  sg_fprint_as_ddv( fd, gs );
805  }
806  }
807  }
808  } else {
809  fprintf( fd, " levels()" );
810  }
811  fprintf( fd, "\"];\n" );
812  }
813  }
814  }
815 
816  fprintf( fd, "\n}\n" );
817 
819 
820  debug_off( );
821 }
char * get_string_property(const char *)
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
void reset_enclosing_loops_map(void)
#define statement_ordering(x)
Definition: ri.h:2454
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
static bool prettyprint_dot_nodes(statement s, dot_ctx ctx)
Print nodes for statements, the recursion is quite complicated.
Definition: util.c:509
Context structure used by gen recurse.
Definition: util.c:414

References action_read_p, action_write_p, type_sg::base, CAR, cone_generating_system, cone_levels, cone_undefined, conflict_cone, conflict_sink, conflict_source, prettyprint_dot_context::current, debug_off, debug_on, dg_arc_label_conflicts, effect_action, effect_any_reference, effect_words_reference(), prettyprint_dot_context::fd, FindMaximumCommonLevel(), FOREACH, fprint_lsom_as_dense(), fprintf(), full_action_to_short_string(), gen_context_recurse, gen_null2(), get_bool_property(), get_string_property(), graph_vertices, ifdebug, ignore_this_conflict(), INT, level, load_statement_enclosing_loops(), loops_mapping_of_statement(), MAPL, mod_stat, prettyprint_dot_context::ordered, pl, prettyprint_dot_nodes(), prettyprint_dot_context::previous_ordering, print_ordering_to_statement(), print_statement(), prettyprint_dot_context::print_statement, print_words(), reset_enclosing_loops_map(), s1, same_string_p, set_enclosing_loops_map(), sg_fprint_as_ddv(), sg_nbre_droites, sg_nbre_rayons, sg_nbre_sommets, sg_sommets, SG_UNDEFINED_P, statement_domain, statement_ordering, successor_arc_label, successor_vertex, vertex_successors, and vertex_to_statement().

Referenced by do_simplify_dg(), and print_dot_dependence_or_chains_graph().

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

◆ prettyprint_graph_daVinci()

void prettyprint_graph_daVinci ( FILE *  out_f,
list  l_of_vers 
)

print a graph to daVinci format, each label of successor is represented by a circular node, each vertex is represented by a square node

To match the call to the free() at the end:

Parameters
out_fut_f
l_of_vers_of_vers

Definition at line 63 of file trace.c.

63  {
64  /* To match the call to the free() at the end: */
65  string gr_buffer = strdup("");
66  bool first_node_parent = true;
67  fprintf(out_f, "[\n");
68 
69  MAP(VERTEX, ver, {
70  string node_name_parent = (string)vertex_vertex_label(ver);
71  bool first_node_child = true;
72  if (first_node_parent)
73  first_node_parent = false;
74  else
75  fprintf(out_f, ",\n");
76  fprintf(out_f,"l(\"%s\",n(\"\",[a(\"OBJECT\",\"%s\")],[\n", node_name_parent, node_name_parent);
77 
78  MAP(SUCCESSOR, succ, {
79  string node_name_child = (string)vertex_vertex_label(successor_vertex(succ));
80  if (first_node_child)
81  first_node_child = false;
82  else
83  fprintf(out_f, ",\n");
84  if (strlen((string)successor_arc_label(succ)) == 0) {
85  fprintf(out_f, " l(\"\",e(\"\",[],r(\"%s\")))", node_name_child);
86  } else {
87  string temp_buffer = strdup(concatenate(gr_buffer, ",\nl(\"", node_name_parent, "-", node_name_child, "\",n(\"\",[a(\"OBJECT\",\"", (string)successor_arc_label(succ), "\"),a(\"_GO\",\"ellipse\")],[\n l(\"\",e(\"\",[],r(\"", node_name_child, "\")))]))", NULL));
88  free(gr_buffer);
89  gr_buffer = temp_buffer;
90  fprintf(out_f, " l(\"\",e(\"\",[],r(\"%s-%s\")))", node_name_parent, node_name_child);
91  }
92  }, vertex_successors(ver));
93  fprintf(out_f, "]))");
94  }, l_of_vers);
95 
96  fprintf(out_f, "%s", gr_buffer);
97  fprintf(out_f, "\n]");
98  free(gr_buffer);
99 }

References concatenate(), fprintf(), free(), MAP, strdup(), SUCCESSOR, successor_arc_label, successor_vertex, VERTEX, vertex_successors, and vertex_vertex_label.

Referenced by print_filtered_dg_or_dvdg().

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

◆ prettyprint_graph_text()

void prettyprint_graph_text ( FILE *  out_f,
list  l_of_vers 
)

print a graph to text format

Parameters
out_fut_f
l_of_vers_of_vers

Definition at line 46 of file trace.c.

47 {
48  FOREACH (VERTEX, ver, l_of_vers) {
49  FOREACH (SUCCESSOR, succ, vertex_successors(ver)) {
50  fputs((string) vertex_vertex_label (ver), out_f);
51  fprintf(out_f, " ");
52  fputs((string) vertex_vertex_label (successor_vertex(succ)), out_f);
53  fprintf(out_f, " ");
54  fputs((string) successor_arc_label (succ), out_f);
55  fprintf(out_f, "\n");
56  }
57  }
58 }

References FOREACH, fprintf(), SUCCESSOR, successor_arc_label, successor_vertex, VERTEX, vertex_successors, and vertex_vertex_label.

Referenced by print_filtered_dg_or_dvdg().

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

◆ print_chains_graph()

bool print_chains_graph ( string  name)
Parameters
nameame

Definition at line 131 of file prettyprint.c.

132 {
133  return print_dependence_or_chains_graph(name, false);
134 }
static bool print_dependence_or_chains_graph(string mod_name, bool with_dg)
Definition: prettyprint.c:81

References print_dependence_or_chains_graph().

+ Here is the call graph for this function:

◆ print_dependence_cone()

void print_dependence_cone ( FILE *  fd,
Ptsg  dc,
Pbase  basis 
)
Parameters
fdd
dcc
basisasis

Definition at line 974 of file util.c.

978 {
979  Psommet v;
980  Pray_dte r;
981  fprintf(fd,"\nDependence cone :\n");
982  if (SG_UNDEFINED_P(dc)) fprintf(fd, "NULL \n");
983  else {
984  fprintf(fd,"basis :");
986  fprintf(fd,"%d vertice(s) :",sg_nbre_sommets(dc));
987  v = sg_sommets(dc);
988  for(; v!=NULL; v= v->succ) {
989  fprint_string_Value(fd, " \n\t denominator = ", v->denominateur);
990  fprintf(fd, "\t");
991  print_vect_in_vertice_val(fd,v->vecteur,basis);
992  }
993 
994  fprintf(fd,"\n%d ray(s) : ",sg_nbre_rayons(dc));
995 
996  for(r = sg_rayons(dc); r!=NULL; r=r->succ)
997  print_vect_in_vertice_val(fd,r->vecteur,basis);
998 
999  fprintf(fd,"\n%d line(s) : ",sg_nbre_droites(dc));
1000 
1001  for(r = sg_droites(dc); r!=NULL; r=r->succ)
1002  print_vect_in_vertice_val(fd,r->vecteur,basis);
1003  fprintf(fd,"\n");
1004  }
1005 }
void fprint_string_Value(FILE *, char *, Value)
Definition: io.c:47
void base_fprint(FILE *f, Pbase b, get_variable_name_t variable_name)
void base_fprint(FILE * f, Pbase b, char * (*variable_name)()): impression d'une base sur le fichier ...
Definition: io.c:342
string safe_entity_name(entity e)
predicates and functions for entities
Definition: entity.c:433
void print_vect_in_vertice_val(FILE *fd, Pvecteur v, Pbase b)
Definition: util.c:959
#define sg_rayons(sg)
acces au premier rayon de la liste des rayons d'un systeme generateur defini par un pointeur: sg_rayo...
Definition: sg-local.h:89
#define sg_droites(sg)
acces a la premiere droite de la liste des droites d'un systeme generateur defini par un pointeur: sg...
Definition: sg-local.h:93
struct rdte * succ
Definition: ray_dte-local.h:46
struct Svecteur * vecteur
Definition: ray_dte-local.h:45
structure de donnees Sommet
Definition: sommet-local.h:64
struct typ_som * succ
Definition: sommet-local.h:68
Pvecteur vecteur
Definition: sommet-local.h:66
Value denominateur
Definition: sommet-local.h:67

References base_fprint(), typ_som::denominateur, prettyprint_dot_context::fd, fprint_string_Value(), fprintf(), print_vect_in_vertice_val(), safe_entity_name(), sg_droites, sg_nbre_droites, sg_nbre_rayons, sg_nbre_sommets, sg_rayons, sg_sommets, SG_UNDEFINED_P, rdte::succ, typ_som::succ, rdte::vecteur, and typ_som::vecteur.

Referenced by dependence_cone_positive(), and TestDependence().

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

◆ print_dependence_graph()

bool print_dependence_graph ( string  name)
Parameters
nameame

Definition at line 126 of file prettyprint.c.

127 {
128  return print_dependence_or_chains_graph(name, true);
129 }

References print_dependence_or_chains_graph().

Referenced by print_effective_dependence_graph(), print_loop_carried_dependence_graph(), and print_whole_dependence_graph().

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

◆ print_dot_chains_graph()

bool print_dot_chains_graph ( string  name)

This pipmake pass output the chains in a file usable by the graphviz tool dot.

Parameters
nameis the name of the module, given by pipsmake
Returns
always true ? see print_dot_dependence_graph
Parameters
nameame

Definition at line 200 of file prettyprint.c.

200  {
201  return print_dot_dependence_or_chains_graph( name, false );
202 }
static bool print_dot_dependence_or_chains_graph(string mod_name, bool with_dg)
Output dependence graph in a file in graphviz dot format.
Definition: prettyprint.c:144

References print_dot_dependence_or_chains_graph().

+ Here is the call graph for this function:

◆ print_dot_dependence_graph()

bool print_dot_dependence_graph ( string  name)

This pipmake pass output the DG in a file usable by graphviz tool dot.

Parameters
nameis the name of the module, given by pipsmake
Returns
always true ? see print_dot_dependence_graph
Parameters
nameame

Definition at line 210 of file prettyprint.c.

210  {
211  return print_dot_dependence_or_chains_graph( name, true );
212 }

References print_dot_dependence_or_chains_graph().

+ Here is the call graph for this function:

◆ print_effective_dependence_graph()

bool print_effective_dependence_graph ( const  string)
Parameters
stringod_name

Definition at line 59 of file prettyprint.c.

60 {
61  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS",
62  true);
63  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS",
64  false);
65  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
66  false);
67  return print_dependence_graph(mod_name);
68 }
void set_bool_property(const char *, bool)
bool print_dependence_graph(string name)
Definition: prettyprint.c:126

References print_dependence_graph(), and set_bool_property().

+ Here is the call graph for this function:

◆ print_filtered_dependence_daVinci_graph()

bool print_filtered_dependence_daVinci_graph ( const  string)
Parameters
stringod_name

Definition at line 52 of file prettyprint.c.

53 {
54  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
55  true);
56  return print_filtered_dg_or_dvdg(mod_name, true);
57 }
bool print_filtered_dg_or_dvdg(string, bool)
Definition: trace.c:202

References print_filtered_dg_or_dvdg(), and set_bool_property().

+ Here is the call graph for this function:

◆ print_filtered_dependence_graph()

bool print_filtered_dependence_graph ( const  string)
Parameters
stringod_name

Definition at line 45 of file prettyprint.c.

46 {
47  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
48  true);
49  return print_filtered_dg_or_dvdg(mod_name, false);
50 }

References print_filtered_dg_or_dvdg(), and set_bool_property().

+ Here is the call graph for this function:

◆ print_filtered_dg_or_dvdg()

bool print_filtered_dg_or_dvdg ( string  mod_name,
bool  is_dv 
)
Parameters
mod_nameod_name
is_dvs_dv

Definition at line 202 of file trace.c.

203 {
204  string dg_name = NULL;
205  string local_dg_name = NULL;
206  FILE *fp;
207  graph dg;
209  list flt_graph;
210 
213  db_get_memory_resource(DBR_CODE, mod_name, true) );
216 
217  dg = (graph) db_get_memory_resource(DBR_DG, mod_name, true);
218 
219  flt_graph = make_filtered_dg_or_dvdg(mod_stat, dg);
220 
221  local_dg_name = db_build_file_resource_name(DBR_DG, mod_name, is_dv ? ".dvdg" : ".dg");
223  "/", local_dg_name, NULL));
224  fp = safe_fopen(dg_name, "w");
225 
226  debug_on("RICEDG_DEBUG_LEVEL");
227 
228  if (is_dv) {
229  prettyprint_graph_daVinci(fp, flt_graph);
230  } else {
231  prettyprint_graph_text(fp, flt_graph);
232  }
233 
234  debug_off();
235 
236  safe_fclose(fp, dg_name);
237  free(dg_name);
238 
239  DB_PUT_FILE_RESOURCE(is_dv ? DBR_DVDG_FILE : DBR_DG_FILE, strdup(mod_name), local_dg_name);
240 
241  gen_free_list(flt_graph);
242 
246 
247  return true;
248 }
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
Definition: lowlevel.c:169
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
void prettyprint_graph_daVinci(FILE *out_f, list l_of_vers)
print a graph to daVinci format, each label of successor is represented by a circular node,...
Definition: trace.c:63
list make_filtered_dg_or_dvdg(statement mod_stat, graph mod_graph)
Definition: trace.c:101
void prettyprint_graph_text(FILE *out_f, list l_of_vers)
print a graph to text format
Definition: trace.c:46

References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, dg, free(), gen_free_list(), get_current_module_statement(), local_name_to_top_level_entity(), make_filtered_dg_or_dvdg(), mod_stat, prettyprint_graph_daVinci(), prettyprint_graph_text(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), and strdup().

Referenced by print_filtered_dependence_daVinci_graph(), and print_filtered_dependence_graph().

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

◆ print_loop_carried_dependence_graph()

bool print_loop_carried_dependence_graph ( const  string)
Parameters
stringod_name

Definition at line 70 of file prettyprint.c.

71 {
72  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS",
73  true);
74  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS",
75  true);
76  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
77  true);
78  return print_dependence_graph(mod_name);
79 }

References print_dependence_graph(), and set_bool_property().

+ Here is the call graph for this function:

◆ print_loopnest_dependence_cone()

bool print_loopnest_dependence_cone ( const char *  module_name)

Get the loop label from the user

Parameters
module_nameodule_name

Definition at line 274 of file trace.c.

275 {
277  graph dg = (graph) db_get_memory_resource(DBR_DG, module_name, true);
278  FILE *fp;
279  string dc_name,local_dc_name;
280  statement loopnest_st;
281  bool first=true;
284  db_get_memory_resource(DBR_CODE, module_name, true) );
287  local_dc_name = db_build_file_resource_name(DBR_DC_FILE, module_name, ".dc");
288  dc_name = strdup(concatenate(db_get_current_workspace_directory(), "/", local_dc_name, NULL));
289  fp = safe_fopen(dc_name, "w");
290 
291  debug_on("RICEDG_DEBUG_LEVEL");
292 
293  /* Get the loop label from the user */
294  const char* lp_label = get_string_property("LOOP_LABEL");
295  if( string_undefined_p( lp_label))
296  pips_user_warning("No loop label", "Please precise the loop label\n");
297 
298  if(lp_label)
299  {
302  pips_user_warning("loop label does not exist\n", "Please give a valid label (%s not valid)\n",lp_label);
303  }
304  }
306  fprintf(fp,"Label: %s ",lp_label);
310  // Verify s is a statement in the loop nest
314 
317 
318  vertex v2 = successor_vertex(su);
319  statement s2 = vertex_to_statement( v2 );
320  // Verify s2 is a statement in the loop nest
324 
325  if(statement_in_loopnest_p) { // s and s2 are in the loop nest
326 
328 
329  if ( conflict_cone(c) != cone_undefined ) {
331  if( !SG_UNDEFINED_P(gs)) {
332  if (first) {
333  fprintf(fp,"- Dependence Cone Basis :");
335  first=false;
336  }
337  if( sg_nbre_rayons(gs) > 0) {
338  for (Pray_dte e = sg_rayons(gs); e != NULL; e = e->succ) {
339  print_cone_vecteur(fp,e->vecteur, gs,2);
340  }
341  }
342  if( sg_nbre_droites(gs) > 0) {
343  for (Pray_dte e = sg_droites(gs); e != NULL; e = e->succ) {
344  Pvecteur v=vect_copy(e->vecteur);
345  print_cone_vecteur(fp,e->vecteur, gs,2);
346  vect_chg_sgn(v);
347  print_cone_vecteur(fp,e->vecteur, gs,2);
348  vect_rm(v);
349  }
350  }
351  if( sg_nbre_sommets(gs) > 0) {
352  for (Psommet e = sg_sommets(gs); e != NULL; e = e->succ) {
353  print_cone_vecteur(fp,e->vecteur, gs,1);
354  }
355  }
356  }
357  }
358  }
359  }
360  }
361  }
362  }
363  if (first) fprintf(fp,"- No Dependencies");
364  }
365 
366  debug_off();
367 
368  safe_fclose(fp, dc_name);
369  free(dc_name);
370 
371  DB_PUT_FILE_RESOURCE( DBR_DC_FILE, strdup(module_name), local_dc_name);
372 
376 
377  return true;
378 }
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
#define pips_user_warning
Definition: misc-local.h:146
#define string_undefined_p(s)
Definition: newgen_types.h:41
entity find_label_entity(const char *, const char *)
util.c
Definition: util.c:43
#define entity_undefined_p(x)
Definition: ri.h:2762
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
static void statement_in_loopnest(statement s)
Definition: trace.c:252
static void print_cone_vecteur(FILE *fd, Pvecteur v, Ptsg gs, int type)
Definition: trace.c:258
entity selected_label
Interface with pipsmake for interactive loop transformations: loop interchange, hyperplane method,...
static statement test_statement_of_reference
Definition: trace.c:251
static bool statement_in_loopnest_p
Definition: trace.c:250
statement find_loop_from_label(statement, entity)
Definition: util.c:218
Pbase vect_copy(Pvecteur b)
direct duplication.
Definition: alloc.c:240
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References type_sg::base, base_fprint(), concatenate(), cone_generating_system, cone_undefined, CONFLICT, conflict_cone, db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, dg, dg_arc_label_conflicts, entity_undefined_p, find_label_entity(), find_loop_from_label(), FOREACH, fprintf(), free(), gen_recurse, gen_true(), get_current_module_statement(), get_string_property(), graph_vertices, local_name_to_top_level_entity(), mod_stat, module_name(), pips_user_warning, print_cone_vecteur(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), safe_entity_name(), safe_fclose(), safe_fopen(), selected_label, set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), sg_droites, sg_nbre_droites, sg_nbre_rayons, sg_nbre_sommets, sg_rayons, sg_sommets, SG_UNDEFINED_P, statement_domain, statement_in_loopnest(), statement_in_loopnest_p, strdup(), string_undefined_p, SUCCESSOR, successor_arc_label, successor_vertex, test_statement_of_reference, vect_chg_sgn(), vect_copy(), vect_rm(), VERTEX, vertex_successors, and vertex_to_statement().

+ Here is the call graph for this function:

◆ print_vect_in_vertice_val()

void print_vect_in_vertice_val ( FILE *  fd,
Pvecteur  v,
Pbase  b 
)
Parameters
fdd

Definition at line 959 of file util.c.

963 {
964  fprintf(fd,"(");
965  for(; b!=NULL; b=b->succ) {
966  fprint_string_Value(fd, " ",vect_coeff(b->var,v));
967  if(b->succ !=NULL)
968  fprintf(fd,",");
969  }
970  fprintf(fd," )");
971 }
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

References prettyprint_dot_context::fd, fprint_string_Value(), fprintf(), Svecteur::succ, Svecteur::var, and vect_coeff().

Referenced by print_dependence_cone().

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

◆ print_whole_dependence_graph()

bool print_whole_dependence_graph ( const string  mod_name)

prettyprint.c

prettyprint.c

Parameters
mod_nameod_name

Definition at line 34 of file prettyprint.c.

35 {
36  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_PRIVATIZED_DEPS",
37  false);
38  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITHOUT_NOLOOPCARRIED_DEPS",
39  false);
40  set_bool_property("PRINT_DEPENDENCE_GRAPH_WITH_DEPENDENCE_CONES",
41  true);
42  return print_dependence_graph(mod_name);
43 }

References print_dependence_graph(), and set_bool_property().

+ Here is the call graph for this function:

◆ quick_privatize_graph()

void quick_privatize_graph ( graph  dep_graph)

quick_privatize.c

we analyze arcs exiting from loop statements

Parameters
dep_graphep_graph

Definition at line 38 of file quick_privatize.c.

38  {
39  /* we analyze arcs exiting from loop statements */
43  if(statement_loop_p(s1)) {
44  loop l = statement_loop(s1);
45  list locals = loop_locals(l);
46  entity ind = loop_index(l);
47 
48  if(gen_find_eq(ind, locals) == entity_undefined) {
49  if(// entity_privatizable_in_loop_p(ind, l) && /* to be restored when global variables are uniformly treated everywhere. BC.*/
51  pips_debug(1, "Index for loop %" PRIdPTR " privatized\n",
53  loop_locals(l) = CONS(ENTITY, ind, locals);
54  } else {
55  pips_debug(1, "could not privatize loop %" PRIdPTR "\n",
57  }
58  }
59  }
60  }
61 }
static list successors(list l)
static graph dep_graph
Definition: deatomizer.c:65
void * gen_find_eq(const void *item, const list seq)
Definition: list.c:422
loop statement_loop(statement)
Get the loop of a statement.
Definition: statement.c:1374
static bool quick_privatize_loop(statement, list)
QUICK PRIVATIZATION
#define loop_locals(x)
Definition: ri.h:1650
#define loop_index(x)
Definition: ri.h:1640

References CONS, dep_graph, ENTITY, entity_undefined, FOREACH, gen_find_eq(), graph_vertices, loop_index, loop_locals, pips_debug, quick_privatize_loop(), s1, statement_loop(), statement_loop_p(), statement_number, successors(), VERTEX, vertex_successors, and vertex_to_statement().

Referenced by compute_dg_on_statement_from_chains_in_place(), and rice_dependence_graph().

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

◆ reset_context_map()

void reset_context_map ( void  )

Referenced by rice_update_dependence_graph().

+ Here is the caller graph for this function:

◆ ResetLoopCounter()

void ResetLoopCounter ( void  )

Definition at line 329 of file testdep_util.c.

329  {
330  ilc = 0;
331 }

References ilc.

Referenced by rice_dependence_graph().

+ Here is the caller graph for this function:

◆ rice_fast_dependence_graph()

bool rice_fast_dependence_graph ( char *  mod_name)
Parameters
mod_nameod_name

Definition at line 139 of file ricedg.c.

139  {
140  dg_type = DG_FAST;
141  return rice_dependence_graph(mod_name);
142 }
static bool rice_dependence_graph(char *)
INTERFACE FUNCTIONS
Definition: ricedg.c:230

References DG_FAST, dg_type, and rice_dependence_graph().

+ Here is the call graph for this function:

◆ rice_full_dependence_graph()

bool rice_full_dependence_graph ( char *  mod_name)
Parameters
mod_nameod_name

Definition at line 144 of file ricedg.c.

144  {
145  dg_type = DG_FULL;
146  return rice_dependence_graph(mod_name);
147 }
#define DG_FULL
Definition: ricedg.c:125

References DG_FULL, dg_type, and rice_dependence_graph().

+ Here is the call graph for this function:

◆ rice_regions_dependence_graph()

bool rice_regions_dependence_graph ( char *  mod_name)
Parameters
mod_nameod_name

Definition at line 154 of file ricedg.c.

154  {
156  "REGION_CHAINS"))
157  pips_user_warning("Region chains not selected - using effects instead\n");
158 
159  dg_type = DG_FAST;
160  return rice_dependence_graph(mod_name);
161 }
#define rule_phase(x)
Definition: makefile.h:244
rule find_rule_by_resource(const char *rname)
This function returns the active rule to produce resource rname.
Definition: pipsmake.c:694

References DG_FAST, dg_type, find_rule_by_resource(), pips_user_warning, rice_dependence_graph(), rule_phase, and same_string_p.

+ Here is the call graph for this function:

◆ rice_semantics_dependence_graph()

bool rice_semantics_dependence_graph ( char *  mod_name)
Parameters
mod_nameod_name

Definition at line 149 of file ricedg.c.

149  {
151  return rice_dependence_graph(mod_name);
152 }
#define DG_SEMANTICS
Definition: ricedg.c:126

References DG_SEMANTICS, dg_type, and rice_dependence_graph().

+ Here is the call graph for this function:

◆ sc_add_di()

void sc_add_di ( int  l,
entity  e,
Psysteme  s,
int  li 
)
Parameters
lii

Definition at line 209 of file testdep_util.c.

210  {
211  Variable v = (Variable)GetDiVar(l);
212  Value vli = int_to_value(li);
213  Pcontrainte pc;
214 
215  for (pc = s->egalites; pc != NULL; pc = pc->succ) {
216  Value ve = vect_coeff((Variable)e, pc->vecteur);
217  value_product(ve, vli);
218  vect_add_elem(&(pc->vecteur), v, ve);
219  }
220 
221  for (pc = s->inegalites; pc != NULL; pc = pc->succ) {
222  Value ve = vect_coeff((Variable)e, pc->vecteur);
223  value_product(ve, vli);
224  vect_add_elem(&(pc->vecteur), v, ve);
225  }
226 }
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
int Value
#define value_product(v, w)
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
Pcontrainte egalites
Definition: sc-local.h:70
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

References Ssysteme::egalites, GetDiVar(), Ssysteme::inegalites, int_to_value, Scontrainte::succ, value_product, vect_add_elem(), vect_coeff(), and Scontrainte::vecteur.

Referenced by build_and_test_dependence_context().

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

◆ sc_add_dsi()

void sc_add_dsi ( int  l,
entity  e,
Psysteme  s 
)

Definition at line 238 of file testdep_util.c.

239  {
240  Variable v = (Variable)GetDsiVar(l);
241  Pcontrainte pc;
242  for (pc = s->egalites; pc != NULL; pc = pc->succ) {
243  vect_add_elem(&(pc->vecteur), v, vect_coeff((Variable)e, pc->vecteur));
244  }
245 
246  for (pc = s->inegalites; pc != NULL; pc = pc->succ) {
247  vect_add_elem(&(pc->vecteur), v, vect_coeff((Variable)e, pc->vecteur));
248  }
249 }
entity GetDsiVar(int l)
Definition: testdep_util.c:164

References Ssysteme::egalites, GetDsiVar(), Ssysteme::inegalites, Scontrainte::succ, vect_add_elem(), vect_coeff(), and Scontrainte::vecteur.

Referenced by build_and_test_dependence_context().

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

◆ sc_faisabilite_optim()

bool sc_faisabilite_optim ( Psysteme  sc)

bool sc_faisabilite_optim (Psysteme sc) :

Test system sc feasibility by successive projections along all variables in its basis.

carry out the projection with function sc_projection_optim_along_vecteur().

sc_normalize() is called here before the projection, which means that sc may be deallocated

result :

boolean : true if system is faisable false else

Modification:

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

Parameters
scc

Definition at line 484 of file testdep_util.c.

485  {
486  debug(6, "sc_faisabilite_optim", "begin\n");
487  sc = sc_normalize(sc);
488  if(!sc_empty_p(sc)) {
489  /* Automatic variables read in a CATCH block need to be declared volatile as
490  * specified by the documentation*/
491  Psysteme volatile sc1 = sc_dup(sc);
492  is_test_Di = false;
493 
495  pips_debug(7, "overflow error, returning TRUE. \n");
496  sc_rm(sc1);
497  debug(6, "sc_faisabilite_optim", "end\n");
498  return (true);
499 
500  } TRY {
501  Pbase base_sc1 = base_dup(sc1->base);
502  sc1 = sc_projection_optim_along_vecteur_ofl(sc1, base_sc1);
503  base_rm(base_sc1);
504  if(sc_empty_p(sc1)) {
505  debug(7, "sc_faisabilite_optim", "system not feasible\n");
506  debug(6, "sc_faisabilite_optim", "end\n");
507  sc_rm(sc);
509  return (false);
510  } else {
511  sc_rm(sc1);
512  debug(7, "sc_faisabilite_optim", "system feasible\n");
513  debug(6, "sc_faisabilite_optim", "end\n");
515  return (true);
516  }
517  }
518  } else {
519  debug(7, "sc_faisabilite_optim", "normalized system not feasible\n");
520  debug(6, "sc_faisabilite_optim", "end\n");
521  sc_rm(sc);
522  return (false);
523  }
524 }
#define CATCH(what)
@ overflow_error
#define UNCATCH(what)
#define TRY
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
bool is_test_Di
Definition: ricedg.h:159
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
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Definition: sc_alloc.c:350
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
Pbase base
Definition: sc-local.h:75
Psysteme sc_projection_optim_along_vecteur_ofl(Psysteme sc, Pvecteur pv)
Psysteme sc_projection_optim_along_vecteur_ofl(Psysteme sc, Pvecteur pv)
Definition: testdep_util.c:648
#define base_rm(b)
Pbase base_dup(Pbase b)
Pbase base_dup(Pbase b) Note: this function changes the value of the pointer.
Definition: alloc.c:268

References Ssysteme::base, base_dup(), base_rm, CATCH, debug(), is_test_Di, overflow_error, pips_debug, sc_dup(), sc_empty_p(), sc_normalize(), sc_projection_optim_along_vecteur_ofl(), sc_rm(), TRY, and UNCATCH.

Referenced by TestDependence().

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

◆ sc_invers()

Psysteme sc_invers ( Psysteme  ps)

Psysteme sc_invers(Psysteme ps): calcul un systeme des contraintes qui est l'invers du systeme initial.

pour chaque element b dans le base initial, remplace b par -b dans le systeme initial.

Parameters
pss

Definition at line 1060 of file testdep_util.c.

1061  {
1062  Pbase b;
1063  Pcontrainte eq;
1064  Variable v;
1065 
1066  for (b = ps->base; !VECTEUR_NUL_P(b); b = b->succ) {
1067  v = vecteur_var(b);
1068  for (eq = ps->egalites; eq != NULL; eq = eq->succ)
1070 
1071  for (eq = ps->inegalites; eq != NULL; eq = eq->succ)
1073  }
1074  return (ps);
1075 }
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
void vect_chg_var_sign(Pvecteur *ppv, Variable var)
void vect_chg_var_sign(Pvecteur *ppv, Variable var) changement de signe de la coordonnee var du vecte...
#define vecteur_var(v)
#define VECTEUR_NUL_P(v)

References eq, Scontrainte::succ, Svecteur::succ, vect_chg_var_sign(), Scontrainte::vecteur, VECTEUR_NUL_P, and vecteur_var.

Referenced by TestDependence().

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

◆ sc_minmax_of_variable_optim()

bool sc_minmax_of_variable_optim ( Psysteme volatile  ps,
Variable  var,
Value pmin,
Value pmax 
)

void sc_minmax_of_variable_optim(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour trouver le minimum et le maximum d'une variable apparaissant dans ce systeme par projection a la Fourier-Motzkin.

la procedure retourne la valeur false si le systeme est infaisable et true sinon

le systeme ps est detruit.

projection sur toutes les variables sauf var

cette contrainte nous donne une borne max

cette contrainte nous donne une borne min

Parameters
pss
varar
pminmin
pmaxmax

Definition at line 975 of file testdep_util.c.

976  {
977  Value val;
978  Pcontrainte pc;
979  Pbase b;
980  Pvecteur pv = NULL;
981 
982  *pmax = VALUE_MAX;
983  *pmin = VALUE_MIN;
984 
985  if(sc_value_of_variable(ps, var, &val) == true) {
986  *pmin = val;
987  *pmax = val;
988  return true;
989  }
990 
991  /* projection sur toutes les variables sauf var */
992  for (b = ps->base; !VECTEUR_NUL_P(b); b = b->succ) {
993  Variable v = vecteur_var(b);
994  if(v != var) {
995  vect_add_elem(&pv, v, 1);
996  }
997  }
998 
1000  debug(6,
1001  "sc_minmax_of_variable_optim",
1002  " overflow error, returning INT_MAX and INT_MIN. \n");
1003  *pmax = INT_MAX;
1004  *pmin = INT_MIN;
1005  } TRY {
1006 
1008  if(sc_empty_p(ps)) {
1009  sc_rm(ps);
1011  return false;
1012  }
1013  if(sc_empty_p(ps = sc_normalize(ps))) {
1014  sc_rm(ps);
1016  return false;
1017  }
1018 
1019  if(sc_value_of_variable(ps, var, &val) == true) {
1020  *pmin = val;
1021  *pmax = val;
1023  return true;
1024  }
1025 
1026  for (pc = ps->inegalites; pc != NULL; pc = pc->succ) {
1027  Value cv = vect_coeff(var, pc->vecteur);
1029 
1030  if(value_pos_p(cv)) {
1031  /* cette contrainte nous donne une borne max */
1032  Value bs = value_pdiv(cc,cv);
1033  if(value_lt(bs,*pmax))
1034  *pmax = bs;
1035  } else if(value_neg_p(cv)) {
1036  /* cette contrainte nous donne une borne min */
1037  Value bi = value_pdiv(cc,cv);
1038  if(value_gt(bi,*pmin))
1039  *pmin = bi;
1040  }
1041  }
1042 
1044  vect_rm(pv);
1045  }
1046 
1047  if(value_lt(*pmax,*pmin))
1048  return false;
1049 
1050  sc_rm(ps);
1051 
1052  return true;
1053 }
#define value_pos_p(val)
#define value_gt(v1, v2)
#define value_pdiv(v1, v2)
#define value_uminus(val)
unary operators on values
#define VALUE_MIN
#define VALUE_MAX
#define value_lt(v1, v2)
#define value_neg_p(val)
bool sc_value_of_variable(Psysteme ps, Variable var, Value *pval)
bool sc_value_for_variable(Psysteme ps, Variable var, Value *pval): examine les egalites du systeme p...
Definition: sc_eval.c:70
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.

References CATCH, debug(), overflow_error, sc_empty_p(), sc_normalize(), sc_projection_optim_along_vecteur_ofl(), sc_rm(), sc_value_of_variable(), Scontrainte::succ, Svecteur::succ, TCST, TRY, UNCATCH, value_gt, value_lt, VALUE_MAX, VALUE_MIN, value_neg_p, value_pdiv, value_pos_p, value_uminus, vect_add_elem(), vect_coeff(), vect_rm(), Scontrainte::vecteur, VECTEUR_NUL_P, and vecteur_var.

Referenced by TestDiVariables().

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

◆ sc_proj_on_di()

int sc_proj_on_di ( int  cl,
Psysteme  s 
)
Parameters
cll

Definition at line 267 of file testdep_util.c.

268  {
269  Pbase coord;
270 
271  for (coord = s->base; !VECTEUR_NUL_P(coord); coord = coord->succ) {
272  Variable v = vecteur_var(coord);
273  int l = DiVarLevel((entity)v);
274 
275  if(l <= 0 || l > cl) {
276  debug(8,
277  "ProjectOnDi",
278  "projection sur %s\n",
280  if(SC_EMPTY_P(s = sc_projection_pure(s, v))) {
281  debug(8, "ProjectOnDi", "infaisable\n");
282  return (false);
283  }
284  debug(8, "ProjectOnDi", "faisable\n");
285  }
286  }
287 
288  return (true);
289 }
int DiVarLevel(entity e)
this function returns the nesting level of a given di variable e.
Definition: testdep_util.c:185

References Ssysteme::base, debug(), DiVarLevel(), entity_local_name(), Svecteur::succ, VECTEUR_NUL_P, and vecteur_var.

+ Here is the call graph for this function:

◆ sc_proj_optim_on_di_ofl()

int sc_proj_optim_on_di_ofl ( int  cl,
Psysteme psc 
)

int sc_proj_optim_on_di_ofl(cl, sc)

This function projects a system onto a set of di variables. This set is defined by cl, the common nesting level of the two array references being tested: only di variables whose nesting level is less than or equal to cl are kept in the projected system (i.e. outermost loops).

The projection is performed by first eliminating variables in the equations. Variables whose coefficients are 1 or -1 are considered first. (in such case it's integer elimination). Remaining inequalities are projected by Fourier-Motzkin elimination.

cl is the common nesting level. sc is the system to project. sc is modified but psc always points to a consistent Psysteme on return (i.e. it's up to the caller to free it). *psc on return is sc_empty() if *psc on entry turns out to be non-feasible. a long jump buffer must have been initialized to handle overflows The value returned is true if the system is feasible, false otherwise.

find the set of variables to be eliminated

find one

Parameters
cll
pscsc

Definition at line 415 of file testdep_util.c.

416 {
417  Pbase coord;
418  Pvecteur pv = VECTEUR_NUL;
419  Variable v;
420  int l;
421  int res;
422 
423  pips_debug(6, "begin\n");
424 
425  /* find the set of variables to be eliminated */
426  for (coord = (*psc)->base; !VECTEUR_NUL_P(coord); coord = coord->succ) {
427  v = vecteur_var(coord);
428  l = DiVarLevel((entity)v);
429 
430  if(l <= 0 || l > cl) /* find one */
431  vect_add_elem(&pv, v, 1);
432  }
433 
434  ifdebug(6) {
435  fprintf(stderr, "The list of variables to be eliminated is :\n");
436  vect_debug(pv);
437  }
438  is_test_Di = true;
439 
440  pips_assert("Dependence system *psc is consistent before projection",
441  sc_consistent_p(*psc));
442 
443  *psc = sc_projection_optim_along_vecteur_ofl(*psc, pv);
444 
445  pips_assert("Dependence system *psc is consistent after projection",
446  sc_consistent_p(*psc));
447 
448  if(sc_empty_p(*psc))
449  res = false;
450  else
451  res = true;
452 
453 
454  vect_rm(pv);
455 
456 
457  pips_assert("Dependence system *psc is consistent after empty test",
458  sc_consistent_p(*psc));
459  pips_debug(6, "end\n");
460 
461  return res;
462 }
void vect_debug(Pvecteur v)
constraint.c
Definition: constraint.c:43
bool sc_consistent_p(Psysteme sc)
bool sc_consistent_p(Psysteme sc): check that sc is well defined, that the numbers of equalities and ...
Definition: sc.c:282
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.

References DiVarLevel(), fprintf(), ifdebug, is_test_Di, pips_assert, pips_debug, sc_consistent_p(), sc_empty_p(), sc_projection_optim_along_vecteur_ofl(), Svecteur::succ, vect_add_elem(), vect_debug(), vect_rm(), VECTEUR_NUL, VECTEUR_NUL_P, and vecteur_var.

Referenced by TestDependence().

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

◆ sc_projection_optim_along_vecteur_ofl()

Psysteme sc_projection_optim_along_vecteur_ofl ( Psysteme  sc,
Pvecteur  pv 
)

Psysteme sc_projection_optim_along_vecteur_ofl(Psysteme sc, Pvecteur pv)

This fonction returns the projected system resulting of the SUCCESSIVE projections of the system sc along the variables contained in vecteur pv. Variables are only more or less projected according to their order in pv.

The projection is done first by eliminating variables constrained by equations. The variables whose coefficients are 1 (or -1?) are considered first (in such case it is a valide integer elimination), then variables appearing in equations with non unit coefficient, and finally all left over variables in pv using Fourier-Motzkin elimination. At each step, the order in pv is used.

If the system sc is not faisable, SC_EMPTY is returned.

FI: this function could be moved to linear... but for the debugging stuff. Also, it could be broken into three parts. And the number of return statements should be reduced to one.

The elimination of variables using equations

First,carry out the integer elimination possible

coeff == 1, do this integer elimination for variable v with the others contrainte(equations and inequations

remove v from the list of variables to be projected pve

it's in head

carry out the non-exact elimination if necessary and possible using other equations

find a variable which appears in the equations, eliminate it

liminate v in the list of variables pve

it's in head

carry out the elimination using Fourier-Motzkin for the other variables

detection of non feasability of Psysteme sc

sc->inegalites = contrainte_sort(sc->inegalites, sc->base, BASE_NULLE,

true, false);

ifdebug(8) {

debug(8, "", "Sorted system :\n");

sc_syst_debug(sc);

}

Are we done? This used to be always true, but sc_normalize() may promote inequalities as equations. Since the projection steps may reveal some implicit equations, we are not sure here that all projections have been performed by the three steps (equations, equations, inequalities).

See for instance the test dependence in SAC/sgemm for such an example.

Update the base and the dimension of the constraint system sc

Clean up auxiliary data structures

Parameters
scc
pvv

Definition at line 648 of file testdep_util.c.

649 {
650  Pcontrainte eq;
651  Pvecteur pv1, prv, pve;
652  Variable v;
653  Value coeff;
654  int syst_size_init;
655  Pbase base_sc = base_dup(sc->base);
656  Pbase lb = BASE_NULLE;
657 
658  pips_assert("The input constraint system is consistent", sc_consistent_p(sc));
659  ifdebug(7) {
660  pips_debug(7, "All variables to project: ");
661  vect_dump(pv);
662  }
663 
664  pve = vect_dup(pv);
665  Pvecteur pve_to_free = pve;
666 
667  do {
668  /* The elimination of variables using equations */
669  if(pve != NULL && sc->nb_eq != 0) {
670 
671  /* First,carry out the integer elimination possible */
672  pips_debug(7, "carry out the integer elimination by equation:\n");
673 
674  prv = NULL;
675  pv1 = pve;
676  while(!VECTEUR_NUL_P(pv1) && (sc->nb_eq != 0)) {
677  v = pv1->var;
678  eq = contrainte_var_min_coeff(sc->egalites, v, &coeff, false);
679  if((eq == NULL) || value_notone_p(coeff)) {
680  prv = pv1;
681  pv1 = pv1->succ;
682  } else {
683  ifdebug(7) {
684  fprintf(stderr, "eliminate %s by :", entity_local_name((entity)v));
685  egalite_debug(eq);
686  }
687  /* coeff == 1, do this integer elimination for variable
688  * v with the others contrainte(equations and inequations */
689  sc = sc_variable_substitution_with_eq_ofl_ctrl(sc, eq, v, FWD_OFL_CTRL);
690 
691  if(sc_empty_p(sc)) {
692  if(is_test_Di)
693  NbrTestProjEqDi++;
694  else
695  NbrTestProjEq++;
696  pips_debug(7, "projection infaisable\n");
697  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
698  v = pv1->var;
700  }
701  base_rm(base_sc);
702  vect_rm(pve_to_free);
703 
704  pips_debug(7, "Return 1: empty\n");
705  return (sc);
706  }
707  sc = sc_normalize(sc);
708 
709  if(sc_empty_p(sc)) { // FI: another normalization step is going to occur here
710  if(is_test_Di)
711  NbrTestProjEqDi++;
712  else
713  NbrTestProjEq++;
714  pips_debug(7, "normalisation infaisable\n");
715 
716  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
717  v = pv1->var;
719  }
720 
721  vect_rm(pve_to_free);
722 
723  pips_debug(7, "Return 2: empty\n");
724  return (sc);
725 
726  }
727 
728  // The removal is delayed till the end of the function. sc is
729  // still consistent. However, too many variables might be left if an
730  // intermediate return occurs
731  // sc_base_remove_variable(sc, v);
732 
733  ifdebug(7) {
734  fprintf(stderr, "projected normalised system is:\n");
735  sc_syst_debug(sc);
736  }
737 
738  /* remove v from the list of variables to be projected pve */
739  if(prv == NULL) /* it's in head */
740  pve = pv1 = pv1->succ;
741  else {
742  prv->succ = pv1->succ;
743  free(pv1);
744  pv1 = prv->succ;
745  }
746  }
747  }
748  }
749 
750  pips_assert("sc is consistent after the first use of equations",
751  sc_consistent_p(sc));
752  ifdebug(7) {
753  pips_debug(7, "Variables left to project after the first step: ");
754  vect_dump(pv);
755  }
756 
757  /* carry out the non-exact elimination if necessary and possible
758  using other equations */
759  if(pve != NULL && sc->egalites != NULL) {
760  pips_debug(7, "carry out the non integer elimination by equation:\n");
761  pv1 = pve;
762  prv = NULL;
763  while((sc->egalites != 0) && (pv1 != NULL)) {
764  v = pv1->var;
765  eq = contrainte_var_min_coeff(sc->egalites, v, &coeff, true);
766  if(eq == NULL && pv1 != NULL) {
767  prv = pv1;
768  pv1 = pv1->succ;
769  } else {
770  if(eq != NULL) {
771  /* find a variable which appears in the equations, eliminate it*/
772  ifdebug(7) {
773  fprintf(stderr, "eliminate %s by :", entity_local_name((entity)v));
774  egalite_debug(eq);
775  }
776  if(is_test_inexact_eq == false)
777  is_test_inexact_eq = true;
778  if(is_test_exact)
779  is_test_exact = false;
780 
781  sc = sc_variable_substitution_with_eq_ofl_ctrl(sc,
782  eq,
783  v,
784  FWD_OFL_CTRL);
785  if(sc_empty_p(sc)) {
786  if(is_test_Di)
787  NbrTestProjEqDi++;
788  else
789  NbrTestProjEq++;
790  pips_debug(7, "projection-infaisable\n");
791 
792  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
793  v = pv1->var;
795  }
796  base_rm(base_sc);
797  vect_rm(pve_to_free);
798 
799  pips_debug(7, "Return 3: empty\n");
800  return sc;
801  }
802 
803  sc = sc_normalize(sc);
804 
805  if(sc_empty_p(sc)) { // FI: should be sc_is_empty_p... or
806  // the normalization is repeated...
807  pips_debug(7, "normalization detects a non-feasible constraint system\n");
808  if(is_test_Di)
809  NbrTestProjEqDi++;
810  else
811  NbrTestProjEq++;
812 
813  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
814  v = pv1->var;
816  }
817 
818  vect_rm(pve_to_free);
819 
820  pips_debug(7, "Return 4: empty\n");
821  return sc;
822  }
823 
824  // FI: the removal is delayed to end of this function, but
825  // sc is nevertheless consistent
826  // sc_base_remove_variable(sc, v);
827  ifdebug(7) {
828  fprintf(stderr, "projected normalised system is:\n");
829  sc_syst_debug(sc);
830  }
831  /*eliminate v in the list of variables pve*/
832  if(prv == NULL) /* it's in head */
833  pve = pv1 = pv1->succ;
834  else
835  prv->succ = pv1 = pv1->succ;
836  }
837  }
838  }
839  }
840 
841  pips_assert("sc is consistent after the second use of equations",
842  sc_consistent_p(sc));
843  ifdebug(7) {
844  pips_debug(7, "Variables left to project with Fourier-Motzkin: ");
845  vect_dump(pve);
846  }
847 
848  /* carry out the elimination using Fourier-Motzkin for the other variables */
849 
850  if(pve != NULL) {
851  pv1 = pve;
852 
853  while(pv1 != NULL) {
854 
855  NbrProjFMTotal++;
856  syst_size_init = nb_elems_list(sc->inegalites);
857  v = pv1->var;
858 
859  ifdebug(7) {
860  fprintf(stderr, "eliminate %s by F-M\n", entity_local_name((entity)v));
861  pips_debug(7, "is_test_exact before: ");
862  if(is_test_exact)
863  fprintf(stderr, "%s\n", "exact");
864  else
865  fprintf(stderr, "%s\n", "not exact");
866  }
867 
868  if(combiner_ofl_with_test(sc, v) == false) {
869  /* detection of non feasability of Psysteme sc */
870  if(is_test_Di)
871  NbrTestProjFMDi++;
872  else
873  NbrTestProjFM++;
874  sc_rm(sc);
875  sc = sc_empty(base_sc);
876  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
877  v = pv1->var;
879  }
880 
881  vect_rm(pve_to_free);
882 
883  pips_debug(7, "Return 5: empty\n");
884  return sc;
885  }
886 
887  sc = sc_normalize(sc);
888 
889  if(sc_empty_p(sc)) {
890  if(is_test_Di)
891  NbrTestProjFMDi++;
892  else
893  NbrTestProjFM++;
894  pips_debug(7, "normalisation-infaisable\n");
895  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
896  v = pv1->var;
898  }
899 
900  vect_rm(pve_to_free);
901 
902  pips_debug(7, "Return 6: empty\n");
903  return sc;
904  }
905 
906  /* sc->inegalites = contrainte_sort(sc->inegalites, sc->base, BASE_NULLE, */
907  /* true, false); */
908 
909  /* ifdebug(8) { */
910  /* debug(8, "", "Sorted system :\n"); */
911  /* sc_syst_debug(sc); */
912  /* } */
913 
915 
916  ifdebug(7) {
917  pips_debug(7, "is_test_exact after: ");
918  if(is_test_exact)
919  fprintf(stderr, "%s\n", "exact");
920  else
921  fprintf(stderr, "%s\n", "not exact");
922  fprintf(stderr, "projected normalised system is:\n");
923  sc_syst_debug(sc);
924  }
925  if(nb_elems_list(sc->inegalites) <= syst_size_init)
926  NbrFMSystNonAug++;
927  pv1 = pv1->succ;
928  }
929  }
930 
931  pips_assert("sc is consistent before base update", sc);
932 
933  /* Are we done? This used to be always true, but sc_normalize()
934  may promote inequalities as equations. Since the projection
935  steps may reveal some implicit equations, we are not sure here
936  that all projections have been performed by the three steps
937  (equations, equations, inequalities).
938 
939  See for instance the test dependence in SAC/sgemm for such an example.
940  */
941  Pbase mb = sc_to_minimal_basis(sc);
942  lb = base_intersection(mb, pv);
943  vect_rm(mb);
944 
945  } while(!BASE_NULLE_P(lb)); // No need to free lb since it is empty
946 
947  /* Update the base and the dimension of the constraint system sc */
948 
949  sc->nb_ineq = nb_elems_list(sc->inegalites);
950  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
951  v = pv1->var;
953  }
954 
955  pips_assert("sc is consistent after base update", sc);
956 
957  /* Clean up auxiliary data structures */
958  vect_rm(pve_to_free);
959  base_rm(base_sc);
960 
961  pips_debug(7, "final return: faisable\n");
962 
963  return sc;
964 }
#define value_notone_p(val)
Pbase base_intersection(Pbase b1, Pbase b2)
Return variables/dimensions present in bases b1 and b2.
Definition: base.c:473
void prv(Pvecteur pv)
Definition: comp_util.c:246
void sc_syst_debug(Psysteme s)
constraint_to_text.c
void egalite_debug(Pcontrainte c)
Pcontrainte contrainte_var_min_coeff(Pcontrainte, Variable, Value *, bool)
Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list ...
Definition: unaires.c:345
int nb_elems_list(Pcontrainte)
int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes
Definition: listes.c:129
void vect_dump(Pvecteur v)
void vect_dump(Pvecteur v): print sparse vector v on stderr.
Definition: io.c:304
int NbrTestProjFMDi
Definition: ricedg.h:148
int NbrFMSystNonAug
Definition: ricedg.h:153
int NbrProjFMTotal
Definition: ricedg.h:152
bool is_test_inexact_eq
Definition: ricedg.h:156
int NbrTestProjEq
Definition: ricedg.h:149
bool is_test_exact
or counting the number of F-M complexity less than 16.
Definition: ricedg.h:155
int NbrTestProjEqDi
Definition: ricedg.h:147
int NbrTestProjFM
Definition: ricedg.h:150
void sc_base_remove_variable(Psysteme sc, Variable v)
Definition: sc.c:239
Psysteme sc_empty(Pbase b)
Psysteme sc_empty(Pbase b): build a Psysteme with one unfeasible constraint to define the empty subsp...
Definition: sc_alloc.c:319
Pbase sc_to_minimal_basis(Psysteme ps)
creation d'une base contenant toutes les variables apparaissant avec des coefficients non-nuls dans l...
Definition: sc_alloc.c:76
void build_sc_nredund_2pass_ofl_ctrl(Psysteme volatile *psc, int ofl_ctrl)
int nb_ineq
Definition: sc-local.h:73
int nb_eq
Definition: sc-local.h:72
static bool combiner_ofl_with_test(Psysteme sc, Variable v)
bool combiner_ofl_with_test(Psysteme sc, Variable v):
Definition: testdep_util.c:533
#define FWD_OFL_CTRL
#define BASE_NULLE_P(b)
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 Ssysteme::base, base_dup(), base_intersection(), BASE_NULLE, BASE_NULLE_P, base_rm, build_sc_nredund_2pass_ofl_ctrl(), combiner_ofl_with_test(), contrainte_var_min_coeff(), egalite_debug(), Ssysteme::egalites, entity_local_name(), eq, fprintf(), free(), FWD_OFL_CTRL, ifdebug, Ssysteme::inegalites, is_test_Di, is_test_exact, is_test_inexact_eq, nb_elems_list(), Ssysteme::nb_eq, Ssysteme::nb_ineq, NbrFMSystNonAug, NbrProjFMTotal, NbrTestProjEq, NbrTestProjEqDi, NbrTestProjFM, NbrTestProjFMDi, pips_assert, pips_debug, prv(), sc_base_remove_variable(), sc_consistent_p(), sc_empty(), sc_empty_p(), sc_normalize(), sc_rm(), sc_syst_debug(), sc_to_minimal_basis(), Svecteur::succ, value_notone_p, Svecteur::var, vect_dump(), vect_dup(), vect_rm(), and VECTEUR_NUL_P.

Referenced by sc_faisabilite_optim(), sc_minmax_of_variable_optim(), and sc_proj_optim_on_di_ofl().

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

◆ set_context_map()

void set_context_map ( statement_mapping  )

Referenced by rice_update_dependence_graph().

+ Here is the caller graph for this function:

◆ statement_context_undefined_p()

bool statement_context_undefined_p ( statement  )

◆ statements_to_successors()

hash_table statements_to_successors ( list  statements,
graph  dg 
)

creates a hash_table containing statements from statements as keys and their respective succesors according to dg as values

Parameters
statementsinput statements
dgdependecy graph
Returns
allocated hash_table with (statement,successors pairs)
Parameters
statementstatements
dgg

Definition at line 1018 of file util.c.

1019 {
1022  {
1024  if( !statement_undefined_p(gen_find_eq(s,statements)))
1025  {
1026  list succ = vertex_successors(v);
1027  hash_put(successors,s,succ);
1028  }
1029  }
1030  return successors;
1031 }
@ hash_pointer
Definition: newgen_hash.h:32
#define HASH_DEFAULT_SIZE
Definition: newgen_hash.h:26

References dg, FOREACH, gen_find_eq(), graph_vertices, HASH_DEFAULT_SIZE, hash_pointer, hash_put(), hash_table_make(), statement_undefined_p, successors(), VERTEX, vertex_successors, and vertex_to_statement().

Referenced by fs_filter(), and if_conversion_compact_stats().

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

◆ store_statement_context()

void store_statement_context ( statement  ,
Psysteme   
)

◆ successor_sort_callback()

int successor_sort_callback ( const successor succ1,
const successor succ2 
)

This is a callback for qsort function, it compares two successor.

Returns
0 if these are equals, -1 if first is lower, 1 if second is lower
Parameters
succ1ucc1
succ2ucc2

Definition at line 116 of file util.c.

116  {
117  vertex v1 = successor_vertex(*succ1);
118  vertex v2 = successor_vertex(*succ2);
119  return vertex_sort_callback( &v1, &v2 );
120 }

References successor_vertex, and vertex_sort_callback().

Referenced by prettyprint_dependence_graph(), and xml_Chain_Graph().

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

◆ TestCoupleOfReferences()

list TestCoupleOfReferences ( list  ,
Psysteme  ,
statement  ,
effect  ,
reference  ,
list  ,
Psysteme  ,
statement  ,
effect  ,
reference  ,
list  ,
Ptsg ,
list ,
Ptsg  
)

◆ 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:

◆ update_statement_context()

void update_statement_context ( statement  ,
Psysteme   
)

◆ vect_chg_var_sign()

void vect_chg_var_sign ( Pvecteur ppv,
Variable  var 
)

void vect_chg_var_sign(Pvecteur *ppv, Variable var) changement de signe de la coordonnee var du vecteur *ppv

Parameters
ppvpv
varar

Definition at line 1080 of file testdep_util.c.

1081  {
1082  Pvecteur pvcour;
1083 
1084  for (pvcour = (*ppv); pvcour != NULL; pvcour = pvcour->succ)
1085  if(pvcour->var == var)
1086  value_oppose(pvcour->val);
1087 
1088  return;
1089 }
#define value_oppose(ref)
Value val
Definition: vecteur-local.h:91

References Svecteur::succ, Svecteur::val, value_oppose, and Svecteur::var.

Referenced by sc_invers().

+ Here is the caller graph for this function:

◆ vertex_ordering()

int vertex_ordering ( vertex  v)

Definition at line 51 of file util.c.

52 {
54  return dg_vertex_label_statement(dvl);
55 }
struct _newgen_struct_dg_vertex_label_ * dg_vertex_label
Definition: dg.h:68

References dg_vertex_label_statement, and vertex_vertex_label.

Referenced by compare_vertex(), get_vertex_of_statement(), and init_statement_equivalence_table().

+ Here is the caller graph for this function:

◆ vertex_sort_callback()

int vertex_sort_callback ( const vertex v1,
const vertex v2 
)

This is a callback for qsort function, it compares two vertex.

Returns
0 if these are equals, -1 if first is lower, 1 if second is lower
Parameters
v11
v22

Definition at line 105 of file util.c.

105  {
107  statement s2 = vertex_to_statement( *v2 );
108  return statement_number(s1) > statement_number(s2);
109 }

References s1, statement_number, and vertex_to_statement().

Referenced by prettyprint_dependence_graph(), successor_sort_callback(), and xml_Chain_Graph().

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

◆ vertex_to_statement()

statement vertex_to_statement ( vertex  v)

cproto-generated files

util.c

cproto-generated files

This information is kept in a static hash_table named OrderingToStatement. See ri-util/ordering.c for more information.

Definition at line 45 of file util.c.

46 {
49 }
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
Definition: ordering.c:111

Referenced by prettyprint_dependence_graph(), prettyprint_dependence_graph_view(), prettyprint_dot_dependence_graph(), statements_to_successors(), and vertex_sort_callback().

+ Here is the caller graph for this function:

◆ writeresult()

void writeresult ( char *  mod_name)

to avoid warnings from compiler

Parameters
mod_nameod_name

Definition at line 2268 of file ricedg.c.

2268  {
2269  FILE *fp;
2270  string filename;
2271  int i, j;
2272 
2273  switch(dg_type) {
2274  case DG_FAST:
2275  filename = "resulttestfast";
2276  break;
2277  case DG_FULL:
2278  filename = "resulttestfull";
2279  break;
2280  case DG_SEMANTICS:
2281  filename = "resulttestseman";
2282  break;
2283  default:
2284  pips_internal_error("erroneous dg type.");
2285  return; /* to avoid warnings from compiler */
2286  }
2287 
2289  "/",
2290  mod_name,
2291  ".",
2292  filename,
2293  0));
2294 
2295  fp = safe_fopen(filename, "w");
2296 
2297  fprintf(fp, "%s", mod_name);
2298  fprintf(fp,
2299  " %d %d %d %d %d %d %d %d %d %d",
2301  NbrIndepFind,
2302  NbrAllEquals,
2303  NbrDepCnst,
2304  NbrTestExact,
2308  NbrScalDep,
2309  NbrIndexDep);
2310  for (i = 0; i <= 4; i++)
2311  for (j = 0; j <= 2; j++)
2312  fprintf(fp, " %d", deptype[i][j]);
2313  for (i = 0; i <= 4; i++)
2314  for (j = 0; j <= 2; j++)
2315  fprintf(fp, " %d", constdep[i][j]);
2316  fprintf(fp,
2317  " %d %d %d %d %d %d %d %d %d %d %d",
2318  NbrTestCnst,
2319  NbrTestGcd,
2320  NbrTestSimple,
2321  NbrTestDiCnst,
2324  NbrTestProjEq,
2325  NbrTestProjFM,
2326  NbrTestDiVar,
2328  NbrFMSystNonAug);
2329  for (i = 0; i < 18; i++)
2330  fprintf(fp, " %d", FMComp[i]);
2331  fprintf(fp, "\n");
2332 
2333  safe_fclose(fp, filename);
2334  free(filename);
2335 }
int NbrAllEquals
Definition: ricedg.c:66
int FMComp[18]
Definition: ricedg.c:86
int NbrTestProjFMDi
Definition: ricedg.c:80
int NbrArrayDepInit
Dependence Graph computation for Allen & Kennedy algorithm.
Definition: ricedg.c:64
int NbrTestExact
Definition: ricedg.c:68
int NbrFMSystNonAug
Definition: ricedg.c:85
int NbrScalDep
Definition: ricedg.c:72
int NbrIndepFind
Definition: ricedg.c:65
int NbrTestDiCnst
by sc_normalize()
Definition: ricedg.c:78
int NbrProjFMTotal
Definition: ricedg.c:84
int NbrTestGcd
Definition: ricedg.c:76
int NbrTestProjEq
Definition: ricedg.c:81
int NbrDepInexactEFM
Definition: ricedg.c:71
int NbrTestCnst
Definition: ricedg.c:75
int NbrTestSimple
Definition: ricedg.c:77
int NbrIndexDep
Definition: ricedg.c:73
int NbrDepCnst
Definition: ricedg.c:67
int NbrTestDiVar
Definition: ricedg.c:83
int NbrDepInexactEq
Definition: ricedg.c:69
int NbrTestProjEqDi
Definition: ricedg.c:79
int NbrDepInexactFM
Definition: ricedg.c:70
int NbrTestProjFM
Definition: ricedg.c:82

References concatenate(), constdep, db_get_current_workspace_directory(), deptype, DG_FAST, DG_FULL, DG_SEMANTICS, dg_type, FMComp, fprintf(), free(), NbrAllEquals, NbrArrayDepInit, NbrDepCnst, NbrDepInexactEFM, NbrDepInexactEq, NbrDepInexactFM, NbrFMSystNonAug, NbrIndepFind, NbrIndexDep, NbrProjFMTotal, NbrScalDep, NbrTestCnst, NbrTestDiCnst, NbrTestDiVar, NbrTestExact, NbrTestGcd, NbrTestProjEq, NbrTestProjEqDi, NbrTestProjFM, NbrTestProjFMDi, NbrTestSimple, pips_internal_error, safe_fclose(), safe_fopen(), and strdup().

Referenced by rice_dependence_graph().

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

Variable Documentation

◆ constdep

int constdep[5][3]

Definition at line 52 of file ricedg.h.

◆ deptype

◆ DiVars

entity DiVars[9]
extern

testdep_util.c

testdep_util.c

di variables are pseudo variables created by PIPS and not accessible to the user that represent the distance between two dependent statement iterations. the sign of this distance is sufficient for Kennedy's way of parallelizing programs, but the exact value migth be of interest for other algorithms such as systolic algorithms.

Written by Remi, Yi-Qing; reorganized by Yi-Qing (18/09/91) To deal with overflow errors occuring during the projection of a Psysteme along a variable The tables of di variables, li variables and ds variables.

Variable DiVars[i-1] or LiVars[i-1] is associated to the loop at nesting level i. A di variable represents the difference in iteration number between the two references considered.

The variable DsiVars[i] is associated to the ith element in the list of scalar variables modified in the loops

Definition at line 53 of file testdep_util.c.

Referenced by DiVarLevel(), and GetDiVar().

◆ DsiVars

entity DsiVars[1024]
extern

Definition at line 55 of file testdep_util.c.

Referenced by GetDsiVar().

◆ Finds2s1

bool Finds2s1
extern

Definition at line 160 of file ricedg.h.

Referenced by rice_update_dependence_graph(), TestCoupleOfReferences(), and TestDependence().

◆ FMComp

int FMComp[18]
extern

Definition at line 154 of file ricedg.h.

Referenced by rice_dependence_graph(), and writeresult().

◆ is_dep_cnst

bool is_dep_cnst
extern

Definition at line 158 of file ricedg.h.

Referenced by TestCoupleOfReferences(), and TestDependence().

◆ is_test_Di

bool is_test_Di
extern

Definition at line 159 of file ricedg.h.

◆ is_test_exact

bool is_test_exact
extern

or counting the number of F-M complexity less than 16.

The complexity of one projection by F-M is multiply of the nbr. of inequations positive and the nbr. of inequations negatives who containe the variable eliminated.The last elem of the array (ie FMComp[17]) is used to count cases with complexity over 16

Definition at line 155 of file ricedg.h.

Referenced by TestCoupleOfReferences(), and TestDependence().

◆ is_test_inexact_eq

bool is_test_inexact_eq
extern

Definition at line 156 of file ricedg.h.

Referenced by TestCoupleOfReferences(), and TestDependence().

◆ is_test_inexact_fm

bool is_test_inexact_fm
extern

Definition at line 157 of file ricedg.h.

Referenced by TestCoupleOfReferences(), and TestDependence().

◆ LiVars

entity LiVars[9]
extern

Definition at line 54 of file testdep_util.c.

Referenced by GetLiVar().

◆ NbrAllEquals

int NbrAllEquals
extern

Definition at line 133 of file ricedg.h.

Referenced by rice_dependence_graph(), TestDependence(), TestDiCnst(), and writeresult().

◆ NbrArrayDepInit

int NbrArrayDepInit
extern

he variables for the statistics of test of dependence and parallelization

ricedg.c

he variables for the statistics of test of dependence and parallelization

Remi Triolet, Yi-qing Yang

Modifications:

  • new option to use semantics analysis results (Francois Irigoin, 12 April 1991)
  • compute the dependence cone, the statistics. (Yi-Qing, August 1991)
  • updated using DEFINE_CURRENT_MAPPING, BA, September 3, 1993
  • dg_type introduced to replace dg_fast and dg_semantics; it is more general. (BC, August 1995).
  • TestDependence split into different procedures for more readability. (BC, August 1995).
  • creation of quick_privatize.c and prettyprint.c to reduce the size of ricedg.c (FI, Oct. 1995)

Notes:

  • Many values seem to be assigned to StatementToContext and never be freed; local variables he variables for the statistics of test of dependence and parallelization they should not be global ? FC.

Definition at line 131 of file ricedg.h.

Referenced by rice_dependence_graph(), TestCoupleOfReferences(), and writeresult().

◆ NbrDepCnst

int NbrDepCnst
extern

Definition at line 134 of file ricedg.h.

Referenced by rice_dependence_graph(), TestCoupleOfReferences(), and writeresult().

◆ NbrDepExact

int NbrDepExact
extern

◆ NbrDepInexactEFM

int NbrDepInexactEFM
extern

Definition at line 138 of file ricedg.h.

Referenced by rice_dependence_graph(), TestCoupleOfReferences(), and writeresult().

◆ NbrDepInexactEq

int NbrDepInexactEq
extern

Definition at line 136 of file ricedg.h.

Referenced by rice_dependence_graph(), TestCoupleOfReferences(), and writeresult().

◆ NbrDepInexactFM

int NbrDepInexactFM
extern

Definition at line 137 of file ricedg.h.

Referenced by rice_dependence_graph(), TestCoupleOfReferences(), and writeresult().

◆ NbrFMSystNonAug

int NbrFMSystNonAug
extern

Definition at line 153 of file ricedg.h.

Referenced by rice_dependence_graph(), and writeresult().

◆ NbrIndepFind

int NbrIndepFind
extern

Definition at line 132 of file ricedg.h.

Referenced by rice_dependence_graph(), TestDependence(), and writeresult().

◆ NbrIndexDep

int NbrIndexDep
extern

Definition at line 140 of file ricedg.h.

Referenced by rice_dependence_graph(), TestCoupleOfReferences(), and writeresult().

◆ NbrProjFMTotal

int NbrProjFMTotal
extern

Definition at line 152 of file ricedg.h.

Referenced by rice_dependence_graph(), and writeresult().

◆ NbrScalDep

int NbrScalDep
extern

Definition at line 139 of file ricedg.h.

Referenced by rice_dependence_graph(), TestCoupleOfReferences(), and writeresult().

◆ NbrTestCnst

int NbrTestCnst
extern

Definition at line 143 of file ricedg.h.

Referenced by gcd_and_constant_dependence_test(), rice_dependence_graph(), and writeresult().

◆ NbrTestDiCnst

int NbrTestDiCnst
extern

by sc_normalize()

Definition at line 146 of file ricedg.h.

Referenced by rice_dependence_graph(), TestDependence(), and writeresult().

◆ NbrTestDiVar

int NbrTestDiVar
extern

Definition at line 151 of file ricedg.h.

Referenced by rice_dependence_graph(), TestDependence(), and writeresult().

◆ NbrTestExact

int NbrTestExact
extern

Definition at line 68 of file ricedg.c.

Referenced by rice_dependence_graph(), TestCoupleOfReferences(), and writeresult().

◆ NbrTestGcd

int NbrTestGcd
extern

Definition at line 144 of file ricedg.h.

Referenced by gcd_and_constant_dependence_test(), rice_dependence_graph(), and writeresult().

◆ NbrTestProjEq

int NbrTestProjEq
extern

Definition at line 149 of file ricedg.h.

Referenced by rice_dependence_graph(), and writeresult().

◆ NbrTestProjEqDi

int NbrTestProjEqDi
extern

Definition at line 147 of file ricedg.h.

Referenced by rice_dependence_graph(), and writeresult().

◆ NbrTestProjFM

int NbrTestProjFM
extern

Definition at line 150 of file ricedg.h.

Referenced by rice_dependence_graph(), and writeresult().

◆ NbrTestProjFMDi

int NbrTestProjFMDi
extern

Definition at line 148 of file ricedg.h.

Referenced by rice_dependence_graph(), and writeresult().

◆ NbrTestSimple

int NbrTestSimple
extern

Definition at line 145 of file ricedg.h.

Referenced by rice_dependence_graph(), TestDependence(), and writeresult().