PIPS
messages.c
Go to the documentation of this file.
1 /*
2 
3  $Id: messages.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 /* Messages handling
28  *
29  * Fabien Coelho, August 1993
30  */
31 
32 #include "defines-local.h"
33 #include "access_description.h"
34 
35 /* ????
36  */
37 static expression safe_static_domain_bound(array, dim, e, shift, lower)
39 int dim;
40 expression e;
41 int shift;
42 bool lower;
43 {
44  expression result;
45  int l=0, u=0, tmp=-1;
46 
48  result = int_to_expression(tmp+shift);
49  else
50  {
51  get_entity_dimensions(array, dim, &l, &u);
52  result = int_to_expression(lower ? l : u);
53  }
54 
55  return(result);
56 }
57 
58 /* message generate_one_message(array, li, lk, lv)
59  *
60  * generate one message after the reference given,
61  */
62 static message generate_one_message(array, li, lk, lv)
64 list li, lk, lv;
65 {
66  int i = 1, len = gen_length(li);
67  list lip = li, lkp = lk, lvp = lv, lr = NIL, ldom = NIL;
68  entity newarray = load_new_node(array);
69  Pvecteur procv = VECTEUR_NUL;
70 
71  assert(len==(int)gen_length(lk) && len==(int)gen_length(lv));
72 
73  for ( ; i<=len ; i++, lip=CDR(lip), lkp=CDR(lkp), lvp=CDR(lvp))
74  {
75  tag at = access_tag(INT(CAR(lkp)));
76  Pvecteur v = (Pvecteur) PVECTOR(CAR(lvp));
77  expression indice = EXPRESSION(CAR(lip));
78  dimension newdim = FindIthDimension(newarray, i);
79  int
80  arraylo = HpfcExpressionToInt(dimension_lower(newdim)),
81  arrayup = HpfcExpressionToInt(dimension_upper(newdim));
82 
83  pips_debug(9, "array %s, dimension %d, access considered is %d\n",
84  entity_local_name(newarray), i, at);
85 
86  switch (at)
87  {
88  case aligned_constant:
89  {
90  /* I think I don't need to store the to where value...
91  * that's rather interesting since I do not know where I could
92  * put it...
93  */
94  Value cst = vect_coeff(TCST, v), vt = vect_coeff(TEMPLATEV, v);
95  int tpl = VALUE_TO_INT(vt),
96  localarraycell = template_cell_local_mapping(array, i, tpl);
97 
98  /* no neighbour concerned */
99  /* content: */
100  lr = gen_nconc(lr,
101  CONS(RANGE,
102  make_range(int_to_expression(localarraycell),
103  int_to_expression(localarraycell),
104  int_to_expression(1)),
105  NIL));
106  /* domain: */
107  ldom = gen_nconc(ldom,
108  CONS(RANGE,
110  Value_to_expression(cst),
111  int_to_expression(1)),
112  NIL));
113  break;
114  }
115  case aligned_shift:
116  /*
117  * note that rate==1
118  */
119  {
120  Pvecteur vindex = the_index_of_vect(v);
121  entity index = (entity) var_of(vindex);
122  range rg = loop_index_to_range(index);
123  Value vs = vect_coeff(TSHIFTV, v), vi = vect_coeff(TCST, v);
124  int procdim,
125  shift = VALUE_TO_INT(vs),
126  ishft = VALUE_TO_INT(vi),
127  n = DistributionParameterOfArrayDim(array, i, &procdim);
128  expression dom_lb, dom_ub;
129 
130  debug(10, "generate_one_message",
131  "n = %d, just to avoid a gcc warning:-)\n", n);
132 
133  if (shift!=0)
134  {
135  /* neighbour to send to */
136  procv = vect_add(procv,
137  vect_new((Variable) (intptr_t)procdim,
138  (shift<0)?(VALUE_ONE):(VALUE_MONE)));
139 
140  /* content, on the sender point of view... */
141  if (shift<0)
142  {
143  lr = gen_nconc
144  (lr,
145  CONS(RANGE,
146  make_range(int_to_expression(arrayup+shift+1),
147  int_to_expression(arrayup),
148  int_to_expression(1)),
149  NIL));
150  }
151  else /* (shift>0) */
152  {
153  lr = gen_nconc
154  (lr,
155  CONS(RANGE,
156  make_range(int_to_expression(arraylo),
157  int_to_expression(arraylo+shift-1),
158  int_to_expression(1)),
159  NIL));
160  }
161  }
162  else /* shift == 0 */
163  {
164  /* content: send it all? */
165  lr = gen_nconc(lr,
166  CONS(RANGE,
167  make_range(int_to_expression(arraylo),
168  int_to_expression(arrayup),
169  int_to_expression(1)),
170  NIL));
171  }
172 
173  /* assert(gen_consistent_p(rg)); */
174 
175  dom_lb = safe_static_domain_bound(array, i,
176  range_lower(rg), ishft, true);
177  dom_ub = safe_static_domain_bound(array, i,
178  range_upper(rg), ishft, false);
179 
180  /* domain */
181  ldom =
182  gen_nconc(ldom,
183  CONS(RANGE,
184  make_range(dom_lb,
185  dom_ub,
186  int_to_expression(1)), /* ??? why 1 */
187  NIL));
188 
189  break;
190  }
191  case local_constant:
192  {
193  Value
194  /* ??? bug if there is a declaration shift... */
195  arraycell = vect_coeff(TCST, v);
196 
197  /* no neighbour concerned */
198  /* content: */
199  lr = gen_nconc(lr,
200  CONS(RANGE,
201  make_range(Value_to_expression(arraycell),
202  Value_to_expression(arraycell),
203  int_to_expression(1)),
204  NIL));
205  /* domain: */
206  ldom = gen_nconc(ldom,
207  CONS(RANGE,
208  make_range(Value_to_expression(arraycell),
209  Value_to_expression(arraycell),
210  int_to_expression(1)),
211  NIL));
212  break;
213  }
214  case local_shift:
215  {
216  Pvecteur vindex = the_index_of_vect(v);
217  entity index = (entity) var_of(vindex);
218  range rg = loop_index_to_range(index);
219  Value vs = vect_coeff(TCST, v);
220  int shift = VALUE_TO_INT(vs),
221  ishft = shift,
224 
225  /* no neighbour */
226  /* content: all shifted space indexed */
227  /* ??? false if declaration shift */
228  lr =
229  gen_nconc(lr,
230  CONS(RANGE,
231  make_range(int_to_expression(lb+shift),
232  int_to_expression(ub+shift),
233  int_to_expression(1)),
234  NIL));
235 
236  /* domain */
237  ldom =
238  gen_nconc(ldom,
239  CONS(RANGE,
240  make_range(int_to_expression(lb+ishft),
241  int_to_expression(ub+ishft),
242  int_to_expression(1)),/* ??? why 1 */
243  NIL));
244 
245 
246  break;
247  }
248  case local_affine:
249  {
250  Pvecteur
251  vindex = the_index_of_vect(v);
252  entity
253  index = (entity) var_of(vindex);
254  range
255  rg = loop_index_to_range(index);
256  Value vs = vect_coeff(TCST, v);
257  int
258  rate = VALUE_TO_INT(val_of(vindex)),
259  shift = VALUE_TO_INT(vs),
260  ishft = shift,
264 
265  /* no neighbour */
266  /* content: all shifted space indexed */
267  /* ??? false if declaration shift */
268  lr = gen_nconc(lr,
269  CONS(RANGE,
270  make_range(int_to_expression(rate*lb+shift),
271  int_to_expression(rate*ub+shift),
272  int_to_expression(in*rate)),
273  NIL));
274 
275  /* domain */
276  ldom = gen_nconc(ldom,
277  CONS(RANGE,
278  make_range(int_to_expression(rate*lb+ishft),
279  int_to_expression(rate*ub+ishft),
280  int_to_expression(in*rate)),
281  NIL));
282 
283 
284  break;
285  }
286  case local_form_cst:
287  {
288  /* no neighbour concerned */
289  /* content: */
290  lr = gen_nconc(lr,
291  CONS(RANGE,
292  make_range(indice,
293  indice,
294  int_to_expression(1)),
295  NIL));
296  /* domain: */
297  ldom = gen_nconc(ldom,
298  CONS(RANGE,
299  make_range(indice,
300  indice,
301  int_to_expression(1)),
302  NIL));
303  break;
304  }
305  default:
306  pips_internal_error("access tag not welcomed here (%d)", at);
307  break;
308  }
309  }
310 
311  return(make_message(array, lr, procv, ldom));
312 }
313 
314 /* list messages_generation(Ro, lRo)
315  *
316  * first kind of messages generation
317  * (the overlap management is handled in message_manageable_p())
318  */
319 static list messages_generation(Ro, lRo)
320 list Ro, lRo;
321 {
322  list
323  lm = NIL,
324  lr = NIL,
325  lp = NIL;
326 
327  for (lr=Ro, lp=lRo ; lr!=NIL ; lr=CDR(lr), lp=CDR(lp))
328  {
329  reference
330  r = syntax_reference(SYNTAX(CAR(lr)));
331  entity
333  list
334  li = reference_indices(r),
335  lkv = CONSP(CAR(lp)),
336  lk = CONSP(CAR(lkv)),
337  lv = CONSP(CAR(CDR(lkv)));
338  int
339  len = gen_length(li);
340 
341  assert(len==(int)gen_length(lk) && len==(int)gen_length(lv));
342 
343  lm = CONS(MESSAGE,
344  generate_one_message(array, li, lk, lv),
345  lm);
346  }
347 
348  return(lm);
349 }
350 
352 message m;
353 {
354  entity
355  array = message_array(m);
356  list
357  content = message_content(m),
358  domain = message_dom(m),
359  lneighbour = NIL,
360  lcontent = NIL,
361  ldomain = NIL,
362  cnt = NIL,
363  dom = NIL,
364  lm = NIL;
365  Pvecteur
366  v = (Pvecteur) message_neighbour(m);
367  int
368  i = 1;
369 
370  ifdebug(9)
371  {
372  fprintf(stderr, "[atomize_one_message] ");
373  fprint_message(stderr, m);
374  }
375 
376  for (cnt=content, dom=domain ; cnt!=NIL ; cnt=CDR(cnt), dom=CDR(dom), i++)
377  {
378  int procdim;
379  range rcnt = RANGE(CAR(cnt)), rdom = RANGE(CAR(dom));
380  bool distributed = ith_dim_distributed_p(array, i, &procdim);
381  Value vn = distributed? vect_coeff((Variable) (intptr_t)procdim, v): VALUE_ZERO;
382  int neighbour = VALUE_TO_INT(vn);
383 
384  debug(9, "atomize_one_message", "dimension %d\n", i);
385 
386  if (neighbour==0)
387  {
388  lcontent = add_to_list_of_ranges_list(lcontent, rcnt);
389  ldomain = add_to_list_of_ranges_list(ldomain, rdom);
390  lneighbour = add_elem_to_list_of_Pvecteur(lneighbour, 0, 0);
391  }
392  else /* let's count in binary mode */
393  {
394  list
395  lc = dup_list_of_ranges_list(lcontent),
396  ld = dup_list_of_ranges_list(ldomain),
397  ln = dup_list_of_Pvecteur(lneighbour);
398 
399  lcontent =
401  complementary_range(array, i, rcnt));
402  ldomain = add_to_list_of_ranges_list(ldomain, rdom);
403  lneighbour = add_elem_to_list_of_Pvecteur(lneighbour, 0, 0);
404 
405  lc = add_to_list_of_ranges_list(lc, rcnt);
406  ld = add_to_list_of_ranges_list(ld, rdom);
407  ln = add_elem_to_list_of_Pvecteur(ln, procdim, neighbour);
408 
409  lcontent = gen_nconc(lcontent, lc);
410  ldomain = gen_nconc(ldomain, ld);
411  lneighbour = gen_nconc(lneighbour, ln);
412  }
413  }
414 
415  /*
416  * message generation from the lists
417  */
418 
419  lm = generate_message_from_3_lists(array, lcontent, lneighbour, ldomain);
420 
421  gen_free_list(lcontent);
422  gen_free_list(lneighbour);
423  gen_free_list(ldomain);
424 
425  return(lm);
426 }
427 
429 list lm1;
430 {
431  list lm2 = NIL;
432 
433  MAP(MESSAGE, m, lm2 = gen_nconc(atomize_one_message(m), lm2), lm1);
434 
435  return lm2;
436 }
437 
439 list l;
440 {
441  list result = NIL;
442 
443  MAP(MESSAGE, m,
444  {
447  result = CONS(MESSAGE, m, result);
448  /* ??? else memory leak */
449  },
450  l);
451 
452  return(result);
453 }
454 
456 list l;
457 {
458  list
459  result = NIL;
460 
461  MAP(MESSAGE, m,
462  {
463  if (!empty_section_p(message_dom(m)))
464  result = CONS(MESSAGE, m, result);
465  /* ??? else memory leak */
466  },
467  l);
468 
469  return(result);
470 }
471 
472 /* message shape_one_message(m)
473  *
474  * caution, rate==1 is assumed.
475  */
477 message m;
478 {
479  entity
480  array = message_array(m);
481  list
482  lr = message_content(m),
483  ld = message_dom(m),
484  lnewdomain = NIL;
485  int
486  procdim = 0,
487  i = 1;
488 
489  for ( ; lr!=NIL ; i++, lr=CDR(lr), ld=CDR(ld))
490  {
491  range
492  d = RANGE(CAR(ld)),
493  r = RANGE(CAR(lr));
494 
495  if (ith_dim_distributed_p(array, i, &procdim)) /* ??? is that all ? */
496  {
497  int
498  newdlo = 0,
499  newdup = 0,
504  n = DistributionParameterOfArrayDim(array, i, &procdim),
505  localdlo = global_array_cell_to_local_array_cell(array, i, dlo),
506  localdup = global_array_cell_to_local_array_cell(array, i, dup);
507 
508  assert(rlo<=rup); /* message content isn't empty */
509 
510  /*
511  * I thought a long time about it, just for these two formulas:
512  */
513  newdlo = dlo+(rlo-localdlo)+((localdlo>rup)?(n):(0));
514  newdup = dup+(rup-localdup)-((localdup<rlo)?(n):(0));
515 
516  lnewdomain = gen_nconc(lnewdomain,
517  CONS(RANGE,
519  int_to_expression(newdup),
520  int_to_expression(1)),
521  NIL));
522  }
523  else
524  {
525  lnewdomain = gen_nconc(lnewdomain, CONS(RANGE, d, NIL));
526  }
527  }
528 
530  message_dom(m) = lnewdomain;
531 
532  return(m);
533 }
534 
536 list l;
537 {
538  list result = NIL;
539 
540  MAP(MESSAGE, m, result = CONS(MESSAGE, shape_one_message(m), result), l);
541 
542  return(result);
543 }
544 
546 message m;
547 {
548  Pvecteur
549  v = (Pvecteur) message_neighbour(m);
550  entity
551  array = message_array(m),
552  template = array_to_template(array),
553  processor = template_to_processors(template);
554  list
555  lra = message_dom(m),
557  lrp = template_ranges_to_processors_ranges(template, lrt);
558  int
559  i = 1, t = 0, procndim = NumberOfDimension(processor);
560  Value vt;
561 
562  gen_free_list(lra);
563  gen_free_list(lrt);
564 
565  message_dom(m) = lrp;
566 
567  /* now the neighbour computation in the linearized processor
568  * arrangment named NODETIDS() of common /HPFC_PARAM/.
569  * the code is similar to the runtime support function HPFC_PROCLID().
570  */
571 
572  assert(procndim>=1);
573 
574  vt = vect_coeff((Variable) 1, v);
575  t = VALUE_TO_INT(vt);
576  for (i=2 ; i<=NumberOfDimension(processor) ; i++)
577  {
578  Value vi = vect_coeff((Variable) (intptr_t) i, v);
579  t = t*SizeOfIthDimension(processor, i) + VALUE_TO_INT(vi) ;
580  }
581 
582  message_neighbour_(m) =
584 
585  return(m);
586 }
587 
589 list l;
590 {
591  list result = NIL;
592 
593  MAP(MESSAGE, m,
594  result = CONS(MESSAGE, one_message_guards_and_neighbour(m), result),
595  l);
596 
597  return result;
598 }
599 
600 
602 message send;
603 {
604  entity
605  array = message_array(send);
606  Pvecteur
607  sendneighbour = (Pvecteur) message_neighbour(send),
608  neighbour = vect_new(TCST,
609  value_uminus(vect_coeff(TCST, sendneighbour)));
610  list
612  sendneighbour),
613  domain = compute_receive_domain(message_dom(send), sendneighbour);
614 
615  return(make_message(array, content, neighbour, domain));
616 }
617 
618 /* list receive_messages_generation(lms)
619  *
620  * this function must warranty that all messages send will be received,
621  * so the messages are symetric.
622  */
624 list lms;
625 {
626  list lmr = NIL;
627 
628  MAP(MESSAGE, send,
629  {
630  lmr = gen_nconc(lmr, CONS(MESSAGE,
631  one_receive_message(send),
632  NIL));
633  },
634  lms);
635 
636  return(lmr);
637 }
638 
639 /* statement st_one_message(m, bsend)
640  *
641  * this function will have to be modified in order to include
642  * message coalescing and aggregation. Here, a direct call to
643  * a function that packs and passes the message is made.
644  */
645 static statement st_one_message(m, bsend)
646 message m;
647 bool bsend;
648 {
649  char buffer[100], *buf = buffer;
651  processor = array_to_processors(array);
652  list content = message_content(m),
653  domain = message_dom(m);
655  int neighbour = VALUE_TO_INT(vn);
656  statement
657  cmpneighbour = st_compute_neighbour(neighbour),
658  pass = (bsend ? st_send_to_neighbour() : st_receive_from_neighbour()),
659  pack = st_generate_packing(array, content, bsend);
660  list interm = CONS(STATEMENT,
661  cmpneighbour,
662  (bsend ?
663  CONS(STATEMENT, pack, CONS(STATEMENT, pass, NIL)) :
664  CONS(STATEMENT, pass, CONS(STATEMENT, pack, NIL))));
665  statement
667  processor,
668  domain);
669 
670  /* comment generation to improve readibility of the code
671  */
672  sprintf(buf, "! %s(", entity_local_name(processor));
673  buf += strlen(buf);
675  buf += strlen(buf);
676  sprintf(buf, ") %s %s(", bsend ? "send" : "receive",
678  buf += strlen(buf);
679  sprint_lrange(buf, content);
680  buf += strlen(buf);
681  sprintf(buf, ") %s (%s%d)\n", bsend ? "to" : "from",
682  neighbour>0 ? "+" : "-", abs(neighbour));
683  buf += strlen(buf);
684 
686  return result;
687 }
688 
689 static list generate_the_messages(lm, bsend)
690 list lm;
691 bool bsend;
692 {
693  list l = NIL;
694 
695  MAP(MESSAGE, m, l = CONS(STATEMENT, st_one_message(m, bsend), l), lm);
696 
697  return l;
698 }
699 
700 /* list remove_stammering_messages(lm)
701  *
702  * remove messages that are contained in another message
703  */
705 list lm;
706 {
707  list kept = NIL;
708 
709  MAPL(cm,
710  {
711  message m = MESSAGE(CAR(cm));
712 
713  if (!larger_message_in_list(m, kept) &&
714  !larger_message_in_list(m, CDR(cm)))
715  kept = CONS(MESSAGE, m, kept);
716  },
717  lm);
718 
719  return kept;
720 }
721 
722 /* every required conditions are supposed to be verified in this function.
723  */
725 list Ro, lRo;
726 {
727  list
728  lm1 = NIL,
729  lm2 = NIL,
730  lm2p = NIL,
731  lm3 = NIL,
732  lm3p = NIL,
733  lm4 = NIL,
734  lms = NIL,
735  lmr = NIL,
736  lsend = NIL,
737  lreceive = NIL;
738  int
739  len = gen_length(Ro);
740 
741  assert(len==(int)gen_length(lRo) && len>=1);
742 
743  /* first kind of messages generation
744  *
745  * a message is
746  * an array,
747  * a mixed content on the local array,
748  * a set of neighbours (in a Pvecteur) and
749  * an array section concerned.
750  */
751  lm1 = messages_generation(Ro, lRo);
752 
753  debug(6, "messages_handling", "lm1 length is %d\n", gen_length(lm1));
754  ifdebug(8)
755  {
756  fprint_lmessage(stderr, lm1);
757  }
758 
759  /*
760  * second kind of messages generation
761  *
762  * messages are atomized to real messages:
763  * a message is
764  * an array,
765  * a content (on the local array),
766  * a neighbour to send to (in a Pvecteur),
767  * a domain of the array concerned.
768  */
769  lm2 = messages_atomization(lm1);
770  gen_free_list(lm1);
771 
772  debug(6, "messages_handling",
773  "lm2 length is %d\n", gen_length(lm2));
774  ifdebug(8)
775  {
776  fprint_lmessage(stderr, lm2);
777  }
778 
780  gen_free_list(lm2);
781 
782  debug(6, "messages_handling",
783  "lm2p length is %d\n", gen_length(lm2p));
784  ifdebug(8)
785  {
786  fprint_lmessage(stderr, lm2p);
787  }
788 
789 
790  /*
791  * third kind of messages generation
792  *
793  * the domain is restricted to what is necessary for the
794  * given message, and this on every distributed dimension...
795  * this is important for the guards generation later on.
796  */
797  lm3 = messages_shaping(lm2p);
798  gen_free_list(lm2p);
799 
800  debug(6, "messages_handling",
801  "lm3 length is %d\n", gen_length(lm3));
802  ifdebug(8)
803  {
804  fprint_lmessage(stderr, lm3);
805  }
806 
807 
808  lm3p = keep_non_empty_domain_messages(lm3);
809  gen_free_list(lm3);
810 
811  debug(6, "messages_handling", "lm3p length is %d\n", gen_length(lm3p));
812  ifdebug(8) fprint_lmessage(stderr, lm3p);
813 
814  /*
815  * fourth kind of messages generation
816  *
817  * the array section domain is translated into a processors section,
818  * and the neighbour shift is computed for the linearized processors
819  * arrangement considered in the runtime resolution.
820  */
821  lm4 = messages_guards_and_neighbour(lm3p);
822  gen_free_list(lm3p);
823 
824  debug(6, "messages_handling", "lm4 length is %d\n", gen_length(lm4));
825  ifdebug(8) fprint_lmessage(stderr, lm4);
826 
827  /* here should be performed some message coalescing and/or aggregation:
828  * a first simple version could check for messages sent twice, and so on.
829  */
830  hpfc_warning("messages coalescing and aggregation not implemented\n");
831 
832  lms = remove_stammering_messages(lm4);
833 
834  /* RECEIVE
835  */
836  lmr = receive_messages_generation(lms);
837 
838  assert(gen_length(lmr)==gen_length(lms));
839 
840  ifdebug(8)
841  {
842  fprintf(stderr, "[message handling] lmr and lms\n");
843  fprint_lmessage(stderr, lmr);
844  fprint_lmessage(stderr, lms);
845  }
846 
847  lsend = generate_the_messages(lms, SEND);
848  lreceive = generate_the_messages(lmr, RECEIVE);
849 
850  return(make_block_statement(gen_nconc(lsend, lreceive)));
851 }
852 
853 /* that is all
854  */
message make_message(entity a1, list a2, Pvecteur a3, list a4)
Definition: message.c:54
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
#define local_affine
#define aligned_shift
#define local_form_cst
#define aligned_constant
#define access_tag(a)
#define local_constant
#define local_shift
bool hpfc_integer_constant_expression_p(expression e, int *pi)
#define VALUE_ZERO
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
#define VALUE_TO_INT(val)
#define value_uminus(val)
unary operators on values
#define VALUE_MONE
int Value
#define VALUE_ONE
@ INT
Definition: atomic.c:48
range loop_index_to_range(entity index)
#define newgen_Pvecteur(p)
Definition: compsec.h:26
void fprint_message(FILE *file, message m)
Definition: debug-util.c:217
void fprint_lmessage(FILE *file, list l)
Definition: debug-util.c:231
#define CONSP(x)
Definition: genC.h:88
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
#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
void insert_comments_to_statement(statement, const char *)
Insert a comment string (if non empty) at the beginning of the comments of a statement.
Definition: statement.c:1916
int template_cell_local_mapping(entity array, int dim, int tc)
int template_cell_local_mapping(array, dim, tc)
Definition: hpfc-util.c:532
int DistributionParameterOfArrayDim(entity array, int dim, int *pprocdim)
Definition: hpfc-util.c:472
void get_entity_dimensions(entity e, int dim, int *plow, int *pup)
Definition: hpfc-util.c:651
int HpfcExpressionToInt(expression e)
HpfcExpressionToInt(e)
Definition: hpfc-util.c:569
bool ith_dim_distributed_p(entity array, int i, int *pprocdim)
whether a dimension is distributed or not.
Definition: hpfc-util.c:160
int global_array_cell_to_local_array_cell(entity array, int dim, int acell)
int global_array_cell_to_local_array_cell(array, dim, acell)
Definition: hpfc-util.c:550
#define TEMPLATEV
Definition: defines-local.h:80
#define array_to_template(array)
#define array_to_processors(array)
#define TSHIFTV
Definition: defines-local.h:81
#define RECEIVE
#define template_to_processors(template)
#define hpfc_warning
WARNING.
#define st_receive_from_neighbour()
RCV.
#define SEND
#define PVECTOR(v)
Definition: defines-local.h:72
#define st_send_to_neighbour()
list add_elem_to_list_of_Pvecteur(list, int, int)
caution, is initial list is destroyed.
entity load_new_node(entity)
list dup_list_of_ranges_list(list)
??? the complexity of this function could be greatly improved
Definition: message-utils.c:72
Pvecteur the_index_of_vect(Pvecteur)
message-utils.c
Definition: message-utils.c:37
statement generate_guarded_statement(statement, entity, list)
list template_ranges_to_processors_ranges(entity, list)
list compute_receive_domain(list, Pvecteur)
bool empty_section_p(list)
bool larger_message_in_list(message, list)
list array_ranges_to_template_ranges(entity, list)
list generate_message_from_3_lists(entity, list, list, list)
list generate_message_from_3_lists(array, lcontent, lneighbour, ldomain)
statement st_compute_neighbour(int)
call to the runtime support function HPFC_CMPNEIGHBOUR(d)
Definition: run-time.c:394
range complementary_range(entity, int, range)
range complementary_range(array, dim, r)
list add_to_list_of_ranges_list(list, range)
Definition: message-utils.c:51
list compute_receive_content(entity, list, Pvecteur)
list dup_list_of_Pvecteur(list)
??? the complexity of this function could be improved greatly...
Definition: message-utils.c:93
char * sprint_lrange(string, list)
statement st_generate_packing(entity, list, bool)
statement st_generate_packing_and_passing(array, content, bsend)
Definition: run-time.c:422
#define message_array(x)
Definition: message.h:75
#define message_dom(x)
Definition: message.h:81
#define message_neighbour_(x)
Definition: message.h:78
#define MESSAGE(x)
newgen_message_domain_defined
Definition: message.h:43
#define message_neighbour(x)
Definition: message.h:79
#define message_content(x)
Definition: message.h:77
static expression safe_static_domain_bound(entity array, int dim, expression e, int shift, bool lower)
Messages handling.
Definition: messages.c:37
static list keep_non_empty_messages_with_destination(list l)
Definition: messages.c:438
static list messages_guards_and_neighbour(list l)
Definition: messages.c:588
static list atomize_one_message(message m)
Definition: messages.c:351
static message shape_one_message(message m)
message shape_one_message(m)
Definition: messages.c:476
static list keep_non_empty_domain_messages(list l)
Definition: messages.c:455
static list messages_generation(list Ro, list lRo)
list messages_generation(Ro, lRo)
Definition: messages.c:319
static message one_message_guards_and_neighbour(message m)
Definition: messages.c:545
static statement st_one_message(message m, bool bsend)
statement st_one_message(m, bsend)
Definition: messages.c:645
static list generate_the_messages(list lm, bool bsend)
Definition: messages.c:689
static list receive_messages_generation(list lms)
list receive_messages_generation(lms)
Definition: messages.c:623
static message generate_one_message(entity array, list li, list lk, list lv)
message generate_one_message(array, li, lk, lv)
Definition: messages.c:62
static message one_receive_message(message send)
Definition: messages.c:601
static list remove_stammering_messages(list lm)
list remove_stammering_messages(lm)
Definition: messages.c:704
static list messages_shaping(list l)
Definition: messages.c:535
static list messages_atomization(list lm1)
Definition: messages.c:428
statement messages_handling(list Ro, list lRo)
every required conditions are supposed to be verified in this function.
Definition: messages.c:724
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_internal_error
Definition: misc-local.h:149
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
#define assert(ex)
Definition: newgen_assert.h:41
int tag
TAG.
Definition: newgen_types.h:92
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
expression 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 Value_to_expression(Value v)
added interface for linear stuff.
Definition: expression.c:1251
dimension FindIthDimension(entity, int)
Definition: type.c:1180
int SizeOfIthDimension(entity, int)
this function returns the size of the ith dimension of a variable e.
Definition: size.c:453
int NumberOfDimension(entity)
Definition: size.c:588
#define syntax_reference(x)
Definition: ri.h:2730
#define reference_variable(x)
Definition: ri.h:2326
#define range_upper(x)
Definition: ri.h:2290
#define dimension_lower(x)
Definition: ri.h:980
#define range_increment(x)
Definition: ri.h:2292
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define RANGE(x)
RANGE.
Definition: ri.h:2257
#define dimension_upper(x)
Definition: ri.h:982
#define reference_indices(x)
Definition: ri.h:2328
#define range_lower(x)
Definition: ri.h:2288
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
#define SYNTAX(x)
SYNTAX.
Definition: ri.h:2670
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define ifdebug(n)
Definition: sg.c:47
static entity array
static char buf[BSZ]
Definition: split_file.c:157
#define intptr_t
Definition: stdint.in.h:294
static string buffer
Definition: string.c:113
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
#define abs(v)
Definition: syntax-local.h:48
A DOMAIN union describes the structure of a user type.
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define val_of(varval)
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
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 var_of(varval)
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
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