PIPS
adg_utils.c
Go to the documentation of this file.
1 /*
2 
3  $Id: adg_utils.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 /* Name : adg_utils.c
28  * Package : array_dfg
29  * Author : Arnauld LESERVOT
30  * Date : 93/06/27
31  * Modified :
32  * Documents: Platonoff's thesis and Leservot's thesis
33  * "Dataflow Analysis of Array and Scalar References" P. FEAUTRIER
34  * Comments :
35  */
36 
37 #define GRAPH_IS_DG
38 #include "local.h"
39 
40 /* Global variables */
41 extern int Gcount_re;
43 extern boolean PATH_METHOD;
44 
45 /*=======================================================================*/
46 /* USEFULL FUNCTIONS */
47 /*=======================================================================*/
48 
49 /*=======================================================================*/
50 /* void adg_fill_with_quast( in_pq, in_q ) AL 17/02/94
51  */
52 void adg_fill_with_quast( in_pq, in_q )
53 quast* in_pq;
54 quast in_q;
55 {
56  debug(8, "adg_fill_with_quast", "begin\n");
57  if (get_debug_level() > 7) {
58  fprintf(stderr, "\n Input quast :\n");
59  imprime_special_quast( stderr, *in_pq );
60  fprintf(stderr, "\n To fill with :\n");
61  imprime_special_quast( stderr, in_q );
62  }
63  if (*in_pq == quast_undefined) *in_pq = in_q;
64  else {
65  quast_value qqv = quast_quast_value( *in_pq );
66  if (quast_value_conditional_p( qqv )) {
68  adg_fill_with_quast( &(conditional_true_quast( cond )), in_q );
70  }
71  }
72  if (get_debug_level() > 7) {
73  fprintf(stderr, "\n Output quast :\n");
74  imprime_special_quast( stderr, *in_pq );
75  }
76  debug(8, "adg_fill_with_quast", "end\n");
77 }
78 
79 
80 /*=======================================================================*/
81 /* AL 94/02/14
82  */
84 int in_i;
85 {
86  extern int Gcount_ie;
87  entity new_ent = NULL, mod_ent = NULL;
88  char *name = NULL, *name2 = NULL, *num = NULL;
89 
90 
91  debug(9, "adg_get_integer_entity", "begin \n");
92  num = int2a(in_i);
94  name = strdup(concatenate("I", (char*) num, (char *) NULL));
95  free(num);
96 
97  /* If a Renamed Entity already exists, we use it ;
98  * else, we make a new one and increment Gcount_re.
99  */
100  if ( in_i <= Gcount_ie ) {
101  new_ent = FindOrCreateEntity(
103  (char*) name );
104  }
105  else {
106  Gcount_ie++;
108  MODULE_SEP_STRING, name, NULL ));
109  new_ent = make_entity(name2,
114  }
115 
116  if (get_debug_level() > 7) fprintf(stderr, "New %s\n", entity_local_name( new_ent ));
117 
118  debug(9, "adg_get_integer_entity", "end \n");
119  return( new_ent );
120 }
121 
122 
123 /*=======================================================================*/
124 /* quast adg_compact_quast( in_q ) AL 1/12/93
125  * Compact a quast with a lot of undefined leaves.
126  * Could be costly extended to more general cases.
127  * Usefull to compact a quast provided by PIP.
128  */
130 quast in_q;
131 {
132  quast new_true = NULL, new_false = NULL, ret_q = quast_undefined;
133  quast_value qv = NULL;
134  conditional cond = NULL;
135  Psysteme ps1 = NULL;
136 
137  debug( 9, "adg_compact_quast", "begin\n");
138  if ( in_q == quast_undefined ) return quast_undefined;
139 
140  qv = quast_quast_value( in_q );
141  if ( qv == quast_value_undefined ) return quast_undefined;
142  if ( quast_value_quast_leaf_p( qv ) ) return in_q;
143 
144  cond = quast_value_conditional( qv );
145  ps1 = predicate_system( conditional_predicate( cond ) );
146  new_true = adg_compact_quast( conditional_true_quast( cond ) );
147  new_false = adg_compact_quast( conditional_false_quast( cond ) );
148 
149  if (adg_quast_equal_p( new_true, new_false ))
150  {free_quast( new_false ); return new_true;}
151  else if ((new_true != quast_undefined) &&
152  (quast_quast_value(new_true) != quast_value_undefined) &&
154  conditional co = NULL;
155  quast cfq = NULL, cft = NULL;
156 
158  cfq = conditional_false_quast( co );
159  cft = conditional_true_quast( co );
160  if( adg_quast_equal_p( cfq, new_false ) ) {
161  Psysteme ps = NULL;
162 
163  ps1->base = NULL; sc_creer_base(ps1);
167  cft, new_false) ),
168  quast_newparms( in_q ) );
169  }
172  new_true, new_false) ),
173  quast_newparms( in_q ) );
174  }
175  else {
178  new_true, new_false) ),
179  quast_newparms( in_q ) );
180  }
181 
182  debug( 9, "adg_compact_quast", "end\n");
183  return ret_q;
184 }
185 
186 
187 /*=======================================================================*/
188 /* bool adg_quast_equal_p() AL 1/12/93
189  * Returns true if the 2 input quasts are equal to quast_undefined.
190  * Could be extented.
191  */
192 bool adg_quast_equal_p( in_q1, in_q2 )
193 quast in_q1, in_q2;
194 { return (( in_q1 == quast_undefined ) && (in_q2 == quast_undefined)); }
195 
196 
197 /*=======================================================================*/
198 /* bool adg_quast_value_equal_p() AL 1/12/93
199  * NOT used, NOT tested.
200  */
201 bool adg_quast_value_equal_p( in_qv1, in_qv2 )
202 quast_value in_qv1, in_qv2;
203 {
204  conditional cond1 = NULL, cond2 = NULL;
205  Psysteme ps1 = NULL, ps2 = NULL;
206 
207  if ((in_qv1 == quast_value_undefined)&&(in_qv2 == quast_value_undefined)) return true;
208  if ((in_qv1 == quast_value_undefined)||(in_qv2 == quast_value_undefined)) return false;
209 
210  if ( quast_value_quast_leaf_p(in_qv1) && quast_value_quast_leaf_p(in_qv2))
212  quast_value_quast_leaf(in_qv2));
213  if (quast_value_quast_leaf_p(in_qv1)||quast_value_quast_leaf_p(in_qv2)) return false;
214 
217  if ((adg_suppress_2nd_in_1st_ps(ps1, ps2) != SC_UNDEFINED) ||
218  (adg_suppress_2nd_in_1st_ps(ps2, ps1) != SC_UNDEFINED) ) return false;
220 }
221 
222 /*=======================================================================*/
223 /* bool adg_quast_leaf_equal_p() AL 1/12/93
224  * NOT used, NOT tested.
225  */
226 bool adg_quast_leaf_equal_p( in_ql1, in_ql2 )
227 quast_leaf in_ql1, in_ql2;
228 {
229  leaf_label ll1 = NULL, ll2 = NULL;
230 
231  if ((in_ql1 == quast_leaf_undefined)&&(in_ql2 == quast_leaf_undefined)) return true;
232  if ((in_ql1 == quast_leaf_undefined)||(in_ql2 == quast_leaf_undefined)) return false;
233 
234  ll1 = quast_leaf_leaf_label( in_ql1 );
235  ll2 = quast_leaf_leaf_label( in_ql2 );
236  if (ll1 == leaf_label_undefined) {
237  if (ll2 == leaf_label_undefined) return true;
238  else return false;
239  }
240  else {
241  if (ll2 == leaf_label_undefined) return false;
242  else return( ((int) leaf_label_statement( ll1 ) ==
243  (int) leaf_label_statement( ll2 )) &&
244  ((int) leaf_label_depth( ll1 ) ==
245  (int) leaf_label_depth( ll2 )) );
246  }
247 }
248 
249 
250 /*=======================================================================*/
251 /* bool adg_quast_leaves_equal_p( (quast) in_q1, (quast) in_q2 )
252  * Returns True if the Two input quast have same leaf-labels.
253  */
254 bool adg_quast_leaf_label_equal_p( in_q1, in_q2 )
255 quast in_q1, in_q2;
256 {
257  quast_value qv1 = NULL, qv2 = NULL;
258  quast_leaf ql1 = NULL, ql2 = NULL;
259  leaf_label ll1 = NULL, ll2 = NULL;
260 
261  debug(9, "adg_quast_leaves_equal_p", "doing\n");
262  if ((in_q1 == quast_undefined)||(in_q2 == quast_undefined)) return false;
263 
264  qv1 = quast_quast_value( in_q1 );
265  qv2 = quast_quast_value( in_q2 );
266  if ((qv1 == quast_value_undefined)||(qv2 == quast_value_undefined) ||
267  quast_value_conditional_p( qv1 )||quast_value_conditional_p( qv2 )) return false;
268 
269  ql1 = quast_value_quast_leaf( qv1 );
270  ql2 = quast_value_quast_leaf( qv2);
271  if ((ql1 == quast_leaf_undefined)||(ql2 == quast_leaf_undefined)) return false;
272 
273  ll1 = quast_leaf_leaf_label( ql1 );
274  ll2 = quast_leaf_leaf_label( ql2 );
275  if (ll1 == leaf_label_undefined) {
276  if (ll2 == leaf_label_undefined) return true;
277  else return false;
278  }
279  else {
280  if (ll2 == leaf_label_undefined) return false;
281  else return( ((int) leaf_label_statement( ll1 ) ==
282  (int) leaf_label_statement( ll2 )) &&
283  ((int) leaf_label_depth( ll1 ) ==
284  (int) leaf_label_depth( ll2 )) );
285  }
286 }
287 
288 
289 /*=======================================================================*/
291 quast in_q1, in_q2;
292 {
293  quast_value qv1, qv2;
294  quast_leaf ql1 = NULL, ql2 = NULL;
295  list ll1 = NULL, ll2 = NULL;
296 
297  debug(9, "adg_quast_leaf_solution_equal_p", "doing\n");
298  if ((in_q1 == quast_undefined) && (in_q2 == quast_undefined)) return true;
299  if ((in_q1 == quast_undefined)||(in_q2 == quast_undefined)) return false;
300 
301  qv1 = quast_quast_value( in_q1 );
302  qv2 = quast_quast_value( in_q2 );
303  if ((qv1 == quast_value_undefined) && (qv2 == quast_value_undefined)) return true;
304  if ((qv1 == quast_value_undefined)||(qv2 == quast_value_undefined) ||
305  quast_value_conditional_p( qv1 )||quast_value_conditional_p( qv2 )) return false;
306 
307  ql1 = quast_value_quast_leaf( qv1 );
308  ql2 = quast_value_quast_leaf( qv2);
309  if ((ql1 == quast_leaf_undefined) && (ql2 == quast_leaf_undefined)) return true;
310  if ((ql1 == quast_leaf_undefined)||(ql2 == quast_leaf_undefined)) return false;
311 
312  ll1 = quast_leaf_solution(ql1);
313  ll2 = quast_leaf_solution(ql2);
314  if (gen_length(ll1) != gen_length( ll2 )) return false;
315  for(; !ENDP(ll1); POP(ll1) , POP(ll2)) {
318  if (!vect_equal(pv1, pv2)) return false;
319  }
320  return true;
321 }
322 
323 
324 /*=======================================================================*/
325 /* Psysteme adg_sc_dup( (Psysteme) in_ps ) AL 09/11/93
326  * Input : A Psysteme in_ps.
327  * Output : A duplicated Psysteme. Smooth version of sc_dup :
328  * We avoid any verificatio on the contraintes.
329  * PRIVATE use !
330  */
332 Psysteme in_ps;
333 {
334  Psysteme cp = SC_UNDEFINED;
335  Pcontrainte eq = NULL, eq_cp = NULL;
336 
337  debug(9, "adg_sc_dup", "begin\n");
338  if (!SC_UNDEFINED_P(in_ps)) {
339  cp = sc_new();
340 
341  for (eq = in_ps->egalites; eq != NULL; eq = eq->succ) {
342  eq_cp = contrainte_new();
344  sc_add_egalite(cp, eq_cp);
345  }
346 
347  for(eq=in_ps->inegalites;eq!=NULL;eq=eq->succ) {
348  eq_cp = contrainte_new();
350  sc_add_inegalite(cp, eq_cp);
351  }
352 
353  if(in_ps->dimension==0) {
354  cp->dimension = 0;
355  cp->base = VECTEUR_UNDEFINED;
356  }
357  else {
358  cp->dimension = in_ps->dimension;
359  cp->base = base_reversal(vect_dup(in_ps->base));
360  }
361  }
362  debug(9, "adg_sc_dup", "end\n");
363  return(cp);
364 }
365 
366 /*=======================================================================*/
367 /* bool adg_is_textualy_after_p( (statement) in_s1, (statement) in_s2 )
368  * Input : Two statements in_s1 and in_s2. AL 08/11/93
369  * Output : True if in_s1 is before in_s2 in the text program.
370  * WARNING: This function compares the statement number of the two
371  * statements => these numbers should already be ordered.
372  */
373 bool adg_is_textualy_after_p( in_s1, in_s2 )
374 statement in_s1, in_s2;
375 { return (statement_number(in_s1) >= statement_number(in_s2));}
376 
377 
378 /*=======================================================================*/
379 /* void adg_sc_update_base( (Psysteme*) in_pps ) AL 05/11/93
380  * Input : A pointer on Psysteme in_pps.
381  * Done : Update base of in_ps.
382  * PRIVATE use !
383  */
384 void adg_sc_update_base( in_pps )
385 Psysteme* in_pps;
386 {
387  Psysteme in_ps = (Psysteme) *in_pps;
388 
389  if ((in_ps != SC_UNDEFINED) && (in_ps != SC_RN)) {
390  if ((in_ps->nb_eq == 0) && (in_ps->nb_ineq == 0) ) *in_pps = SC_RN;
391  else { in_ps->base = (Pbase) NULL; sc_creer_base( in_ps ); }
392  }
393 }
394 
395 /*=======================================================================*/
396 /* Psysteme adg_suppress_2nd_in_1st_ps( (Psysteme) in_ps1, (Psysteme) in_ps2 )
397  * AL 03/11/93
398  * Input : 2 Psystemes.
399  * Output : Psysteme : Scan in_ps1 and remove from it Pcontraintes
400  * in in_ps2. No sharing, No remove input object.
401  * PUBLIC use possible.
402  */
404 Psysteme in_ps1, in_ps2;
405 {
406  Psysteme ret_ps = SC_RN;
407  Pcontrainte eq1 = NULL, eq2 = NULL, ineq1 = NULL, ineq2 = NULL;
408 
409  debug(9, "adg_suppress_2nd_in_1st_ps", "begin\n");
410  if ( in_ps1 == SC_RN ) RETURN(9, "adg_suppress_2nd_in_1st_ps", ret_ps);
411  if ( in_ps2 == SC_RN ) RETURN(9, "adg_suppress_2nd_in_1st_ps", in_ps1);
412  for (eq1 = in_ps1->egalites; eq1 != NULL; eq1 = eq1->succ) {
413  bool ok = true;
414  for (eq2 = in_ps2->egalites; eq2 != NULL; eq2 = eq2->succ)
415  { if (vect_equal(eq1->vecteur, eq2->vecteur)) {ok=false; break; }}
416  if (ok) ret_ps = sc_append( ret_ps,
418  }
419  for (ineq1 = in_ps1->inegalites; ineq1 != NULL; ineq1 = ineq1->succ) {
420  bool ok = true;
421  for (ineq2 = in_ps2->inegalites; ineq2 != NULL; ineq2 = ineq2->succ)
422  { if (vect_equal(ineq1->vecteur, ineq2->vecteur)) {ok=false; break;} }
423  if (ok) ret_ps = sc_append( ret_ps,
424  sc_make( CONTRAINTE_UNDEFINED, contrainte_make(ineq1->vecteur)));
425  }
426 
427  debug(9, "adg_suppress_2nd_in_1st_ps", "end\n");
428  return ret_ps;
429 }
430 
431 /*=======================================================================*/
432 /* int adg_number_of_same_loops( (list) in_l1, (list) in_l2 ) AL 28/10/93
433  * Input : Two lists of loops in_l1 and in_l2.
434  * Output : Number of loops in the two lists that have the same
435  * statement ordering.
436  * PUBLIC use possible.
437  */
438 int adg_number_of_same_loops( in_l1, in_l2 )
439 list in_l1, in_l2;
440 {
441  int count = 0;
442 
443  debug(9, "adg_number_of_same_loops", "begin\n");
444  for(; !ENDP(in_l1); POP(in_l1)) {
445  list ll = in_l2;
446  int order1 = statement_ordering( loop_body( LOOP(CAR(in_l1)) ) );
447  for(; !ENDP(ll); POP(ll)) {
448  if (order1 == statement_ordering(loop_body(LOOP(CAR(ll))))) count++;
449  }
450  }
451  debug(9,"adg_number_of_same_loops","number of same loop = %d\n", count);
452  return count;
453 }
454 
455 /*=======================================================================*/
456 /* statement adg_number_to_statement( (int) in_nb ) AL 25/10/93
457  * Input : Number of a vertex.
458  * Output : A statement associated to this vertex.
459  * PRIVATE use !
460  */
462 int in_nb;
463 { return ordering_to_statement( adg_number_to_ordering( in_nb ) ); }
464 
465 
466 /*=======================================================================*/
467 /* void adg_enrichir( (quast) in_qu, (leaf_label) in_ll ) AL 21/10/93
468  * Input : A quast and a leaf label.
469  * Output : Nothing. Just put each leaf_label of quast in_qu equal to in_ll
470  * and update the solution.
471  * WARNING ! Using global variable : Gstco_map.
472  * PRIVATE use !
473  */
474 void adg_enrichir( in_qu, in_ll )
475 quast in_qu;
476 leaf_label in_ll;
477 {
478  quast_value qv = NULL;
479 
480  debug(9, "adg_enrichir", "begin \n");
481  if( in_qu == quast_undefined ) {}
482  else if((qv = quast_quast_value(in_qu))!= quast_value_undefined) {
483  if (quast_value_conditional_p(qv)) {
485  if(cond != conditional_undefined) {
486  adg_enrichir(conditional_true_quast(cond), in_ll);
488  }
489  }
490  if(quast_value_quast_leaf_p(qv)) {
491  int nb, dep, count = 0;
492  statement stat;
493  static_control sc;
494  quast_leaf ql = NULL;
495  list qs = NIL, prov_l = NIL, ind = NIL;
496 
497  /* We get the indices of statement linked to in_ll */
498  nb = leaf_label_statement( in_ll );
499  dep = leaf_label_depth( in_ll );
500  stat = adg_number_to_statement( nb );
503 
504  /* Get the dep first indices and put them in prov_l */
505  for(; !ENDP(ind) && (count < dep); POP(ind), count++) {
507  ADD_ELEMENT_TO_LIST( prov_l, EXPRESSION, exp );
508  }
509 
510  /* Add to prov_l the solutions of quast */
511  ql = quast_value_quast_leaf( qv );
512  if (ql != quast_leaf_undefined) qs = quast_leaf_solution( ql );
513  for(; !ENDP(qs) ; POP(qs)) {
514  expression exp = EXPRESSION(CAR( qs ));
515  ADD_ELEMENT_TO_LIST( prov_l, EXPRESSION, exp );
516  }
517  quast_value_quast_leaf( qv ) = make_quast_leaf( prov_l, in_ll );
518  }
519  }
520  debug(9, "adg_enrichir", "end \n");
521 }
522 
523 /*=======================================================================*/
524 /* predicate predicate_dup( (predicate) in_pred ) AL 18/10/93
525  * Input : A predicate in_pred.
526  * Output : A duplicated predicate ret_pred.
527  * PUBLIC use possible.
528  */
530 predicate in_pred;
531 {
532  if ( in_pred != predicate_undefined )
533  return make_predicate( sc_dup( predicate_system(in_pred) ) );
534  else return predicate_undefined;
535 }
536 
537 /*=======================================================================*/
538 /* dfg_vertex_label_dup( (dfg_vertex_label) in_dvl ) AL 18/10/93
539  * Input : A dfg_vertex_label in_dvl
540  * Output : A duplicated dfg_vertex_label.
541  * WARNING: tag sccflags is always put to sccflags_undefined !!
542  * Should not be used anymore : copy_dfg_vertex_label exists !
543  * PRIVATE use .
544  */
546 dfg_vertex_label in_dvl;
547 {
549 
550  debug(9, "dfg_vertex_label_dup", "begin \n");
551  if( in_dvl != dfg_vertex_label_undefined ) {
552  ret_dvl = make_dfg_vertex_label(
553  dfg_vertex_label_statement( in_dvl ),
556  }
557  debug(9, "dfg_vertex_label_dup", "end \n");
558  return ret_dvl;
559 }
560 
561 /*=======================================================================*/
562 /* bool adg_simple_ineg_p( (Psysteme) in_ps ) AL 22/10/93
563  * Input : A psysteme in_ps
564  * Output : true if in_ps has only one inegality in it.
565  * FALSE otherwhise.
566  * PUBLIC use.
567  */
568 bool adg_simple_ineg_p( in_ps )
569 Psysteme in_ps;
570 { return (in_ps != SC_RN)?((in_ps->nb_eq == 0) && (in_ps->nb_ineq == 1)):false; }
571 
572 
573 /*=======================================================================*/
574 /* quast adg_max_of_leaves( tsou, tsou2, in_i, in_pa, take_last)
575  * Compute max of two quasts. in_i is the order to ta ...
576  * PRIVATE use.
577  */
578 quast adg_max_of_leaves( tsou, tsou2, in_i, in_pa, take_last)
579 quast *tsou, tsou2;
580 int in_i;
581 Ppath in_pa;
582 bool take_last;
583 {
584  quast_value in_qv = NULL, in_qv2 = NULL;
585  int dep = 0, dep2 = 0;
586  int nb = 0, nb2 = 0, max_depth = 0;
587  leaf_label ll = NULL, ll2 = NULL;
588  quast ret_q = quast_undefined;
589  quast_leaf ql = NULL, ql2 = NULL;
590  statement st = NULL, st2 = NULL;
591  Psysteme delt_sc = NULL, delt_sc1 = NULL, delt_sc2 = NULL;
592  Ppath new_pa1 = NULL, new_pa2 = NULL, new_pa = NULL;
593  Pvecteur pvec = NULL, pv1 = NULL, pv2 = NULL, diff = NULL;
594  bool cut_space=false, after2=false, after1=false, tt=false;
595 
596  debug(9, "adg_max_of_leaves", "begin\n");
597 
598  in_qv = quast_quast_value( *tsou );
599  in_qv2 = quast_quast_value( tsou2 );
600  ql = quast_value_quast_leaf( in_qv );
601  ql2 = quast_value_quast_leaf( in_qv2 );
602  ll = quast_leaf_leaf_label(ql);
603  ll2 = quast_leaf_leaf_label(ql2);
604 
605  if (ll == leaf_label_undefined)
606  { *tsou = copy_quast(tsou2); RETURN(9, "adg_max_of_leaves", *tsou); }
607  if (ll2 == leaf_label_undefined) RETURN(9, "adg_max_of_leaves", copy_quast(*tsou));
608 
609  dep = leaf_label_depth(ll);
610  dep2 = leaf_label_depth(ll2);
611  nb = leaf_label_statement(ll);
612  nb2 = leaf_label_statement(ll2);
613 
614  if (take_last) {
615  if (dep > dep2) RETURN(9, "adg_max_of_leaves", copy_quast(*tsou));
616  if (dep2 > dep) {
617  quast_quast_value( *tsou ) = copy_quast_value(in_qv2);
618  RETURN(9, "adg_max_of_leaves", *tsou);
619  }
620  }
621  else {
622  if (dep2 > dep) RETURN(9, "adg_max_of_leaves", copy_quast(*tsou));
623  if (dep > dep2) {
624  quast_quast_value( *tsou ) = copy_quast_value(in_qv2);
625  RETURN(9, "adg_max_of_leaves", *tsou);
626  }
627  }
628 
629  /*The two leaves are at the same depth : we have three cases*/
630  st = adg_number_to_statement( nb );
631  st2 = adg_number_to_statement( nb2 );
632 
633  /* If we are in the deepest position : take textual order */
634  max_depth = stco_common_loops_of_statements(Gstco_map, st, st2);
635  if ((dep == max_depth) || (in_i == max_depth)) {
636  tt = (statement_number(st) >= statement_number(st2));
637  if (take_last) {
638  if (tt) RETURN(9, "adg_max_of_leaves", copy_quast(*tsou));
639  *tsou = copy_quast(tsou2);
640  RETURN(9, "adg_max_of_leaves", *tsou);
641  }
642  else {
643  if (!tt) RETURN(9, "adg_max_of_leaves", copy_quast(*tsou));
644  *tsou = copy_quast(tsou2);
645  RETURN(9, "adg_max_of_leaves", *tsou);
646  }
647  }
648 
649  /* Take the in_i element of solutions */
652  in_i++;
653 
654  /*If *tsou and tsou2 distances to the source could be equal*/
655  diff = vect_substract( pv1, pv2 );
656  pvec = diff;
657  delt_sc = sc_make(contrainte_make(pvec), CONTRAINTE_UNDEFINED);
658  new_pa = pa_intersect_system( in_pa, delt_sc );
659  cut_space = pa_faisabilite(pa_intersect_system(in_pa, delt_sc));
660 
661  /* See if tsou2 could be after *tsou */
662  pvec = vect_add( vect_new(TCST, VALUE_ONE), diff );
663  delt_sc2 = sc_make(CONTRAINTE_UNDEFINED, contrainte_make(pvec));
664  new_pa2 = pa_intersect_system( in_pa, delt_sc2 );
665  after2 = pa_faisabilite( new_pa2 );
666 
667  /* See if *tsou could be after tsou2 */
668  vect_chg_sgn( diff );
669  pvec = vect_add( vect_new(TCST, VALUE_ONE), diff );
670  delt_sc1 = sc_make(CONTRAINTE_UNDEFINED, contrainte_make(pvec));
671  new_pa1 = pa_intersect_system( in_pa, delt_sc1 );
672  after1 = pa_faisabilite( new_pa1 );
673 
674  /* Only one of the two is after the other. */
675  if (!cut_space) {
676  if (take_last) {
677  if(after1) ret_q = copy_quast( *tsou );
678  else if(after2) ret_q = copy_quast( tsou2 );
679  else pips_internal_error("Bad cutting space !");
680  }
681  else {
682  if(after2) ret_q = copy_quast( *tsou );
683  else if(after1) ret_q = copy_quast( tsou2 );
684  else pips_internal_error("Bad cutting space !");
685  }
686  }
687  /* Both quast could be a source: look at a deeper stage. */
688  else if (after1 && after2) {
689  quast ts = NULL, ts2 = NULL;
690 
691  if (take_last) {
692  ts = copy_quast( *tsou );
693  ts2 = copy_quast( tsou2 );
694  }
695  else {
696  ts = copy_quast( tsou2 );
697  ts2 = copy_quast( *tsou );
698  }
701  make_predicate(delt_sc),
702  adg_max_of_leaves( tsou, tsou2, in_i, new_pa, take_last),
706  make_predicate( delt_sc2 ), ts2, ts )),
707  NIL ) )),
708  NIL );
709  }
710  /* !after1 or !after2 */
711  /* only after1 holds */
712  else if (after1) ret_q = take_last?copy_quast( *tsou ):copy_quast(tsou2);
713  /* only after2 holds */
714  else if (after2) ret_q = take_last?copy_quast( tsou2 ):copy_quast( *tsou );
715  /* !after1 and !after2 */
716  else ret_q = adg_max_of_leaves( tsou, tsou2, in_i, new_pa, take_last);
717 
718  debug(9, "adg_max_of_leaves", "end \n");
719  return( ret_q );
720 }
721 
722 /*=======================================================================*/
723 /* quast adg_path_max_source( quast *tsou, quast *tsou2,
724  * list psl, Ppath in_pa, bool take_last ) AL 04/08/93
725  */
726 quast adg_path_max_source( tsou, tsou2, in_pa, psl, take_last )
727 quast *tsou, *tsou2;
728 list psl;
729 Ppath in_pa;
730 boolean take_last;
731 {
732  quast ret_tsou = quast_undefined;
733  quast_value in_qv = NULL, in_qv2 = NULL;
734 
735  debug(9, "adg_path_max_source", "begin \n");
736  /* Trivial cases */
737  if(*tsou2 == quast_undefined) RETURN(9,"adg_path_max_source",*tsou);
738  in_qv2 = quast_quast_value( *tsou2 );
739  if(in_qv2 == quast_value_undefined) RETURN(9,"adg_path_max_source",*tsou);
740 
741 
742  if(*tsou == quast_undefined)
743  { *tsou = *tsou2; RETURN(9,"adg_path_max_source",*tsou); }
744 
745  /* Case the quast of *tsou is a conditional */
746  in_qv = quast_quast_value( *tsou );
747  if (quast_value_conditional_p(in_qv)) {
748  conditional qvcond = quast_value_conditional( in_qv );
750 /* quast qt = conditional_true_quast( qvcond );
751  quast qf = conditional_false_quast( qvcond );*/
752  Ppath ct = pa_intersect_system( in_pa, cond );
753  Ppath cf = pa_intersect_complement( in_pa, cond );
754 
755  adg_path_max_source(&(conditional_true_quast(qvcond)),tsou2,ct,psl,take_last);
756  adg_path_max_source(&(conditional_false_quast(qvcond)),tsou2,cf,psl,take_last);
757 
758  ret_tsou = *tsou;
759  }
760 
761  /* Case the quast of *tsou is a leaf and *tsou2 a conditional*/
762  else if (quast_value_conditional_p(in_qv2)) {
763  Ppath ct, cf;
764  conditional qvcond = quast_value_conditional( in_qv2 );
765  predicate pred = conditional_predicate( qvcond );
766  Psysteme cond = predicate_system( pred );
767  quast qt = conditional_true_quast( qvcond );
768  quast qf = conditional_false_quast( qvcond );
769  quast qll = *tsou;
770 
771  cond->base = NULL; sc_creer_base( cond );
772  ct = pa_intersect_system( in_pa, cond );
773  cf = pa_intersect_complement( in_pa, cond );
774 
775  if (!pa_faisabilite( ct )) adg_path_max_source(tsou,&qf,in_pa,psl,take_last);
776  else if (!pa_faisabilite(cf)) adg_path_max_source(tsou,&qt,in_pa,psl,take_last);
777  else {
778  quast q3 = copy_quast( qll );
779  quast q4 = copy_quast( qll );
780  quast q1 = adg_path_max_source(&q3, &qt, ct, psl, take_last);
781  quast q2 = adg_path_max_source(&q4, &qf, cf, psl, take_last);
782 
783  if (adg_quast_leaf_solution_equal_p(q1, q2)) *tsou = q1;
785  make_conditional(pred,q1, q2)),psl);
786  }
787 
788  ret_tsou = *tsou;
789  }
790 
791  /* The two quasts are leaves */
792  else if (quast_value_quast_leaf_p(in_qv2) && quast_value_quast_leaf_p(in_qv)) {
793  int dep, dep2, nb, nb2, max_depth;
794  quast q2 = quast_undefined;
795  statement st, st2;
796  bool tt;
797  quast_leaf ql = quast_value_quast_leaf( in_qv );
798  quast_leaf ql2 = quast_value_quast_leaf( in_qv2 );
801 
802  if (ll == leaf_label_undefined)
803  { *tsou = copy_quast(*tsou2); RETURN(9, "adg_path_max_source", *tsou2); }
804  if (ll2 == leaf_label_undefined) RETURN(9, "adg_path_max_source", *tsou);
805 
806  dep = leaf_label_depth(ll);
807  dep2 = leaf_label_depth(ll2);
808  nb = leaf_label_statement(ll);
809  nb2 = leaf_label_statement(ll2);
810 
811  if (take_last) {
812  if (dep > dep2) RETURN(9, "adg_path_max_source", *tsou);
813  if (dep2 > dep) {
814  quast_quast_value( *tsou ) = copy_quast_value(in_qv2);
815  RETURN(9, "adg_path_max_source", *tsou2);
816  }
817  }
818  else {
819  if (dep2 > dep ) RETURN(9, "adg_path_max_source", *tsou);
820  if (dep > dep2) {
821  quast_quast_value( *tsou ) = copy_quast_value(in_qv2);
822  RETURN(9, "adg_path_max_source", *tsou2);
823  }
824  }
825 
826  /* The two statement have the same depth dep */
827  st = adg_number_to_statement( nb );
828  st2 = adg_number_to_statement( nb2 );
829 
830  max_depth = stco_common_loops_of_statements(Gstco_map, st, st2);
831  if (dep == max_depth) {
832  tt = (statement_number(st) >= statement_number(st2));
833  if (take_last) {
834  if (tt) RETURN(9, "adg_path_max_source", *tsou);
835  *tsou = copy_quast(*tsou2);
836  RETURN(9, "adg_path_max_source", *tsou2);
837  }
838  else {
839  if (!tt) RETURN(9, "adg_path_max_source", *tsou);
840  *tsou = copy_quast(*tsou2);
841  RETURN(9, "adg_path_max_source", *tsou2);
842  }
843  }
844 
845  q2 = adg_max_of_leaves( tsou, *tsou2, dep, in_pa, take_last );
847  quast_newparms(*tsou2) );
848  quast_quast_value( *tsou ) = quast_quast_value( q2 );
849  ret_tsou = *tsou;
850  }
851  else pips_internal_error("Anormal quast ");
852 
853  debug(9, "adg_path_max_source", "end \n");
854  return( ret_tsou );
855 }
856 
857 
858 /*=======================================================================*/
859 /* Pvecteur adg_list_to_vect(list in_list, bool with_tcst) AL 07/10/93
860  * Input : A list of entities and a boolean.
861  * Output : A Pvecteur sorted by the in_list order.
862  * TCST is added at the end if with_tcst is set to TRUE.
863  * PUBLIC use.
864  */
865 Pvecteur adg_list_to_vect( in_list, with_tcst )
866 list in_list;
867 bool with_tcst;
868 {
869  Pvecteur pv2 = NULL, *pvec = NULL, prov_vec = VECTEUR_NUL;
870 
871  debug(9, "adg_list_to_vect", "begin \n");
872 
873  /* Build a Pvecteur according to the reverse order of the in_list */
874  pvec = &prov_vec;
875  for(; !ENDP(in_list); POP(in_list))
876  { vect_add_elem( pvec, (Variable) ENTITY(CAR( in_list )), (Value) 1 ); }
877 
878  /* Add the TCST var or not */
879  if (with_tcst) vect_add_elem( pvec, TCST, VALUE_ONE);
880 
881  /* Reverse the vecteur to recover the order of the input list */
882  pv2 = vect_reversal( *pvec );
883 
884  debug(9, "adg_list_to_vect", "end \n");
885  return pv2;
886 }
887 
888 /*=======================================================================*/
889 /* Psysteme adg_build_Psysteme( predicate in_pred, list in_list )
890  * Input : A predicate in_pred. AL 29/07/93
891  * A list of entities in_list.
892  * Output : A Psysteme from in_pred ordered according to the list in_list.
893  * PUBLIC use.
894  */
895 Psysteme adg_build_Psysteme( in_pred, in_list )
896 predicate in_pred;
897 list in_list;
898 {
899  Psysteme ret_ps = NULL;
900  Pvecteur pv2 = NULL;
901 
902  debug(9, "adg_build_Psysteme", "begin \n");
903  if ((in_list == NIL) && (in_pred != predicate_undefined)) {
904  pips_internal_error("Error : there is no correspondance between input Psysteme and input entity list");
905  }
906 
907  ret_ps = (Psysteme) predicate_system( in_pred );
908  pv2 = adg_list_to_vect( in_list, true );
909 
910  /* Call a sort function */
911  sort_psysteme( ret_ps, pv2 );
912 
913  debug(9, "adg_build_Psysteme", "end \n");
914  return( ret_ps );
915 }
916 
917 /*=======================================================================*/
918 /* Pposs_source adg_path_possible_source( quast in_tsou, vertex in_ver,
919  * int in_dep, Psysteme in_ps )
920  * Input : The present solution source in_tsou AL 29/07/93
921  * the vertex in_ver to examine and its depth in_dep.
922  * and the candidate context in_ps.
923  * If take_last is true, we select leaves according to
924  * the sequential order (the last one wins).
925  * If it is false, the first one wins.
926  * Output : Node of quast in_tsou under which we could find a source.
927  * PRIVATE use.
928  */
929 Pposs_source adg_path_possible_source(in_tsou, in_ver, in_dep, in_pa, take_last )
930 quast *in_tsou;
931 vertex in_ver;
932 int in_dep;
933 Ppath in_pa;
934 bool take_last;
935 {
936  bool ret_bool = false;
937  quast_value qu_v = NULL;
938  Pposs_source ret_psou;
939 
940  debug(8, "adg_path_possible_source", "begin \n");
941 
942  ret_psou = (Pposs_source) malloc(sizeof(Sposs_source));
943  ret_psou->pat = in_pa;
944  ret_psou->qua = in_tsou;
945 
946  if ( *in_tsou == quast_undefined ) RETURN(8,"adg_path_possible_source 1",ret_psou);
947  qu_v = quast_quast_value( *in_tsou );
948  if (qu_v == quast_value_undefined ) RETURN(8,"adg_path_possible_source 2",ret_psou);
949 
950  if (quast_value_conditional_p(qu_v)) {
951  Ppath pat, paf;
952  Pposs_source pt, pf;
954  quast* tq = &(conditional_true_quast( qvc ));
955  quast* fq = &(conditional_false_quast( qvc ));
957 
958  adg_sc_update_base( &loc_ps );
959  pat = pa_intersect_system( in_pa, loc_ps );
960  paf = pa_intersect_complement( in_pa, loc_ps );
961  pt = adg_path_possible_source( tq, in_ver, in_dep, pat, take_last );
962  pf = adg_path_possible_source( fq, in_ver, in_dep, paf, take_last );
963 
964  if (pa_empty_p( pt->pat )) ret_psou = pf;
965  else if (pa_empty_p( pf->pat )) ret_psou = pt;
966  }
967  else if (quast_value_quast_leaf_p(qu_v)) {
969  int qu_d = leaf_label_depth( qu_ll );
970  statement sou_s = adg_vertex_to_statement(in_ver);
971  int sou_nb = statement_number( sou_s );
973  int qu_order = statement_number( qu_s );
975  bool tt = ( sou_nb <= qu_order );
976 
977  /* The last wins. General usage. */
978  if (take_last) {
979  if( qu_d != in_dep ) {
980  if( (nesting > qu_d) || (nesting > in_dep) ) {
981  if(qu_d <= in_dep) ret_bool = true; }
982  else ret_bool = tt;
983  }
984  else ret_bool = true;
985  }
986  /* The first wins. Used to compute summary read effects */
987  else {
988  if( qu_d != in_dep ) {
989  if( (nesting > qu_d) || (nesting > in_dep) ) {
990  if(qu_d <= in_dep) ret_bool = false;
991  else ret_bool = true;
992  }
993  else ret_bool = !tt;
994  }
995  else ret_bool = true;
996  }
997 
998  /* This vertex is not a possible source */
999  if (!ret_bool) ret_psou->pat = pa_empty();
1000  }
1001 
1002  debug(8, "adg_path_possible_source", "end \n");
1003  return( ret_psou );
1004 }
1005 
1006 
1007 /*=======================================================================*/
1008 /* list adg_increasing_stat_order_sort( list in_list ) AL 28/07/93
1009  * Input : A list of vertices in_list.
1010  * Output : A list of vertices sorted by decreasing order
1011  * PRIVATE use.
1012  */
1014 list in_list;
1015 { return(gen_nreverse( adg_decreasing_stat_order_sort( in_list ))); }
1016 
1017 /*=======================================================================*/
1018 /* list adg_decreasing_stat_order_sort( list in_list ) AL 28/07/93
1019  * Input : A list of vertices in_list.
1020  * Output : A list of vertices sorted by decreasing order
1021  * of statement_ordering attached to each vertex ret_list.
1022  * Method : We scan in_list. For each vertex ver of in_list, we scan ret_list
1023  * with l1. l2 points on predecessor of l1.
1024  * According to the order of ver compared to the order
1025  * of v1 and v2, we insert (or not) ver between l2 and l1.
1026  * PRIVATE use.
1027  */
1029 list in_list;
1030 {
1031  list ret_list = NIL, prov_l = NIL;
1032 
1033  debug(9,"adg_decreasing_stat_order_sort", "begin\n");
1034  for(; !ENDP(in_list); POP(in_list)) {
1035  bool cont = true;
1036  list l2 = NIL;
1037  vertex ver = VERTEX(CAR( in_list ));
1038  int order = statement_number(adg_vertex_to_statement( ver ));
1039  list l1 = ret_list;
1040 
1041  prov_l = NIL;
1042  ADD_ELEMENT_TO_LIST( prov_l, VERTEX, ver );
1043 
1044  while( cont ) {
1045  int order2 = 0;
1046 
1047  /* ret_list is presently empty : we initialize it
1048  * with the new vertex ver */
1049  if ((l1 == NIL) && (l2 == NIL )) {
1050  ret_list = prov_l;
1051  cont = false;
1052  }
1053  /* We are at the end of ret_list : we add the new
1054  * vertex at the end of our list */
1055  else if ((l1 == NIL) && (l2 != NIL)) {
1056  l2->cdr = prov_l;
1057  cont = false;
1058  }
1059  /* Core of the pass : compares new input vertex ver */
1060  else {
1062  if ((order >= order2) && (l2 == NIL)) {
1063  ret_list = prov_l;
1064  ret_list->cdr = l1;
1065  cont = false;
1066  }
1067  else if ((order >= order2) && (l2 != NIL)) {
1068  l2->cdr = prov_l;
1069  prov_l->cdr = l1;
1070  cont = false;
1071  }
1072  else {
1073  cont = true;
1074  l2 = l1;
1075  POP( l1 );
1076  }
1077  }
1078  }
1079  }
1080  debug(9,"adg_decreasing_stat_order_sort", "returned list length : %d \n",
1081  gen_length( ret_list ));
1082  return( ret_list );
1083 }
1084 
1085 
1086 /*=======================================================================*/
1087 /* list adg_merge_entities_lists( list l1, list l2 ) AL 23/07/93
1088  * Input : Two lists of entities.
1089  * Output : A list of entities, union of the l1 and l2.
1090  * Append the new entities of l2 after list l1.
1091  * PUBLIC use.
1092  */
1094 list l1, l2;
1095 {
1096  list ret_list = NIL;
1097 
1098  debug(9, "adg_merge_entities_list", "begin \n");
1099  for(; !ENDP(l1); POP(l1) )
1100  { ADD_ELEMENT_TO_LIST( ret_list, ENTITY, ENTITY(CAR( l1 )) );}
1101  for(; !ENDP(l2); POP( l2 )) {
1102  entity ent = ENTITY(CAR(l2));
1103  if ( gen_find_eq(ent, ret_list) == chunk_undefined )
1104  ADD_ELEMENT_TO_LIST( ret_list, ENTITY, ent );
1105  }
1106 
1107  debug(9, "adg_merge_entities_list", "end \n");
1108  return( ret_list );
1109 }
1110 
1111 
1112 
1113 /*=======================================================================*/
1114 /* list adg_rename_entities( list le, hash_table fst) AL 22/07/93
1115  * Input : A list of entities le and a hash table fst.
1116  *
1117  * Output : A list of entities with names RE1 RE2 RE3 ...
1118  * according to a global counter Gcount_re. If we already have
1119  * created enough amount of new entities, we reuse them; else,
1120  * we create new ones. Gcount_re is the total number of such entities.
1121  * The corresponding changes are kept in the hash_table
1122  * Gforward_substitute_table ("fst") given in argument.
1123  * PRIVATE use.
1124  */
1126 list le;
1127 hash_table fst;
1128 {
1129  list ret_l = NIL;
1130  int counter = 0;
1131 
1132  debug(9, "adg_rename_entities", "begin \n");
1133  for(;!ENDP(le); POP(le)) {
1134  extern int Gcount_re;
1135  entity in_ent = NULL, new_ent = NULL, mod_ent = NULL;
1136  char *name = NULL, *name2 = NULL, *num = NULL;
1137 
1138  counter++;
1139  num = int2a(counter);
1141  name = strdup(concatenate("RE", num, (char *) NULL));
1142  free(num);
1143 
1144  /* If a Renamed Entity already exists, we use it ;
1145  * else, we make a new one and increment Gcount_re.
1146  */
1147  if ( counter <= Gcount_re ) {
1148  new_ent = FindOrCreateEntity(
1151  (char*) NULL)),
1152  name );
1153  }
1154  else {
1155  Gcount_re++;
1158  MODULE_SEP_STRING, name, NULL ));
1159  new_ent = make_entity(name2,
1164  }
1165 
1166  ADD_ELEMENT_TO_LIST(ret_l, ENTITY, new_ent);
1167 
1168  in_ent = ENTITY(CAR(le));
1169  hash_put(fst, (char*) in_ent, (char*) entity_to_expression(new_ent));
1170  if (get_debug_level() > 7) {
1171  fprintf(stderr, "Old %s -> New %s\n",
1172  entity_local_name( in_ent ),
1173  entity_local_name( new_ent ));
1174  }
1175  }
1176  debug(9, "adg_rename_entities", "end \n");
1177  return( ret_l );
1178 }
1179 
1180 /*=======================================================================*/
1181 /* list adg_get_loop_indices( list ll ) AL 22/07/93
1182  * Input : A list of loops ll.
1183  * Output : A list of entities representing indices of loops in ll.
1184  * PUBLIC use.
1185  */
1187 list ll;
1188 {
1189  list ret_list = NIL;
1190  for(; !ENDP(ll); POP(ll))
1191  { ADD_ELEMENT_TO_LIST( ret_list, ENTITY, loop_index(LOOP(CAR( ll ))) ); }
1192  return( ret_list );
1193 }
1194 /*=======================================================================*/
void free_quast(quast p)
Definition: paf_ri.c:483
quast_value make_quast_value(enum quast_value_utype tag, void *val)
Definition: paf_ri.c:565
quast make_quast(quast_value a1, list a2)
Definition: paf_ri.c:516
quast_value copy_quast_value(quast_value p)
QUAST_VALUE.
Definition: paf_ri.c:522
conditional make_conditional(predicate a1, quast a2, quast a3)
Definition: paf_ri.c:138
quast_leaf make_quast_leaf(list a1, leaf_label a2)
Definition: paf_ri.c:474
quast copy_quast(quast p)
QUAST.
Definition: paf_ri.c:480
dfg_vertex_label make_dfg_vertex_label(intptr_t a1, predicate a2, sccflags a3)
Definition: paf_ri.c:264
basic make_basic(enum basic_utype tag, void *val)
Definition: ri.c:155
predicate make_predicate(Psysteme a1)
Definition: ri.c:1820
storage make_storage(enum storage_utype tag, void *val)
Definition: ri.c:2273
value make_value(enum value_utype tag, void *val)
Definition: ri.c:2832
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
type make_type(enum type_utype tag, void *val)
Definition: ri.c:2706
static int count
Definition: SDG.c:519
int adg_number_to_ordering(int in_nb)
======================================================================
Definition: adg_graph.c:227
statement adg_vertex_to_statement(vertex in_ver)
======================================================================
Definition: adg_graph.c:266
void imprime_special_quast(FILE *fp, quast qu)
===========================================================================
list adg_merge_entities_lists(list l1, list l2)
======================================================================
Definition: adg_utils.c:1093
bool adg_quast_equal_p(quast in_q1, quast in_q2)
======================================================================
Definition: adg_utils.c:192
statement adg_number_to_statement(int in_nb)
======================================================================
Definition: adg_utils.c:461
quast adg_path_max_source(quast *tsou, quast *tsou2, Ppath in_pa, list psl, boolean take_last)
======================================================================
Definition: adg_utils.c:726
quast adg_compact_quast(quast in_q)
======================================================================
Definition: adg_utils.c:129
Pvecteur adg_list_to_vect(list in_list, bool with_tcst)
======================================================================
Definition: adg_utils.c:865
void adg_fill_with_quast(quast *in_pq, quast in_q)
======================================================================
Definition: adg_utils.c:52
int adg_number_of_same_loops(list in_l1, list in_l2)
======================================================================
Definition: adg_utils.c:438
dfg_vertex_label dfg_vertex_label_dup(dfg_vertex_label in_dvl)
======================================================================
Definition: adg_utils.c:545
bool adg_simple_ineg_p(Psysteme in_ps)
======================================================================
Definition: adg_utils.c:568
int Gcount_re
Global variables.
Definition: array_dfg.c:45
bool adg_quast_value_equal_p(quast_value in_qv1, quast_value in_qv2)
======================================================================
Definition: adg_utils.c:201
void adg_sc_update_base(Psysteme *in_pps)
======================================================================
Definition: adg_utils.c:384
bool adg_quast_leaf_label_equal_p(quast in_q1, quast in_q2)
======================================================================
Definition: adg_utils.c:254
list adg_decreasing_stat_order_sort(list in_list)
======================================================================
Definition: adg_utils.c:1028
bool adg_quast_leaf_equal_p(quast_leaf in_ql1, quast_leaf in_ql2)
======================================================================
Definition: adg_utils.c:226
bool adg_is_textualy_after_p(statement in_s1, statement in_s2)
======================================================================
Definition: adg_utils.c:373
list adg_increasing_stat_order_sort(list in_list)
======================================================================
Definition: adg_utils.c:1013
Psysteme adg_build_Psysteme(predicate in_pred, list in_list)
======================================================================
Definition: adg_utils.c:895
Psysteme adg_sc_dup(Psysteme in_ps)
======================================================================
Definition: adg_utils.c:331
Pposs_source adg_path_possible_source(quast *in_tsou, vertex in_ver, int in_dep, Ppath in_pa, bool take_last)
======================================================================
Definition: adg_utils.c:929
boolean PATH_METHOD
statement_mapping Gstco_map
Definition: array_dfg.c:47
list adg_get_loop_indices(list ll)
======================================================================
Definition: adg_utils.c:1186
void adg_enrichir(quast in_qu, leaf_label in_ll)
======================================================================
Definition: adg_utils.c:474
quast adg_max_of_leaves(quast *tsou, quast tsou2, int in_i, Ppath in_pa, bool take_last)
======================================================================
Definition: adg_utils.c:578
list adg_rename_entities(list le, hash_table fst)
======================================================================
Definition: adg_utils.c:1125
Psysteme adg_suppress_2nd_in_1st_ps(Psysteme in_ps1, Psysteme in_ps2)
======================================================================
Definition: adg_utils.c:403
entity adg_get_integer_entity(int in_i)
======================================================================
Definition: adg_utils.c:83
predicate predicate_dup(predicate in_pred)
======================================================================
Definition: adg_utils.c:529
bool adg_quast_leaf_solution_equal_p(quast in_q1, quast in_q2)
======================================================================
Definition: adg_utils.c:290
int Value
#define VALUE_ONE
static entity mod_ent
#define EXPRESSION_PVECTEUR(e)
#define ADFG_MODULE_NAME
struct Sposs_source * Pposs_source
int Gcount_ie
Definition: array_dfg.c:46
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
Definition: base.c:221
static int num
Definition: bourdoncle.c:137
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
#define CONTRAINTE_UNDEFINED
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
Pcontrainte contrainte_new(void)
package contrainte - allocations et desallocations
Definition: alloc.c:47
#define sccflags_undefined
Definition: dg.h:247
#define chunk_undefined
obsolete
Definition: genC.h:79
void * malloc(YYSIZE_T)
void free(void *)
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#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
list gen_concatenate(const list l1x, const list l2x)
concatenate two lists.
Definition: list.c:436
size_t gen_length(const list l)
Definition: list.c:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
void * gen_find_eq(const void *item, const list seq)
Definition: list.c:422
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
Definition: list.c:710
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 ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50
bool vect_equal(Pvecteur v1, Pvecteur v2)
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
Definition: reductions.c:278
#define pips_internal_error
Definition: misc-local.h:149
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
#define MODULE_SEP_STRING
Definition: naming-local.h:30
#define GET_STATEMENT_MAPPING(map, stat)
Definition: newgen-local.h:49
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define UUINT(i)
Definition: newgen_types.h:99
#define UU
Definition: newgen_types.h:98
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
Definition: ordering.c:111
int stco_common_loops_of_statements(statement_mapping, statement, statement)
AP, sep 25th 1995 : I have added a function from static_controlise/utils.c.
Definition: utils.c:2497
#define static_control_loops(x)
Definition: paf_ri.h:757
#define conditional_true_quast(x)
Definition: paf_ri.h:302
#define quast_undefined
Definition: paf_ri.h:603
#define quast_value_undefined
Definition: paf_ri.h:639
struct _newgen_struct_static_control_ * static_control
Definition: paf_ri.h:184
#define leaf_label_statement(x)
Definition: paf_ri.h:451
#define dfg_vertex_label_undefined
Definition: paf_ri.h:388
#define conditional_undefined
Definition: paf_ri.h:275
@ is_quast_value_conditional
Definition: paf_ri.h:655
#define conditional_false_quast(x)
Definition: paf_ri.h:304
#define quast_newparms(x)
Definition: paf_ri.h:629
#define quast_leaf_solution(x)
Definition: paf_ri.h:591
#define dfg_vertex_label_statement(x)
Definition: paf_ri.h:413
#define quast_leaf_undefined
Definition: paf_ri.h:567
#define leaf_label_undefined
Definition: paf_ri.h:427
#define quast_value_conditional_p(x)
Definition: paf_ri.h:676
#define quast_value_quast_leaf_p(x)
Definition: paf_ri.h:673
#define leaf_label_depth(x)
Definition: paf_ri.h:453
#define quast_value_quast_leaf(x)
Definition: paf_ri.h:675
#define quast_leaf_leaf_label(x)
Definition: paf_ri.h:593
#define quast_quast_value(x)
Definition: paf_ri.h:627
#define dfg_vertex_label_exec_domain(x)
Definition: paf_ri.h:415
#define conditional_predicate(x)
Definition: paf_ri.h:300
#define quast_value_conditional(x)
Definition: paf_ri.h:678
Ppath pa_empty()
Ppath pa_empty() AL 18/11/93 Returns empty path : pa_empty = sc_empty(NULL) ^ (NIL)
Definition: path.c:135
bool pa_empty_p(Ppath in_pa)
pa_empty_p( (Ppath) in_pa ) AL 18/11/93 Returns True if in_pa = (1*TCST = 0) ^ (NIL)
Definition: path.c:141
Ppath pa_intersect_system(Ppath in_pa, Psysteme in_ps)
Ppath pa_intersect_system( (Ppath) in_pa, (Psysteme) in_ps ) Computes the intersection between in_pa ...
Definition: path.c:178
Ppath pa_intersect_complement(Ppath in_pa, Pcomplement in_pc)
Ppath pa_intersect_complement( (Ppath) in_pa, (Pcomplement) in_pc ) Computes the intersection between...
Definition: path.c:200
void sort_psysteme(Psysteme ps, Pvecteur pv)
==================================================================
Definition: pip.c:729
Pvecteur vect_reversal(Pvecteur vect_in)
Pvecteur vect_reversal(Pvecteur vect_in); produces the reversal vector of the vect_in.
Definition: private.c:237
#define make_entity(n, t, s, i)
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
entity FindOrCreateEntity(const char *package, const char *local_name)
Problem: A functional global entity may be referenced without parenthesis or CALL keyword in a functi...
Definition: entity.c:1586
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
#define loop_body(x)
Definition: ri.h:1644
@ is_basic_int
Definition: ri.h:571
#define LOOP(x)
LOOP.
Definition: ri.h:1606
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define ram_undefined
Definition: ri.h:2221
#define statement_ordering(x)
Definition: ri.h:2454
@ is_value_unknown
Definition: ri.h:3035
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
@ is_storage_ram
Definition: ri.h:2492
#define predicate_undefined
Definition: ri.h:2046
@ is_type_variable
Definition: ri.h:2900
#define statement_number(x)
Definition: ri.h:2452
#define predicate_system(x)
Definition: ri.h:2069
#define loop_index(x)
Definition: ri.h:1640
struct Ssysteme * Psysteme
Psysteme sc_make(Pcontrainte leg, Pcontrainte lineg)
Psysteme sc_make(Pcontrainte leg, Pcontrainte lineg): allocation et initialisation d'un systeme d'equ...
Definition: sc.c:78
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Definition: sc_alloc.c:389
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
Definition: sc_read.c:87
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
#define RETURN(x)
flex uses isatty
Definition: sc_lex.c:777
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
static list nesting
assumes:
static bool ok
Pvecteur vecteur
struct Scontrainte * succ
Structure for return of a possible source.
Pbase base
Definition: sc-local.h:75
int nb_ineq
Definition: sc-local.h:73
int nb_eq
Definition: sc-local.h:72
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
struct cons * cdr
The pointer to the next element.
Definition: newgen_list.h:43
char * int2a(int)
util.c
Definition: util.c:42
#define pa_faisabilite(pa)
Definition: union-local.h:112
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
struct Svecteur * Pbase
#define VECTEUR_UNDEFINED
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
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
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
Definition: binaires.c:75
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