PIPS
dbm_interface.c
Go to the documentation of this file.
1 /*
2 
3  $Id: dbm_interface.c 23412 2017-08-09 15:07:09Z irigoin $
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  /* Interface between the untyped database manager and clean code and
28  * between pipsmake and clean code.
29  *
30  * There are other interface routines in prettyprint.c
31  *
32  * The top routines should be called by the PIPS make utility. They might
33  * eventually be integrated into it.
34  *
35  * The lower level routines are dealing with "statement_mapping"s. They
36  * might have to be updated when mappings are integrated into NewGen.
37  * At that time, the whole file should disappear in a typed pipsmake.
38  *
39  * Francois Irigoin, August 1990
40  */
41 
42  /* the lowest level routines dealing with "statement_mapping"s are now
43  * generated by a macro defined in mapping.h : DEFINE_CURRENT_MAPPING.
44  * see this file for more details.
45  *
46  * Be'atrice Apvrille, August 1993
47  */
48 
49 #include <stdio.h>
50 #include <string.h>
51 
52 #include "genC.h"
53 #include "database.h"
54 
55 #include "resources.h"
56 #include "linear.h"
57 #include "ri.h"
58 #include "effects.h"
59 #include "ri-util.h"
60 #include "workspace-util.h"
61 #include "effects-util.h"
62 #include "pipsdbm.h"
63 #include "effects-generic.h"
64 #include "effects-simple.h"
65 #include "control.h"
66 
67 #include "misc.h"
68 
69 #include "transformer.h"
70 /* FC 2015-07-21: redundant declarations to help with include cycle issues
71  * there are expected in "transformer.h"
72  */
77 
78 #include "semantics.h"
79 
80 #include "properties.h"
81 #include "preprocessor.h"
82 
83 /* three mappings used throughout semantics analysis:
84  * - transformer_map is computed in a first phase
85  * - precondition_map is computed in a second phase
86  * - cumulated_effects is used and assumed computed before (defined in effects.c)
87  * - proper_effects might be useless... only DO loop analysis could use it (idem)
88  */
89 
90 
91 /* declaration of the previously described mappings with their access functions :
92  *
93  * (DEFINE_CURRENT_MAPPING is a macro defined in ~pips/Newgen/mapping.h)
94  *
95  * BA, August 26, 1993
96  */
97 
100 DEFINE_CURRENT_MAPPING(total_precondition, transformer)
101 
102 /* Returns the entry to exit transformer associated to a statement,
103  * since all statements in PIPS internal representation have a unique
104  * exit.
105  *
106  * The transformers associated to loops are the transformers linking
107  * the loop precondition to the loop body precondition. When dealing
108  * with sequences or test or... the transformer linking the loop
109  * precondition to its postcondition, i.e. the precondition hodling
110  * at the loop exit, is needed.
111  *
112  * To complete the statement transformer, a precondition is
113  * required. Different preconditions can be used:
114  *
115  * - transformer_identity(): provides no information
116  *
117  * - load_statement_precondition(): provides as much information as
118  * possible
119  *
120  * - the transformer domain: provides information available when the
121  * transformers are computed, i.e. preconditions do not have to be
122  * available; this is unsafe as the loop entrance transition domain
123  * may be a subset of the precocndition, unless the loop is always
124  * entered.
125  *
126  * Unlike load_statement_transformer(), this function allocates a new
127  * transformer. See comments associated to:
128  *
129  * generic_complete_statement_transformer()
130  */
132 {
134 
135  // Unsafe if s is a loop, unless you check that the loop is always
136  //entered
137  //transformer pre = transformer_to_domain(t);
139 
141 
142  //pips_assert("te is defined", !transformer_undefined_p(te));
143 
144  free_transformer(pre);
145 
146  return te;
147 }
148 
149 ␌
151 {
153  const char* fp_name = get_string_property("SEMANTICS_FIX_POINT_OPERATOR");
154  if(strcmp(fp_name, "transfer")==0) {
156  }
157  else if(strcmp(fp_name, "pattern")==0) {
159  }
160  else if(strcmp(fp_name, "derivative")==0) {
162  }
163  else {
164  user_error("select_fix_point_operator", "Unknown value %s for property %s\n",
165  fp_name, "SEMANTICS_FIX_POINT_OPERATOR");
166  }
167  }
168  else {
170  }
171  /* This fix-point is not debugged nor used */
172  /*
173  if(pips_flag_p(SEMANTICS_INEQUALITY_INVARIANT)) {
174  tf = transformer_halbwachs_fix_point(tfb);
175  }
176  */
177 }
178 ␌
180  list dl,
181  bool precondition_p)
182 {
185  language l = code_language(c);
186 
187  FOREACH(ENTITY, v, dl) {
188  type t = entity_type(v);
189 
190  if(type_variable_p(t)) {
191  variable tv = type_variable(t);
192 
196 
198  Pvecteur vl = normalized_linear(nl);
199  Pvecteur vu = normalized_linear(nu);
200 
203  Pvecteur cv = vect_substract(vl, vu);
204 
205  if(language_c_p(l))
207 
208  if(!precondition_p) {
209  upwards_vect_rename(cv, pre);
210  }
211 
212  if(!vect_constant_p(cv) || vect_coeff(TCST, cv) > 0) {
214  }
215  }
216  }
217  }
218 
219  }
220  }
221 }
222 
223 static void add_declaration_information(transformer pre, entity m, bool precondition_p)
224 {
225  //list decls = code_declarations(value_code(entity_initial(m)));
227 
228  ifdebug(8) {
229  pips_debug(8, "Begin for module %s with precondition\n", module_local_name(m));
230  print_transformer(pre);
231  }
232 
233  add_declaration_list_information(pre, decls, precondition_p);
234 
235  ifdebug(8) {
236  pips_debug(8, "End for module %s with precondition\n", module_local_name(m));
237  print_transformer(pre);
238  }
239 
240 }
241 
243 {
244  add_declaration_information(pre, m, false);
245 }
246 
248 {
249  add_declaration_information(pre, m, true);
250 }
251 ␌
252 /* Functions to make transformers */
253 
255 {
259  bool result = true;
260 
261  /* Set properties as required for a very fast semantics analysis */
262  if(si) {
263  pips_user_warning("Property SEMANTICS_INTERPROCEDURAL is ignored\n");
265  }
266  if(!sfs) {
267  pips_user_warning("Property SEMANTICS_FLOW_SENSITIVE is ignored\n");
269  }
270  if(sfp) {
271  pips_user_warning("Property SEMANTICS_FIX_POINT is ignored\n");
273  }
274  /* No need to select a fix point operator given the above property, but just in case... */
276 
278  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
279 
280  if(get_bool_property("SEMANTICS_COMPUTE_TRANSFORMERS_IN_CONTEXT")) {
281  pips_user_warning("If you really want to set property "
282  "SEMANTICS_COMPUTE_TRANSFORMERS_IN_CONTEXT, "
283  "you should activate TRANSFORMERS_INTER_FULL\n");
284  }
285 
287 
288  /* Restaure initial values of modified properties */
289  if(si)
291  if(!sfs)
293  if(sfp)
295 
296  return result;
297 }
298 
300 {
306  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
308 }
309 
311 {
317  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
319 }
320 
322 {
328  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
330 }
331 
333 {
339  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
341  db_get_memory_resource(DBR_POINTS_TO, module_name, true) );
344 
345  return result;
346 }
347 
348 /* Transformer recomputation cannot be of real use unless an
349  interprocedural analysis is performed. For intraprocedural analyses,
350  using property SEMANTICS_COMPUTE_TRANSFORMERS_IN_CONTEXT is
351  sufficient. */
353 
355 {
356  bool res;
362  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
363  refine_transformers_p = true;
365  refine_transformers_p = false;
366  return res;
367 }
368 
370 {
371  bool res;
377  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
379  db_get_memory_resource(DBR_POINTS_TO, module_name, true) );
380  refine_transformers_p = true;
382  refine_transformers_p = false;
384  return res;
385 }
386 
388 {
389  /* There is a choice: do nothing and leave the effective computation
390  in module_name_to_transformers, or move it here */
391  /* There is another choice: distinguish between inter- and
392  intra-procedural analyses at the summary level or in
393  module_name_to_transformers(). The choice does not have to be
394  consistent with the similar choice made for summary_precondition. */
395  pips_debug(1, "considering module %s\n", module_name);
396  return true;
397 }
398 ␌
400 {
401  /* nothing to do: transformers are preconditions for this
402  intraprocedural option */
403 
406  /* Maybe we should have an intra fast and an intra full as with other
407  semantics entries */
408  /* set_bool_property(SEMANTICS_FIX_POINT, false); */
413  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
415 }
416 
418 {
419  /* nothing to do: transformers are preconditions for this
420  intraprocedural option */
421 
424  /* Maybe we should have an intra fast and an intra full as with other
425  semantics entries */
426  /* set_bool_property(SEMANTICS_FIX_POINT, false); */
431  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
433 }
434 
436 {
443  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
445 }
446 
448 {
455  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
457 }
458 
460 {
467  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
469  db_get_memory_resource(DBR_POINTS_TO, module_name, true) );
470  bool result_p = module_name_to_preconditions(module_name);
472  return result_p;
473 }
474 ␌
476 {
483  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
485 }
486 
488 {
495  /* set_int_property(SEMANTICS_DEBUG_LEVEL, 0); */
497 }
498 
499 ␌
501 {
502  /* do not nothing because it has been computed by side effects;
503  * or provide an empty precondition for root modules;
504  * maybe a touch to look nicer?
505  */
506 
507  transformer t;
508 
510 
511  debug(8, "summary_precondition", "begin\n");
512 
513  if(db_resource_p(DBR_SUMMARY_PRECONDITION, module_name)) {
514  /* touch it */
515  t = (transformer) db_get_memory_resource(DBR_SUMMARY_PRECONDITION,
516  module_name,
517  true);
518  }
519  else {
520  t = transformer_identity();
521  }
522 
523  DB_PUT_MEMORY_RESOURCE(DBR_SUMMARY_PRECONDITION,
524  module_name, (char * )t);
525 
526  ifdebug(8) {
527  pips_debug(8, "initial summary precondition %p for %s:\n",
528  t, module_name);
529  dump_transformer(t);
530  pips_debug(8, "end\n");
531  }
532 
533  debug_off();
534 
535  return true;
536 }
537 
539 {
540  /* The current module is sufficient to derive it. */
543 }
544 
546 {
547  /* The DATA statement from all modules, called or not called, are used,
548  as well as the preconditions at all call sites. */
551 }
552 
553 static bool use_points_to_information_p = false;
554 
555 static void set_use_points_to()
556 {
558 }
559 
560 static void reset_use_points_to()
561 {
563 }
564 
566 {
568 }
569 
570 
572 {
573  /* The DATA statement from all modules, called or not called, are
574  * used, as well as the preconditions at all call sites. Points_to
575  * information is required to perform a more accurate translation
576  * between callesr and callees.
577  */
580  bool result_p = summary_precondition(module_name);
582  return result_p;
583 }
584 
585 /* Special case: main module
586  *
587  * Intraprocedural case: use the local DATA statement to define the initial store.
588  *
589  * Interprocedural case: use the program precondition
590  *
591  * */
592 
594 {
596 
599  db_get_memory_resource(DBR_PROGRAM_PRECONDITION, "", false));
600  if(transformer_empty_p(t)) {
602  "Initial preconditions are not consistent.\n"
603  " The Fortran standard rules about variable initialization"
604  " with DATA statements are likely to be violated.\n"
605  "set property PARSER_ACCEPT_ANSI_EXTENSIONS to false\n"
606  "and CHECK_FORTRAN_SYNTAX_BEFORE_PIPS to true.\n");
607  }
608  }
609  else {
610  /* Do we need to initialize the mappings before calling this subroutine? */
611  /* Why not use a DB_GET of DBR_INITIAL_PRECONDITION? */
612  /* t = data_to_precondition(callee); */
613  t = copy_transformer
614  ((transformer) db_get_memory_resource(DBR_INITIAL_PRECONDITION,
616  false));
617  }
618 
619  return t;
620 }
621 
622 /* Standard cases: called modules
623  *
624  * If a main is present, modules which are never called receive an
625  * unfeasible summary_precondition.
626  *
627  * If no main is present in the current workspace, modules which are never
628  * called receive an identity summary precondition, i.e. no information.
629  *
630  * If an interprocedural analysis is required, the preconditions of all
631  * call sites are translated and then unioned.
632  *
633  *
634  */
635 
637  entity callee)
638 {
640 
642  /* Look for all call sites in the callers
643  */
644  callees callers = (callees) db_get_memory_resource(DBR_CALLERS,
645  module_name,
646  true);
647  list lc = callees_callees(callers);
648 
649  ifdebug(1) {
650  pips_debug(1, "begin for %s with %zd callers\n",
651  module_name,
652  gen_length(lc));
653  FOREACH(STRING, caller_name, lc) {
654  (void) fprintf(stderr, "%s, ", caller_name);
655  }
656  (void) fprintf(stderr, "\n");
657  }
658 
660  // FI: it might be safer to make and free this stack in the loop
661  // body, once for each caller. The initialization is located in
662  // summary_preconditions()
663 
664  // make_statement_global_stack();
665 
669  }
670 
671  // free_statement_global_stack();
672 
673  if (ENDP(callees_callees(callers)) &&
674  some_main_entity_p()) {
675  /* no callers => empty precondition if a main is being analyzed
676  FC. 08/01/1999.
677  */
678  pips_user_warning("empty precondition to %s "
679  "because not in call tree from main.\n", module_name);
680  t = transformer_empty();
681  }
682  else if (transformer_undefined_p(t)) {
683  /* No main in the application? Do declare every module executed. */
684  t = transformer_identity();
685  }
686  else {
687  /* Try to eliminate (some) redundancy at a reasonnable cost. */
688  /* What is a reasonnable cost? */
689 
690  t = transformer_normalize(t, 2);
691  /* Level 7 core dumps with
692  * Semantics-New/summary_precondition04.c unless formal
693  * parameter "_c" is renamed... external_value_name is called
694  * when the value mapping hash-tables are not
695  * available. Validations of Semantics and Semantics-new are not
696  * improved by level 7 wrt level 2.
697  */
698  /* t = transformer_normalize(t, 7); */
699 
700  /* Corinne's best one... for YPENT2 in ARC2D, but be ready to pay
701  the price! And in case an overflow occurs, you may loose a lot of
702  accuracy without any control. */
703  /* t = transformer_normalize(t, 8); */
704 
705  /* No consistency check possible here because value_mappings are
706  not available */
707  /* pips_assert("The summary precondition is consistent",
708  transformer_consistency_p(t));*/
709  }
710  }
711  else {
712  /* Intraprocedural case */
713  t = transformer_identity();
714  }
715 
716  return t;
717 }
718 
720 {
721  /* transformer t = transformer_identity(); */
724 
726 
730 
733  }
734  else {
736  }
737 
738  /* Add declaration information: arrays cannot be empty (Fortran
739  * standard, Section 5.1.2)
740  *
741  * It does not seem to be a good idea for the semantics of
742  * SUMMARY_PRECONDITION. It seems better to have this information in the
743  * summary transformer as an input validity condition.
744  *
745  */
746  if(false && get_bool_property("SEMANTICS_TRUST_ARRAY_DECLARATIONS")) {
748  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
750  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
757  }
758 
759  pips_assert("t is defined", !transformer_undefined_p(t));
760 
761  /* Try to put the summary precondition in a (partially) canonical form. */
762  t = transformer_normalize(t, 4);
763  t = transformer_normalize(t, 4);
764 
765  ifdebug(3) {
766  pips_debug(1, "considering summary precondition for %s\n", module_name);
767  dump_transformer(t);
768  }
769 
770  DB_PUT_MEMORY_RESOURCE(DBR_SUMMARY_PRECONDITION,
771  module_name, (char * )t);
772 
773  ifdebug(1) {
774  pips_debug(1,
775  "initial summary precondition %p for %s (%d call sites):\n",
777  dump_transformer(t);
778  pips_debug(1, "end for module %s\n", module_name);
779  }
780 
784  debug_off();
785 
786  return true;
787 }
788 ␌
790 {
791  /* Look for all call sites in the callers
792  */
793  callees callers = (callees) db_get_memory_resource(DBR_CALLERS,
794  module_name,
795  true);
797  /* transformer t = transformer_identity(); */
799 
801 
802  pips_assert("Not implemented yet", false);
803 
805 
806  ifdebug(1) {
807  debug(1, "summary_precondition", "begin for %s with %d callers\n",
808  module_name,
809  gen_length(callees_callees(callers)));
811  (void) fprintf(stderr, "%s, ", caller_name);
812  }, callees_callees(callers));
813  (void) fprintf(stderr, "\n");
814  }
815 
817 
819  {
822  }, callees_callees(callers));
823 
824  if (!callees_callees(callers) &&
827  {
828  /* no callers => empty precondition (but the main).
829  FC. 08/01/1999.
830  */
831  pips_user_warning("empty precondition to %s "
832  "because not in call tree from main.\n", module_name);
833  t = transformer_empty();
834  } else if (transformer_undefined_p(t)) {
835  t = transformer_identity();
836  } else {
837  /* try to eliminate (some) redundancy at a reasonnable cost */
838  /* t = transformer_normalize(t, 2); */
839 
840  /* what cost? */
841  t = transformer_normalize(t, 7);
842  }
843 
844  /* Add declaration information: arrays cannot be empty (Fortran
845  * standard, Section 5.1.2)
846  *
847  * It does not seem to be a good idea for the semantics of
848  * SUMMARY_PRECONDITION. It seems better to have this information in the
849  * summary transformer as an input validity condition.
850  *
851  */
852  if(false && get_bool_property("SEMANTICS_TRUST_ARRAY_DECLARATIONS")) {
854  (statement) db_get_memory_resource(DBR_CODE, module_name, true));
856  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
858  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
866  }
867 
868  DB_PUT_MEMORY_RESOURCE(DBR_SUMMARY_TOTAL_POSTCONDITION,
869  module_name, (char * )t);
870 
871  ifdebug(1) {
872  pips_debug(1,
873  "summary total postcondition %p for %s (%d call sites):\n",
875  dump_transformer(t);
876  pips_debug(1, "end for module %s\n", module_name);
877  }
878 
880  debug_off();
881 
882  return true;
883 }
884 
886 {
887  /* there is a choice: do nothing and leave the effective computation
888  in module_name_to_total_preconditions or move it here */
889  pips_debug(1, "considering module %s\n", module_name);
890  return true;
891 }
892 
893 ␌
894 /* FI: Provisional management of warnings
895  *
896  * To avoid repetitive warnings.
897  *
898  * A hash table could be used to count warnings according to the
899  * function and line number in the C file.
900  */
901 static int wc = 0;
902 
904 {
905  wc = 0;
906 }
907 
909 {
910  return wc++==0;
911 }
912 
913 ␌
914 /* bool generic_module_name_to_transformers(char * module_name, bool in_context):
915  * compute a transformer for each statement of a module with a given
916  * name; compute also the global transformer for the module
917  */
918 bool generic_module_name_to_transformers(const char* module_name, bool in_context)
919 {
922  /* intraprocedural preconditions: proper declarations */
924  list e_inter;
925 
928 
929  /* This stack is useful to document warnings and to retrieve
930  points-to information. */
934  /* could be a gen_find_tabulated as well... */
936  (statement) db_get_memory_resource(DBR_CODE, module_name, true));
938  pips_internal_error("no statement for module %s", module_name);
939 
941  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
942 
944  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
945 
947 
948  /* cumulated_effects_map_print();*/
949 
950  e_inter = effects_to_list( (effects)
951  db_get_memory_resource(DBR_SUMMARY_EFFECTS, module_name, true));
952 
954 
955  /* compute the basis related to module m */
957 
958  /* In the main module, transformers can be computed in context of the
959  initial values */
961  && get_bool_property("SEMANTICS_COMPUTE_TRANSFORMERS_IN_CONTEXT"))
962  {
964  {
965  mod_pre = (transformer)
966  db_get_memory_resource(DBR_PROGRAM_PRECONDITION, "", false);
967  if(transformer_empty_p(mod_pre)) {
969  "Initial preconditions are not consistent.\n"
970  " The Fortran standard rules about variable initialization"
971  " with DATA statements are likely to be violated.\n"
972  "set property PARSER_ACCEPT_ANSI_EXTENSIONS to false\n"
973  "and CHECK_FORTRAN_SYNTAX_BEFORE_PIPS to true.\n");
974  }
975  }
976  else
978  }
979  else if(in_context) {
980  mod_pre =
982  }
983  else
984  mod_pre = transformer_identity();
985 
986  /* Add declaration information: arrays cannot be empty (Fortran
987  standard, Section 5.1.2) */
988  if(get_bool_property("SEMANTICS_TRUST_ARRAY_DECLARATIONS")) {
991  }
992 
993  /* Get the preconditions: they might prove useful within loops where
994  transformers cannot propagate enough information. */
995  if(in_context) {
997  db_get_memory_resource(DBR_PRECONDITIONS, module_name, true));
998  }
999 
1000  /* compute intraprocedural transformer */
1002  t_intra = statement_to_transformer(ms, mod_pre);
1003  free_transformer(mod_pre);
1004 
1005  DB_PUT_MEMORY_RESOURCE(DBR_TRANSFORMERS, module_name,
1006  (char*) get_transformer_map() );
1007 
1008  /* FI: side effect; compute and store the summary transformer, because
1009  every needed piece of data is available... */
1010 
1011  /* filter out local variables from the global intraprocedural effect */
1012  t_inter = transformer_intra_to_inter(t_intra, e_inter);
1013  t_inter = transformer_normalize(t_inter, 2);
1016  }
1017  if(!transformer_consistency_p(t_inter)) {
1018  (void) print_transformer(t_inter);
1019  pips_internal_error("Non-consistent summary transformer");
1020  }
1021  DB_PUT_MEMORY_RESOURCE(DBR_SUMMARY_TRANSFORMER,
1023  (char*) t_inter);
1024  pips_debug(8, "t_inter=%p\n", t_inter);
1025 
1028  /* Two auxiliary hash tables allocated by effectsmap_to_listmap() */
1033  if(in_context) reset_precondition_map();
1034 
1037 
1039  debug_off();
1040 
1041  return true;
1042 }
1043 ␌
1045 {
1046  bool rc = false;
1047  bool save_prop = get_bool_property("SEMANTICS_COMPUTE_TRANSFORMERS_IN_CONTEXT");
1048 
1049  if(!save_prop) {
1050  pips_user_warning("Although property SEMANTICS_COMPUTE_TRANSFORMERS_IN_CONTEXT"
1051  " is not set, it is used because it is necessary for this "
1052  "recomputation to be useful\n");
1053  set_bool_property("SEMANTICS_COMPUTE_TRANSFORMERS_IN_CONTEXT", true);
1054  }
1055 
1057 
1058  set_bool_property("SEMANTICS_COMPUTE_TRANSFORMERS_IN_CONTEXT", save_prop);
1059  return rc;
1060 }
1061 
1063 {
1064  bool rc = false;
1066  return rc;
1067 }
1068 ␌
1069 /* resource module_name_to_preconditions(char * module_name):
1070  * compute a transformer for each statement of a module with a given
1071  * name; compute also the global transformer for the module
1072  */
1074 {
1075  transformer t_inter;
1076  transformer pre;
1077  transformer post;
1078 
1079  /* set_debug_level(get_int_property(SEMANTICS_DEBUG_LEVEL)); */
1081  /* To provide information for warnings */
1084 
1086  /* could be a gen_find_tabulated as well... */
1088  (statement) db_get_memory_resource(DBR_CODE, module_name, true));
1090  pips_internal_error("no statement for module %s", module_name);
1091 
1092  /* Used to add reference information when it is trusted... which
1093  should always be, at least for automatic parallelization. */
1095  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
1096 
1097  /* cumulated effects are used to compute the value mappings */
1099  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
1100 
1102 
1104  db_get_memory_resource(DBR_TRANSFORMERS, module_name, true));
1105 
1106 
1107  /* p_inter is not used!!! FI, 9 February 1994 */
1108  /*
1109  if(get_bool_property(SEMANTICS_INTERPROCEDURAL)) {
1110  p_inter = (transformer)
1111  db_get_memory_resource(DBR_SUMMARY_PRECONDITION,
1112  module_name, true);
1113  }
1114  */
1115 
1116  t_inter = (transformer)
1117  db_get_memory_resource(DBR_SUMMARY_TRANSFORMER, module_name, true);
1118 
1119  /* debug_on(SEMANTICS_DEBUG_LEVEL); */
1120 
1122 
1123  /* compute the mappings related to module m, that is likely to be
1124  unavailable during interprocedural analysis; a module reference
1125  should be kept with the mappings to avoid useless recomputation,
1126  allocation and frees, including those due to the prettyprinter */
1127 
1129 
1130  /* set the list of global values. This is a bit too restrictive in
1131  C as the formal arguments, even modified in the procedure body,
1132  will not appear in the transformer_arguments. Should we add
1133  missing formal arguments to this list? See for instance
1134  "character01.c". */
1136 
1137  /* debug_on(SEMANTICS_DEBUG_LEVEL); */
1138 
1140 
1141  /* Add declaration information: arrays cannot be empty (Fortran
1142  standard, Section 5.1.2). But according to summary_precondition(),
1143  this is now supposed to be performed by the transformer phase? */
1144  if(get_bool_property("SEMANTICS_TRUST_ARRAY_DECLARATIONS")) {
1146  }
1147  if(get_bool_property("SEMANTICS_USE_TYPE_INFORMATION")
1148  || get_bool_property("SEMANTICS_USE_TYPE_INFORMATION_IN_PRECONDITIONS")) {
1149 
1150  /* If the module is never called, its precondition is identity
1151  and by default no values are listed in its basis. Function
1152  add_type_information() has no effect. */
1153 
1154  /* if(transformer_identity_p(pre)) { */
1155  /* list el = effects_to_list( */
1156  /* (effects) db_get_memory_resource(DBR_SUMMARY_EFFECTS, module_name, true)); */
1157  /* free_transformer(pre); */
1158  /* // FI: memory leak */
1159  /* pre = transformer_range(effects_to_transformer(el)); */
1160  /* } */
1161 
1163  }
1164 
1165  /* debug_on(SEMANTICS_DEBUG_LEVEL); */
1166 
1167  /* propagate the module precondition */
1170  close_reachable();
1171 
1172  /* post could be stored in the ri for later interprocedural uses
1173  but the ri cannot be modified so early before the DRET demo;
1174  also our current interprocedural algorithm does not propagate
1175  postconditions upwards in the call tree */
1176 
1177  DB_PUT_MEMORY_RESOURCE(DBR_PRECONDITIONS,
1178  module_name,
1179  (char*) get_precondition_map() );
1180 
1181  pips_debug(8, "postcondition computed for %s\n",
1183  ifdebug(8) (void) print_transformer(post);
1184  debug(1, "module_name_to_preconditions", "end\n");
1185 
1193 
1195 
1198  debug_off();
1199 
1200  return true;
1201 }
1202 ␌
1204 {
1207  transformer t_pre_inter = transformer_undefined;
1209  list e_inter = list_undefined;
1210 
1213 
1216  (statement) db_get_memory_resource(DBR_CODE, module_name, true));
1218  pips_internal_error("no statement for module %s", module_name);
1219 
1221  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
1222 
1224  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
1225 
1226  e_inter = effects_to_list((effects)
1227  db_get_memory_resource(DBR_SUMMARY_EFFECTS, module_name, true));
1228 
1230  db_get_memory_resource(DBR_TRANSFORMERS, module_name, true));
1231 
1233  db_get_memory_resource(DBR_PRECONDITIONS, module_name, true));
1234 
1235 
1236  t_inter = (transformer)
1237  db_get_memory_resource(DBR_SUMMARY_TRANSFORMER, module_name, true);
1238 
1240 
1242 
1243  /* set the list of global values */
1245 
1247  /* The program postcondition should be used DBR_PROGRAM_POSTCONDITION */
1248  t_post = transformer_identity();
1249  }
1250 
1251  ifdebug(3) {
1252  pips_debug(1, "considering final total postcondition for %s\n", module_name);
1253  print_transformer(t_post);
1254  }
1255 
1257  transformer ip =
1259  if( ip == transformer_undefined) {
1260  /* that might be because we are at the call tree root
1261  or because no information is available;
1262  maybe, every module precondition should be initialized
1263  to a neutral value? */
1264  pips_user_warning("no interprocedural module total postcondition for %s\n",
1266  ;
1267  }
1268  else {
1270  ifdebug(8) {
1271  pips_debug(8, "\t summary_total_postcondition %p after translation:\n",
1272  ip);
1273  print_transformer(ip);
1274  pips_assert("The summary total postcondition is consistent",
1276  }
1277  t_post = transformer_combine(transformer_dup(ip), t_post);
1278  }
1279  }
1280  else if(transformer_undefined_p(t_post)) {
1281  /* intra-procedural case, not a main module */
1282  t_post = transformer_identity();
1283  }
1284 
1285  /* propagate the module total postcondition */
1288  close_reachable();
1289 
1290  DB_PUT_MEMORY_RESOURCE(DBR_TOTAL_PRECONDITIONS,
1291  module_name,
1292  (char*) get_total_precondition_map() );
1293 
1294  /* filter out local variables from the global intraprocedural effect */
1295  t_pre_inter = transformer_intra_to_inter(t_pre, e_inter);
1296  t_pre_inter = transformer_normalize(t_pre_inter, 2);
1297  if(!transformer_consistency_p(t_pre_inter)) {
1298  (void) print_transformer(t_pre_inter);
1299  pips_internal_error("Non-consistent summary transformer");
1300  }
1301  DB_PUT_MEMORY_RESOURCE(DBR_SUMMARY_TOTAL_PRECONDITION,
1303  (char*) t_pre_inter);
1304 
1305  pips_debug(8, "total precondition computed for %s\n",
1307  ifdebug(8) (void) print_transformer(t_pre);
1308  pips_debug(1, "end\n");
1309 
1317 
1319 
1321  debug_off();
1322 
1323  return true;
1324 }
1325 
1326 ␌
1328 {
1329  /* FI: I had to add a guard db_resource_p() on Nov. 14, 1995.
1330  * I do not understand why the problem never occured before,
1331  * although it should each time the intra-procedural option
1332  * is selected.
1333  *
1334  * This may partially be explained because summary transformers
1335  * are implicitly computed with transformers instead of using
1336  * an explicit call to summary_transformer (I guess I'm going
1337  * to change that).
1338  *
1339  * I think it would be better not to call load_summary_transformer()
1340  * at all when no interprocedural options are selected. I should
1341  * change that too.
1342  */
1343 
1344  /* memoization could be used to improve efficiency */
1346 
1347  pips_assert("e is a module", entity_module_p(e));
1348 
1349  if(db_resource_p(DBR_SUMMARY_TRANSFORMER, module_local_name(e))) {
1350  t = (transformer)
1351  db_get_memory_resource(DBR_SUMMARY_TRANSFORMER,
1352  entity_local_name(e),
1353  true);
1354 
1355  /* db_get_memory_resource never returns database_undefined or
1356  resource_undefined */
1357  pips_assert("load_summary_transformer", t != transformer_undefined);
1358  }
1359  else {
1361  }
1362 
1363  /* Let's be careful with people using an intraprocedural analysis
1364  of the transformers and requesting an interprocedural analysis
1365  of the preconditions... */
1366  if(transformer_undefined_p(t)) {
1367  if(db_resource_p(DBR_SUMMARY_EFFECTS, module_local_name(e))) {
1369  db_get_memory_resource(DBR_SUMMARY_EFFECTS,
1370  entity_local_name(e),
1371  true));
1372  t = effects_to_transformer(el);
1373  }
1374  }
1375 
1376  return t;
1377 }
1378 
1379 ␌
1380 /* void update_summary_precondition(e, t): t is supposed to be a
1381  * precondition related to one of e's call sites and translated into
1382  * e's basis;
1383  *
1384  * the current global precondition for e is replaced by its convex
1385  * hull with t;
1386  *
1387  * t may be slightly modified by transformer_convex_hull
1388  * because of bad design (FI)
1389  */
1391 {
1394 
1395  pips_assert("update_summary_precondition", entity_module_p(e));
1396 
1397  debug(8, "update_summary_precondition", "begin\n");
1398 
1399  t_old = (transformer)
1400  db_get_memory_resource(DBR_SUMMARY_PRECONDITION, module_local_name(e),
1401  true);
1402 
1403  ifdebug(8) {
1404  debug(8, "update_summary_precondition", " old precondition for %s:\n",
1405  entity_local_name(e));
1406  print_transformer(t_old);
1407  }
1408 
1409  if(t_old == transformer_undefined)
1410  t_new = transformer_dup(t);
1411  else {
1412  t_new = transformer_convex_hull(t_old, t);
1413  transformer_free(t_old);
1414  }
1415 
1416  DB_PUT_MEMORY_RESOURCE(DBR_SUMMARY_PRECONDITION,
1417  module_local_name(e),
1418  (char*) t_new );
1419 
1420  ifdebug(8) {
1421  debug(8, "update_summary_precondition", "new precondition for %s:\n",
1422  entity_local_name(e));
1423  print_transformer(t_new);
1424  debug(8, "update_summary_precondition", "end\n");
1425  }
1426 }
1427 ␌
1428 /* summary_preconditions are expressed in any possible frame, in fact the frame of
1429  * the last procedure that used/produced it
1430  */
1432 {
1433  /* memoization could be used to improve efficiency */
1434  transformer t;
1435 
1436  pips_assert("e is a module", entity_module_p(e));
1437 
1438  pips_debug(8, "begin\n for %s\n",
1439  module_local_name(e));
1440 
1441  t = (transformer)
1442  db_get_memory_resource(DBR_SUMMARY_PRECONDITION, module_local_name(e),
1443  true);
1444  /* Not done earlier, because the value mappings were not available. On
1445  the other hand, htis assumes that the value mappings have been
1446  initialized before a call to load_summary_precondition(0 is
1447  performed.*/
1449 
1450  pips_assert("the summary precondition t is defined", t != transformer_undefined);
1451 
1452  ifdebug(8) {
1453  pips_debug(8, " precondition for %s:\n",
1454  module_local_name(e));
1455  dump_transformer(t);
1456  pips_debug(8, " end\n");
1457  }
1458 
1459  return t;
1460 }
1461 ␌
1462 /* summary_preconditions are expressed in any possible frame, in fact the frame of
1463  * the last procedure that used/produced it
1464  */
1466 {
1468 
1469  pips_assert("e is a module", entity_module_p(e));
1470 
1471  pips_debug(8, "begin\n for %s\n",
1472  module_local_name(e));
1473 
1474  t_post = (transformer)
1475  db_get_memory_resource(DBR_SUMMARY_TOTAL_POSTCONDITION, module_local_name(e),
1476  true);
1477 
1478  pips_assert("t is defined", t_post != transformer_undefined);
1479 
1480  ifdebug(8) {
1481  pips_debug(8, " total postcondition for %s:\n",
1482  module_local_name(e));
1483  dump_transformer(t_post);
1484  pips_debug(8, " end\n");
1485  }
1486 
1487  return t_post;
1488 }
1489 ␌
1490 /* FI->FI, FI->BC: these two functions should be moved into
1491  effects-util or effects-simple */
1493 {
1494  /* memorization could be used to improve efficiency */
1495  list t;
1496 
1497  pips_assert("load_summary_effects", entity_module_p(e));
1498 
1499  t = effects_to_list( (effects)
1500  db_get_memory_resource(DBR_SUMMARY_EFFECTS, module_local_name(e),
1501  true));
1502 
1503  pips_assert("t is defined", t != list_undefined);
1504 
1505  return t;
1506 }
1507 
1509 {
1510  string module_name = (string) module_local_name(e);
1511 
1512  pips_assert("load_summary_effects", entity_module_p(e));
1513 
1514  statement b = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
1516  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true);
1517  effects be = (effects) (intptr_t)HASH_GET(p, p, statement_effects_hash_table(se), (void *) b);
1518  list bel = effects_effects(be);
1519 
1520  pips_assert("bel is defined", bel != list_undefined);
1521 
1522  return bel;
1523 }
1524 
1525 ␌
1527 {
1528  /* memoization could be used to improve efficiency */
1529  list t;
1530  statement s;
1531 
1532  pips_assert("is a module", entity_module_p(e));
1533  pips_assert("is the current module", e == get_current_module_entity());
1535  pips_assert("some statement", s!=statement_undefined);
1536 
1538 
1539  pips_assert("some list", t != list_undefined);
1540 
1541  return t;
1542 }
1543 
1544 
1545 /* ca n'a rien a` faire ici, et en plus, il serait plus inte'ressant
1546  * d'avoir une fonction void statement_map_print(statement_mapping
1547  * htp)
1548  */
1550 {
1551  FILE * f =stderr;
1553 
1554  /* hash_table_print_header (htp,f); */
1555 
1556  STATEMENT_EFFECTS_MAP(k, v, {
1557  fprintf(f, "\n\n%td", statement_ordering((statement) k));
1559  },
1560  htp);
1561 }
void free_transformer(transformer p)
Definition: ri.c:2616
transformer copy_transformer(transformer p)
TRANSFORMER.
Definition: ri.c:2613
bool db_resource_p(const char *rname, const char *oname)
true if exists and in loaded or stored state.
Definition: database.c:524
static const char * caller_name
Definition: alias_check.c:122
static entity callee
Definition: alias_pairs.c:62
#define VALUE_MONE
transformer transformer_dup(transformer t_in)
transformer package - basic routines
Definition: basic.c:49
void transformer_free(transformer t)
Definition: basic.c:68
transformer transformer_inequality_add(transformer tf, Pvecteur i)
Definition: basic.c:375
transformer transformer_identity()
Allocate an identity transformer.
Definition: basic.c:110
bool transformer_consistency_p(transformer t)
FI: I do not know if this procedure should always return or fail when an inconsistency is found.
Definition: basic.c:612
transformer transformer_empty()
Allocate an empty transformer.
Definition: basic.c:120
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
bool vect_constant_p(Pvecteur)
bool vect_constant_p(Pvecteur v): v contains only a constant term, may be zero
Definition: predicats.c:211
void close_reachable(void)
Remove reachability information about previously checked statements.
Definition: unreachable.c:252
void init_reachable(statement)
unreachable.c
Definition: unreachable.c:223
#define database_undefined
Definition: database.h:42
bool preconditions_intra_fast(char *module_name)
bool interprocedural_summary_precondition(char *module_name)
transformer transformer_equality_fix_point(transformer)
Let A be the affine loop transfert function.
Definition: fix_point.c:266
list load_module_intraprocedural_effects(entity e)
bool summary_total_precondition(char *module_name)
static int wc
FI: Provisional management of warnings.
static void select_fix_point_operator()
static void transformer_add_declaration_information(transformer pre, entity m)
transformer load_summary_total_postcondition(entity e)
summary_preconditions are expressed in any possible frame, in fact the frame of the last procedure th...
bool generic_module_name_to_transformers(const char *module_name, bool in_context)
bool generic_module_name_to_transformers(char * module_name, bool in_context): compute a transformer ...
bool transformers_inter_full_with_points_to(char *module_name)
transformer load_completed_statement_transformer(statement s)
three mappings used throughout semantics analysis:
bool summary_precondition(char *module_name)
bool preconditions_inter_full_with_points_to(char *module_name)
bool refine_transformers_p
Transformer recomputation cannot be of real use unless an interprocedural analysis is performed.
bool module_name_to_transformers_in_context(const char *module_name)
bool transformers_intra_fast(char *module_name)
Functions to make transformers.
bool use_points_to_p()
bool transformers_inter_full(char *module_name)
bool test_warning_counters(void)
void cumulated_effects_map_print(void)
ca n'a rien a` faire ici, et en plus, il serait plus inte'ressant d'avoir une fonction void statement...
bool summary_total_postcondition(char *module_name)
bool module_name_to_preconditions(const char *module_name)
resource module_name_to_preconditions(char * module_name): compute a transformer for each statement o...
void set_warning_counters(void)
transformer(* transformer_fix_point_operator)(transformer)
Interface between the untyped database manager and clean code and between pipsmake and clean code.
Definition: fix_point.c:114
bool total_preconditions_inter(char *module_name)
transformer transformer_pattern_fix_point(transformer)
This fixpoint function was developped to present a talk at FORMA.
Definition: fix_point.c:709
bool interprocedural_summary_precondition_with_points_to(char *module_name)
bool module_name_to_transformers(const char *module_name)
list load_body_effects(entity e)
bool transformers_inter_fast(char *module_name)
bool refine_transformers_with_points_to(char *module_name)
bool preconditions_inter_full(char *module_name)
bool module_name_to_total_preconditions(const char *module_name)
void add_declaration_list_information(transformer pre, list dl, bool precondition_p)
bool summary_transformer(char *module_name)
static void reset_use_points_to()
transformer load_summary_precondition(entity e)
summary_preconditions are expressed in any possible frame, in fact the frame of the last procedure th...
bool preconditions_intra(char *module_name)
bool refine_transformers(char *module_name)
static bool use_points_to_information_p
list load_summary_effects(entity e)
FI->FI, FI->BC: these two functions should be moved into effects-util or effects-simple.
static void add_declaration_information(transformer pre, entity m, bool precondition_p)
static transformer main_summary_precondition(entity callee)
Special case: main module.
bool old_summary_precondition(char *module_name)
void update_summary_precondition(entity e, transformer t)
void update_summary_precondition(e, t): t is supposed to be a precondition related to one of e's call...
transformer load_summary_transformer(entity e)
static void precondition_add_declaration_information(transformer pre, entity m)
bool transformers_intra_full(char *module_name)
static transformer ordinary_summary_precondition(const char *module_name, entity callee)
Standard cases: called modules.
bool total_preconditions_intra(char *module_name)
bool preconditions_inter_fast(char *module_name)
static void set_use_points_to()
bool intraprocedural_summary_precondition(char *module_name)
transformer transformer_derivative_fix_point(transformer)
Computation of a transitive closure using constraints on the discrete derivative.
Definition: fix_point.c:1067
statement_effects get_cumulated_rw_effects(void)
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
list load_cumulated_rw_effects_list(statement)
void generic_effects_reset_all_methods(void)
void reset_cumulated_rw_effects(void)
void set_methods_for_simple_effects(void)
void set_pt_to_list(statement_points_to)
list effects_to_list(effects)
Definition: effects.c:209
void reset_pt_to_list(void)
#define statement_effects_hash_table(x)
Definition: effects.h:1054
struct _newgen_struct_effects_ * effects
Definition: effects.h:138
struct _newgen_struct_statement_effects_ * statement_effects
Definition: effects.h:210
#define STATEMENT_EFFECTS_MAP(k, v, c, f)
Definition: effects.h:1057
#define effects_effects(x)
Definition: effects.h:710
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
char * get_string_property(const char *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
transformer transformer_basic_fix_point(transformer tf)
Computation of a fix point: drop all constraints, remember which variables are changed.
Definition: fix_point.c:1280
#define STRING(x)
Definition: genC.h:87
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
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
size_t gen_length(const list l)
Definition: list.c:150
#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
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
#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 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 pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
#define user_error(fn,...)
Definition: misc-local.h:265
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
#define DEFINE_CURRENT_MAPPING(name, type)
Definition: newgen-local.h:58
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
#define HASH_GET(start, image, h, k)
Definition: newgen_map.h:30
char * string
STRING.
Definition: newgen_types.h:39
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
bool some_main_entity_p(void)
util.c
Definition: util.c:37
#define print_transformer(t)
Definition: print.c:357
#define print_effects(e)
Definition: print.c:334
#define dump_transformer(t)
Definition: print.c:355
#define SEMANTICS_FIX_POINT
#define SEMANTICS_FLOW_SENSITIVE
#define SEMANTICS_DEBUG_LEVEL
#define SEMANTICS_STDOUT
#define SEMANTICS_INTERPROCEDURAL
#define SEMANTICS_INEQUALITY_INVARIANT
void set_bool_property(const char *, bool)
#define NORMALIZE_EXPRESSION(e)
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
bool c_module_p(entity m)
Test if a module "m" is written in C.
Definition: entity.c:2777
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
bool entity_module_p(entity e)
Definition: entity.c:683
void free_statement_global_stack(void)
Definition: static.c:358
void make_statement_global_stack(void)
Definition: static.c:318
struct _newgen_struct_callees_ * callees
Definition: ri.h:55
#define transformer_undefined
Definition: ri.h:2847
#define transformer_undefined_p(x)
Definition: ri.h:2848
#define normalized_linear_p(x)
Definition: ri.h:1779
#define callees_callees(x)
Definition: ri.h:675
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define statement_ordering(x)
Definition: ri.h:2454
#define dimension_lower(x)
Definition: ri.h:980
#define type_variable(x)
Definition: ri.h:2949
#define language_c_p(x)
Definition: ri.h:1594
#define transformer_arguments(x)
Definition: ri.h:2871
#define dimension_upper(x)
Definition: ri.h:982
#define value_code(x)
Definition: ri.h:3067
#define variable_dimensions(x)
Definition: ri.h:3122
struct _newgen_struct_transformer_ * transformer
Definition: ri.h:431
#define entity_type(x)
Definition: ri.h:2792
#define code_language(x)
Definition: ri.h:792
#define normalized_linear(x)
Definition: ri.h:1781
#define type_variable_p(x)
Definition: ri.h:2947
#define statement_undefined
Definition: ri.h:2419
#define entity_initial(x)
Definition: ri.h:2796
transformer data_to_precondition(entity m)
restricted to variables with effects.
void set_module_global_arguments(list args)
transformer statement_to_postcondition(transformer, statement)
end of the non recursive section
transformer statement_to_total_precondition(transformer, statement)
semantical analysis
transformer complete_statement_transformer(transformer t, transformer pre, statement s)
Returns the effective transformer ct for a given statement s.
transformer effects_to_transformer(list e)
list of effects
transformer transformer_intra_to_inter(transformer tf, list le)
transformer statement_to_transformer(statement s, transformer spre)
stmt precondition
void sc_variable_name_pop(void)
Definition: sc_debug.c:239
void sc_variable_name_push(char *(*fun)(Variable))
Definition: sc_debug.c:217
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
transformer update_precondition_with_call_site_preconditions(transformer t, entity caller, entity callee)
Update precondition t for callee with preconditions of call sites to callee in caller.
transformer value_passing_summary_transformer(entity f, transformer tf)
With value passing, writes on formal parameters are not effective interprocedurally unless an array i...
int get_call_site_number()
void translate_global_values(entity m, transformer tf)
void reset_call_site_number()
bool value_mappings_compatible_vector_p(Pvecteur iv)
transform a vector based on variable entities into a vector based on new value entities when possible...
Definition: mappings.c:924
void upwards_vect_rename(Pvecteur v, transformer post)
Renaming of variables in v according to transformations occuring later.
Definition: mappings.c:1062
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
Definition: mappings.c:624
void transformer_add_type_information(transformer)
type.c
Definition: type.c:162
void set_total_precondition_map(statement_mapping)
void reset_total_precondition_map(void)
void set_transformer_map(statement_mapping)
transformer load_statement_transformer(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
statement_mapping get_total_precondition_map(void)
statement_mapping get_transformer_map(void)
void reset_transformer_map(void)
statement_mapping get_precondition_map(void)
#define ifdebug(n)
Definition: sg.c:47
#define intptr_t
Definition: stdint.in.h:294
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
transformer transformer_convex_hull(transformer t1, transformer t2)
transformer transformer_convex_hull(t1, t2): compute convex hull for t1 and t2; t1 and t2 are slightl...
Definition: convex_hull.c:216
transformer transformer_normalize(transformer t, int level)
Eliminate (some) rational or integer redundancy.
Definition: transformer.c:932
bool transformer_empty_p(transformer t)
If true is returned, the transformer certainly is empty.
Definition: transformer.c:2455
transformer transformer_combine(volatile transformer t1, transformer t2)
transformer transformer_combine(transformer t1, transformer t2): compute the composition of transform...
Definition: transformer.c:238
void free_value_mappings(void)
Normal call to free the mappings.
Definition: value.c:1212
const char * readable_value_name(entity)
For debugging purposes, we might have to print system with temporary values.
Definition: value.c:1769
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
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
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
Definition: binaires.c:75
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228
list current_module_declarations()
Definition: module.c:78