PIPS
guard_elimination.c
Go to the documentation of this file.
1 /*
2 
3  $Id: guard_elimination.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 /*#include <sys/ddi.h>*/
29 
30 #include "genC.h"
31 
32 #include "linear.h"
33 #include "matrice.h"
34 #include "sparse_sc.h"
35 
36 #include "ri.h"
37 #include "database.h"
38 #include "resources.h"
39 #include "misc.h"
40 #include "ri-util.h"
41 #include "prettyprint.h" // for sc_syst_debug()
42 #include "pipsdbm.h"
43 #include "control.h"
44 #include "conversion.h"
45 #include "hyperplane.h"
46 
49 bool if1=false,if2=false;
50 
51 typedef struct
52 {
55 
56 static Value myceil( k,m)
57  Value k,m;
58 {
59  Value res;
60  res = value_div(k,m);
61  if(value_mod(k,m)==0) return res;
62  else
63  {
64  if ( value_direct_multiply(k,m)>=0 ) return res+1;
65  else return res;
66  }
67 }
68 
69 static Value myfloor ( k , m)
70  Value k,m;
71 {
72  Value res;
73  res = value_div(k,m);
74  if(value_mod(k,m)==0) return res;
75  else
76  {
77  if ( value_direct_multiply(k,m)>=0 ) return res;
78  else return res-1;
79  }
80 }
81 
82 static Value eval(pv,val,var)
83  Pvecteur pv;
84  Value val;
85  Variable var;
86 {
87  Value coef, cons;
88  coef = vect_coeff(var,pv);
89  cons = vect_coeff(TCST,pv);
90  return (coef * val +cons ) ;
91 }
92 
93 static Value eval2(val0,val1,val2,val)
94  Value val0,val1,val2,val;
95 {
96  return ( value_div(value_direct_multiply (val1,val)+val0,-val2 )) ;
97 }
98 
99 
100 static Value intersection (pv1, pv2,var,floor)
101  Pvecteur pv1,pv2;
102  Variable var;
103  int floor ;
104 {
105  if (floor==1)
106  return
108  vect_coeff(var,pv1 )- vect_coeff(var,pv2 ) );
109  else
110  return
111  myceil(vect_coeff(TCST,pv2) -vect_coeff(TCST,pv1),
112  vect_coeff(var,pv1 )- vect_coeff(var,pv2 ) );
113 
114 }
115 
117 {
118  stack_push(s, context->statement_stack);
119  return true;
120 }
122 {
123  pips_assert("true", s==s && context==context);
124  stack_pop(context->statement_stack);
125 }
126 
128 {
129  /*DECLARATION */
130  statement s1=NULL,s2=NULL,s_in_loop_in_side=NULL,st=NULL;
131  int i=0,cas=0;
132  bool first1=true,first2=true;
133  Value val1=0,val2=0,f1_val1,f1_val2,f2_val1,f2_val2,e=0;
134  loop copyloop,loop_in_side=NULL;
135  Variable var1= (Variable)loop_index(l);
136  instruction ins,ins1,ins2;
137  sequence seq,seq1,seq2;
138  list lis=NIL,lis1=NIL,lis1par=NIL,lis2=NIL,lis2par=NIL;
139  range range;
140  expression lower, upper,index=NULL ;
141  normalized norm1, norm2;
142  Pvecteur pv1 ,pv2;
143  test t1,t2;
144  /*END OF DECLARATION */
145 
146  copyloop =copy_loop(l);
147  range=loop_range(l);
148  lower=range_lower(range);
149  upper=range_upper(range);
152  norm1=expression_normalized(lower);
153  norm2=expression_normalized(upper);
154  pips_assert("normalized are linear", normalized_linear_p(norm1)&&
155  normalized_linear_p(norm2));
156  pv1= normalized_linear(norm1);
157  pv2= normalized_linear(norm2);
158  val1= vect_coeff(TCST,pv1);
159  val2=vect_coeff(TCST,pv2);
161  if (instruction_sequence_p(ins))
162  {
163  seq = instruction_sequence(ins);
164  lis =sequence_statements(seq);
166  i++;
167  if(!(instruction_loop_p(ins1))&&first1 ) {
168  if (instruction_call_p(ins1 )) {
169  call ca= instruction_call(ins1 ) ;
170  if(strcmp(entity_name(call_function(ca)),"TOP-LEVEL:CONTINUE" )!=0){
171  if (i==1) { lis1=CONS(STATEMENT,s,NIL); lis1par=lis1;}
172  else {
173  CDR(lis1par)=CONS(STATEMENT,s,NIL);
174  lis1par=CDR(lis1par);
175  };
176  };
177  }
178  else
179  {
180  if (i==1) {
181  lis1=CONS(STATEMENT,s,NIL);
182  lis1par=lis1;
183  }
184  else {
185  CDR(lis1par)=CONS(STATEMENT,s,NIL);
186  lis1par=CDR(lis1par);
187  };
188  };
189  };
190  if( (instruction_loop_p(ins1))&&first1 ) {
191  loop_in_side=instruction_loop(ins1);
192  index= entity_to_expression(loop_index(loop_in_side));
193  s_in_loop_in_side=loop_body( loop_in_side );
194  range=loop_range(loop_in_side);
195  lower=range_lower(range);
196  upper=range_upper(range);
199  norm1=expression_normalized(lower);
200  norm2=expression_normalized(upper);
201  pips_assert("normalized are linear", normalized_linear_p(norm1) &&
202  normalized_linear_p(norm2));
203  pv1= normalized_linear(norm1);
204  pv2= normalized_linear(norm2);
205  f1_val1= eval(pv1,val1,var1);
206  f1_val2= eval(pv1,val2,var1);
207  f2_val1= eval(pv2,val1,var1);
208  f2_val2= eval(pv2,val2,var1);
209  if ( (f2_val1 >=f1_val1)&&(f2_val2 >=f1_val2)){
210  cas=1;
211  loop_body(l)=s;
212  }
213  else {
214  if ( (f2_val1 >=f1_val1)&&(f2_val2 <f1_val2)){
215  cas=2;
216  loop_body(l)=s;
217  e=intersection(pv1,pv2,var1,1);
218  }
219  else{
220  if ( (f2_val1 < f1_val1)&&(f2_val2 >= f1_val2)){
221  e=intersection(pv1,pv2,var1,2);
222  cas=3;
223  loop_body(l)=s;
224  }
225  else {
226  cas=4;
228  }
229  }
230  }
231  first1 =false;
232  i=0;
233  }
234  if ( (! first1 )&&(i !=0)) {
235  if (instruction_call_p(ins1 )) {
236  call ca= instruction_call(ins1 ) ;
237  if( strcmp( entity_name(call_function(ca)),"TOP-LEVEL:CONTINUE" )!=0){
238  if (i==1) {
239  lis2=CONS(STATEMENT,s,NIL);
240  lis2par=lis2;
241  }
242  else {
243  CDR(lis2par)=CONS(STATEMENT,s,NIL);
244  lis2par=CDR(lis2par);
245  };
246  };
247  }
248  else {
249  if (i==1)
250  {
251  lis2=CONS(STATEMENT,s,NIL);
252  lis2par=lis2;
253  }
254  else{
255  CDR(lis2par)=CONS(STATEMENT,s,NIL);
256  lis2par=CDR(lis2par);
257  };
258  };
259  };
260  lis=CDR(lis);
261  ;},lis);
262  switch (cas) {
263  case 1:{
264  switch (gen_length(lis1)) {
265  case 0 :{ break;}
266  case 1 :{ s1=STATEMENT(CAR(lis1)); break;}
267  default :{ seq1= make_sequence(lis1);
268  ins1= make_instruction_sequence(seq1);
269  s1= instruction_to_statement(ins1); break;
270  }
271  };
272  switch (gen_length(lis2)) {
273  case 0 :{ break;}
274  case 1 :{ s2=STATEMENT(CAR(lis2)); break;}
275  default :{ seq2= make_sequence(lis2);
276  ins2= make_instruction_sequence(seq2);
277  s2= instruction_to_statement(ins2); break;
278  }
279  };
280  if (gen_length(lis1)!=0)
281  { expression copyindex, copylower;
282  copyindex=copy_expression(index);
283  copylower=copy_expression(lower);
284  t1= make_test(eq_expression (copyindex,copylower),s1,
286  s1=test_to_statement(t1);
287  if1=true;
288  };
289  if (gen_length(lis2)!=0)
290  { expression copyindex, copyupper;
291  copyindex=copy_expression(index);
292  copyupper=copy_expression(upper);
293  t2= make_test(eq_expression (copyindex,copyupper) ,s2,
295  s2=test_to_statement(t2);
296  if2=true;
297  };
298  if (gen_length(lis2)!=0)
299  lis=CONS(STATEMENT , s2,NIL);
300  else{
302  lis=CONS(STATEMENT,s2,NIL);
303  };
304  lis=CONS(STATEMENT,s_in_loop_in_side,lis);
305  if (gen_length(lis1)!=0)
306  lis=CONS(STATEMENT,s1,lis);
307  else
309  seq= make_sequence(lis);
310  ins= make_instruction_sequence(seq);
311  s_in_loop_in_side= instruction_to_statement(ins);
312  loop_body(loop_in_side)=s_in_loop_in_side;
313  break ;
314  }
315  case 2:{
316  switch (gen_length(lis1)) {
317  case 0 :{ break;}
318  case 1 :{ s1=STATEMENT(CAR(lis1)); break;}
319  default :{ seq1= make_sequence(lis1);
320  ins1= make_instruction_sequence(seq1);
321  s1= instruction_to_statement(ins1); break;
322  }
323  };
324  switch (gen_length(lis2)) {
325  case 0 :{ break;}
326  case 1 :{ s2=STATEMENT(CAR(lis2)); break;}
327  default :{ seq2= make_sequence(lis2);
328  ins2= make_instruction_sequence(seq2);
329  s2= instruction_to_statement(ins2); break;
330  }
331  };
332  if (gen_length(lis1)!=0)
333  {
334  expression copyindex, copylower;
335  copyindex=copy_expression(index);
336  copylower=copy_expression(lower);
337  t1= make_test(eq_expression (copyindex,copylower),s1,
339  s1=test_to_statement(t1);
340  };
341  if (gen_length(lis2)!=0)
342  {
343  expression copyindex, copyupper;
344  copyindex=copy_expression(index);
345  copyupper=copy_expression(upper);
346  t2= make_test(eq_expression (copyindex,copyupper) ,s2,
348  s2=test_to_statement(t2);
349  };
350  if (gen_length(lis2)!=0)
351  lis=CONS(STATEMENT , s2,NIL);
352  else{
354  lis=CONS(STATEMENT,s2,NIL);
355  };
356  lis=CONS(STATEMENT,s_in_loop_in_side,lis);
357  if (gen_length(lis1)!=0)
358  lis=CONS(STATEMENT,s1,lis);
359  else
361  seq= make_sequence(lis);
362  ins= make_instruction_sequence(seq);
363  s_in_loop_in_side= instruction_to_statement(ins);
364  loop_body(loop_in_side)=s_in_loop_in_side;
366  st=stack_head(context->statement_stack);
367  s1=copy_statement (st);
368  ins1 = statement_instruction(loop_body(copyloop));
369  seq = instruction_sequence(ins1);
370  lis =sequence_statements(seq);
372  if( (instruction_loop_p(ins1))&&first2 ) {
374  first2=false;
375  };
376  lis=CDR(lis);
377  ;},lis);
378  range_lower(loop_range(copyloop))= int_to_expression(e+1);
379  s2=loop_to_statement(copyloop);
380  lis=CONS(STATEMENT,s1,CONS(STATEMENT,s2,NIL));
381  seq=make_sequence(lis);
382  ins=make_instruction_sequence(seq);
383  statement_instruction(st) = ins;
384  break ;
385  }
386 
387  case 3: {
388  switch (gen_length(lis1)) {
389  case 0 :{ break;}
390  case 1 :{ s1=STATEMENT(CAR(lis1)); break;}
391  default :{ seq1= make_sequence(lis1);
392  ins1= make_instruction_sequence(seq1);
393  s1= instruction_to_statement(ins1); break;
394  }
395  };
396  switch (gen_length(lis2)) {
397  case 0 :{ break;}
398  case 1 :{ s2=STATEMENT(CAR(lis2)); break;}
399  default :{ seq2= make_sequence(lis2);
400  ins2= make_instruction_sequence(seq2);
401  s2= instruction_to_statement(ins2); break;
402  }
403  };
404  if (gen_length(lis1)!=0)
405  {
406  expression copyindex, copylower;
407  copyindex=copy_expression(index);
408  copylower=copy_expression(lower);
409  t1= make_test(eq_expression (copyindex,copylower),s1,
411  s1=test_to_statement(t1);
412  if1=true;
413  };
414  if (gen_length(lis2)!=0)
415  {
416  expression copyindex, copyupper;
417  copyindex=copy_expression(index);
418  copyupper=copy_expression(upper);
419  t2= make_test(eq_expression (copyindex,copyupper) ,s2,
421  s2=test_to_statement(t2);
422  if2=true;
423  };
424  if (gen_length(lis2)!=0)
425  lis=CONS(STATEMENT , s2,NIL);
426  else{
428  lis=CONS(STATEMENT,s2,NIL);
429  };
430  lis=CONS(STATEMENT,s_in_loop_in_side,lis);
431  if (gen_length(lis1)!=0)
432  lis=CONS(STATEMENT,s1,lis);
433  else
435  seq= make_sequence(lis);
436  ins= make_instruction_sequence(seq);
437  s_in_loop_in_side= instruction_to_statement(ins);
438  loop_body(loop_in_side)=s_in_loop_in_side;
440  st=stack_head(context->statement_stack);
441  s2=copy_statement (st);
442  ins = statement_instruction(loop_body(copyloop));
443  seq = instruction_sequence(ins);
444  lis =sequence_statements(seq);
446  if( (instruction_loop_p(ins1))&&first2 ) {
448  first2=false;};
449  lis=CDR(lis);
450  ;},lis);
451  range_upper(loop_range(copyloop))= int_to_expression(e-1);
452  s1=loop_to_statement(copyloop);
453  lis=CONS(STATEMENT,s1,CONS(STATEMENT,s2,NIL));
454  seq=make_sequence(lis);
455  ins=make_instruction_sequence(seq);
456  statement_instruction(st) = ins;
457  break;}
458  case 4 :{ break;}
459  default :{break;}
460  };
461  };
462  return false;
463 }
464 
466  statement s ;
467 {
468  FILE *infp;
469  char *name_file;
470  cons *lls=NULL;
471  Psysteme sci; /* sc initial */
472  Psysteme scn; /* sc nouveau */
473  Psysteme sc_row_echelon;
474  Pbase base_oldindex = NULL;
475  Pbase base_newindex = NULL;
476  matrice A;
477  matrice G;
478  matrice AG;
479  matrice G_inv;
480  int n; /* number of index */
481  int m ; /* number of constraints */
482  statement s_lhyp;
483  Pvecteur *pvg;
484  Pbase pb;
485  expression lower, upper;
486  Pvecteur pv1 ;
487  loop l;
489  lls = CONS(STATEMENT,s,lls);
491  }
492  sci = loop_iteration_domaine_to_sc(lls, &base_oldindex);
493  sc_dump(sci);
494  n = base_dimension(base_oldindex);
495  m = sci->nb_ineq;
496  A = matrice_new(m,n);
497  sys_matrice_index(sci, base_oldindex, A, n, m);
498  name_file = user_request("nom du fichier pour la matrice T");
499  infp = safe_fopen(name_file,"r");
500  matrice_fscan(infp,&G,&n,&n);
501  safe_fclose(infp, name_file);
502  free(name_file);
503  G_inv = matrice_new(n,n);
504  matrice_general_inversion(G,G_inv,n);
505  AG = matrice_new(m,n);
506  matrice_multiply(A, G_inv, AG, m, n, n);
507  printf( " tototototo \n");
508  /* create the new system of constraintes (Psysteme scn) with
509  AG and sci */
510  scn = sc_dup(sci);
511  matrice_index_sys(scn, base_oldindex, AG, n,m );
512 
513  /* computation of the new iteration space in the new basis G */
514  sc_row_echelon = new_loop_bound(scn,base_oldindex);
515 
516 
517  /* change of basis for index */
518  change_of_base_index(base_oldindex, &base_newindex);
519 
520  sc_newbase = sc_change_baseindex(sc_dup(sc_row_echelon), base_oldindex, base_newindex);
521 
522 
526  /* generation of hyperplane code */
527  /* generation of bounds */
528  for (pb=base_newindex; pb!=NULL; pb=pb->succ) {
529  make_bound_expression(pb->var, base_newindex, sc_newbase, &lower, &upper);
530  }
531  /* loop body generation */
532  pvg = (Pvecteur *)malloc((unsigned)n*sizeof(Svecteur));
533  scanning_base_to_vect(G_inv,n,base_newindex,pvg);
534  pv1 = sc_row_echelon->inegalites->succ->vecteur;
535  (void)vect_change_base(pv1,base_oldindex,pvg);
537  lower = range_upper(loop_range(l));
538  upper= expression_to_expression_newbase(lower, pvg, base_oldindex);
539  /* FI: I do not know if the last parameter should be true or false */
540  s_lhyp = code_generation(lls, pvg, base_oldindex, base_newindex, sc_newbase, true);
541  printf(" finn \n");
542  return(s_lhyp);
543 }
545  statement s;
546 {
547  int isoler =-1,isoler2=-1;
548  instruction ins;
549  statement body1,body2,loop2=NULL;
550  sequence seqi,seqj,seq;
551  list lisi,lisj,lisjcopy,lis,lisjcopy2,lisp;
552  statement first, last=NULL;
553  expression exp;
555  Pvecteur pv1,pv2=NULL,pvif1=NULL,pvif2=NULL,pv_i_lower,pv_i_upper;
556  Pcontrainte cif1=NULL,cif2=NULL;
557  Value sommetg[4];
558  loop tab_loop[6], loop1;
559  instruction tab_instruction[6];
560  statement tab_statement[6];
561  int i=0,j;
562  Psommet vertice,e;
563  int nbr_vertice;
564  Variable indice1,indice2;
565  range range_i,range1,range2,range3;
566  /* sg_dump(sg); */
567  /* fprint_lsom(stderr, vertice,variable_dump_name ); */
568  ins =statement_instruction(s);
569  loop1=instruction_loop(ins);
570  body1=loop_body(instruction_loop(ins));
571  indice1=(Variable )loop_index(instruction_loop(ins));
572  range_i=loop_range(instruction_loop(ins));
576  vect_add_elem(&pv_i_lower,indice1,-1);
578  vect_add_elem(&pv_i_upper,indice1,-1);
579  ins =statement_instruction(body1);
580  seqi=instruction_sequence(ins);
581  lisi =sequence_statements(seqi);
582  MAP(STATEMENT,s1,{loop2 =s1; },lisi) ;
583  ins=statement_instruction(loop2);
584  indice2=(Variable )loop_index(instruction_loop(ins));
585  body2=loop_body(instruction_loop(ins));
586  ins =statement_instruction(body2);
587  seqj=instruction_sequence(ins);
588  lisj =sequence_statements(seqj);
589  lisjcopy= gen_full_copy_list(lisj);
590  first= (statement )CHUNK( CAR(lisj));
591  nbr_vertice=sg_nbre_sommets(sg);
592  printf(" le nombre de sommet est %d \n", nbr_vertice);
593  vertice= sg_sommets(sg);
594  for (e = vertice; e != NULL; e = e->succ) {
595  pv1=e->vecteur;
596  sommetg[i]=value_div (vect_coeff(indice1,pv1),e->denominateur);
597  i++;
598  };
599  for(i=0;i<=nbr_vertice-1;i++)
600  {
601  for(j=i+1;j<= nbr_vertice;j++)
602  if( sommetg[j]< sommetg[i] )
603  {
604  Value permut;
605  permut= sommetg[i];
606  sommetg[i]= sommetg[j];
607  sommetg[j]=permut;
608  };
609  };
610  for(i=0;i<= nbr_vertice-1;i++)
611  {
612  if( sommetg[i]== sommetg[i+1] )
613  {
614  for (j=i;j<=nbr_vertice-1;j++)
615  sommetg[j]=sommetg[j+1];
616  nbr_vertice--;
617  };
618  };
619  i=0;
620  MAP(STATEMENT,s1, { last =s1; },lisjcopy) ;
621  if (if1){
622  Pcontrainte peq;
623  syntax syntax;
624  call call;
625  list lis;
626  CHUNK(CAR(lisjcopy))= (gen_chunk *)
633  lis =call_arguments(call);
634  exp=(expression )CHUNK(CAR(lis));
636  pv1=normalized_linear(norm);
637  MAP(EXPRESSION,exp,{
639  pv2=normalized_linear(norm);
640  },lis) ;
641  pvif1=vect_substract(pv1,pv2);
643  for (peq = sc_newbase->inegalites;peq!=NULL;peq=peq->succ){
644  if( vect_oppos(pvif1,peq->vecteur))
645  pvif1=vect_substract(VECTEUR_NUL,vect_dup(pvif1));
646  };
647  cif1=contrainte_make(pvif1);
651  }
652  if(if2){
653  Pcontrainte peq;
654  syntax syntax;
655  call call;
656  list lis;
657  CHUNK(CAR(gen_last(lisjcopy)))= (gen_chunk *)
664  lis =call_arguments(call);
665  exp=(expression) CHUNK(CAR(lis));
667  pv1=normalized_linear(norm);
668  MAP(EXPRESSION,exp,{
670  pv2=normalized_linear(norm);
671  },lis) ;
672  pvif2=vect_substract(pv1,pv2);
673  for (peq = sc_newbase->inegalites;peq!=NULL;peq=peq->succ){
674  if( vect_oppos(pvif2,peq->vecteur))
675  pvif2= vect_substract(VECTEUR_NUL,vect_dup(pvif2)) ;
676  }
677  cif2=contrainte_make(pvif2);
681  (exp, int_to_expression(0) );
682  }
683  lis=NIL;
684  lisjcopy2= gen_full_copy_list(lisjcopy);
685  if(if1) CHUNK( CAR( (lisjcopy2)))= (gen_chunk *) make_block_statement(NIL);
686  if(if2)CHUNK(CAR(gen_last((lisjcopy))))= (gen_chunk *) make_block_statement(NIL);
687  for(i=0;i<=2*nbr_vertice-2;i++){
688  Pcontrainte peq,cinf=NULL,csup=NULL;
689  statement body1,body2;
690  instruction ins;
691  sequence seqi,seqj;
692  list lisi,lisj;
693  range range;
694  statement loop2=NULL;
695  bool condition1=false,condition2=false;
696  tab_loop[i]=copy_loop(loop1);
697  tab_instruction[i] = make_instruction_loop(tab_loop[i]);
698  tab_statement[i]=instruction_to_statement ( tab_instruction[i]);
699  lis=CONS(STATEMENT, tab_statement[i],lis);
700  if (i%2==0){
701  int indice;
702  Value minjp=-100,maxjp=100;
703  indice=i/2;
704  range_lower(loop_range(tab_loop[i]))=
705  int_to_expression( sommetg[indice]);
706  range_upper(loop_range(tab_loop[i]))=
707  int_to_expression( sommetg[indice]);
708  for (peq = sc_newbase->inegalites;peq!=NULL;peq=peq->succ){
709  Pvecteur v;
710  Value constante,val1,val2;
711  v = contrainte_vecteur(peq);
712  constante=vect_coeff(TCST,v);
713  val1=vect_coeff(indice1,v);
714  val2=vect_coeff(indice2,v);
715  if (val2 < 0){
716  if (eval2(constante,val1,val2, sommetg[indice])>minjp ){
717  minjp=eval2(constante,val1,val2, sommetg[indice]);
718  cinf=peq;
719  }
720  else {
721  if ( eval2(constante,val1,val2, sommetg[indice])==minjp ){
722  Pvecteur vp;
723  Value constantep,val1p,val2p;
724  vp=contrainte_vecteur(cinf);
725  constantep=vect_coeff(TCST,vp);
726  val1p=vect_coeff(indice1,vp);
727  val2p=vect_coeff(indice2,vp);
729  ( value_direct_multiply(val1,sommetg[indice])+ constante ,-val2p)
731  (value_direct_multiply(val1p,sommetg[indice])+constantep,-val2))
732  cinf=peq;
733  else
735  (value_direct_multiply(val1,sommetg[indice])+ constante,-val2p)
737  (value_direct_multiply(val1p,sommetg[indice])+constantep,-val2))
738  if(egalite_equal(peq,cif1)||egalite_equal(peq,cif2) )
739  cinf=peq;
740  };
741  };
742  };
743  if (val2 > 0){
744  if (eval2(constante,val1,val2, sommetg[indice])<maxjp ){
745  maxjp=eval2(constante,val1,val2, sommetg[indice]);
746  csup=peq;
747  }
748  else {
749  if (eval2(constante,val1,val2, sommetg[indice])==maxjp ){
750  Pvecteur vp;
751  Value constantep,val1p,val2p;
752  vp=contrainte_vecteur(csup);
753  constantep=vect_coeff(TCST,vp);
754  val1p=vect_coeff(indice1,vp);
755  val2p=vect_coeff(indice2,vp);;
757  (value_direct_multiply(val1,sommetg[indice])+ constante ,-val2p)
759  (value_direct_multiply (val1p,sommetg[indice])+ constantep,-val2))
760  csup=peq;
761  else
763  (value_direct_multiply(val1,sommetg[indice])+ constante ,-val2p)
765  (value_direct_multiply(val1p,sommetg[indice])+constantep,-val2))
766  if( ( egalite_equal(peq,cif1) )||(egalite_equal(peq,cif2)) )
767  csup=peq;
768  };
769  };
770  };
771  };
772  for (e = vertice; e != NULL; e = e->succ) {
773  Value j2;
774  Pvecteur pv1;
775  pv1=e->vecteur;
776  if (sommetg[indice]==vect_coeff(indice1,pv1)){
777  j2=vect_coeff(indice2,pv1);
778  if (
779  (value_direct_multiply(vect_coeff(indice1,pvif1),sommetg[indice])+
780  value_direct_multiply(vect_coeff(indice2,pvif1),j2)+
781  vect_coeff(TCST,pvif1)==0)&&
782  (value_direct_multiply(vect_coeff(indice1,pvif2),sommetg[indice])+
783  value_direct_multiply(vect_coeff(indice2,pvif2),j2)+
784  vect_coeff(TCST,pvif2)==0)){
785  if( vect_coeff(indice2,pvif2) < 0 )
786  condition1=true;
787  else{
788  if( vect_coeff(indice2,pvif1) > 0 ){
789  condition2=true;
790 
791  };
792  }
793  }
794  }
795  };
796 
797  }
798  else{
799  int indice;
800  Value minjp1=-100,minjp2=-100,maxjp1=100,maxjp2=100;
801  indice=i/2;
802  range_lower(loop_range(tab_loop[i]))=
803  int_to_expression( sommetg[indice]+1);
804  range_upper(loop_range(tab_loop[i]))=
805  int_to_expression( sommetg[indice+1]-1);
806  for (peq = sc_newbase->inegalites;peq!=NULL;peq=peq->succ){
807  Pvecteur v;
808  Value constante,val1,val2;
809  v = contrainte_vecteur(peq);
810  constante=vect_coeff(TCST,v);
811  val1=vect_coeff(indice1,v);
812  val2=vect_coeff(indice2,v);
813  if (val2 < 0){
814  if ( (eval2(constante,val1,val2, sommetg[indice])>=minjp1 )
815  &&( eval2(constante,val1,val2, sommetg[indice+1]) >=minjp2)){
816  if ( (eval2(constante,val1,val2, sommetg[indice])==minjp1 )
817  &&( eval2(constante,val1,val2, sommetg[indice+1]) ==minjp2))
818  {
819  Pvecteur vp;
820  Value constantep,val1p,val2p;
821  vp=contrainte_vecteur(cinf);
822  constantep=vect_coeff(TCST,vp);
823  val1p=vect_coeff(indice1,vp);
824  val2p=vect_coeff(indice2,vp);
826  (value_direct_multiply(val1,sommetg[indice])+constante,-val2p)
828  (value_direct_multiply(val1p,sommetg[indice])+constantep,-val2))||
830  ( value_direct_multiply(val1,sommetg[indice+1])+ constante ,-val2p)
833  (val1p,sommetg[indice+1])+ constantep ,-val2)))
834  {
835  minjp1=eval2(constante,val1,val2, sommetg[indice]);
836  minjp2=eval2(constante,val1,val2, sommetg[indice+1]);
837  cinf=peq;
838  }
839  }
840  else{
841  minjp1=eval2(constante,val1,val2, sommetg[indice]);
842  minjp2=eval2(constante,val1,val2, sommetg[indice+1]);
843  cinf=peq;
844  }
845  };
846  };
847  if (val2 > 0){
848  if ( (eval2(constante,val1,val2, sommetg[indice])<=maxjp1 )&&
849  ( eval2(constante,val1,val2, sommetg[indice+1]) <=maxjp2)){
850  if ( (eval2(constante,val1,val2, sommetg[indice])==maxjp1 )
851  &&( eval2(constante,val1,val2, sommetg[indice+1]) ==maxjp2))
852  {
853  Pvecteur vp;
854  Value constantep,val1p,val2p;
855  vp=contrainte_vecteur(csup);
856  constantep=vect_coeff(TCST,vp);
857  val1p=vect_coeff(indice1,vp);
858  val2p=vect_coeff(indice2,vp);
860  (value_direct_multiply(val1,sommetg[indice])+ constante ,-val2p)
862  (value_direct_multiply(val1p,sommetg[indice])+constantep,-val2)) ||
864  (value_direct_multiply(val1,sommetg[indice+1])+ constante ,-val2p)
866  (value_direct_multiply (val1p,sommetg[indice+1])+constantep,-val2)))
867  {
868  maxjp1=eval2(constante,val1,val2, sommetg[indice]);
869  maxjp2=eval2(constante,val1,val2, sommetg[indice+1]);
870  csup=peq;
871  };
872  }
873  else{
874  maxjp1=eval2(constante,val1,val2, sommetg[indice]);
875  maxjp2=eval2(constante,val1,val2, sommetg[indice+1]);
876  csup=peq;
877  };
878  };
879  };
880  };
881  };
882  body1=loop_body( tab_loop[i]);
883  ins =statement_instruction(body1);
884  seqi=instruction_sequence(ins);
885  lisi =sequence_statements(seqi);
886  MAP(STATEMENT,s,loop2=s,lisi);
887  ins=statement_instruction(loop2);
891  body2= loop_body(instruction_loop(ins));
893  lisj=sequence_statements(seqj);
894  if (condition1){
895  list lisjcopy;
896  Pvecteur v;
897  Value constante;
898  lisjcopy= gen_full_copy_list(lisj);
899  CHUNK(CAR(gen_last(lisjcopy)))= (gen_chunk *)
901  CHUNK(CAR(lisjcopy))= (gen_chunk *)
903  lisi= gen_concatenate(lisjcopy,lisi);
904  sequence_statements(seqi)=lisi;
905  v = vect_dup (contrainte_vecteur(cinf));
906  constante=vect_coeff(TCST,v);
907  vect_chg_coeff(&v,TCST,value_plus(1,constante));
908  cinf=contrainte_make(v);
910 
911  }
912  if (condition2){
913  Pvecteur v;
914  Value constante;
915  list lisjcopy;
916  lisjcopy= gen_full_copy_list(lisj);
917  CHUNK(CAR(gen_last(lisjcopy)))= (gen_chunk *)
919  CHUNK(CAR(lisjcopy))= (gen_chunk *)
921  lisi= gen_concatenate(lisi,lisjcopy);
922  sequence_statements(seqi)=lisi;
923  v=vect_dup( contrainte_vecteur(csup));
924  constante=vect_coeff(TCST,v);
925  vect_chg_coeff(&v,TCST,value_plus(1,constante));
926  csup=contrainte_make(v);
928  }
929  if (i==0){
930  if ( vect_equal(pvif1,pv_i_lower) ||
931  vect_oppos(pvif1,pv_i_lower)){
932  CHUNK( CAR((lisj)))= (gen_chunk * )
934  sequence_statements(seqj)=lisj;
935  isoler2=0;
936  }
937  else{
938  if ( vect_equal(pvif2,pv_i_lower) ||
939  vect_oppos(pvif2,pv_i_lower)) {
940  CHUNK( CAR(gen_last((lisj))))= (gen_chunk * )
942  sequence_statements(seqj)=lisj;
943  isoler2=0;
944  };
945  };
946  };
947  if (i==2*nbr_vertice-2){
948  if ( vect_equal(pvif1,pv_i_upper) ||
949  vect_oppos(pvif1,pv_i_upper))
950  {
951  CHUNK( CAR((lisj)))= (gen_chunk * )
953  sequence_statements(seqj)=lisj;
954  isoler=2*nbr_vertice-2;
955  }
956  else{
957  if ( vect_equal(pvif2,pv_i_upper) ||
958  vect_oppos(pvif2,pv_i_upper)) {
959  CHUNK( CAR(gen_last((lisj))))= (gen_chunk * )
961  sequence_statements(seqj)=lisj;
962  isoler=2*nbr_vertice-2;
963  };
964  };
965  };
966 
967  if ((condition1==false) && (condition2==false)){
968 
969  /* debut cas1 */
970 
971  if ( egalite_equal(cinf,cif1)){
972  if (value_abs (vect_coeff(indice2,pvif1))==1){
973  lisi=CONS(STATEMENT,
975  sequence_statements(seqi)=lisi;
976  }
977  else{
978  list lexp;
979  call ca;
980  expression exp1,exp2;
981  Pvecteur pv;
982  statement s;
983  pv=vect_dup (pvif1);
984  vect_erase_var( &pv,indice2);
985  exp1=Pvecteur_to_expression(pv);
986  s= copy_statement (first);
988  (-vect_coeff(indice2,pvif1)), NIL);
989  lexp = CONS(EXPRESSION, exp1, lexp);
993  exp2=int_to_expression(0);
994  exp1=eq_expression(exp1,exp2);
996  lisi=CONS(STATEMENT,s,lisi);
997  sequence_statements(seqi)=lisi;
998  };
999  };
1000 
1001  /* fins cas1 */
1002 
1003 
1004  /*debut cas2 */
1005 
1006  if ( egalite_equal(csup,cif2)) {
1007  list listemp;
1008  if (value_abs (vect_coeff(indice2,pvif2))==1){
1009  listemp=CONS(STATEMENT,
1011  lisi= gen_concatenate(lisi,listemp);
1012  sequence_statements(seqi)=lisi;
1013  }
1014  else{
1015  list lexp;
1016  call ca;
1017  expression exp1,exp2;
1018  Pvecteur pv;
1019  statement s;
1020  pv=vect_dup (pvif2);
1021  vect_erase_var( &pv,indice2);
1022  exp1=Pvecteur_to_expression(pv);
1023  s= copy_statement (last);
1025  (-vect_coeff(indice2,pvif2)), NIL);
1026  lexp = CONS(EXPRESSION, exp1, lexp);
1030  exp2=int_to_expression(0);
1031  exp1=eq_expression(exp1,exp2);
1033  listemp=CONS(STATEMENT,s ,NIL);
1034  lisi= gen_concatenate(lisi,listemp);
1035  sequence_statements(seqi)=lisi;
1036  };
1037  };
1038 
1039 
1040  /* fin cas2 */
1041  /* debut cas3 */
1042 
1043  if ( egalite_equal(cinf,cif2)) {
1044  statement sif1;
1045  sequence seqif1;
1046  instruction insif1;
1047  Pvecteur v;
1048  Value constante;
1049  seqif1=make_sequence(lisjcopy2);
1050  insif1=make_instruction_sequence(seqif1);
1051  sif1=instruction_to_statement(insif1);
1052  if (value_abs (vect_coeff(indice2,pvif2))==1){
1053  lisi=gen_concatenate(lisjcopy2,lisi);
1054  sequence_statements(seqi)=lisi;
1055  }
1056  else{
1057  list lexp;
1058  call ca;
1059  expression exp1,exp2;
1060  Pvecteur pv;
1061  Value val;
1062  statement s/*,s1*/;
1063  pv=vect_dup (pvif2);
1064  val=vect_coeff(indice2,pvif2);
1065  vect_erase_var( &pv,indice2);
1066  exp1=Pvecteur_to_expression(pv);;
1067  s= copy_statement (last);
1068 
1070  (-val), NIL);
1071  lexp = CONS(EXPRESSION, exp1, lexp);
1075  exp2=int_to_expression(0);
1076  exp1=eq_expression(exp1,exp2);
1079  lisi=CONS(STATEMENT,s,lisi);
1080  sequence_statements(seqi)=lisi;
1081  };
1082  v = vect_dup (contrainte_vecteur(cinf));
1083  constante=vect_coeff(TCST,v);
1084  vect_chg_coeff(&v,TCST,value_plus(1,constante));
1085  cinf=contrainte_make(v);
1087  }
1088  /*fin cas3 */
1089  /* debut cas4 */
1090 
1091  if ( egalite_equal(csup,cif1)){
1092  statement sif2;
1093  sequence seqif2;
1094  instruction insif2;
1095  Pvecteur v;
1096  list listemp;
1097  Value constante;
1098  seqif2=make_sequence(lisjcopy);
1099  insif2=make_instruction_sequence(seqif2);
1100  sif2=instruction_to_statement(insif2);
1101  if (value_abs (vect_coeff(indice2,pvif1))==1){
1102  lisi=gen_concatenate(lisi,lisjcopy);
1103  sequence_statements(seqi)=lisi;
1104  }
1105  else{
1106  list lexp;
1107  call ca;
1108  expression exp1,exp2;
1109  Pvecteur pv;
1110  statement s;
1111  pv=vect_dup (pvif1);
1112  vect_erase_var( &pv,indice2);
1113  exp1=Pvecteur_to_expression(pv);
1114  s= copy_statement (first);
1116  (-vect_coeff(indice2,pvif1)), NIL);
1117  lexp = CONS(EXPRESSION, exp1, lexp);
1121  exp2=int_to_expression(0);
1122  exp1=eq_expression(exp1,exp2);
1125  listemp=CONS(STATEMENT,s ,NIL);
1126  lisi= gen_concatenate(lisi,listemp);
1127  sequence_statements(seqi)=lisi;
1128  };
1129  v=vect_dup( contrainte_vecteur(csup));
1130  constante=vect_coeff(TCST,v);
1131  vect_chg_coeff(&v,TCST,value_plus(1,constante));
1132  csup=contrainte_make(v);
1134 
1135  }
1136 
1137  /*fin cas4 */
1138  };
1139  if (i%2==0){
1140  if (condition1||condition2) isoler =i;
1141  }
1142 
1143  };
1144  lis= gen_nreverse(lis);
1145  i=-1;
1146  lisp=lis;
1147  FOREACH(STATEMENT,s,lis)
1148  {
1149  i++;if((i!=isoler)&&(i%2==0)&&(i!=isoler2)) {
1150  if(i==0) {
1151  CHUNK( CAR(lisp))= (gen_chunk *) make_block_statement(NIL);
1152  range_lower(loop_range(tab_loop[i+1]))=
1153  int_to_expression( sommetg[(i+1)/2]);
1154  }
1155  else{
1156  if(i==2*nbr_vertice-2){
1157  CHUNK( CAR(lisp))= (gen_chunk *) make_block_statement(NIL);
1158  range_upper(loop_range(tab_loop[i-1]))=
1159  int_to_expression(sommetg[(i-1)/2+1]);
1160  }
1161  else{
1162  body1=loop_body(tab_loop[i]);
1163  ins =statement_instruction(body1);
1164  seq=instruction_sequence(ins);
1165  lisi =sequence_statements(seq);
1167  loop2 =s1; },lisi) ;
1168  ins =statement_instruction(loop2);
1169  range1=loop_range(instruction_loop(ins));
1170  body1=loop_body(tab_loop[i-1]);
1171  ins =statement_instruction(body1);
1172  seq=instruction_sequence(ins);
1173  lisi =sequence_statements(seq);
1175  loop2 =s1; },lisi) ;
1176  ins =statement_instruction(loop2);
1177  range2=loop_range(instruction_loop(ins));
1178  body1=loop_body(tab_loop[i+1]);
1179  ins =statement_instruction(body1);
1180  seq=instruction_sequence(ins);
1181  lisi =sequence_statements(seq);
1183  loop2 =s1; },lisi) ;
1184  ins =statement_instruction(loop2);
1185  range3=loop_range(instruction_loop(ins));
1186  if (range_equal_p(range1,range2)) {
1187  CHUNK( CAR(lisp))= (gen_chunk *) make_block_statement(NIL);
1188  range_upper(loop_range(tab_loop[i-1]))=
1189  int_to_expression( sommetg[(i-1)/2+1]);
1190  }
1191  else {
1192  CHUNK( CAR(lisp))= (gen_chunk *) make_block_statement(NIL);
1193  if (range_equal_p(range1,range3))
1194  range_lower(loop_range(tab_loop[i+1]))=
1195  int_to_expression( sommetg[(i+1)/2]);
1196  }
1197  };
1198  };
1199 
1200  };
1201  lisp=CDR(lisp);
1202  }
1203  seq=make_sequence (lis);
1204  ins= make_instruction_sequence(seq);
1205  return( instruction_to_statement(ins));
1206 }
1207 
1209 {
1210 
1211  statement stat,s1;
1212  string str ;
1213  int ordering ;
1214  instruction ins;
1215  sequence seq;
1216  list lis;
1217  context_t context;
1218  debug_on("GUARD_ELIMINATION_DEBUG_LEVEL");
1219  pips_debug(1, "considering module %s\n", module);
1221  stat = (statement) db_get_memory_resource(DBR_CODE, module, true);
1223  context.statement_stack = stack_make(statement_domain, 0, 0);
1224 
1225  // user_request
1226  // recherche le statement dans stat
1227  // appliquer...
1228 
1229  /* set_ordering_to_statement(stat); */
1230  ins=statement_instruction(stat);
1231  seq=instruction_sequence(ins);
1232  lis =sequence_statements(seq);
1233  /* MAP(STATEMENT,s,{printf("%d \n",statement_ordering(s));},lis) */
1234 
1235  str = user_request("Which nid do you want to treat?\n"
1236  "(give its ordering): ");
1237  ordering=atoi(str);
1238 
1239 
1240  s1=ordering_to_statement(ordering);
1241 
1245  NULL);
1246  str = user_request("for Which nid do you want apply unimodular "
1247  "transformation ?\n" "(give its ordering): ");
1248  ordering=atoi(str);
1249 
1250  s1=ordering_to_statement(ordering);
1251  MAP(STATEMENT,s,{if (statement_ordering(s)==ordering){
1252  s1=unimodular(s1); ; s1= free_guards(s1);
1253  CHUNK(CAR(lis))= (gen_chunk *) s1;}
1254  ;lis=CDR(lis) ;},lis)
1255 
1256 
1257 
1258 
1259  /* gen_recurse(stat, statement_domain, gen_true,); */
1260  module_reorder(stat);
1261 
1262  DB_PUT_MEMORY_RESOURCE(DBR_CODE, module, stat);
1265  debug_off();
1266  return true;
1267 }
1268 
1269 
1270 
1271 
1272 
1273 
1274 
1275 
1276 
1277 
1278 
1279 
1280 
1281 
1282 
1283 
1284 
1285 
1286 
1287 
1288 
1289 
1290 
1291 
1292 
1293 
1294 
1295 
1296 
1297 
1298 
1299 
1300 
1301 
1302 
1303 
1304 
1305 
1306 
1307 
instruction make_instruction_loop(loop _field_)
Definition: ri.c:1175
call make_call(entity a1, list a2)
Definition: ri.c:269
loop copy_loop(loop p)
LOOP.
Definition: ri.c:1265
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
instruction make_instruction_sequence(sequence _field_)
Definition: ri.c:1169
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
sequence make_sequence(list a)
Definition: ri.c:2125
struct _newgen_struct_expression_ * expression
Definition: alias_private.h:21
#define value_direct_multiply(v1, v2)
int Value
#define value_plus(v1, v2)
binary operators on values
#define value_abs(val)
#define value_mod(v1, v2)
#define value_div(v1, v2)
static list lexp
void change_of_base_index(Pbase base_oldindex, Pbase *base_newindex)
void change_of_base_index(Pbase base_oldindex, Pbase *base_newindex) change of variable index from ba...
Psysteme sc_change_baseindex(Psysteme sc, Pbase base_old, Pbase base_new)
Psysteme sc_change_baseindex(Psysteme sc, Pbase base_old, Pbase base_new) le changement de base d'ind...
Ptsg sc_to_sg_chernikova(Psysteme sc)
chernikova_mulprec.c
Definition: chernikova.c:42
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
expression expression_to_expression_newbase(expression e_old, pvg, Pbase base_oldindex)
expression expression_to_expression_newbase(expression e_old,Pvecteur pvg[], Pbase base_oldindex) com...
Pvecteur vect_change_base(Pvecteur pv_old, Pbase base_oldindex, pvg)
Pvecteur vect_change_base(Pvecteur pv_old, Pvecteur pvg[], Pbase base_oldindex, Pbase base_newindex) ...
void scanning_base_to_vect(matrice G, int n, Pbase base, pvg)
void scanning_base_to_vect(matrice G,int n,Pbase base,Pvecteur pvg[n]) compute G*base and put the res...
statement code_generation(list lls, Pvecteur pvg[], Pbase base_oldindex, Pbase base_newindex, Psysteme sc_newbase, bool preserve_entry_label_p)
package hyperplane
#define A(i, j)
comp_matrice.c
Definition: comp_matrice.c:63
void sc_syst_debug(Psysteme s)
constraint_to_text.c
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
bool egalite_equal(Pcontrainte, Pcontrainte)
bool egalite_equal(Pcontrainte eg1, Pcontrainte eg2): teste l'equivalence de deux egalites; leurs coe...
Definition: predicats.c:98
Psysteme loop_iteration_domaine_to_sc(list, Pbase *)
loop_iteration_domaine_to_sc.c
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
#define CHUNK(x)
Definition: genC.h:90
void * malloc(YYSIZE_T)
void free(void *)
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
Definition: statement.c:597
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
Definition: genClib.c:3373
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
list gen_concatenate(const list l1x, const list l2x)
concatenate two lists.
Definition: list.c:436
struct cons cons
The structure used to build lists in NewGen.
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
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
list gen_full_copy_list(list l)
Copy a list structure with element copy.
Definition: list.c:535
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
static bool stmt_flt(statement s, context_p context)
bool guard_elimination(string module)
static Value intersection(Pvecteur pv1, Pvecteur pv2, Variable var, floor)
statement free_guards(statement s)
Psysteme sc_newbase
include <sys/ddi.h>
struct context_p context_t
statement unimodular(s)
static void stmt_rwt(statement s, context_p context)
bool if2
static Value myfloor(Value k, Value m)
static bool loop_flt(loop l, context_p context)
static Value myceil(Value k, Value m)
static Value eval(Pvecteur pv, Value val, Variable var)
Ptsg sg
static Value eval2(Value val0, Value val1, Value val2, Value val)
bool if1
bool vect_equal(Pvecteur v1, Pvecteur v2)
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
Definition: reductions.c:278
bool vect_oppos(Pvecteur v1, Pvecteur v2)
bool vect_oppos(Pvecteur v1, Pvecteur v2): test de l'opposition de deux vecteurs
Definition: reductions.c:360
loop loop1
tiling_sequence.c
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Definition: matrice-local.h:77
Value * matrice
package matrice
Definition: matrice-local.h:71
void matrice_general_inversion(matrice a, matrice inv_a, int n)
void matrice_general_inversion(matrice a; matrice inv_a; int n) calcul de l'inversion du matrice gene...
Definition: inversion.c:222
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r)
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r): multiply rational matrix...
Definition: matrice.c:82
void matrice_fscan(FILE *, matrice *, int *, int *)
void matrice_fscan(FILE * f, matrice * a, int * n, int * m): read an (nxm) rational matrix in an ASCI...
Definition: matrice_io.c:115
struct _newgen_struct_range_ * range
Definition: message.h:21
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define debug_off()
Definition: misc-local.h:160
string user_request(const char *,...)
void * stack_head(const stack)
returns the item on top of stack s
Definition: stack.c:420
void stack_push(void *, stack)
stack use
Definition: stack.c:373
stack stack_make(int, int, int)
allocation
Definition: stack.c:246
void * stack_pop(stack)
POPs one item from stack s.
Definition: stack.c:399
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
Definition: ordering.c:111
void normalize_all_expressions_of(void *obj)
Definition: normalize.c:668
static char * module
Definition: pips.c:74
static void norm(struct rproblem *RR)
cette procedure normalise la fonction cout, calcule les valeurs des seconds membres resultant d'une n...
Definition: r1.c:271
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
#define loop_to_statement(l)
#define test_to_statement(t)
#define eq_expression(e1, e2)
#define MODULO_OPERATOR_NAME
void make_bound_expression(Variable index, Pbase base, Psysteme sc, expression *lower, expression *upper)
void make_bound_expression(variable index, Pbase base, Psysteme sc, expression *lower,...
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
Definition: expression.c:1825
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
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_contrainte_expression(Pcontrainte pc, Variable index)
A wrapper around make_constraint_expression() for compatibility.
Definition: expression.c:1815
bool range_equal_p(range r1, range r2)
Definition: expression.c:1522
#define loop_body(x)
Definition: ri.h:1644
#define normalized_undefined
Definition: ri.h:1745
#define instruction_sequence_p(x)
Definition: ri.h:1512
#define normalized_linear_p(x)
Definition: ri.h:1779
#define instruction_loop_p(x)
Definition: ri.h:1518
#define call_function(x)
Definition: ri.h:709
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define range_upper(x)
Definition: ri.h:2290
#define instruction_loop(x)
Definition: ri.h:1520
#define statement_ordering(x)
Definition: ri.h:2454
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
@ is_syntax_call
Definition: ri.h:2693
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_name(x)
Definition: ri.h:2790
struct _newgen_struct_call_ * call
Definition: ri.h:63
#define expression_normalized(x)
Definition: ri.h:1249
struct _newgen_struct_syntax_ * syntax
Definition: ri.h:407
#define test_true(x)
Definition: ri.h:2835
#define sequence_statements(x)
Definition: ri.h:2360
#define instruction_sequence(x)
Definition: ri.h:1514
#define syntax_call(x)
Definition: ri.h:2736
#define instruction_call_p(x)
Definition: ri.h:1527
#define test_condition(x)
Definition: ri.h:2833
#define range_lower(x)
Definition: ri.h:2288
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define loop_range(x)
Definition: ri.h:1642
#define call_arguments(x)
Definition: ri.h:711
#define instruction_test(x)
Definition: ri.h:1517
#define normalized_linear(x)
Definition: ri.h:1781
#define expression_syntax(x)
Definition: ri.h:1247
#define loop_index(x)
Definition: ri.h:1640
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
void sc_dump(Psysteme sc)
void sc_dump(Psysteme sc): dump to stderr
Definition: sc_io.c:142
int printf()
Psysteme new_loop_bound(Psysteme scn, Pbase base_index)
Psysteme new_loop_bound(Psysteme scn, Pbase base_index) computation of the new iteration space (given...
#define G(j, a, b)
maybe most of them should be functions?
s1
Definition: set.c:247
#define sg_sommets(sg)
vieilles definitions des fonctions d'impression void sg_fprint(); #define print_sg(sg) sg_fprint(stdo...
Definition: sg-local.h:85
#define sg_nbre_sommets(sg)
nombre de sommets: int sg_nbre_sommets(Ptsg)
Definition: sg-local.h:96
void sys_matrice_index(Psysteme, Pbase, matrice, int, int)
Warning! Do not modify this file that is automatically generated!
void matrice_index_sys(Psysteme, Pbase, matrice, int, int)
void matrice_index_sys(Psysteme sc, Pbase base_index, matrice AG, int n, int m) replace the coefficie...
Definition: pip__tab.h:25
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
int nb_ineq
Definition: sc-local.h:73
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
the stack head
Definition: stack.c:62
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
cette structure contient une pile.
stack statement_stack
Definition: delay.c:253
structure de donnees Sommet
Definition: sommet-local.h:64
struct typ_som * succ
Definition: sommet-local.h:68
Pvecteur vecteur
Definition: sommet-local.h:66
Value denominateur
Definition: sommet-local.h:67
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
Definition: sg-local.h:66
A gen_chunk is used to store every object.
Definition: genC.h:58
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
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)
struct Svecteur Svecteur
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
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_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
Definition: binaires.c:75
void vect_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
Definition: unaires.c:106
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143