PIPS
reindexing_utils.c
Go to the documentation of this file.
1 /*
2 
3  $Id: reindexing_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 : reindexing_utils.c
28  * Package : reindexing
29  * Author : Alexis Platonoff & Antoine Cloue
30  * Date : May 1994
31  * Historic :
32  * - 20 apr 95 : modification of create_new_entity(), AP
33  *
34  * Documents: SOON
35  * Comments : contains some usefull functions.
36  */
37 
38 /* Ansi includes */
39 #include <stdlib.h>
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <string.h>
43 
44 /* Newgen includes */
45 #include "genC.h"
46 
47 /* C3 includes */
48 #include "boolean.h"
49 #include "arithmetique.h"
50 #include "vecteur.h"
51 #include "contrainte.h"
52 #include "ray_dte.h"
53 #include "sommet.h"
54 #include "sg.h"
55 #include "sc.h"
56 #include "polyedre.h"
57 #include "union.h"
58 #include "matrix.h"
59 
60 /* Pips includes */
61 #include "boolean.h"
62 #include "ri.h"
63 #include "constants.h"
64 #include "ri-util.h"
65 #include "misc.h"
66 #include "complexity_ri.h"
67 #include "database.h"
68 #include "graph.h"
69 #include "dg.h"
70 #include "paf_ri.h"
71 #include "parser_private.h"
72 #include "property.h"
73 #include "reduction.h"
74 #include "text.h"
75 #include "text-util.h"
76 #include "tiling.h"
77 #include "text-util.h"
78 #include "pipsdbm.h"
79 #include "resources.h"
80 #include "static_controlize.h"
81 #include "paf-util.h"
82 #include "pip.h"
83 #include "array_dfg.h"
84 #include "reindexing.h"
85 
86 /* Macro functions */
87 
88 /* Internal variables */
89 
90 /* Local defines */
93 
94 #define SUCC(cp) (((cp) == NULL) ? NULL : (cp)->succ)
95 
96 
97 /*=======================================================================*/
98 /* Psyslist reverse_psyslist(l): reverse the psyslist l.
99  *
100  * AC 94/06/29
101  */
102 
104 
105  Psyslist l;
106 {
107  Psyslist next, next_next;
108 
109  if( l == NULL || l->succ == NULL ) return(l) ;
110 
111  next = l->succ;
112  l->succ = NULL ;
113  next_next = SUCC(next);
114 
115  for( ; next != NULL ; )
116  {
117  next->succ = l;
118  l = next ;
119  next = next_next ;
120  next_next = SUCC(next_next);
121  }
122 
123  return(l) ;
124 }
125 
126 /*=======================================================================*/
127 /* expression psystem_to_expression(predicate pred): function that
128  * transforms a predicate into an expression. Function that comes from
129  * single_assign.c but I have modified it to include the case where
130  * pred is NULL.
131  *
132  * AC 94/06/24
133  */
135  Psysteme ps;
136 {
137  entity and_ent, leq_ent, equ_ent;
138  expression exp1 = expression_undefined, exp2;
139  Pcontrainte pc;
140 
141  if (SC_UNDEFINED_P(ps))
142  return(int_to_expression(0));
143  else {
146  entity_domain);
149  entity_domain);
152  entity_domain);
153 
154  if( (and_ent == entity_undefined) || (leq_ent == entity_undefined) ||
155  (equ_ent == entity_undefined) ) {
156  pips_internal_error("There is no entity for operators");
157  }
158 
159  for(pc = ps->inegalites; pc!=NULL; pc = pc->succ) {
160  Pvecteur pv = pc->vecteur;
162  exp2 = MakeBinaryCall(leq_ent, exp, int_to_expression(0));
163 
164  if(exp1 == expression_undefined) exp1 = exp2;
165  else exp1 = MakeBinaryCall(and_ent, exp1, exp2);
166  }
167 
168  for(pc = ps->egalites; pc!=NULL; pc = pc->succ) {
169  Pvecteur pv = pc->vecteur;
170  exp2 = MakeBinaryCall(equ_ent, make_vecteur_expression(pv),
171  int_to_expression(0));
172  if(exp1 == expression_undefined) exp1 = exp2;
173  else exp1 = MakeBinaryCall(and_ent, exp1, exp2);
174  }
175 
176  if (get_debug_level() > 7) {
177  fprintf(stderr, "\t[predicate_to_expression] Result: %s\n",
178  expression_to_string(exp1));
179  }
180 
181  return(exp1);
182  }
183 }
184 
185 /*=========================================================================*/
186 /* reference build_new_ref(int kind,int n,list subscripts,reference old_r)
187  *
188  * builds a new array reference. Its entity name depends on "kind":
189  * kind == IS_TEMP => name is : SATn
190  * kind == IS_NEW_ARRAY => name is : SAIn
191  * We first test if this entity does not exist yet. If not, we have create
192  * it with a type_variable with the same basic as the one of the entity of
193  * "old_ref" and a dimension depending again on kind:
194  * kind == IS_TEMP => dimension is: empty
195  * kind == IS_NEW_ARRAY => dimension is: dimension of the loop nest of
196  * statement number n
197  *
198  * Its indices of the new reference are "subscripts".
199  *
200  * "subscripts" is a list of affine expressions.
201  * If "subscripts" is empty, then this is a scalar.
202  * AC : function that comes from single_assign.c but we have modified it
203  * to include the new parameter BASE_NODE_NUMBER.
204  */
205 
206 reference my_build_new_ref(kind, n, subscripts, old_r)
207 
208  int kind;
209  int n;
210  list subscripts;
211  reference old_r;
212 {
213  list sl;
214  entity ent;
215  string num, name = (string) NULL;
216  entity mod_entity;
217  code mod_code;
218 
219  /* we duplicate this list */
220  sl = subscripts;
221 
222  num = atoi(n-BASE_NODE_NUMBER);
223  if(kind == IS_TEMP)
225  SAT, num, (char *) NULL));
226  else if(kind == IS_NEW_ARRAY)
228  SAI, num, (char *) NULL));
229  else
230  pips_internal_error("Bad value for kind");
231 
232  ent = gen_find_tabulated(name, entity_domain);
233  if(ent == entity_undefined) {
234  list dims = NIL;
235 
236  if(kind == IS_NEW_ARRAY)
237  dims = dims_of_nest(n);
238  else
239  pips_internal_error("Bad value for kind");
240 
241  ent = create_entity(name, make_variable(basic_of_reference(old_r), dims));
242 
243  /* Declare the entity */
244  mod_entity = get_current_module_entity();
245  mod_code = entity_code(mod_entity);
246  code_declarations(mod_code) = gen_nconc(code_declarations(mod_code),
247  CONS(ENTITY, ent, NIL));
248 
249  if (get_debug_level() > 6) {
250  if(kind == IS_NEW_ARRAY)
251  fprintf(stderr, "\n***\nCreate an ARRAY ENTITY : %s, %s\n",
252  entity_local_name(ent), name);
253  }
254  }
255 
256  return(make_reference(ent, sl));
257 }
258 
259 /*=========================================================================*/
260 /* void lhs_subs_in_ins(instruction ins, string SA, int n, list subscripts)
261  *
262  * Substitutes to the lhs (left Hand Side) reference of "ins" the array
263  * reference SAn[subscripts], cf. build_new_ref().
264  *
265  * "subscripts" is a list of entity, so we have transform it into a list of
266  * expression.
267  *
268  * Note: "ins" must be an assign call
269  */
270 
271 void my_lhs_subs_in_ins(ins, SA, n, subscripts)
272 
273  instruction ins;
274  string SA;
275  int n;
276  list subscripts;
277 {
278  switch(instruction_tag(ins))
279  {
280  case is_instruction_call : {
281  call c = instruction_call(ins);
283  expression lhs_exp = EXPRESSION(CAR(call_arguments(c)));
284  syntax sy = expression_syntax(lhs_exp);
285  if(syntax_reference_p(sy)) {
286  reference lhs = syntax_reference(sy);
287  list exp_subs = entities_to_expressions(subscripts);
289  exp_subs, lhs);
290 
291  }
292  else pips_internal_error("Lhs is not a reference");
293  }
294  else pips_internal_error("Instruction is not an assign call");
295  break;
296  }
297  case is_instruction_block :
298  case is_instruction_test :
299  case is_instruction_loop :
300  case is_instruction_goto :
302  default : pips_internal_error("Instruction is not an assign call");
303  }
304 }
305 
306 /*========================================================================*/
307 /* list ADD_LIST_TO_LIST(l1, l2): add the list l2 at the end of the list l1
308  *
309  * AC 94/06/07
310  */
311 
313 
314  list l1, l2;
315 {
316  list l3, l4;
317 
318  if (l1 == NIL) return(l2);
319  if (l2 == NIL) return(l1);
320 
321  l3 = l1;
322 
323  while (l3 != NIL)
324  {
325  l4 = l3;
326  l3 = l3->cdr;
327  }
328  l4->cdr = l2;
329 
330  return(l1);
331 }
332 
333 /*========================================================================*/
334 /* void fprint_list_of_ins(fp, li): print a list of instruction.
335  *
336  * AC 94/06/07
337  */
338 
339 void fprint_list_of_ins(fp, li)
340 
341  FILE *fp;
342  list li;
343 {
344  int i = 1;
345 
346  fprintf(fp,"\nListe of instruction:");
347  fprintf(fp,"\n=====================");
348 
349  for (; li != NIL; li = CDR(li))
350  {
351  fprintf(fp, "\nInstruction n. %d:\n", i);
352  sa_print_ins(fp, INSTRUCTION(CAR(li)));
353  i++;
354  }
355 }
356 
357 /*========================================================================*/
358 /* void fprint_loop(fp, lp): print a loop.
359  *
360  * AC 94/06/07
361  */
362 
363 void fprint_loop(fp, lp)
364 
365  FILE *fp;
366  loop lp;
367 {
368  fprintf(fp,"\nIndice de boucle :");
370  fprintf(fp,"\nDomaine (lower, upper, inc):");
373  fprint_list_of_exp(fp,
375  fprint_list_of_exp(fp,
377  fprintf(fp,"\nCorps de boucle :");
379  fprintf(fp,"\nLabel:");
381  fprintf(fp,"\nType d'execution");
383  fprintf(fp," ->sequentiel");
384  else fprintf(fp, "->parallele");
385  fprintf(fp, "\nLocals : ");
387 }
388 
389 /*========================================================================*/
390 /* void fprint_call(fp, ca): print a call.
391  *
392  * AC 94/06/07
393  */
394 
395 void fprint_call(fp, ca)
396 
397  FILE *fp;
398  call ca;
399 {
400  expression exp1, exp2;
401 
402  exp1 = EXPRESSION(CAR(call_arguments(ca)));
403  exp2 = EXPRESSION(CAR((call_arguments(ca))->cdr));
404  fprintf(fp, "\nCall : ");
405  fprint_list_of_exp(fp, CONS(EXPRESSION, exp1, NIL));
406  fprintf(fp, " %s ", entity_local_name(call_function(ca)));
407  fprint_list_of_exp(fp, CONS(EXPRESSION, exp2, NIL));
408 }
409 
410 /*=======================================================================*/
411 /* void print_detailed_ins(): the instruction is either a
412  * test or an unstructured.
413  *
414  * AC 01/06/94
415  */
416 
418 
419  instruction ins;
420 {
421  list l;
422  statement stat;
423  loop lp;
424 
425  switch (instruction_tag(ins))
426  {
428  {
429  fprintf(stderr,"\nC'est un block de statement :");
430  for (l = instruction_block(ins); l != NIL; l = CDR(l))
431  {
432  stat = STATEMENT(CAR(l));
434  }
435  fprintf(stderr,"\nFin du block");
436  break;
437  }
438 
439  case is_instruction_test:
440  {
441  fprintf(stderr,"\nC'est un test :");
442  fprintf(stderr,"\nTrue statement :");
444  test_true(instruction_test(ins))));
445  fprintf(stderr, "\nFin de la branche True");
446  fprintf(stderr,"\nFalse statement :");
449  fprintf(stderr,"\nFin du test.");
450  break;
451  }
452 
453  case is_instruction_loop:
454  {
455  fprintf(stderr,"\nC'est une boucle :");
456  lp = instruction_loop(ins);
457  fprint_loop(stderr, lp);
458  fprintf(stderr,"\nFin de boucle.");
459  break;
460  }
461 
462  case is_instruction_goto:
463  {
464  fprintf(stderr, "\nC'est une instruction goto ");
466  fprintf(stderr,"\nFin du goto");
467  break;
468  }
469 
470  case is_instruction_call:
471  {
472  fprintf(stderr, "\nC'est un call ");
473  fprint_call(stderr, instruction_call(ins));
474  fprintf(stderr, "\nFin du call");
475  break;
476  }
477 
479  {
480  fprintf(stderr,"\nC'est un unstructured ;");
481 /* loop_normalize_of_unstructured(instruction_unstructured(ins));*/
484  instruction_unstructured(ins))));
485  fprintf(stderr, "\nFin du unstructured");
486  break;
487  }
488  }
489 }
490 
491 /*========================================================================*/
492 /* Psyslist add_sclist_to_sclist(l1, l2): add the list of systems l2 at
493  * the end of the list of system l1.
494  *
495  * Ac 94/05/05
496  */
497 
499 
500  Psyslist l1, l2;
501 {
502  Psyslist l = l1, ls;
503 
504  if (l2 == NULL) return(l1);
505 
506  if (l != NULL)
507  {
508  ls = l->succ;
509  while (ls != NULL)
510  {
511  l = l->succ;
512  ls = l->succ;
513  }
514  l->succ = l2;
515  return(l1);
516  }
517  else return(l2);
518 }
519 
520 /*========================================================================*/
521 /* Psysteme base_complete(Psysteme sys, list var_l, list par_l): "sys" gives
522  * a family of free vectors {V1, ..., Vs} represented by a linear combinations
523  * of indices from "var_l". This function wants to find the indices
524  * (I1, ..., Id) of "var_l" for which we have that {V1, ..., Vs, I1, ..., Id}
525  * is a family of free vectors.
526  * "par_l" gives the symbolic constants that may appear in "sys".
527  *
528  * "s" is the number of equations of "sys" (its number of vectors).
529  * "d" is the number of vectors we have to find in order to get as much
530  * equations in "sys" as there are indices in "var_l".
531  *
532  * Example: with "sys" equal to {i+j = 0, i-k+2j = 0}, and "var_l" equal to
533  * {i, j, k} we obtain the new system {i+j = 0, i-k+2j = 0, i = 0}
534  *
535  * function written by Alexis in "utils.c". The difference is that
536  * it returns the list of new free vectors added. (AC 94/03/18)
537  */
538 
539 Psysteme base_complete(sys, var_l, par_l, new_l)
540 
541  Psysteme sys;
542  list var_l, par_l, *new_l;
543 {
544  Psysteme ps = sc_dup(sys), new_ps = sc_new();
545  int dim = gen_length(var_l) - sys->nb_eq;
546  list l;
547 
548  for (l = var_l; (!ENDP(l)) && (new_ps->nb_eq < dim); POP(l))
549  {
550  entity var = ENTITY(CAR(l));
551  Pvecteur pv = vect_new((Variable) var, 1);
552  Psysteme aux_ps = sc_dup(ps);
553  Psysteme aux_new_ps = sc_dup(new_ps);
554 
555  sc_add_egalite(aux_new_ps, contrainte_make(pv));
556  aux_ps = append_eg(aux_ps, aux_new_ps);
557 
558  if (vecteurs_libres_p(aux_ps, list_to_base(var_l), list_to_base(par_l)))
559  {
560  new_ps = aux_new_ps;
561  ADD_ELEMENT_TO_LIST(*new_l, ENTITY, var);
562  }
563  else
564  sc_rm(aux_new_ps);
565  }
566 
567  ps = append_eg(ps, new_ps);
568  ps->base = NULL;
569  sc_creer_base(ps);
570 
571  return(ps);
572 }
573 
574 /*========================================================================*/
575 /* Psysteme sc_add_egalite_at_end(ps, co): idem "sc_add_egalite()" except that
576  * it puts the new constraint at the end of the list of constraints.
577  *
578  * The system basis is not updated. ps may be inconsistent on return.
579  *
580  * AC 94/03/17
581  */
583 {
584  Pcontrainte co_aux;
585 
586  if (ps->egalites == NULL) ps->egalites = co;
587  else
588  {
589  for (co_aux = ps->egalites; co_aux->succ != NULL; co_aux = co_aux->succ) ;
590  co_aux->succ = co;
591  }
592  ps->nb_eq++;
593 
594  return ps;
595 }
596 
597 /*=========================================================================*/
598 /* void matrix_coef_mult(A, nb):multiply all elements of matrix A by the
599  * number nb.
600  *
601  * AC 94/03/21
602  */
603 
604 /* also elsewehre... */
606 
607  Pmatrix A;
608  Value nb;
609 {
610  int i, j;
611 
612  for (i = 1; i <= MATRIX_NB_LINES(A); i++)
613  for (j = 1; j <= MATRIX_NB_COLUMNS(A); j++)
614  value_product(MATRIX_ELEM(A,i,j), nb);
615 }
616 
617 /*======================================================================*/
618 /* void constraints_with_sym_cst_to_matrices(Pcontrainte pc,
619  * Pbase index_base const_base, matrice A B, int n m1 m2):
620  *
621  * constructs the matrices "A" and "B" corresponding to the linear
622  * constraints "pc", so: A.ib + B1.cb + B2 = 0 <=> pc(ib, cb) = 0:
623  *
624  * B = ( B1 | B2 ), B2 of dimension (n,1).
625  *
626  * The basis "ib" gives the variables of the linear system.
627  * The basis "cb" gives the symbolic constants of the linear system.
628  *
629  * The matrices "A" and "B" are supposed to have been already allocated
630  * in memory, respectively of dimension (n, m1) and (n, m2).
631  *
632  * "n" must be the exact number of constraints in "pc".
633  * "m1" must be the exact number of variables in "ib".
634  * "m2" must be equal to the number of symbolic constants (in "cb") PLUS
635  * ONE (the actual constant).
636  */
637 void my_constraints_with_sym_cst_to_matrices(pc,index_base,const_base,A,B)
638 
639  Pcontrainte pc;
640  Pbase index_base,const_base;
641  Pmatrix A, B;
642 {
643  int i,j;
644  Pcontrainte eq;
645  Pvecteur pv;
646  int n = 0;
647  int m2 = vect_size(const_base) + 1; /* CHANGE HERE !!! */
648 
649  for (eq = pc; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,n++);
650  matrix_nulle(B);
651  matrix_nulle(A);
652 
653  for (eq = pc,i=1; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,i++)
654  {
655  for(pv = index_base, j=1; pv != NULL; pv = pv->succ, j++)
656  { MATRIX_ELEM(A,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur);}
657 
658  for(pv = const_base, j=1; pv != NULL; pv = pv->succ, j++)
659  { MATRIX_ELEM(B,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur);}
660 
662  }
663 }
664 
665 /*======================================================================*/
666 /* void my_matrices_to_constraints_with_sym_cst(Pcontrainte *pc,
667  * Pbase index_base const_base, matrice A B,int n m1 m2):
668  *
669  * constructs the constraints "pc" corresponding to the matrices "A" and "B"
670  * so: A.ib + B1.cb + B2 = nb <=> pc(nb, ib, cb) = 0, with:
671  *
672  * B = ( B1 | B2 ), B2 of dimension (n,1).
673  *
674  * The basis "ib" gives the variables of the linear system.
675  * The basis "cb" gives the symbolic constants of the linear system.
676  * The basis "nb" gives the new variables of the linear system.
677  *
678  * The matrices "A" and "B" are respectively of dimension (n, m1) and (n,m2).
679  *
680  * "n" will be the exact number of constraints in "pc".
681  * "m1" must be the exact number of variables in "ib".
682  * "m2" must be equal to the number of symbolic constants (in "cb") PLUS
683  * ONE (the actual constant).
684  *
685  * Note: the formal parameter pc is a "Pcontrainte *". Instead, the resulting
686  * Pcontrainte could have been returned as the result of this function.
687  *
688  * TAKE CARE : new_base should be well ordered !!
689  *
690  * AC 94/03/30
691  */
692 
693 void my_matrices_to_constraints_with_sym_cst(pc, new_base, index_base,
694  const_base, A, B)
695 
696  Pcontrainte *pc;
697  Pbase new_base, index_base, const_base;
698  Pmatrix A, B;
699 {
700  Pvecteur vect, pv = NULL;
701  Pcontrainte cp, newpc = NULL;
702  int i, j;
703  Value cst, coeff, dena, denb, ppc;
704  bool found;
705  list lnew = gen_nreverse(base_to_list(new_base));
706  entity ent;
707 
708  int n= MATRIX_NB_LINES(A);
709  int m1 = MATRIX_NB_COLUMNS(A);
710  int m2 = MATRIX_NB_COLUMNS(B);
711  dena = MATRIX_DENOMINATOR(A);
712  denb = MATRIX_DENOMINATOR(B);
713 
714  ppc = ppcm(dena, denb);
715 
716  for (i = n; i >= 1; i--)
717  {
718  found = false;
719  cp = contrainte_new();
720 
721  /* build the constant terme if it exists */
722  if (value_notzero_p(cst = MATRIX_ELEM(B,i,m2)))
723  {
724  Value x = value_mult(ppc,cst);
725  value_division(x, denb);
726  pv = vect_new(TCST, x);
727  found = true;
728  }
729 
730  vect = index_base;
731  for (j = 1; j <= m1; vect = vect->succ, j++)
732  {
733  if (value_notzero_p(coeff = MATRIX_ELEM(A,i,j)))
734  {
735  Value x = value_div(ppc,dena);
736  value_product(x,coeff);
737  if (found)
738  vect_chg_coeff(&pv, vecteur_var(vect), x);
739  else
740  {
741  /* build a new vecteur if there is not constant term */
742  pv = vect_new(vecteur_var(vect), x);
743  found = true;
744  }
745  }
746  }
747 
748  vect = const_base;
749  for (j = 1; j <= m2-1; vect = vect->succ, j++)
750  {
751  if (value_notzero_p(coeff = MATRIX_ELEM(B,i,j)))
752  {
753  Value x = value_div(ppc,denb);
754  value_product(x,coeff);
755  if (found)
756  vect_chg_coeff(&pv, vecteur_var(vect), x);
757  else
758  {
759  /* build a new vecteur if there is not constant term */
760  pv = vect_new(vecteur_var(vect), x);
761  found = true;
762  }
763  }
764  }
765 
766  ent = ENTITY(CAR(lnew));
767  pv = vect_substract(pv, vect_new((Variable) ent, ppc));
768  lnew = CDR(lnew);
769 
770  cp->vecteur = pv;
771  cp->succ = newpc;
772  newpc = cp;
773  }
774 
775  *pc = newpc;
776 }
777 
778 /*======================================================================*/
779 /* void my_matrices_to_constraints_with_sym_cst_2(Pcontrainte *pc,
780  * Pbase index_base const_base, matrice A B,int n m1 m2):
781  *
782  * constructs the constraints "pc" corresponding to the matrices "A" and "B"
783  * so: A.ib + B1.cb + B2 = nb <=> pc(nb, ib, cb) = 0, with:
784  *
785  * B = ( B1 | B2 ), B2 of dimension (n,1).
786  *
787  * The basis "ib" gives the variables of the linear system.
788  * The basis "cb" gives the symbolic constants of the linear system.
789  * The basis "nb" gives the new variables of the linear system.
790  *
791  * The matrices "A" and "B" are respectively of dimension (n, m1) and (n,m2).
792  *
793  * "n" will be the exact number of constraints in "pc".
794  * "m1" must be the exact number of variables in "ib".
795  * "m2" must be equal to the number of symbolic constants (in "cb") PLUS
796  * ONE (the actual constant).
797  *
798  * Note: the formal parameter pc is a "Pcontrainte *". Instead, the resulting
799  * Pcontrainte could have been returned as the result of this function.
800  *
801  * TAKE CARE : new_base should be well ordered !!
802  *
803  * AC 94/03/30
804  */
805 
806 void my_matrices_to_constraints_with_sym_cst_2(pc, new_base, index_base,
807  const_base, A, B)
808 
809  Pcontrainte *pc;
810  Pbase new_base, index_base, const_base;
811  Pmatrix A, B;
812 {
813  Pvecteur vect, pv = NULL;
814  Pcontrainte cp, newpc = NULL;
815  int i, j;
816  Value cst, coeff, dena, denb, ppc;
817  bool found;
818 
819  int n= MATRIX_NB_LINES(A);
820  int m1 = MATRIX_NB_COLUMNS(A);
821  int m2 = MATRIX_NB_COLUMNS(B);
822  dena = MATRIX_DENOMINATOR(A);
823  denb = MATRIX_DENOMINATOR(B);
824 
825  ppc = ppcm(dena, denb);
826 
827  for (i = n; i >= 1; i--)
828  {
829  found = false;
830  cp = contrainte_new();
831 
832  /* build the constant terme if it exists */
833  if (value_notzero_p(cst = MATRIX_ELEM(B,i,m2)))
834  {
835  Value x = value_div(ppc,denb);
836  value_product(x, cst);
837  pv = vect_new(TCST, x);
838  found = true;
839  }
840 
841  vect = index_base;
842  for (j = 1; j <= m1; vect = vect->succ, j++)
843  {
844  if (value_notzero_p(coeff = MATRIX_ELEM(A,i,j)))
845  {
846  Value x = value_div(ppc,dena);
847  value_product(x,coeff);
848  if (found)
849  vect_chg_coeff(&pv, vecteur_var(vect), x);
850  else
851  {
852  /* build a new vecteur if there is not constant term */
853  pv = vect_new(vecteur_var(vect), x);
854  found = true;
855  }
856  }
857  }
858 
859  vect = const_base;
860  for (j = 1; j <= m2-1; vect = vect->succ, j++)
861  {
862  if (value_notzero_p(coeff = MATRIX_ELEM(B,i,j)))
863  {
864  Value x = value_div(ppc,denb);
865  value_product(x,coeff);
866  if (found)
867  vect_chg_coeff(&pv, vecteur_var(vect), x);
868  else
869  {
870  /* build a new vecteur if there is not constant term */
871  pv = vect_new(vecteur_var(vect), x);
872  found = true;
873  }
874  }
875  }
876 
877  cp->vecteur = pv;
878  cp->succ = newpc;
879  newpc = cp;
880  }
881 
882  *pc = newpc;
883 }
884 
885 /*===================================================================*/
886 /* Psysteme matrix_to_system(A, b): transform a Pmatrix in a system
887  * following the variables in Pbase b.
888  *
889  * AC 94/05/15
890  */
891 
893 
894  Pmatrix A;
895  Pbase b;
896 {
897  Psysteme p = sc_new();
898  list l, lb = base_to_list(b);
899  int i, j;
900  Pvecteur vect, nvect;
901 
902  for (i = 1; i <= MATRIX_NB_LINES(A); i++)
903  {
904  l = lb;
905  vect = VECTEUR_NUL;
906 
907  for (j = 1; j <= MATRIX_NB_COLUMNS(A); j++)
908  {
909  nvect = vect_new((Variable) ENTITY(CAR(l)), MATRIX_ELEM(A,i,j));
910  vect = vect_add(vect, nvect);
911  l = CDR(l);
912  }
914  }
915 
916  if (get_debug_level() > 5)
917  {
918  fprintf(stderr,"\nmatrcix_to_ps");
919  fprint_psysteme(stderr,p);
920  }
921 
922  p->base = vect_dup(b);
923 
924  return(p);
925 }
926 
927 /*=========================================================================*/
928 /* Psysteme sc_reverse_constraints(ps): reverse the list of equalities and
929  * inequalities in the system ps.
930  *
931  * AC 94/03/17
932  */
933 
935 
936  Psysteme ps;
937 {
938  Pcontrainte pc1, pc2;
939 
940  pc2 = NULL;
941 
942  while (ps->egalites != NULL)
943  {
944  pc1 = ps->egalites;
945  ps->egalites = (ps->egalites)->succ;
946  pc1->succ = pc2;
947  pc2 = pc1;
948  }
949  ps->egalites = pc2;
950  pc2 = NULL;
951 
952  while (ps->inegalites != NULL)
953  {
954  pc1 = ps->inegalites;
955  ps->inegalites = (ps->inegalites)->succ;
956  pc1->succ = pc2;
957  pc2 = pc1;
958  }
959  ps->inegalites = pc2;
960 
961  return(ps);
962 }
963 
964 
965 /*=======================================================================*/
966 /* bool vars_in_vect_p(Pvecteur pv, list vars):
967  *
968  * returns true if the vector "vec" contains at least one of the variables
969  * of "vars". Else, returns FALSE. */
970 bool vars_in_vect_p(pv, vars)
971  Pvecteur pv;
972  list vars;
973 {
974  bool no_var = true;
975  list lv;
976 
977  if(!VECTEUR_NUL_P(pv)) {
978  for(lv = vars; !ENDP(lv) && no_var; POP(lv)) {
979  entity cv = ENTITY(CAR(lv));
980 
981  if(value_notzero_p(vect_coeff((Variable) cv, pv)))
982  no_var = false;
983  }
984  }
985  return(! no_var);
986 }
987 
988 
989 /*====================================================================*/
990 /* expression merge_expressions(expression exp1, exp2, int max_or_min):
991  *
992  * Merges two expression into one using the MAX or MIN function
993  *
994  * For example, with expressions (N-1) and (M+2), and IS_MIN, we obtain
995  * the following expression : MIN(N-1, M+2).
996  *
997  * Note : should be modified in order to avoid the MAX or MIN call when
998  * the result can be known (AP) */
999 expression merge_expressions(exp1, exp2, max_or_min)
1000 expression exp1, exp2;
1001 int max_or_min;
1002 {
1003  expression exp;
1004  entity op_ent = entity_undefined;
1005 
1006  if(max_or_min == IS_MAX)
1007  op_ent = entity_intrinsic("MAX");
1008  else if(max_or_min == IS_MIN)
1009  op_ent = entity_intrinsic("MIN");
1010  else
1011  user_error("merge_expressions", "Bad max or min tag\n");
1012 
1013  if(exp1 == expression_undefined)
1014  exp = exp2;
1015  else if(exp2 == expression_undefined)
1016  exp = exp1;
1017  else
1019  make_call(op_ent,
1020  CONS(EXPRESSION, exp1,
1021  CONS(EXPRESSION,
1022  exp2, NIL)))),
1024  return(exp);
1025 }
1026 
1027 
1028 /*====================================================================*/
1029 /*
1030  * bool min_or_max_expression_p(expression exp)
1031  *
1032  * Returns true if this expression ("exp") is a call to the MAX or MIN
1033  * function. Else, returns FALSE.
1034  */
1036 expression exp;
1037 {
1038  syntax sy;
1039  call ca;
1040  entity func;
1041 
1042  sy = expression_syntax(exp);
1043  if(syntax_tag(sy) != is_syntax_call)
1044  return(false);
1045 
1046  ca = syntax_call(sy);
1047  func = call_function(ca);
1048 
1049  return(ENTITY_MIN_OR_MAX_P(func));
1050 }
1051 
1052 
1053 /*========================================================================*/
1054 /* list extract_bdt(b, cn):extract in the global bdt b the bdt of the
1055  * instruction of statement cn.
1056  *
1057  * AC 94/03/15
1058  */
1059 
1061 bdt b;
1062 int cn;
1063 {
1064  list lc = NIL, ba = bdt_schedules(b);
1065  schedule sched;
1066 
1067  for (; !ENDP(ba); POP(ba)) {
1068  sched = SCHEDULE(CAR(ba));
1069  if (cn == schedule_statement(sched))
1070  ADD_ELEMENT_TO_LIST(lc, SCHEDULE, sched);
1071  }
1072 
1073  return(lc);
1074 }
1075 
1076 /*=========================================================================*/
1077 /* placement extract_plc(p, cn): extract in the global distribution p, the
1078  * placement function of statement "cn".
1079  *
1080  * AC 94/03/15
1081  */
1082 
1084 plc p;
1085 int cn;
1086 {
1087  list pa = plc_placements(p);
1089 
1090  for (; !ENDP(pa); POP(pa)) {
1091  pla = PLACEMENT(CAR(pa));
1092  if (cn == placement_statement(pla)) break;
1093  }
1094 
1095  if(pla == placement_undefined)
1096  user_error("extract_plc", "A plc is undefined\n");
1097 
1098  return(pla);
1099 }
1100 
1101 /*=========================================================================*/
1102 /* entity create_new_entity(st, typ, nb): create a new entity with the
1103  * following form : "STAT_SYMstTYPnb" where st is the statement number.
1104  *
1105  * This new entity is put in the list of entities that have to be
1106  * declared.
1107  *
1108  * AC 94/03/15
1109  *
1110  * AP 95/04/20: entities must have in their full name the current module
1111  * name instead of RE_MODULE_NAME */
1112 
1114 int st, nb;
1115 char *typ;
1116 {
1117  entity ent, mod_entity;
1118  code mod_code;
1119  char *name;
1120  string f_name;
1121 
1122  /* Create the entity */
1123  name = (char*) malloc(32);
1124  sprintf(name,"%s%d%s%d", STAT_SYM, st, typ, nb);
1125 
1126  /* f_name = concatenate(RE_MODULE_NAME, MODULE_SEP_STRING, name, NULL); */
1128  MODULE_SEP_STRING, name, NULL);
1129  free(name);
1130 
1131  ent = make_entity(strdup(f_name),
1134  NIL)),
1137 
1138  /* Declare the entity */
1139  mod_entity = get_current_module_entity();
1140  mod_code = entity_code(mod_entity);
1141  code_declarations(mod_code) = gen_nconc(code_declarations(mod_code),
1142  CONS(ENTITY, ent, NIL));
1143 
1144  return(ent);
1145 }
1146 
1147 
1148 /*=========================================================================*/
1149 /* Psysteme change_base_in_sc(ps, lvar, lequ)
1150  *
1151  * Change in the system ps all variables given by lvar by the
1152  * corresponding equation of lequ. In fact, to each variable of lvar
1153  * corresponds an equality of lequ which gives its value. We then
1154  * substitute in ps each variable of lvar by its value given by lequ.
1155  *
1156  * The system ps is modified and its new value is returned.
1157  *
1158  * AC 94/03/22 */
1159 
1161 Psysteme ps, lequ;
1162 list lvar;
1163 {
1164  entity cvar;
1165  Pcontrainte cequ;
1166  list le;
1167 
1168  /* There should be as many equalities in lequ as there are variables in
1169  * lvar.*/
1170  if (lequ->nb_eq != gen_length(lvar)) {
1171  if (get_debug_level() > 5) {
1172  fprintf(stderr,
1173  "\nErreur dans le nombre d'equations ds chg_base()!\n");
1174  fprintf(stderr,"\nnb eq = %d",lequ->nb_eq);
1175  fprintf(stderr,"\nlvar = %d", gen_length(lvar));
1176  }
1177  user_error("change_base_in_sc",
1178  "Erreur dans le nombre d'equations !\n");
1179  }
1180  else {
1181  cequ = lequ->egalites;
1182  for (le = lvar; le != NIL; POP(le), cequ = cequ->succ) {
1183  Value val;
1184  Pvecteur vec = vect_dup(cequ->vecteur);
1185 
1186  cvar = ENTITY(CAR(le));
1187 
1188  /* We have to substitute the occurrences of "cvar" in "ps" by its
1189  * counterpart in "cequ->vecteur", which represents the following
1190  * equality : cequ->vecteur = 0. We note it "vec" : val*cvar-vec=0,
1191  * so we have : vec = -(cequ->vecteur-val*cvar) */
1192  val = vect_coeff((Variable) cvar, vec);
1193  vect_erase_var(&vec, (Variable) cvar);
1194  vect_chg_sgn(vec);
1195  substitute_var_with_vec(ps, cvar, val, vec);
1196  }
1197  }
1198 
1199  ps->base = NULL;
1200  sc_creer_base(ps);
1201 
1202  return(ps);
1203 }
1204 
1205 /*=========================================================================*/
1206 /* list find_new_variables(l1, l2): replace the n first variables of list
1207  * l1 by those of list l2 (gen_length(l2) = n).
1208  *
1209  * AC 93/03/31
1210  */
1211 
1213 list l1, l2;
1214 {
1215  int n;
1216  entity e;
1217 
1218  n = gen_length(l2);
1219 
1220  while (n != 0) {
1221  l1 = CDR(l1);
1222  n--;
1223  }
1224 
1225  while (l1 != NIL) {
1226  e = ENTITY(CAR(l1));
1227  ADD_ELEMENT_TO_LIST(l2, ENTITY, e);
1228  l1 = CDR(l1);
1229  }
1230 
1231  return(l2);
1232 }
1233 
1234 
1235 /*========================================================================*/
1236 /* Psysteme my_clean_ps(ps):
1237  *
1238  * put nb_eq and nb_ineq at the rigth value.
1239  *
1240  * AC 94/05/09
1241  */
1242 
1244 Psysteme ps;
1245 {
1246  int count;
1247  Pcontrainte cont;
1248 
1249  count = 0;
1250  cont = ps->egalites;
1251  while (cont != NULL) {
1252  count++;
1253  cont = cont->succ;
1254  }
1255  ps->nb_eq = count;
1256 
1257  count = 0;
1258  cont = ps->inegalites;
1259  while (cont != NULL) {
1260  count++;
1261  cont = cont->succ;
1262  }
1263  ps->nb_ineq = count;
1264 
1265  return(ps);
1266 }
1267 
1268 
1269 /*=========================================================================*/
1270 /* bool is_vect_constant_p(v): test if a vecteur is constant.
1271  *
1272  * AC 94/07/01
1273  */
1274 
1276 Pvecteur v;
1277 {
1278  if (VECTEUR_NUL_P(v))
1279  return(true);
1280  else {
1281  if ((v->var == TCST)&&(v->succ == NULL))
1282  return(true);
1283  else
1284  return(false);
1285  }
1286 }
1287 
1288 /*=========================================================================*/
1289 /* bool cst_vector_p(Pvecteur v, Pbase b)
1290  *
1291  * Tests if a vector is constant, i.e. does not depend on one of the
1292  * variables given in b.
1293  *
1294  * AC 94/07/01 */
1295 
1296 bool cst_vector_p(v, b)
1297 Pvecteur v;
1298 Pbase b;
1299 {
1300  bool not_found = true;
1301  Pvecteur av;
1302 
1303  if (!VECTEUR_NUL_P(v)) {
1304  for(av = b; (av != NULL) && not_found; av = av->succ) {
1305  Variable cv = av->var;
1306  not_found = value_zero_p(vect_coeff(cv, v));
1307  }
1308  }
1309  return(not_found);
1310 }
1311 
1312 
1313 /*======================================================================*/
1314 /* list remove_minmax(list le)
1315  *
1316  * Parameters:
1317  *
1318  * Result:
1319  *
1320  * AP 95/02/1
1321  */
1323 list le;
1324 {
1325  list res_l = NIL, lle;
1326 
1327  for(lle = le; !ENDP(lle); POP(lle)) {
1328  expression exp = EXPRESSION(CAR(lle));
1329  normalized nor;
1330 
1331  ifdebug(9) {
1332  pips_debug(9, "considering expression:\n");
1334  }
1335 
1336  nor = NORMALIZE_EXPRESSION(exp);
1337 
1340 
1341  if(syntax_tag(sy) == is_syntax_call) {
1342 
1343  call ca = syntax_call(sy);
1345  res_l = remove_minmax(call_arguments(ca));
1346  else
1347  pips_internal_error("A complex exp is not a call to MIN or MAX: %s",
1348  expressio`n_to_string(exp));
1349  }
1350  else
1351  pips_internal_error("A complex exp is not a call : %s",
1353  }
1354  else
1356  }
1357 
1358  return(res_l);
1359 }
1360 
1361 
1362 /*=======================================================================*/
1363 /* bool array_ref_exp_p(e)
1364  *
1365  * Tests if an expression is an array, that is we test the field
1366  * "reference" of the expression which should not be empty.
1367  *
1368  * AC 94/07/28 */
1369 
1371 expression e;
1372 {
1373  bool b = false;
1374 
1377  return(reference_indices(r) != NIL);
1378  }
1379  else
1380  pips_internal_error("expression syntax is not no reference !");
1381 
1382  /* Never reached. */
1383  return(b);
1384 }
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
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
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
type make_type(enum type_utype tag, void *val)
Definition: ri.c:2706
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
static int count
Definition: SDG.c:519
#define value_notzero_p(val)
#define value_zero_p(val)
int Value
#define value_division(ref, val)
#define value_product(v, w)
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
#define value_div(v1, v2)
Value ppcm(Value, Value)
ppcm.c
Definition: ppcm.c:42
static int num
Definition: bourdoncle.c:137
#define A(i, j)
comp_matrice.c
Definition: comp_matrice.c:63
#define CONTRAINTE_UNDEFINED_P(c)
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
string make_entity_fullname(const char *module_name, const char *local_name)
END_EOLE.
Definition: entity_names.c:230
void * malloc(YYSIZE_T)
void free(void *)
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
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#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
void fprint_entity_list(FILE *fp, list l)
void fprint_entity_list(FILE *fp,list l): prints a list of entities on file fp.
Definition: entity.c:3188
list base_to_list(Pbase base)
Most includes are centralized here.
#define B(A)
Definition: iabrev.h:61
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
#define MATRIX_NB_LINES(matrix)
Definition: matrix-local.h:87
#define MATRIX_NB_COLUMNS(matrix)
Definition: matrix-local.h:88
#define MATRIX_DENOMINATOR(matrix)
int MATRIX_DENONIMATOR(matrix): acces au denominateur global d'une matrice matrix
Definition: matrix-local.h:86
#define MATRIX_ELEM(matrix, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrix-local.h:80
void matrix_nulle(Pmatrix Z)
void matrix_nulle(Pmatrix Z): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrix.c:293
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_internal_error
Definition: misc-local.h:149
#define user_error(fn,...)
Definition: misc-local.h:265
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
Pbase list_to_base(list l)
Pbase list_to_base(list l): returns the Pbase that contains the variables of list "l",...
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
#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
char * string
STRING.
Definition: newgen_types.h:39
#define UU
Definition: newgen_types.h:98
#define IS_MIN
#define IS_MAX
#define BASE_NODE_NUMBER
void substitute_var_with_vec(Psysteme, entity, Value, Pvecteur)
===========================================================================
Definition: utils.c:1210
void fprint_psysteme(FILE *, Psysteme)
===========================================================================
Definition: print.c:302
#define plc_placements(x)
Definition: paf_ri.h:557
#define placement_undefined
Definition: paf_ri.h:499
#define SCHEDULE(x)
SCHEDULE.
Definition: paf_ri.h:682
#define PLACEMENT(x)
PLACEMENT.
Definition: paf_ri.h:493
#define bdt_schedules(x)
Definition: paf_ri.h:226
#define schedule_statement(x)
Definition: paf_ri.h:713
#define placement_statement(x)
Definition: paf_ri.h:523
void fprint_list_of_exp(FILE *fp, list exp_l)
void fprint_list_of_exp(FILE *fp, list exp_l): prints in the file "fp" the list of expression "exp_l"...
Definition: expression.c:229
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
string expression_to_string(expression e)
Definition: expression.c:77
bool vecteurs_libres_p(Psysteme sys, Pbase v_base, Pbase c_base)
========================================================================
Definition: utils.c:903
Psysteme append_eg(Psysteme M1, Psysteme M2)
========================================================================
Definition: utils.c:946
#define SA_MODULE_NAME
#define SAT
#define STAT_SYM
#define IS_NEW_ARRAY
#define SAI
#define IS_TEMP
void fprint_call(FILE *fp, call ca)
=======================================================================
bool array_ref_exp_p(expression e)
======================================================================
Psyslist reverse_psyslist(Psyslist l)
======================================================================
entity create_new_entity(int st, char *typ, int nb)
========================================================================
Psysteme my_clean_ps(Psysteme ps)
=======================================================================
dfg_arc_label arc_label
reference my_build_new_ref(int kind, int n, list subscripts, reference old_r)
========================================================================
Psysteme change_base_in_sc(Psysteme ps, list lvar, Psysteme lequ)
========================================================================
placement extract_plc(plc p, int cn)
========================================================================
list remove_minmax(list le)
=====================================================================
void my_matrices_to_constraints_with_sym_cst_2(Pcontrainte *pc, Pbase new_base, Pbase index_base, Pbase const_base, Pmatrix A, Pmatrix B)
=====================================================================
void my_lhs_subs_in_ins(instruction ins, string SA, int n, list subscripts)
========================================================================
Psyslist add_sclist_to_sclist(Psyslist l1, Psyslist l2)
=======================================================================
void fprint_loop(FILE *fp, loop lp)
=======================================================================
expression psystem_to_expression(Psysteme ps)
======================================================================
bool min_or_max_expression_p(expression exp)
===================================================================
dfg_vertex_label vertex_label
Name : reindexing_utils.c Package : reindexing Author : Alexis Platonoff & Antoine Cloue Date : May 1...
void matrix_coef_mult(Pmatrix A, Value nb)
========================================================================
Psysteme matrix_to_system(Pmatrix A, Pbase b)
==================================================================
void fprint_list_of_ins(FILE *fp, list li)
=======================================================================
void print_detailed_ins(instruction ins)
======================================================================
bool vars_in_vect_p(Pvecteur pv, list vars)
======================================================================
Psysteme sc_reverse_constraints(Psysteme ps)
========================================================================
list find_new_variables(list l1, list l2)
========================================================================
#define SUCC(cp)
expression merge_expressions(expression exp1, expression exp2, int max_or_min)
===================================================================
Psysteme sc_add_egalite_at_end(Psysteme ps, Pcontrainte co)
=======================================================================
bool is_vect_constant_p(Pvecteur v)
========================================================================
list extract_bdt(bdt b, int cn)
=======================================================================
void my_constraints_with_sym_cst_to_matrices(Pcontrainte pc, Pbase index_base, Pbase const_base, Pmatrix A, Pmatrix B)
=====================================================================
bool cst_vector_p(Pvecteur v, Pbase b)
========================================================================
list ADD_LIST_TO_LIST(list l1, list l2)
=======================================================================
void my_matrices_to_constraints_with_sym_cst(Pcontrainte *pc, Pbase new_base, Pbase index_base, Pbase const_base, Pmatrix A, Pmatrix B)
=====================================================================
Psysteme base_complete(Psysteme sys, list var_l, list par_l, list *new_l)
=======================================================================
#define ENTITY_ASSIGN_P(e)
#define EQUAL_OPERATOR_NAME
#define NORMALIZE_EXPRESSION(e)
#define make_entity(n, t, s, i)
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define AND_OPERATOR_NAME
FI: intrinsics are defined at a third place after bootstrap and effects! I guess the name should be d...
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
#define LESS_OR_EQUAL_OPERATOR_NAME
#define ENTITY_MIN_OR_MAX_P(e)
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
code entity_code(entity e)
Definition: entity.c:1098
list entities_to_expressions(list l_ent)
build a list of expressions from a list of entities
Definition: entity.c:2703
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
Definition: expression.c:1650
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
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
basic basic_of_reference(reference)
Retrieves the basic of a reference in a newly allocated basic object.
Definition: type.c:1459
#define loop_body(x)
Definition: ri.h:1644
@ is_basic_int
Definition: ri.h:571
#define normalized_undefined
Definition: ri.h:1745
#define syntax_reference_p(x)
Definition: ri.h:2728
#define loop_execution(x)
Definition: ri.h:1648
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define call_function(x)
Definition: ri.h:709
#define range_upper(x)
Definition: ri.h:2290
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define instruction_loop(x)
Definition: ri.h:1520
#define INSTRUCTION(x)
INSTRUCTION.
Definition: ri.h:1448
#define instruction_goto(x)
Definition: ri.h:1526
#define test_false(x)
Definition: ri.h:2837
@ is_value_unknown
Definition: ri.h:3035
#define code_declarations(x)
Definition: ri.h:784
@ is_syntax_call
Definition: ri.h:2693
#define range_increment(x)
Definition: ri.h:2292
#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
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define execution_sequential_p(x)
Definition: ri.h:1208
#define normalized_tag(x)
Definition: ri.h:1778
#define test_true(x)
Definition: ri.h:2835
#define reference_indices(x)
Definition: ri.h:2328
#define syntax_call(x)
Definition: ri.h:2736
#define loop_label(x)
Definition: ri.h:1646
#define loop_locals(x)
Definition: ri.h:1650
#define range_lower(x)
Definition: ri.h:2288
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define loop_range(x)
Definition: ri.h:1642
#define call_arguments(x)
Definition: ri.h:711
#define control_statement(x)
Definition: ri.h:941
#define instruction_test(x)
Definition: ri.h:1517
@ is_type_variable
Definition: ri.h:2900
#define expression_syntax(x)
Definition: ri.h:1247
#define instruction_unstructured(x)
Definition: ri.h:1532
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
#define loop_index(x)
Definition: ri.h:1640
@ is_normalized_complex
Definition: ri.h:1761
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
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_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
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
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
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
#define ifdebug(n)
Definition: sg.c:47
void sa_print_ins(FILE *fp, instruction i)
=========================================================================
list dims_of_nest(int n)
=========================================================================
entity create_entity(string name, variable v)
=========================================================================
static char * x
Definition: split_file.c:159
Definition: pip__tab.h:25
package matrice
Definition: matrix-local.h:63
Pvecteur vecteur
struct Scontrainte * succ
Warning! Do not modify this file that is automatically generated!
Definition: union-local.h:3
struct Ssyslist * succ
Definition: union-local.h:5
Pcontrainte egalites
Definition: sc-local.h:70
Pbase base
Definition: sc-local.h:75
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
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
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.
#define vecteur_var(v)
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define VECTEUR_NUL_P(v)
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_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
Definition: unaires.c:106
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