PIPS
phrase_distributor_communication.c
Go to the documentation of this file.
1 /*
2 
3  $Id: phrase_distributor_communication.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 /**
28  * General computation for PHRASE distribution
29  * COMMUNICATION STUFFs
30  */
31 
32 #include <stdio.h>
33 #include <ctype.h>
34 
35 #include "genC.h"
36 #include "linear.h"
37 #include "ri.h"
38 #include "effects.h"
39 
40 #include "resources.h"
41 
42 #include "misc.h"
43 #include "ri-util.h"
44 #include "prettyprint.h"
45 #include "effects-util.h"
46 #include "pipsdbm.h"
47 
48 #include "text-util.h"
49 
50 #include "ray_dte.h"
51 #include "sommet.h"
52 #include "sg.h"
53 #include "polyedre.h"
54 
55 #include "phrase_tools.h"
56 
57 #include "effects-generic.h"
58 #include "effects-simple.h"
59 #include "effects-convex.h"
60 
61 #include "sc.h"
62 #include "conversion.h"
63 
64 #include "phrase_distribution.h"
65 
66 #include "phrase.h"
67 /**
68  * Build and store new module START_RU.
69  * Create statement module_statement
70  */
73  int number_of_deployment_units,
74  entity global_common,
76 {
77  entity start_ru_module;
78  entity func_id;
79  entity unit_id = NULL;
80  const char* function_name;
81  list stat_seq = NIL;
82  sequence new_sequence;
83  instruction sequence_instruction;
84  entity set_entity = get_current_module_entity();
85 
87  pips_debug(2, "Creating module %s\n", entity_global_name(start_ru_module));
89  set_current_module_entity(start_ru_module);
92  start_ru_module,
93  1);
94  if (number_of_deployment_units > 1) {
97  start_ru_module,
98  2);
99  }
100 
101  /* Declare CONTROL_DATA common to be visible here */
102  declare_common_variables_in_module (global_common, start_ru_module);
103 
104  /* Declare commons for all externalized functions to be visible here */
105  MAP (ENTITY, com, {
106  declare_common_variables_in_module (com, start_ru_module);
107  },l_commons);
108 
109  ifdebug(7) {
110  pips_debug(7, "Declarations for START_RU module: \n");
111  fprint_environment(stderr, start_ru_module);
112  }
113 
114  HASH_MAP (externalized_function, l_params, {
115 
116  entity function = (entity)externalized_function;
118  test new_test;
119  instruction test_instruction;
120  statement test_statement;
121  statement call_statement;
122  list call_params ;
123 
124  function_name = entity_local_name(function);
125 #if 0
126  statement called_module_stat = (statement) db_get_memory_resource(DBR_CODE,
127  function_name,
128  true);
129 
130 #endif
131  entity called_module = local_name_to_top_level_entity(function_name);
132 
133  /* Compute the parameters of call function */
134  call_params = NIL;
135 
136  /* Processing PARAMS regions */
137  MAP (REGION, reg, {
140  entity local_variable
141  = entity_in_module (get_common_param_name(reference_variable(ref), function), start_ru_module);
142  list indices = NIL;
143  if (number_of_deployment_units > 1) {
144  list primary_indices = variable_dimensions(type_variable(entity_type(local_variable)));
145  expression to_be_replaced = NULL;
146  MAP (DIMENSION, dim, {
148  dimension_lower(dim),
149  indices);
150  to_be_replaced=dimension_lower(dim);
151  }, primary_indices);
152  gen_list_patch (indices,to_be_replaced,entity_to_expression(unit_id));
154  }
155  new_param = make_entity_expression (local_variable, indices);
156  call_params = CONS(EXPRESSION, new_param, call_params);
157  }, (list)l_params);
158 
159  call_params = gen_nreverse(call_params);
160 
161  /* Make the CALL statement */
162  call_statement = make_statement(entity_empty_label(),
167  make_call(called_module,call_params)),
168  NIL,NULL,
170 
173  entity_to_expression (func_id),
174  entity_to_expression (entity_in_module (get_function_id_name(function), start_ru_module)));
175 
176  new_test = make_test (test_condition, call_statement,
178 
179  test_instruction = make_instruction (is_instruction_test,new_test);
180 
181  test_statement = make_statement (entity_empty_label(),
185  test_instruction,NIL,NULL,
187 
188  stat_seq = CONS (STATEMENT, test_statement, stat_seq);
189 
190  }, ht_params);
191 
192  stat_seq = gen_nreverse(CONS(STATEMENT, make_return_statement(start_ru_module), stat_seq));
193 
194  new_sequence
195  = make_sequence (stat_seq);
196 
197  sequence_instruction
199  new_sequence);
200 
205  sequence_instruction,NIL,NULL,
207 
209 
211  set_current_module_entity(set_entity);
212  return start_ru_module;
213 }
214 
215 /**
216  * Build and store new module WAIT_RU.
217  * Create statement module_statement
218  */
220  _UNUSED_ int number_of_deployment_units,
221  entity global_common,
222  list l_commons)
223 {
224  entity wait_ru_module;
225  entity set_entity = get_current_module_entity();
226 
228  pips_debug(2, "Creating module %s\n", entity_global_name(wait_ru_module));
230  set_current_module_entity(wait_ru_module);
231 #if 0
234  wait_ru_module,
235  1);
236  entity unit_id = NULL;
237  if (number_of_deployment_units > 1) {
240  wait_ru_module,
241  2);
242  }
243 #endif
244 
245  /* Declare CONTROL_DATA common to be visible here */
246  declare_common_variables_in_module (global_common, wait_ru_module);
247 
248  /* Declare commons for all externalized functions to be visible here */
249  MAP (ENTITY, com, {
250  declare_common_variables_in_module (com, wait_ru_module);
251  },l_commons);
252 
253  ifdebug(7) {
254  pips_debug(7, "Declarations for WAIT_RU module: \n");
255  fprint_environment(stderr, wait_ru_module);
256  }
257 
258  *module_statement = make_return_statement(wait_ru_module);
259 
261 
263  set_current_module_entity(set_entity);
264 
265  return wait_ru_module;
266 }
267 
268 /**
269  * Make communication statement (SEND or RECEIVE data), for a
270  * given fonction and region
271  */
273  entity module,
274  region reg,
275  entity unit_id,
276  entity param,
277  int number_of_deployment_units,
278  bool is_receiving)
279 {
280  entity local_entity = entity_in_module (get_common_param_name (region_entity(reg), function), module);
281 
282  ifdebug(2) {
283  pips_debug(2, "BEGIN make_communication_statement\n");
284  pips_debug(2, "Function: [%s]\n",entity_local_name(function));
285  pips_debug(2, "Module: [%s]\n",entity_local_name(module));
286  pips_debug(2, "Region: \n");
287  print_region(reg);
288  pips_debug(2, "Local entity: [%s]\n",entity_local_name(local_entity));
289  }
290 
291  if (region_scalar_p(reg)) {
292  if (number_of_deployment_units > 1) {
293  list inds = CONS(EXPRESSION, entity_to_expression(unit_id),NIL);
294  if (is_receiving) {
297  make_entity_expression(local_entity, inds),
298  NULL);
299  }
300  else {
302  make_entity_expression(local_entity, inds),
304  NULL);
305  }
306  }
307  else {
308  if (is_receiving) {
311  entity_to_expression(local_entity),
312  NULL);
313  }
314  else {
316  entity_to_expression(local_entity),
318  NULL);
319  }
320  }
321  }
322 
324 }
325 
326 /**
327  * Build and store new module used for communication (SEND or RECEIVE scalar params)
328  * Create statement module_statement
329  */
331  const char* module_name,
332  hash_table ht_communications,
334  int number_of_deployment_units,
335  entity global_common,
336  list l_commons,
337  bool is_receiving)
338 {
339  entity new_module;
340  entity func_id, param_id, param;
341  entity unit_id = NULL;
342  entity set_entity = get_current_module_entity();
343 
345  test new_test;
346  instruction test_instruction;
347  statement test_statement;
348  list stat_seq = NIL;
349  statement function_statement;
350  sequence new_sequence;
351  instruction sequence_instruction;
352  int param_nb = 1;
353 
355  pips_debug(2, "Creating module %s\n", entity_global_name(new_module));
357  set_current_module_entity(new_module);
359  module_name,
360  new_module,
361  param_nb++);
362  if (number_of_deployment_units > 1) {
364  module_name,
365  new_module,
366  param_nb++);
367  }
369  module_name,
370  new_module,
371  param_nb++);
372 
375  module_name,
376  new_module,
377  param_nb++);
378 
379  /* Declare CONTROL_DATA common to be visible here */
380  declare_common_variables_in_module (global_common, new_module);
381 
382  /* Declare commons for all externalized functions to be visible here */
383  MAP (ENTITY, com, {
384  declare_common_variables_in_module (com, new_module);
385  },l_commons);
386 
387  ifdebug(7) {
388  pips_debug(7, "Declarations for %s module: \n", module_name);
389  fprint_environment(stderr, new_module);
390  }
391 
392  HASH_MAP (function, l_reg, {
393 
394  list function_proc_l_stats = NIL;
395  expression test_condition2;
396  test new_test2;
397  instruction test_instruction2;
398  statement test_statement2;
399  sequence new_sequence2;
400  instruction sequence_instruction2;
401 
402  MAP (REGION, reg, {
403 
404  statement communication_stat
405  = make_communication_statement(function,
406  new_module,
407  reg,
408  unit_id,
409  param,
410  number_of_deployment_units,
411  is_receiving);
412 
413  entity param_id_value = entity_in_module (is_receiving?get_out_param_id_name(region_entity(reg),function):get_in_param_id_name(region_entity(reg),function), new_module);
414 
415  test_condition2
417  entity_to_expression (param_id),
418  entity_to_expression (param_id_value));
419 
420  new_test2 = make_test (test_condition2, communication_stat,
422 
423  test_instruction2 = make_instruction (is_instruction_test,new_test2);
424 
425  test_statement2 = make_statement (entity_empty_label(),
429  test_instruction2,NIL,NULL,
431 
432  function_proc_l_stats = CONS (STATEMENT, test_statement2, function_proc_l_stats);
433 
434  /*if (scalar_region_p(reg)) {
435  }*/
436  },l_reg);
437 
438  function_proc_l_stats = gen_nreverse(function_proc_l_stats);
439 
440  new_sequence2
441  = make_sequence (function_proc_l_stats);
442 
443  sequence_instruction2
445  new_sequence2);
446 
447  function_statement = make_statement(entity_empty_label(),
451  sequence_instruction2,NIL,NULL,
453 
456  entity_to_expression (func_id),
458 
459  new_test = make_test (test_condition, function_statement,
461 
462  test_instruction = make_instruction (is_instruction_test,new_test);
463 
464  test_statement = make_statement (entity_empty_label(),
468  test_instruction,NIL,NULL,
470 
471  stat_seq = CONS (STATEMENT, test_statement, stat_seq);
472  }, ht_communications);
473 
474  stat_seq = gen_nreverse(CONS(STATEMENT, make_return_statement(new_module), stat_seq));
475 
476  new_sequence
477  = make_sequence (stat_seq);
478 
479  sequence_instruction
481  new_sequence);
482 
487  sequence_instruction,NIL,NULL,
489 
491 
493  set_current_module_entity(set_entity);
494 
495  return new_module;
496 }
497 
498 /**
499  * Return DYN_VAR_PARAM_NAME name for a dynamic variable
500  */
501 string get_dynamic_variable_name(entity dynamic_variable)
502 {
503  char *buffer;
504  asprintf(&buffer,
506  entity_local_name(dynamic_variable));
507  return (buffer);
508 }
509 
510 /**
511  * Return REF_VAR_PARAM_NAME name for a dynamic variable
512  */
513 string get_ref_var_param_name(entity reference_param)
514 {
515  char *buffer;
516  asprintf(&buffer,
518  entity_local_name(reference_param));
519  return (buffer);
520 }
521 
522 /**
523  * Return SEND_PARAM module name for function and region
524  */
526 {
527  if (region_scalar_p(reg)) {
529  }
530  else {
531  char *buffer;
532  asprintf(&buffer,
534  entity_local_name(function),
536  return (buffer);
537  }
538 }
539 
540 /**
541  * Return RECEIVE_PARAM module name for function and region
542  */
544 {
545  if (region_scalar_p(reg)) {
547  }
548  else {
549  char *buffer;
550  asprintf(&buffer,
552  entity_local_name(function),
554  return (buffer);
555  }
556 }
557 
558 /**
559  * Internally used for building communication modules
560  */
562  int number_of_deployment_units,
563  entity global_common,
564  list l_commons,
565  bool is_receiving)
566 {
567  list l_modules = NIL;
568 
569  HASH_MAP (var, ht_regions_for_functions, {
572  pips_debug(2, "Creating module [%s]\n", module_name);
573  l_modules
574  = CONS (ENTITY,
576  module_name,
577  ht_regions_for_functions,
579  number_of_deployment_units,
580  global_common,
581  l_commons,
582  is_receiving),
583  l_modules);
584  },ht_communications);
585 
586  return l_modules;
587 }
588 
589 /**
590  * Build and return list of modules used for INPUT communications
591  * (SEND_PARAMETERS...)
592  */
594  int number_of_deployment_units,
595  entity global_common,
596  list l_commons)
597 {
598  return make_scalar_communication_modules (ht_in_communications,
599  number_of_deployment_units,
600  global_common,
601  l_commons,
602  false);
603 }
604 
605 /**
606  * Build and return list of modules used for OUTPUT communications
607  * (RECEIVE_PARAMETERS...)
608  */
610  int number_of_deployment_units,
611  entity global_common,
612  list l_commons)
613 {
614  return make_scalar_communication_modules (ht_out_communications,
615  number_of_deployment_units,
616  global_common,
617  l_commons,
618  true);
619 }
620 
621 /**
622  * Build and return parameters (PHI1,PHI2) and dynamic variables for
623  * region reg.
624  * NOT IMPLEMENTED: suppress unused dynamic variables !!!!
625  */
627  list* l_reg_params,
628  list* l_reg_variables)
629 {
630  Psysteme ps_reg;
631  Pbase ps_base;
632 
633  ps_reg = region_system(reg);
634  ps_base = ps_reg->base;
635 
636  *l_reg_params = NIL;
637  *l_reg_variables = NIL;
638 
639  pips_debug(3, "BEGIN compute_region_variables: \n");
640 
641  pips_assert("compute_region_variables", ! SC_UNDEFINED_P(ps_reg));
642 
643  for (; ! VECTEUR_NUL_P(ps_base); ps_base = ps_base->succ) {
644 
645  entity e = (entity) ps_base->var;
646  if (e != NULL) {
647  storage s = entity_storage(e);
648  pips_debug(7, "Variable: %s\n", entity_global_name(e));
649  /* An entity in a system that has an undefined storage is
650  necesseraly a PHI entity, not dynamic !! */
651  if (s != storage_undefined) {
652  if (storage_tag(s) == is_storage_ram) {
653  ram r = storage_ram(s);
654  if (dynamic_area_p(ram_section(r))) {
655  *l_reg_variables = CONS(ENTITY, e, *l_reg_variables);
656  }
657  }
658  else {
659  *l_reg_params = CONS(ENTITY, e, *l_reg_params);
660  }
661  }
662  }
663  }
664  pips_debug(3, "END compute_region_variables: \n");
665 }
666 
667 /**
668  * Build statement doing data transfer between internal storage for
669  * externalized function and parameters from the caller. This job is done
670  * using reg region and systeme_to_loop_nest(...) function
671  */
673  entity module,
674  region reg,
675  entity unit_id,
676  entity param,
677  int number_of_deployment_units,
678  bool is_receiving,
679  list l_reg_params,
680  list l_reg_variables)
681 {
682  Psysteme ps_reg;
683  reference ref;
684  statement assignement_statement;
685  expression local_entity_exp;
686  expression param_exp;
687  list local_entity_inds;
688  list param_inds;
689  entity divide;
690  statement returned_statement;
691 
692  entity local_entity = entity_in_module (get_common_param_name (region_entity(reg), function), module);
693 
694  ifdebug(2) {
695  pips_debug(2, "BEGIN make_array_communication_statement\n");
696  pips_debug(2, "Function: [%s]\n",entity_local_name(function));
697  pips_debug(2, "Module: [%s]\n",entity_local_name(module));
698  pips_debug(2, "Region: \n");
699  print_region(reg);
700  pips_debug(2, "Local entity: [%s]\n",entity_local_name(local_entity));
701  }
702 
703  ps_reg = region_system(reg);
704 
705  ref = effect_any_reference(reg);
706  param_inds = gen_copy_seq(reference_indices(ref));
707  if (number_of_deployment_units > 1) {
709  }
710  else {
711  local_entity_inds = gen_copy_seq(reference_indices(ref));
712  }
713  local_entity_exp = make_entity_expression(local_entity, local_entity_inds);
714  param_exp = make_entity_expression(param, param_inds);
715 
716  if (is_receiving) {
717  assignement_statement =
719  param_exp,
720  local_entity_exp,
721  NULL);
722  }
723  else {
724  assignement_statement =
726  local_entity_exp,
727  param_exp,
728  NULL);
729  }
730 
731 
732  pips_debug(2, "Loop Nest:\n");
733 
734  /* !!! WARNING !!! This divide function has to be redefined here to
735  * have a positive remainder ! Use an other custom integer division
736  * operation ! */
738 
739  returned_statement = systeme_to_loop_nest(ps_reg,
740  l_reg_params,
741  assignement_statement,
742  divide);
743 
744 
745  MAP (ENTITY, dyn_var, {
746  pips_debug(2, "Replace: %s with: %s\n",
747  entity_global_name(dyn_var),
748  get_dynamic_variable_name(dyn_var));
749  replace_entity (returned_statement,dyn_var,
751 
752  },l_reg_variables);
753 
754  MAP (ENTITY, phi_param, {
755  pips_debug(2, "Replace: %s with: %s\n",
756  entity_global_name(phi_param),
757  get_ref_var_param_name(phi_param));
758  replace_entity (returned_statement,phi_param,
760 
761  },l_reg_params);
762 
763  ifdebug(2) {
764  pips_debug(2, "Make this statement:\n");
765  print_statement(returned_statement);
766  pips_debug(2, "END make_array_communication_statement\n");
767  }
768 
769  return returned_statement;
770 }
771 
772 /**
773  * Creates an integer variable in specified module
774  */
776  const char* new_module_name,
777  entity module)
778 {
780  entity a;
781  basic base;
782 
783  if ((gen_find_tabulated(concatenate(new_module_name,
785  new_name,
786  NULL),
788  {
789  /* This entity does not exist, we can safely create it */
790 
791  new_variable = make_entity (strdup(concatenate(new_module_name,
793  new_name, NULL)),
797  a = FindEntity(new_module_name, DYNAMIC_AREA_LOCAL_NAME);
801  make_ram(module, a,
804  NIL));
805  /* Add to declarations.... */
807  pips_debug(2, "Created new private variable: %s\n", entity_global_name(new_variable));
808  return new_variable;
809  }
810  else
811  {
812  pips_internal_error("Entity already exist: %s", new_name);
813  return NULL;
814  }
815 }
816 
817 /**
818  * Internally used for making communication module for non-scalar region
819  * and function
820  */
822  region reg,
823  entity global_common,
824  entity externalized_fonction_common,
825  int number_of_deployment_units,
826  bool is_receiving)
827 {
828  entity new_module;
829  entity unit_id = NULL;
830  entity param;
831  const char* module_name = is_receiving?get_receive_param_module_name(function,reg):get_send_param_module_name(function,reg);
832  entity set_entity = get_current_module_entity();
835  list l_reg_params; /* list of entities: phi1, phi2,... */
836  list l_reg_variables; /* list of dynamic variables....*/
837  int param_nb = 1;
838 
840  pips_debug(2, "Creating module %s\n", entity_local_name(new_module));
841  pips_debug(2, "Function [%s]\n", entity_local_name(function));
842  pips_debug(2, "Region: ");
843  print_region(reg);
844 
845 
846  compute_region_variables(reg,&l_reg_params,&l_reg_variables);
847 
849  set_current_module_entity(new_module);
850  if (number_of_deployment_units > 1) {
852  module_name,
853  new_module,
854  param_nb++);
855  }
858  module_name,
859  new_module,
860  param_nb++);
861 
862  MAP (ENTITY, dyn_var, {
863  pips_debug(2, "New parameter: %s\n", get_dynamic_variable_name(dyn_var));
865  get_dynamic_variable_name(dyn_var),
866  module_name,
867  new_module,
868  param_nb++);
869  },l_reg_variables);
870 
871  MAP (ENTITY, phi_param, {
872  pips_debug(2, "New private variable: %s\n", get_ref_var_param_name(phi_param));
874  module_name,
875  new_module);
876  },l_reg_params);
877 
878 
879 
880  /* Declare CONTROL_DATA common to be visible here */
881  declare_common_variables_in_module (global_common, new_module);
882 
883  /* Declare common for externalized function to be visible here */
884  declare_common_variables_in_module (externalized_fonction_common, new_module);
885 
886  ifdebug(7) {
887  pips_debug(7, "Declarations for %s module: \n", module_name);
888  fprint_environment(stderr, new_module);
889  }
890 
893  new_module,
894  reg,
895  unit_id,
896  param,
897  number_of_deployment_units,
898  is_receiving,
899  l_reg_params,
900  l_reg_variables);
901 
903 
905  set_current_module_entity(set_entity);
906 
907  return new_module;
908 }
909 
910 /**
911  * Internally used for making all communication modules for non-scalar IN
912  * or OUT regions for a given function
913  */
915  list l_regions,
916  entity global_common,
917  entity externalized_fonction_common,
918  int number_of_deployment_units,
919  bool is_receiving)
920 {
921  list returned = NIL;
922 
923  MAP (REGION, reg, {
924  if (!region_scalar_p(reg)) {
925  returned = CONS (ENTITY,
927  reg,
928  global_common,
929  externalized_fonction_common,
930  number_of_deployment_units,
931  is_receiving),
932  returned);
933  }
934  },l_regions);
935 
936  return returned;
937 }
938 
939 /**
940  * Make all SEND_PARAM communication modules for non-scalar regions for a
941  * given function
942  */
944  list l_regions,
945  entity global_common,
946  entity externalized_fonction_common,
947  int number_of_deployment_units)
948 {
949  return make_array_communication_modules (function,
950  l_regions,
951  global_common,
952  externalized_fonction_common,
953  number_of_deployment_units,
954  false);
955 }
956 
957 /**
958  * Make all RECEIVE_PARAM communication modules for non-scalar regions for a
959  * given function
960  */
962  list l_regions,
963  entity global_common,
964  entity externalized_fonction_common,
965  int number_of_deployment_units)
966 {
967  return make_array_communication_modules (function,
968  l_regions,
969  global_common,
970  externalized_fonction_common,
971  number_of_deployment_units,
972  true);
973 }
974 
975 
call make_call(entity a1, list a2)
Definition: ri.c:269
storage make_storage(enum storage_utype tag, void *val)
Definition: ri.c:2273
language make_language_unknown(void)
Definition: ri.c:1259
ram make_ram(entity a1, entity a2, intptr_t a3, list a4)
Definition: ri.c:1999
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
Definition: ri.c:2222
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
synchronization make_synchronization_none(void)
Definition: ri.c:2424
sequence make_sequence(list a)
Definition: ri.c:2125
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
void new_param(string s)
===========================================================================
Definition: adg_read_paf.c:262
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
static statement module_statement
Definition: alias_check.c:125
#define divide(a, b)
static list l_commons
bdt base
Current expression.
Definition: bdt_read_paf.c:100
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
statement systeme_to_loop_nest(Psysteme, list, statement, entity)
sc is used to generate the loop nest bounds for variables vars.
static entity new_variable
entity to be replaced, the primary?
Definition: dynamic.c:860
#define region_entity(reg)
#define region_system(reg)
#define REGION
#define region
simulation of the type region
#define region_scalar_p(reg)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
if(!(yy_init))
Definition: genread_lex.c:1029
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
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 replace_entity(void *s, entity old, entity new)
per variable version of replace_entities.
Definition: replace.c:113
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
#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
void gen_list_patch(list l, const void *x, const void *y)
Replace all the reference to x in list l by a reference to y:
Definition: list.c:985
#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
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
statement make_return_statement(entity)
Definition: statement.c:779
statement make_continue_statement(entity)
Definition: statement.c:953
static list indices
Definition: icm.c:204
#define _UNUSED_
Definition: misc-local.h:232
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define asprintf
Definition: misc-local.h:225
#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 DYNAMIC_AREA_LOCAL_NAME
Definition: naming-local.h:69
#define MODULE_SEP_STRING
Definition: naming-local.h:30
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define HASH_MAP(k, v, code, ht)
Definition: newgen_hash.h:60
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
struct cons * list
Definition: newgen_types.h:106
entity entity_in_module(const char *, entity)
Return entity named name in specified module.
entity create_parameter_for_new_module(variable, const char *, const char *, entity, int)
phrase_distributor_control_code.c
string get_send_parameter_module_name(variable)
string get_common_param_name(entity variable, entity)
string get_out_param_id_name(entity variable, entity)
string get_receive_parameter_module_name(variable)
entity create_integer_parameter_for_new_module(const char *, const char *, entity, int)
Create new integer variable parameter for a newly created module.
void store_new_module(const char *, entity, statement)
Store (PIPDBM) newly created module module with module_statement as USER_FILE by saving pretty printi...
void declare_common_variables_in_module(entity, entity)
Creates all the things that need to be created in order to declare common in module (all the variable...
string get_function_id_name(entity)
statement make_binary_call_statement(const char *, expression, expression, statement)
Build and return new statement which is a binary call with the 2 expressions expression1 and expressi...
Definition: phrase_tools.c:354
string get_in_param_id_name(entity variable, entity)
#define REF_VAR_PARAM_NAME
#define START_RU_PARAM1_NAME
#define COM_MODULE_PARAM4_NAME
#define COM_MODULE_PARAM2_NAME
#define WAIT_RU_MODULE_NAME
Stuff for WAIT_RU(...) subroutine generation.
#define RECEIVE_ARRAY_PARAM_MODULE_NAME
#define START_RU_PARAM2_NAME
#define COM_MODULE_PARAM1_NAME
#define DYN_VAR_PARAM_NAME
#define WAIT_RU_PARAM1_NAME
#define COM_MODULE_PARAM3_NAME
#define SEND_ARRAY_PARAM_MODULE_NAME
#define WAIT_RU_PARAM2_NAME
#define START_RU_MODULE_NAME
Stuff for START_RU(...) subroutine generation.
list make_receive_array_params_modules(entity function, list l_regions, entity global_common, entity externalized_fonction_common, int number_of_deployment_units)
Make all RECEIVE_PARAM communication modules for non-scalar regions for a given function.
list make_send_array_params_modules(entity function, list l_regions, entity global_common, entity externalized_fonction_common, int number_of_deployment_units)
Make all SEND_PARAM communication modules for non-scalar regions for a given function.
list make_send_scalar_params_modules(hash_table ht_in_communications, int number_of_deployment_units, entity global_common, list l_commons)
Build and return list of modules used for INPUT communications (SEND_PARAMETERS......
static statement make_array_communication_statement(entity function, entity module, region reg, entity unit_id, entity param, int number_of_deployment_units, bool is_receiving, list l_reg_params, list l_reg_variables)
Build statement doing data transfer between internal storage for externalized function and parameters...
static statement make_communication_statement(entity function, entity module, region reg, entity unit_id, entity param, int number_of_deployment_units, bool is_receiving)
Make communication statement (SEND or RECEIVE data), for a given fonction and region.
entity make_wait_ru_module(statement *module_statement, _UNUSED_ int number_of_deployment_units, entity global_common, list l_commons)
Build and store new module WAIT_RU.
string get_dynamic_variable_name(entity dynamic_variable)
Return DYN_VAR_PARAM_NAME name for a dynamic variable.
static list make_array_communication_modules(entity function, list l_regions, entity global_common, entity externalized_fonction_common, int number_of_deployment_units, bool is_receiving)
Internally used for making all communication modules for non-scalar IN or OUT regions for a given fun...
static list make_scalar_communication_modules(hash_table ht_communications, int number_of_deployment_units, entity global_common, list l_commons, bool is_receiving)
Internally used for building communication modules.
string get_receive_param_module_name(entity function, region reg)
Return RECEIVE_PARAM module name for function and region.
static entity make_scalar_communication_module(variable var, const char *module_name, hash_table ht_communications, statement *module_statement, int number_of_deployment_units, entity global_common, list l_commons, bool is_receiving)
Build and store new module used for communication (SEND or RECEIVE scalar params) Create statement mo...
list make_receive_scalar_params_modules(hash_table ht_out_communications, int number_of_deployment_units, entity global_common, list l_commons)
Build and return list of modules used for OUTPUT communications (RECEIVE_PARAMETERS....
string get_send_param_module_name(entity function, region reg)
Return SEND_PARAM module name for function and region.
string get_ref_var_param_name(entity reference_param)
Return REF_VAR_PARAM_NAME name for a dynamic variable.
static entity make_array_communication_module(entity function, region reg, entity global_common, entity externalized_fonction_common, int number_of_deployment_units, bool is_receiving)
Internally used for making communication module for non-scalar region and function.
void compute_region_variables(region reg, list *l_reg_params, list *l_reg_variables)
Build and return parameters (PHI1,PHI2) and dynamic variables for region reg.
entity make_start_ru_module(hash_table ht_params, statement *module_statement, int number_of_deployment_units, entity global_common, list l_commons)
General computation for PHRASE distribution COMMUNICATION STUFFs.
entity create_private_integer_variable_for_new_module(string new_name, const char *new_module_name, entity module)
Creates an integer variable in specified module.
static char * module
Definition: pips.c:74
#define print_region(x)
Definition: print.c:343
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
#define EQUAL_OPERATOR_NAME
#define make_entity(n, t, s, i)
#define STATEMENT_NUMBER_UNDEFINED
default values
#define DIVIDE_OPERATOR_NAME
#define empty_comments
Empty comments (i.e.
#define ASSIGN_OPERATOR_NAME
Definition: ri-util-local.h:95
bool dynamic_area_p(entity aire)
Definition: area.c:68
void fprint_environment(FILE *fd, entity m)
Definition: declarations.c:287
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
Definition: entity.c:1503
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
string entity_global_name(entity e)
Used instead of the macro to pass as formal argument.
Definition: entity.c:464
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
entity make_empty_subroutine(const char *name, language l)
Definition: entity.c:268
entity entity_empty_label(void)
Definition: entity.c:1105
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
expression make_entity_expression(entity e, cons *inds)
Definition: expression.c:176
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
basic MakeBasic(int)
END_EOLE.
Definition: type.c:128
void AddEntityToDeclarations(entity, entity)
END_EOLE.
Definition: variable.c:108
int add_variable_to_area(entity, entity)
Definition: variable.c:1376
type MakeTypeVariable(basic, cons *)
BEGIN_EOLE.
Definition: type.c:116
#define value_undefined
Definition: ri.h:3016
@ is_basic_overloaded
Definition: ri.h:574
@ is_basic_int
Definition: ri.h:571
#define reference_variable(x)
Definition: ri.h:2326
#define storage_tag(x)
Definition: ri.h:2515
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define dimension_lower(x)
Definition: ri.h:980
#define basic_tag(x)
Definition: ri.h:613
#define type_variable(x)
Definition: ri.h:2949
#define entity_storage(x)
Definition: ri.h:2794
#define ram_section(x)
Definition: ri.h:2249
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
@ is_storage_ram
Definition: ri.h:2492
#define entity_undefined
Definition: ri.h:2761
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_sequence
Definition: ri.h:1469
#define reference_indices(x)
Definition: ri.h:2328
#define test_condition(x)
Definition: ri.h:2833
#define variable_dimensions(x)
Definition: ri.h:3122
#define storage_ram(x)
Definition: ri.h:2521
#define entity_type(x)
Definition: ri.h:2792
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
#define variable_basic(x)
Definition: ri.h:3120
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
#define storage_undefined
Definition: ri.h:2476
char * strdup()
#define ifdebug(n)
Definition: sg.c:47
static string buffer
Definition: string.c:113
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
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: replace.c:135
#define VECTEUR_NUL_P(v)