PIPS
cell.c
Go to the documentation of this file.
1 /*
2 
3  $Id: cell.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 /************************************************************************/
28 /* Name : cell.c
29  * Package : reindexing
30  * Author : Alexis Platonoff & Antoine Cloue
31  * Date : april 1995
32  * Historic :
33  *
34  * Documents: SOON
35  * Comments : This file contains the functions manipulating the cells.
36  */
37 
38 /* Ansi includes */
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 
43 /* Newgen includes */
44 #include "genC.h"
45 
46 /* C3 includes */
47 #include "boolean.h"
48 #include "arithmetique.h"
49 #include "vecteur.h"
50 #include "contrainte.h"
51 #include "ray_dte.h"
52 #include "sommet.h"
53 #include "sg.h"
54 #include "sc.h"
55 #include "polyedre.h"
56 #include "matrice.h"
57 #include "union.h"
58 #include "matrix.h"
59 #include "sparse_sc.h"
60 
61 /* Pips includes */
62 #include "boolean.h"
63 #include "ri.h"
64 #include "constants.h"
65 #include "ri-util.h"
66 #include "misc.h"
67 #include "complexity_ri.h"
68 #include "database.h"
69 #include "graph.h"
70 #include "dg.h"
71 #include "paf_ri.h"
72 #include "parser_private.h"
73 #include "property.h"
74 #include "reduction.h"
75 #include "text.h"
76 #include "text-util.h"
77 #include "tiling.h"
78 #include "text-util.h"
79 #include "pipsdbm.h"
80 #include "resources.h"
81 #include "static_controlize.h"
82 #include "paf-util.h"
83 #include "pip.h"
84 #include "array_dfg.h"
85 #include "prgm_mapping.h"
86 #include "conversion.h"
87 #include "scheduling.h"
88 #include "reindexing.h"
89 
90 /* Macro functions */
91 
92 #define STRING_BDT "t"
93 #define STRING_PLC "p"
94 #define STRING_TAU "q"
95 #define STRING_FLAG "flag"
96 
97 #define MAKE_STATEMENT(ins) \
98  (make_statement(entity_empty_label(), \
99  STATEMENT_NUMBER_UNDEFINED, \
100  STATEMENT_ORDERING_UNDEFINED, \
101  string_undefined, ins))
102 
103 /* Internal variables */
104 
105 /* Local defines */
108 
109 /* type cell that contains all information for the reindexation of */
110 /* an instruction. Filled during function prepare_reindexing(). */
111 typedef struct scell {
112  int statement; /* number of the node */
113  predicate domain; /* complete domain of the bdt */
114  predicate edge_dom; /* predicate of the schedule */
115 
116  Pbase var_base; /* (to) = Rmat(i) + Smat(n) */
120 
121  Pmatrix Tmat; /* (t) = Tmat(i) + Bmat(n) */
122  Pmatrix Tmat_inv; /* (i) = Tmat_inv(t) + Bmat_inv(n) */
125 
126  Pmatrix Rmat; /* (to) = Rmat (i) + Smat */
127  Pmatrix Rmat_inv; /* (i) = Rmat_inv(to) + Smat_inv(n) */
130 
131  list lomega; /* list of the period(s) of bdt */
132  list lp; /* list of variable p created */
133  list lt; /* list of variable t created */
134  list ltau; /* list of variable tau created */
135 
136  Psysteme Nbounds; /* new systeme of bounds in (t,p,..) */
137  Pbase Nindices; /* list of the new indices */
138  Psyslist t_bounds; /* bounds of global time for the ins */
139  Psyslist p_topology; /* topology of the plc in function of t */
140 
141  struct scell *succ;
143 
144 /* type of a test, the same as the "normal" test except that the */
145 /* condition field is not an expression but a Psysteme. */
146 typedef struct mytest {
149  instruction false;
150 
151  struct mytest *succ;
153 
154 /* type of new instruction which contains information about the loop */
155 /* bounds we will construct around it - used in build_first_comb(). */
156 typedef struct newinst {
158 
159  /* information about the local time */
163 
164  struct newinst *succ;
166 
167 /* We define a set of constant in order to a more generic function for the
168  * insert of the declarations of the new created variables.
169  */
170 #define INTEGER_DEC 0
171 #define REAL_DEC 1
172 #define COMPLEX_DEC 2
173 #define LOGICAL_DEC 3
174 #define DOUBLE_DEC 4
175 #define CHARACTER_DEC 5
176 
177 #define INTEGER_DECL " INTEGER"
178 #define REAL_DECL " REAL"
179 #define COMPLEX_DECL " COMPLEX"
180 #define LOGICAL_DECL " LOGICAL"
181 #define DOUBLE_DECL " DOUBLE"
182 #define CHARACTER_DECL " CHARACTER"
183 #define COLON ":"
184 #define NEWLINE "\n *"
185 #define ENDLINE "\n"
186 #define LINE_LENGHT 68
187 #define MARGIN_LENGHT 7
188 
189 #define IS_MIN 0
190 #define IS_MAX 1
191 
192 
193 /*======================================================================*/
194 /*
195  *
196  * AC 94/08/05
197  */
198 
200 Pscell pc;
201 entity e;
202 {
203  list l;
204 
206  if(l == NIL) {
207  l = CONS(ENTITY, e, l);
208  }
209  else {
210  l = CDR(l);
211  l = CONS(ENTITY, e, l);
212  }
213 
214  return(list_to_base(l));
215 }
216 
217 
218 /*========================================================================*/
219 /* Pmytest create_mytest(ps, ins1, ins2): create a Pmytest.
220  *
221  * AC 94/06/08
222  */
223 
224 static Pmytest create_mytest(ps, ins1, ins2)
225 
226  Psysteme ps;
227  instruction ins1, ins2;
228 {
229  Pmytest te = (Pmytest)malloc(sizeof(mytest));
230 
231  te->test = ps;
232  te->true = ins1;
233  te->false = ins2;
234  te->succ = NULL;
235 
236  return(te);
237 }
238 
239 
240 /*======================================================================*/
241 /* Pmytest add_elt_to_test_list(te, lte): add a Pmytest element at the
242  * end of a Pmytest list lte.
243  *
244  * AC 94/06/08
245  */
246 
248 
249  Pmytest te, lte;
250 {
251  Pmytest aux, aux2;
252 
253  if (lte == NULL) return(te);
254  else
255  {
256  aux = lte;
257  while (aux != NULL)
258  {
259  aux2 = aux;
260  aux = aux->succ;
261  }
262  aux2->succ = te;
263 
264  return(lte);
265  }
266 }
267 
268 /*========================================================================*/
269 /* void fprint_mytest(fp, t): print a list of Pmytest.
270  *
271  * AC 94/06/08
272  */
273 
274 static void fprint_mytest(fp, t)
275 
276  FILE *fp;
277  Pmytest t;
278 {
279  Pmytest l;
280  int i = 1;
281 
282  for (l = t; l!= NULL; l = l->succ)
283  {
284  fprintf(fp,"\nTest n. %d:", i);
285  fprint_psysteme(fp, l->test);
286  sa_print_ins(fp, l->true);
287  i++;
288  }
289 }
290 
291 /*========================================================================*/
292 /* Pmytest add_ltest_to_ltest(l1, l2): add the Pmytest list l2 at the end
293  * of the Pmytest list l1.
294  *
295  * AC 94/06/08
296  */
297 
299 
300  Pmytest l1, l2;
301 {
302  Pmytest l3, l4;
303 
304  if (l1 == NULL) return(l2);
305  if (l2 == NULL) return(l1);
306 
307  l3 = l1;
308 
309  while (l3 != NULL)
310  {
311  l4 = l3;
312  l3 = l3->succ;
313  }
314  l4->succ = l2;
315 
316  return(l1);
317 }
318 
319 
320 /*=========================================================================*/
321 /* void calculate_delay(exp, pcs, pcd)
322  *
323  * Calculates the delay if possible for the instruction of Pscell pcs that
324  * is the instruction source.
325  *
326  * AC 94/06/29 */
327 
328 static void calculate_delay(exp, pcs, pcd, tau)
330 Pscell pcd, pcs;
331 entity tau;
332 {
333  Psysteme ps;
334  Pcontrainte con;
335  int os = 0, od = 0,di;
336  Value del, d, lbs = VALUE_ZERO, lbd = VALUE_ZERO;
337  Pvecteur vect, vect2;
338  bool with_t;
339 
340  if (get_debug_level() > 5)
341  fprintf(stderr,"\nDebut calculate delai pour %d", pcs->statement);
342 
343  with_t = (tau != entity_undefined);
344 
345  di = (int)hash_get(delay_table, (char *)pcs->statement);
346  d = int_to_value(di);
347 
348  if (di != INFINITY) {
349  if (get_debug_level() > 5) {
350  fprintf(stderr,"\nd != infinity pour noeud %d", pcs->statement);
351  }
352 
353  if (pcs->lomega == NIL) /* A cst Schedule for the source */
354  del = INFINITY;
355  else {
356  os = INT(CAR(pcs->lomega));
357  if (pcd->lomega == NIL) /* A cst schedule for the destination */
358  del = INFINITY;
359  else {
360  od = INT(CAR(pcd->lomega));
361 
362  if (get_debug_level() > 5) {
363  fprintf(stderr,"\n os = %d", os);
364  fprintf(stderr,"\n od = %d", od);
365  fprintf(stderr,"\nExpression :");
367  }
368 
369  if (os != od) /* Diff period for source and dest */
370  del = INFINITY;
371  else {
372  /* first see if the expression has the */
373  /* proper form that is : tau - d */
374  Variable Tau;
375 
376  if(with_t)
377  Tau = (Variable) tau;
378  else
379  Tau = TCST;
380 
382  if (get_debug_level() > 5) {
383  fprintf(stderr,"\nVecteur :");
384  pu_vect_fprint(stderr, vect);
385  fprintf(stderr,"\nEntite Tau : %s", pu_variable_name(Tau));
386  fprint_string_Value(stderr, "\nCoeff = ", vect_coeff(Tau, vect));
387  fprintf(stderr, "\n");
388  }
389 
390  if (value_notone_p(vect_coeff(Tau, vect)) && with_t)
391  del = INFINITY;
392  else {
393  /* vect2 is equal to +d in the formula */
394  if(with_t)
395  vect2 = vect_substract(vect_new(Tau, 1), vect);
396  else {
397  vect2 = vect_dup(vect);
398  vect_chg_sgn(vect2);
399  }
400 
401  if (get_debug_level() > 5) {
402  fprintf(stderr,"\nVecteur 2 :");
403  pu_vect_fprint(stderr, vect2);
404  fprintf(stderr,"\nIndices of Dest :");
405  pu_vect_fprint(stderr, pcd->Nindices);
406  }
407 
408  if (!cst_vector_p(vect2, pcd->Nindices))
409  del = INFINITY;
410  else {
411  /* the delay is calculated by the formula: */
412  /* delay = abs((lbd-lbs)/omega + d ) */
413 
414  Pvecteur pd;
415  Value vp;
416 
417  ps = (pcs->t_bounds)->psys;
418  con = ps->egalites;
419  if (!CONTRAINTE_UNDEFINED_P(con))
420  lbs = value_uminus(vect_coeff(TCST, con->vecteur));
421  pd = vect_dup(con->vecteur);
422  vect_chg_sgn(pd);
423 
424  if (get_debug_level() > 5) {
425  fprintf(stderr, "\nLBS :");
426  pu_vect_fprint(stderr, con->vecteur);
427  fprint_string_Value(stderr,"\nlbs = ", lbs);
428  }
429 
430  ps = (pcd->t_bounds)->psys;
431  con = ps->egalites;
432  if (!CONTRAINTE_UNDEFINED_P(con))
433  lbd = value_uminus(vect_coeff(TCST, con->vecteur));
434  pd = vect_cl_ofl_ctrl(pd, (Value) 1,
435  vect_dup(con->vecteur), NO_OFL_CTRL);
436 
437  if (get_debug_level() > 5) {
438  fprintf(stderr, "\nLBD :");
439  pu_vect_fprint(stderr, con->vecteur);
440  fprint_string_Value(stderr,"\nlbd = ", lbd);
441  fprintf(stderr, "\nValue of PD :");
442  pu_vect_fprint(stderr, pd);
443  }
444 
445  if(is_vect_constant_p(pd))
446  vp = VALUE_ZERO;
447  else
448  vp = value_mod(vect_pgcd_all(pd),int_to_value(os));
449  if(value_zero_p(vp)) {
450  pd = vect_div(pd, int_to_value(os));
451  pd = vect_cl_ofl_ctrl(pd, VALUE_ONE,
452  vect2 , NO_OFL_CTRL);
453 
454  if (get_debug_level() > 5) {
455  fprintf(stderr, "\nValue of the delay :");
456  pu_vect_fprint(stderr, pd);
457  }
458 
459  if(is_vect_constant_p(pd)) {
460  del = value_abs(vect_coeff(TCST, pd));
461  }
462  else
463  del = INFINITY;
464  }
465  else
466  del = INFINITY;
467  }
468  }
469  }
470  }
471  }
472  if(value_gt(del,d)) {
473  (void) hash_del(delay_table, (char *)pcs->statement);
474  hash_put(delay_table, (char *)pcs->statement,
475  (char *)VALUE_TO_INT(del));
476 
477  if (get_debug_level() > 5)
478  fprint_string_Value(stderr,"\nDelai = ", del);
479  }
480  }
481  if (get_debug_level() > 5)
482  fprintf(stderr,"\nFin calculate delai");
483 }
484 
485 
486 /*====================================================================*/
487 /* static void prepare_array_bounds(Pscell pc):
488  *
489  * Compute for the instruction corresponding to the scell "pc" the size
490  * of all the dimensions of the array defined by this instruction.
491  *
492  * These sizes are memorized in the hash table "ht_ab".
493  *
494  * Parameters :
495  * pc: scell of the current instruction
496  *
497  * Note: On the time dimensions, these sizes are not the true ones
498  * because they correspond to the local time bounds, not the minor
499  * time bounds. The computation of the minor bounds is done afterwards
500  * (see make_array_bounds())
501  *
502  * AP 22/08/94 */
503 static void prepare_array_bounds(pc)
504 Pscell pc;
505 {
506  extern hash_table ht_ab;
507 
508  Pscell pc_aux;
509  int sn;
510  list llp, llt;
511  expression lower, upper;
512  Psyslist sl_tbou, sl_ptopo, llp1, llp2, llp3;
513  list lcr_range = NIL, ab_val, lcr_ab;
514  range cr;
515 
516  /* statement number ("ht_ab" key) */
517  sn = pc->statement;
518 
519  /* We get the current value of the bounds: should not exit yet */
520  if((ab_val = (list) hash_get(ht_ab, (char *) sn))
522  lcr_range = NIL;
523  else
524  user_error("prepare_array_bounds", "\n Bounds already exits\n");
525 
526  for(pc_aux = pc; pc_aux != NULL; pc_aux = pc_aux->succ) {
527  lcr_ab = lcr_range;
528 
529  if(pc_aux->statement != sn)
530  user_error("prepare_array_bounds", "\n Not the same stmt\n");
531 
532  /* the P topology is a list of system giving the bounds of the */
533  /* space loop counters ; the order is from the inner loop to the */
534  /* outer loop. We reverse the order. */
535  llp1 = pc_aux->p_topology;
536  llp2 = NULL;
537  while (llp1 != NULL){
538  llp3 = sl_new();
539  llp3->psys = llp1->psys;
540  llp3->succ = llp2;
541  llp2 = llp3;
542  llp1 = llp1->succ;
543  }
544  sl_ptopo = llp2;
545 
546  /* Idem for the T bounds */
547  llp1 = pc_aux->t_bounds;
548  llp2 = NULL;
549  while (llp1 != NULL){
550  llp3 = sl_new();
551  llp3->psys = llp1->psys;
552  llp3->succ = llp2;
553  llp2 = llp3;
554  llp1 = llp1->succ;
555  }
556  sl_tbou = llp2;
557 
558  /* Two cases depending on whether there is a non null scheduling or
559  * not. */
560  if(sl_tbou->psys->nb_ineq == 0) {
561  for(llp = pc_aux->lp; !ENDP(llp); POP(llp)) {
562  entity cind = ENTITY(CAR(llp));
563  Psysteme ps = sl_ptopo->psys;
564 
565  cr = make_bounds(ps, cind, IS_ARRAY_BOUNDS,
566  gen_copy_seq(pc_aux->lp), lcr_range);
567  lower = range_lower(cr);
568  upper = range_upper(cr);
569 
570  ifdebug(7) {
571  fprintf(stderr,
572  "\nNew lb and ub expressions (only Space) :\n\tLB: %s\n\tUB: %s\n",
573  expression_to_string(lower),
574  expression_to_string(upper));
575  }
576 
577  if(lcr_ab == NIL) {
578  cr = make_range(lower, upper,
579  int_to_expression(1));
580  lcr_ab = CONS(RANGE, cr, NIL);
581  lcr_range = gen_nconc(lcr_range, lcr_ab);
582  }
583  else {
584  cr = RANGE(CAR(lcr_ab));
586  lower, IS_MIN);
588  upper, IS_MAX);
589  }
590  lcr_ab = CDR(lcr_ab);
591 
592  sl_ptopo = sl_ptopo->succ;
593  }
594  }
595  else {
596  /* First the time bounds */
597  for(llt = pc_aux->lt; !ENDP(llt); POP(llt)) {
598  entity cind = ENTITY(CAR(llt));
599  Psysteme ps = sl_tbou->psys;
600 
601  cr = make_bounds(ps, cind, IS_ARRAY_BOUNDS,
602  gen_copy_seq(pc_aux->lt), lcr_range);
603  lower = range_lower(cr);
604  upper = range_upper(cr);
605 
606  ifdebug(7) {
607  fprintf(stderr,
608  "\nNew lb and ub expressions (time) :\n\tLB: %s\n\tUB: %s\n",
609  expression_to_string(lower),
610  expression_to_string(upper));
611  }
612 
613  if(lcr_ab == NIL) {
614  cr = make_range(lower, upper,
615  int_to_expression(1));
616  lcr_ab = CONS(RANGE, cr, NIL);
617  lcr_range = gen_nconc(lcr_range, lcr_ab);
618  }
619  else {
620  cr = RANGE(CAR(lcr_ab));
622  lower, IS_MIN);
624  upper, IS_MAX);
625  }
626  lcr_ab = CDR(lcr_ab);
627 
628  sl_tbou = sl_tbou->succ;
629  }
630  /* Then the space bounds */
631  for(llp = pc_aux->lp; !ENDP(llp); POP(llp)) {
632  entity cind = ENTITY(CAR(llp));
633  Psysteme ps = sl_ptopo->psys;
634 
635  cr = make_bounds(ps, cind,
637  gen_nconc(gen_copy_seq(pc_aux->lt),
638  gen_copy_seq(pc_aux->lp)) , lcr_range);
639  lower = range_lower(cr);
640  upper = range_upper(cr);
641 
642  if (get_debug_level() > 6) {
643  fprintf(stderr,
644  "\nNew lb and ub expressions (space) :\n\tLB: %s\n\tUB: %s\n",
645  expression_to_string(lower),
646  expression_to_string(upper));
647  }
648 
649  if(lcr_ab == NIL) {
650  cr = make_range(lower, upper,
651  int_to_expression(1));
652  lcr_ab = CONS(RANGE, cr, NIL);
653  lcr_range = gen_nconc(lcr_range, lcr_ab);
654  }
655  else {
656  cr = RANGE(CAR(lcr_ab));
658  lower, IS_MIN);
660  upper, IS_MAX);
661  }
662  lcr_ab = CDR(lcr_ab);
663 
664  sl_ptopo = sl_ptopo->succ;
665  }
666  }
667  }
668 
669  hash_put(ht_ab, (char *) sn, (char *) lcr_range);
670 
671  if (get_debug_level() > 6) {
672  fprintf(stderr, "\n====================\n====================\n");
673  }
674 }
675 
676 #define DOUBLE_PRECISION_SIZE 8
677 
678 /*====================================================================*/
679 /* void make_array_bounds(vertex cv):
680  *
681  * Do the declaration of the array defined by the instruction
682  * corresponding to "cv". The bounds of this array are given by a hash
683  * table ("ht_ab"), see prepare_array_bounds().
684  *
685  * The bounds of the first time dimension must be computed using the
686  * delay. If there is no delay (d < 0 or d = infinity), then these bounds
687  * are expressed from the minor time point of view, so the values given by
688  * the hash table must be translate from the local time to the minor time.
689  *
690  * With the following notation: local lower bound = llb, local upper bound
691  * = lub, local period = lp, minor lower bound = mlb, minor upper bound =
692  * mub, minor period = mp
693  *
694  * We have: mlb = 0
695  * mub = (lub - llb)/lp
696  * mp = 1
697  *
698  * AP 22/08/94 */
700  vertex cv;
701 {
703 
704  range cr;
705  int d, cn;
706  entity mod_entity, var_ent;
707  string name;
708  list lcr, lt, la, lom;
709  basic ba;
710  int type_decl;
711  string num;
712  Pscell pc;
713  bool is_first;
714 
716  if (cn == ENTRY_ORDER)
717  return;
718  if (cn == EXIT_ORDER)
719  return;
720 
721  pc = (Pscell)hash_get(h_node, (char *)cn);
722  lcr = (list) hash_get(ht_ab, (char *) cn);
723  d = (int)hash_get(delay_table, (char *) cn);
724 
725  mod_entity = get_current_module_entity();
726 
727  /* Find the array entity */
728  num = (string) malloc(32);
729  (void) sprintf(num, "%d", cn-BASE_NODE_NUMBER);
731  SAI, num, (char *) NULL));
732  var_ent = gen_find_tabulated(name, entity_domain);
733  if(var_ent == entity_undefined)
734  user_error("make_array_bounds",
735  "\nOne ins (%d) has no array entity : %s\n",
736  cn-BASE_NODE_NUMBER, name);
737 
738  /* Find the type of this array */
739  ba = variable_basic(type_variable(entity_type(var_ent)));
740  switch(basic_tag(ba))
741  {
742  case is_basic_int: { type_decl = INTEGER_DEC; break; }
743  case is_basic_complex: { type_decl = COMPLEX_DEC; break; }
744  case is_basic_logical: { type_decl = LOGICAL_DEC; break; }
745  case is_basic_string: { type_decl = CHARACTER_DEC; break; }
746  case is_basic_float: {
748  type_decl = REAL_DEC;
749  else
750  type_decl = DOUBLE_DEC;
751  break;
752  }
753  default: user_error("make_array_bounds", "\nBad array type\n");
754  }
755 
756  /* No bounds => scalar variable. */
757  if(lcr != NIL) {
758  /* Modifies the bounds of the time dimensions (see above). */
759  is_first = true;
760  for(lt = pc->ltau, la = lcr, lom = pc->lomega; !ENDP(lt);
761  POP(lt), POP(la), POP(lom)) {
762  cr = RANGE(CAR(la));
763 
764  if(is_first && (d >= 0) && (d != INFINITY)) {
766 
767  is_first = false;
768  }
769  else {
770  normalized nor_ub, nor_lb;
771  Pvecteur pv_aux;
772  Value cr_om;
773 
774  cr_om = int_to_value(INT(CAR(lom)));
775  nor_ub = NORMALIZE_EXPRESSION(range_upper(cr));
776  nor_lb = NORMALIZE_EXPRESSION(range_lower(cr));
777 
778  if((normalized_tag(nor_ub) != is_normalized_linear) ||
779  (normalized_tag(nor_ub) != is_normalized_linear) )
780  user_error("make_array_bounds",
781  "\nArray bounds should be linear\n");
782 
783  pv_aux = vect_substract((Pvecteur) normalized_linear(nor_ub),
784  (Pvecteur) normalized_linear(nor_lb));
785 
786  if (value_zero_p(value_mod(vect_pgcd_all(pv_aux), value_abs(cr_om))))
787  range_upper(cr) = make_vecteur_expression(vect_div(pv_aux, cr_om));
788  else
789  range_upper(cr) = make_rational_exp(pv_aux, cr_om);
790  }
792  }
793  }
794 
795  set_array_declaration(var_ent, lcr);
796 }
797 
798 
799 /*========================================================================*/
800 /* static Psysteme include_trans_on_LC_in_sc(ps, pc): transform the system
801  * ps with the new variable we can find in the scell pc.
802  *
803  * AC 94/05/10
804  */
805 
807 
808  Psysteme ps;
809  Pscell pc;
810 {
811  Pcontrainte cont;
812  Psysteme int_ps;
813 
815  pc->Tbase_out, pc->con_base,\
816  pc->Tmat_inv, pc->Bmat_inv);
817  int_ps = sc_make(cont, NULL);
818 
819  return(change_base_in_sc(ps, base_to_list(pc->var_base), int_ps));
820 }
821 
822 /*========================================================================*/
823 /* reference include_trans_on_LC_in_ref(re, pc): include in the reference
824  * "re" the new variables introduced by pc.
825  *
826  * AC 94/05/10
827  */
828 
830 
831  reference re;
832  Pscell pc;
833 {
834  Pcontrainte cont;
835  Psysteme int_ps;
836  list l, li = NIL, la, lnew = NIL;
837  expression exp;
838  Pvecteur v, vc;
839  int d = 1;
840  Value co, va, ppc;
841  entity e;
842 
843  li = base_to_list(pc->var_base);
844  if (li != NIL)
845  {
846  if (get_debug_level() > 5)
847  {
848  fprintf(stderr, "\nReference en entree: \n");
849  fprintf(stderr, "\n\tVariable : ");
851  fprintf(stderr, "\n\tIndices : ");
853  }
854 
856  pc->Nindices, pc->con_base,\
857  pc->Rmat_inv, pc->Smat_inv);
858  int_ps = sc_make(cont, NULL);
859  sc_normalize(int_ps);
860 
861  if (get_debug_level() > 5)
862  {
863  fprintf(stderr,"\nSysteme qui remplace :");
864  fprint_psysteme(stderr,int_ps);
865  }
866 
867  for (l = reference_indices(re); l != NIL; l = CDR(l)) {
868  exp = EXPRESSION(CAR(l));
869  analyze_expression(&exp, &d);
870  if (d != 1) pips_internal_error("d != 1");
873  la = li;
874  for (cont = int_ps->egalites; cont != NULL; cont = cont->succ)
875  {
876  e = ENTITY(CAR(la));
877  co = vect_coeff((Variable) e, cont->vecteur);
879  {
880  Value x;
881  vc = vect_dup(cont->vecteur);
882  va = vect_coeff((Variable)e, v);
883  ppc = ppcm(co, va);
884  x = value_div(ppc,co);
885  vc = vect_multiply(vc, value_abs(x));
886  x = value_div(ppc,va);
887  v = vect_multiply(v, value_abs(x));
888  vect_erase_var(&v, (Variable)e);
889  vect_erase_var(&vc, (Variable)e);
890  if (value_posz_p(value_mult(co,va))) v = vect_substract(v, vc);
891  else v = vect_add(v, vc);
892  vect_normalize(v);
893  }
894  la = CDR(la);
895  }
898  }
899 
900  reference_indices(re) = lnew;
901  }
902 
903  if (get_debug_level() > 5)
904  {
905  fprintf(stderr, "\nReference en sortie: \n");
906  fprintf(stderr, "\n\tVariable : ");
908  fprintf(stderr, "\n\tIndices : ");
910  }
911 
912  return(re);
913 }
914 
915 
916 /*========================================================================*/
917 /* static Psysteme include_trans_on_LC_in_sc2(ps, pc): transform the system
918  * ps with the new variable we can find in the scell pc.
919  *
920  * AC 94/05/10
921  */
922 
924 
925  Psysteme ps;
926  Pscell pc;
927  Pbase b;
928 {
929  Pcontrainte cont;
930  Psysteme int_ps;
931 
933  pc->Tmat_inv, pc->Bmat_inv);
934  int_ps = sc_make(cont, NULL);
935 
936  return(change_base_in_sc(ps, base_to_list(pc->var_base), int_ps));
937 }
938 
939 
940 /*========================================================================*/
941 /* void prepare_reindexing(v, b, p)
942  *
943  * It associates to the vertex v a structure scell. First it changes the
944  * base of the instruction from base (i,j,...) of loop counters to base
945  * (t, p,...) given by the time function and the placement function. All
946  * the results are put in matrix. Then we introduce a matrix called Q that
947  * mappes time x space coordinates to minor time x space coordinates using
948  * the time periodicty. Returns the list of global time variables created
949  *
950  * AC 94/03/21 */
951 
953 vertex v;
954 bdt b;
955 plc p;
956 {
957  Pscell pc = NULL, pc_aux = NULL;
958  placement pv;
959  Psysteme ps_b, ps_p, ps_aux, old_ps, new_ps, int_ps, sys_p, pps, pcond,
960  time_ps = SC_UNDEFINED;
962  static_control stco;
963  list lexp, bv, lnewp, lnewb, lpar, ciel, lnew, lnewp2, lnewp3, ltau =
964  NIL, lnewq, lnewt, lom, lt = NIL;
965  int pcount, bcount = 0, diff, d, qcount = 0, count_loop, i, time_count;
966  Value den = VALUE_ONE, detP, detU;
967  expression exp;
968  Pvecteur vec, Tindx, Tcnst, Qindx, Qcnst, new_indx;
969  entity ent;
970  Pmatrix mT, mB, mT_inv, mQ, mC, mQ_inv, mT_invB, mH, mP, mR, mQ_invC,
971  mS, mR_inv, mS_inv, mI, mIc, mU, mId;
972  Pcontrainte cont;
973 
974  bool with_t = true;
975  Psyslist lsys, lsys_aux, ltime, lsys_time, ltopo;
976 
977  lnewp = NIL;
978  lnewq = NIL;
979 
980  if (cn != ENTRY_ORDER) {
982 
983  if (get_debug_level()>5)
984  fprintf(stderr, "\n***debut index pour %d***\n", cn);
985 
986  /* List of englobing loop counters */
987  ciel = static_control_to_indices(stco);
988 
989  /* List of structure parameters. */
990  lpar = lparams;
991 
992  Tindx = list_to_base(ciel);
993  Tcnst = list_to_base(lpar);
994 
995  /* Two cases : loops around, or not */
996  if (ciel != NIL) {
997  if (get_debug_level()>1) {
998  fprintf(stderr,"\nCIEL: ");
999  fprint_entity_list(stderr,ciel);
1000  fprintf(stderr,"\nLPAR: ");
1001  fprint_entity_list(stderr,lpar);
1002  }
1003 
1004  /* first we extract the bdt corresponding to this node in the global */
1005  /* bdt b. idem for the plc. */
1006  bv = extract_bdt(b, cn);
1007  pv = extract_plc(p, cn);
1008 
1009  /* we write the equations p = f(i,j,...) and put them in system
1010  ps_p. Note : we only keep those with loop indices. */
1011  ps_p = sc_new();
1012  pcount = 0;
1013  for (lexp = placement_dims(pv); !ENDP(lexp); POP(lexp)) {
1014  normalized nor;
1015 
1016  exp = EXPRESSION(CAR(lexp));
1017  nor = NORMALIZE_EXPRESSION(exp);
1018 
1020  user_error("prepare_reindexing", "PLC not linear\n");
1021 
1022  vec = normalized_linear(nor);
1023 
1024  if(vars_in_vect_p(vec,ciel)) {
1025  ps_p = sc_add_egalite_at_end(ps_p, contrainte_make(vec));
1026  ent = create_new_entity(cn-BASE_NODE_NUMBER, STRING_PLC, pcount);
1027  ADD_ELEMENT_TO_LIST(lnewp, ENTITY, ent);
1028  pcount++;
1029  }
1030  }
1031 
1032  /* we write the equations t = f(i,j,...) and put them in system
1033  ps_b we have a double loop on the schedule because of possible
1034  predicate and posible multi-dimensionnal expression. We attach
1035  a scell to each domain of the schedule. */
1036  for (; !ENDP(bv); POP(bv)) {
1037  schedule sched = SCHEDULE(CAR(bv));
1038  predicate pred = schedule_predicate(sched);
1039  lnewb = NIL;
1040  lnewq = NIL;
1041  lnew = NIL;
1042  ps_b = sc_new();
1043  den = 1;
1044  ltime = NULL;
1045 
1047  old_ps = sc_append(old_ps, predicate_to_system(pred));
1048 
1049  if (get_debug_level() > 1)
1050  fprintf(stderr,"\n**Computing Cell**\n\n");
1051  time_count = gen_length(schedule_dims(sched));
1052 
1053  if(time_count > 1)
1054  user_error("prepare_reindexing",
1055  "Multi dimensional case not treated yet\n");
1056 
1057  ent = create_new_entity(cn-BASE_NODE_NUMBER, STRING_BDT, bcount);
1058  ADD_ELEMENT_TO_LIST(lnewb, ENTITY, ent);
1059  exp = EXPRESSION(CAR(schedule_dims(sched)));
1060  analyze_expression(&exp, &d);
1061  bcount++;
1062 
1063  /* we take care of a possible denominator. the denominator */
1064  /* of system ps_b has the value "den" */
1065  if (d == 1) {
1066  normalized nor;
1067 
1068  nor = NORMALIZE_EXPRESSION(exp);
1070  user_error("prepare_reindexing", "Bdt is not linear\n");
1071 
1072  vec = vect_multiply(normalized_linear(nor), den);
1073  if (vars_in_vect_p(vec, ciel)) {
1074  sc_add_egalite(ps_b, contrainte_make(vec));
1075  }
1076  else {
1077  ps_b = SC_UNDEFINED;
1078  with_t = false;
1079  time_ps = sc_make(contrainte_make(vec), NULL);
1080  }
1081  }
1082  else
1083  user_error("prepare reindexing",
1084  "Rational case not treated yet !\n");
1085 
1086  if (get_debug_level() > 5) {
1087  fprintf(stderr, "\nNouvelles variables b:\n");
1088  fprint_entity_list(stderr, lnewb);
1089  fprintf(stderr, "\nNouvelles variables p:\n");
1090  fprint_entity_list(stderr, lnewp);
1091  fprintf(stderr,"\nContraintes sur B:\n");
1092  fprint_psysteme(stderr, ps_b);
1093  fprintf(stderr,"\nContraintes sur P:\n");
1094  fprint_psysteme(stderr, ps_p);
1095  }
1096 
1097  /* count the number of equalities (diff) we need to add to
1098  * build an inversible system */
1099  if (SC_UNDEFINED_P(ps_b)) {
1100  diff = -1 * gen_length(ciel);
1101  lnew = NIL;
1102  }
1103  else {
1104  diff = gen_length(lnewb) - gen_length(ciel);
1105  lnew = gen_copy_seq(lnewb);
1106  }
1107 
1108  if (get_debug_level() > 5)
1109  fprintf(stderr,"\nDiff = %d\n",diff);
1110 
1111  lnewp2 = gen_copy_seq(lnewp);
1112  lnewp3 = NIL;
1113  ps_aux = sc_dup(ps_p);
1114  ps_aux = sc_reverse_constraints(ps_aux);
1115 
1116  /* Now we build the system on the system coming from the local */
1117  /* time by adding equalities coming from the placement system */
1118  /* who are independant with the first ones. */
1119  if (diff < 0) {
1120  Pcontrainte ct = ps_aux->egalites;
1121 
1122  /* we first append to ps_b the vectors coming from ps_p who */
1123  /* are not linked with those of ps_b. */
1124  while ((diff != 0) && !CONTRAINTE_UNDEFINED_P(ps_aux->egalites)) {
1125  ps_aux->egalites = ct->succ;
1126  ct->succ = NULL;
1127 
1128  if (value_notone_p(den))
1129  ct->vecteur = vect_multiply(ct->vecteur, den);
1130 
1131  if (!SC_UNDEFINED_P(ps_b))
1132  {sc_add_egalite(ps_b, ct);}
1133  else
1134  ps_b = sc_make(ct, NULL);
1135 
1136  if (vecteurs_libres_p(ps_b, Tindx, Tcnst)) {
1137  /* the new vector is acceptable, i.e. free */
1138  diff++;
1139  /* update the list of new considered entities */
1140  ent = ENTITY(CAR(lnewp2));
1141  ADD_ELEMENT_TO_LIST(lnew, ENTITY, ent);
1142  ADD_ELEMENT_TO_LIST(lnewp3, ENTITY, ent);
1143  }
1144  else {
1145  /* the vector is unacceptable, continue to search */
1146  ps_b->egalites = (ps_b->egalites)->succ;
1147  ps_b->nb_eq--;
1148  }
1149  lnewp2 = CDR(lnewp2);
1150 
1151  ct = ps_aux->egalites;
1152  if (get_debug_level() > 5)
1153  fprint_psysteme(stderr,ps_b);
1154  }
1155 
1156  /* we have to complete the system with others free vectors */
1157  if (diff != 0) {
1158  list llnew = NIL;
1159 
1160  if (get_debug_level() > 5) {
1161  fprintf(stderr,"\nBase incomplete !!!\n");
1162  fprintf(stderr,"\nCiel :");
1163  fprint_entity_list(stderr, ciel);
1164  fprintf(stderr,"\nLpar :");
1165  fprint_entity_list(stderr, lpar);
1166  fprintf(stderr,"\nLnew :");
1167  fprint_entity_list(stderr, lnew);
1168  }
1169 
1170  if(SC_UNDEFINED_P(ps_b))
1171  ps_b = sc_new();
1172 
1173  ps_b = base_complete(ps_b, ciel, lpar, &llnew);
1174  ps_b = sc_reverse_constraints(ps_b);
1175  if (get_debug_level() > 5)
1176  fprint_psysteme(stderr,ps_b);
1177 
1178  for(; !ENDP(llnew); POP(llnew)) {
1179  ent = create_new_entity(cn-BASE_NODE_NUMBER, STRING_PLC, pcount);
1180  ADD_ELEMENT_TO_LIST(lnew, ENTITY, ent);
1181  ADD_ELEMENT_TO_LIST(lnewp3, ENTITY, ent);
1182  ADD_ELEMENT_TO_LIST(lnewp, ENTITY, ent);
1183  vec = vect_new((Variable) ent, 1);
1184  ps_p = sc_add_egalite_at_end(ps_p, contrainte_make(vec));
1185  pcount++;
1186  }
1187  }
1188  }
1189 
1190  ps_b = sc_reverse_constraints(ps_b);
1191 
1192  if(ps_b->nb_eq != gen_length(ciel))
1193  pips_internal_error("We are building a non-squared matrix");
1194 
1195  /* Now build the matrix of base changement :
1196  * t: new indices, i: old indices, n:structure parameters
1197  * t = mT.i + mB.n
1198  * i = mT_inv.t - (mT_inv*mB).n
1199  */
1200  mT = matrix_new(ps_b->nb_eq, gen_length(ciel));
1201  mB = matrix_new(ps_b->nb_eq, gen_length(lpar)+1);
1204  mR_inv = matrix_new(MATRIX_NB_LINES(mT),MATRIX_NB_COLUMNS(mT));
1205  mS_inv = matrix_new(MATRIX_NB_LINES(mT),MATRIX_NB_COLUMNS(mB));
1207  Tcnst, mT, mB);
1208  MATRIX_DENOMINATOR(mT) = den;
1209  MATRIX_DENOMINATOR(mB) = den;
1210  matrix_normalize(mT);
1211  matrix_normalize(mB);
1212 
1213  /* calculate the inverse matrix of mT called mT_inv */
1214  /* we are sure that mT is reversible because it has */
1215  /* been built in a way where all vectors were free */
1216  mT_inv = matrix_new(ps_b->nb_eq, gen_length(ciel));
1217  matrix_general_inversion(mT, mT_inv);
1218 
1219  mT_invB = matrix_new(MATRIX_NB_LINES(mT),MATRIX_NB_COLUMNS(mB));
1220  matrix_multiply(mT_inv, mB, mT_invB );
1221  matrix_coef_mult(mT_invB, VALUE_MONE);
1222  matrix_normalize(mT_inv);
1223  matrix_normalize(mT_invB);
1224 
1225  /* we get the execution domain of the node and we will change */
1226  /* the old variables by the new ones (t,p...). First we find */
1227  /* the expression of the old variables in function of the new */
1228  /* ones and put the result in int_ps, then make the replacement */
1229  /* in old_ps. old_ps will be the "domain" of the scell. */
1230 
1232  old_ps = sc_append(old_ps, predicate_to_system(pred));
1233  pred = make_predicate(sc_dup(old_ps));
1234 
1235  if (get_debug_level() > 5) {
1236  fprintf(stderr,"\nOld indices:");
1237  fprint_entity_list(stderr, ciel);
1238  fprintf(stderr,"\nNew indices:");
1239  fprint_entity_list(stderr, lnew);
1240  fprintf(stderr, "\nDomain of the old indices:");
1241  fprint_psysteme(stderr, old_ps);
1242  fprintf(stderr, "\nSystem of basis change 1:");
1243  fprint_psysteme(stderr, ps_b);
1244  fprintf(stderr, "\nT = ");
1245  matrix_fprint(stderr,mT);
1246  fprintf(stderr, "\nB = ");
1247  matrix_fprint(stderr,mB);
1248  fprintf(stderr,"\nMatrice mT_inv :");
1249  matrix_fprint(stderr, mT_inv);
1250  fprintf(stderr,"\nMatrice mT_invB :");
1251  matrix_fprint(stderr, mT_invB);
1252  }
1253 
1254  new_indx = list_to_base(lnew);
1255  my_matrices_to_constraints_with_sym_cst(&cont, Tindx, new_indx,\
1256  Tcnst, mT_inv, mT_invB);
1257  int_ps = sc_make(cont, NULL);
1258  sc_normalize(int_ps);
1259 
1260  /* we include the new parameters in the system of constraints */
1261  new_ps = change_base_in_sc(old_ps, ciel, int_ps);
1262 
1263  if (get_debug_level() > 5) {
1264  fprintf(stderr, "\nSystem of basis change 2:");
1265  fprint_psysteme(stderr, int_ps);
1266  fprintf(stderr, "\nDomain after the basis change:");
1267  fprint_psysteme(stderr, new_ps);
1268  }
1269 
1270  pcond = sc_rn(list_to_base(lnew));
1271  pps = sc_dup(new_ps);
1273 
1274  if(!sc_consistent_p(pps)) {
1275  pps->base = (Pbase) NULL;
1276  sc_creer_base(pps);
1277  pps->nb_eq = nb_elems_list(sc_egalites(pps));
1278  pps->nb_ineq = nb_elems_list(sc_inegalites(pps));
1279  }
1280 
1281  algorithm_row_echelon(pps, list_to_base(lnew), &pcond, &int_ps);
1282 
1283  new_ps = sc_append(new_ps, pcond);
1284 
1285  lnewt = gen_copy_seq(lnew);
1286 
1287  if (get_debug_level() > 5) {
1288  fprintf(stderr, "\nDomain after row_echelon:");
1289  fprint_psysteme(stderr, int_ps);
1290  }
1291 
1292 
1293  if (with_t) {
1294  /* Now we have to build matrix mQ that maps normal to minor
1295  * time x space coordinates, using the time period of each
1296  * new variable given by omega and the its value at the
1297  * origin */
1298  mH = matrix_new(ps_b->nb_eq, gen_length(ciel));
1299  mP = matrix_new(ps_b->nb_eq, gen_length(ciel));
1300  mU = matrix_new(ps_b->nb_eq, gen_length(ciel));
1301 
1302  matrix_hermite(mT, mP, mH, mU, &detP, &detU);
1303 
1304  if (get_debug_level() > 5) {
1305  fprintf(stderr, "\nHermite of mT = ");
1306  matrix_fprint(stderr,mH);
1307  }
1308 
1309  matrix_free(mU);
1310  matrix_free(mP);
1311 
1312  if (get_debug_level() > 1) {
1313  fprintf(stderr,"\nSeparate begin");
1314  }
1315  count_loop = gen_length(lnewb);
1316  lsys = separate_variables(sc_dup(int_ps), gen_copy_seq(lnew),\
1317  &sys_p, count_loop);
1318  if (get_debug_level() > 1) {
1319  fprintf(stderr,"\nSeparate end");
1320  }
1321 
1322  if (get_debug_level() > 1) {
1323  fprintf(stderr, "\n Separate systems: ");
1324  sl_fprint(stderr, lsys, entity_local_name);
1325  fprintf(stderr, "\nSystems for PLC:");
1326  fprint_psysteme(stderr, sys_p);
1327  }
1328 
1329  lsys_time = lsys;
1330  ltime = NULL;
1331  ltopo = NULL;
1332 
1333  /* we separate the list of psystems in p from the one in t */
1334  i = 1;
1335  while (lsys_time != NULL) {
1336  if (i <= time_count) {
1337  /* this is a system in t */
1338  ltime = add_sc_to_sclist(sc_dup(lsys_time->psys), ltime);
1339  lsys_time = lsys_time->succ;
1340  i++;
1341  }
1342  else {
1343  /* this is a system in p */
1344  ltopo = add_sc_to_sclist(sc_dup(lsys_time->psys), ltopo);
1345  lsys_time = lsys_time->succ;
1346  }
1347  }
1348 
1349  ltime = build_list_of_min(ltime, lnew, SC_UNDEFINED);
1350 
1351  if (get_debug_level() > 5) {
1352  fprintf(stderr, "\n Systems for BDT after build_min: ");
1353  sl_fprint(stderr, ltime, entity_local_name);
1354  fprintf(stderr, "\n Systems for PLC after build_min: ");
1355  sl_fprint(stderr, ltopo, entity_local_name);
1356  }
1357 
1358  /* for each system of ltime build a Pscell */
1359  for (lsys_aux = ltime; lsys_aux != NULL; lsys_aux =
1360  lsys_aux->succ) {
1361  qcount = 0;
1362  int_ps = sc_dup(lsys_aux->psys);
1363  int_ps = sc_append(int_ps, sc_dup(sys_p));
1364 
1365  if (get_debug_level() > 5) {
1366  fprintf(stderr,"\nWe work on system: ");
1367  fprint_psysteme(stderr, int_ps);
1368  }
1369 
1370  /* tau: new indices with minor time
1371  * tau = mQ.t + mC.n
1372  * t = mQ_inv.tau - (mQ_inv*mC).n
1373  */
1375  mQ_inv = matrix_new(MATRIX_NB_LINES(mT),MATRIX_NB_COLUMNS(mT));
1377  mQ_invC = matrix_new(MATRIX_NB_LINES(mT), MATRIX_NB_COLUMNS(mB));
1378 
1379  build_contraction_matrices(cn, int_ps, mH, &qcount, &mQ, &mQ_inv,\
1380  &mC, &lnewq, &lom,
1381  list_to_base(lnew), Tcnst);
1382 
1383  matrix_multiply(mQ_inv, mC, mQ_invC);
1384  matrix_coef_mult(mQ_invC, -1);
1385  matrix_normalize(mQ_inv);
1386  matrix_normalize(mQ_invC);
1387 
1388  ltau = gen_copy_seq(lnewq);
1389  lnewq = find_new_variables(lnew, lnewq);
1390 
1391  new_indx = list_to_base(lnewq);
1392  Qindx = list_to_base(lnew);
1393  Qcnst = Tcnst;
1394 
1395  if (get_debug_level() >5) {
1396  fprintf(stderr, "\nmQ :");
1397  matrix_fprint(stderr, mQ);
1398  fprintf(stderr, "\nmC:");
1399  matrix_fprint(stderr, mC);
1400  fprintf(stderr, "\nmQ_inv :");
1401  matrix_fprint(stderr, mQ_inv);
1402  fprintf(stderr, "\nmQ_invC:");
1403  matrix_fprint(stderr, mQ_invC);
1404  }
1405 
1406  my_matrices_to_constraints_with_sym_cst(&cont, Qindx, new_indx,\
1407  Qcnst, mQ_inv,
1408  mQ_invC);
1409 
1413 
1414  matrix_multiply(mQ, mT, mR);
1415  matrix_normalize(mR);
1416 
1417  matrix_multiply(mT_inv, mQ_inv, mR_inv);
1418  matrix_normalize(mR_inv);
1419 
1420  matrix_multiply(mQ, mB, mIc);
1421  matrix_add(mS, mIc, mC);
1422  matrix_normalize(mS);
1423 
1424  matrix_multiply(mR_inv, mS, mS_inv);
1425  matrix_coef_mult(mS_inv, -1);
1426  matrix_normalize(mS_inv);
1427  }
1428  }
1429  else {
1430  /* case where the schedule is constant */
1431  /* should be matrix_undefined better than NULL */
1432  mQ = NULL; /* should be: Id */
1433  mQ_inv = NULL; /* idem */
1434  mC = NULL; /* should be: 0 */
1435  lnewq = lnew;
1436  mR = mT;
1437  mS = mB;
1438  mR_inv = mT_inv;
1439  mS_inv = mT_invB;
1440 
1441  lom = CONS(INT, 1, NIL);
1442  ltau = NIL;
1443  ltime = add_sc_to_sclist(time_ps, ltime);
1444 
1445  count_loop = gen_length(lnewb);
1446  ltopo = separate_variables_2(sc_dup(int_ps), gen_copy_seq(lnew),\
1447  &sys_p, count_loop);
1448  }
1449 
1450  /* we fill the scell at last ! */
1451  pc_aux = (Pscell)malloc(sizeof(scell));
1452  pc_aux->statement = cn;
1453  pc_aux->domain = pred;
1454  pc_aux->edge_dom = make_predicate(sc_dup(predicate_to_system(schedule_predicate(sched))));
1455  pc_aux->var_base = Tindx;
1456  pc_aux->con_base = Tcnst;
1457  pc_aux->Rbase_out = list_to_base(lnewq);
1458  pc_aux->Tbase_out = list_to_base(lnewt);
1459  pc_aux->Tmat = mT;
1460  pc_aux->Tmat_inv = mT_inv;
1461  pc_aux->Bmat = mB;
1462  pc_aux->Bmat_inv = mT_invB;
1463  pc_aux->Rmat = mR;
1464  pc_aux->Rmat_inv = mR_inv;
1465  pc_aux->Smat = mS;
1466  pc_aux->Smat_inv = mS_inv;
1467  pc_aux->lomega = lom;
1468  pc_aux->lp = lnewp3;
1469  pc_aux->lt = lnewb;
1470  pc_aux->ltau = ltau;
1471  pc_aux->Nbounds = new_ps;
1472  pc_aux->Nindices = list_to_base(lnewq);
1473  pc_aux->t_bounds = ltime;
1474  pc_aux->p_topology = ltopo;
1475  pc_aux->succ = pc;
1476  pc = pc_aux;
1477 
1478  if (get_debug_level() > 1) {
1479  fprintf(stderr,"\nNoeud %d :\n", cn);
1480  fprintf(stderr, "\nNouvelles variables:\n");
1481  fprint_entity_list(stderr, lnewq);
1482  fprintf(stderr, "\nRmat = ");
1483  matrix_fprint(stderr,mR);
1484  fprintf(stderr, "\nBasen de Smat = ");
1485  pu_vect_fprint(stderr, Tcnst);
1486  fprintf(stderr, "\nSmat = ");
1487  matrix_fprint(stderr,mS);
1488  fprintf(stderr, "\nSmat inverse = ");
1489  matrix_fprint(stderr,mS_inv);
1490  fprintf(stderr, "\nR_inv = ");
1491  matrix_fprint(stderr,mR_inv);
1492  fprintf(stderr, "\nNew Psystem ");
1493  fprint_psysteme(stderr, new_ps);
1494  fprintf(stderr,"\nOMEGU = %d",INT(CAR(lom)));
1495  fprintf(stderr,"Liste des extremums sur temps :");
1496  sl_fprint(stderr, pc_aux->t_bounds, entity_local_name);
1497  fprintf(stderr,"Liste sur topology de p :");
1498  sl_fprint(stderr, pc_aux->p_topology, entity_local_name);
1499  }
1500 
1501  /* Y a des matrices a effacer ICI !!*/
1502 
1503  if (gen_length(lnewb) > gen_length(lt)) lt = gen_copy_seq(lnewb);
1504  /* end of loop on schedule */
1505  }
1506  }
1507  else {
1508  /* No loop around the instruction */
1509  if (get_debug_level()>5)
1510  fprintf(stderr, "\nNo Loop Counters\n");
1511 
1512  /* first we extract the bdt, which should be constant. The plc */
1513  /* is null. */
1514  bv = extract_bdt(b, cn);
1515 
1516  /* The bdt is constant, but it can have different domains */
1517  for (; !ENDP(bv); POP(bv)) {
1518  schedule sched = SCHEDULE(CAR(bv));
1519  predicate pred = schedule_predicate(sched);
1520  lnewb = NIL;
1521  ltime = NULL;
1522 
1524  old_ps = sc_append(old_ps, predicate_to_system(pred));
1525 
1526  if (get_debug_level() > 1)
1527  fprintf(stderr,"\n**Computing Cell**\n\n");
1528 
1529  lexp = schedule_dims(sched);
1530  if(gen_length(lexp) > 1)
1531  user_error("prepare_reindexing",
1532  "\nA constant schedule can not be multi-dimensional\n");
1533 
1534  ent = create_new_entity(cn-BASE_NODE_NUMBER, STRING_BDT, bcount);
1535  ADD_ELEMENT_TO_LIST(lnewb, ENTITY, ent);
1536  exp = EXPRESSION(CAR(lexp));
1537  analyze_expression(&exp, &d);
1538 
1539  /* we take care of a possible denominator. */
1540  if (d == 1) {
1543  time_ps = sc_make(contrainte_make(vec), NULL);
1544  lom = CONS(INT, 1, NIL);
1545  }
1546  else
1547  user_error("prepare reindexing",
1548  "Rational case not treated yet !");
1549 
1550  pc_aux = (Pscell)malloc(sizeof(scell));
1551  pc_aux->statement = cn;
1552  pc_aux->domain = pred;
1553  pc_aux->edge_dom = make_predicate(sc_dup(predicate_to_system(schedule_predicate(sched))));
1554  pc_aux->var_base = NULL;
1555  pc_aux->con_base = Tcnst;
1556  pc_aux->Rbase_out = NULL;
1557  pc_aux->Tbase_out = NULL;
1558  pc_aux->Tmat = matrix_new(0,0);
1559  pc_aux->Tmat_inv = matrix_new(0,0);
1560  pc_aux->Bmat = matrix_new(0,0);
1561  pc_aux->Bmat_inv = matrix_new(0,0);
1562  pc_aux->Rmat = matrix_new(0,0);
1563  pc_aux->Rmat_inv = matrix_new(0,0);
1564  pc_aux->Smat = matrix_new(0,0);
1565  pc_aux->Smat_inv = matrix_new(0,0);
1566  pc_aux->lomega = lom;
1567  pc_aux->lp = NIL;
1568  pc_aux->lt = lnewb;
1569  pc_aux->ltau = NIL;
1570  pc_aux->Nbounds = NULL;
1571  pc_aux->Nindices = NULL;
1572  pc_aux->t_bounds = add_sc_to_sclist(time_ps, NULL);
1573  pc_aux->p_topology = NULL;
1574  pc_aux->succ = pc;
1575  pc = pc_aux;
1576  }
1577  }
1578 
1579  hash_put(h_node, (char *)cn, (char *)pc);
1580 
1581  /* Prepare the array bounds */
1583 
1584  if (get_debug_level()>5)
1585  fprintf(stderr, "\n***Fin index***\n");
1586  }
1587 
1588  return(lt);
1589 }
1590 
1591 
1592 /*=========================================================================*/
1593 /* bool compatible_pc_p(pcd, pcs, s, d)
1594  *
1595  * Tests if the domain on which we work, that is pcd->domain with the
1596  * conditions on the edge is included in the domain of the selectionned
1597  * scell pcs (we transform)
1598  *
1599  * AC 94/04/07 */
1600 
1601 static bool compatible_pc_p(pcd, pcs, s, d)
1602 Pscell pcd, pcs;
1603 int s;
1604 dataflow d;
1605 {
1606  bool bool = false;
1607  list ltrans = dataflow_transformation(d);
1608  Psysteme pss, psd;
1609  Pdisjunct dis = DJ_UNDEFINED;
1610  Ppath pa = pa_new();
1611 
1612  if (get_debug_level() > 6) {
1613  fprintf(stderr,"\ncompatible pc debut:\n");
1614  fprintf(stderr,"\narc %d -> %d", pcs->statement, pcd->statement);
1615  fprintf(stderr,"\nDataflow:");
1616  fprint_dataflow(stderr, s, d);
1617  }
1618 
1619  if ((pcd == NULL) || (pcs == NULL))
1620  bool = true;
1621  else {
1623  psd = sc_append(psd, predicate_to_system(pcd->domain));
1624  if (get_debug_level() > 6) {
1625  fprintf(stderr,"\nSysteme destination avec arc:\n");
1626  fprint_psysteme(stderr,psd);
1627  }
1628 
1629  pss = sc_dup(predicate_to_system(pcs->domain));
1630  if (get_debug_level() > 6) {
1631  fprintf(stderr,"\nTransformation:");
1632  fprint_list_of_exp(stderr, ltrans);
1633  fprintf(stderr,"\nSysteme source:\n");
1634  fprint_psysteme(stderr, pss);
1635  }
1636  if(pss != SC_UNDEFINED) {
1637  pss = include_trans_in_sc(s, pss, ltrans);
1638  if (get_debug_level() > 6) {
1639  fprintf(stderr,"\nSysteme source:\n");
1640  fprint_psysteme(stderr, pss);
1641  }
1642 
1643  dis = dj_append_system(dis, pss);
1644  pa->psys = psd;
1645  pa->pcomp = dis;
1646  if (!pa_faisabilite(pa))
1647  bool = true;
1648  }
1649  else
1650  bool = true;
1651  }
1652 
1653  if (get_debug_level() > 6) {
1654  if (bool)
1655  fprintf(stderr, "\ncellules compatibles .");
1656  else
1657  fprintf(stderr, "\ncellules non compatibles .");
1658  fprintf(stderr,"\ncompatible pc fin:\n");
1659  }
1660 
1661  return(bool);
1662 }
1663 
1664 
1665 /*=========================================================================*/
1666 /* reference make_reindex(crt_df, crt_m, assign_i, pc):
1667  *
1668  * AC 94/04/22
1669  */
1670 
1671 static reference make_reindex(crt_df, crt_m, assign_i, pc)
1672 dataflow crt_df;
1673 int crt_m;
1674 instruction assign_i;
1675 Pscell pc;
1676 {
1677  extern hash_table h_node;
1678 
1679  Pscell source_pc;
1680  bool not_found = true;
1681  reference old_ref, new_ref;
1682  list ltrans = dataflow_transformation(crt_df), lsub = NIL;
1683  Pmatrix mL, mC, mA, mAC, mB, mBC, term1, term2, term3, term4, term5;
1684  Pmatrix term6, term7;
1685  Psysteme ps = sc_new();
1686  Pvecteur Abase, ACbase, Bbase, Lbase;
1687  Pcontrainte cont;
1688  expression exp;
1689  Pvecteur vec;
1690 
1691  if (get_debug_level() > 6)
1692  fprintf(stderr,"\nMake reindex debut pour le noeud %d:\n", crt_m);
1693 
1694  source_pc = (Pscell)hash_get(h_node, (char *)crt_m);
1695  old_ref = dataflow_reference(crt_df);
1696 
1697  if (get_debug_level() > 6) {
1698  fprintf(stderr, "\nOld dataflow reference : ");
1699  print_reference(old_ref);
1700  }
1701 
1702  if (source_pc != NULL) {
1703  /* first, find the good scell we should work on */
1704  for ( ; (source_pc != NULL) && not_found; ) {
1705  if (compatible_pc_p(pc, source_pc, crt_m, crt_df))
1706  not_found = false;
1707  else
1708  source_pc = source_pc->succ;
1709  }
1710 
1711  if (not_found)
1712  user_error("make reindex"," pas trouve de domaine commun !");
1713 
1714  if(source_pc->var_base != NULL) {
1715  if (pc->var_base != NULL) {
1716  /* gotcha the good scell, we build now the list of subscripts */
1717  /* that is gamma(rhs) = f(gamma(lhs)) */
1718  mA = pc->Rmat_inv;
1719  mAC = pc->Smat_inv;
1720  mB = source_pc->Rmat;
1721  mBC = source_pc->Smat;
1722  Abase = pc->Rbase_out;
1723  ACbase = pc->con_base;
1724  Lbase = pc->var_base;
1725  Bbase = source_pc->Rbase_out;
1726 
1727  /* first we transform the L application into matrices */
1728  /* (j) = (L)(i) <=> (j) = mL * (i) + mC * (n) */
1729 
1730  if (get_debug_level() > 6)
1731  fprintf(stderr,"\nApplication transformation :\n");
1732 
1733  for (; ltrans != NIL; POP(ltrans)) {
1734  exp = EXPRESSION(CAR(ltrans));
1735  if (get_debug_level() > 6) {
1737  fprintf(stderr,"\n");
1738  }
1741  ps = sc_add_egalite_at_end(ps, contrainte_make(vec));
1742  }
1743 
1746 
1748  ACbase, mL, mC);
1749 
1750  sc_rm(ps);
1751  ps = sc_new();
1752 
1753  /* the formula we have to apply now is : */
1754  /* gamma_b = mB * (mL(mA(gamma_a)+mAC) + mC) + mBC */
1755  /* gamma_b = mB*mL*mA(gamma_a)+mB*mL*mAC+mB*mC+mBC */
1756 
1757  term1 = matrix_new(MATRIX_NB_LINES(mL),MATRIX_NB_COLUMNS(mA));
1758  term2 = matrix_new(MATRIX_NB_LINES(mB),MATRIX_NB_COLUMNS(mL));
1759  term3 = matrix_new(MATRIX_NB_LINES(mL),MATRIX_NB_COLUMNS(mAC));
1760  term4 = matrix_new(MATRIX_NB_LINES(mB),MATRIX_NB_COLUMNS(mC));
1761  term5 = matrix_new(MATRIX_NB_LINES(mB),MATRIX_NB_COLUMNS(mC));
1762  term6 = matrix_new(MATRIX_NB_LINES(mB),MATRIX_NB_COLUMNS(mC));
1763  term7 = matrix_new(MATRIX_NB_LINES(mB),MATRIX_NB_COLUMNS(mC));
1764 
1765  if (get_debug_level() > 6) {
1766  fprintf(stderr,"\nMatrice A:\n");
1767  matrix_fprint(stderr, mA);
1768  fprintf(stderr,"\nMatrice mL:\n");
1769  matrix_fprint(stderr, mL);
1770  fprintf(stderr,"\nMatrice mB:\n");
1771  matrix_fprint(stderr, mB);
1772  fprintf(stderr,"\nMatrice mC:\n");
1773  matrix_fprint(stderr, mC);
1774  }
1775 
1776  matrix_multiply(mL, mA, term1);
1777  matrix_multiply(mB, term1, term2);
1778 
1779  /* constant term */
1780  matrix_multiply(mL, mAC, term3);
1781  matrix_multiply(mB, term3, term4);
1782  matrix_multiply(mB, mC, term5);
1783 
1784  matrix_add(term6, term5, term4);
1785  matrix_add(term7, mBC, term6);
1786 
1787  matrix_normalize(term2);
1788  matrix_normalize(term7);
1789 
1790  if (get_debug_level() > 4) {
1791  fprintf(stderr,"\nBase de depart:\n");
1792  pu_vect_fprint(stderr, Abase);
1793  fprintf(stderr,"\nBase d arrivee:\n");
1794  pu_vect_fprint(stderr, Bbase);
1795  fprintf(stderr,"\nBase matrice constante:\n");
1796  pu_vect_fprint(stderr, ACbase);
1797  fprintf(stderr,"\nMatrice produit:\n");
1798  matrix_fprint(stderr, term2);
1799  fprintf(stderr,"\nMatrice constante:\n");
1800  matrix_fprint(stderr, term7);
1801  }
1802 
1803  my_matrices_to_constraints_with_sym_cst_2(&cont, Bbase, Abase,\
1804  ACbase, term2, term7);
1805 
1806  matrix_free(mL);
1807  matrix_free(mC);
1808  matrix_free(term1);
1809  matrix_free(term2);
1810  matrix_free(term3);
1811  matrix_free(term4);
1812  matrix_free(term5);
1813  matrix_free(term6);
1814  matrix_free(term7);
1815 
1816  for (; cont != NULL; cont = cont->succ) {
1819  exp = int_to_expression(0);
1821  cont->vecteur);
1823  }
1824  }
1825  else {
1826  /* gotcha the good scell, we build now the list of subscripts */
1827  /* that is gamma(rhs) = f(gamma(lhs)) */
1828  mB = source_pc->Rmat;
1829  mBC = source_pc->Smat;
1830  Bbase = source_pc->Rbase_out;
1831  ACbase = pc->con_base;
1832 
1833  /* first we transform the L application into matrices */
1834  /* (j) = (L)(i) <=> (j) = mL * (i) + mC * (n) */
1835 
1836  if (get_debug_level() > 6)
1837  fprintf(stderr,"\nApplication transformation : destination empty\n");
1838 
1839  for (; ltrans != NIL; POP(ltrans)) {
1840  exp = EXPRESSION(CAR(ltrans));
1841  if (get_debug_level() > 6) {
1843  fprintf(stderr,"\n");
1844  }
1847  ps = sc_add_egalite_at_end(ps, contrainte_make(vec));
1848  }
1849 
1850  if(get_debug_level() > 6) {
1851  fprintf(stderr,"mB :\n");
1852  matrix_fprint(stderr, mB);
1853  fprintf(stderr,"mBC :\n");
1854  matrix_fprint(stderr, mBC);
1855  fprintf(stderr,"Bbase :\n");
1856  pu_vect_fprint(stderr, Bbase);
1857  fprintf(stderr,"ACbase :\n");
1858  pu_vect_fprint(stderr, ACbase);
1859  fprintf(stderr,"Trans:\n");
1860  fprint_psysteme(stderr, ps);
1861  }
1862 
1863  mC = matrix_new(MATRIX_NB_LINES(mB), vect_size(ACbase)+1);
1865  matrix_new(0,0), mC);
1866 
1867  if(get_debug_level() >6) {
1868  fprintf(stderr,"mC :\n");
1869  matrix_fprint(stderr, mC);
1870  }
1871 
1872  sc_rm(ps);
1873  ps = sc_new();
1874 
1875  /* the formula we have to apply now is : */
1876  /* gamma_b = mB * mC + mBC */
1877 
1878  term1 = matrix_new(MATRIX_NB_LINES(mB),0);
1879  term5 = matrix_new(MATRIX_NB_LINES(mB),MATRIX_NB_COLUMNS(mC));
1880  term6 = matrix_new(MATRIX_NB_LINES(mB),MATRIX_NB_COLUMNS(mC));
1881 
1882  if (get_debug_level() > 6) {
1883  fprintf(stderr,"\nMatrice mB:\n");
1884  matrix_fprint(stderr, mB);
1885  fprintf(stderr,"\nMatrice mC:\n");
1886  matrix_fprint(stderr, mC);
1887  }
1888 
1889  /* constant term */
1890  matrix_multiply(mB, mC, term5);
1891  matrix_add(term6, term5, mBC);
1892  matrix_normalize(term6);
1893 
1894  if (get_debug_level() > 4) {
1895  fprintf(stderr,"\nBase d arrivee:\n");
1896  pu_vect_fprint(stderr, Bbase);
1897  fprintf(stderr,"\nBase matrice constante:\n");
1898  pu_vect_fprint(stderr, ACbase);
1899  fprintf(stderr,"\nMatrice constante:\n");
1900  matrix_fprint(stderr, term6);
1901  }
1902 
1903  my_matrices_to_constraints_with_sym_cst_2(&cont, Bbase, NULL,
1904  ACbase, term1, term6);
1905 
1906  matrix_free(mC);
1907  matrix_free(term1);
1908  matrix_free(term5);
1909  matrix_free(term6);
1910 
1911  for (; cont != NULL; cont = cont->succ) {
1914  exp = int_to_expression(0);
1916  cont->vecteur);
1918 
1919  if (get_debug_level() > 4) {
1920  fprintf(stderr,"\nNouvelles contraintes:\n");
1921  vecteur_fprint(stderr, cont, pu_variable_name);
1922  fprintf(stderr, "\nNouvelles expressions: %s\n",
1924  }
1925  }
1926  }
1927  }
1928  else
1929  if(ltrans != NIL)
1930  user_error("make_reindex", "\nTransformation should be empty\n");
1931  }
1932 
1933  if (get_debug_level() > 6) {
1934  fprintf(stderr,"\nListe d expression :\n");
1935  fprint_list_of_exp(stderr, lsub);
1936  }
1937 
1938  /* calculate the delay if necessary */
1939  if (lsub != NULL) {
1940  entity tau = entity_undefined;
1941 
1942  if(pc->ltau != NIL)
1943  tau = ENTITY(CAR(pc->ltau));
1944  calculate_delay(EXPRESSION(CAR(lsub)), source_pc, pc, tau);
1945  }
1946 
1947  new_ref = my_build_new_ref(IS_NEW_ARRAY, crt_m, lsub, old_ref);
1948 
1949  if (get_debug_level() > 6) {
1950  fprintf(stderr,"\nNouvelle reference :\t ");
1951  print_reference(new_ref);
1952  fprintf(stderr,"\nMake reindex fin\n");
1953  }
1954 
1955  return(new_ref);
1956 }
1957 
1958 /*======================================================================*/
1959 /* void substitute_expressions(expression exp, list l_ind, list l_exp)
1960  *
1961  * Substitute in expression "exp" the loop indices contains in "l_ind" by
1962  * the respective expressions contains in "l_exp". This substitution is
1963  * done recursively
1964  *
1965  * Parameters:
1966  * exp: expression in which we do the substitution
1967  * l_ind: list of the loop indices that have to be subtituted
1968  * l_exp: list of the expressions used in the substitution
1969  *
1970  * AP 95/09/20 */
1971 void substitute_expressions(exp, l_ind, l_exp)
1972 expression exp;
1973 list l_ind, l_exp;
1974 {
1975  syntax sy;
1976  sy = expression_syntax(exp);
1977 
1978  if(syntax_tag(sy) == is_syntax_reference) {
1979  reference crt_ref = syntax_reference(sy);
1980 
1981  if(reference_indices(crt_ref) == NIL) {
1982  entity crt_e = reference_variable(crt_ref);
1983  bool is_in_list = false;
1984  list li, le = l_exp;
1985 
1986  for(li = l_ind; (li != NIL) && (! is_in_list); li = CDR(li)) {
1987  if(same_entity_p(crt_e, ENTITY(CAR(li))))
1988  is_in_list = true;
1989  else
1990  le = CDR(le);
1991  }
1992  if(is_in_list)
1994  }
1995  }
1996  else if(syntax_tag(sy) == is_syntax_call) {
1997  list ael = call_arguments(syntax_call(sy));
1998  for(; !ENDP(ael); POP(ael)) {
1999  expression ae = EXPRESSION(CAR(ael));
2000  substitute_expressions(ae, l_ind, l_exp);
2001  }
2002  }
2003  else
2004  pips_internal_error("Bad syntax tag");
2005 }
2006 
2007 /*======================================================================*/
2008 /* void substitute_loop_indices(instruction ins, list l_ind, list l_exp)
2009  *
2010  * Substitute in instruction "ins" the loop indices contains in "l_ind" by
2011  * the respective expressions contains in "l_exp".
2012  *
2013  * Parameters:
2014  * ins: instruction in which we do the substitution
2015  * l_ind: list of the loop indices that have to be subtituted
2016  * l_exp: list of the expressions used in the substitution
2017  *
2018  * AP 95/09/20 */
2019 void substitute_loop_indices(ins, l_ind, l_exp)
2021 list l_ind, l_exp;
2022 {
2024  call c = instruction_call(ins);
2025  if(ENTITY_ASSIGN_P(call_function(c))) {
2026  expression rhs_exp;
2027  list args = call_arguments(c);
2028 
2029  if(gen_length(args) != 2)
2030  pips_internal_error("Assign call without 2 args");
2031 
2032  /* There are two args: lhs = rhs, we want the references of the rhs */
2033  rhs_exp = EXPRESSION(CAR(CDR(args)));
2034 
2035  substitute_expressions(rhs_exp, l_ind, l_exp);
2036  }
2037  }
2038  else
2039  pips_internal_error("Instruction is not an assign call");
2040 }
2041 
2042 /*======================================================================*/
2043 /* list build_third_comb(old_ref, cls, assign_i, pc, te, sc, c, linit,
2044  * lmax): make the reindexation on a reference which we know it is the
2045  * last one of the instruction, so we make the reindexation on the
2046  * current reference, then encapsulate the new instruction in its test
2047  * C(t,p).
2048  *
2049  * Parameters:
2050  * old_ref: current reference
2051  * cls: current list of predecessors
2052  * assign_i: current instruction
2053  * pc: current Pscell
2054  * te:
2055  * sc: current domain
2056  * c: counter of the local time variables
2057  * linit:
2058  * lmax:
2059  *
2060  * Result:
2061  *
2062  * AC 94/05/15 */
2063 
2064 static list
2065 build_third_comb(old_ref, cls, assign_i, pc, te, sc, c, linit, lmax)
2066 list cls, *linit, *lmax;
2067 instruction assign_i;
2068 Pscell pc;
2069 reference old_ref;
2070 Psysteme sc, te;
2071 int *c;
2072 {
2073  instruction ins, new_i;
2074  Psysteme new_ps, pps, pps2, pps3 = SC_UNDEFINED, te_dup, pcond;
2075  predicate pred;
2076  dataflow df;
2077  reference new_ref;
2078  int m, i;
2079  list ldf, lm, lp, lom, lb = NIL, ub = NIL;
2080  statement stat;
2081  range ran;
2082  loop loo;
2083  Psyslist llp, llp1, llp2, llp3;
2084  list li = NIL, lstat;
2085  expression exp;
2086  entity ent = entity_undefined, tim;
2087  Pbase nbase;
2088  Pcontrainte cont;
2089  Psysteme int_ps;
2090  list la, lnew = NIL;
2091  Pvecteur vc;
2092  Value co;
2093  entity e;
2094 
2095  if (get_debug_level() > 4)
2096  fprintf(stderr, "\nBuild_third_comb begin");
2097 
2098  ldf = NIL; lm = NIL;
2099 
2100  /* special treatment for the old loop counters appearing as scalar
2101  variable in the instruction */
2102  if(pc != NULL) {
2103  li = base_to_list(pc->var_base);
2104  if (li != NIL) {
2106  pc->Nindices, pc->con_base,\
2107  pc->Rmat_inv, pc->Smat_inv);
2108  int_ps = sc_make(cont, NULL);
2109  sc_normalize(int_ps);
2110 
2111  if (get_debug_level() > 5) {
2112  fprintf(stderr, "\nIns BEFORE substitution\n");
2113  sa_print_ins(stderr, assign_i);
2114  }
2115  if (get_debug_level() > 5) {
2116  fprintf(stderr,"\nSubstitution with system:");
2117  fprint_psysteme(stderr,int_ps);
2118  }
2119 
2120  la = li;
2121  lnew = NIL;
2122  for (cont = int_ps->egalites; cont != NULL; cont = cont->succ) {
2123  e = ENTITY(CAR(la));
2124  co = vect_coeff((Variable) e, cont->vecteur);
2125  vc = vect_dup(cont->vecteur);
2126  vect_erase_var(&vc, (Variable)e);
2127  if (value_posz_p(co))
2128  vc = vect_multiply(vc, VALUE_MONE);
2129  vect_normalize(vc);
2131  if(value_gt(co,VALUE_ONE) || value_lt(co,VALUE_MONE)) {
2134  VALUE_TO_INT(value_abs(co))));
2135  }
2136  lnew = gen_nconc(lnew, CONS(EXPRESSION, exp, NIL));
2137  la = CDR(la);
2138 
2139  if (get_debug_level() > 5) {
2140  fprintf(stderr, "\nSubstitute %s by %s\n",
2141  entity_local_name(e),
2143  }
2144  }
2145  substitute_loop_indices(assign_i, li, lnew);
2146  if (get_debug_level() > 5) {
2147  fprintf(stderr, "\nIns AFTER substitution\n");
2148  sa_print_ins(stderr, assign_i);
2149  }
2150  }
2151  }
2152 
2153  li = NIL;
2154 
2155  /* get the list of dataflows */
2156  if (pc != NULL)
2157  ldf = dataflows_on_reference(cls, old_ref, pc->domain, &lm);
2158 
2159  if (ldf == NIL) {
2160  entity var;
2161  Pvecteur vec;
2162  expression cst_sched;
2163 
2164  /* special case where we replace just the old variables by the */
2165  /* new ones without changing the name of the reference */
2166  if (get_debug_level() > 5)
2167  fprintf(stderr,"\nOOPPS!! pas de reference\n");
2168 
2169  new_ref = include_trans_on_LC_in_ref(copy_reference(old_ref), pc);
2170  ins = copy_instruction(assign_i);
2171  rhs_subs_in_ins(ins, old_ref, new_ref);
2172 
2173  /* Duplication because "te" is reused when there are two or
2174  * more dataflows, i.e. "ldf" has two or more elements. */
2175  new_ps = sc_dup(te);
2176  if (get_debug_level() > 6) {
2177  fprint_psysteme(stderr, new_ps);
2178  }
2179 
2180  /* modify te to take t_local into account */
2181  pps = sc_dup(pc->Nbounds);
2182  if (get_debug_level() > 6) {
2183  fprint_psysteme(stderr, pps);
2184  }
2185 
2186  /* include the information on the test */
2187  pps = sc_append(pps, new_ps);
2188 
2189  nbase = pc->Tbase_out;
2190  pcond = sc_rn(nbase);
2191  if(nbase != NULL) {
2192  /* recalculate the bounds for each variable of nbase */
2193  /* pps2 = new_loop_bound(pps, nbase); */
2195 
2196  if(!sc_consistent_p(pps)) {
2197  pps->base = (Pbase) NULL;
2198  sc_creer_base(pps);
2199  pps->nb_eq = nb_elems_list(sc_egalites(pps));
2200  pps->nb_ineq = nb_elems_list(sc_inegalites(pps));
2201  }
2202 
2203  algorithm_row_echelon(pps, nbase, &pcond, &pps2);
2204  }
2205  else
2206  pps2 = pps;
2207 
2208  if (get_debug_level() > 6) {
2209  fprint_psysteme(stderr, pps2);
2210  fprint_psysteme(stderr, pcond);
2211  }
2212 
2213  if(!sc_empty_p(pcond)) {
2214  normalized ncs;
2215 
2216  /* deux derniers parametres a revoir */
2217  llp = separate_variables(pps2, base_to_list(nbase), &pps3, 0);
2218 
2219  /* build the "forall p" loop around the instruction */
2220  lp = gen_nreverse(gen_copy_seq(pc->lp));
2221  if (get_debug_level() > 4) {
2222  fprintf(stderr,"\nListe des p : ");
2223  fprint_entity_list(stderr, lp);
2224  }
2225 
2226  /* the list is in the wrong order: reorder it */
2227  llp1 = llp;
2228  llp2 = NULL;
2229  if(nbase != NULL) {
2230  while (llp1 != NULL) {
2231  llp3 = sl_new();
2232  llp3->psys = llp1->psys;
2233  if (get_debug_level() > 6) {
2234  fprint_psysteme(stderr, llp1->psys);
2235  }
2236  llp3->succ = llp2;
2237  llp2 = llp3;
2238  llp1 = llp1->succ;
2239  }
2240  }
2241 
2242  /* Bounds of the local time */
2243  cst_sched =
2245  ncs = NORMALIZE_EXPRESSION(cst_sched);
2246 
2247  if(get_debug_level() > 6) {
2248  fprintf(stderr, "\nConstant Schedule : %s\n",
2249  expression_to_string(cst_sched));
2250  }
2251 
2252  /* get a possible max for global time */
2253  ADD_ELEMENT_TO_LIST((*lmax), EXPRESSION, cst_sched);
2254 
2255  /* We substitute the time variable by its constante value */
2256  var = ENTITY(CAR(pc->lt));
2257  vec = (Pvecteur) normalized_linear(ncs);
2258 
2259  /* build the loop on p's, around our ins */
2260  stat = MAKE_STATEMENT(ins);
2261  for (; lp != NIL; lp = CDR(lp)) {
2262  pps = llp2->psys;
2263 
2264  if (get_debug_level() > 6) {
2265  fprintf(stderr,
2266  "\nBEFORE subs: var = %s, val = 1, vec = ",
2267  entity_local_name(var));
2268  pu_vect_fprint(stderr, vec);
2269  fprint_psysteme(stderr, pps);
2270  }
2271 
2272  /* The substitution */
2273  substitute_var_with_vec(pps, var, 1, vec);
2274 
2275  if (get_debug_level() > 6) {
2276  fprintf(stderr, "\nAFTER subs:\n");
2277  fprint_psysteme(stderr, pps);
2278  }
2279 
2280  ran = make_bounds(pps, ENTITY(CAR(lp)), IS_LOOP_BOUNDS, NIL, NIL);
2281  loo = make_loop(ENTITY(CAR(lp)), ran, stat,
2284  NIL);
2285  new_i = make_instruction(is_instruction_loop, loo);
2286  stat = MAKE_STATEMENT(new_i);
2287  llp2 = llp2->succ;
2288  }
2289 
2290  lstat = NIL;
2291  ADD_ELEMENT_TO_LIST(lstat, STATEMENT, stat);
2292 
2293  if (get_debug_level() > 6) {
2294  fprintf(stderr,
2295  "\nInstruction en milieu de build_third_comb() :\n");
2296  sa_print_ins(stderr, ins);
2297  }
2298 
2299  /* encapsulate everything in a block */
2300  ins = make_instruction_block(lstat);
2301 
2302  /* Add the condition introduces by algorithm_row_echelon() */
2303  stat = generate_optional_if(pcond, MAKE_STATEMENT(ins));
2304 
2305  /* Put the test on global time around it */
2306  tim = get_time_ent(0, STRING_BDT, 0);
2307  exp = build_global_time_test_with_exp(tim, cst_sched);
2308 
2310  make_test(exp, stat,
2312 
2313  if (get_debug_level() > 6) {
2314  fprintf(stderr,
2315  "\nInstruction en sortie de build_third_comb() :\n");
2316  sa_print_ins(stderr, ins);
2317  }
2318 
2320  }
2321  }
2322  else {
2323  if (get_debug_level() > 4)
2324  fprintf(stderr,"\nNombre de dataflow: %d", gen_length(ldf));
2325 
2326  while (ldf != NIL) {
2327  bool with_t;
2328 
2329  df = DATAFLOW(CAR(ldf));
2330  m = INT(CAR(lm));
2331  lb = NIL;
2332  ub = NIL;
2333  lstat = NIL;
2334 
2335  /* Duplication because "te" is reused when there are two or
2336  * more dataflows, i.e. "ldf" has two or more elements. */
2337  te_dup = sc_dup(te);
2338 
2339  /* Says if the schedule is constant or not. */
2340  with_t = (pc->ltau != NIL);
2341 
2342  if(with_t) {
2343  /* The local time of the scell is split into as many local
2344  * time as there are dataflows. Each has its own bounds,
2345  * which are computed below. However, there relation with
2346  * the minor time remains the same, i.e.: t = omega*tau +
2347  * l, where "l" is the lower bound calculated before
2348  * (cf. prepare_reindexing) and saved into the field
2349  * "t_bounds" of the scell.*/
2351  STRING_BDT, (*c));
2352  (*c)++;
2353 
2354  /* take the new local time into account in the base */
2355  nbase = include_time_in_base(pc, ent);
2356 
2357  if (get_debug_level() > 6) {
2358  fprintf(stderr,"\nBase : ");
2359  pu_vect_fprint(stderr, nbase);
2360  }
2361 
2362  /* modify te to take t_local into account */
2363  sc_chg_var(te_dup, (Variable)ENTITY(CAR(pc->lt)),
2364  (Variable)ent);
2365  }
2366  else {
2367  nbase = pc->Tbase_out;
2368  }
2369 
2370  if (m == ENTRY_ORDER)
2371  new_ref = include_trans_on_LC_in_ref(copy_reference(old_ref),
2372  pc);
2373  else
2374  new_ref = make_reindex(df, m, assign_i, pc);
2375  new_i = copy_instruction(assign_i);
2376  rhs_subs_in_ins(new_i, old_ref, new_ref);
2377 
2378  pred = dataflow_governing_pred(df);
2379  new_ps = sc_dup(predicate_to_system(pred));
2380 
2381  if (get_debug_level() > 4) {
2382  fprintf(stderr,"\nCurrent Dataflow:");
2383  fprint_dataflow(stderr, m, df);
2384  fprintf(stderr,"\nSystem of the edge:");
2385  fprint_psysteme(stderr, new_ps);
2386  }
2387 
2388  /* take the test into account */
2389  if (!SC_UNDEFINED_P(new_ps)) {
2390  /* we put around the ins the test C(t, p) */
2391  new_ps = include_trans_on_LC_in_sc2(new_ps, pc, nbase);
2392  new_ps = sc_append(new_ps, te_dup);
2393  }
2394  else
2395  new_ps = te_dup;
2396 
2397  if (get_debug_level() > 6) {
2398  fprintf(stderr,"\nnew system:");
2399  fprint_psysteme(stderr, new_ps);
2400  }
2401 
2402  /* We need some consistency */
2403  if(!sc_consistent_p(new_ps) && !SC_UNDEFINED_P(new_ps)) {
2404  new_ps->base = NULL;
2405  sc_creer_base(new_ps);
2406  new_ps->nb_eq = nb_elems_list(sc_egalites(new_ps));
2407  new_ps->nb_ineq = nb_elems_list(sc_inegalites(new_ps));
2408  sc_dimension(new_ps) = base_dimension(sc_base(new_ps));
2409  }
2410 
2411  if (SC_RN_P(new_ps) ||
2413  entity tau, var;
2414  int omega, val;
2415  Pvecteur vec;
2416 
2417  /* modify te to take t_local into account */
2418  pps = sc_dup(pc->Nbounds);
2419 
2420  if(with_t)
2421  sc_chg_var(pps, (Variable)ENTITY(CAR(pc->lt)),
2422  (Variable)ent);
2423 
2424  if (get_debug_level() > 6) {
2425  fprint_psysteme(stderr, pps);
2426  }
2427 
2428  /* include the information on the test */
2429  pps = sc_append(pps, new_ps);
2430 
2431  if (get_debug_level() > 6) {
2432  fprint_psysteme(stderr, pps);
2433  }
2434 
2435  pcond = sc_rn(nbase);
2436  if(nbase != NULL) {
2437  /* recalculate the bounds for each variable of nbase */
2438  /* pps2 = new_loop_bound(pps, nbase); */
2440 
2441  if(!sc_consistent_p(pps)) {
2442  pps->base = (Pbase) NULL;
2443  sc_creer_base(pps);
2444  pps->nb_eq = nb_elems_list(sc_egalites(pps));
2445  pps->nb_ineq = nb_elems_list(sc_inegalites(pps));
2446  }
2447 
2448  algorithm_row_echelon(pps, nbase, &pcond, &pps2);
2449  }
2450  else
2451  pps2 = pps;
2452 
2453  if (get_debug_level() > 6) {
2454  fprint_psysteme(stderr, pps2);
2455  fprint_psysteme(stderr, pcond);
2456  }
2457 
2458  if(!sc_empty_p(pcond)) {
2459  /* deux derniers parametres a revoir */
2460  llp = separate_variables(pps2, base_to_list(nbase),
2461  &pps3, 0);
2462 
2463  /* build the "forall p" loop around the instruction */
2464  lp = gen_nreverse(gen_copy_seq(pc->lp));
2465  if (get_debug_level() > 4) {
2466  fprintf(stderr,"\nListe des p : ");
2467  fprint_entity_list(stderr, lp);
2468  }
2469 
2470  /* the list is in the wrong order: reorder it */
2471  llp1 = llp;
2472  llp2 = NULL;
2473 
2474  if(nbase != NULL) {
2475  /* extract the list concerning the p's and reorder it */
2476  for (i = 1; i <= gen_length(pc->ltau); i++)
2477  llp1 = llp1->succ;
2478 
2479  while (llp1 != NULL) {
2480  llp3 = sl_new();
2481  llp3->psys = llp1->psys;
2482  if (get_debug_level() > 6) {
2483  fprint_psysteme(stderr, llp1->psys);
2484  }
2485  llp3->succ = llp2;
2486  llp2 = llp3;
2487  llp1 = llp1->succ;
2488  }
2489  }
2490 
2491  stat = MAKE_STATEMENT(new_i);
2492 
2493  /* Bounds of the local time */
2494  if(with_t) {
2495  lom = pc->lomega;
2496  get_bounds_expression(llp, CONS(ENTITY, ent, NIL),
2497  &lb, &ub);
2498 
2499  /* in lb we 've got the list of the lower bound of local time
2500  * (of the current dataflow). we are in the case of an
2501  * instruction dependant of the time */
2502  }
2503  else {
2504  expression cst_sched;
2505 
2506  cst_sched =
2508  (pc->t_bounds->psys->egalites->vecteur);
2509  NORMALIZE_EXPRESSION(cst_sched);
2510  ub = CONS(EXPRESSION, cst_sched, NIL);
2511 
2512  if(get_debug_level() > 6) {
2513  fprintf(stderr, "\nConstant Schedule : %s\n",
2514  expression_to_string(cst_sched));
2515  }
2516  }
2517 
2518  /* get a possible max for global time */
2519  *lmax = gen_nconc((*lmax), remove_minmax(CONS(EXPRESSION,
2520  EXPRESSION(CAR(ub)),
2521  NIL)));
2522 
2523  if(with_t) {
2524  Pvecteur vec_l;
2525  statement sa;
2526 
2527  /* initialize the local time, put the test
2528  introduces by algorithm_row_echelon and put it in
2529  the initialization list of stat called linit. */
2530  if (sc_rn_p(pcond))
2532  else if (sc_empty_p(pcond))
2533  sa = MAKE_STATEMENT(make_init_time(ent,
2534  int_to_expression(-1)));
2535  else
2537  CONS(STATEMENT,
2539  NIL),
2540  CONS(STATEMENT,
2542  NIL));
2543 
2544  ADD_ELEMENT_TO_LIST((*linit), STATEMENT, sa);
2545 
2546  /* HERE WE HAVE TO SUBSTITUTE minor time (tau) TO
2547  * local time (var) IN THE Ps LOOP BOUNDS : var =
2548  * omega*tau + l. "l" is the lower bound of the
2549  * local time of the current scell, NOT the lower
2550  * bound of the local time of the current dataflow
2551  * (cf. above). */
2552  vec_l =
2554  tau = ENTITY(CAR(pc->ltau));
2555  omega = INT(CAR(pc->lomega));
2556  var = ent;
2557  val = 1;
2558  vec = vect_add(vec_l, vect_new((Variable) tau, omega));
2559  }
2560  else {
2561  /* We substitute the time variable by its constante
2562  value */
2563  var = ENTITY(CAR(pc->lt));
2564  val = 1;
2565  vec = (Pvecteur) normalized_linear
2567  }
2568 
2569  /* build the loop on p's */
2570  for (; lp != NIL; lp = CDR(lp)) {
2571  pps = llp2->psys;
2572 
2573  if (get_debug_level() > 6) {
2574  fprintf(stderr,
2575  "\nBEFORE subs: var = %s, val = 1, vec = ",
2576  entity_local_name(var));
2577  pu_vect_fprint(stderr, vec);
2578  fprint_psysteme(stderr, pps);
2579  }
2580 
2581  /* The substitution */
2582  substitute_var_with_vec(pps, var, val, vec);
2583 
2584  if (get_debug_level() > 6) {
2585  fprintf(stderr, "\nAFTER subs:\n");
2586  fprint_psysteme(stderr, pps);
2587  }
2588 
2589  ran = make_bounds(pps, ENTITY(CAR(lp)), IS_LOOP_BOUNDS, NIL, NIL);
2590  loo = make_loop(ENTITY(CAR(lp)), ran, stat,
2593  UU), NIL);
2594  new_i = make_instruction(is_instruction_loop, loo);
2595  stat = MAKE_STATEMENT(new_i);
2596  llp2 = llp2->succ;
2597  }
2598 
2599  lstat = NIL;
2600  ADD_ELEMENT_TO_LIST(lstat, STATEMENT, stat);
2601 
2602  if (get_debug_level() > 6) {
2603  fprintf(stderr,
2604  "\nInstruction en milieu de build_third_comb() :\n");
2605  sa_print_ins(stderr, new_i);
2606  }
2607 
2608  tim = get_time_ent(0, STRING_BDT, 0);
2609  if(with_t) {
2610  /* increment the local time of omega */
2612  INT(CAR(pc->lomega)));
2614 
2615  /* build test on local time: if t>ub then t=-1 */
2616  ins = build_local_time_test(ent, ub);
2618 
2619  /* build the test on global time: IF t == t_local */
2622  NIL));
2623  }
2624  else {
2625  /* build the test on global time IF t == cst */
2627  }
2628 
2629  /* encapsulate everything in a block */
2630  ins = make_instruction_block(lstat);
2631  stat = MAKE_STATEMENT(ins);
2632 
2633  /* Put the test on global time around it */
2635  make_test(exp, stat,
2637 
2638  if (get_debug_level() > 6) {
2639  fprintf(stderr,
2640  "\nInstruction en sortie de build_third_comb() :\n");
2641  sa_print_ins(stderr, ins);
2642  }
2643 
2645  }
2646  else
2647  /* We can reuse the local time variable */
2648  (*c)--;
2649  }
2650  else
2651  /* We can reuse the local time variable */
2652  (*c)--;
2653 
2654  ldf = CDR(ldf);
2655  lm = CDR(lm);
2656 
2657  if (get_debug_level() > 4)
2658  fprintf(stderr,"\nFin d'un dataflow");
2659  }
2660 
2661  /* end of while */
2662  }
2663 
2664  if (get_debug_level() > 4)
2665  fprintf(stderr, "\nBuild_third_comb end");
2666 
2667  return(li);
2668 }
2669 
2670 
2671 /*======================================================================*/
2672 /* Pmytest build_third_subcomb(old_ref, cls, assign_i, pc, sc):
2673  * make reindexation on a reference we know it is not the last one,
2674  * which means that we can't build the new complete instruction. We
2675  * work on the copy of the instruction, and we return a list of
2676  * "mytest", the test is the possible new test introduced by the
2677  * dataflows, and the reindexed instruction is in the field "true".
2678  *
2679  * Parameters:
2680  * old_ref: current reference
2681  * cls: current list of predecessors
2682  * assign_i: current instruction
2683  * pc: current Pscell
2684  * sc: current domain
2685  *
2686  * Result:
2687  *
2688  * AC 94/05/15 */
2689 
2690 static Pmytest build_third_subcomb(old_ref, cls, assign_i, pc, sc)
2691 list cls;
2692 instruction assign_i;
2693 Pscell pc;
2694 reference old_ref;
2695 Psysteme sc;
2696 {
2697  instruction ins, new_i;
2698  Psysteme new_ps;
2699  predicate pred;
2700  dataflow df;
2701  reference new_ref;
2702  int m;
2703  list ldf = NIL, lm;
2704  Pmytest lins = NULL, tes = NULL;
2705 
2706  if (get_debug_level() > 4)
2707  fprintf(stderr, "\nBuild_third_subcomb begin");
2708 
2709  /* get the list of dataflows */
2710  if (pc != NULL)
2711  ldf = dataflows_on_reference(cls, old_ref, pc->domain, &lm);
2712 
2713  if (ldf == NIL) {
2714  /* special case where we replace juste the old variables by the */
2715  /* new ones without changing the name of the reference */
2716  if (get_debug_level() > 5) fprintf(stderr,"\nOOPPS!! pas de reference\n");
2717  new_ref = include_trans_on_LC_in_ref(copy_reference(old_ref), pc);
2718  ins = copy_instruction(assign_i);
2719  rhs_subs_in_ins(ins, old_ref, new_ref);
2720  lins = create_mytest(SC_UNDEFINED, ins, instruction_undefined);
2721  }
2722  else {
2723  if (get_debug_level() > 4)
2724  fprintf(stderr,"\nNombre de dataflow: %d", gen_length(ldf));
2725 
2726  while (ldf != NIL) {
2727  df = DATAFLOW(CAR(ldf));
2728  m = INT(CAR(lm));
2729 
2730  /* make the reindexation really if the source ("m") is not the
2731  * original sin, oopps!, node. */
2732  if (m == ENTRY_ORDER)
2733  new_ref = include_trans_on_LC_in_ref(copy_reference(old_ref), pc);
2734  else
2735  new_ref = make_reindex(df, m, assign_i, pc);
2736  new_i = copy_instruction(assign_i);
2737  rhs_subs_in_ins(new_i, old_ref, new_ref);
2738 
2739  /* include the right conditions on the instruction we build */
2740  pred = dataflow_governing_pred(df);
2741  new_ps = sc_dup(predicate_to_system(pred));
2742 
2743  if (!SC_UNDEFINED_P(new_ps)) {
2744  /* we put around the ins the test C(t, p) */
2745  new_ps = include_trans_on_LC_in_sc(new_ps, pc);
2746  new_ps = sc_append(new_ps, sc);
2747  tes = create_mytest(new_ps, new_i, instruction_undefined);
2748  }
2749  else
2750  tes = create_mytest(sc, new_i, instruction_undefined);
2751 
2752  /* put the new element in the list we return */
2753  lins = add_elt_to_test_list(tes, lins);
2754 
2755  if (get_debug_level() > 4) {
2756  fprint_mytest(stderr, lins);
2757  fprintf(stderr,"\nFin d'un dataflow");
2758  }
2759 
2760  ldf = CDR(ldf);
2761  lm = CDR(lm);
2762  }
2763  }
2764 
2765  if (get_debug_level() > 4)
2766  fprintf(stderr, "\nBuild_third_subcomb end");
2767 
2768  return(lins);
2769 }
2770 
2771 /*======================================================================*/
2772 /* list build_second_comb(pc, clrhs, assign_i, cls, sc, linit, lmax):
2773  * we treat here each reference of the right hand side of the
2774  * instruction (rhs) and we distinguish two type of reference, the
2775  * last one and the others. We first treat "the others" where we apply
2776  * build_third_subcomb(), and then we apply on the last one
2777  * build_third_comb().
2778  *
2779  * Parameters:
2780  * pc: current Pscell
2781  * clrhs: current list of rhs
2782  * assign_i: current instruction
2783  * cls: current list of predecessors
2784  * sc: current bdt domain
2785  * linit: list of initialization instructions
2786  * lmax:
2787  *
2788  * Result:
2789  *
2790  * AC 94/04/28 */
2791 
2792 static list build_second_comb(pc, clrhs, assign_i, cls, sc, linit, lmax)
2793 Pscell pc;
2794 list clrhs, cls, *linit, *lmax;
2795 instruction assign_i;
2796 Psysteme sc;
2797 {
2798  instruction ins;
2799  list li = NIL, li2 = NIL, linit_aux = NIL, lmax_aux = NIL;
2800  reference crhs = REFERENCE(CAR(clrhs));
2801  Pmytest lins = NULL, lins1, lins2, lins3;
2802  Psysteme tes;
2803  int count = 0;
2804 
2805  /* the case clrhs = NIL should have treated in build_first_comb() */
2806  if (get_debug_level() > 4)
2807  fprintf(stderr, "\nBuild_second_comb begin");
2808 
2809  /* First we treat the case where we have several reference: we build a
2810  * list of "mytest" containing the copy of the instruction where the
2811  * current refernce has been replaced by its value and reindexed by the
2812  * function build_third_subcomb(). */
2813  while (clrhs->cdr != NIL) {
2814  lins2 = NULL;
2815 
2816  if (lins == NULL)
2817  lins = build_third_subcomb(crhs, cls, assign_i, pc, sc);
2818  else {
2819  for (lins1 = lins; lins1 != NULL; lins1 = lins1->succ) {
2820  ins = lins1->true;
2821  tes = lins1->test;
2822 
2823  lins3 = build_third_subcomb(crhs, cls, ins, pc, tes);
2824  lins2 = add_ltest_to_ltest(lins2, lins3);
2825  }
2826  lins = lins2;
2827  }
2828  clrhs = clrhs->cdr;
2829  crhs = REFERENCE(CAR(clrhs));
2830  }
2831 
2832  /* Now we are in the case where clrhs->cdr == NIL. We call here the
2833  * function build_third_comb(). What we build here is not a list of
2834  * mytest but a list of instruction. */
2835  if (lins != NULL) {
2836  lins2 = NULL;
2837 
2838  for (lins1 = lins; lins1 != NULL; lins1 = lins1->succ) {
2839  ins = lins1->true;
2840  tes = lins1->test;
2841  linit_aux = NIL;
2842  lmax_aux = NIL;
2843 
2844  li2 = build_third_comb(crhs, cls, ins, pc, tes, sc, &count,
2845  &linit_aux, &lmax_aux);
2846 
2847  *linit = ADD_LIST_TO_LIST((*linit), linit_aux);
2848  *lmax = ADD_LIST_TO_LIST((*lmax), remove_minmax(lmax_aux));
2849  li = ADD_LIST_TO_LIST(li2, li);
2850  }
2851  }
2852  else {
2853  linit_aux = NIL;
2854  lmax_aux = NIL;
2855 
2856  li = build_third_comb(crhs, cls, assign_i, pc, SC_RN, sc, &count,
2857  &linit_aux, &lmax_aux);
2858 
2859  *linit = ADD_LIST_TO_LIST((*linit), linit_aux);
2860  *lmax = ADD_LIST_TO_LIST((*lmax), remove_minmax(lmax_aux));
2861  }
2862 
2863  return(li);
2864 }
2865 
2866 /*======================================================================*/
2867 /* instruction build_first_comb(pc, ci, cls, cn, linit, lmax):
2868  *
2869  * Parameters:
2870  * pc: Pcurrent Pscell
2871  * ci: current instruction
2872  * cls: list of the predecessors of the instruction
2873  * cn: number of the instruction
2874  * linit: list of the initialization instructions
2875  * lmax: list
2876  *
2877  * Result:
2878  *
2879  * AC 94/04/22
2880  */
2881 
2882 static list build_first_comb(pc, ci, cls, cn, linit, lmax)
2883 Pscell pc;
2884 instruction ci;
2885 list cls, *linit, *lmax;
2886 int cn;
2887 {
2888  instruction assign_i = copy_instruction(ci), new_i;
2889  list n_indices = NIL, clrhs, lp;
2890  Psysteme new_sc, pps;
2891  list lins = NIL, linit_a = NIL, lmax_a = NIL;
2892  statement stat;
2893  Psyslist llp;
2894  loop loo;
2895  range ran;
2896  expression exp, exp2;
2897  Pvecteur vec;
2898  entity tim = get_time_ent(0, STRING_BDT, 0);
2899  instruction ins;
2900 
2901  if (pc != NULL)
2902  n_indices = base_to_list(pc->Nindices);
2903 
2904  if (get_debug_level() > 1) {
2905  fprintf(stderr,"\n** instruction build_firstomb_comb debut pour %d**\n",cn);
2906  fprintf(stderr,"\nInstruction en entree : ");
2907  sa_print_ins(stderr, assign_i);
2908  }
2909 
2910  /* Change the lhs of ci to a new array indexed by the englobing loop
2911  * indices: SAIn(i1,...ip), (i1,...,ip) are the new indices of the
2912  * englobing loops of ci. */
2913  my_lhs_subs_in_ins(assign_i, SAI, cn, n_indices);
2914 
2915  if (get_debug_level() > 1) {
2916  fprintf(stderr,"\nInstruction apres lhs_subs");
2917  sa_print_ins(stderr, assign_i);
2918  }
2919 
2920  /* construct the list of rhs */
2921  clrhs = get_rhs_of_instruction(assign_i);
2922 
2923  if (get_debug_level() > 2)
2924  fprintf(stderr,"\nNombre de reference a droite : %d\n",
2925  gen_length(clrhs));
2926 
2927  if (pc != NULL) {
2928  if (pc->succ != NULL) {
2929  /* the domain of the bdt is in multiple parts, we build a comb by
2930  * calling recursively build_first_comb() */
2931  new_sc = sc_dup(predicate_to_system(pc->edge_dom));
2932 
2933  if (gen_length(clrhs) != 0) {
2934  linit_a = NIL;
2935  lmax_a = NIL;
2936 
2937  lins = build_second_comb(pc, clrhs, assign_i, cls, new_sc,
2938  &linit_a, &lmax_a);
2939  *linit = ADD_LIST_TO_LIST((*linit), linit_a);
2940  *lmax = ADD_LIST_TO_LIST((*lmax), remove_minmax(lmax_a));
2941  }
2942  else {
2943  ADD_ELEMENT_TO_LIST(lins, INSTRUCTION, assign_i);
2944  hash_put(delay_table, (char *)cn, (char *)INFINITY);
2945  }
2946 
2947  linit_a = NIL;
2948  lmax_a = NIL;
2949  lins = ADD_LIST_TO_LIST(lins, build_first_comb(pc->succ, ci, cls,
2950  cn, &linit_a,
2951  &lmax_a));
2952  *linit = ADD_LIST_TO_LIST((*linit), linit_a);
2953  *lmax = ADD_LIST_TO_LIST((*lmax), remove_minmax(lmax_a));
2954  }
2955  else {
2956  /* the domain of the bdt is in one part */
2957  if (gen_length(clrhs) != 0) {
2958  linit_a = NIL;
2959  lmax_a = NIL;
2960  lins = build_second_comb(pc, clrhs, assign_i, cls, SC_RN,
2961  &linit_a, &lmax_a);
2962  *linit = ADD_LIST_TO_LIST((*linit), linit_a);
2963  *lmax = ADD_LIST_TO_LIST((*lmax), remove_minmax(lmax_a));
2964  }
2965  else {
2966  if (get_debug_level() > 4) {
2967  fprintf(stderr,"\nNo right hand side reference\n");
2968  }
2969 
2970  /* case of no right hand side reference */
2971  stat = MAKE_STATEMENT(assign_i);
2972 
2973  /* build the "forall p" loop around the instruction */
2974  lp = gen_nreverse(gen_copy_seq(pc->lp));
2975  if (get_debug_level() > 4) {
2976  fprintf(stderr,"\nListe des p : ");
2977  fprint_entity_list(stderr, lp);
2978  }
2979  llp = (pc->p_topology);
2980 
2981  for (; lp != NIL; lp = CDR(lp)) {
2982  pps = llp->psys;
2983 
2984  ran = make_bounds(pps, ENTITY(CAR(lp)), IS_LOOP_BOUNDS, NIL, NIL);
2985  loo = make_loop(ENTITY(CAR(lp)), ran, stat, entity_empty_label(),
2987  new_i = make_instruction(is_instruction_loop, loo);
2988  stat = MAKE_STATEMENT(new_i);
2989  llp = llp->succ;
2990  }
2991  hash_del(delay_table, (char *)cn);
2992  hash_put(delay_table, (char *)cn, (char *) INFINITY);
2993 
2994  /* the instruction has a constant schedule, in the system of
2995  * pc->t_bounds we have the value of the bdt */
2996  vec = (((pc->t_bounds)->psys)->egalites)->vecteur;
2997  if (!VECTEUR_NUL_P(vec))
2998  exp2 = Pvecteur_to_expression(vec);
2999  else
3000  exp2 = int_to_expression(0);
3001 
3002  /* put the test on global time IF t == bdt_value */
3003  exp = build_global_time_test_with_exp(tim, exp2);
3004 
3005  if (get_debug_level() > 6) {
3007  }
3008 
3009  (*lmax) = gen_nconc((*lmax), remove_minmax(CONS(EXPRESSION, exp2,
3010  NIL)));
3011 
3013  make_test(exp, stat, make_empty_statement()));
3014 
3016  }
3017  }
3018  /* If it exists, initialize the minor time and put it in the
3019  * initialization list of stat called linit. */
3020  if(pc->ltau != NIL) {
3022  int_to_expression(0));
3024  }
3025  }
3026 
3027  return(lins);
3028 }
3029 
3030 
3031 /*=======================================================================*/
3032 /* void re_do_it(graph the_dfg): function that redo the code by calling
3033  * the different functions necessary to do the job.
3034  *
3035  * AC 94/07/25
3036  */
3037 
3039  graph the_dfg;
3040  bdt the_bdt;
3041  plc the_plc;
3042 {
3043  extern hash_table h_node;
3044 
3045  list vl, sl, lstatg, ltim = NIL, laux, lins = NIL, lent;
3046  statement new_mod_stat;
3047  range ran;
3048  loop loo;
3049  statement stat;
3050  instruction ins, ins2;
3051  list linit, lstat, lmax = NIL;
3052  entity tim, fla;
3053  expression upper, lower, incr;
3054  call ca;
3055  Psysteme ps;
3056  Variable var;
3057 
3058 
3059  /* let's have a reverse DFG, i.e. the "successors" of an instruction i */
3060  /* are the instructions that may write the values used by i; */
3062 
3063  if (get_debug_level() > 2) {
3064  fprintf(stderr,"\nGraphe renverse comme la creme:");
3065  fprint_dfg(stderr, the_dfg);
3066  }
3067 
3068  /* we prepare here the different elements of the reindexing. The default
3069  * delay is -1. */
3070  for (vl = graph_vertices(the_dfg); !ENDP(vl); POP(vl)) {
3071  vertex cv = VERTEX(CAR(vl));
3074  (char *) -1);
3075  laux = prepare_reindexing(cv, the_bdt, the_plc);
3076  if ( gen_length(laux) > gen_length(ltim) )
3077  ltim = laux;
3078  }
3079 
3080  if(gen_length(ltim) > 1)
3081  user_error("re_do_it", "\nMulti dimensional case not treated yet\n");
3082 
3083  tim = ENTITY(CAR(ltim));
3084 
3085  /* Initialize the list of instructions of the body of the global
3086  * time loop. */
3087  sl = NIL;
3088 
3089  /* Initialize the list of instructions of initialization */
3090  linit = NIL;
3091 
3092  /* now we make the reindexation in the code */
3093  for (vl = graph_vertices(the_dfg); !ENDP(vl); POP(vl)) {
3094  vertex cv = VERTEX(CAR(vl));
3096  statement cs;
3097  instruction ci;
3098  list cls;
3099  Pscell pc;
3100 
3101  /* loop on vertices */
3102  if (cn != ENTRY_ORDER) {
3103  cs = adg_number_to_statement(cn);
3104  ci = statement_instruction(cs);
3105 
3106  if (get_debug_level() > 2)
3107  print_detailed_ins(ci);
3108 
3109  if (!assignment_statement_p(cs))
3110  user_error("reindexing", "Pas une assignation\n");
3111 
3112  /* cls is the list of predecessors of cv */
3113  cls = vertex_successors(cv);
3114 
3115  pc = (Pscell)hash_get(h_node, (char *)cn);
3116 
3117  /* Do the reindexation */
3118  lins = build_first_comb(pc, ci, cls, cn, &linit, &lmax);
3119 
3120  /* two cases here: either the list has one element and we do not
3121  * have to introduce a flag but we have to increment the minor time
3122  * (if it exists). Or, the list has more than one element and we
3123  * have to introduce a flag and put the incrementation of the minor
3124  * time in a test on the flag (if it exists). In both case, if there
3125  * is no minor time then we do nothing. */
3126 
3127  if(pc->ltau != NIL) {
3128  /* This list is to be the new value of "lins". */
3129  lstatg = NIL;
3130 
3131  if (lins->cdr != NIL) {
3132  /* introducing the flag */
3134 
3135  for (; lins != NIL; lins = CDR(lins)) {
3136  instruction aux_ins;
3137 
3138  /* Each instruction is composed of tests perfectly nested with
3139  * a non empty instruction in the true part. */
3140  ins = INSTRUCTION(CAR(lins));
3141 
3143  user_error("re_do_it", "Not a test\n");
3144 
3146  while(instruction_tag(aux_ins) != is_instruction_block) {
3147  if(instruction_tag(aux_ins) != is_instruction_test)
3148  user_error("re_do_it", "Not a test\n");
3149 
3150  aux_ins = statement_instruction
3151  (test_true(instruction_test(aux_ins)));
3152  }
3153  lstat = instruction_block(aux_ins);
3154 
3155  /* create the statement: flag = true, and add it at the
3156  * end of the block */
3157  ins2 = build_flag_assign(fla, true);
3160  (test_true(instruction_test(ins)))) = lstat;
3161 
3162  /* Put this statement in "lstatg", the new value of
3163  * "lins". */
3165  }
3166 
3167  /* add the test on the flag */
3168  ins = build_flag_test(fla, ENTITY(CAR(pc->ltau)));
3170 
3171  /* set the flag to false, i.e. reinitialization */
3172  ins = build_flag_assign(fla, false);
3174 
3175  /* initialize the flag to false in "linit" */
3176  ins = build_flag_assign(fla, false);
3178  }
3179  else {
3180  ins = INSTRUCTION(CAR(lins));
3182 
3183  /* increment the minor time */
3184  ins2 = make_increment_instruction(ENTITY(CAR(pc->ltau)),1);
3186 
3188 
3189  /* no flag to introduce */
3191  }
3192  }
3193  else {
3194  lstatg = NIL;
3195  for (; lins != NIL; lins = CDR(lins)) {
3196  ins = INSTRUCTION(CAR(lins));
3198  }
3199  }
3200  /* put all the pieces of lstatg in one statement */
3201  ins = make_instruction_block(lstatg);
3202 
3203  /* put the new statement in the list representing the program */
3205  }
3206  /* end of loop on vertices */
3207  }
3208 
3209  if (get_debug_level() > 1) {
3210  fprintf(stderr,
3211  "\n\n****************************************************");
3212  fprintf(stderr,"\nCODE BEFORE DELAY");
3213  fprintf(stderr,
3214  "\n****************************************************\n\n");
3215  sa_print_ins(stderr, make_instruction_block(sl));
3216  fprintf(stderr,
3217  "\n\n****************************************************\n");
3218  }
3219 
3220  /* now, we have to take into account the value of the delay calculated, */
3221  /* i.e. we go through the code and replace each first time dimension of */
3222  /* each instruction by the same expression modulo the delay. */
3224 
3225  /* ICI il faudrait pouvoir construire les boucles sur les differentes */
3226  /* dimension du temps global et non 1 seule dimension !! */
3227  /* voir aussi le probleme des bornes de ces variables */
3228 
3229  /* Computation of the array bounds, one per instruction */
3230  for (vl = graph_vertices(the_dfg); !ENDP(vl); POP(vl)) {
3231  vertex cv = VERTEX(CAR(vl));
3232  make_array_bounds(cv);
3233  }
3234 
3235  /* Build the loop on the global time, the body is "sl" */
3237  tim = get_time_ent(0, STRING_BDT, 0);
3238 
3239  /* We have to simplify the list of the possible upper bounds to put in
3240  * our MAX expression. This is done by using the function
3241  * simplify_minmax() with a context specifying that each structure
3242  * parameter is positive. The list "lparams" is a global variables
3243  * giving these parameters. */
3244  ps = sc_new();
3245  for (lent = lparams; lent != NIL; lent = CDR(lent)) {
3246  var = (Variable)ENTITY(CAR(lent));
3248  }
3249  sc_creer_base(ps);
3250  ca = make_call(entity_intrinsic("MAX"), simplify_minmax(lmax, ps,
3251  IS_MAX));
3254  lower = int_to_expression(0);
3255  incr = int_to_expression(1);
3256  ran = make_range(lower, upper, incr);
3257 
3258  loo = make_loop(tim, ran, stat, entity_empty_label(),
3261 
3262  /* add the statement to all statements of initialization */
3264 
3265  /* "sl" becomes the lists of all the instructions of the parallel
3266  * program. */
3267  sl = linit;
3268 
3269  new_mod_stat = MAKE_STATEMENT(make_instruction_block(sl));
3270 
3271  if (get_debug_level() > 1) {
3272  fprintf(stderr,
3273  "\n\n****************************************************");
3274  fprintf(stderr,"\nCODE FINAL");
3275  fprintf(stderr,
3276  "\n****************************************************\n\n");
3277  sa_print_ins(stderr, statement_instruction(new_mod_stat));
3278  fprintf(stderr,
3279  "\n\n****************************************************\n");}
3280 
3281  return(new_mod_stat);
3282 }
execution make_execution(enum execution_utype tag, void *val)
Definition: ri.c:838
instruction copy_instruction(instruction p)
INSTRUCTION.
Definition: ri.c:1115
call make_call(entity a1, list a2)
Definition: ri.c:269
normalized make_normalized(enum normalized_utype tag, void *val)
Definition: ri.c:1447
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
Definition: ri.c:1301
predicate make_predicate(Psysteme a1)
Definition: ri.c:1820
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
reference copy_reference(reference p)
REFERENCE.
Definition: ri.c:2047
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
static int count
Definition: SDG.c:519
void fprint_dfg(FILE *fp, graph obj)
===========================================================================
statement adg_number_to_statement(int in_nb)
======================================================================
Definition: adg_utils.c:461
#define VALUE_ZERO
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
#define value_gt(v1, v2)
#define VALUE_TO_INT(val)
#define value_uminus(val)
unary operators on values
void const char const char const int
#define value_notone_p(val)
#define VALUE_MONE
#define value_zero_p(val)
int Value
#define VALUE_ONE
#define value_abs(val)
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
#define value_mod(v1, v2)
#define value_lt(v1, v2)
#define value_div(v1, v2)
#define value_posz_p(val)
Value ppcm(Value, Value)
ppcm.c
Definition: ppcm.c:42
void fprint_string_Value(FILE *, char *, Value)
Definition: io.c:47
static list lexp
#define EXIT_ORDER
#define ENTRY_ORDER
@ INT
Definition: atomic.c:48
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 predicate_to_system(predicate p)
=================================================================
Definition: bdt_utils.c:298
void analyze_expression(expression *e, int *d)
=====================================================================
Definition: bdt_utils.c:480
range make_bounds(Psysteme ps, entity ent, int array_or_loop, list lvar, list lrange)
=====================================================================
Definition: bounds.c:413
void set_array_declaration(entity var_to_decl, list lrange)
Name : bounds.c Package : reindexing Author : Alexis Platonoff Date : March 1995 Historic :
Definition: bounds.c:95
void get_bounds_expression(Psyslist sys, list lt, list *lb, list *ub)
=====================================================================
Definition: bounds.c:497
Psyslist separate_variables(Psysteme ps, list l, Psysteme *sp, int c)
========================================================================
Definition: bounds.c:622
Psyslist separate_variables_2(Psysteme ps, list l, Psysteme *sp, int c)
========================================================================
Definition: bounds.c:711
static int num
Definition: bourdoncle.c:137
struct scell scell
type cell that contains all information for the reindexation of
struct scell * Pscell
#define DOUBLE_PRECISION_SIZE
Definition: cell.c:676
dfg_arc_label arc_label
Definition: cell.c:107
#define STRING_PLC
Definition: cell.c:93
static void calculate_delay(expression exp, Pscell pcs, Pscell pcd, entity tau)
========================================================================
Definition: cell.c:328
static Psysteme include_trans_on_LC_in_sc2(Psysteme ps, Pscell pc, Pbase b)
=======================================================================
Definition: cell.c:923
static Psysteme include_trans_on_LC_in_sc(Psysteme ps, Pscell pc)
=======================================================================
Definition: cell.c:806
#define DOUBLE_DEC
Definition: cell.c:174
#define STRING_TAU
Definition: cell.c:94
static Pmytest add_ltest_to_ltest(Pmytest l1, Pmytest l2)
=======================================================================
Definition: cell.c:298
#define INTEGER_DEC
We define a set of constant in order to a more generic function for the insert of the declarations of...
Definition: cell.c:170
#define LOGICAL_DEC
Definition: cell.c:173
static Pbase include_time_in_base(Pscell pc, entity e)
=====================================================================
Definition: cell.c:199
static void fprint_mytest(FILE *fp, Pmytest t)
=======================================================================
Definition: cell.c:274
static Pmytest build_third_subcomb(reference old_ref, list cls, instruction assign_i, Pscell pc, Psysteme sc)
=====================================================================
Definition: cell.c:2690
void make_array_bounds(vertex cv)
===================================================================
Definition: cell.c:699
struct newinst newinst
type of new instruction which contains information about the loop
static list build_first_comb(Pscell pc, instruction ci, list cls, int cn, list *linit, list *lmax)
=====================================================================
Definition: cell.c:2882
#define CHARACTER_DEC
Definition: cell.c:175
void substitute_expressions(expression exp, list l_ind, list l_exp)
=====================================================================
Definition: cell.c:1971
dfg_vertex_label vertex_label
Internal variables
Definition: cell.c:106
static reference make_reindex(dataflow crt_df, int crt_m, instruction assign_i, Pscell pc)
========================================================================
Definition: cell.c:1671
#define COMPLEX_DEC
Definition: cell.c:172
#define REAL_DEC
Definition: cell.c:171
#define MAKE_STATEMENT(ins)
Definition: cell.c:97
#define IS_MIN
Definition: cell.c:189
struct newinst * Pnewinst
struct mytest mytest
type of a test, the same as the "normal" test except that the
static list build_second_comb(Pscell pc, list clrhs, instruction assign_i, list cls, Psysteme sc, list *linit, list *lmax)
=====================================================================
Definition: cell.c:2792
list prepare_reindexing(vertex v, bdt b, plc p)
=======================================================================
Definition: cell.c:952
static list build_third_comb(reference old_ref, list cls, instruction assign_i, Pscell pc, Psysteme te, Psysteme sc, int *c, list *linit, list *lmax)
=====================================================================
Definition: cell.c:2065
#define IS_MAX
Definition: cell.c:190
struct mytest * Pmytest
void substitute_loop_indices(instruction ins, list l_ind, list l_exp)
=====================================================================
Definition: cell.c:2019
static Pmytest add_elt_to_test_list(Pmytest te, Pmytest lte)
=====================================================================
Definition: cell.c:247
static reference include_trans_on_LC_in_ref(reference re, Pscell pc)
=======================================================================
Definition: cell.c:829
static void prepare_array_bounds(Pscell pc)
===================================================================
Definition: cell.c:503
static bool compatible_pc_p(Pscell pcd, Pscell pcs, int s, dataflow d)
========================================================================
Definition: cell.c:1601
static Pmytest create_mytest(Psysteme ps, instruction ins1, instruction ins2)
=======================================================================
Definition: cell.c:224
#define STRING_BDT
Name : cell.c Package : reindexing Author : Alexis Platonoff & Antoine Cloue Date : april 1995 Histor...
Definition: cell.c:92
statement re_do_it(graph the_dfg, bdt the_bdt, plc the_plc)
======================================================================
Definition: cell.c:3038
#define STRING_FLAG
Definition: cell.c:95
#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
int nb_elems_list(Pcontrainte)
int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes
Definition: listes.c:129
expression Psysteme_to_expression(Psysteme)
system_to_code.c
statement generate_optional_if(Psysteme, statement)
statement generate_optional_if(sc, stat)
Pdisjunct dj_append_system(Pdisjunct in_dj, Psysteme in_ps)
Pdisjunct dj_append_system( (Pdisjunct) in_dj, (Psysteme) in_ps ) Input : A disjunct in_dj to wich in...
Definition: disjunct.c:403
void * malloc(YYSIZE_T)
#define vertex_vertex_label(x)
Definition: graph.h:152
#define vertex_successors(x)
Definition: graph.h:154
#define graph_vertices(x)
Definition: graph.h:82
#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
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
#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_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
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
bool assignment_statement_p(statement)
Test if a statement is an assignment.
Definition: statement.c:135
statement st_make_nice_test(expression, list, list)
Definition: statement.c:1585
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
void * hash_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:439
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 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
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
Psysteme include_trans_in_sc(int s, Psysteme sys, list l)
=================================================================
Definition: makebdt.c:1227
Psyslist add_sc_to_sclist(Psysteme sc, Psyslist lsys)
=================================================================
Definition: makebdt.c:1985
#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_free(m)
Allocation et desallocation d'une matrice.
Definition: matrix-local.h:73
Pmatrix matrix_new(int m, int n)
package matrix
Definition: alloc.c:41
void matrix_hermite(Pmatrix MAT, Pmatrix P, Pmatrix H, Pmatrix Q, Value *det_p, Value *det_q)
package matrix
Definition: hermite.c:78
void matrix_general_inversion(Pmatrix a, Pmatrix inv_a)
void matrix_general_inversion(Pmatrix a; Pmatrix inv_a) calcul de l'inversion du matrice general.
Definition: inversion.c:216
void matrix_add(Pmatrix a, Pmatrix b, Pmatrix c)
a = b + c
Definition: matrix.c:471
void matrix_multiply(const Pmatrix a, const Pmatrix b, Pmatrix c)
void matrix_multiply(Pmatrix a, Pmatrix b, Pmatrix c): multiply rational matrix a by rational matrix ...
Definition: matrix.c:95
void matrix_normalize(Pmatrix a)
void matrix_normalize(Pmatrix a)
Definition: matrix.c:136
void matrix_fprint(FILE *, Pmatrix)
matrix_io.c
Definition: matrix_io.c:44
#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 MODULE_SEP_STRING
Definition: naming-local.h:30
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
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
struct cons * list
Definition: newgen_types.h:106
#define BASE_NODE_NUMBER
const char * pu_variable_name(Variable)
package mapping : Alexis Platonoff, april 1993
Definition: print.c:421
void vecteur_fprint(FILE *, Pcontrainte, const char *(*)(entity))
void pu_vect_fprint(FILE *, Pvecteur)
===========================================================================
Definition: print.c:446
list static_control_to_indices(static_control)
package mapping : Alexis Platonoff, july 1993
Definition: utils.c:1037
void substitute_var_with_vec(Psysteme, entity, Value, Pvecteur)
===========================================================================
Definition: utils.c:1210
list simplify_minmax(list, Psysteme, int)
=================================================================
Definition: utils.c:2313
static_control get_stco_from_current_map(statement)
========================================================================
Definition: utils.c:2429
expression make_rational_exp(Pvecteur, Value)
=====================================================================
Definition: utils.c:2446
void fprint_psysteme(FILE *, Psysteme)
===========================================================================
Definition: print.c:302
void fprint_dataflow(FILE *, int, dataflow)
===========================================================================
Definition: print.c:229
#define DATAFLOW(x)
DATAFLOW.
Definition: paf_ri.h:308
#define dataflow_transformation(x)
Definition: paf_ri.h:342
#define placement_dims(x)
Definition: paf_ri.h:525
#define SCHEDULE(x)
SCHEDULE.
Definition: paf_ri.h:682
#define schedule_predicate(x)
Definition: paf_ri.h:715
#define dataflow_governing_pred(x)
Definition: paf_ri.h:344
#define dfg_vertex_label_statement(x)
Definition: paf_ri.h:413
#define schedule_dims(x)
Definition: paf_ri.h:717
#define dataflow_reference(x)
Definition: paf_ri.h:340
#define dfg_vertex_label_exec_domain(x)
Definition: paf_ri.h:415
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
string expression_to_string(expression e)
Definition: expression.c:77
void print_reference(reference r)
Definition: expression.c:142
bool vecteurs_libres_p(Psysteme sys, Pbase v_base, Pbase c_base)
========================================================================
Definition: utils.c:903
graph the_dfg
The placement function.
Definition: prgm_mapping.c:99
bdt the_bdt
The data flow graph.
Definition: prgm_mapping.c:100
#define SA_MODULE_NAME
#define INFINITY
define INFINITY 2147483647
#define IS_LOOP_BOUNDS
FI: moved into ri-util.
#define IS_NEW_ARRAY
#define IS_ARRAY_BOUNDS
#define SAI
hash_table delay_table
Name : delay.c Package : reindexing Author : Alexis Platonoff Date : March 1995 Historic :
Definition: reindexing.c:109
list add_delay_information(hash_table t, list sl)
======================================================================
Definition: delay.c:200
list lparams
Array bounds.
Definition: reindexing.c:111
hash_table h_node
Definition: reindexing.c:108
void build_contraction_matrices(int s, Psysteme ps, Pmatrix mH, int *c, Pmatrix *mQ, Pmatrix *mQ_inv, Pmatrix *mC, list *ln, list *lom, Pbase indx, Pbase cnst)
========================================================================
Definition: reindexing.c:197
hash_table ht_ab
Definition: reindexing.c:110
instruction build_flag_test(entity f, entity t)
======================================================================
Definition: reindexing.c:561
Psyslist build_list_of_min(Psyslist lsys, list lnew, Psysteme ps)
=======================================================================
Definition: reindexing.c:276
instruction build_local_time_test(entity t, list l)
======================================================================
Definition: reindexing.c:471
list dataflows_on_reference(list cls, reference crhs, predicate pred, list *lm)
=======================================================================
Definition: reindexing.c:398
expression build_global_time_test_with_exp(entity tg, expression exp)
======================================================================
Definition: reindexing.c:509
instruction make_init_time(entity en, expression ex)
======================================================================
Definition: reindexing.c:588
entity get_time_ent(int st, char *typ, int count)
==================================================================
Definition: reindexing.c:156
instruction make_increment_instruction(entity t, int i)
=====================================================================
Definition: reindexing.c:610
instruction build_flag_assign(entity f, bool val)
======================================================================
Definition: reindexing.c:531
entity create_new_entity(int st, char *typ, int nb)
========================================================================
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)
========================================================================
void matrix_coef_mult(Pmatrix A, Value nb)
========================================================================
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)
========================================================================
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 NORMALIZE_EXPRESSION(e)
#define is_instruction_block
soft block->sequence transition
#define DIVIDE_OPERATOR_NAME
#define instruction_block(i)
#define make_empty_statement
An alias for make_empty_block_statement.
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
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
entity entity_empty_label(void)
Definition: entity.c:1105
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 make_entity_expression(entity e, cons *inds)
Definition: expression.c:176
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
Definition: expression.c:1825
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
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
Definition: expression.c:2012
@ is_basic_string
Definition: ri.h:576
@ is_basic_float
Definition: ri.h:572
@ is_basic_int
Definition: ri.h:571
@ is_basic_logical
Definition: ri.h:573
@ is_basic_complex
Definition: ri.h:575
#define normalized_undefined
Definition: ri.h:1745
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
#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 reference_variable(x)
Definition: ri.h:2326
#define range_upper(x)
Definition: ri.h:2290
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define INSTRUCTION(x)
INSTRUCTION.
Definition: ri.h:1448
#define basic_tag(x)
Definition: ri.h:613
#define type_variable(x)
Definition: ri.h:2949
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_reference
Definition: ri.h:2691
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define instruction_undefined
Definition: ri.h:1454
#define entity_undefined
Definition: ri.h:2761
@ 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 RANGE(x)
RANGE.
Definition: ri.h:2257
#define normalized_tag(x)
Definition: ri.h:1778
#define expression_normalized(x)
Definition: ri.h:1249
#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 basic_float(x)
Definition: ri.h:619
#define expression_undefined_p(x)
Definition: ri.h:1224
#define range_lower(x)
Definition: ri.h:2288
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
@ is_execution_parallel
Definition: ri.h:1190
@ is_execution_sequential
Definition: ri.h:1189
#define call_arguments(x)
Definition: ri.h:711
#define instruction_test(x)
Definition: ri.h:1517
#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 entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
#define variable_basic(x)
Definition: ri.h:3120
@ is_normalized_linear
Definition: ri.h:1760
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
bool sc_consistent_p(Psysteme sc)
bool sc_consistent_p(Psysteme sc): check that sc is well defined, that the numbers of equalities and ...
Definition: sc.c:282
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
bool sc_rn_p(Psysteme sc)
bool sc_rn_p(Psysteme sc): check if the set associated to sc is the whole space, rn
Definition: sc_alloc.c:369
Psysteme sc_rn(Pbase b)
Psysteme sc_rn(Pbase b): build a Psysteme without constraints to define R^n, where n is b's dimension...
Definition: sc_alloc.c:336
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
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Definition: sc_alloc.c:350
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
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
void sl_fprint(in_fi, in_sl, char *(*in_fu)())
Definition: sc_list.c:447
Psyslist sl_new()
Psyslist sl_new() AL 26/10/93 Input : Nothing.
Definition: sc_list.c:277
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
void algorithm_row_echelon(Psysteme scn, Pbase base_index, Psysteme *pcondition, Psysteme *penumeration)
see comments above.
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
void sc_transform_eg_in_ineg(Psysteme sc)
Package sc.
void sc_chg_var(Psysteme s, Variable v_old, Variable v_new)
void sc_chg_var(Psysteme s, Variable v_old, Variable v_new) this function replace the variable v_old ...
Definition: sc_unaires.c:98
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
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 ifdebug(n)
Definition: sg.c:47
void sa_print_ins(FILE *fp, instruction i)
=========================================================================
list get_rhs_of_instruction(instruction ins)
=========================================================================
void rhs_subs_in_ins(instruction ins, reference r1, reference r2)
=========================================================================
graph my_dfg_reverse_graph(graph g)
======================================================================
int aux
Definition: solpip.c:104
void constraints_with_sym_cst_to_matrices(Pcontrainte, Pbase, Pbase, Pmatrix, Pmatrix)
=======================================================================
static char * x
Definition: split_file.c:159
package matrice
Definition: matrix-local.h:63
Pvecteur vecteur
struct Scontrainte * succ
Pcomplist pcomp
Definition: union-local.h:20
Psysteme psys
Definition: union-local.h:19
Warning! Do not modify this file that is automatically generated!
Definition: union-local.h:3
Psysteme psys
Definition: union-local.h:4
struct Ssyslist * succ
Definition: union-local.h:5
Pcontrainte egalites
Definition: sc-local.h:70
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
type of a test, the same as the "normal" test except that the
Definition: cell.c:146
struct mytest * succ
Definition: cell.c:151
Psysteme test
Definition: cell.c:147
instruction false
Definition: cell.c:149
instruction true
Definition: cell.c:148
type of new instruction which contains information about the loop
Definition: cell.c:156
struct newinst * succ
Definition: cell.c:164
instruction ins
Definition: cell.c:157
list lb
Definition: cell.c:161
list lomega
information about the local time
Definition: cell.c:160
list ub
Definition: cell.c:162
type cell that contains all information for the reindexation of
Definition: cell.c:111
list ltau
list of variable t created
Definition: cell.c:134
Pmatrix Rmat_inv
(to) = Rmat (i) + Smat
Definition: cell.c:127
Pmatrix Bmat
(i) = Tmat_inv(t) + Bmat_inv(n)
Definition: cell.c:123
Pmatrix Bmat_inv
Definition: cell.c:124
Pmatrix Rmat
Definition: cell.c:126
list lp
list of the period(s) of bdt
Definition: cell.c:132
Pmatrix Tmat_inv
(t) = Tmat(i) + Bmat(n)
Definition: cell.c:122
struct scell * succ
topology of the plc in function of t
Definition: cell.c:141
predicate domain
number of the node
Definition: cell.c:113
Pmatrix Smat_inv
Definition: cell.c:129
Psyslist t_bounds
list of the new indices
Definition: cell.c:138
Pbase var_base
predicate of the schedule
Definition: cell.c:116
Pbase con_base
(to) = Rmat(i) + Smat(n)
Definition: cell.c:117
Pbase Nindices
new systeme of bounds in (t,p,..)
Definition: cell.c:137
Pbase Tbase_out
Definition: cell.c:119
Pmatrix Smat
(i) = Rmat_inv(to) + Smat_inv(n)
Definition: cell.c:128
Psysteme Nbounds
list of variable tau created
Definition: cell.c:136
Pbase Rbase_out
Definition: cell.c:118
Pmatrix Tmat
Definition: cell.c:121
Psyslist p_topology
bounds of global time for the ins
Definition: cell.c:139
predicate edge_dom
complete domain of the bdt
Definition: cell.c:114
list lomega
Definition: cell.c:131
list lt
list of variable p created
Definition: cell.c:133
int statement
Definition: cell.c:112
#define pa_faisabilite(pa)
Definition: union-local.h:112
#define pa_new()
Definition: union-local.h:111
#define DJ_UNDEFINED
Definition: union-local.h:12
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define NO_OFL_CTRL
struct Svecteur * Pbase
struct Svecteur * Pvecteur
#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
#define base_dimension(b)
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51
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
Pvecteur vect_cl_ofl_ctrl(Pvecteur v, Value lambda, Pvecteur u, int ofl_ctrl)
Pvecteur vect_cl_ofl_ctrl(Pvecteur v, Value lambda, Pvecteur u, int ofl_ctrl): etape d'acculumulation...
Definition: binaires.c:128
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_normalize(Pvecteur v)
void vect_normalize(Pvecteur v): division de tous les coefficients de v par leur pgcd; "normalisation...
Definition: unaires.c:59