PIPS
analyse.c
Go to the documentation of this file.
1 #ifdef HAVE_CONFIG_H
2  #include "pips_config.h"
3 #endif
4 
5 #include "defines-local.h"
6 #include "workspace-util.h" // for list_to_base()
7 #include "prettyprint.h"
8 #include "preprocessor.h" // for pips_srcpath_append()
9 #include "transformer.h" // for add_intermediate_value() !?!
10 #include "semantics.h" // for load_statement_precondition()
11 
12 #include "dg.h" // for dg_arc_label, dg_vertex_label
15 #include "graph.h" // for graph
16 #include "ricedg.h" // for vertex_to_statement
17 #include "bootstrap.h"
18 
19 
20 /* The step_analyse phase computes three main resources:
21  - step_comm
22  - step_send_regions
23  - step_recv_regions
24 */
25 
26 /*
27  Corresponds to the three fields of the newgen step_comm type.
28  */
32 
33 /* Declaration of the step_send_regions and step_send_regions resources.
34 
35  Store all different kind of regions:
36  - directive regions (at directive statement level)
37  - translated regions (at call statement level)
38  - summary regions (at body statement level)
39 
40 */
41 
42 GENERIC_LOCAL_FUNCTION(step_send_regions, statement_effects)
43 GENERIC_LOCAL_FUNCTION(step_recv_regions, statement_effects)
44 
45 /*
46  Calcul des statements paths
47 
48  Pour tous les statements S d'un module M,
49 
50  on appelle SP(S) (statement_path) le chemin permettant de rejoindre
51  le statement S à partir du statement "body" de M.
52 
53 */
54 
56 
57 static bool step_statement_path_build(statement stmt, list *sp_current)
58 {
59  *sp_current = CONS(STATEMENT, stmt, *sp_current);
60 
61  list sp = gen_nreverse(gen_copy_seq(*sp_current));
63 
64  return true;
65 }
67 {
68  gen_remove_once(sp_current, stmt);
69 }
70 
72 {
75 
76  list sp_current = NIL;
78 }
79 
81 {
83 
84  HASH_MAP(stmt, sp,
85  {
86  gen_free_list(sp);
88 
91 }
92 
94 {
96 }
97 
99 {
101 
102  statement first_directive_stmt;
103 
105 
106  return first_directive_stmt;
107 }
108 
109 /*
110 static void step_statement_path_print(list sp)
111 {
112  int lvl = 0;
113  FOREACH(STATEMENT, stmt, sp)
114  {
115  pips_debug(2, "statement_path stmt_lvl %d\n", lvl++);
116  STEP_DEBUG_STATEMENT(2, "", stmt);
117  }
118 }
119 
120 static void step_statement_path_print_all(void)
121 {
122  HASH_MAP(stmt, sp,
123  {
124  STEP_DEBUG_STATEMENT(2, "Statement key", stmt);
125  pips_debug(2, "statement_path length=%d\n", (int)gen_length((list)sp));
126  step_statement_path_print((list)sp);
127  }, step_statement_path)
128 }
129 */
130 
131 
132 /*
133  step_statement_path_factorise
134 
135  From two statement paths s1 (B, ...., S1) and s2 (B, ...., S3),
136  step_statement_path_factorise() returns the common statement path
137  (B, ..., C) and two suffix statement paths (C, ..., S1) and (C, ..., S3).
138 
139  */
140 
141 static list step_statement_path_factorise(statement s1, statement s2, list *suffix_sp1, list* suffix_sp2)
142 {
143  list common_sp = NIL;
144 
145  pips_debug(5, "begin\n");
146 
147  *suffix_sp1 = step_statement_path_get(s1);
148  *suffix_sp2 = step_statement_path_get(s2);
149 
150  while(!ENDP(*suffix_sp1) && !ENDP(*suffix_sp2) && STATEMENT(CAR(*suffix_sp1))==STATEMENT(CAR(*suffix_sp2)))
151  {
152  common_sp = CONS(STATEMENT, STATEMENT(CAR(*suffix_sp1)), common_sp);
153  POP(*suffix_sp1);
154  POP(*suffix_sp2);
155  }
156 
157  pips_debug(5, "end\n");
158  return common_sp;
159 }
160 
161 
162 /*
163  * step_comm resource management
164  *
165  */
166 
168 {
169  assert(bound_step_interlaced_p(reg));
170  return load_step_interlaced(reg);
171 }
172 
174 {
175  assert(bound_step_partial_p(reg));
176  return load_step_partial(reg);
177 }
178 
180 {
181  return db_resource_required_or_available_p(DBR_STEP_SEND_REGIONS, module_name);
182 }
183 
184 /*
185  * step_comm management
186  * also used in compile.c
187  *
188  */
189 
191 {
192  step_comm comms = (step_comm)db_get_memory_resource(DBR_STEP_COMM, "", true);
193 
194  set_step_effect_path(step_comm_path(comms));
195  set_step_interlaced(step_comm_interlaced(comms));
196  set_step_partial(step_comm_partial(comms));
197 }
198 
200 {
201  reset_step_effect_path();
202  reset_step_interlaced();
203  reset_step_partial();
204 }
205 
207 {
208  step_comm comms = (step_comm)db_get_memory_resource(DBR_STEP_COMM, "", true);
209 
210  step_comm_path(comms) = get_step_effect_path();
211  step_comm_interlaced(comms) = get_step_interlaced();
212  step_comm_partial(comms) = get_step_partial();
213 
214  DB_PUT_MEMORY_RESOURCE(DBR_STEP_COMM, "", comms);
215 
216  reset_step_effect_path();
217  reset_step_interlaced();
218  reset_step_partial();
219 }
220 
221 /*
222  * step_effect_path management
223  *
224  *
225  */
226 
228 {
229  pips_debug(4, "begin\n");
230  step_point point;
231  point = make_step_point(module, stmt, previous_eff);
232  store_step_effect_path(new_eff, point);
233  pips_debug(4, "end\n");
234 }
235 
237 {
238  int level=1;
239  FOREACH(STEP_POINT, point, path)
240  {
241  string txt = safe_statement_identification(step_point_stmt(point));
242  pips_debug(1, "level=%d module=%s statment= %s", level, entity_name(step_point_module(point)), txt);
243  free(txt);
244  debug_print_effects_list(CONS(EFFECT, step_point_data(point),NIL), "step_point_data :");
245  level++;
246  }
247 }
248 
249 /*
250  Build a step_point list
251  First step_point corresponds to start_eff
252 
253  In the middle, link from summary to translated regions...
254 
255  Last step_point data will correspond to the directive statement and
256  the corresponding region.
257 
258  FSC A VOIR peut-être dans l'autre sens?
259 
260  */
261 
263 {
264  list path = NIL;
265  effect current_eff = start_eff ;
266 
267  pips_debug(4, "begin\n");
268  while(bound_step_effect_path_p(current_eff))
269  {
270  step_point point = load_step_effect_path(current_eff);
271 
272  path = CONS(STEP_POINT, point, path);
273 
274  if (step_point_data(point) == current_eff)
275  break;
276 
277  current_eff = step_point_data(point);
278  }
279 
280  ifdebug(5)
281  {
283  }
284 
285  pips_debug(4, "end\n");
286  return path;
287 }
288 
290 {
291  effect directive_statement_region;
292  pips_debug(4, "begin\n");
293 
295  assert(!ENDP(path));
296  directive_statement_region = step_point_data(STEP_POINT(CAR(path)));
297 
298  pips_debug(4, "end\n");
299  return directive_statement_region;
300 }
301 
302 /*
303  SEND regions corresponding to directives will be associated with partial or full
304 
305  Only directive regions are associated with communication
306  type. TRANSLATED or SUMMARY regions are not.
307 
308 */
309 static void step_set_step_partial(effect send_region, bool partial_p)
310 {
311  pips_debug(4, "begin\n");
312 
313  effect directive_statement_send;
314 
315  /* Retrieve the corresponding original DIRECTIVE
316  region from any king of region: SUMMARY, TRANSLATED or DIRECTIVE region */
317  directive_statement_send = get_directive_statement_region(send_region);
318 
319  if(!partial_p)
320  store_or_update_step_partial(directive_statement_send, false);
321  else if(!bound_step_partial_p(directive_statement_send))
322  store_step_partial(directive_statement_send, true);
323  pips_debug(4, "end\n");
324 }
325 static void step_set_communication_type_full(effect send_region)
326 {
327  step_set_step_partial(send_region, false);
328 }
330 {
331  step_set_step_partial(send_region, true);
332 }
333 
334 void debug_print_effects_list(list l, string txt)
335 {
336  if(ENDP(l))
337  pips_debug(1, "%s empty\n", txt);
338  else
339  {
340  bool property_prettyprint_scalar_regions = get_bool_property("PRETTYPRINT_SCALAR_REGIONS");
341  set_bool_property("PRETTYPRINT_SCALAR_REGIONS", true);
342 
343  FOREACH(EFFECT, eff, l)
344  {
345  string str_reg = text_to_string(text_rw_array_regions(CONS(EFFECT, eff, NIL)));
346  pips_debug(1, "%s %p : %s\n", txt, eff, str_reg); free(str_reg);
347  }
348  set_bool_property("PRETTYPRINT_SCALAR_REGIONS", property_prettyprint_scalar_regions);
349  }
350 }
351 
352 
353 /*
354  *
355  * PHASE step_analyse_init
356  *
357  *
358  *
359  */
360 
361 bool step_analyse_init(const string module_name)
362 {
363  pips_debug(2, "begin for module \"%s\".\n", module_name);
365 
366  string srcpath = strdup(PIPS_RUNTIME_DIR "/" STEP_DEFAULT_RT_H);
367  string old_path = pips_srcpath_append(srcpath);
368  free(old_path);
369  free(srcpath);
370 
371  /* init intrinsics */
372  static struct intrin {
373  char * name;
374  intrinsic_desc_t desc;
375  } step_intrinsics [] = {
376 #include "STEP_RT_intrinsic.h"
377  { NULL , {NULL, 0} }
378  };
379  for(struct intrin *p = step_intrinsics;p->name;++p)
380  register_intrinsic_handler(p->name,&(p->desc));
381 
382  /* other intrinsics */
383  static IntrinsicDescriptor IntrinsicTypeDescriptorTable[] =
384  {
385 #include "STEP_RT_bootstrap.h"
386  {NULL, 0, 0, 0, 0}
387  };
388  for(IntrinsicDescriptor *p=IntrinsicTypeDescriptorTable;p->name;p++)
390 
391  pips_debug(2, "end\n");
392  return true;
393 }
394 
396 {
399  Pbase phis = list_to_base(ephis);
400  gen_free_list(ephis);
402  base_rm(phis);
403  return reg;
404 }
405 
407 {
408  list regions_final = NIL;
409 
410  pips_debug(2,"begin\n");
411 
412  FOREACH(REGION, reg, regions_l)
413  {
415  {
416  /* remove omp private from send and recv regions */
417  pips_debug(2,"drop private entity %s\n", entity_name(region_entity(reg)));
418  continue;
419  }
420  if (io_effect_p(reg) || std_file_effect_p(reg))
421  {
422  pips_debug(2,"drop I/O effect on %s\n", entity_name(region_entity(reg)));
423  continue;
424  }
426  {
427  pips_debug(2,"drop effect on FILE * : %s\n", entity_name(region_entity(reg)));
428  continue;
429  }
430  if (entity_scalar_p(region_entity(reg)))
431  {
432  pips_debug(2,"drop scalar region %s\n", entity_name(region_entity(reg)));
433  continue;
434  }
435 
436  /* Remove precondition contrainte */
437  transformer stmt_precondition = load_statement_precondition(stmt);
438  Psysteme sc = predicate_system(transformer_relation(stmt_precondition));
440 
442 
444  switch (action_tag)
445  {
446  case is_action_read:
448  break;
449  case is_action_write:
451  break;
452  default:
453  pips_assert("unknown action_tag", 0);
454  }
455 
456  regions_final = CONS(REGION, r, regions_final);
457  }
459 
460  pips_debug(2,"end\n");
461  return regions_final;
462 }
463 
465 {
466  pips_debug(4,"begin\n");
467 
468  FOREACH(REGION, reg, regions_l)
469  {
470  /* Add an initial point into the path,
471  key effect is equal to data field (effect)
472  used as stop condition in step_get_path() */
474  }
475 
476  pips_debug(4,"end\n");
477 }
478 
479 static bool anymodule_anywhere_region_p(list regions_l)
480 {
481  bool is_anymodule_anywhere = false;
482 
483  FOREACH(REGION, reg, regions_l)
484  {
485  if (anywhere_effect_p(reg))
486  {
487  is_anymodule_anywhere = true;
488  break;
489  }
490  }
491 
492  return is_anymodule_anywhere;
493 }
494 
496 {
497  pips_debug(2,"begin\n");
498  list send_final = NIL;
499  list write_tmp_l = regions_dup(write_l);
500  list out_tmp_l = regions_dup(out_l);
501 
502  /*
503  SEND = OUT Inter WRITE
504 
505  Computation of the approximation (EXACT or MAY)
506 
507  1) OUT-MAY Inter WRITE-MAY -> SEND-MAY
508  2) OUT-EXACT Inter WRITE-MAY -> SEND-MAY
509  3) OUT-EXACT Inter WRITE-EXACT -> SEND-EXACT
510  4) OUT-MAY Inter WRITE-EXACT -> SEND-MAY
511 
512  Case 4 is a problem, we want OUT-MAY Inter WRITE-EXACT --> SEND-*EXACT*.
513 
514  Generally the approximation of the SEND region should be the
515  approximation of the WRITE region because OUT should be used only
516  to reduce region communication. Thus we artificially transform
517  the out approximation as EXACT so that the MAY approximation does
518  not impact the SEND approximation.
519  */
520 
521  FOREACH(REGION, reg, out_tmp_l)
522  {
525  }
526 
527  ifdebug(2)
528  {
529  debug_print_effects_list(out_tmp_l, "OUT :");
530  debug_print_effects_list(write_tmp_l, "WRITE :");
531  }
532 
533  list send_l = RegionsIntersection(out_tmp_l, write_tmp_l, w_w_combinable_p);
534 
535  if (anymodule_anywhere_region_p(send_l))
536  {
537  /* ANYMODULE ANYWHERE send regions are a big problem! FIXME.
538  */
539 
540  STEP_DEBUG_STATEMENT(0, "ANYWHERE effect on stmt", stmt);
541  pips_debug(0, "end stmt\n");
542  pips_user_warning("ANYWHERE effect in SEND regions\n");
543  }
544 
545  send_final = create_step_regions(stmt, send_l, is_action_write);
546  gen_full_free_list(send_l);
547 
548  ifdebug(2)
549  debug_print_effects_list(send_final, "SEND final :");
550 
551  pips_debug(2,"end\n");
552  return send_final;
553 }
554 
556 {
557  pips_debug(2,"begin\n");
558  list recv_final = NIL;
559  list send_may_l = NIL;
560  list recv_l;
561 
562  /*
563  RECV = IN Union SEND-MAY
564 
565  Generally, for a given construct, SEND is not sur-approximated
566  then SEND-MAY is empty thus
567 
568  RECV = IN
569 
570  But, for a given construct, when SEND is sur-approximated (i.e. SEND
571  MAY), then the communication is interlaced and a diff is
572  necessary at the end to determine what data were updated.
573 
574  Thus data in the sur-approximation must have a correct value even
575  if they are not read (for the diff).
576 
577  Thus when SEND is sur-approximated: RECV = IN Union SEND-MAY
578  */
579 
580  FOREACH(REGION, reg, send_l)
581  {
582  if (region_may_p(reg))
583  send_may_l = CONS(REGION, region_dup(reg), send_may_l);
584  }
585 
586  ifdebug(2)
587  {
588  debug_print_effects_list(send_may_l, "SEND may :");
589  debug_print_effects_list(in_l, "IN :");
590  }
591 
592  recv_l = RegionsMustUnion(regions_dup(in_l), regions_dup(send_may_l), r_w_combinable_p);
593  gen_full_free_list(send_may_l);
594 
595  if (anymodule_anywhere_region_p(recv_l))
596  {
597  /* ANYMODULE ANYWHERE recv regions should cause FULL communications
598  thus ANYMODULE ANYWHERE recv regions are removed from recv regions.
599  */
600  pips_debug(2,"drop ANYMODULE ANYWHERE RECV regions\n");
601  recv_final = NIL;
602  gen_full_free_list(recv_l);
603  }
604  else
605  {
606  recv_final = create_step_regions(stmt, recv_l, is_action_read);
607  gen_full_free_list(recv_l);
608  }
609 
610  ifdebug(2)
611  debug_print_effects_list(recv_final, "RECV final :");
612 
613  pips_debug(2,"end\n");
614  return recv_final;
615 }
616 
617 /*
618  For a given region and two different iterations
619  check if overlap
620  */
621 
623 {
624  if(ENDP(index_l))
625  return false;
626 
627  bool interlaced_p;
628  Psysteme s = sc_copy(region_system(reg));
629  Psysteme s_prime = sc_copy(s);
630 
631  FOREACH(ENTITY, index, index_l)
632  {
633  add_intermediate_value(index);
634  entity index_prime = entity_to_intermediate_value(index);
635  s_prime = sc_variable_rename(s_prime, (Variable)index, (Variable)index_prime);
636 
637  // contrainte I<I' qui s'ecrit : I-I'+1 <= 0
639  (Variable) index, VALUE_ONE,
640  (Variable) index_prime, VALUE_MONE,
641  TCST, VALUE_ONE));
642  sc_add_inegalite(s, c);
643  }
644 
645  s = sc_append(s, s_prime);
646  sc_rm(s_prime);
647 
648  s->base = BASE_NULLE;
649  sc_creer_base(s);
650 
651  interlaced_p = sc_integer_feasibility_ofl_ctrl(s, NO_OFL_CTRL, true);
652 
653  sc_rm(s);
654  pips_debug(2,"check interlaced %s : %s\n", entity_name(region_entity(reg)), interlaced_p?"true":"false");
655  return interlaced_p;
656 }
657 
658 /*
659  *
660  *
661  * SEND/RECV regions list management
662  *
663  *
664  */
666 {
667  pips_debug(4, "begin\n");
668  if (!bound_step_send_regions_p(s))
669  return NIL;
670 
671  effects e = load_step_send_regions(s);
672  ifdebug(8) pips_assert("send regions loaded are consistent", effects_consistent_p(e));
673  pips_debug(4, "end\n");
674  return(effects_effects(e));
675 }
676 
677 static void step_send_regions_list_store(statement s, list l_regions)
678 {
679  pips_debug(4, "begin\n");
680  effects e = make_effects(l_regions);
681  ifdebug(8) pips_assert("send regions to store are consistent", effects_consistent_p(e));
682  store_step_send_regions(s, e);
683  pips_debug(4, "end\n");
684 }
685 
687 {
688  pips_debug(4, "begin\n");
689  if (bound_step_send_regions_p(s))
690  {
691  effects e = load_step_send_regions(s);
692  effects_effects(e) = l_regions;
693  update_step_send_regions(s, e);
694  }
695  pips_debug(4, "end\n");
696 }
697 
699 {
700  pips_debug(4, "begin\n");
701  pips_assert ("step_send_regions", bound_step_send_regions_p(stmt));
702 
703  effects e = load_step_send_regions(stmt);
704  effects_effects(e) = gen_nconc(l_regions, effects_effects(e));
705  update_step_send_regions(stmt, e);
706 
707  pips_debug(4, "end\n");
708 }
709 
711 {
712  pips_debug(4, "begin\n");
713  if (!bound_step_recv_regions_p(s))
714  return NIL;
715 
716  effects e = load_step_recv_regions(s);
717  ifdebug(8) pips_assert("recv regions loaded are consistent", effects_consistent_p(e));
718 
719  pips_debug(4, "end\n");
720  return(effects_effects(e));
721 }
722 
723 static void step_recv_regions_list_store(statement s, list l_regions)
724 {
725  pips_debug(4, "begin\n");
726  effects e = make_effects(l_regions);
727  ifdebug(8) pips_assert("recv regions to store are consistent", effects_consistent_p(e));
728  store_step_recv_regions(s, e);
729  pips_debug(4, "end\n");
730 }
731 
733 {
734  pips_debug(4, "begin\n");
735  if (bound_step_recv_regions_p(s))
736  {
737  effects e = load_step_recv_regions(s);
738  effects_effects(e) = l_regions;
739  update_step_recv_regions(s, e);
740  }
741  pips_debug(4, "end\n");
742 }
743 
745 {
746  pips_debug(4, "begin\n");
747 
748  pips_assert ("step_recv_regions", bound_step_recv_regions_p(stmt));
749 
750  effects e = load_step_recv_regions(stmt);
751  effects_effects(e) = gen_nconc(l_regions, effects_effects(e));
752  update_step_recv_regions(stmt, e);
753 
754  pips_debug(4, "end\n");
755 }
756 
758 {
759  pips_debug(2, "begin\n");
760  ifdebug(2)
761  {
762  statement stmt_basic_workchunk = step_directive_basic_workchunk(d);
763  assert(!statement_undefined_p(stmt_basic_workchunk));
764 
765  list rw_l = load_rw_effects_list(stmt_basic_workchunk);
766  list in_l = load_in_effects_list(stmt_basic_workchunk);
767  list out_l = load_out_effects_list(stmt_basic_workchunk);
768 
769  string str_reg;
770  bool property_prettyprint_scalar_regions = get_bool_property("PRETTYPRINT_SCALAR_REGIONS");
771  set_bool_property("PRETTYPRINT_SCALAR_REGIONS", true);
772 
773  str_reg = text_to_string(text_rw_array_regions(rw_l));
774  pips_debug(1, "REGIONS RW : %s\n", str_reg); free(str_reg);
775  str_reg = text_to_string(text_rw_array_regions(in_l));
776  pips_debug(1, "REGIONS IN : %s\n", str_reg); free(str_reg);
777  str_reg = text_to_string(text_rw_array_regions(out_l));
778  pips_debug(1, "REGIONS OUT : %s\n", str_reg); free(str_reg);
779 
780  set_bool_property("PRETTYPRINT_SCALAR_REGIONS", property_prettyprint_scalar_regions);
781  }
782 
783  debug_print_effects_list(recv_l, "REGION RECV");
784 
785  if(ENDP(send_l))
786  debug_print_effects_list(send_l, "REGION SEND");
787  else
788  {
789  FOREACH(REGION, r, send_l)
790  {
791  pips_assert("interlaced defined", bound_step_interlaced_p(r));
792  list l = CONS(EFFECT, r, NIL);
793  debug_print_effects_list(l, load_step_interlaced(r)?"REGION SEND INTERLACED":"REGION SEND");
794  gen_free_list(l);
795  }
796  }
797  pips_debug(2, "end\n");
798 }
799 
801 {
802  pips_debug(4, "begin\n");
803  list summarized_l = NIL;
804 
805  FOREACH(EFFECT, eff, effect_l)
806  {
807  effect new_eff = copy_effect(eff);
808 
809  pips_debug(4, "tmp summarize eff = %p new_eff = %p\n", eff, new_eff);
810  step_add_point_into_effect_path(new_eff, module, body, eff);
811  summarized_l = CONS(EFFECT, new_eff, summarized_l);
812  }
813 
814  pips_debug(4, "end\n");
815  return summarized_l;
816 }
817 
818 /*
819  For each step region (send or recv), summarizes the region at the module level
820  */
821 
823 {
824  /*
825  For the statement stmt included in a module,
826  add the list of regions at the statement level to the list of regions at the module level.
827 
828  Summarized_send_l (resp. recv_l) means list of send (resp. recv)
829  regions at the module level.
830  */
831  pips_debug(4, "begin\n");
832 
833  /* search for the first stmt of type directive_stmt in the path from the
834  body to stmt S
835 
836  if the first_directive_stmt is different than stmt, it means that
837  stmt is imbricated inside another directive.
838 
839  In case of an imbricated statement, regions attached to stmt are
840  not summarized at the module level.
841  */
843 
844  if(statement_undefined_p(first_directive_stmt) || first_directive_stmt == stmt)
845  {
848  list summarized_send_l, summarized_recv_l;
849 
850  pips_assert("stmt != body", stmt != body);
851  pips_assert("statement with step regions", bound_step_send_regions_p(stmt) && bound_step_recv_regions_p(stmt));
852 
854  /* Store SEND summary regions */
855  step_send_regions_list_add(body, summarized_send_l);
857  /* Store RECV summary regions */
858  step_recv_regions_list_add(body, summarized_recv_l);
859 
860  pips_debug(4, " SEND and RECV propagated on module %s\n", entity_name(module));
861  }
862  pips_debug(4, "end\n");
863 }
864 
866 {
867  FOREACH(REGION, reg, send_l)
868  {
869  /* All SENDs are initialized as PARTIAL */
871  }
872 }
873 
874 
876 {
878  FOREACH(REGION, reg, send_l)
879  {
880  bool interlaced_p = interlaced_basic_workchunk_regions_p(reg, index_l);
881  store_step_interlaced(reg, interlaced_p);
882  }
883 }
884 
885 /*
886  return true if some region exists
887 */
889 {
891 
892  pips_debug(1,"Begin\n");
893 
894  statement directive_stmt = step_directive_block(drt);
895  statement stmt_basic_workchunk = step_directive_basic_workchunk(drt);
896  assert(!statement_undefined_p(stmt_basic_workchunk));
897 
898  ifdebug(1)
899  {
901  }
902 
903  list rw_l = load_rw_effects_list(stmt_basic_workchunk);
904  list write_l = regions_write_regions(rw_l);
905  list in_l = load_in_effects_list(stmt_basic_workchunk);
906  list out_l = load_out_effects_list(stmt_basic_workchunk);
907 
908  /* TODO ajouter un test si tout est vide. */
909 
910  list send_l = compute_send_regions(write_l, out_l, directive_stmt);
911  list recv_l = compute_recv_regions(send_l, in_l, directive_stmt);
912 
913 
914  /* Store SEND/RECV directive statement regions */
915  step_send_regions_list_store(directive_stmt, send_l);
916  step_recv_regions_list_store(directive_stmt, recv_l);
917 
918 #ifdef FRED
919  pips_assert("ANYMODULE ANYWHERE SEND regions", !anymodule_anywhere_region_p(send_l));
920  pips_assert("ANYMODULE ANYWHERE RECV regions", !anymodule_anywhere_region_p(recv_l));
921 #endif
922 
923  /* Initialization of step_effect_path for each send/recv regions */
924  step_init_effect_path(module, directive_stmt, send_l);
925  step_init_effect_path(module, directive_stmt, recv_l);
926 
927  /* Initialization of step_interlaced and step_partial for each send region */
929  step_compute_step_interlaced(send_l, drt);
930 
931  ifdebug(3)
932  {
933  step_print_directives_regions(drt, send_l, recv_l);
934  }
935  pips_debug(1,"End\n");
936  return !(ENDP(recv_l) && ENDP(send_l));
937 }
938 
939 static list step_translate_and_map(statement stmt, list effects_called_l)
940 {
941  pips_debug(2, "begin\n");
942 
943  effect translated_eff;
944  list translated_l = NIL;
948  transformer context = load_statement_precondition(stmt); /* for generic_effects_backward_translation() */
949 
950  make_effects_private_current_context_stack(); /* for generic_effects_backward_translation()
951  cf. summary_rw_effects_engine()
952  dans Libs/effects-generic/rw_effects_engine.c */
953 
954  FOREACH(EFFECT, called_eff, effects_called_l)
955  {
956  /* to avoid low level debug messages of generic_effects_backward_translation */
957  setenv("REGION_TRANSLATION_DEBUG_LEVEL", "0", 0);
958  debug_on("REGION_TRANSLATION_DEBUG_LEVEL");
959 
960  /* create a new translated effect in list caller_l */
961  list tmp_l = CONS(EFFECT, called_eff, NIL);
962  list caller_l = generic_effects_backward_translation(called, args, tmp_l, context);
963 
964  debug_off();
965 
966  if(gen_length(caller_l)>1)
967  {
968  pips_user_warning("to many effect at callsite : %d effect\n", gen_length(caller_l));
969  pips_debug(1, "input effect list (called_eff) :\n %s", text_to_string(text_rw_array_regions(tmp_l)));
970  pips_debug(0, "output effect list (caller_l) :\n %s", text_to_string(text_rw_array_regions(caller_l)));
971  list keep_l = NIL;
972 
973  FOREACH(EFFECT, eff, caller_l)
974  {
975  if (anywhere_effect_p(eff) && effect_action_tag(called_eff)==effect_action_tag(eff))
976  {
977  gen_free_list(keep_l);
978  keep_l = CONS(EFFECT, eff, NIL);
979  pips_debug(0, "keep only %s", text_to_string(text_rw_array_regions(keep_l)));
980  break;
981  }
982 
985  keep_l = CONS(EFFECT, eff, keep_l);
986  else
987  pips_debug(0, "drop effect on not array entity : %s", text_to_string(text_rw_array_regions(CONS(EFFECT, eff, NIL))));
988  }
989  gen_free_list(caller_l);
990  caller_l = keep_l;
991  }
992 
993  /* map */
994  switch (gen_length(caller_l))
995  {
996  case 1:
997  /* one called effect should produce a unique translated effect */
998  translated_eff = EFFECT(CAR(caller_l));
999  pips_debug(2, "translate called_eff = %p, translated_eff = %p\n", called_eff, translated_eff);
1000  step_add_point_into_effect_path(translated_eff, module, stmt, called_eff);
1001  translated_l = gen_nconc(translated_l, caller_l);
1002  case 0:
1003  break;
1004  default:
1005  pips_debug(0, "Error\n");
1006  pips_debug(0, "input effect list (called_eff) :\n %s\n", text_to_string(text_rw_array_regions(tmp_l)));
1007  pips_debug(0, "output effect list (caller_l) :\n %s\n", text_to_string(text_rw_array_regions(caller_l)));
1008  pips_assert("gen_length(caller_l)<2", 0);
1009  }
1010  gen_free_list(tmp_l);
1011  }
1012 
1014  pips_debug(2, "end\n");
1015  return translated_l;
1016 }
1017 
1018 /*
1019  return true if some region exists
1020 */
1022 {
1023  entity called;
1024  list caller_l, called_l;
1025  statement_effects regions;
1026  bool new_region_p = false;
1027 
1028  pips_debug(2, "begin\n");
1030  called = call_function(statement_call(stmt));
1031 
1032  assert(entity_module_p(called));
1033  statement called_body = (statement) db_get_memory_resource(DBR_CODE, entity_user_name(called), true);
1034 
1035  ifdebug(1)
1036  {
1037  pips_debug(1,"------------------> CALL\n");
1038  string txt = safe_statement_identification(stmt);
1039  pips_debug(1, "%s\n", txt);
1040  free(txt);
1041  }
1042 
1043  /* SEND */
1044  regions = (statement_effects)db_get_memory_resource(DBR_STEP_SEND_REGIONS, entity_user_name(called), true);
1045  called_l = effects_effects(apply_statement_effects(regions, called_body));
1046  caller_l = step_translate_and_map(stmt, called_l);
1047  /* Store SEND translated regions */
1049 
1050  new_region_p |= !ENDP(caller_l);
1051 
1052  ifdebug(2)
1053  {
1054  debug_print_effects_list(called_l, "CALLED REGIONS SEND");
1055  debug_print_effects_list(caller_l, "CALLER REGIONS SEND");
1056  }
1057 
1058  /* RECV */
1059  regions = (statement_effects)db_get_memory_resource(DBR_STEP_RECV_REGIONS, entity_user_name(called), true);
1060  called_l = effects_effects(apply_statement_effects(regions, called_body));
1061  caller_l = step_translate_and_map(stmt, called_l);
1062  /* Store RECV translated regions */
1064 
1065  new_region_p |= !ENDP(caller_l);
1066 
1067  ifdebug(2)
1068  {
1069  debug_print_effects_list(called_l, "CALLED REGIONS RECV");
1070  debug_print_effects_list(caller_l, "CALLER REGIONS RECV");
1071  }
1072 
1073  pips_debug(2, "end\n");
1074 
1075  return new_region_p;
1076 }
1077 
1078 static bool compute_SENDRECV_regions(statement stmt, bool *exist_regions_p)
1079 {
1081 
1082  STEP_DEBUG_STATEMENT(2, "begin on stmt", stmt);
1083 
1085  {
1088  *exist_regions_p |= compute_directive_regions(drt);
1089 
1090  /* default: SEND/RECV regions are summarized at the body level of the current module.
1091  This will be modified later using the DG
1092  */
1094  }
1095  else
1096  {
1097  /* When module call, compute translated SEND and RECV regions
1098 
1099  Note: all entities present in the field call_function are not
1100  a module ie it could also be a numerical constant, an
1101  intrinsics...
1102  */
1104  {
1105  *exist_regions_p |= step_translate_and_map_step_regions(stmt);
1106  /* default: SEND/RECV regions are summarized at the body level of the current module.
1107  This will be modified later using the DG
1108  */
1110  }
1111  else
1112  pips_debug(2, "no STEP region to compute\n");
1113  }
1114 
1115  pips_debug(2, "end\n");
1116  return true;
1117 }
1118 
1119 static bool concerned_entity_p(effect eff, list regions)
1120 {
1121  pips_debug(4, "begin\n");
1122  FOREACH(REGION, reg, regions)
1123  {
1124  pips_debug(5, "\n eff %s regions %s\n", text_to_string(text_region(eff)), text_to_string(text_region(reg)));
1125  if (effect_comparable_p(eff, reg))
1126  {
1127  pips_debug(4, "end TRUE\n");
1128  return true;
1129  }
1130  }
1131  pips_debug(4, "end FALSE\n");
1132  return false;
1133 }
1134 
1135 static void step_get_comparable_effects(list eff_list, effect eff, set *effects_set)
1136 {
1137  pips_debug(2, "begin\n");
1138  FOREACH(EFFECT, eff2, eff_list)
1139  {
1140  if (effect_comparable_p(eff, eff2))
1141  {
1142  pips_debug(2,"############################# unoptimizable %p %s\n", eff2, entity_name(effect_entity(eff2)));
1143  *effects_set = set_add_element(*effects_set, *effects_set, eff2);
1144  }
1145  }
1146  pips_debug(2, "end\n");
1147 }
1148 
1149 static void step_compute_CHAINS_DG_remove_summary_regions(successor su, list source_send_l, list sink_recv_l, set *remove_from_summary_send, set *remove_from_summary_recv)
1150 {
1151  pips_debug(2, "begin\n");
1152  /* a arc label in this CHAINS DG graph is a list of conflicts, see dg.pdf */
1153 
1155  {
1156  effect source_eff = conflict_source(c);
1157  effect sink_eff = conflict_sink(c);
1158 
1159  pips_debug(2,"Conflict source_eff sink_eff\n");
1160 
1161  if(!(effect_write_p(source_eff) && effect_read_p(sink_eff)))
1162  {
1163  pips_debug(2,"not WRITE->READ dependence (ignored)\n");
1164  continue;
1165  }
1166 
1167 
1168  /* WRITE-READ dependence */
1169  pips_debug(2, "Dependence :\n\t\t%s from\t%s\t\t%s to \t%s",
1170  effect_to_string(source_eff), text_to_string(text_region(source_eff)),
1171  effect_to_string(sink_eff), text_to_string(text_region(sink_eff)));
1172 
1173  bool source_send_p = concerned_entity_p(source_eff, source_send_l);
1174  bool sink_recv_p = concerned_entity_p(sink_eff, sink_recv_l);
1175 
1176  if (source_send_p)
1177  {
1178  if (sink_recv_p)
1179  {
1180  pips_debug(2,"optimizable SEND, SEND and RECV are already summarized at the module level\n");
1181  }
1182  else
1183  {
1184  pips_debug(2,"unoptimizable SEND (no matching RECV)\n");
1185 
1186  step_get_comparable_effects(source_send_l, source_eff, remove_from_summary_send);
1187  }
1188 
1189  continue;
1190  }
1191 
1192  if (sink_recv_p)
1193  {
1194  pips_debug(2,"no corresponding SEND, remove RECV from summarized list at the module level\n");
1195 
1196  step_get_comparable_effects(sink_recv_l, sink_eff, remove_from_summary_recv);
1197  continue;
1198  }
1199 
1200  pips_debug(2,"no SEND/RECV for %s\n",effect_to_string(source_eff));
1201  }
1202  pips_debug(2, "end\n");
1203 }
1204 
1205 static void step_compute_CHAINS_DG_SENDRECV_regions(statement s1, statement s2, list *s1_send_l, list *s2_recv_l)
1206 {
1207  pips_debug(3, "begin\n");
1208 
1209  /* compute first directive statement on suffix_sp1 and suffix_sp2 */
1210  list suffix_sp1, suffix_sp2;
1211  list __attribute__ ((unused)) common_sp = step_statement_path_factorise(s1, s2, &suffix_sp1, &suffix_sp2);
1212 
1213  statement first_directive_stmt1 = gen_find_if((gen_filter_func_t)step_directives_bound_p, suffix_sp1, gen_chunk_identity);
1214  statement first_directive_stmt2 = gen_find_if((gen_filter_func_t)step_directives_bound_p, suffix_sp2, gen_chunk_identity);
1215 
1216 
1217  if(!statement_undefined_p(first_directive_stmt1))
1218  {
1219  STEP_DEBUG_STATEMENT(3, "directive on statement path suffix_sp1", first_directive_stmt1);
1220  /* Get directive region */
1221  *s1_send_l = step_send_regions_list_load(first_directive_stmt1);
1222  }
1223  else
1224  {
1225  pips_debug(3, "no directive on statement path suffix_sp1\n");
1226  /* no directive on path thus if regions corresponding to s1 exist, they are translated regions */
1227  if (bound_step_send_regions_p(s1))
1228  *s1_send_l = step_send_regions_list_load(s1);
1229  }
1230 
1231  if(!statement_undefined_p(first_directive_stmt2))
1232  {
1233  STEP_DEBUG_STATEMENT(3, "directive on statement path suffix_sp2", first_directive_stmt2);
1234  /* Get directive region */
1235  *s2_recv_l = step_recv_regions_list_load(first_directive_stmt2);
1236  }
1237  else
1238  {
1239  pips_debug(3, "no directive on statement path suffix_sp2\n");
1240  /* no directive on path thus if regions corresponding to s1 exist, they are translated regions */
1241  if (bound_step_recv_regions_p(s2))
1242  *s2_recv_l = step_recv_regions_list_load(s2);
1243  }
1244 
1245  pips_debug(3, "end\n");
1246 }
1247 
1248 static void step_analyse_CHAINS_DG(const char *module_name, set *remove_from_summary_send, set *remove_from_summary_recv)
1249 {
1250  graph dependences_graph = (graph) db_get_memory_resource(DBR_CHAINS, module_name, true);
1251 
1252  *remove_from_summary_send = set_make(set_pointer);
1253  *remove_from_summary_recv = set_make(set_pointer);
1254 
1255  pips_debug(1, "################ CHAINS DG %s ###############\n", module_name);
1256 
1257  /* for graph data structure, see newgen/graph.pdf */
1258  /* CHAINS is computed by the REGION_CHAINS phase. */
1259 
1260  FOREACH(VERTEX, v1, graph_vertices(dependences_graph))
1261  {
1263  {
1266  list s1_send_l = NIL;
1267  list s2_recv_l = NIL;
1268 
1269  ifdebug(2)
1270  {
1271  pips_debug(2, "new s1->s2 \n");
1273  pips_debug(2, "to %s", safe_statement_identification(s2));
1274  STEP_DEBUG_STATEMENT(2, "statement s1", s1);
1275  STEP_DEBUG_STATEMENT(2, "statement s2", s2);
1276  }
1277 
1278 
1279  step_compute_CHAINS_DG_SENDRECV_regions(s1, s2, &s1_send_l, &s2_recv_l);
1280 
1281  ifdebug(2)
1282  {
1283  debug_print_effects_list(s1_send_l, "SEND S1");
1284  debug_print_effects_list(s2_recv_l, "RECV S2");
1285  }
1286 
1287  step_compute_CHAINS_DG_remove_summary_regions(su, s1_send_l, s2_recv_l, remove_from_summary_send, remove_from_summary_recv);
1288 
1289  pips_debug(2, "end statement s1->s2\n");
1290  }
1291  }
1292  pips_debug(2, "end\n");
1293 }
1294 
1295 
1296 static void update_SUMMARY_SENDRECV_regions(set remove_from_summary_regions, list tmp_summary_regions_l, list *final_summary_regions_l)
1297 {
1298  pips_debug(1, "begin\n");
1299 
1300  /*
1301 
1302  The effects in the remove_from_summary_send and
1303  remove_from_summary_send sets are not SUMMARY. They can be
1304  DIRECTIVE regions or TRANSLATED regions.
1305 
1306  They are built from SEND and RECV effects corresponding to
1307  statements S1 and S2 of the DG.
1308 
1309  We need to get pathpoint corresponding to the SUMMARY
1310  effects to retrieve the original effects (from which summary was
1311  computed).
1312 
1313  Because the pathpoint corresponds to a SUMMARY, the effect in the
1314  pathpoint data field can be either TRANSLATED or DIRECTIVE region.
1315 
1316  */
1317 
1318  FOREACH(EFFECT, summ_eff, tmp_summary_regions_l)
1319  {
1320  assert(bound_step_effect_path_p(summ_eff));
1321 
1322  step_point point = load_step_effect_path(summ_eff);
1323  effect from_region = step_point_data(point);
1324 
1325  /*
1326  from_region can be either DIRECTIVE or TRANSLATED region. See comments above.
1327 
1328  if from_region corresponding to the SUMMARY effect is not is
1329  the remove set then add the SUMMARY effect into the final SUMMARY regions list.
1330  */
1331  if(!set_belong_p(remove_from_summary_regions, from_region))
1332  *final_summary_regions_l = CONS(EFFECT, summ_eff, *final_summary_regions_l);
1333  else
1334  pips_debug(2, "drop unoptimizable tmp_summary %p -> data %p\n", summ_eff, step_point_data(point));
1335  }
1336 
1337  pips_debug(1, "end\n");
1338 }
1339 
1340 static void step_update_SUMMARY_SENDRECV_regions(set remove_from_summary_send, set remove_from_summary_recv, list *full_send_l, list *partial_send_l)
1341 {
1343  list tmp_summary_send;
1344  list tmp_summary_recv;
1345  list final_summary_send = NIL;
1346  list final_summary_recv = NIL;
1347 
1348  pips_debug(2, "begin\n");
1349 
1350  /* Regions corresponding to body are SYMMARY regions */
1351  tmp_summary_send = step_send_regions_list_load(body);
1352  update_SUMMARY_SENDRECV_regions(remove_from_summary_send, tmp_summary_send, &final_summary_send);
1353  /* Store SEND summary regions */
1354  step_send_regions_list_update(body, final_summary_send);
1355 
1356  /* Regions corresponding to body are SYMMARY regions */
1357  tmp_summary_recv = step_recv_regions_list_load(body);
1358  update_SUMMARY_SENDRECV_regions(remove_from_summary_recv, tmp_summary_recv, &final_summary_recv);
1359  /* Store RECV summary regions */
1360  step_recv_regions_list_update(body, final_summary_recv);
1361 
1362  ifdebug(2)
1363  {
1364  debug_print_effects_list(final_summary_send, "FINAL SUMMARIZED SEND");
1365  debug_print_effects_list(final_summary_recv, "FINAL SUMMARIZED RECV");
1366  }
1367 
1368  /*
1369  full_send_l are TRANSLATED or DIRECTIVE regions.
1370  partial_send_l are SUMMARY regions.
1371 
1372  They will both be to retrieve the corresponding original DIRECTIVE
1373  region.
1374  This can be done from any SUMMARY or TRANSLATED and DIRECTIVE (of
1375  course) kind of region.
1376  */
1377 
1378  *full_send_l = set_to_list(remove_from_summary_send);
1379  *partial_send_l = final_summary_send;
1380  pips_debug(2, "end\n");
1381 }
1382 
1383 static void step_update_comm(list full_send_l, list partial_send_l)
1384 {
1385  pips_debug(2, "begin\n");
1386 
1387  FOREACH(EFFECT, eff, full_send_l)
1388  {
1390  }
1391  FOREACH(EFFECT, eff, partial_send_l)
1392  {
1394  }
1395 
1396  ifdebug(1)
1398  {
1399  pips_debug(1, "################ COMM ###############\n");
1400  MAP_EFFECT_BOOL_MAP(eff, partial,
1401  {
1402  step_point point = load_step_effect_path(eff);
1403  pips_debug(1, "module : %s\n", entity_user_name(step_point_module(point)));
1404  ifdebug(2)
1406  debug_print_effects_list(CONS(EFFECT,step_point_data(point),NIL), partial?"COMMUNICATION PARTIAL":"COMMUNICATION FULL");
1407  }, get_step_partial());
1408  }
1409 
1410  pips_debug(2, "end\n");
1411 }
1412 
1414 {
1415  bool exist_regions_p = false;
1416  pips_debug(2, "################ REGIONS %s ###############\n", entity_name(module));
1417 
1418  /* Initialization of summary regions */
1421 
1423 
1424  pips_debug(2, "end exist_regions_p = %d\n", exist_regions_p);
1425  return exist_regions_p;
1426 }
1427 
1428 
1429 bool step_analyse(const char* module_name)
1430 {
1431  debug_on("STEP_ANALYSE_DEBUG_LEVEL");
1432  bool exist_regions_p;
1433  pips_debug(2, "begin %d module_name = %s\n", __LINE__, module_name);
1434 
1437 
1441 
1442  statement body = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
1445 
1448 
1450 
1451  load_step_comm();
1452 
1454 
1455  init_step_send_regions();
1456  init_step_recv_regions();
1457 
1458  exist_regions_p = step_compute_SENDRECV_regions(module, body);
1459 
1460  pips_debug(2, "exist_regions_p = %d\n", exist_regions_p);
1461 
1462  if(exist_regions_p)
1463  {
1464  set remove_from_summary_send, remove_from_summary_recv;
1465  list full_send_l, partial_send_l;
1466 
1467  step_analyse_CHAINS_DG(module_name, &remove_from_summary_send, &remove_from_summary_recv);
1468 
1469  /* remove_from_summary_send et remove_from_summary_recv contain
1470  only directive regions and translated regions. They do not
1471  contain summary regions. */
1472 
1473  step_update_SUMMARY_SENDRECV_regions(remove_from_summary_send, remove_from_summary_recv, &full_send_l, &partial_send_l);
1474 
1475  /*
1476  full_send_l are TRANSLATED or DIRECTIVE regions.
1477  partial_send_l are SUMMARY regions.
1478  */
1479  step_update_comm(full_send_l, partial_send_l);
1480  }
1481 
1482  DB_PUT_MEMORY_RESOURCE(DBR_STEP_SEND_REGIONS, module_name, get_step_send_regions());
1483  DB_PUT_MEMORY_RESOURCE(DBR_STEP_RECV_REGIONS, module_name, get_step_recv_regions());
1484 
1485  reset_step_send_regions();
1486  reset_step_recv_regions();
1487 
1489 
1490  store_step_comm();
1491 
1493 
1496 
1499 
1500  reset_in_effects();
1502  reset_rw_effects();
1503 
1505 
1506  pips_debug(2, "End step_analyse\n");
1507  debug_off();
1508  return true;
1509 }
1510 
float a2sf[2] __attribute__((aligned(16)))
USER generates a user error (i.e., non fatal) by printing the given MSG according to the FMT.
Definition: 3dnow.h:3
bool effects_consistent_p(effects p)
Definition: effects.c:541
effects make_effects(list a)
Definition: effects.c:568
effects apply_statement_effects(statement_effects f, statement k)
Definition: effects.c:1007
approximation make_approximation_exact(void)
Definition: effects.c:185
void free_action(action p)
Definition: effects.c:80
effect copy_effect(effect p)
EFFECT.
Definition: effects.c:448
void free_approximation(approximation p)
Definition: effects.c:135
map_effect_bool make_map_effect_bool(void)
Definition: step_private.c:52
step_point make_step_point(entity a1, statement a2, effect a3)
Definition: step_private.c:447
step_comm make_step_comm(map_effect_step_point a1, map_effect_bool a2, map_effect_bool a3)
Definition: step_private.c:306
map_effect_step_point make_map_effect_step_point(void)
Definition: step_private.c:109
bool db_resource_required_or_available_p(const char *rname, const char *oname)
from now on we must not know about the database internals?
Definition: database.c:505
static list step_statement_path_get(statement stmt)
Definition: analyse.c:93
bool step_interlaced_p(region reg)
Definition: analyse.c:167
static list step_send_regions_list_load(statement s)
Definition: analyse.c:665
static void step_recv_regions_list_add(statement stmt, list l_regions)
Definition: analyse.c:744
static void step_print_directives_regions(step_directive d, list send_l, list recv_l)
Definition: analyse.c:757
static void step_set_step_partial(effect send_region, bool partial_p)
Definition: analyse.c:309
static void update_SUMMARY_SENDRECV_regions(set remove_from_summary_regions, list tmp_summary_regions_l, list *final_summary_regions_l)
Definition: analyse.c:1296
bool step_analysed_module_p(const char *module_name)
Definition: analyse.c:179
void reset_step_comm()
Definition: analyse.c:199
static void step_recv_regions_list_update(statement s, list l_regions)
Definition: analyse.c:732
static void step_initialize_step_partial(list send_l)
Definition: analyse.c:865
bool step_analyse(const char *module_name)
Definition: analyse.c:1429
static bool concerned_entity_p(effect eff, list regions)
Definition: analyse.c:1119
static list step_statement_path_factorise(statement s1, statement s2, list *suffix_sp1, list *suffix_sp2)
Definition: analyse.c:141
static void step_init_effect_path(entity module, statement stmt, list regions_l)
Definition: analyse.c:464
static void step_compute_CHAINS_DG_SENDRECV_regions(statement s1, statement s2, list *s1_send_l, list *s2_recv_l)
Definition: analyse.c:1205
static void step_set_communication_type_partial(effect send_region)
Definition: analyse.c:329
static void step_set_communication_type_full(effect send_region)
Definition: analyse.c:325
bool step_partial_p(region reg)
Definition: analyse.c:173
static bool step_translate_and_map_step_regions(statement stmt)
Definition: analyse.c:1021
static void step_analyse_CHAINS_DG(const char *module_name, set *remove_from_summary_send, set *remove_from_summary_recv)
Definition: analyse.c:1248
dg_vertex_label vertex_label
Definition: analyse.c:14
static void step_update_SUMMARY_SENDRECV_regions(set remove_from_summary_send, set remove_from_summary_recv, list *full_send_l, list *partial_send_l)
Definition: analyse.c:1340
static list step_recv_regions_list_load(statement s)
Definition: analyse.c:710
static effect get_directive_statement_region(effect reg)
Definition: analyse.c:289
static bool interlaced_basic_workchunk_regions_p(region reg, list index_l)
Definition: analyse.c:622
static bool anymodule_anywhere_region_p(list regions_l)
Definition: analyse.c:479
static void step_summarize_and_map_step_regions(statement stmt)
Definition: analyse.c:822
static bool compute_directive_regions(step_directive drt)
Definition: analyse.c:888
void debug_print_effects_list(list l, string txt)
Definition: analyse.c:334
static void step_statement_path_init(statement body)
Definition: analyse.c:71
void load_step_comm()
Definition: analyse.c:190
static bool step_statement_path_build(statement stmt, list *sp_current)
Definition: analyse.c:57
dg_arc_label arc_label
Definition: analyse.c:13
static bool step_compute_SENDRECV_regions(entity module, statement body)
Definition: analyse.c:1413
static void step_send_regions_list_add(statement stmt, list l_regions)
Definition: analyse.c:698
static void step_statement_path_unbuild(statement stmt, list *sp_current)
Definition: analyse.c:66
static list step_translate_and_map(statement stmt, list effects_called_l)
Definition: analyse.c:939
static void step_add_point_into_effect_path(effect new_eff, entity module, statement stmt, effect previous_eff)
Definition: analyse.c:227
static void step_get_comparable_effects(list eff_list, effect eff, set *effects_set)
Definition: analyse.c:1135
void store_step_comm()
Definition: analyse.c:206
static void step_compute_CHAINS_DG_remove_summary_regions(successor su, list source_send_l, list sink_recv_l, set *remove_from_summary_send, set *remove_from_summary_recv)
Definition: analyse.c:1149
static void step_recv_regions_list_store(statement s, list l_regions)
Definition: analyse.c:723
static void step_statement_path_finalize(void)
Definition: analyse.c:80
region rectangularization_region(region reg)
Definition: analyse.c:395
static void step_print_effect_path(list path)
Definition: analyse.c:236
static void step_compute_step_interlaced(list send_l, step_directive d)
Definition: analyse.c:875
static list compute_send_regions(list write_l, list out_l, statement stmt)
Definition: analyse.c:495
static void step_send_regions_list_update(statement s, list l_regions)
Definition: analyse.c:686
static list create_step_regions(statement stmt, list regions_l, enum action_utype action_tag)
Definition: analyse.c:406
bool step_analyse_init(const string module_name)
Definition: analyse.c:361
static statement step_statement_path_first_directive_statement(statement stmt)
Definition: analyse.c:98
static bool compute_SENDRECV_regions(statement stmt, bool *exist_regions_p)
Definition: analyse.c:1078
static list compute_recv_regions(list send_l, list in_l, statement stmt)
Definition: analyse.c:555
static void step_update_comm(list full_send_l, list partial_send_l)
Definition: analyse.c:1383
static list step_get_effect_path(effect start_eff)
Definition: analyse.c:262
static void step_send_regions_list_store(statement s, list l_regions)
Definition: analyse.c:677
static list summarize_and_map_step_regions(list effect_l, entity module, statement body)
Definition: analyse.c:800
static hash_table step_statement_path
The step_analyse phase computes three main resources:
Definition: analyse.c:55
#define VALUE_MONE
#define VALUE_ONE
void register_intrinsic_type_descriptor(IntrinsicDescriptor *p)
This function is called one time (at the very beginning) to create all intrinsic functions.
Definition: bootstrap.c:4411
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
int compare_effect_reference(effect *e1, effect *e2)
int compare_effect_reference(e1, e2):
Definition: compare.c:210
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
#define conflict_sink(x)
Definition: dg.h:167
#define CONFLICT(x)
CONFLICT.
Definition: dg.h:134
#define dg_arc_label_conflicts(x)
Definition: dg.h:201
#define conflict_source(x)
Definition: dg.h:165
#define region_any_reference(reg)
To be avoided.
#define region_action(reg)
#define region_entity(reg)
#define region_system(reg)
#define region_may_p(reg)
#define REGION
#define region
simulation of the type region
#define region_approximation(reg)
list RegionsMustUnion(list l1, list l2, bool(*union_combinable_p)(effect, effect))
list RegionsMustUnion(list l1, list l2, union_combinable_p) input : two lists of regions output : a l...
list RegionsIntersection(list l1, list l2, bool(*intersection_combinable_p)(effect, effect))
list RegionsIntersection(list l1,l2, bool (*intersection_combinable_p)(effect, effect)) input : outpu...
list regions_write_regions(list)
void init_convex_rw_regions(const char *)
Definition: methods.c:495
void set_methods_for_convex_effects(void)
methods.c
Definition: methods.c:235
void reset_convex_rw_regions(const char *)
Definition: methods.c:560
text text_rw_array_regions(list)
text text_region(effect)
list regions_dup(list)
effect region_dup(effect)
void free_effects_private_current_context_stack(void)
void set_rw_effects(statement_effects)
void make_effects_private_current_context_stack(void)
list load_out_effects_list(statement)
void reset_out_effects(void)
list generic_effects_backward_translation(entity, list, list, transformer)
list load_in_effects_list(statement)
void set_out_effects(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
bool w_w_combinable_p(effect, effect)
list load_rw_effects_list(statement)
void generic_effects_reset_all_methods(void)
bool r_w_combinable_p(effect, effect)
void reset_rw_effects(void)
string effect_to_string(effect)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
#define effect_read_p(eff)
#define effect_scalar_p(eff) entity_scalar_p(effect_entity(eff))
#define effect_action_tag(eff)
entity effect_entity(effect)
cproto-generated files
Definition: effects.c:52
action make_action_write_memory(void)
To ease the extension of action with action_kind.
Definition: effects.c:1011
bool FILE_star_effect_reference_p(reference)
Definition: effects.c:536
bool anywhere_effect_p(effect)
Is it an anywhere effect? ANYMMODULE:ANYWHERE
Definition: effects.c:346
bool std_file_effect_p(effect)
Definition: effects.c:519
action make_action_read_memory(void)
Definition: effects.c:1017
bool effect_comparable_p(effect, effect)
Can we merge these two effects because they are equal or because they only differ by their approximat...
Definition: effects.c:587
bool io_effect_p(effect)
Definition: effects.c:501
#define action_tag(x)
Definition: effects.h:310
struct _newgen_struct_statement_effects_ * statement_effects
Definition: effects.h:210
#define effects_effects(x)
Definition: effects.h:710
action_utype
Definition: effects.h:291
@ is_action_write
Definition: effects.h:293
@ is_action_read
Definition: effects.h:292
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
void gen_full_free_list(list l)
Definition: genClib.c:1023
void free(void *)
#define successor_vertex(x)
Definition: graph.h:118
#define successor_arc_label(x)
Definition: graph.h:116
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
#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
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
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
void * gen_chunk_identity(gen_chunk x)
Definition: genClib.c:2812
#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
void gen_remove_once(list *pl, const void *o)
Remove the first occurence of o in list pl:
Definition: list.c:691
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#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
void * gen_find_if(gen_filter_func_t test, const list l, gen_extract_func_t extract)
Definition: list.c:370
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
Definition: list.c:796
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
call statement_call(statement)
Get the call of a statement.
Definition: statement.c:1406
bool statement_call_p(statement)
Definition: statement.c:364
string safe_statement_identification(statement)
Definition: statement.c:1726
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_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
void hash_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
#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_user_warning
Definition: misc-local.h:146
#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
Pbase list_to_base(list l)
Pbase list_to_base(list l): returns the Pbase that contains the variables of list "l",...
#define assert(ex)
Definition: newgen_assert.h:41
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
@ hash_pointer
Definition: newgen_hash.h:32
#define hash_table_undefined_p(h)
Definition: newgen_hash.h:50
#define hash_table_undefined
Value of an undefined hash_table.
Definition: newgen_hash.h:49
#define HASH_DEFAULT_SIZE
Definition: newgen_hash.h:26
list set_to_list(const set)
create a list from a set the set is not freed
Definition: set.c:436
bool set_belong_p(const set, const void *)
Definition: set.c:194
@ set_pointer
Definition: newgen_set.h:44
set set_make(set_type)
Create an empty set of any type but hash_private.
Definition: set.c:102
set set_add_element(set, const set, const void *)
Definition: set.c:152
bool(* gen_filter_func_t)(const void *)
Definition: newgen_types.h:109
int(* gen_cmp_func_t)(const void *, const void *)
Definition: newgen_types.h:114
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
static char * module
Definition: pips.c:74
Psysteme sc_rectangular_hull(Psysteme, Pbase)
take the rectangular bounding box of the systeme sc, by projecting each constraint of the systeme aga...
Definition: sc_enveloppe.c:456
string pips_srcpath_append(string)
returns an allocated pointer to the old value
Definition: source_file.c:177
void register_intrinsic_handler(const char *name, intrinsic_desc_t *desc)
after this call, name and desc are owned by intrinsic_handlers, but will never be deallocated they mu...
Definition: misc.c:2517
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
void set_bool_property(const char *, bool)
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
Definition: entity.c:487
bool entity_array_p(entity e)
Is e a variable with an array type?
Definition: entity.c:754
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
bool entity_main_module_p(entity e)
Definition: entity.c:700
bool entity_module_p(entity e)
Definition: entity.c:683
list expressions_to_entities(list expressions)
map expression_to_entity on expressions
Definition: expression.c:3161
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
Definition: variable.c:1113
#define call_function(x)
Definition: ri.h:709
#define reference_variable(x)
Definition: ri.h:2326
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define entity_name(x)
Definition: ri.h:2790
#define transformer_relation(x)
Definition: ri.h:2873
#define reference_indices(x)
Definition: ri.h:2328
#define call_arguments(x)
Definition: ri.h:711
#define statement_undefined_p(x)
Definition: ri.h:2420
#define predicate_system(x)
Definition: ri.h:2069
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
Psysteme sc_variable_rename(Psysteme s, Variable v_old, Variable v_new)
Psysteme sc_variable_rename(Psysteme s, Variable v_old, Variable v_new): reecriture du systeme s remp...
Definition: sc.c:157
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Definition: sc_alloc.c:277
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
Psysteme sc_copy(Psysteme ps)
Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans...
Definition: sc_alloc.c:230
Psysteme extract_nredund_subsystem(Psysteme s1, Psysteme s2)
Psysteme extract_nredund_subsystem(s1, s2) Psysteme s1, s2;.
#define level
bool sc_integer_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
char * strdup()
transformer load_statement_precondition(statement)
s1
Definition: set.c:247
#define ifdebug(n)
Definition: sg.c:47
#define STEP_DEBUG_STATEMENT(D, W, S)
Definition: defines-local.h:42
#define STEP_DEFAULT_RT_H
Definition: defines-local.h:45
bool step_directives_bound_p(statement stmt)
Definition: directives.c:121
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
bool step_private_p(statement stmt, entity e)
Definition: directives.c:424
void step_directives_reset()
Definition: directives.c:103
void step_directive_print(step_directive d)
Definition: directives.c:362
step_directive step_directives_load(statement stmt)
Definition: directives.c:116
void step_directives_init(bool first_p)
Definition: directives.c:88
list step_directive_basic_workchunk_index(step_directive d)
Definition: directives.c:320
statement step_directive_basic_workchunk(step_directive d)
Definition: directives.c:286
#define step_point_data(x)
Definition: step_private.h:472
#define step_point_module(x)
Definition: step_private.h:468
#define STEP_POINT(x)
STEP_POINT.
Definition: step_private.h:437
#define step_point_stmt(x)
Definition: step_private.h:470
#define step_comm_partial(x)
Definition: step_private.h:353
#define step_comm_path(x)
Definition: step_private.h:349
#define step_directive_block(x)
Definition: step_private.h:431
struct _newgen_struct_step_comm_ * step_comm
Definition: step_private.h:75
#define step_comm_interlaced(x)
Definition: step_private.h:351
#define MAP_EFFECT_BOOL_MAP(k, v, c, f)
Definition: step_private.h:135
The following data structure describes an intrinsic function: its name and its arity and its type,...
Pbase base
Definition: sc-local.h:75
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
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: delay.c:253
for intrinsic registration
Definition: statement.c:54
string text_to_string(text t)
SG: moved here from ricedg.
Definition: print.c:239
entity entity_to_intermediate_value(entity)
Definition: value.c:879
void add_intermediate_value(entity)
Definition: value.c:1476
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define NO_OFL_CTRL
#define base_rm(b)
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_NULLE
MACROS SUR LES BASES.
Pvecteur vect_make(Pvecteur v, Variable var, Value val,...)
Pvecteur vect_make(v, [var, val,]* 0, val) Pvecteur v; // may be NULL, use assigne anyway Variable va...
Definition: alloc.c:165