PIPS
bdt_utils.c
Go to the documentation of this file.
1 /*
2 
3  $Id: bdt_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 #include <stdio.h>
28 #include <setjmp.h>
29 #include <string.h>
30 #include <stdlib.h>
31 
32 #include "genC.h"
33 #include "ri.h"
34 #include "constants.h"
35 #include "ri-util.h"
36 #include "misc.h"
37 
38 /* C3 includes */
39 #include "boolean.h"
40 #include "arithmetique.h"
41 #include "vecteur.h"
42 #include "contrainte.h"
43 #include "ray_dte.h"
44 #include "sommet.h"
45 #include "sg.h"
46 #include "sc.h"
47 #include "polyedre.h"
48 #include "union.h"
49 #include "matrix.h"
50 
51 
52 /* Pips includes */
53 
54 #include "complexity_ri.h"
55 #include "database.h"
56 #include "dg.h"
57 #include "parser_private.h"
58 #include "property.h"
59 #include "reduction.h"
60 #include "tiling.h"
61 
62 
63 #include "text.h"
64 #include "text-util.h"
65 #include "graph.h"
66 #include "paf_ri.h"
67 #include "paf-util.h"
68 #include "pipsdbm.h"
69 #include "resources.h"
70 #include "array_dfg.h"
71 #include "pip.h"
72 #include "static_controlize.h"
73 #include "scheduling.h"
74 
75 /* Local defines */
78 
79 
80 /*======================================================================*/
81 /* entity create_named_entity(name): create a scalar integer entity named
82  * "name".
83  *
84  * AC 93/11/05 */
86 char *name;
87 {
88  entity ent;
89  basic b;
90  string full_name;
91 
93  NULL);
94 
96  == entity_undefined) {
101  b = make_basic(is_basic_int, 4);
102  entity_type(ent) = (type) MakeTypeVariable(b, NIL);
103  }
104 
105  return(ent);
106 }
107 
108 /*============================================================================*/
109 /* void fprint_bdt_with_stat(fp, obj): prints the bdt "obj" with the
110  * corresponding statement.
111  *
112  * AC 94/02/12
113  */
114 
115 void fprint_bdt_with_stat(fp, obj)
116 
117  FILE *fp;
118  bdt obj;
119 {
120  list sched_l;
121 
122  fprintf(fp,"\n Base de Temps :\n");
123  fprintf(fp,"===============\n");
124 
125  if (obj == bdt_undefined)
126  {
127  fprintf(fp, "\tNon calculee\n\n");
128  return;
129  }
130 
131  sched_l = bdt_schedules(obj);
132 
133  for (; sched_l != NIL; sched_l = CDR(sched_l))
134  {
135  schedule crt_sched;
136  int crt_stmt;
137  list dim_l;
138  predicate crt_pred;
139 
140  crt_sched = SCHEDULE(CAR(sched_l));
141  crt_stmt = schedule_statement(crt_sched);
142  dim_l = schedule_dims(crt_sched);
143  crt_pred = schedule_predicate(crt_sched);
144 
145  /* PRINT */
146  fprintf(fp,"ins_%d: =>", crt_stmt);
148 
149  if (crt_pred != predicate_undefined)
150  {
151  Psysteme ps = (Psysteme)predicate_system(crt_pred);
152  Pcontrainte peq;
153 
154  if (ps != NULL)
155  {
156  fprintf(fp,"\t pred: ");
157 
158  for (peq = ps->inegalites; peq!=NULL;\
159  pu_inegalite_fprint(fp,peq,entity_local_name),peq=peq->succ);
160 
161  for (peq = ps->egalites; peq!=NULL;\
162  pu_egalite_fprint(fp,peq,entity_local_name),peq=peq->succ);
163 
164  fprintf(fp,"\n");
165  }
166  else
167  fprintf(fp, "\t pred: TRUE\n");
168  }
169  else
170  fprintf(fp, "\t pred: TRUE\n");
171 
172  fprintf(fp, "\t dims: ");
173  for (; dim_l != NIL; dim_l = CDR(dim_l))
174  {
175  expression exp = EXPRESSION(CAR(dim_l));
176  fprintf(fp,"%s", expression_to_string(exp));
177  if (CDR(dim_l) != NIL)
178  fprintf(fp," , ");
179  }
180  fprintf(fp,"\n");
181  }
182 }
183 
184 /*==========================================================================*/
185 /* bool my_contrainte_normalize(Pcontrainte c, bool is_egalite):
186  * this is the same function as contrainte_normalize, except that it divides
187  * inequalities by the pgcd of all the terms, including the TCST one.
188  *
189  * AC 93/12/23
190  */
191 
192 bool my_contrainte_normalize(c, is_egalite)
193 
194  Pcontrainte c;
195  bool is_egalite;
196 {
197  bool is_c_norm = true;
198  Value a, nb0 = VALUE_ZERO;
199 
200  if ((c != NULL) && (c->vecteur != NULL)
201  && value_notzero_p(a = vect_pgcd_except(c->vecteur, TCST)))
202  {
203  nb0 = value_mod(value_abs(vect_coeff(TCST, c->vecteur)),a);
204  if (is_egalite)
205  {
206  if (value_zero_p(nb0))
207  {
208  (void) vect_div(c->vecteur, value_abs(a));
209  c->vecteur = vect_clean(c->vecteur);
210  }
211  else is_c_norm= false;
212  }
213 
214  else
215  {
216  if (value_zero_p(nb0) )
217  {
218  vect_chg_coeff(&(c->vecteur), TCST,
219  value_uminus(vect_coeff(TCST, c->vecteur)));
220  (void) vect_div(c->vecteur, value_abs(a));
221  c->vecteur = vect_clean(c->vecteur);
222  vect_chg_coeff(&(c->vecteur), TCST,
223  value_uminus(vect_coeff(TCST, c->vecteur)));
224  }
225  }
226  }
227 
228  return (is_c_norm);
229 }
230 
231 /*===============================================================*/
232 /* bool my_inegalite_normalize(Pcontrainte ineg): same function
233  * as inegalite_normalize except that it uses my_contrainte_nor-
234  * malize insteadof contrainte_normalize.
235  *
236  * AC 93/12/23
237  */
238 
240 
241  Pcontrainte ineg;
242 {
243  return(my_contrainte_normalize(ineg, false));
244 }
245 
246 /*===============================================================*/
247 /* Psysteme my_sc_normalize(ps): that function suppresses redondant
248  * equations and reduce its equations to the pgcd. There is no test
249  * of faisability.
250  *
251  * AC 93/12/23
252  */
253 
255 
256  Psysteme ps;
257 {
258  Pcontrainte eq;
259 
260  ps = sc_elim_db_constraints(ps);
261 
262  if (ps)
263  {
264  for (eq = ps->egalites; eq != NULL; eq=eq->succ)
265  {
266  /* normalisation de chaque equation */
267  if (eq->vecteur)
268  {
270  }
271  }
272 
273  for (eq = ps->inegalites; eq!=NULL; eq=eq->succ)
274  {
275  if (eq->vecteur)
276  {
278  }
279  }
280  ps = sc_elim_db_constraints(ps);
281  sc_elim_empty_constraints(ps, true);
282  sc_elim_empty_constraints(ps, false);
283 
284  ps->base = (Pvecteur)NULL;
285  sc_creer_base(ps);
286  }
287 
288  return(ps);
289 }
290 
291 /*==================================================================*/
292 /* Psysteme predicate_to_system((predicate) p) : transform a
293  * predicate in a system.
294  *
295  * AC 93/11/02
296  */
297 
299 
300  predicate p;
301 {
302  Psysteme s;
303 
304  if (p == predicate_undefined) s = SC_RN;
305  else s = predicate_system(p);
306 
307  return(s);
308 }
309 
310 /*==================================================================*/
311 /* schedule true_copy_schedule( s ): really copies a schedule s.
312  * The function copy_schedule is not sufficient here because it
313  * doesn't copy the predicate properly for example.
314  *
315  * AC 93/12/15
316  */
317 
319 
320  schedule s;
321 {
322  int stat;
323  predicate pred;
324  expression exp, exp_copy;
325  list lexp, lexp_copy = NIL;
326  Psysteme sys, sys_copy;
327  schedule scopy;
328 
329  stat = schedule_statement(s);
330 
332  sys_copy = sc_dup(sys);
333  pred = make_predicate(sys_copy);
334 
335  lexp = schedule_dims(s);
336  for ( ; lexp != NIL; lexp = CDR(lexp))
337  {
338  exp = EXPRESSION(CAR(lexp));
339  exp_copy = copy_expression(exp);
340  ADD_ELEMENT_TO_LIST(lexp_copy, EXPRESSION, exp_copy);
341  }
342 
343  scopy = make_schedule(stat, pred, lexp_copy);
344 
345  return(scopy);
346 }
347 
348 /*======================================================================*/
349 /* bdt true_copy_bdt(b): really copies a bdt b, cf. true_copy_schedule().
350  *
351  * AC 93/12/21
352  */
353 
355 
356  bdt b;
357 {
358  bdt b_copy;
359  list lbdt, lbdt_copy = NIL;
360  schedule sched, sched_copy;
361 
362  lbdt = bdt_schedules(b);
363 
364  for (; lbdt != NIL; lbdt = CDR(lbdt))
365  {
366  sched = SCHEDULE(CAR(lbdt));
367  sched_copy = true_copy_schedule(sched);
368  ADD_ELEMENT_TO_LIST(lbdt_copy, SCHEDULE, sched_copy);
369  }
370  b_copy = make_bdt(lbdt_copy);
371 
372  return(b_copy);
373 }
374 
375 /*======================================================================*/
376 /* bool system_contains_var(ps, var): test if a system contains the
377  * variable"var".
378  *
379  * AC 94/01/04
380  */
381 
382 bool system_contains_var(ps, var)
383 
384  Psysteme ps;
385  Variable var;
386 {
387  ps->base = NULL;
388  sc_creer_base(ps);
389  return(base_contains_variable_p(ps->base, var));
390 }
391 
392 /*==================================================================*/
393 /* void poly_chg_var(pp, v_old, v_new) : change the variable "v_old"
394  * in the variable "v_new" in the polynom pp.
395  *
396  * AC 93/11/04
397  */
398 
399 void poly_chg_var(pp, v_old, v_new)
400 
401  Ppolynome pp;
402  Variable v_old, v_new;
403 {
404  while (!POLYNOME_NUL_P(pp))
405  {
406  Pmonome pmcur = polynome_monome(pp);
407  if (pmcur != (Pmonome)NIL)
408  {
409  Pvecteur pvcur = monome_term(pmcur);
410  vect_chg_var(&pvcur, v_old, v_new);
411  }
412  pp = polynome_succ(pp);
413  }
414 }
415 
416 /*=======================================================================*/
417 /* Psysteme suppress_sc_in_sc((Psysteme) in_ps1, (Psysteme) in_ps2)
418  * Input : 2 Psystemes.
419  * Output : Psysteme : Scan in_ps1 and remove from it Pcontraintes
420  * in in_ps2. No sharing, No remove input object.
421  * cf. function "adg_suppress_2nd_in_1st_ps" from array_dfg.c
422  *
423  * AC 93/12/14
424  */
425 
427 
428  Psysteme in_ps1, in_ps2;
429 {
430  Psysteme ret_ps = SC_RN;
431  Pcontrainte eq1, eq2, ineq1, ineq2, cont;
432 
433  if (in_ps1 == SC_RN) return(ret_ps);
434  if (in_ps2 == SC_RN) return(in_ps1);
435 
436  for (eq1 = in_ps1->egalites; eq1 != NULL; eq1 = eq1->succ)
437  {
438  bool ok = true;
439  for (eq2 = in_ps2->egalites; eq2 != NULL; eq2 = eq2->succ)
440  {
441  ok = ok && (!vect_equal(eq1->vecteur, eq2->vecteur));
442  if (!ok) break;
443  }
444  if (ok)
445  {
446  cont = contrainte_make(eq1->vecteur);
447  ret_ps = sc_append(ret_ps,sc_make(cont,CONTRAINTE_UNDEFINED));
448  }
449  }
450  for (ineq1 = in_ps1->inegalites; ineq1 != NULL; ineq1 = ineq1->succ)
451  {
452  bool ok = true;
453  for (ineq2=in_ps2->inegalites; ineq2 != NULL; ineq2=ineq2->succ)
454  {
455  ok = ok && !(vect_equal(ineq1->vecteur, ineq2->vecteur));
456  if (!ok) break;
457  }
458  if (ok)
459  {
460  cont = contrainte_make(ineq1->vecteur);
461  ret_ps = sc_append(ret_ps,sc_make(CONTRAINTE_UNDEFINED,cont));
462  }
463  }
464 
465  return(ret_ps);
466 }
467 
468 
469 /*======================================================================*/
470 /* void analyze_expression(e, d): this function analyzes an expression
471  * that is, it reduces the different components of the expression to
472  * the common denominator and make as many simplification as possible.
473  * ex:
474  * u + v - (u + 2*v)/3 => (2*u + v)/3
475  * 4*(u + v)/2 - v +w => 2*u + v + w
476  *
477  * AC 93/12/14
478  */
479 
481 
482  expression *e;
483  int *d;
484 {
485  expression exp1, exp2, exp_a, exp_b;
486  list lexp1, lexp2;
487  syntax syn;
488  tag t;
489  int d1, d2, val;
490  entity ent, func;
491  call ca;
492  Pvecteur vect1, vect2;
493 
496 
498 
499  /* We have to analyze the complex expression */
501  syn = expression_syntax(*e);
502  t = syntax_tag(syn);
503 
504  switch(t) {
505  case is_syntax_call:
506  ent = call_function(syntax_call(syn));
507  lexp1 = call_arguments(syntax_call(syn));
508  exp1 = EXPRESSION(CAR(lexp1));
509  lexp2 = CDR(lexp1);
510  exp2 = EXPRESSION(CAR(lexp2));
511 
512  if (ENTITY_DIVIDE_P(ent))
513  {
514  NORMALIZE_EXPRESSION(exp1);
515  d2 = expression_to_int(exp2);
518  {
519  analyze_expression(&exp1, &d1);
520  d2 = d1 * d2;
521  exp2 = int_to_expression(d2);
523  lexp2->cdr = NULL;
524  ADD_ELEMENT_TO_LIST(lexp2, EXPRESSION, exp2);
525  *d = d2;
526  *e = exp1;
527  }
528  else
529  {
531  val = VALUE_TO_INT(vect_pgcd_all(vect1));
532  if ((val%d2) == 0)
533  {
534  vect1 = vect_div(vect1, d2);
535  *e = Pvecteur_to_expression(vect1);
537  *d = 1;
538  }
539  else
540  {
542  *d = expression_to_int(exp2);
543  }
544  }
545  }
546 
547  else if (ENTITY_MULTIPLY_P(ent))
548  {
549  if (expression_constant_p(exp1))
550  {
551  analyze_expression(&exp2, &d1);
552  val = expression_to_int(exp1);
553  *d = d1;
554  if (d1 != 1)
555  {
558  exp_a = EXPRESSION(CAR(lexp2));
559  NORMALIZE_EXPRESSION(exp_a);
560  lexp2 = CDR(lexp2);
562  vect1 = vect_multiply(vect1, val);
563  val = VALUE_TO_INT(vect_pgcd_all(vect1));
564  d2 = expression_to_int(exp1);
565  if ((val%d1) == 0)
566  {
567  vect1 = vect_div(vect1, d1);
568  *e = Pvecteur_to_expression(vect1);
570  *d = 1;
571  }
572  else
573  {
574  if ((d1%val) == 0)
575  {
576  vect1 = vect_div(vect1, val);
577  exp_a = Pvecteur_to_expression(vect1);
578  unnormalize_expression(exp_a);
579  exp_b = int_to_expression(d1/val);
580  lexp2 = CONS(EXPRESSION, exp_b, NIL);
581  lexp1 = CONS(EXPRESSION, exp_a, lexp2);
582  ca = make_call(func, lexp1);
583  syn = make_syntax(is_syntax_call,ca);
585  *d = d1/val;
586  }
587  else
588  {
589  exp_a = Pvecteur_to_expression(vect1);
590  unnormalize_expression(exp_a);
591  lexp1 = CONS(EXPRESSION, exp_a, lexp2);
592  ca = make_call(func, lexp1);
593  syn = make_syntax(is_syntax_call,ca);
595  }
596  }
597  }
598  else
599  {
600  NORMALIZE_EXPRESSION(exp2);
602  vect1 = vect_multiply(vect1, val);
603  *e = Pvecteur_to_expression(vect1);
605  }
606  }
607  else
608  {
609  analyze_expression(&exp1, &d1);
610  val = expression_to_int(exp2);
611  *d = d1;
612  if (d1 != 1)
613  {
616  exp_a = EXPRESSION(CAR(lexp1));
617  NORMALIZE_EXPRESSION(exp_a);
618  lexp1 = CDR(lexp1);
620  vect1 = vect_multiply(vect1, val);
621 
622  val = VALUE_TO_INT(vect_pgcd_all(vect1));
623  d2 = expression_to_int(exp2);
624 
625  if ((val%d1) == 0)
626  {
627  vect1 = vect_div(vect1, d1);
628  *e = Pvecteur_to_expression(vect1);
630  *d = 1;
631  }
632  else
633  {
634  if ((d1%val) == 0)
635  {
636  vect1 = vect_div(vect1, val);
637  exp_a = Pvecteur_to_expression(vect1);
638  unnormalize_expression(exp_a);
639  exp_b = int_to_expression(d1/val);
640  lexp2 = CONS(EXPRESSION, exp_b, NIL);
641  lexp1 = CONS(EXPRESSION, exp_a, lexp2);
642  ca = make_call(func, lexp1);
643  syn = make_syntax(is_syntax_call,ca);
645  *d = d1/val;
646  }
647  else
648  {
649  exp_a = Pvecteur_to_expression(vect1);
650  unnormalize_expression(exp_a);
651  lexp1 = CONS(EXPRESSION, exp_a, lexp1);
652  ca = make_call(func, lexp1);
653  syn = make_syntax(is_syntax_call,ca);
655  }
656  }
657  }
658  else
659  {
660  NORMALIZE_EXPRESSION(exp1);
662  vect1 = vect_multiply(vect1,val);
663  *e = Pvecteur_to_expression(vect1);
665  }
666  }
667  }
668  else
669  {
670  /* case of + or - */
671  analyze_expression(&exp1, &d1);
672  analyze_expression(&exp2, &d2);
673  *d = sol_ppcm(d1, d2);
674 
675  if ((d1 == 1) && (d2 != 1))
676  {
679  exp_a = EXPRESSION(CAR(lexp2));
680  NORMALIZE_EXPRESSION(exp_a);
681  NORMALIZE_EXPRESSION(exp1);
684  lexp2 = CDR(lexp2);
685 
686  vect1 = vect_multiply(vect1, d2);
687  if (ENTITY_PLUS_P(ent))
688  vect1 = vect_add(vect1, vect2);
689  else vect1 = vect_substract(vect1, vect2);
690 
691  val = VALUE_TO_INT(vect_pgcd_all(vect1));
692  if ((val%(*d)) == 0)
693  {
694  vect1 = vect_div(vect1, d2);
695  *e = Pvecteur_to_expression(vect1);
697  *d = 1;
698  }
699  else
700  {
701  exp_a = Pvecteur_to_expression(vect1);
702  unnormalize_expression(exp_a);
703  lexp1 = CONS(EXPRESSION, exp_a, lexp2);
704  ca = make_call(func, lexp1);
705  syn = make_syntax(is_syntax_call, ca);
707  }
708  }
709  else if ((d1 != 1) && (d2 == 1))
710  {
713  exp_a = EXPRESSION(CAR(lexp1));
714  NORMALIZE_EXPRESSION(exp_a);
715  NORMALIZE_EXPRESSION(exp2);
718  lexp1 = CDR(lexp1);
719 
720  vect2 = vect_multiply(vect2, d1);
721  if (ENTITY_PLUS_P(ent))
722  vect1 = vect_add(vect1, vect2);
723  else vect1 = vect_substract(vect1, vect2);
724 
725  val = VALUE_TO_INT(vect_pgcd_all(vect1));
726  if ((val%(*d)) == 0)
727  {
728  vect1 = vect_div(vect1, d2);
729  *e = Pvecteur_to_expression(vect1);
731  *d = 1;
732  }
733  else
734  {
735  exp_a = Pvecteur_to_expression(vect1);
736  unnormalize_expression(exp_a);
737  lexp1 = CONS(EXPRESSION, exp_a, lexp1);
738  ca = make_call(func, lexp1);
739  syn = make_syntax(is_syntax_call, ca);
741  }
742  }
743  else if ((d1 != 1) && (d2 != 1))
744  {
747  (expression_syntax(exp1)))));
749  (expression_syntax(exp2)))));
750  NORMALIZE_EXPRESSION(exp_a);
751  NORMALIZE_EXPRESSION(exp_b);
754 
755  vect1 = vect_multiply(vect1, (*d/d1));
756  vect2 = vect_multiply(vect2, (*d/d2));
757  if (ENTITY_PLUS_P(ent))
758  vect1 = vect_add(vect1, vect2);
759  else vect1 = vect_substract(vect1, vect2);
760 
761  val = VALUE_TO_INT(vect_pgcd_all(vect1));
762  if ((val%(*d)) == 0)
763  {
764  vect1 = vect_div(vect1, (*d));
765  *e = Pvecteur_to_expression(vect1);
767  *d = 1;
768  }
769  else
770  {
771  exp_a = Pvecteur_to_expression(vect1);
772  unnormalize_expression(exp_a);
773  exp_b = int_to_expression(*d);
774  lexp1 = CONS(EXPRESSION, exp_b, NIL);
775  lexp1 = CONS(EXPRESSION, exp_a, lexp1);
776  ca = make_call(func, lexp1);
777  syn = make_syntax(is_syntax_call, ca);
779  }
780  }
781  else
782  {
783  NORMALIZE_EXPRESSION(exp1);
784  NORMALIZE_EXPRESSION(exp2);
787 
788  if (ENTITY_PLUS_P(ent))
789  vect1 = vect_add(vect1, vect2);
790  else vect1 = vect_substract(vect1, vect2);
791 
792  *e = Pvecteur_to_expression(vect1);
794  }
795  }
796  break;
797 
798  case is_syntax_reference:
799  *d = 1;
800  break;
801  }
802  }
803 
804  else
805  {
806  /* case of an already normalized expression, do nothing */
808  *d =1;
809  }
810 }
811 
812 /*=======================================================================*/
813 /* bool exp_equals_p(e1,e2): tests if two expressions are equal. This
814  * function is better than expression_equal_p() because it takes into
815  * account the case where the expressions are not linear.
816  *
817  * AC 94/01/03
818  */
819 
820 bool exp_equals_p(e1, e2)
821 
822  expression e1, e2;
823 {
824  expression e12, e22;
825  int d1, d2;
826 
827  analyze_expression(&e1, &d1);
828  analyze_expression(&e2, &d2);
829 
830  if (d1 == d2)
831  {
832  if (d1 == 1)
833  {
834  if ((e1 != expression_undefined) && \
835  (e2 != expression_undefined))
836  {
839  return (vect_equal(normalized_linear(e1),\
840  normalized_linear(e2)));
841  }
842  else return(false);
843  }
844  else
845  {
847  (expression_syntax(e1)))));
849  (expression_syntax(e2)))));
852  return (vect_equal(normalized_linear(e12),\
853  normalized_linear(e22)));
854  }
855  }
856  else return(false);
857 }
858 
859 /*=======================================================================*/
860 /* bool list_of_exp_equals_p(l1,l2): tests if two lists of expressions
861  * have all their terms equals. Beware, the equality of the length of the
862  * two lists is not checked !
863  *
864  * AC 94/01/03
865  */
866 
868 
869  list l1, l2;
870 {
871  bool is_equal = true;
872  expression exp1, exp2;
873 
874  while ((is_equal) && (l1 != NIL))
875  {
876  exp1 = EXPRESSION(CAR(l1));
877  exp2 = EXPRESSION(CAR(l2));
878  is_equal = exp_equals_p(exp1, exp2);
879  l1 = CDR(l1);
880  l2 = CDR(l2);
881  }
882 
883  return (is_equal);
884 }
885 
886 /*************************************************************************/
887 
bdt make_bdt(list a)
Definition: paf_ri.c:54
schedule make_schedule(intptr_t a1, predicate a2, list a3)
Definition: paf_ri.c:613
call make_call(entity a1, list a2)
Definition: ri.c:269
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
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
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
value make_value(enum value_utype tag, void *val)
Definition: ri.c:2832
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
static int crt_stmt
Current source statement.
Definition: adg_read_paf.c:162
statement adg_number_to_statement(int in_nb)
======================================================================
Definition: adg_utils.c:461
#define VALUE_ZERO
#define VALUE_TO_INT(val)
#define value_notzero_p(val)
#define value_uminus(val)
unary operators on values
#define value_zero_p(val)
int Value
#define value_abs(val)
#define value_mod(v1, v2)
static list lexp
bool base_contains_variable_p(Pbase b, Variable v)
bool base_contains_variable_p(Pbase b, Variable v): returns true if variable v is one of b's elements...
Definition: base.c:136
Psysteme my_sc_normalize(Psysteme ps)
==============================================================
Definition: bdt_utils.c:254
dfg_arc_label arc_label
C3 includes
Definition: bdt_utils.c:76
schedule true_copy_schedule(schedule s)
=================================================================
Definition: bdt_utils.c:318
entity create_named_entity(char *name)
=====================================================================
Definition: bdt_utils.c:85
dfg_vertex_label vertex_label
Definition: bdt_utils.c:77
void fprint_bdt_with_stat(FILE *fp, bdt obj)
===========================================================================
Definition: bdt_utils.c:115
void poly_chg_var(Ppolynome pp, Variable v_old, Variable v_new)
=================================================================
Definition: bdt_utils.c:399
Psysteme suppress_sc_in_sc(Psysteme in_ps1, Psysteme in_ps2)
======================================================================
Definition: bdt_utils.c:426
bool my_contrainte_normalize(Pcontrainte c, bool is_egalite)
=========================================================================
Definition: bdt_utils.c:192
bool my_inegalite_normalize(Pcontrainte ineg)
==============================================================
Definition: bdt_utils.c:239
Psysteme predicate_to_system(predicate p)
=================================================================
Definition: bdt_utils.c:298
bool system_contains_var(Psysteme ps, Variable var)
=====================================================================
Definition: bdt_utils.c:382
bool list_of_exp_equals_p(list l1, list l2)
======================================================================
Definition: bdt_utils.c:867
bdt true_copy_bdt(bdt b)
=====================================================================
Definition: bdt_utils.c:354
bool exp_equals_p(expression e1, expression e2)
======================================================================
Definition: bdt_utils.c:820
void analyze_expression(expression *e, int *d)
=====================================================================
Definition: bdt_utils.c:480
struct _newgen_struct_type_ * type
#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
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define full_name(dir, name)
Definition: compile.c:414
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
Definition: expression.c:2453
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50
Value vect_pgcd_all(Pvecteur v)
Value vect_pgcd(Pvecteur v): calcul du pgcd de tous les coefficients non nul d'un vecteur v.
Definition: reductions.c:108
bool vect_equal(Pvecteur v1, Pvecteur v2)
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
Definition: reductions.c:278
Value vect_pgcd_except(Pvecteur v, Variable var)
Value vect_pgcd_except(Pvecteur v, Variable var): calcul du pgcd de tous les coefficients non nul d'u...
Definition: reductions.c:130
#define MODULE_SEP_STRING
Definition: naming-local.h:30
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
int tag
TAG.
Definition: newgen_types.h:92
#define UU
Definition: newgen_types.h:98
void pu_inegalite_fprint(FILE *, Pcontrainte, const char *(*)(entity))
print.c
void pu_egalite_fprint(FILE *, Pcontrainte, const char *(*)(entity))
#define SCHEDULE(x)
SCHEDULE.
Definition: paf_ri.h:682
#define schedule_predicate(x)
Definition: paf_ri.h:715
#define bdt_schedules(x)
Definition: paf_ri.h:226
#define schedule_dims(x)
Definition: paf_ri.h:717
#define schedule_statement(x)
Definition: paf_ri.h:713
#define bdt_undefined
Definition: paf_ri.h:204
int sol_ppcm()
void unnormalize_expression(void *st)
void unnormalize_expression(expression exp): puts all the normalized field of expressions in "st" to ...
Definition: normalize.c:452
#define monome_term(pm)
#define polynome_monome(pp)
#define POLYNOME_NUL_P(pp)
#define polynome_succ(pp)
string expression_to_string(expression e)
Definition: expression.c:77
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
#define ENTITY_DIVIDE_P(e)
#define ENTITY_PLUS_P(e)
#define ENTITY_MULTIPLY_P(e)
#define NORMALIZE_EXPRESSION(e)
#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
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
Definition: expression.c:1825
int expression_to_int(expression exp)
================================================================
Definition: expression.c:2205
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
type MakeTypeVariable(basic, cons *)
BEGIN_EOLE.
Definition: type.c:116
@ is_basic_int
Definition: ri.h:571
#define normalized_undefined
Definition: ri.h:1745
#define syntax_tag(x)
Definition: ri.h:2727
#define call_function(x)
Definition: ri.h:709
@ is_value_unknown
Definition: ri.h:3035
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_reference
Definition: ri.h:2691
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
@ is_storage_rom
Definition: ri.h:2494
#define entity_undefined
Definition: ri.h:2761
#define expression_undefined
Definition: ri.h:1223
#define normalized_tag(x)
Definition: ri.h:1778
#define predicate_undefined
Definition: ri.h:2046
#define expression_normalized(x)
Definition: ri.h:1249
#define syntax_call(x)
Definition: ri.h:2736
#define type_undefined
Definition: ri.h:2883
#define call_arguments(x)
Definition: ri.h:711
#define entity_type(x)
Definition: ri.h:2792
#define normalized_linear(x)
Definition: ri.h:1781
#define expression_syntax(x)
Definition: ri.h:1247
#define predicate_system(x)
Definition: ri.h:2069
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
@ is_normalized_complex
Definition: ri.h:1761
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
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
void sc_elim_empty_constraints(Psysteme ps, bool process_equalities)
void sc_elim_empty_constraints(Psysteme ps, bool process_equalities): elimination des "fausses" contr...
Psysteme sc_elim_db_constraints(Psysteme ps)
Psysteme sc_elim_db_constraints(Psysteme ps): elimination des egalites et des inegalites identiques o...
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
Pvecteur vect_clean(Pvecteur v)
Pvecteur vect_clean(Pvecteur v): elimination de tous les couples dont le coefficient vaut 0 dans le v...
Definition: scalaires.c:80
Pvecteur vect_div(Pvecteur v, Value x)
Pvecteur vect_div(Pvecteur v, Value x): division du vecteur v par le scalaire x, si x est different d...
Definition: scalaires.c:52
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
Definition: scalaires.c:123
#define BDT_MODULE_NAME
static bool ok
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
Pcontrainte egalites
Definition: sc-local.h:70
Pbase base
Definition: sc-local.h:75
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
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
struct Svecteur * Pvecteur
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_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
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
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143
void vect_chg_var(Pvecteur *ppv, Variable v_old, Variable v_new)
void vect_chg_var(Pvecteur *ppv, Variable v_old, Variable v_new) replace the variable v_old by v_new
Definition: unaires.c:168
void vect_normalize(Pvecteur v)
void vect_normalize(Pvecteur v): division de tous les coefficients de v par leur pgcd; "normalisation...
Definition: unaires.c:59