PIPS
instruction_to_wp65_code.c
Go to the documentation of this file.
1 /*
2 
3  $Id: instruction_to_wp65_code.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 /* Code Generation for Distributed Memory Machines
28  *
29  * Higher level functions
30  *
31  * PUMA, ESPRIT contract 2701
32  *
33  * Francois Irigoin, Corinne Ancourt
34  * 1991
35  */
36 
37 #include <stdio.h>
38 #include <string.h>
39 
40 #include "genC.h"
41 
42 #include "linear.h"
43 #include "ri.h"
44 #include "effects.h"
45 #include "dg.h"
48 #include "graph.h"
49 
50 #include "matrice.h"
51 #include "tiling.h"
52 #include "database.h"
53 #include "text.h"
54 
55 #include "misc.h"
56 #include "ri-util.h"
57 #include "prettyprint.h"
58 #include "effects-util.h"
59 #include "text-util.h"
60 #include "resources.h"
61 #include "pipsdbm.h"
62 #include "movements.h"
63 #include "rice.h"
64 #include "constants.h"
65 
66 #include "ricedg.h"
67 #include "wp65.h"
68 
70 static int loop_nest_dim =0;
72 
73 static void
75 {
77  CONS(RANGE,r,NIL):
79 }
80 static void
82 {
84 }
85 
86 static void
88 {
89 
92  loop_nest_dim ++;
93 }
94 
95 static void
97 {
98  loop_nest_dim = 0;
100 }
101 
102 /* Function used during code generation for non-perfectly
103  nested loops. The loops of inner nests are executed sequentially.
104  No tiling is applied on these inner loops. Thus, the new loop
105  bounds do not change, except that there are shift -1 to deal with
106  Fortran declarations.
107  */
108 static void
110 {
111  range r = loop_range(l);
112  Pvecteur vlow = VECTEUR_NUL,vup = VECTEUR_NUL;
113  expression low = range_lower(r);
114  expression up = range_upper(r);
115  normalized low_norm = NORMALIZE_EXPRESSION(low);
116  normalized up_norm = NORMALIZE_EXPRESSION(up);
117 
118  if (normalized_linear_p(low_norm) && normalized_linear_p(up_norm)){
119  vlow = (Pvecteur) normalized_linear(low_norm);
120  vup = (Pvecteur) normalized_linear(up_norm);
121  vect_add_elem(&vlow,TCST, VALUE_MONE);
125  }
126  else (void) fprintf(stderr,"non linear loop bounds-cannot be reduced\n");
127 }
128 
129 static void
131 {
133 
134 }
135 bool
137 {
138  list pl;
139  for(pl=lsb;
141  pl = CDR(pl));
142  return(pl==NIL);
143 }
144 
145 entity
147 {
148  entity result = entity_undefined;
149  list ith_index=reference_indices(r);
150  expression exp_ind = EXPRESSION(gen_nth(level,ith_index));
151  syntax sy = expression_syntax(exp_ind);
152  if (syntax_reference_p(sy))
153  result = reference_variable(syntax_reference(sy));
154  return (result);
155 }
156 
157 loop
159 {
161  loop loop1;
162  if (instruction_block_p(inst)) {
164  inst = statement_instruction(st1);
165  }
166  loop1 = instruction_loop(inst);
167  return((level ==1) ? loop1 :
169 
170 }
171 
172 ␌
173 
174 void
175 instruction_to_wp65_code(entity module, list l, graph dg,int pn,int bn,int ls,int pd,
176  entity proc_id, entity proc_id_mm,Pbase bank_indices,
177  hash_table v_to_esv,hash_table v_to_nlv,
178  entity compute_module, statement computational,
179  entity memory_module, statement emulator,
180  statement_mapping fetch_map,
181  statement_mapping store_map)
182 {
183 
184  statement mod_stat/*,cms*/;
185  //entity cme;
186  debug_on("WP65_DEBUG_LEVEL");
187 
188  /* FI: the semantics has been changed: the next two get_xxx() cannot/should not return
189  * something undefined.
190  */
191  /* if ((cme = get_current_module_entity()) == entity_undefined) */
192  /* FI: already done somewhere else */
193  /* set_current_module_entity(local_name_to_top_level_entity(module_local_name(module))); */
194  /* if ((cms = get_current_module_statement()) == statement_undefined) */
195  /* FI: shouldn't the current statement be retrieved at the same time as the current module? */
197  db_get_memory_resource(DBR_CODE,
199  true) );
201  MAPL(pm,{
202  statement s1 = STATEMENT(CAR(pm));
204  ifdebug(9)
205  (void) fprintf(stderr,
206  "instruction_to_wp65_code-instruction- begin\n");
207  switch(instruction_tag(inst)) {
208 
209  case is_instruction_block:{
211  dg, pn, bn, ls, pd,
212  proc_id, proc_id_mm, bank_indices,
213  v_to_esv, v_to_nlv,
214  compute_module, computational,
215  memory_module, emulator,
216  fetch_map,store_map);
217 
218  break;}
219  case is_instruction_test: {
220  (void) fprintf(stderr,
221  "instruction_to_wp65_code-Sorry:test not implemented\n");
222  break;}
223  case is_instruction_goto: {
224  (void) fprintf(stderr,
225  "instruction_to_wp65_cod -Sorry:goto implemented\n");
226  break;}
227  case is_instruction_loop: {
228  loop_nest_to_wp65_code(module, s1, dg, pn, bn, ls, pd,
229  proc_id, proc_id_mm, bank_indices,
230  v_to_esv, v_to_nlv,
231  compute_module, computational,
232  memory_module, emulator,
233  fetch_map,store_map,mod_stat);
234  break;}
235  case is_instruction_call: {
236  if (!return_statement_p(s1)) {
237 
238  call_to_wp65_code(s1,compute_module,
239  memory_module,
240  (entity) bank_indices->var,proc_id,
241  computational,emulator, fetch_map,
242  store_map,v_to_esv);
243  }
244  break;
245  }
247  pips_internal_error("Sorry: unstructured not implemented");
248  break;}
249  default:
250  (void) fprintf(stderr,
251  " instruction_to_wp65_code- bad instruction tag \n");
252  break;
253  }
254  ifdebug(9)
255  (void) fprintf(stderr,
256  "instruction_to_wp65_code-instruction_end \n");
257  },l);
258  /* reset_current_module_entity(); */
260  debug_off();
261 }
262 
263 
264 ␌
265 
266 void
267 call_to_wp65_code(statement s, entity compute_module, entity memory_module,
268  entity bank_id, entity proc_id,
269  statement computational,statement emulator,
270  statement_mapping fetch_map,
271  statement_mapping store_map, hash_table v_to_esv)
272 {
273  list lrefs;
274  bool load_code = true;
275  instruction i;
277  /* To deal with implied_do and I/Os */
278 
279 
280  if (strcmp(entity_local_name(call_function(c)), "WRITE") == 0) {
281  generate_io_wp65_code(s,s,v_to_esv,false);
282  i = statement_instruction(emulator);
284  CONS(STATEMENT,
285  copy_statement(s), NIL));
286  }
287  else { /* communications for variables having to be
288  loaded in local memories for assignments */
289  if ((lrefs = (list) GET_STATEMENT_MAPPING(fetch_map,s))
290  != (list) HASH_UNDEFINED_VALUE) {
291  ifdebug(9) {
292  (void) fprintf(stderr,
293  "Vars having to be loaded for stat %"PRIdPTR":\n",
294  statement_number(s));
295  reference_list_print(lrefs); }
296  include_constant_symbolic_communication(compute_module,lrefs,
297  load_code,computational,
298  proc_id);
299  include_constant_symbolic_communication(memory_module,lrefs,
300  !load_code,emulator,
301  bank_id);
302  }
303  i = statement_instruction(computational);
306  /* communications for variables having to be
307  stored in global memory for assignments */
308  if ((lrefs = (list) GET_STATEMENT_MAPPING(store_map,s))
309  != (list) HASH_UNDEFINED_VALUE) {
310  load_code = false;
311  ifdebug(9) {
312  (void) fprintf(stderr,
313  "Vars having to be stored for stat %"PRIdPTR":\n",
314  statement_number(s));
315  reference_list_print(lrefs); }
316  include_constant_symbolic_communication(compute_module,lrefs,
317  load_code,computational,proc_id);
318  include_constant_symbolic_communication(memory_module,lrefs,
319  !load_code,emulator,bank_id);
320  }
321  }
322 }
323 
324 /* This function extracts from an implied_do expression the
325  reference having to be computed or printed */
326 
327 expression
329 {
331  list call_args = call_arguments(c2);
332  expression last_call = EXPRESSION(CAR(gen_last(call_args)));
333  syntax s = expression_syntax(last_call);
334 
335  return((syntax_call_p(s)
337  "IMPLIED-DO") == 0)) ?
338  ref_in_implied_do(last_call):
339  last_call );
340 }
341 
342 /* This function translates a reference in I/O statement into
343  its corresponding emulated shared memory reference */
344 
345 reference
346 translate_IO_ref(call c, hash_table v_to_esv, bool loop_or_call_print)
347 {
348  pips_assert("true", loop_or_call_print==loop_or_call_print);
349  list pio,pc = NIL;
350  bool iolist_reached = false;
351  expression exp;
352  syntax s;
354  if (same_string_p(entity_local_name(call_function(c)), "WRITE")) {
355  pio = pc = call_arguments(c);
356  /* scan the argument list till IOLIST' arguments*/
357  while (!ENDP(pio) && (!iolist_reached)) {
358  call c1;
359  expression arg;
360  s = expression_syntax(EXPRESSION(CAR(pio)));
361  c1=syntax_call(s);
362  arg = EXPRESSION(CAR(CDR(pio)));
363 
364  if (((strcmp(entity_local_name(call_function(c1)),"FMT=")==0) &&
365  (strcmp(expression_to_string(arg),"*")==0))
366  ||((strcmp(entity_local_name(call_function(c1)),"UNIT=")==0)
367  &&
368  (strcmp(expression_to_string(arg),"*")==0)))
369  pio = CDR(CDR(pio));
370  else
371  if (strcmp(entity_local_name(call_function(c1)),
372  "IOLIST=")==0) {
373  iolist_reached = true;
374  pio = CDR(pio);
375  }
376  }
377  exp = EXPRESSION(CAR(pio));
378  /* implied-do case: the array reference is the first argument
379  in the last argument list of the implied do call */
381  if (syntax_call_p(s) &&
383  "IMPLIED-DO") == 0)) {
386  }
387  if (syntax_reference_p(s)) {
389  reference ref1 = syntax_reference(sy1);
391  entity ent1=(entity)hash_get(v_to_esv,
392  (char *) reference_variable(ref1));
393  reference newr = make_reference(ent1,indic);
395  result = ref1;
396  }
397  }
398  else
399  pips_user_error("function calls are not handled in this version\n");
400  return result;
401 }
402 
403 
404 
405 statement
406 generate_io_wp65_code(statement s1,statement body,hash_table v_to_esv,bool loop_or_call_print)
407 {
408 
409  list rvld,pl;
410  statement result = s1;
411  instruction inst = statement_instruction(body);
412  call c;
413  reference r;
414 
415  entity rv,esv_ref;
416  type rvt;
417  int nb_dim,i;
418 
419  /* we know that it is a loop nest containing a PRINT function
420  The loop body contains block statement in case of CONTINUE
421  loop nest style*/
423  if (instruction_block_p(inst)) {
424  list b = instruction_block(inst);
426  }
427  else
428  c= instruction_call(inst);
429  r = translate_IO_ref(c,v_to_esv,loop_or_call_print);
430  rv = reference_variable(r);
431  esv_ref = (entity) hash_get(v_to_esv,(char *) rv);
432  rvt = entity_type(esv_ref);
433  rvld = variable_dimensions(type_variable(rvt));
434  nb_dim = gen_length((list) rvld);
435 
436  if (loop_or_call_print) /* loop nest belonging IO statement */
437  for (i=1; i<=nb_dim; i++) {
438  list ldim = gen_nthcdr(i-1,rvld);
439  expression low = dimension_lower(DIMENSION(CAR(ldim)));
441  range looprange = make_range(low, up,
442  int_to_expression(1));
443  loop loopi = ith_loop_in_loop_nest(result,i);
444  loop_range(loopi) = looprange;
445  }
446  else { /* implied_do case */
448  implied_do_ranges(result);
450  for (i=1,pl = implied_do_range_list; !ENDP(pl); POP(pl),i++) {
451  range r1 = RANGE(CAR(pl));
452  list ldim = gen_nthcdr(i-1,rvld);
454  dimension_lower(DIMENSION(CAR(ldim))));
456  dimension_upper(DIMENSION(CAR(ldim))));
457  range_lower(r1)=low;
458  range_upper(r1)=up;
459  }
460  }
461  return(result);
462 }
463 
464 /* Test if the statement resulting from the
465  perfectly_loop_nest_to_body function contains at first call an io */
466 bool
468 {
470  call c;
471  if (instruction_block_p(inst)) {
472  list b = instruction_block(inst);
474  }
475  else
476  c= instruction_call(inst);
477  return (strcmp(entity_local_name(call_function(c)), "WRITE") == 0) ;
478 }
479 
480 
481 
482 void
484  entity module,
485  statement loop_nest,
486  int pn,
487  int bn,
488  int ls,
489  int pd,
490  entity proc_id,
491  entity proc_id_mm,
492  Pbase bank_indices,
493  hash_table v_to_esv,
494  hash_table v_to_nlv,
495  entity compute_module,
496  statement computational,
497  entity memory_module,
498  statement emulator,
499  statement_mapping fetch_map,
500  statement_mapping store_map,
502  bool fully_parallel,
503  Psysteme sc_tile,
504  Pbase initial_basis,
505  Pbase local_basis,
506  Pbase local_basis2,
507  Pbase tile_basis_in_tile_basis,
508  Pbase tile_basis_in_tile_basis2,
509  Pbase loop_body_indices,
510  list lpv,
511  list * lb,
512  list *blb,
513  list *sb,
514  list *bsb,
515  int first_parallel_level,
516  int last_parallel_level,
517  hash_table llv_to_lcr,
518  hash_table r_to_llv,
519  hash_table v_to_lllv,
520  hash_table r_to_ud)
521 {
522  pips_assert("true", pd==pd
523  && proc_id_mm==proc_id_mm
524  &&v_to_nlv==v_to_nlv
525  && emulator==emulator
526  && mod_stat==mod_stat
527  && r_to_llv==r_to_llv
528  && computational==computational);
529 
530  list fetch_data_list =NIL;
531  list store_data_list = NIL;
532  list fetch_reference_list = NIL;
533  list store_reference_list = NIL;
534  debug_on("WP65_DEBUG_LEVEL");
535  /* the list of data having to be store into the global memory
536  is the concatenation of store_map sets of the internal loops */
537 
538  concat_data_list(&fetch_data_list,&fetch_reference_list,
539  loop_nest,fetch_map,fully_parallel);
540  concat_data_list(&store_data_list , &store_reference_list ,
541  loop_nest,store_map,fully_parallel);
542  MAPL(r1,{ entity rv = (entity) reference_variable(REFERENCE(CAR(r1)));
543  if(!entity_is_argument_p(rv, lpv))
545  module,compute_module,memory_module,
546  rv,fetch_reference_list,
547  llv_to_lcr, v_to_lllv,r_to_ud, v_to_esv,
548  pn,bn, ls,
549  sc_tile, initial_basis, local_basis,
550  proc_id, bank_indices,loop_body_indices,
551  lb, blb,is_action_read,first_parallel_level,
552  last_parallel_level);
553  },
554  fetch_data_list);
555  /* update of variable names according to the module of appartenance */
556  sc_variables_rename(sc_tile,local_basis2,local_basis, (string(*)(void*))entity_local_name);
557  sc_variables_rename(sc_tile, tile_basis_in_tile_basis2,
558  tile_basis_in_tile_basis,(string(*)(void*))entity_local_name);
559  MAPL(r1,{
560  reference rf = REFERENCE(CAR(r1));
561  entity rv = (entity) reference_variable(rf);
562  if (!reference_scalar_p(rf) && !entity_is_argument_p(rv, lpv))
563  make_all_movement_blocks(module,compute_module,memory_module,
564  rv,store_reference_list ,
565  llv_to_lcr, v_to_lllv, r_to_ud, v_to_esv,
566  pn,bn, ls,
567  sc_tile, initial_basis, local_basis,
568  proc_id, bank_indices, loop_body_indices,
569  sb, bsb, is_action_write,
570  first_parallel_level,
571  last_parallel_level);
572  },
573  store_data_list);
574  debug_off();
575 }
576 
577 
578 void
580  entity module,
581  statement loop_nest,
582  graph dg,
583  int pn,
584  int bn,
585  int ls,
586  int pd,
587  entity proc_id,
588  entity proc_id_mm,
589  Pbase bank_indices,
590  hash_table v_to_esv,
591  hash_table v_to_nlv,
592  entity compute_module,
593  statement computational,
594  entity memory_module,
595  statement emulator,
596  statement_mapping fetch_map,
597  statement_mapping store_map,
599 {
600 
601  Psysteme iteration_domain = sc_new();
602  Psysteme iteration_domain2 = sc_new();
603  Psysteme sc_tile = SC_UNDEFINED;
604  tiling tile;
605  Pvecteur tile_delay = VECTEUR_NUL;
606  Pvecteur pv;
607  int it;
608  list lb = NIL; /* load block */
609  list blb = NIL; /* bank load block */
610  list sb = NIL; /* store block */
611  list bsb = NIL; /* bank store block */
612  list cb = NIL; /* compute block */
613  /* list of local variables to list of conflicting references */
614  hash_table llv_to_lcr = hash_table_make(hash_pointer, 0);
615  /* inverse table: list of local variables to use for a given reference */
616  hash_table r_to_llv = hash_table_make(hash_pointer, 0);
617  /* variable to list of list of local variables: the main list
618  is an image of connected components of the dependence graph filtered
619  for a given variable, v; the low-level list is a function of
620  the number of pipeline stages */
621  hash_table v_to_lllv = hash_table_make(hash_pointer,0);
622  /* reference to use-def usage ; use and def are encoded as action_is_read
623  and action_is_write */
625 
626  /* pipelining offset; no pipelining is implemented yet */
627  Pbase offsets = VECTEUR_NUL;
628  statement body;
629 
630  /* private variables for the loop nest */
632 
633  /* local variables */
634  list cbl, embl = NIL;
635  statement cs, ems,bs;
637  instruction i;
638  list store_data_list = NIL;
639  list store_reference_list = NIL;
640  Pbase initial_basis = BASE_NULLE;
641  Pbase full_initial_basis = BASE_NULLE;
642  Pbase local_basis = BASE_NULLE;
643  Pbase tile_basis_in_initial_basis = BASE_NULLE;
644  Pbase tile_basis_in_tile_basis = BASE_NULLE;
645  Pbase local_basis2 = BASE_NULLE;
646  Pbase initial_basis2= BASE_NULLE;
647  Pbase tile_basis_in_tile_basis2 = BASE_NULLE;
648  Pbase loop_body_indices = BASE_NULLE;
649  int i1,lpl, loop_nest_dimt;
650  int first_parallel_level=1;
651  int last_parallel_level, perfect_nested_loop_size;
652  bool loop_carried_dep[11];
653  bool fully_parallel;
654  bool fully_sequential=true;
655  int nested_level2,nested_level=0;
656  list list_statement_block=NIL;
657  list list_statement_block2=NIL;
658  list new_compute_lst = NIL;
659  list new_bank_lst = NIL;
660  instruction binst,binst2;
661  bool io_statementp=false;
662 
663  debug_on("WP65_DEBUG_LEVEL");
664  debug(5,"loop_nest_to_wp65_code", "begin\n");
665 
666  for (i1=1;i1<=10;i1++) loop_carried_dep[i1] = false;
667  compute_loop_nest_dim(loop_nest);
668  loop_nest_dimt = loop_nest_dim;
669 
670 
671  fully_parallel = full_parallel_loop_nest_p(mod_stat,loop_nest,
672  loop_nest_dimt,dg,
673  loop_carried_dep);
674  find_iteration_domain(loop_nest,&iteration_domain, &initial_basis,
675  &nested_level,&list_statement_block, &binst);
676  full_initial_basis = base_dup(initial_basis);
677  perfect_nested_loop_size= vect_size(initial_basis);
678 
679  /* pour eviter tous les problemes de tiling sur les nids de boucles
680  internes a des nids de boucles mal imbriques on execute les boucles
681  internes en sequentiel. Il faudrait autrement s'assurer que l'on a
682  les meme indices de boucles en interne pour le tiling et que les
683  bornes sont identiques (meme restrictions que pour du loop fusion) */
684 
685  for (i1=perfect_nested_loop_size+1;i1<=10;i1++)
686  loop_carried_dep[i1] = true;
687  assert(perfect_nested_loop_size <=10);
688 
689  last_parallel_level =perfect_nested_loop_size+1;
690  if (!fully_parallel) {
691  for (i1=1; i1<=loop_nest_dimt && (loop_carried_dep[i1] == true);
692  i1++);
693  first_parallel_level = i1;
694  for (i1=first_parallel_level;
695  i1<=loop_nest_dimt && (loop_carried_dep[i1] == false);i1++);
696  last_parallel_level = i1-1;
697  for (it=1, pv=initial_basis;
698  it <perfect_nested_loop_size && it<last_parallel_level;
699  it++, pv=pv->succ);
700  loop_body_indices = base_dup(pv->succ);
701  ifdebug(4) {
702  (void) fprintf(stderr,"first_parallel_level :%d, last_parallel_level %d\n",
703  first_parallel_level,last_parallel_level);
704  (void) fprintf(stderr,"\nLoop body basis - loop_nest:");
705  base_fprint(stderr, loop_body_indices, (string(*)(void*))entity_local_name);
706  (void) fprintf(stderr,"\nInitial basis - loop_nest:");
707  base_fprint(stderr, initial_basis, (string(*)(void*))entity_local_name);
708  }
709  }
710 
711  /* creation of new indices */
712  create_tile_basis(module,compute_module,memory_module, initial_basis,
713  &tile_basis_in_initial_basis,
714  &tile_basis_in_tile_basis,
715  &local_basis,
716  &tile_basis_in_tile_basis2,
717  &local_basis2);
718  lpl = (fully_parallel) ? last_parallel_level-1:last_parallel_level;
719  tile = loop_nest_to_tile(iteration_domain, ls,
720  initial_basis, first_parallel_level,lpl,
721  perfect_nested_loop_size);
722 
723  sc_tile = loop_bounds_to_tile_bounds(iteration_domain,initial_basis,
724  tile, tile_delay,
725  tile_basis_in_tile_basis,
726  local_basis);
727 
728  ifdebug(8) {
729  fprintf(stderr,"loop body \n");
731  list_statement_block);
732  }
733  if (list_of_calls_p(list_statement_block)) {
734  body = perfectly_nested_loop_to_body(loop_nest);
735 
736  if (io_loop_nest_p(body)) {
737  io_st = generate_io_wp65_code(loop_nest,body,v_to_esv,true);
738  io_statementp = true;}
739  else {
740 
741  /* a modifie pour tenir compte des dimensions reelles des domaines */
742 
743  loop_nest_to_local_variables(module, compute_module, memory_module,
744  llv_to_lcr, r_to_llv, v_to_lllv,
745  r_to_ud, v_to_esv, v_to_nlv,
746  lpv, body, initial_basis, dg,
747  bn, ls, pd,
748  tile);
749  ifdebug(4) fprint_wp65_hash_tables(stderr, llv_to_lcr, r_to_llv, v_to_lllv,
750  r_to_ud, v_to_esv);
751 
752  loop_nest_movement_generation(module,loop_nest,pn,bn, ls, pd,proc_id,proc_id_mm,
753  bank_indices,v_to_esv,v_to_nlv,compute_module,
754  computational, memory_module,emulator,fetch_map,
755  store_map,mod_stat,fully_parallel,sc_tile,
756  full_initial_basis,local_basis, local_basis2,
757  tile_basis_in_tile_basis, tile_basis_in_tile_basis2,
758  loop_body_indices,lpv,&lb,&blb,&sb,
759  &bsb,first_parallel_level, last_parallel_level,
760  llv_to_lcr, r_to_llv, v_to_lllv,r_to_ud );
761 }
762  }
763  else {
764  Pbase tbib2 = BASE_NULLE;
765  Pbase tbtl3 = BASE_NULLE;
766  Pbase tbtl4 = BASE_NULLE;
767  Pbase lba3 = BASE_NULLE;
768  Pbase lba4 = BASE_NULLE;
769  Pbase lba5 = BASE_NULLE;
770  Pbase lba6 = BASE_NULLE;
771  Pbase tbtl5 = BASE_NULLE;
772  Pbase tbtl6 = BASE_NULLE;
773  Psysteme sc_tile2 = SC_UNDEFINED;
774  tiling tile2;
775 
776  MAPL(lsb,
777  {
778  statement stmp = STATEMENT(CAR(lsb));
779  if (!continue_statement_p(stmp)) {
780  instruction_block(binst) = CONS(STATEMENT,stmp,NIL);
781  ifdebug(8)
782  {
783  fprintf(stderr,"generation des transferts pour \n");
784  wp65_debug_print_text(module, loop_nest);
785  }
786  body = perfectly_nested_loop_to_body(loop_nest);
787  find_iteration_domain(loop_nest,&iteration_domain2,
788  &initial_basis2,&nested_level2,
789  &list_statement_block2,&binst2);
790  if (loop_nest_dimt > perfect_nested_loop_size) {
791  loop_body_indices = vect_dup(initial_basis2);
792  for ( pv=initial_basis; pv!= NULL;
793  vect_chg_coeff(&loop_body_indices,pv->var,VALUE_ZERO),
794  pv =pv->succ);
795  full_initial_basis=base_reversal(vect_add(initial_basis,
796  loop_body_indices));
797  /* normalement full_initila_basis == initial_basis2*/
798  }
799  ifdebug(2) {
800  (void) fprintf(stderr,"full basis\n");
801  base_fprint(stderr, initial_basis2,
802  (string(*)(void*))entity_local_name);
803  (void) fprintf(stderr,"full iteration domain\n");
804  sc_fprint(stderr,iteration_domain2,
805  (string(*)(void*))entity_local_name);
806  }
807  create_tile_basis(module,compute_module,memory_module, loop_body_indices,
808  &tbib2, &tbtl3, &lba3, &tbtl4, &lba4);
809  tbtl5= base_reversal(vect_add(tile_basis_in_tile_basis, tbtl3));
810  tbtl6= base_reversal(vect_add(tile_basis_in_tile_basis2, tbtl4));
811  //Pbase tbib3=base_reversal(vect_add(tile_basis_in_initial_basis, tbib2));
812  lba5= base_reversal(vect_add( local_basis, lba3));
813  lba6= base_reversal(vect_add( local_basis2, lba4));
814  /* a modifie pour tenir compte des dimensions reelles des domaines */
815  tile2 = loop_nest_to_tile(iteration_domain2, ls, initial_basis2,
816  first_parallel_level,lpl,
817  perfect_nested_loop_size);
818  sc_tile2=loop_bounds_to_tile_bounds(iteration_domain2,initial_basis2,
819  tile2, tile_delay,tbtl5,lba5);
820 
821  loop_nest_to_local_variables(module, compute_module, memory_module,
822  llv_to_lcr, r_to_llv, v_to_lllv,
823  r_to_ud, v_to_esv, v_to_nlv,
824  lpv, body, initial_basis2, dg,
825  bn, ls, pd,tile2);
826  ifdebug(4) fprint_wp65_hash_tables(stderr, llv_to_lcr,
827  r_to_llv, v_to_lllv,
828  r_to_ud, v_to_esv);
830  module,stmp,pn,bn, ls, pd,proc_id,
831  proc_id_mm, bank_indices,v_to_esv,
832  v_to_nlv,compute_module, computational,
833  memory_module,emulator,fetch_map,
834  store_map, mod_stat,fully_parallel,
835  sc_tile2,initial_basis2,lba5,lba6,tbtl5,
836  tbtl6,loop_body_indices,lpv,&lb,&blb,&sb,
837  &bsb,first_parallel_level,
838  last_parallel_level, llv_to_lcr,
839  r_to_llv, v_to_lllv,r_to_ud );
841  }
842 
843  },
844  list_statement_block);
845  }
846  fully_sequential = (first_parallel_level >last_parallel_level);
847 
848  if (io_statementp) {
849  cs = statement_undefined;
850  ems =io_st;
851  }
852  else {
853  insert_run_time_communications(compute_module, memory_module,
854  bank_indices,bn,ls,proc_id,
855  list_statement_block,fetch_map,
856  store_map,&new_compute_lst,
857  &new_bank_lst,v_to_esv,
858  fully_sequential,
859  initial_basis,tile, tile_delay,
860  tile_basis_in_tile_basis,
861  local_basis);
862 
863  instruction_block(binst)= new_compute_lst;
864  body = instruction_to_statement(binst);
865  ifdebug(8) {
866  fprintf(stderr,"loop body \n");
868  fprintf(stderr,"base_initiale 1\n");
869  vect_fprint(stderr,initial_basis,(string(*)(void*))entity_local_name);
870  }
871 
872  sc_variables_rename(sc_tile,local_basis,local_basis2, (string(*)(void*))entity_local_name);
873  sc_variables_rename(sc_tile, tile_basis_in_tile_basis,
874  tile_basis_in_tile_basis2,(string(*)(void*))entity_local_name);
875 
876  cb = make_compute_block(compute_module, body, offsets, r_to_llv,tile,
877  initial_basis, local_basis2,
878  tile_basis_in_tile_basis2,
879  tile_basis_in_initial_basis,
880  iteration_domain,first_parallel_level,
881  last_parallel_level);
882 
883 
884  if (new_bank_lst != NIL) {
886  make_block_statement(new_bank_lst),
887  tile, initial_basis, local_basis,
888  tile_basis_in_tile_basis,
889  tile_basis_in_initial_basis,
890  iteration_domain,
891  first_parallel_level,
892  last_parallel_level);
893  new_bank_lst = CONS(STATEMENT,bs,NIL);
894  }
895  /* put together the different pieces of code as two lists of
896  statements */
897  cbl = gen_nconc(lb, gen_nconc(cb ,sb));
898  bsb = gen_nconc(new_bank_lst, bsb);
899  embl =gen_nconc(blb, bsb);
900 
901  /* add the scanning over the tiles around them to build a proper stmt */
902  cs = make_scanning_over_tiles(compute_module, cbl, proc_id, pn,tile,
903  initial_basis,
904  tile_basis_in_tile_basis2,
905  tile_basis_in_initial_basis,
906  iteration_domain,first_parallel_level,
907  last_parallel_level);
908  ems = make_scanning_over_tiles(memory_module, embl, proc_id_mm,
909  pn, tile, initial_basis,
910  tile_basis_in_tile_basis,
911  tile_basis_in_initial_basis,
912  iteration_domain,first_parallel_level,
913  last_parallel_level);
914 
915  if (fully_sequential) {
916  range looprange = make_range(int_to_expression(0),
917  int_to_expression(pn-1),
918  int_to_expression(1));
919  entity looplabel = make_loop_label(9000,
920  compute_module);
921  loop newloop = make_loop(proc_id,
922  looprange,
923  ems,
924  looplabel,
926  UU),
927  NIL);
928 
929  ems = loop_to_statement(newloop);
930  }
931  /* update computational and emulator with cs and ems */
932  }
933  i = statement_instruction(computational);
934  if (cs != statement_undefined)
936  i = statement_instruction(emulator);
938 
939  ifdebug(5) {
940  (void) fprintf(stderr,
941  "Vars having to be stored into global memory:\n");
942  reference_list_print(store_data_list);
943  reference_list_print(store_reference_list);
944  }
946 
947  MAPL(r1,{
948  reference rf = REFERENCE(CAR(r1));
949  if (reference_scalar_p(rf)) {
951  false,computational,proc_id);
953  true,emulator,(entity)bank_indices->var);
954  }
955  },
956  store_data_list);
957  hash_table_free(llv_to_lcr);
958  hash_table_free(r_to_llv);
959  hash_table_free(v_to_lllv);
960  hash_table_free(r_to_ud);
961 
962  debug(5,"loop_nest_to_wp65_code", "end\n");
963  debug_off();
964 }
965 
966 
967 
968 ␌
969 /* generates all data movements related to entity v, loads or stores
970  depending on use_def */
971 void
972 make_all_movement_blocks(initial_module,compute_module,memory_module, v,map,
973  llv_to_lcr, v_to_lllv,r_to_ud, v_to_esv,
974  pn,bn, ls,
975  iteration_domain, initial_basis, local_basis,
976  proc_id, bank_indices, loop_body_indices,
977  pmb, pbmb,
978  use_def,first_parallel_level,last_parallel_level)
979 entity initial_module;
980 entity compute_module;
981 entity memory_module;
982 entity v;
983 list map;
984 hash_table llv_to_lcr;
985 hash_table v_to_lllv;
986 hash_table r_to_ud;
987 hash_table v_to_esv;
988 int pn;
989 int bn;
990 int ls;
991 Psysteme iteration_domain;
992 Pbase initial_basis;
993 Pbase local_basis;
994 entity proc_id;
995 Pbase bank_indices;
996 Pbase loop_body_indices;
997 list * pmb; /* movement blocks */
998 list * pbmb; /* bank movement blocks */
999 tag use_def;
1000 int first_parallel_level,last_parallel_level;
1001 {
1002  list lllv = (list) hash_get(v_to_lllv, (char *) v);
1003  entity esv = (entity) hash_get(v_to_esv, (char *) v);
1004 
1005  debug(8,"make_all_movement_blocks", "begin\n");
1006  for(; !ENDP(lllv); POP(lllv)) {
1007  /* FI: depending on the pipeline stage, a specific lv should be
1008  chosen; by default, let's take the first one */
1009  list llv = LIST(CAR(lllv));
1010  entity lv = ENTITY(CAR(llv));
1011  list lr = (list) hash_get(llv_to_lcr, (char *) llv);
1012  bool proper_tag = false;
1013 
1014  for(; !ENDP(lr) && !proper_tag ; POP(lr)) {
1015  reference r = REFERENCE(CAR(lr));
1016  if( reference_in_list_p(r,map) &&
1017  (intptr_t) hash_get(r_to_ud, r) == (intptr_t)use_def) {
1018  statement mbs = NULL; /* statement for one movement block */
1019  statement bmbs = NULL; /* statement for one bank movement block */
1020 
1021  proper_tag = true;
1022  switch(use_def) {
1023  case is_action_read:
1024  make_load_blocks(initial_module,compute_module,
1025  memory_module, v, esv, lv,
1026  lr, r_to_ud, iteration_domain,
1027  initial_basis, bank_indices,
1028  local_basis, loop_body_indices,
1029  proc_id, pn,bn, ls,
1030  &mbs, &bmbs,first_parallel_level,
1031  last_parallel_level);
1032 
1033  break;
1034  case is_action_write:
1035  make_store_blocks(initial_module,compute_module,
1036  memory_module, v, esv, lv,
1037  lr, r_to_ud, iteration_domain,
1038  initial_basis,
1039  bank_indices,local_basis,
1040  loop_body_indices,
1041  proc_id, pn,bn, ls,
1042  &mbs, &bmbs,first_parallel_level,
1043  last_parallel_level);
1044  break;
1045  default:
1046  pips_internal_error("unexpected use-def = %d", use_def);
1047  }
1048 
1049  ifdebug(9) {
1050  pips_debug(9, "mbs=\n");
1051  wp65_debug_print_text(compute_module, mbs);
1052  pips_debug(9, "bmbs=\n");
1053  wp65_debug_print_text(compute_module, mbs);
1054  }
1055 
1056  *pmb = gen_nconc(*pmb, CONS(STATEMENT, mbs, NIL));
1057  *pbmb = gen_nconc(*pbmb, CONS(STATEMENT, bmbs, NIL));
1058  }
1059  }
1060  }
1061 
1062  debug(8,"make_all_movement_blocks", "end\n");
1063 }
1064 
1065 
1066 
1067 void
1068 search_parallel_loops( mod_stat,loop_statement,dg,loop_carried_dep)
1070 statement loop_statement;
1071 graph dg;
1072 bool loop_carried_dep[11];
1073 {
1074  cons *pv1, *ps, *pc;
1075  set region = region_of_loop(loop_statement);;
1076 
1078 
1079  for (pv1 = graph_vertices(dg); !ENDP(pv1); pv1 = CDR(pv1)) {
1080  vertex v1 = VERTEX(CAR(pv1));
1083 
1084  if (set_belong_p(region,(char *) s1)) {
1085  for (ps = vertex_successors(v1); !ENDP(ps); ps = CDR(ps)) {
1086  successor su = SUCCESSOR(CAR(ps));
1087  vertex v2 = successor_vertex(su);
1088  statement s2 = vertex_to_statement(v2);
1089  list loops2 = load_statement_enclosing_loops(s2);
1091  int nbrcomloops = FindMaximumCommonLevel(loops1, loops2);
1092 
1093  for (pc = dg_arc_label_conflicts(dal);
1094  !ENDP(pc); pc = CDR(pc)) {
1095  conflict c = CONFLICT(CAR(pc));
1096 
1097  if(conflict_cone(c) != cone_undefined) {
1098  cons * lls = cone_levels(conflict_cone(c));
1099  cons *llsred =NIL;
1100  MAPL(pl,{
1101  int level = INT(CAR(pl));
1102  if ((level <= nbrcomloops)
1103  && !ignore_this_conflict(v1,v2,c,level))
1104  llsred = gen_nconc(llsred, CONS(INT, level, NIL));
1105  }, lls);
1106  if (llsred != NIL)
1107  MAPL(pl,
1108  { loop_carried_dep[INT(CAR(pl))] = true;
1109  }, llsred);
1110  }
1111  }
1112  }
1113  }
1114  }
1116 }
1117 
1118 bool
1120  int nest_dim,graph dg, bool *loop_carried_dep)
1121 {
1122  int i;
1123  search_parallel_loops(mod_stat,loop_stmt, dg,loop_carried_dep);
1124  for (i=1; i<= nest_dim && loop_carried_dep[i]== false; i++);
1125  return( (i>nest_dim) ? true : false);
1126 }
1127 
execution make_execution(enum execution_utype tag, void *val)
Definition: ri.c:838
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
Definition: ri.c:1301
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
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
tiling loop_nest_to_tile(Psysteme sc, int ls, Pbase base_index, int first_parallel_level, int last_parallel_level, int perfect_nested_level)
Code Generation for Distributed Memory Machines.
Definition: tiling.c:58
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
bool entity_is_argument_p(entity e, cons *args)
Definition: arguments.c:150
#define VALUE_ZERO
#define VALUE_MONE
@ INT
Definition: atomic.c:48
Pbase base_reversal(Pbase b_in)
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in,...
Definition: base.c:221
void create_tile_basis(entity initial_module, entity compute_module, entity memory_module, Pbase initial_basis, Pbase *tile_basis_in_initial_basis, Pbase *tile_basis_in_tile_basis, Pbase *local_tile_basis, Pbase *tile_basis_in_tile_basis2, Pbase *local_tile_basis2)
Definition: basis.c:100
Psysteme loop_bounds_to_tile_bounds(Psysteme loop_bounds, Pbase loop_indices, tiling t, Pvecteur tile_delay, Pvecteur tile_indices, Pvecteur tile_local_indices)
this function returns the system of constraints
Definition: build_sc_tile.c:97
static graph dg
dg is the dependency graph ; FIXME : should not be static global ?
Definition: chains.c:124
void make_store_blocks(entity initial_module, entity compute_module, entity memory_module, entity var, entity shared_variable, entity local_variable, list lrefs, hash_table r_to_ud, Psysteme sc_domain, Pbase index_base, Pbase bank_indices, Pbase tile_indices, Pbase loop_body_indices, entity Proc_id, int pn, int bn, int ls, statement *store_block, statement *bank_store_block, int first_parallel_level, int last_parallel_level)
Definition: code.c:1166
statement make_scanning_over_tiles(entity module, list body, entity proc_id, int pn, tiling tile, Pbase initial_basis, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_initial_basis, Psysteme iteration_domain, int first_parallel_level, int last_parallel_level)
make_scanning_over_tiles()
Definition: code.c:227
void make_load_blocks(entity initial_module, entity compute_module, entity memory_module, entity var, entity shared_variable, entity local_variable, list lrefs, hash_table r_to_ud, Psysteme sc_domain, Pbase index_base, Pbase bank_indices, Pbase tile_indices, Pbase loop_body_indices, entity Proc_id, int pn, int bn, int ls, statement *load_block, statement *bank_load_block, int first_parallel_level, int last_parallel_level)
Definition: code.c:1312
list make_compute_block(entity module, statement body, Pvecteur offsets, hash_table r_to_llv, tiling tile, Pbase initial_basis, Pbase local_basis, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_initial_basis, Psysteme iteration_domain, int first_parallel_level, int last_parallel_level)
Definition: code.c:679
statement make_scanning_over_one_tile(entity module, statement body, tiling tile, Pbase initial_basis, Pbase local_basis, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_initial_basis, Psysteme iteration_domain, int first_parallel_level, int last_parallel_level)
make_scanning_over_one_tile():
Definition: code.c:475
void insert_run_time_communications(entity compute_module, entity memory_module, Pbase bank_indices, int bn, int ls, entity proc_id, list list_statement_block, statement_mapping fetch_map, statement_mapping store_map, list *new_slst, list *new_blist, hash_table v_to_esv, bool fully_sequential, Pbase loop_indices, tiling tile, Pvecteur tile_delay, Pvecteur tile_indices, Pvecteur tile_local_indices)
void include_constant_symbolic_communication(entity compute_or_memory_module, list lrefs, bool load_code, statement computational_or_emulator, entity var_id)
struct _newgen_struct_dg_arc_label_ * dg_arc_label
Definition: dg.h:60
#define cone_levels(x)
Definition: dg.h:128
#define CONFLICT(x)
CONFLICT.
Definition: dg.h:134
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define cone_undefined
Definition: dg.h:104
#define conflict_cone(x)
Definition: dg.h:169
#define region
simulation of the type region
@ is_action_write
Definition: effects.h:293
@ is_action_read
Definition: effects.h:292
void find_iteration_domain(statement s, Psysteme *sc, Pbase *basis, nested_level, list *list_statement_block, instruction *inst)
#define LIST(x)
Definition: genC.h:93
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
#define successor_vertex(x)
Definition: graph.h:118
#define successor_arc_label(x)
Definition: graph.h:116
#define vertex_successors(x)
Definition: graph.h:154
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
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_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
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
set region_of_loop(statement l)
this function returns the set of all statements belonging to the given loop even if the loop contains...
Definition: loop.c:254
statement perfectly_nested_loop_to_body(statement loop_nest)
Extract the body of a perfectly nested loop body.
Definition: loop.c:590
statement_mapping loops_mapping_of_statement(statement stat)
Definition: loop.c:155
#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
void gen_map(gen_iter_func_t fp, const list l)
Definition: list.c:172
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
list gen_last(list l)
Return the last element of a list.
Definition: list.c:578
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
list gen_nthcdr(int n, const list lx)
caution: the first item is 0! was: return( (n<=0) ? l : gen_nthcdr( n-1, CDR( l ))) ; if n>gen_length...
Definition: list.c:700
#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
gen_chunk gen_nth(int n, const list l)
to be used as ENTITY(gen_nth(3, l))...
Definition: list.c:710
#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
bool statement_call_p(statement)
Definition: statement.c:364
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
Definition: statement.c:172
bool continue_statement_p(statement)
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python....
Definition: statement.c:203
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
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_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
statement vertex_to_statement(vertex v)
Vertex_to_statement looks for the statement that is pointed to by vertex v.
Definition: util.c:45
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
static int loop_nest_dim
static list implied_do_range_list
expression ref_in_implied_do(expression exp)
This function extracts from an implied_do expression the reference having to be computed or printed.
void make_all_movement_blocks(entity initial_module, entity compute_module, entity memory_module, entity v, list map, hash_table llv_to_lcr, hash_table v_to_lllv, hash_table r_to_ud, hash_table v_to_esv, int pn, int bn, int ls, Psysteme iteration_domain, Pbase initial_basis, Pbase local_basis, entity proc_id, Pbase bank_indices, Pbase loop_body_indices, list *pmb, list *pbmb, tag use_def, int first_parallel_level, int last_parallel_level)
generates all data movements related to entity v, loads or stores depending on use_def
bool io_loop_nest_p(statement st)
Test if the statement resulting from the perfectly_loop_nest_to_body function contains at first call ...
bool full_parallel_loop_nest_p(statement mod_stat, statement loop_stmt, int nest_dim, graph dg, bool *loop_carried_dep)
loop ith_loop_in_loop_nest(statement s1, int level)
void loop_nest_movement_generation(entity module, statement loop_nest, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map, statement mod_stat, bool fully_parallel, Psysteme sc_tile, Pbase initial_basis, Pbase local_basis, Pbase local_basis2, Pbase tile_basis_in_tile_basis, Pbase tile_basis_in_tile_basis2, Pbase loop_body_indices, list lpv, list *lb, list *blb, list *sb, list *bsb, int first_parallel_level, int last_parallel_level, hash_table llv_to_lcr, hash_table r_to_llv, hash_table v_to_lllv, hash_table r_to_ud)
void loop_nest_to_wp65_code(entity module, statement loop_nest, graph dg, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map, statement mod_stat)
static void reduce_loop_bound_for_st(statement stmp)
statement generate_io_wp65_code(statement s1, statement body, hash_table v_to_esv, bool loop_or_call_print)
reference translate_IO_ref(call c, hash_table v_to_esv, bool loop_or_call_print)
This function translates a reference in I/O statement into its corresponding emulated shared memory r...
dg_vertex_label vertex_label
static void update_loop_nest_dim(loop l)
dg_arc_label arc_label
Code Generation for Distributed Memory Machines.
void instruction_to_wp65_code(entity module, list l, graph dg, int pn, int bn, int ls, int pd, entity proc_id, entity proc_id_mm, Pbase bank_indices, hash_table v_to_esv, hash_table v_to_nlv, entity compute_module, statement computational, entity memory_module, statement emulator, statement_mapping fetch_map, statement_mapping store_map)
static void reduce_loop_bound(loop l)
Function used during code generation for non-perfectly nested loops.
bool list_of_calls_p(list lsb)
instruction_to_wp65_code.c
static void implied_do_ranges(statement s)
void search_parallel_loops(statement mod_stat, statement loop_statement, graph dg, loop_carried_dep)
static void compute_loop_nest_dim(statement l)
static void add_range_in_list(range r)
entity ith_index_of_ref(reference r, int level)
void call_to_wp65_code(statement s, entity compute_module, entity memory_module, entity bank_id, entity proc_id, statement computational, statement emulator, statement_mapping fetch_map, statement_mapping store_map, hash_table v_to_esv)
static list loops_of_nest
void base_fprint(FILE *f, Pbase b, get_variable_name_t variable_name)
void base_fprint(FILE * f, Pbase b, char * (*variable_name)()): impression d'une base sur le fichier ...
Definition: io.c:342
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
Definition: io.c:124
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
loop loop1
tiling_sequence.c
void wp65_debug_print_text(entity m, statement s)
include "values.h"
#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 pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
#define pips_user_error
Definition: misc-local.h:147
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
#define GET_STATEMENT_MAPPING(map, stat)
Definition: newgen-local.h:49
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define assert(ex)
Definition: newgen_assert.h:41
@ hash_pointer
Definition: newgen_hash.h:32
#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
#define same_string_p(s1, s2)
bool set_belong_p(const set, const void *)
Definition: set.c:194
int tag
TAG.
Definition: newgen_types.h:92
void(* gen_iter_func_t)(void *)
Definition: newgen_types.h:116
#define UU
Definition: newgen_types.h:98
struct cons * list
Definition: newgen_types.h:106
void loop_nest_to_local_variables(entity initial_module, entity compute_module, entity memory_module, hash_table llv_to_lcr, hash_table r_to_llv, hash_table v_to_lllv, hash_table r_to_ud, hash_table v_to_esv, hash_table v_to_nlv, list lpv, statement body, Pbase indices, graph dg, int bn, int ls, int pd, tiling tile)
for the phi variable
Definition: variable.c:80
static char * module
Definition: pips.c:74
string expression_to_string(expression e)
Definition: expression.c:77
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
Definition: properties.c:783
void concat_data_list(list *l, list *lr, statement st, statement_mapping map, bool perfect_nested_loop)
Definition: references.c:236
void reference_list_print(list l)
This function prints the references belonging to l.
Definition: references.c:186
bool reference_in_list_p(reference r, list lwr)
This function tests whether at least one array indice of Reference r belongs to List lwr or not.
Definition: references.c:130
void reference_scalar_defined_p(reference r)
Definition: references.c:199
#define instruction_block_p(i)
#define loop_to_statement(l)
#define NORMALIZE_EXPRESSION(e)
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
entity make_loop_label(int __attribute__((unused)) desired_number, entity module)
Definition: entity.c:370
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
Definition: expression.c:1650
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
bool reference_scalar_p(reference r)
This function returns true if Reference r is scalar.
Definition: expression.c:3530
list load_statement_enclosing_loops(statement)
void reset_enclosing_loops_map(void)
void set_enclosing_loops_map(statement_mapping)
#define loop_body(x)
Definition: ri.h:1644
#define syntax_reference_p(x)
Definition: ri.h:2728
#define REFERENCE(x)
REFERENCE.
Definition: ri.h:2296
#define syntax_reference(x)
Definition: ri.h:2730
#define reference_undefined
Definition: ri.h:2302
#define normalized_linear_p(x)
Definition: ri.h:1779
#define call_function(x)
Definition: ri.h:709
#define reference_variable(x)
Definition: ri.h:2326
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define range_upper(x)
Definition: ri.h:2290
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define syntax_call_p(x)
Definition: ri.h:2734
#define instruction_loop(x)
Definition: ri.h:1520
#define statement_ordering(x)
Definition: ri.h:2454
#define dimension_lower(x)
Definition: ri.h:980
#define type_variable(x)
Definition: ri.h:2949
@ is_syntax_reference
Definition: ri.h:2691
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_undefined
Definition: ri.h:2761
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define RANGE(x)
RANGE.
Definition: ri.h:2257
#define dimension_upper(x)
Definition: ri.h:982
#define reference_indices(x)
Definition: ri.h:2328
#define syntax_call(x)
Definition: ri.h:2736
#define loop_locals(x)
Definition: ri.h:1650
#define range_lower(x)
Definition: ri.h:2288
#define variable_dimensions(x)
Definition: ri.h:3122
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define loop_range(x)
Definition: ri.h:1642
@ is_execution_parallel
Definition: ri.h:1190
#define call_arguments(x)
Definition: ri.h:711
#define entity_type(x)
Definition: ri.h:2792
#define statement_number(x)
Definition: ri.h:2452
#define normalized_linear(x)
Definition: ri.h:1781
#define expression_syntax(x)
Definition: ri.h:1247
#define range_domain
newgen_ram_domain_defined
Definition: ri.h:330
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
bool ignore_this_conflict(vertex v1, vertex v2, conflict c, int l)
This function checks if conflict c between vertices v1 and v2 should be ignored at level l.
Definition: codegen.c:163
int FindMaximumCommonLevel(cons *, cons *)
Definition: testdep_util.c:307
Psysteme sc_variables_rename(Psysteme s, Pvecteur pv_old, Pvecteur pv_new, get_variable_name_t variable_name)
Psysteme sc_variables_rename(Psysteme s, Pvecteur pv_old, Pvecteur pv_new): reecriture du systeme s r...
Definition: sc.c:224
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
#define level
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
s1
Definition: set.c:247
#define ifdebug(n)
Definition: sg.c:47
#define intptr_t
Definition: stdint.in.h:294
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
FI: I do not understand why the type is duplicated at the set level.
Definition: set.c:59
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: statement.c:4047
#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.
struct Svecteur * Pvecteur
#define BASE_NULLE
MACROS SUR LES BASES.
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
Pbase base_dup(Pbase b)
Pbase base_dup(Pbase b) Note: this function changes the value of the pointer.
Definition: alloc.c:268
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53
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
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143
void fprint_wp65_hash_tables(FILE *fd, hash_table llv_to_lcr, hash_table r_to_llv, hash_table v_to_lllv, hash_table r_to_ud, hash_table v_to_esv)
Ignore this function: debugging purposes only.
Definition: wp65.c:406