PIPS
hpfc.c
Go to the documentation of this file.
1 /*
2 
3  $Id: hpfc.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 /* HPFC module by Fabien COELHO
28  */
29 
30 #include "defines-local.h"
31 
32 #include "semantics.h"
33 #include "resources.h"
34 #include "pipsdbm.h"
35 #include "transformations.h"
36 #include "effects-generic.h"
37 #include "effects-simple.h"
38 #include "effects-convex.h"
39 
40 /*************************************************************** REDUCTIONS */
41 
43 
44 /****************************************************************** COMMONS */
45 
46 GENERIC_STATIC_STATUS(static, the_commons, list, NIL, gen_free_list)
47 
49 { the_commons_object = gen_once(c, the_commons_object);}
50 
51 static void compile_common(entity c)
52 {
54 // statement_remove_unused_declarations(statement_undefined,load_new_host(c));
56 }
57 
58 /******************************************************************** PURES */
59 
60 GENERIC_STATIC_STATUS(static, the_pures, list, NIL, gen_free_list)
61 
63 { the_pures_object = gen_once(f, the_pures_object);}
64 
65 /* ??? some intrinsics should also be considered as pure. all of them ?
66  */
68 { return gen_in_list_p(f, the_pures_object);}
69 
70 /********************************************************************** IOS */
71 
72 GENERIC_STATIC_STATUS(static, the_ios, list, NIL, gen_free_list)
73 
75 { the_ios_object = gen_once(f, the_ios_object);}
76 
78 { return gen_in_list_p(f, the_ios_object);}
79 
80 /******************************************************************** FAKES */
81 
82 /* ??? to be added to HPFC_STATUS
83  */
84 /* GENERIC_STATIC_STATUS(static, the_fakes, list, NIL, gen_free_list) */
85 
87 
90 
92 { return gen_in_list_p(f, the_fakes_object);}
93 
94 
95 /*************************************************************** REMAPPINGS */
96 
97 /* list of already computed remappings...
98  */
99 GENERIC_STATIC_STATUS(static, computed_remaps, list, NIL, gen_free_list)
100 
101 /* exported interface
102  */
103 
104 bool
106 {
107  entity src = renaming_old(x), trg = renaming_new(x);
108 
109  MAP(REMAPPING, r,
110  {
112  if (renaming_old(p)==src && renaming_new(p)==trg)
113  return true;
114  },
115  get_computed_remaps());
116 
117  return false;
118 }
119 
120 void
122  renaming r, /* old -> new remapping */
123  list /* of entity */ vars) /* variables to be declared */
124 {
125  computed_remaps_object = CONS(REMAPPING,
127  computed_remaps_object);
128 }
129 
130 /***************************************************** ENTITIES IN INCLUDES */
131 
132 GENERIC_STATIC_STATUS(static, include_entities, list, NIL, gen_free_list)
133 
134 void
136 {
137  entity src = renaming_old(x), trg = renaming_new(x);
139 
140  MAP(REMAPPING, r,
141  {
143 
144  if (renaming_old(y)==src && renaming_new(y)==trg)
145  {
146  p = r;
147  break;
148  }
149  },
150  get_computed_remaps());
151 
152  pips_assert("defined remapping", !remapping_undefined_p(p));
153 
154  MAP(ENTITY, e,
155  include_entities_object = gen_once(e, include_entities_object),
157 }
158 
159 /*********************************************** COMPILER STATUS MANAGEMENT */
160 
161 /* ??? some memory leaks in the hpfc_status management...
162  */
163 
164 static hpfc_status chs = (hpfc_status) NULL; /* current hpfc status */
165 
166 /* initialization of data that belongs to the hpf compiler status
167  */
168 static void init_hpfc_status()
169 {
174  init_the_commons();
176  init_the_pures();
177  init_the_ios();
178  init_computed_remaps();
180 
182  get_data_status(),
185  get_the_commons(),
187  get_the_pures(),
188  get_the_ios(),
189  get_computed_remaps(),
191 }
192 
193 static void reset_hpfc_status()
194 {
199  reset_the_commons();
201  reset_the_pures();
202  reset_the_ios();
203  reset_computed_remaps();
205 
206  chs = (hpfc_status) NULL;
207 }
208 
209 static void save_hpfc_status() /* GET them */
210 {
211  pips_assert("some current hpfc status", chs);
212 
217  hpfc_status_commons(chs) = get_the_commons() ;
219  hpfc_status_pures(chs) = get_the_pures();
220  hpfc_status_ios(chs) = get_the_ios();
221  hpfc_status_computed(chs) = get_computed_remaps();
223 
224  DB_PUT_MEMORY_RESOURCE(DBR_HPFC_STATUS, "", chs);
225 
226  reset_hpfc_status(); /* cleaned! */
227 }
228 
229 static void load_hpfc_status() /* SET them */
230 {
231  chs = (hpfc_status) db_get_memory_resource(DBR_HPFC_STATUS, "", true);
232 
237  set_the_commons(hpfc_status_commons(chs));
239  set_the_pures(hpfc_status_pures(chs));
240  set_the_ios(hpfc_status_ios(chs));
241  set_computed_remaps(hpfc_status_computed(chs));
243 }
244 
245 #if 0
246 /* never called... memory to be freed by pipsdbm...
247  */
248 static void close_hpfc_status()
249 {
250  __attribute__((unused)) intptr_t i = (intptr_t) close_hpfc_status ;
251 
256  close_the_commons();
258  close_the_pures();
259  close_the_ios();
260  close_computed_remaps();
262 }
263 #endif
264 
265 static void hpfc_error_handler(void)
266 {
267  /* An error_reset_hpfc_status() would be necessary */
268  /* reset_hpfc_status(); */
274 }
275 
276 /************************************************************** COMPILATION */
277 
279 {
280  store_new_host_variable(host, old);
282 }
283 
285 {
286  const char* module_name = module_local_name(module);
287 
288  // STATEMENT
290  ((statement) db_get_memory_resource(DBR_CODE, module_name, false));
291 
292  // PRECONDITIONS
295  db_get_memory_resource(DBR_PRECONDITIONS, module_name, true));
296 
297  // POSTCONDITIONS
302 
303  // REGIONS
306  db_get_memory_resource(DBR_REGIONS, module_name, true));
307 
308  // IN & OUT Regions are not always used
309  if (!get_bool_property("HPFC_IGNORE_IN_OUT_REGIONS"))
310  {
311  set_out_effects((statement_effects) // OUT EFFECTS
312  db_get_memory_resource(DBR_OUT_EFFECTS, module_name, true));
313  set_in_effects((statement_effects) // IN EFFECTS
314  db_get_memory_resource(DBR_IN_EFFECTS, module_name, true));
315 
316  /* set_bool_property("MUST_REGIONS", true);
317  set_bool_property("EXACT_REGIONS", true);
318  get_regions_properties();
319  set_out_effects
320  ((statement_effects)
321  db_get_memory_resource(DBR_OUT_REGIONS, module_name, true));
322  set_in_effects
323  ((statement_effects)
324  db_get_memory_resource(DBR_IN_REGIONS, module_name, true));*/
325  }
326 
327  // CUMMULATED REFERENCES
330  db_get_memory_resource(DBR_CUMULATED_REFERENCES, module_name, true));
331 
332  // ONLY I/O
334 
335  // NEW VARIABLES NEEDED
337 
338  // OTHERS
340  init_include_entities();
341 
342  // next in hpfc_init ???
344 
345  // STOP is to be translated into hpfc_{host,node}_end. the special FCD calls.
364 }
365 
366 static void
368 {
373 
376 
378  close_include_entities();
379 
380  // IN & OUT Regions are not always used
381  if (!get_bool_property("HPFC_IGNORE_IN_OUT_REGIONS"))
382  {
385  }
386 }
387 
388 /* removes DOALL ???
389  */
390 static void loop_rwt(loop l)
391 {
393 }
394 
395 static void clean_the_code(statement s)
396 {
398 }
399 
400 /* ??? some quick hack to move bound computations ahead if possible
401  */
402 static list /* of statement */ added_ahead_of_node_code;
403 
405 {
407 }
408 
409 static void
411 {
412  statement s, host_stat, node_stat;
413 
414  /* INIT
415  */
421 
422  /* NORMALIZATIONS
423  */
426 
427  /* here because the module was updated with some external declarations
428  */
430 
431  /* ACTUAL COMPILATION
432  */
433  hpf_compiler(s, &host_stat, &node_stat);
435  node_stat = make_block_statement
437  CONS(STATEMENT, node_stat, NIL)));
438 
439  clean_the_code(host_stat);
440  clean_the_code(node_stat);
441 
443  add_pvm_init_and_end(&host_stat, &node_stat);
444 
445  /* DECLARATIONS
446  */
448 
450 
453 
456 
459 
460  /* SG: we need to add included entites into node_module declaration
461  * but only if they are not already present
462  * see how beautiful the list usage is, a O(n^2) algorithm !
463  */
464  list included_entities_to_add = NIL;
465  FOREACH(ENTITY,e,get_include_entities())
468  included_entities_to_add = CONS(ENTITY,e,included_entities_to_add);
470  gen_nconc(entity_declarations(node_module),included_entities_to_add);
471 
472  /* MORE CODE CLEANING
473  */
476 
479 
480  /* PUT IN DB
481  */
482  put_generated_resources_for_module(s, host_stat, node_stat);
483 
484  /* CLOSE
485  */
489 }
490 
491 /********************************************* FUNCTIONS CALLED BY PIPSMAKE */
492 
493 /* bool hpfc_init(string name)
494  *
495  * what: initialize the hpfc status for a program.
496  * input: the program (workspace) name.
497  * output: none.
498  * side effects:
499  * - the hpfc status is initialized and stored in the pips dbm.
500  * bugs or features:
501  * - some callees are filtered out with a property, to deal with pipsmake.
502  */
503 bool hpfc_init(const string name)
504 {
505  debug_on("HPFC_DEBUG_LEVEL");
506  pips_debug(1, "considering program %s\n", name);
507 
509 
510  set_string_property("PRETTYPRINT_VARIABLE_DIMENSIONS", "common");
511  set_bool_property("PRETTYPRINT_HPFC", true); /* vars local to commons */
512  set_bool_property("HPFC_FILTER_CALLEES", true); /* drop hpfc specials */
513  set_bool_property("GLOBAL_EFFECTS_TRANSLATION", false);
514  set_bool_property("WARNING_ON_STAT_ERROR", false); // for fake files
515 
516  // should not be there. if true, obscure coredump in proper
517  // effects on a preference which has been cleanup up...
518  // see validation/Hpfc/io_4.tpips that triggers the issue
519  set_bool_property("PRETTYPRINT_IO_EFFECTS", false); // ??????
520 
521  // too verbose...
522  set_bool_property("UNSPAGHETTIFY_DISPLAY_STATISTICS", false);
523  set_bool_property("CLEAN_UP_SEQUENCES_DISPLAY_STATISTICS", false);
524  set_bool_property("WARN_ABOUT_EMPTY_SEQUENCES", false);
525 
526  // where the specials dummy/variables are stored... ???
528 
529  // mkdir...
530  {
532  free(dir_name);
533  }
534 
537 
539  debug_off();
540  return true;
541 }
542 
543 /* bool hpfc_filter(string name)
544  *
545  * what: filter the source code for module name. to be called by pipsmake.
546  * how: call to a shell script, "hpfc_directives", that transforms
547  * hpf directives in "special" subroutine calls to be parsed by
548  * the fortran 77 parser.
549  * input: the module name.
550  * output: none.
551  * side effects:
552  * - a new source code file is created for module name.
553  * - the old one is saved...
554  * bugs or features:
555  * - ??? not all hpf syntaxes are managable this way.
556  */
557 #define HPFC_FILTERED_SUFFIX ".hpfc_filtered"
558 
559 static bool directive_in_file_p(string name)
560 {
561  FILE * f;
562  bool no_directive;
563  char c;
564 
565  /* checks for any directive before calling the filter...
566  * looks for /^[!Cc*]([Hh][Pp][Ff]|[Ff][Cc][Ff])$/
567  */
568  f = safe_fopen(name, "r");
569  c='\n';
570  no_directive = true;
571  while (!feof(f) && no_directive)
572  {
573  if (c=='\n') /* beginning a line */
574  {
575  c = getc(f);
576  if (c=='!' || c=='C' || c=='c' || c=='*') /* starting a comment */
577  {
578  c = getc(f); if (c=='\n') continue;
579  c = getc(f); if (c=='\n') continue;
580  c = getc(f); if (c=='\n') continue;
581  c = getc(f); if (c=='$') no_directive = false;
582  }
583  }
584  else /* next char */
585  c = getc(f);
586  }
587  safe_fclose(f, name);
588 
589  pips_debug(1, "directive for %s: %s\n", name, no_directive? "NO": "YES");
590 
591  return !no_directive;
592 }
593 
594 bool hpfc_filter(const string name)
595 {
596  string file_name, dir_name, new_name, src_name;
597 
599  file_name = db_get_file_resource(DBR_SOURCE_FILE, name, true);
600  new_name = strdup(concatenate(name, HPFC_FILTERED_SUFFIX, NULL));
601  src_name = strdup(concatenate(dir_name, "/", file_name, NULL));
602 
603  debug_on("HPFC_DEBUG_LEVEL");
604  pips_debug(1, "considering module %s\n", name);
606 
608  "PATH=${PATH}:${PIPS_ROOT}/Share ",
609  hpf_directive_string_p(name) || !directive_in_file_p(src_name)?
610  "cat" : "hpfc_directives",
611  " < ", src_name, " > ", dir_name, "/", new_name, NULL));
612 
613  DB_PUT_FILE_RESOURCE(DBR_HPFC_FILTERED_FILE, name, new_name);
614 
615  free(src_name);
616 
618  debug_off();
619  return true;
620 }
621 
622 /* what: deals with directives. to be called by pipsmake.
623  * input: the name of the module.
624  * output: none.
625  * side effects: (many)
626  * - the module's code statement will be modified.
627  * - the hpf mappings and so are stored in the compiler status.
628  * bugs or features:
629  * - fortran library, reduction and hpfc special functions are skipped.
630  * - ??? obscure problem with the update of common entities.
631  */
632 static bool hpfc_directives_handler(string name, bool dyn)
633 {
635 
636  debug_on("HPFC_DEBUG_LEVEL");
637  pips_debug(1, "considering module %s\n", name);
638  debug_on("HPFC_DIRECTIVES_DEBUG_LEVEL");
640 
644  {
645  statement s = (statement) db_get_memory_resource(DBR_CODE, name, true);
646 
647  if (dyn)
649  db_get_memory_resource(DBR_PROPER_EFFECTS, name, true));
650 
656 
657  if (!dyn) NormalizeCommonVariables(module, s);
658  handle_hpf_directives(s, dyn); // do the job...
659 
664 
665  if (dyn) reset_proper_rw_effects();
666 
667  DB_PUT_MEMORY_RESOURCE(DBR_CODE, name, s);
668  }
669 
671  debug_off();
672  debug_off();
673  return true;
674 }
675 
676 bool hpfc_static_directives(const string name)
677 {
678  return hpfc_directives_handler(name, false);
679 }
680 
681 bool hpfc_dynamic_directives(const string name)
682 {
683  return hpfc_directives_handler(name, true);
684 }
685 
686 
687 /* bool hpfc_compile(string name)
688  *
689  * what: hpf compile module name. to be called by pipsmake.
690  * input: the name of the module to compile.
691  * output: none
692  * side effects: (many)
693  * - creates the statements for the host and nodes.
694  * - store the generated resources.
695  * bugs or features:
696  * - fortran library, reduction and hpfc special functions are skipped.
697  * - a fake file is put as the generated resource for such modules.
698  */
699 bool hpfc_compile(const string name)
700 {
702  bool do_compile;
703 
704  debug_on("HPFC_DEBUG_LEVEL");
705  pips_debug(1, "considering module %s\n", name);
707 
710 
711  do_compile =
716 
717  if (do_compile)
718  {
719  set_string_property("PRETTYPRINT_COMMONS", "none");
720 
721  if (hpfc_special_io(module))
723  else if (hpf_pure_p(module))
725  else
727  }
728  else /* just fake for pipsmake... */
729  {
730  pips_debug(2, "skipping %s compilation\n", name);
731  DB_PUT_FILE_RESOURCE(DBR_HPFC_PARAMETERS, name, NO_FILE);
732  DB_PUT_FILE_RESOURCE(DBR_HPFC_HOST, name, NO_FILE);
733  DB_PUT_FILE_RESOURCE(DBR_HPFC_NODE, name, NO_FILE);
734  DB_PUT_FILE_RESOURCE(DBR_HPFC_RTINIT, name, NO_FILE);
735  }
736 
737  /* for callers */
738  if (hpfc_special_io(module))
739  {
742  }
743  else if (hpf_pure_p(module))
744  {
747  }
748 
751 
753  debug_off();
754  return true;
755 }
756 
757 /* bool hpfc_common(string name)
758  *
759  * what: compile a common, that is generate the common for both host and nodes.
760  * how: generate files to be included.
761  * input: a common name.
762  * output: none.
763  * side effects:
764  * - uses the hpfc_status.
765  * - generates 4 files.
766  * bugs or features:
767  * - never called by pipsmake (:-)
768  */
769 bool hpfc_common(const string name)
770 {
771  debug_on("HPFC_DEBUG_LEVEL");
772  pips_debug(1, "considering common %s\n", name);
774 
776 
777  set_string_property("PRETTYPRINT_COMMONS", "declaration");
779 
781 
783  debug_off();
784  return true;
785 }
786 
787 /* bool hpfc_close(string name)
788  *
789  * what: closes the hpf compiler execution. to be called by pipsmake.
790  * input: the program (workspace) name.
791  * output: none.
792  * side effects:
793  * - deals with the commons.
794  * - generates global files.
795  * bugs or features:
796  * - ??? COMMON should be managable thru pipsmake ad-hoc rules.
797  */
798 bool hpfc_close(const string name)
799 {
800  debug_on("HPFC_DEBUG_LEVEL");
801  pips_debug(1, "considering program %s\n", name);
803 
805 
806  set_string_property("PRETTYPRINT_COMMONS", "declaration");
807  set_string_property("PIPSDBM_RESOURCES_TO_DELETE", "all");
808  gen_map((gen_iter_func_t)compile_common, get_the_commons());
809 
810  put_generated_resources_for_program(name); /* global informations */
811 
812  /* not close, because it would free the memory and
813  * pipsdbm will run into troubles when trying to free the resource...
814  */
816 
817  /* ??? the next function is in pipsmake... (should be in pipsdbm only,
818  * but pipsmake manages its own cache which must be destroyed also...
819  */
820  DB_PUT_FILE_RESOURCE(DBR_HPFC_COMMONS, name, NO_FILE); /* fake */
821 
823  debug_off();
824  return true;
825 }
826 
827 /* bool hpfc_install(string name)
828  *
829  * what: install generated files in a directory. done for wpips.
830  * how: all in the hpfc_install shell script.
831  * input: program name.
832  * output: none.
833  * side effects:
834  * - creates an hpfc directory in the database
835  * - copies the files in this directory...
836  * bugs or features:
837  */
838 bool hpfc_install(const string name)
839 {
840  string dir, wks;
841  debug_on("HPFC_DEBUG_LEVEL");
842  pips_debug(1, "considering program %s\n", name);
843 
846 
847  safe_system(concatenate("hpfc_install -iob ", dir, " -n ", wks, NULL));
848 
849  DB_PUT_FILE_RESOURCE(DBR_HPFC_INSTALLATION, name, NO_FILE);
850 
851  debug_off();
852  return true;
853 }
854 
855 /* bool hpfc_make(string name)
856  *
857  * what: compile the generated and installed code. for wpips.
858  * how: system call to $HPFC_MAKE
859  * input: the workspace name (which is not used)
860  * output: none.
861  * side effects: may stop if can't execute
862  * bugs or features:
863  */
864 bool hpfc_make(const string name)
865 {
866  string dir = db_get_current_workspace_directory();
867 
868  debug_on("HPFC_DEBUG_LEVEL");
869  pips_debug(1, "considering program %s\n", name);
870 
871  safe_system(concatenate("cd ", dir, "/hpfc ; "
872  "${HPFC_MAKE:-gmake} make &", NULL));
873 
874  debug_off();
875  return true;
876 }
877 
878 /* bool hpfc_run(string name)
879  *
880  * what: run the program.
881  * how: system call sut $HPFC_MAKE...
882  * input: none.
883  * output: none.
884  * side effects:
885  * - forks a process.
886  * - may stop if cannot execute.
887  * bugs or features:
888  */
889 bool hpfc_run(const string name)
890 {
891  string dir = db_get_current_workspace_directory();
892 
893  debug_on("HPFC_DEBUG_LEVEL");
894  pips_debug(1, "considering program %s\n", name);
895 
896  safe_system(concatenate("cd ", dir, "/hpfc ; "
897  "${HPFC_MAKE:-gmake} run &", NULL));
898 
899  debug_off();
900  return true;
901 }
902 
903 /* that is all
904  */
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
static void node(FILE *out, string name)
Build for module name a node and link to its successors.
Definition: graph.c:56
renaming copy_renaming(renaming p)
RENAMING.
Definition: hpf_private.c:845
hpfc_status make_hpfc_status(overlapsmap a1, data_status a2, numbers_status a3, entity_status a4, list a5, dynamic_status a6, list a7, list a8, list a9, statement_entities a10)
Definition: hpf_private.c:490
remapping make_remapping(renaming a1, list a2)
Definition: hpf_private.c:839
language make_language_fortran(void)
Definition: ri.c:1250
void hpfc_close_dummy_to_prime()
Definition: build-system.c:168
void free_hpfc_current_mappings()
Definition: build-system.c:200
void make_hpfc_current_mappings()
??? used with a temporary hack to differentiate array and templates
Definition: build-system.c:192
void hpfc_init_dummy_to_prime()
Definition: build-system.c:155
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void hpf_compiler(statement stat, statement *hoststatp, statement *nodestatp)
what: compile a statement into a host and SPMD node code.
Definition: compiler.c:710
entity host_module
HPFC - Fabien Coelho, May 1993 and later...
Definition: compiler.c:47
entity node_module
Definition: compiler.c:47
void close_dynamic_status()
Definition: dynamic.c:117
void set_dynamic_status(dynamic_status d)
Definition: dynamic.c:108
void set_similar_mappings_for_updates(void)
Definition: dynamic.c:162
void init_dynamic_status()
DYNAMIC STATUS management.
Definition: dynamic.c:81
void reset_dynamic_status()
Definition: dynamic.c:90
dynamic_status get_dynamic_status()
Definition: dynamic.c:99
void set_rw_effects(statement_effects)
void reset_cumulated_references(void)
void reset_out_effects(void)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_out_effects(statement_effects)
void set_cumulated_references(statement_effects)
void set_in_effects(statement_effects)
void reset_in_effects(void)
void reset_rw_effects(void)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_chunk_undefined_p(c)
Definition: genC.h:75
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
void free(void *)
statement make_block_statement(list)
Make a block statement from a list of statement.
Definition: statement.c:616
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
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
void gen_map(gen_iter_func_t fp, const list l)
Definition: list.c:172
list gen_once(const void *vo, list l)
Prepend an item to a list only if it is not already in the list.
Definition: list.c:722
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_free_list(list l)
free the spine of the list
Definition: list.c:327
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
Definition: list.c:734
#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_eq(const void *item, const list seq)
Definition: list.c:422
#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
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
void store_new_node_variable(entity new, entity old)
void update_object_for_module(void *obj, entity module)
entity_status get_entity_status()
void store_new_host_variable(entity new, entity old)
void set_entity_status(entity_status s)
void close_entity_status()
void init_entity_status()
void reset_entity_status()
#define hpfc_status_reductions(x)
Definition: hpf_private.h:640
#define remapping_undefined_p(x)
Definition: hpf_private.h:910
struct _newgen_struct_hpfc_status_ * hpfc_status
Definition: hpf_private.h:129
#define renaming_old(x)
Definition: hpf_private.h:969
#define hpfc_status_pures(x)
Definition: hpf_private.h:634
#define hpfc_status_ios(x)
Definition: hpf_private.h:636
#define REMAPPING(x)
REMAPPING.
Definition: hpf_private.h:903
#define hpfc_status_computed(x)
Definition: hpf_private.h:638
#define remapping_undefined
Definition: hpf_private.h:909
#define hpfc_status_numbers_status(x)
Definition: hpf_private.h:626
#define remapping_referenced(x)
Definition: hpf_private.h:935
#define hpfc_status_dynamic_status(x)
Definition: hpf_private.h:632
#define hpfc_status_entity_status(x)
Definition: hpf_private.h:628
#define hpfc_status_commons(x)
Definition: hpf_private.h:630
#define hpfc_status_overlapsmap(x)
Definition: hpf_private.h:622
#define hpfc_status_data_status(x)
Definition: hpf_private.h:624
#define renaming_new(x)
Definition: hpf_private.h:971
#define remapping_renaming(x)
Definition: hpf_private.h:933
#define HPFC_PACKAGE
local definitions
Definition: hpfc-local.h:27
void kill_statement_number_and_ordering(statement s)
Definition: hpfc-util.c:232
void hpfc_util_error_handler()
removes IF (.TRUE.) THEN and DO X=n, n
Definition: hpfc-util.c:785
void statement_structural_cleaning(statement s)
Definition: hpfc-util.c:847
void make_host_and_node_modules(entity module)
compile.c
Definition: compile.c:45
#define src(name, suf)
HPFC by Fabien Coelho, May 1993 and later...
Definition: compile.c:41
void NormalizeCodeForHpfc(statement s)
Definition: compile.c:848
void NormalizeCommonVariables(entity module, statement stat)
Definition: compile.c:940
void put_generated_resources_for_common(entity common)
Definition: compile.c:417
void init_host_and_node_entities()
both host and node modules are initialized with the same declarations than the compiled module,...
Definition: compile.c:246
void put_generated_resources_for_program(_UNUSED_ string program_name)
Definition: compile.c:567
void hpfc_compile_error_handler()
Definition: compile.c:644
void compile_a_special_io_function(entity module)
just copied for the host
Definition: compile.c:469
void put_generated_resources_for_module(_UNUSED_ statement stat, statement host_stat, statement node_stat)
Definition: compile.c:516
void compile_a_pure_function(entity module)
simply copied for both host and node...
Definition: compile.c:493
void reset_hpf_number_status()
Definition: declarations.c:142
void set_hpf_number_status(numbers_status s)
Definition: declarations.c:148
void close_hpf_number_status()
Definition: declarations.c:157
void reset_data_status()
Definition: declarations.c:320
numbers_status get_hpf_number_status()
Definition: declarations.c:134
void NormalizeHpfDeclarations()
Definition: declarations.c:437
void init_hpf_number_status()
STANDARS STATIC MANAGEMENT.
Definition: declarations.c:128
void declaration_with_overlaps_for_module(entity module)
Definition: declarations.c:835
void close_data_status()
Definition: declarations.c:339
data_status get_data_status()
Definition: declarations.c:308
void set_data_status(data_status s)
Definition: declarations.c:328
void init_data_status()
Definition: declarations.c:300
#define HOST_TIMEON
special FCD calls.
#define NODE_TIMEON
#define HPFC_STOP
#define HPFC_NTELL
#define SYNCHRO
#define NO_FILE
fake resources...
#define NODE_TIMEOFF
#define HOST_TIMEOFF
#define HPFC_HTELL
void hpfc_directives_error_handler()
the local stack is used to retrieve the current statement while scanning the AST with gen_recurse.
Definition: directives.c:109
void handle_hpf_directives(statement s, bool dyn)
void handle_hpf_directives(s) statement s;
Definition: directives.c:1069
bool hpfc_run(const string name)
bool hpfc_run(string name)
Definition: hpfc.c:889
static bool directive_in_file_p(string name)
Definition: hpfc.c:559
void add_an_io_function(entity f)
Definition: hpfc.c:74
bool hpfc_close(const string name)
bool hpfc_close(string name)
Definition: hpfc.c:798
static void save_hpfc_status()
GET them.
Definition: hpfc.c:209
static void compile_common(entity c)
Definition: hpfc.c:51
static hpfc_status chs
??? some memory leaks in the hpfc_status management...
Definition: hpfc.c:164
static bool hpfc_directives_handler(string name, bool dyn)
what: deals with directives.
Definition: hpfc.c:632
void add_remapping_as_computed(renaming r, list vars)
variables to be declared
Definition: hpfc.c:121
static void automatic_translation(entity old, entity host, entity node)
Definition: hpfc.c:278
bool hpfc_make(const string name)
bool hpfc_make(string name)
Definition: hpfc.c:864
static void clean_the_code(statement s)
Definition: hpfc.c:395
bool hpfc_special_fake(entity f)
Definition: hpfc.c:91
static void reset_hpfc_status()
Definition: hpfc.c:193
void add_remapping_as_used(renaming x)
Definition: hpfc.c:135
static list the_fakes_object
??? to be added to HPFC_STATUS
Definition: hpfc.c:86
bool hpfc_dynamic_directives(const string name)
Definition: hpfc.c:681
static void compile_module(entity module)
Definition: hpfc.c:410
void add_a_common(entity c)
HPFC module by Fabien COELHO.
Definition: hpfc.c:48
static void loop_rwt(loop l)
removes DOALL ???
Definition: hpfc.c:390
static list added_ahead_of_node_code
??? some quick hack to move bound computations ahead if possible
Definition: hpfc.c:402
bool hpfc_compile(const string name)
bool hpfc_compile(string name)
Definition: hpfc.c:699
bool hpfc_install(const string name)
bool hpfc_install(string name)
Definition: hpfc.c:838
static void hpfc_error_handler(void)
Definition: hpfc.c:265
bool hpfc_common(const string name)
bool hpfc_common(string name)
Definition: hpfc.c:769
bool hpfc_init(const string name)
bool hpfc_init(string name)
Definition: hpfc.c:503
bool hpf_pure_p(entity f)
??? some intrinsics should also be considered as pure.
Definition: hpfc.c:67
bool hpfc_filter(const string name)
Definition: hpfc.c:594
static void load_hpfc_status()
SET them.
Definition: hpfc.c:229
void add_a_pure(entity f)
Definition: hpfc.c:62
static void set_resources_for_module(entity module)
Definition: hpfc.c:284
bool hpfc_special_io(entity f)
Definition: hpfc.c:77
static void init_hpfc_status()
current hpfc status
Definition: hpfc.c:168
void add_a_fake_function(entity f)
Definition: hpfc.c:88
#define HPFC_FILTERED_SUFFIX
bool hpfc_filter(string name)
Definition: hpfc.c:557
void hpfc_add_ahead_of_node_code(statement s)
Definition: hpfc.c:404
bool remapping_already_computed_p(renaming x)
list of already computed remappings...
Definition: hpfc.c:105
static void reset_resources_for_module()
Definition: hpfc.c:367
bool hpfc_static_directives(const string name)
Definition: hpfc.c:676
bool fortran_library_entity_p(entity)
Definition: local-ri-util.c:52
entity hpfc_name_to_entity(const char *)
Definition: run-time.c:817
void init_overlap_status(void)
void reset_overlap_status(void)
void init_hpf_reductions(void)
void hpfc_special_cases_error_handler(void)
void close_overlap_status(void)
void set_overlap_status(overlapsmap)
void reset_hpf_reductions(void)
void close_hpf_reductions(void)
void hpfc_init_run_time_entities(void)
to be seen from outside of this file
Definition: run-time.c:751
void free_update_common_map(void)
statement_entities get_hpf_reductions(void)
void set_hpf_reductions(statement_entities)
void free_only_io_map(void)
overlapsmap get_overlap_status(void)
void add_pvm_init_and_end(statement *, statement *)
this is for the main.
Definition: run-time.c:364
void make_update_common_map(void)
void hpfc_io_util_error_handler(void)
??? neglect expression side effects...
Definition: io-util.c:82
void only_io_mapping_initialize(statement)
Definition: io-util.c:163
bool hpfc_entity_reduction_p(entity)
special_cases.c
Definition: special_cases.c:82
string db_get_directory_name_for_module(const char *name)
returns the allocated and mkdir'ed directory for module name
Definition: lowlevel.c:150
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define debug_off()
Definition: misc-local.h:160
void safe_system(string)
system.c
Definition: system.c:38
void reset_hooks_unregister(reset_func_t)
remove registered cleanup hook.
Definition: reset_hooks.c:73
void reset_hooks_register(reset_func_t)
reset_hooks.c
Definition: reset_hooks.c:44
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define GENERIC_GLOBAL_FUNCTION(name, type)
#define GENERIC_STATIC_STATUS(PREFIX, name, type, init, cloze)
void(* gen_iter_func_t)(void *)
Definition: newgen_types.h:116
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
static char * module
Definition: pips.c:74
#define db_get_file_resource
#define WORKSPACE_SRC_SPACE
Definition: pipsdbm-local.h:32
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
string db_get_current_workspace_name(void)
the function is used to check that there is some current workspace...
Definition: workspace.c:82
statement_mapping compute_postcondition(statement stat, statement_mapping post_map, statement_mapping pre_map)
statement_mapping compute_postcondition(stat, post_map, pre_map) statement stat; statement_mapping po...
void set_bool_property(const char *, bool)
void set_string_property(const char *, const char *)
#define HPF_PREFIX
moved here because needed by syntax:-(
#define TIMEON_SUFFIX
#define SYNCHRO_SUFFIX
#define HOSTSECTION_SUFFIX
#define entity_declarations(e)
MISC: newgen shorthands.
#define CONTINUE_FUNCTION_NAME
#define TIMEOFF_SUFFIX
#define TELL_SUFFIX
suffixes for my own (FCD:-) directives.
#define STOP_FUNCTION_NAME
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_program(const char *name, language l)
Definition: entity.c:261
code entity_code(entity e)
Definition: entity.c:1098
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
bool entity_main_module_p(entity e)
Definition: entity.c:700
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
bool hpf_directive_string_p(const char *s)
recognize an hpf directive special entity.
Definition: hpfc.c:51
bool hpf_directive_entity_p(entity e)
Definition: hpfc.c:56
void reset_unique_variable_numbers(void)
Definition: variable.c:421
#define execution_tag(x)
Definition: ri.h:1207
#define loop_execution(x)
Definition: ri.h:1648
#define loop_domain
newgen_language_domain_defined
Definition: ri.h:218
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
@ is_execution_sequential
Definition: ri.h:1189
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
char * strdup()
void free_postcondition_map(void)
void reset_precondition_map(void)
void set_postcondition_map(statement_mapping)
void set_precondition_map(statement_mapping)
statement_mapping get_precondition_map(void)
static char * x
Definition: split_file.c:159
#define intptr_t
Definition: stdint.in.h:294
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
void entity_clean_declarations(entity, statement)
remove all entities declared in module but never used in s
Definition: util.c:177
static string file_name