PIPS
comp_scan.c
Go to the documentation of this file.
1 /*
2 
3  $Id: comp_scan.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 /*
28  * scan the Abstract Syntax Tree of a program to count operations
29  */
30 
31 
32 #include <stdio.h>
33 #include <string.h>
34 
35 #include "linear.h"
36 
37 #include "genC.h"
38 #include "ri.h"
39 #include "effects.h"
40 #include "complexity_ri.h"
41 #include "database.h"
42 
43 #include "ri-util.h"
44 #include "effects-util.h"
45 #include "pipsdbm.h"
46 #include "resources.h"
47 #include "properties.h"
48 #include "text-util.h"
49 #include "misc.h"
50 #include "matrice.h"
51 #include "semantics.h"
52 #include "effects-simple.h"
53 #include "effects-generic.h"
54 #include "transformer.h"
55 #include "complexity.h"
56 
59 
60 /* declares the static variable complexity_map and defines its access functions */
62 
63 
64 /* bool complexities(module_name)
65  * Entry point called by the pips makefile
66  *
67  * "hash_callee_to_complexity" contains a list of summary_complexity
68  * of callees,
69  * Non-recursive: callees complexities are supposed to be computed
70  * when arriving here.
71  *
72  * "hash_complexity_parameters" contains the list of variables that we
73  * don't want to evaluate; so they will appear in the polynomial.
74  * All other variables (except for the loop indices) are evaluated
75  * as the scan proceeds, thanks to semantic analysis. Those which
76  * can't be evaluated are replaced by the pseudo-variable UNKNOWN_VARIABLE,
77  * which will be given an arbitrary value at the end of the evaluation.
78  */
80 {
81  bool success = true;
82 
83  //set_string_property("COMPLEXITY_COST_TABLE", "all_1");
85 
86  return success;
87 }
88 
89 bool fp_complexities(const string module_name)
90 {
91  bool success = true;
92 
93  //set_string_property("COMPLEXITY_COST_TABLE", "fp_1");
95 
96  return success;
97 }
98 
99 bool any_complexities(const string module_name)
100 {
102  list effects_list = NIL;
103  entity module_entity;
104  statement module_stat;
105 
106  trace_on("complexities %s", (char *)module_name);
107  debug_on("COMPLEXITY_DEBUG_LEVEL");
108 
109  /* we may need to print preconditions for debugging purposes */
111  db_get_memory_resource(DBR_PRECONDITIONS, module_name, true));
113  db_get_memory_resource(DBR_CUMULATED_EFFECTS, module_name, true));
115  db_get_memory_resource(DBR_PROPER_EFFECTS, module_name, true));
118  db_get_memory_resource(DBR_CODE, module_name, true ) );
119 
120  module_entity = get_current_module_entity();
121  module_stat = get_current_module_statement();
122 
123  module_to_value_mappings(module_entity);
124 
125  precond = load_statement_precondition(module_stat);
126  effects_list = load_cumulated_rw_effects_list(module_stat);
127 
128  init_cost_table();
129 
130  if (get_bool_property("COMPLEXITY_PRINT_COST_TABLE"))
131  fprint_cost_table(stdout);
132 
134 
137 
140 
143 
144  (void)statement_to_complexity(module_stat, precond, effects_list);
145 
148 
151  debug_off();
152  trace_off();
153 
154  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
155  fprintf(stderr,"\n");
156  fprintf(stderr,"Before ------- COMPLEXITIES; module %s\n",module_name);
157  }
158 
159  DB_PUT_MEMORY_RESOURCE(DBR_COMPLEXITIES,
161  (char *) get_complexity_map() );
162  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
163  fprintf(stderr,"After ------- COMPLEXITIES; module %s\n",module_name);
164  }
165 
175 
176  return true;
177 }
178 
179 bool summary_complexity(const string module_name)
180 {
181  complexity summary_comp = make_zero_complexity();// complexity_undefined;
182  complexity summary_comp_dup = make_zero_complexity();// complexity_undefined;
183 
185  db_get_memory_resource(DBR_CODE, module_name, true ) );
186 
188  db_get_memory_resource(DBR_COMPLEXITIES, module_name, true));
190 
191  trace_on("summary complexity %s", module_name);
192  debug_on("COMPLEXITY_DEBUG_LEVEL");
193 
194  if ( summary_comp == COMPLEXITY_NOT_FOUND )
195  pips_internal_error("No summary complexity!");
196  else {
197  /* summary_comp_dup = complexity_dup(summary_comp); */
198  summary_comp_dup = copy_complexity(summary_comp);
199  }
200 
201  pips_assert("summary_comp is conssten",
202  complexity_consistent_p(summary_comp));
203  pips_assert("summary_comp_dup is consistent",
204  complexity_consistent_p(summary_comp_dup));
205 
206  trace_off();
207 
208  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
209  fprintf(stderr,"\n");
210  fprintf(stderr,"Before ======== SUMMARY ; module %s\n",module_name);
211  }
212 
213  debug_off();
214 
215  DB_PUT_MEMORY_RESOURCE(DBR_SUMMARY_COMPLEXITY,
217  (char *) summary_comp_dup);
218 
219  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
220  fprintf(stderr,"After ======== SUMMARY ; module %s\n",module_name);
221  }
222 
225 
226  return true;
227 }
228 ␌
229 /* starting point of Abstract Syntax Tree */
231  transformer precon __attribute__ ((__unused__)),
232  list eff_list __attribute__ ((__unused__)))
233 {
234  instruction instr = statement_instruction(stat);
235  int so = statement_ordering(stat);
237  list effects_list = load_cumulated_rw_effects_list(stat);
239 
240  trace_on("statement %s, ordering (%d %d)",
243  /*
244  if ( perfectly_nested_loop_p(stat) )
245  fprintf(stderr, "PERFECTLY nested loop, ordering %d\n",
246  statement_ordering(perfectly_nested_loop_to_body(stat)));
247  else
248  fprintf(stderr, "NOT a perfectly nested loop\n");
249 */
250  if (instr != instruction_undefined)
251  comp = instruction_to_complexity(instr, precond, effects_list);
252  else {
253  pips_internal_error("instruction undefined");
254  }
255 
256  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
257  fprintf(stderr,"complexity for statement (%td,%td) at %p\n",
258  (statement_ordering(stat) >> 16),
259  (statement_ordering(stat) & 0xffff), comp);
260  complexity_fprint(stderr, comp, true, true);
261  }
262 
263  /* Check and store the complexity in the statement_mapping */
264  complexity_check_and_warn("statement_to_complexity", comp);
265  pips_assert("comp is consistent", complexity_consistent_p(comp));
266 
267  /* SET_STATEMENT_MAPPING(get_complexity_map() , stat, (char *) comp); */
268  store_statement_complexity(stat, comp);
269 
270  trace_off();
271  return(comp);
272 }
273 ␌
274 /* The only element available of the statement */
275 complexity instruction_to_complexity(instr, precond, effects_list)
276 instruction instr;
277 transformer precond;
278 list effects_list;
279 {
280  complexity comp = make_zero_complexity();// complexity_undefined;
281 
282  trace_on("instruction");
283 
284  switch (instruction_tag(instr)) {
286  comp = block_to_complexity(instruction_block(instr), precond, effects_list);
287  break;
288  case is_instruction_test:
289  comp = test_to_complexity(instruction_test(instr), precond, effects_list);
290  break;
291  case is_instruction_loop:
292  comp = loop_to_complexity(instruction_loop(instr), precond, effects_list);
293  break;
295  comp= whileloop_to_complexity(instruction_whileloop(instr), precond, effects_list);
296  break;
297  case is_instruction_goto:
298  comp = goto_to_complexity(instruction_goto(instr), precond, effects_list);
299  break;
300  case is_instruction_call: {
301  basic callbasic = MAKE_INT_BASIC; /* dummy parameter */
302  comp = call_to_complexity(instruction_call(instr),
303  &callbasic, precond, effects_list);
304  break;
305  }
308  precond, effects_list);
309  break;
310  case is_instruction_expression: { // copied from is_instruction_call
311  basic callbasic = MAKE_INT_BASIC; /* dummy parameter */
313  &callbasic,
314  precond, effects_list);
315  break;
316  }
317  default:
318  pips_internal_error("instruction tag %d isn't in 14->19.",
319  (int) instruction_tag(instr));
320  }
321  complexity_check_and_warn("instruction_to_complexity", comp);
322 
323  trace_off();
324  return(comp);
325 }
326 ␌
327 /* 1st element of instruction */
328 /* Modification:
329  * - To postpone the variable evaluation, we reverse the block.
330  * Attention: gen_nreverse destroys the original list. LZ 4 Dec. 92
331  *
332  * - Secondly, we check the variables in complexity. If a certain variable
333  * is must_be_written variable ( obtained from cumulated effects ),
334  * we evaluate it. LZ 5 Dec. 92
335  *
336  * - When the variable is must_be_written, the precondition is no longer
337  * available with this effect. So we need to use the next statement effect
338  * with current precondition to evaluate the variable. LZ 9 Dec. 92
339  *
340  * - Francois suggested not to create new list, ie, reverse block.
341  * Hence we don't use MAPL any more here. Instead, gen_nthcdr is used.
342  * 16 Dec 92
343  */
344 complexity block_to_complexity(list block, // list of statements
345  transformer precond,
346  list effects_list)
347 {
349  int block_length = gen_length( block );
350  int i;
351 
352  trace_on("block");
353 
354  if (get_bool_property("COMPLEXITY_EARLY_EVALUATION")) {
355  FOREACH(STATEMENT, stat, block) {
356  complexity ctemp = statement_to_complexity(stat, precond, effects_list);
357  complexity_add(&comp, ctemp);
358  }
359  }
360  else { // default property setting
361  for ( i = block_length; i > 0 ; i-- ) {
362  statement stat = STATEMENT(CAR(gen_nthcdr( i-1, block )));
363  statement up_stat;
365  complexity ctemp = statement_to_complexity(stat,
366  prec, effects_list);
367 
368  list cumu_list = load_cumulated_rw_effects_list(stat);
369  //extern int default_is_inferior_pvarval(Pvecteur *, Pvecteur *);
370 
371  Pbase pb = VECTEUR_NUL;
372 
373  if ( i > 1 ) {
374  up_stat = STATEMENT(CAR(gen_nthcdr( i-2, block )));
375  cumu_list = load_cumulated_rw_effects_list(up_stat);
376  }
377  complexity_add(&comp, ctemp);
378 
381 
382  for ( ; !VECTEUR_NUL_P(pb); pb = pb->succ) {
383  bool mustbewritten;
384  entity v = (entity) (pb->var);
385  //char *var = variable_local_name(pb->var);
386 
387  //mustbewritten = is_must_be_written_var(cumu_list, var);
388  mustbewritten = effects_write_variable_p(cumu_list, v);
389 
390  if ( mustbewritten ) {
391  complexity csubst;
392 
393  csubst = evaluate_var_to_complexity((entity)pb->var,
394  prec,
395  cumu_list, 1);
396  comp = complexity_var_subst(comp, pb->var, csubst);
397  }
398  }
399  }
400  }
401 
402  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
403  (void) complexity_consistent_p(comp);
404  fprintf(stderr, "block comp is at %p and comp value is ", comp);
405  complexity_fprint(stderr, comp, false, true);
406  }
407  complexity_check_and_warn("block_to_complexity", comp);
408 
409  trace_off();
410  return(comp);
411 }
412 ␌
413 /* 2nd element of instruction */
414 complexity test_to_complexity(test_instr, precond, effects_list)
415 test test_instr;
416 transformer precond;
417 list effects_list;
418 {
419  complexity comp, ctrue, cfalse, ctemp;
420  basic testbasic;
421 
422  trace_on("test");
423 
424  ctrue = statement_to_complexity(test_true(test_instr), precond, effects_list);
425  cfalse = statement_to_complexity(test_false(test_instr), precond, effects_list);
426  comp = expression_to_complexity(test_condition(test_instr),
427  &testbasic, precond, effects_list);
428 
429  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
430  fprintf(stderr, "\n");
431  fprintf(stderr, "YYY test true complexity: ");
432  complexity_fprint(stderr, ctrue, false, true);
433  fprintf(stderr, "YYY test false complexity: ");
434  complexity_fprint(stderr, cfalse, false, true);
435  fprintf(stderr, "YYY test cond. complexity: ");
436  complexity_fprint(stderr, comp, false, true);
437  }
438 
439  ctemp = complexity_dup(ctrue);
440  complexity_add(&ctemp, cfalse);
441  complexity_scalar_mult(&ctemp, 0.5);
442  complexity_add(&comp, ctemp);
443  complexity_rm(&ctemp);
444 
445  if ( !complexity_zero_p(comp) )
447 
448  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
449  fprintf(stderr, "YYY test total complexity: ");
450  complexity_fprint(stderr, comp, true, true);
451  fprintf(stderr, "\n");
452  }
453  complexity_check_and_warn("test_to_complexity", comp);
454 
455  trace_off();
456  return(comp);
457 }
458 ␌
459 /* 3rd element of instruction */
460 complexity loop_to_complexity(loop_instr, precond, effects_list)
461 loop loop_instr;
462 transformer precond;
463 list effects_list;
464 {
465  entity ll = loop_label (loop_instr);
466  entity index = loop_index(loop_instr);
467  range rng = loop_range(loop_instr);
468  statement s = loop_body(loop_instr);
469  execution ex = loop_execution(loop_instr);
470  complexity comp, cbody, crange, clower, cupper, cincr, cioh, cboh;
471  string sl,su,si;
472  /* FI: Lei chose to allocate the UL and UU entities in the current
473  module... Maybe, we are ready fo some dynamic profiling... */
474  /* string mod_name = entity_module_name(ll); */
475  basic ibioh = MAKE_INT_BASIC;
476  basic ibboh = MAKE_INT_BASIC;
477 
478  trace_on("loop %s label %s",entity_name(index),
479  entity_name(loop_label(loop_instr)));
480 
481  if ( empty_global_label_p(entity_name(ll)) ) {
482  /* if the statement were still reachable, we could try to use the
483  * statement nunber...
484  */
485  sl=strdup("UL_");
486  su=strdup("UU_");
487  si=strdup("UU_");
488  }
489  else {
490  /* In order to get rid of at-sign, add 1 , LZ 010492 */
491  asprintf(&sl,"UL_%s",entity_local_name(loop_label(loop_instr))+1);
492  asprintf(&su,"UU_%s",entity_local_name(loop_label(loop_instr))+1);
493  asprintf(&si,"UI_%s",entity_local_name(loop_label(loop_instr))+1);
494  }
495 
496  /* tell callees that they mustn't try to evaluate the loop index */
497 
500 
501  crange = range_to_complexity(rng, precond, effects_list);
502  cbody = statement_to_complexity(s, precond, effects_list);
503 
504  cioh = make_constant_complexity((float)
506  cboh = make_constant_complexity((float)
508  /* cioh cboh are derived from overhead file "overhead" LZ, 280993 */
509 
511 
512  if ( execution_parallel_p(ex) ) {
513  user_warning("loop_to_complexity", "DOALL not implemented yet\n");
514  }
515 
517  precond, effects_list,
519  if ( complexity_unknown_p(clower) ) {
520  /*
521  clower = make_single_var_complexity(1.0,
522  (Variable)FindOrCreateEntity(mod_name, sl));
523  */
526  clower = make_single_var_complexity(1.0,var);
527  }
528 
530  precond, effects_list,
532  if ( complexity_unknown_p(cupper) ) {
533  /*
534  cupper = make_single_var_complexity(1.0,
535  (Variable)FindOrCreateEntity(mod_name, su));
536  */
539  cupper = make_single_var_complexity(1.0,var);
540  }
541 
543  precond, effects_list,
545 
546  if ( complexity_constant_p(cincr) ) {
547  int incr = complexity_TCST(cincr);
548  if (incr == 0)
549  user_error("loop_to_complexity", "null increment\n");
550  else if ( incr < 0 ) {
551  complexity cswap;
552 
553  complexity_scalar_mult(&cincr, -1.0);
554  if ( incr != -1.0 ) {
555  complexity_div(&clower, cincr);
556  complexity_div(&cupper, cincr);
557  }
558  complexity_scalar_mult(&cincr, -1.0/incr);
559  cswap = clower;
560  clower = cupper;
561  cupper = cswap;
562  }
563  else if ( incr != 1) {
564  complexity_div(&clower, cincr);
565  complexity_div(&cupper, cincr);
566  complexity_scalar_mult(&cincr, 1.0/incr);
567  }
568  else if ( complexity_constant_p(clower) || complexity_constant_p(cupper) ) {
569  ;
570  }
571  }
572 
573  if ( complexity_constant_p(clower) && complexity_constant_p(cupper)) {
574  float lower = complexity_TCST(clower);
575  float upper = complexity_TCST(cupper);
576  if (lower>upper) {
577  /* zero iteration for sure */
578  comp = make_zero_complexity();
579  }
580  else {
581  /* at least one iteration */
582  comp = complexity_sigma(cbody, (Variable)index, clower, cupper);
583  }
584  }
585  else {
586  /* maybe some iteration */
587  comp = complexity_sigma(cbody, (Variable)index, clower, cupper);
588  /* an intermediate test based on preconditions would give better
589  result with affine loop bounds */
590  }
591 
592  /*
593  if ( !complexity_constant_p(cincr)
594  || complexity_constant_p(clower) || complexity_constant_p(cupper) ) {
595  complexity_div(&comp, cincr);
596  }
597  */
598 
599  if(!complexity_constant_p(cincr)) {
600  if(complexity_is_monomial_p(cincr) && complexity_degree(cincr)==1) {
601  complexity_div(&comp, cincr);
602  }
603  else {
604  free_complexity(cincr);
607  cincr = make_single_var_complexity(1.0,var);
608  }
609  }
610 
611  if ( complexity_constant_p(comp) && complexity_TCST(comp) < 0 )
612  comp = make_zero_complexity();
613 
614  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
615  fprintf(stderr, "\n");
616  fprintf(stderr, "@@@ body complexity: ");
617  complexity_fprint(stderr, cbody, false, true);
618  fprintf(stderr, "@@@ range complexity: ");
619  complexity_fprint(stderr, crange, false, true);
620  fprintf(stderr, "@@@ lower value : ");
621  complexity_fprint(stderr, clower, false, true);
622  fprintf(stderr, "@@@ upper value : ");
623  complexity_fprint(stderr, cupper, false, true);
624  fprintf(stderr, "@@@ increment value : ");
625  complexity_fprint(stderr, cincr, false, true);
626  fprintf(stderr, "@@@ sigma complexity: ");
627  complexity_fprint(stderr, comp, false, true);
628  }
629 /*
630  if ( !complexity_constant_p(cincr) ) {
631  complexity_div(&comp, cincr);
632  }
633  else {
634  float incr = complexity_TCST(cincr);
635  if (incr == 0)
636  user_error("loop_to_complexity", "null increment\n");
637 
638  if ( complexity_constant_p(clower) && complexity_constant_p(cupper) ) {
639  float lower = complexity_TCST(clower);
640  float upper = complexity_TCST(cupper);
641  int times=0;
642  float curf;
643 
644  for ( curf = lower; curf <= upper; curf += incr )
645  times++;
646 
647  complexity_scalar_mult(&comp, 1./(float)times);
648  if ( complexity_zero_p(comp) )
649  comp = make_constant_complexity(1.0);
650  }
651  else {
652  complexity_scalar_mult(&comp, 1.0/incr);
653  }
654  }
655 */
658  complexity_stats_add(&comp, cincr);
660 
661  complexity_rm(&crange);
662  complexity_rm(&cioh);
663  complexity_rm(&cboh);
664  complexity_rm(&clower);
665  complexity_rm(&cupper);
666  complexity_rm(&cincr);
667 
668  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
669  fprintf(stderr, "@@@ loop total compl: ");
670  complexity_fprint(stderr, comp, true, true);
671  fprintf(stderr, "\n");
672  }
673 
675  complexity_check_and_warn("loop_to_complexity", comp);
676 
677  trace_off();
678  free(sl);free(su);free(si);
679  return(comp);
680 }
681 
682 /* 4th element of instruction */
684  transformer precond __attribute__ ((__unused__)),
685  list effects_list __attribute__ ((__unused__)))
686 {
687  pips_internal_error("A GOTO is remaining.");
688  return(make_zero_complexity());
689 }
690 ␌
691 /* 5th element of instruction */
692 complexity whileloop_to_complexity(whileloop while_instr, transformer precond, list effects_list)
693 {
694  basic b;
695  expression exp1, exp2,exp3;
696  expression exp = whileloop_condition(while_instr);
697  complexity range ;
698  complexity cbody = statement_to_complexity(whileloop_body(while_instr), precond, effects_list),
699  ctest = expression_to_complexity(exp, &b,precond, effects_list);
700  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
701  fprintf(stderr, "\n");
702  fprintf(stderr, "YYY body complexity: ");
703  complexity_fprint(stderr, cbody, false, true);
704  fprintf(stderr, "YYY test complexity: ");
705  complexity_fprint(stderr, ctest, false, true);
706  }
707 
709  entity fun = call_function(syntax_call( s ));
710  if (ENTITY_LESS_THAN_P( fun )) {
713  exp3 = make_op_exp( MINUS_OPERATOR_NAME,exp1,exp2);
715  precond, effects_list,
717  }
718  else
719  {
721  }
722  complexity_add(&cbody,ctest);
723  complexity_mult(&cbody,range);
724 
725  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
726  fprintf(stderr, "YYY while total complexity: ");
727  complexity_fprint(stderr, cbody, true, true);
728  fprintf(stderr, "\n");
729  }
730  complexity_check_and_warn(__FUNCTION__, cbody);
731 
732  return cbody;
733 }
734 
735 /* 3rd element of syntax */
736 complexity call_to_complexity(call_instr, pbasic, precond, effects_list)
737 call call_instr;
738 basic *pbasic;
739 transformer precond;
740 list effects_list;
741 {
743  entity f = call_function(call_instr);
744  list args= call_arguments(call_instr);
745  type t = entity_type(f);
746  value v = entity_initial(f);
747 
748  const char *name = module_local_name(f);
749 
750  trace_on("call %s", entity_name(f));
751 
752  pips_assert("call_to_complexity",
754 
755  switch (value_tag(v)) {
756  case is_value_code: {
757  complexity compcallee;
758 
759  /* The only case that hash_callee_to_complexity is used */
761  (char *) f);
762  if ( compcallee == COMPLEXITY_NOT_FOUND )
763  user_error("call_to_complexity", "unknown complexity\n");
764  /* transform formal params into real ones */
765  comp = replace_formal_parameters_by_real_ones(compcallee,
766  f, args,
767  precond,
768  effects_list);
769  break;
770  }
771  case is_value_symbolic:
772  case is_value_constant:
773  if ( !type_statement_p(t) ) /* if not format case */
774  *pbasic = entity_basic(f);
775  comp = make_zero_complexity();
776  break;
777  case is_value_intrinsic:
778  comp = arguments_to_complexity(args, pbasic, precond, effects_list);
779  complexity_float_add(&comp, (float) intrinsic_cost(name, pbasic));
780  break;
781  case is_value_unknown:
782  user_error("call_to_complexity", "unknown value");
783  default:
784  pips_internal_error("value_tag is %d not in 37->41", (int)value_tag(v));
785  }
786 
787  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
788  fprintf(stderr, "call '%s': ", name);
789  complexity_fprint(stderr, comp, false, true);
790  fprintf(stderr, "call comp is at %p\n", comp);
791  }
792  complexity_check_and_warn("call_to_complexity", comp);
793 
794  trace_off();
795  return(comp);
796 }
797 ␌
798 /* 2nd element of call */
799 /* arguments_to_complexity
800  * Return the sum of the complexities of the list of expressions passed.
801  * Return also in *pbasic the basic of the "biggest" argument
802  * (int/float/double/...)
803  */
804 complexity arguments_to_complexity(exprlist, pbasic, precond, effects_list)
805 list exprlist;
806 basic *pbasic;
807 transformer precond;
808 list effects_list;
809 {
811  basic abasic = MAKE_INT_BASIC;
812 
813  trace_on("arguments");
814 
815  *pbasic = MAKE_INT_BASIC;
816  MAPL (pa, {
817  expression e = EXPRESSION(CAR(pa));
818  complexity ctmp = expression_to_complexity(e, &abasic, precond, effects_list);
819  complexity_add(&comp, ctmp);
820  if (is_inferior_basic(*pbasic, abasic)) {
821  free_basic(*pbasic);
822  *pbasic = simple_basic_dup(abasic);
823  }
824  },exprlist);
825 
826  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
827  fprintf(stderr, "argument comp is at %p and value is ", comp);
828  complexity_fprint(stderr, comp, false, true);
829  }
830  complexity_check_and_warn("arguments_to_complexity", comp);
831 
832  trace_off();
833  return(comp);
834 }
835 
836 /* 2nd element of call --arguments */
837 /* 2nd element of reference --indices */
838 complexity expression_to_complexity(expr, pbasic, precond, effects_list)
839 expression expr;
840 basic *pbasic;
841 transformer precond;
842 list effects_list;
843 {
844  syntax s = expression_syntax(expr);
845  complexity comp = make_zero_complexity();// complexity_undefined;
846 
847  trace_on("expression");
848 
849  if ( s != syntax_undefined )
850  comp = syntax_to_complexity(s, pbasic, precond, effects_list);
851  else
852  pips_internal_error("syntax undefined");
853 
854  complexity_check_and_warn("expression_to_complexity", comp);
855 
856  trace_off();
857  return(comp);
858 }
859 ␌
861  basic * pbasic, transformer precond, list effects_list) {
862 
864  subscript_array(sub),
865  pbasic,
866  precond,
867  effects_list);
869  subscript_indices(sub),
870  pbasic,
871  precond,
872  effects_list);
873  complexity_add(&cl,cr);
874  complexity_rm(&cr);
875  complexity_float_add(&cl,1.f);/*SG:let us assume . cost 1 */
876  return cl;
877 
878 }
879 ␌
880 /* the only available element of expression */
881 complexity syntax_to_complexity(s, pbasic, precond, effects_list)
882 syntax s;
883 basic *pbasic;
884 transformer precond;
885 list effects_list;
886 {
887  complexity comp = make_zero_complexity();// complexity_undefined;
888 
889  trace_on("syntax");
890 
891  switch (syntax_tag(s)) {
892  case is_syntax_reference:
893  comp = reference_to_complexity(syntax_reference(s), pbasic,
894  precond, effects_list);
895  break;
896  case is_syntax_range:
897  comp = range_to_complexity(syntax_range(s), precond, effects_list);
898  break;
899  case is_syntax_call:
900  comp = call_to_complexity(syntax_call(s), pbasic, precond, effects_list);
901  break;
902  case is_syntax_cast: {
903  cast c = syntax_cast(s);
904  /* A cost for casting could be added, although casting is mostly
905  used for typing issue. However, (float) 2 has a cost. */
906  /* TypeCast operation added by Molka Becher to complexity_cost_tables
907  for handling the cost of cast when it is necessary, 24 March 2011 */
908  basic ib = MAKE_INT_BASIC;
909  comp = expression_to_complexity(cast_expression(c), pbasic, precond, effects_list);
911  complexity_add(&comp, c1);
912  complexity_rm(&c1);
913  break;
914  }
919  pbasic, precond, effects_list);
920  else {
921  /* Compiler generated constant: equivalent to a constant load --> 0*/
922  comp = make_zero_complexity();
923  }
924  break;
925  }
926  case is_syntax_subscript:
927  comp=subscript_to_complexity(syntax_subscript(s),pbasic,precond,effects_list);
928  break;
930  pips_internal_error("Not implemented yet");
931  break;
932  case is_syntax_va_arg:
933  pips_internal_error("Not implemented yet");
934  break;
935  default:
936  pips_internal_error("syntax_tag %d, not in %d->%d", (int)syntax_tag(s),
938  }
939 
940  complexity_check_and_warn("syntax_to_complexity", comp);
941 
942  trace_off();
943  return(comp);
944 }
945 ␌
946 /* 1st element of syntax */
947 /* reference_to_complexity:
948  * return the complexity of the computing of the indices
949  * plus the complexity of one memory read
950  * Also return basic type of variable in *pbasic.
951  */
952 complexity reference_to_complexity(ref, pbasic, precond, effects_list)
953 reference ref;
954 basic *pbasic;
955 transformer precond;
956 list effects_list;
957 {
959  list ind = reference_indices(ref);
960 
961  const char* name = module_local_name(var);
963  basic ib = MAKE_INT_BASIC; /* indices basic */
964  complexity comp, ci, ca; /* ci=compindexation, ca=compaccess */
965 
966  trace_on("reference %s", entity_name(var));
967 
968  if ( basic_int_p(b) || basic_float_p(b) ||
970  *pbasic = simple_basic_dup(b);
971  else if (basic_string_p(b))
972  *pbasic = MAKE_STRING_BASIC;
973  else if (basic_derived_p(b) || basic_pointer_p(b)){
974  *pbasic = MAKE_ADDRESS_BASIC;
975  }
976  else {
977  user_warning("reference_to_complexity",
978  "basic_tag %d, not in 1->9\n", (int)basic_tag(b));
979  }
980 
981  comp = indices_to_complexity(ind, &ib, precond, effects_list);
982 
983  /* ci=compindexation counts multi-dimension arrays indexation costs */
984 
985  switch ( gen_length(ind) ) {
986  case 0:
987  ci = make_zero_complexity();
988  break;
989  case 1:
990  ci = make_constant_complexity((float)
992  break;
993  case 2:
994  ci = make_constant_complexity((float)
996  break;
997  case 3:
998  ci = make_constant_complexity((float)
1000  break;
1001  case 4:
1002  ci = make_constant_complexity((float)
1004  break;
1005  case 5:
1006  ci = make_constant_complexity((float)
1008  break;
1009  case 6:
1010  ci = make_constant_complexity((float)
1012  break;
1013  default:
1014  ci = make_constant_complexity((float)
1016  }
1017 
1018  if(entity_register_p(var))
1019  ca = make_zero_complexity();
1020  else
1021  ca = make_constant_complexity((float)
1023  &ib));
1024 
1025  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
1026  fprintf(stderr, "\n");
1027  fprintf(stderr, ">>> ref. %s argus complexity: ", name);
1028  complexity_fprint(stderr, comp, false, true);
1029  fprintf(stderr, ">>> ref. %s access complexity: ", name);
1030  complexity_fprint(stderr, ca, false, true);
1031  fprintf(stderr, ">>> ref. %s indices complexity: ", name);
1032  complexity_fprint(stderr, ci, false, true);
1033  }
1034 
1035  complexity_add(&comp, ca);
1036  complexity_add(&comp, ci);
1037  complexity_rm(&ca);
1038  complexity_rm(&ci);
1039 
1040  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
1041  fprintf(stderr, ">>> ref. %s total complexity: ", name);
1042  complexity_fprint(stderr, comp, true, true);
1043  fprintf(stderr,"\n");
1044  }
1045 
1046  complexity_check_and_warn("reference_to_complexity", comp);
1047 
1048  trace_off();
1049  return(comp);
1050 }
1051 ␌
1052 /* 2nd element of reference */
1053 /* exactly the same with arguments_to_complexity
1054  * I add this function in order to make the structure clearer
1055  * Apr. 15,91
1056  */
1057 complexity indices_to_complexity(exprlist, pbasic, precond, effects_list)
1058 list exprlist;
1059 basic *pbasic;
1060 transformer precond;
1061 list effects_list;
1062 {
1064  basic ibasic = MAKE_INT_BASIC;
1065 
1066  trace_on("indices");
1067 
1068  *pbasic = MAKE_INT_BASIC;
1069 
1070  MAPL (pa, {
1071  expression e = EXPRESSION(CAR(pa));
1072  complexity ctmp = expression_to_complexity(e, &ibasic, precond, effects_list);
1073  complexity_add(&comp, ctmp);
1074  complexity_rm(&ctmp);
1075 
1076  if (is_inferior_basic(*pbasic, ibasic)) {
1077  free_basic(*pbasic);
1078  *pbasic = simple_basic_dup(ibasic);
1079  }
1080  },exprlist);
1081 
1082  complexity_check_and_warn("indices_to_complexity", comp);
1083 
1084  trace_off();
1085  return(comp);
1086 }
1087 ␌
1088 /* 2nd element of syntax */
1089 complexity range_to_complexity(rng, precond, effects_list)
1090 range rng;
1091 transformer precond;
1092 list effects_list;
1093 {
1094  complexity compl = NULL, compu = NULL, compi = NULL;
1095  expression lower = range_lower(rng);
1096  expression upper = range_upper(rng);
1097  expression incr = range_increment(rng);
1098  basic rngbasic;
1099 
1100  trace_on("range");
1101 
1102  if (!expression_undefined_p(lower))
1103  compl = expression_to_complexity(lower, &rngbasic, precond,
1104  effects_list);
1105  else
1106  pips_internal_error("lower undefined");
1107 
1108  if (!expression_undefined_p(upper))
1109  compu = expression_to_complexity(upper, &rngbasic, precond,
1110  effects_list);
1111  else
1112  pips_internal_error("upper undefined");
1113 
1114  if (!expression_undefined_p(incr))
1115  compi = expression_to_complexity(incr, &rngbasic, precond,
1116  effects_list);
1117  else
1118  pips_internal_error("increment undefined");
1119 
1120  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
1121  fprintf(stderr, "\n");
1122  fprintf(stderr, "--- range lower complexity: ");
1123  complexity_fprint(stderr, compl, false, true);
1124  fprintf(stderr, "--- range upper complexity: ");
1125  complexity_fprint(stderr, compu, false, true);
1126  fprintf(stderr, "--- range incr complexity: ");
1127  complexity_fprint(stderr, compi, false, true);
1128  }
1129 
1130  complexity_add(&compl, compu);
1131  complexity_add(&compl, compi);
1132  complexity_rm(&compu);
1133  complexity_rm(&compi);
1134 
1135  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
1136  fprintf(stderr, "--- range total complexity: ");
1137  complexity_fprint(stderr, compl, true, true);
1138  fprintf(stderr, "\n");
1139  }
1140  complexity_check_and_warn("range_to_complexity", compl);
1141 
1142  trace_off();
1143  return(compl);
1144 }
1145 
1146 
1147 
1148 
1149 
1150 
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
void free_complexity(complexity p)
Definition: complexity_ri.c:21
complexity copy_complexity(complexity p)
COMPLEXITY.
Definition: complexity_ri.c:18
bool complexity_consistent_p(complexity p)
Definition: complexity_ri.c:27
void free_basic(basic p)
Definition: ri.c:107
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
complexity make_complexity_unknown(const char *name)
builds a new unknown complexity attached to a virtual package
complexity evaluate_var_to_complexity(entity var, transformer precond, list effects_list __attribute__((__unused__)), int maximize)
complexity evaluate_var_to_complexity(entity var, transformer precond, list effects_list,...
complexity expression_to_complexity_polynome(expression expr, transformer precond, list effects_list, bool keep_symbols, int maximize)
Entry point routine of this file:
void complexity_add(complexity *pcomp1, complexity comp2)
void complexity_add(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 + comp2; !...
Definition: comp_math.c:372
void complexity_scalar_mult(complexity *pcomp, float f)
multiply a complexity by a floating-point number.
Definition: comp_math.c:303
void complexity_polynome_add(complexity *pcomp, Ppolynome pp)
Definition: comp_math.c:463
Ppolynome complexity_polynome(complexity comp)
Because complexity is composed of two elements, we use this function to get the first element : polyn...
Definition: comp_math.c:506
float complexity_TCST(complexity comp)
return the constant term of comp.
Definition: comp_math.c:288
void complexity_div(complexity *pcomp1, complexity comp2)
void complexity_div(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 / comp2; !...
Definition: comp_math.c:445
void complexity_float_add(complexity *pcomp, float f)
Add a floating point digit to the complexity May 3, 91.
Definition: comp_math.c:480
complexity replace_formal_parameters_by_real_ones(complexity comp, entity mod, list args, transformer precond, list effects_list)
transform formal params into real ones (args) in complexity comp
Definition: comp_math.c:519
bool complexity_constant_p(complexity comp)
true if comp is constant.
Definition: comp_math.c:256
complexity make_zero_complexity()
make a zero complexity "0.0000 * TCST" with null statistics
Definition: comp_math.c:238
complexity complexity_var_subst(complexity comp, Variable var, complexity compsubst)
complexity complexity_var_subst(comp, var, compsubst) replaces every occurrence of variable var in co...
Definition: comp_math.c:155
complexity make_constant_complexity(float f)
make a constant complexity "f * TCST" with null statistics
Definition: comp_math.c:231
complexity complexity_sigma(complexity comp, Variable index, complexity clower, complexity cupper)
comp_math.c
Definition: comp_math.c:84
void complexity_stats_add(complexity *pcomp1, complexity comp2)
Add comp2's statistics to *pcomp1's comp2 keeps unchanged.
Definition: comp_math.c:323
void complexity_mult(complexity *pcomp1, complexity comp2)
void complexity_mult(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 * comp2; !...
Definition: comp_math.c:418
bool complexity_zero_p(complexity comp)
zero complexity check.
Definition: comp_math.c:244
bool complexity_unknown_p(complexity comp)
true if comp is unknown.
Definition: comp_math.c:269
complexity make_single_var_complexity(float f, Variable var)
make a complexity "f * var" with null statistics
Definition: comp_math.c:220
hash_table hash_complexity_parameters
Definition: comp_scan.c:58
complexity range_to_complexity(range rng, transformer precond, list effects_list)
2nd element of syntax
Definition: comp_scan.c:1089
complexity whileloop_to_complexity(whileloop while_instr, transformer precond, list effects_list)
5th element of instruction
Definition: comp_scan.c:692
complexity call_to_complexity(call call_instr, basic *pbasic, transformer precond, list effects_list)
3rd element of syntax
Definition: comp_scan.c:736
complexity loop_to_complexity(loop loop_instr, transformer precond, list effects_list)
3rd element of instruction
Definition: comp_scan.c:460
hash_table hash_callee_to_complexity
comp_expr_to_pnome.c
Definition: comp_scan.c:57
complexity test_to_complexity(test test_instr, transformer precond, list effects_list)
2nd element of instruction
Definition: comp_scan.c:414
bool any_complexities(const string module_name)
Definition: comp_scan.c:99
complexity reference_to_complexity(reference ref, basic *pbasic, transformer precond, list effects_list)
1st element of syntax
Definition: comp_scan.c:952
complexity instruction_to_complexity(instruction instr, transformer precond, list effects_list)
The only element available of the statement.
Definition: comp_scan.c:275
complexity expression_to_complexity(expression expr, basic *pbasic, transformer precond, list effects_list)
2nd element of call –arguments
Definition: comp_scan.c:838
bool fp_complexities(const string module_name)
Definition: comp_scan.c:89
bool uniform_complexities(const string module_name)
declares the static variable complexity_map and defines its access functions
Definition: comp_scan.c:79
complexity indices_to_complexity(list exprlist, basic *pbasic, transformer precond, list effects_list)
2nd element of reference
Definition: comp_scan.c:1057
complexity arguments_to_complexity(list exprlist, basic *pbasic, transformer precond, list effects_list)
2nd element of call
Definition: comp_scan.c:804
complexity statement_to_complexity(statement stat, transformer precon __attribute__((__unused__)), list eff_list __attribute__((__unused__)))
starting point of Abstract Syntax Tree
Definition: comp_scan.c:230
complexity subscript_to_complexity(subscript sub, basic *pbasic, transformer precond, list effects_list)
Definition: comp_scan.c:860
bool summary_complexity(const string module_name)
Definition: comp_scan.c:179
complexity goto_to_complexity(statement st __attribute__((__unused__)), transformer precond __attribute__((__unused__)), list effects_list __attribute__((__unused__)))
4th element of instruction
Definition: comp_scan.c:683
complexity block_to_complexity(list block, transformer precond, list effects_list)
1st element of instruction
Definition: comp_scan.c:344
complexity syntax_to_complexity(syntax s, basic *pbasic, transformer precond, list effects_list)
the only available element of expression
Definition: comp_scan.c:881
complexity unstructured_to_complexity(unstructured unstr, transformer precond, list effects_list)
6th element of instruction
Definition: comp_unstr.c:75
void complexity_rm(complexity *pcomp)
remove complexity comp
Definition: comp_util.c:164
void remove_formal_parameters_from_hash_table(entity mod, hash_table hash_complexity_params)
Definition: comp_util.c:791
void remove_common_variables_from_hash_table(entity module, hash_table hash_complexity_params)
Definition: comp_util.c:985
void trace_on(char *fmt,...)
Definition: comp_util.c:684
hash_table free_callees_complexities(hash_table h)
Definition: comp_util.c:812
void complexity_fprint(FILE *fd, complexity comp, bool print_stats_p, bool print_local_names_p)
Definition: comp_util.c:217
void add_common_variables_to_hash_table(entity module, hash_table hash_complexity_params)
Definition: comp_util.c:946
void complexity_check_and_warn(char *s, complexity comp) const
Definition: comp_util.c:108
int complexity_degree(complexity c)
Definition: comp_util.c:1167
hash_table fetch_complexity_parameters(char *module_name)
Definition: comp_util.c:901
void trace_off()
"trace off"
Definition: comp_util.c:714
void add_formal_parameters_to_hash_table(entity mod, hash_table hash_complexity_params)
Definition: comp_util.c:768
void fprint_cost_table(FILE *fd)
Definition: comp_util.c:481
hash_table fetch_callees_complexities(char *module_name)
Definition: comp_util.c:821
int intrinsic_cost(char *s, basic *pargsbasic) const
Return the cost of the intrinsic named s, knowing that the "basic" type of its biggest argument is *p...
Definition: comp_util.c:617
complexity complexity_dup(complexity comp)
duplicates complexity comp
Definition: comp_util.c:131
void init_cost_table()
Completes the intrinsic cost table with the costs read from the files specified in the "COMPLEXITY_CO...
Definition: comp_util.c:519
bool complexity_is_monomial_p(complexity c)
Definition: comp_util.c:1159
#define MAKE_ADDRESS_BASIC
#define LOOP_BRANCH_OVERHEAD
#define TYPE_CAST_COST
TYPE_CAST_COST added to handle cast case ; Molka Becher
#define FOUR_INDEX_NAME
#define MAXIMUM_VALUE
#define ONE_INDEX_NAME
#define MEMORY_READ_NAME
the above two lines are added for 6th cost file, overhead.
#define KEEP_SYMBOLS
defines for "expression_to_polynome" parameters
#define HASH_LOOP_INDEX
#define MAKE_STRING_BASIC
#define SIX_INDEX_NAME
#define LOOP_INIT_OVERHEAD
#define FIVE_INDEX_NAME
#define MINIMUM_VALUE
#define SEVEN_INDEX_NAME
#define THREE_INDEX_NAME
#define TWO_INDEX_NAME
#define MAKE_INT_BASIC
#define UNKNOWN_RANGE_NAME
pseudo-variable for default iteration number of a loop
#define COMPLEXITY_NOT_FOUND
statement_mapping get_complexity_map(void)
void store_statement_complexity(statement, complexity)
complexity load_statement_complexity(statement)
void reset_complexity_map(void)
void set_complexity_map(statement_mapping)
#define complexity_ifcount(x)
Definition: complexity_ri.h:98
#define complexity_rangecount(x)
Definition: complexity_ri.h:96
struct _newgen_struct_complexity_ * complexity
Definition: complexity_ri.h:30
#define rangecount_guessed(x)
#define ifcount_halfhalf(x)
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 reset_cumulated_rw_effects(void)
bool effects_write_variable_p(list, entity)
Definition: effects.c:1091
bool empty_global_label_p(const char *gln)
Definition: entity_names.c:264
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void free(void *)
bool success
Definition: gpips-local.h:59
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 NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#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 CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
list gen_nthcdr(int n, const list lx)
caution: the first item is 0! was: return( (n<=0) ? l : gen_nthcdr( n-1, CDR( l ))) ; if n>gen_length...
Definition: list.c:700
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
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
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
void * hash_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:439
struct _newgen_struct_range_ * range
Definition: message.h:21
#define debug_on(env)
Definition: misc-local.h:157
#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 debug_off()
Definition: misc-local.h:160
#define user_error(fn,...)
Definition: misc-local.h:265
#define user_warning(fn,...)
Definition: misc-local.h:262
#define DEFINE_CURRENT_MAPPING(name, type)
Definition: newgen-local.h:58
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
#define hash_table_undefined
Value of an undefined hash_table.
Definition: newgen_hash.h:49
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
Definition: newgen_types.h:78
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
int default_is_inferior_pvarval(Pvecteur *pvarval1, Pvecteur *pvarval2)
bool default_is_inferior_pvarval(Pvecteur * pvarval1, Pvecteur * pvarval2) return true if var1 is bef...
Definition: pnome-io.c:286
Pbase polynome_used_var(Ppolynome pp, int *is_inferior_var)
Pbase polynome_used_var(Ppolynome pp, bool *is_inferior_var()) PRIVATE Returns, in a Pbase,...
Definition: pnome-reduc.c:204
#define MINUS_OPERATOR_NAME
#define ORDERING_NUMBER(o)
#define ENTITY_LESS_THAN_P(e)
#define ORDERING_STATEMENT(o)
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
bool entity_register_p(entity e)
Definition: entity.c:766
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
Definition: entity.c:1380
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
Definition: expression.c:2012
basic simple_basic_dup(basic)
Definition: type.c:2735
basic MakeBasic(int)
END_EOLE.
Definition: type.c:128
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
Definition: variable.c:260
type entity_basic_concrete_type(entity)
retrieves or computes and then returns the basic concrete type of an entity
Definition: type.c:3677
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
Definition: variable.c:592
bool is_inferior_basic(basic, basic)
bool is_inferior_basic(basic1, basic2) return true if basic1 is less complex than basic2 ex: int is l...
Definition: type.c:2687
#define type_functional_p(x)
Definition: ri.h:2950
#define value_tag(x)
Definition: ri.h:3064
#define loop_body(x)
Definition: ri.h:1644
@ is_basic_int
Definition: ri.h:571
#define transformer_undefined
Definition: ri.h:2847
#define loop_execution(x)
Definition: ri.h:1648
#define basic_complex_p(x)
Definition: ri.h:626
#define basic_int_p(x)
Definition: ri.h:614
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define call_function(x)
Definition: ri.h:709
#define reference_variable(x)
Definition: ri.h:2326
#define range_upper(x)
Definition: ri.h:2290
#define instruction_loop(x)
Definition: ri.h:1520
#define statement_ordering(x)
Definition: ri.h:2454
#define sizeofexpression_expression(x)
Definition: ri.h:2409
#define syntax_cast(x)
Definition: ri.h:2739
#define instruction_goto(x)
Definition: ri.h:1526
#define test_false(x)
Definition: ri.h:2837
#define basic_tag(x)
Definition: ri.h:613
#define type_variable(x)
Definition: ri.h:2949
#define basic_pointer_p(x)
Definition: ri.h:635
#define basic_derived_p(x)
Definition: ri.h:638
#define type_statement_p(x)
Definition: ri.h:2941
@ is_value_intrinsic
Definition: ri.h:3034
@ is_value_unknown
Definition: ri.h:3035
@ is_value_constant
Definition: ri.h:3033
@ is_value_code
Definition: ri.h:3031
@ is_value_symbolic
Definition: ri.h:3032
#define syntax_range(x)
Definition: ri.h:2733
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_application
Definition: ri.h:2697
@ is_syntax_cast
Definition: ri.h:2694
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_va_arg
Definition: ri.h:2698
@ is_syntax_reference
Definition: ri.h:2691
@ is_syntax_sizeofexpression
Definition: ri.h:2695
@ is_syntax_subscript
Definition: ri.h:2696
#define range_increment(x)
Definition: ri.h:2292
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define cast_expression(x)
Definition: ri.h:747
#define subscript_indices(x)
Definition: ri.h:2563
#define instruction_undefined
Definition: ri.h:1454
#define statement_label(x)
Definition: ri.h:2450
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_expression
Definition: ri.h:1478
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define type_void_p(x)
Definition: ri.h:2959
#define entity_name(x)
Definition: ri.h:2790
#define test_true(x)
Definition: ri.h:2835
#define reference_indices(x)
Definition: ri.h:2328
#define syntax_sizeofexpression(x)
Definition: ri.h:2742
#define sizeofexpression_expression_p(x)
Definition: ri.h:2407
#define syntax_call(x)
Definition: ri.h:2736
#define loop_label(x)
Definition: ri.h:1646
#define instruction_expression(x)
Definition: ri.h:1541
#define expression_undefined_p(x)
Definition: ri.h:1224
#define test_condition(x)
Definition: ri.h:2833
#define subscript_array(x)
Definition: ri.h:2561
#define instruction_whileloop(x)
Definition: ri.h:1523
#define range_lower(x)
Definition: ri.h:2288
#define whileloop_body(x)
Definition: ri.h:3162
#define statement_instruction(x)
Definition: ri.h:2458
#define syntax_undefined
Definition: ri.h:2676
#define instruction_call(x)
Definition: ri.h:1529
#define syntax_subscript(x)
Definition: ri.h:2745
#define loop_range(x)
Definition: ri.h:1642
#define call_arguments(x)
Definition: ri.h:711
#define instruction_test(x)
Definition: ri.h:1517
#define whileloop_condition(x)
Definition: ri.h:3160
#define basic_string_p(x)
Definition: ri.h:629
#define entity_type(x)
Definition: ri.h:2792
#define expression_syntax(x)
Definition: ri.h:1247
#define execution_parallel_p(x)
Definition: ri.h:1211
#define instruction_unstructured(x)
Definition: ri.h:1532
#define loop_index(x)
Definition: ri.h:1640
#define variable_basic(x)
Definition: ri.h:3120
#define basic_logical_p(x)
Definition: ri.h:620
#define basic_float_p(x)
Definition: ri.h:617
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
#define entity_initial(x)
Definition: ri.h:2796
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
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
transformer load_statement_precondition(statement)
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
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
void free_value_mappings(void)
Normal call to free the mappings.
Definition: value.c:1212
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define VECTEUR_NUL_P(v)
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_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51