PIPS
static_controlize.c
Go to the documentation of this file.
1 /*
2 
3  $Id: static_controlize.c 23470 2018-06-02 13:39:47Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 /* Name : static_controlize.c
28  * package : static_controlize
29  * Author : Arnauld LESERVOT
30  * Date : May 93
31  * Modified :
32  * Documents : "Implementation du Data Flow Graph dans Pips"
33  * Comments :
34  */
35 
36 /* Ansi includes */
37 #include <stdlib.h>
38 #include <stdio.h>
39 #include <stdlib.h>
40 #include <string.h>
41 
42 /* Newgen includes */
43 #include "genC.h"
44 #include "boolean.h"
45 
46 /* C3 includes */
47 #include "boolean.h"
48 #include "arithmetique.h"
49 #include "vecteur.h"
50 #include "contrainte.h"
51 #include "ray_dte.h"
52 #include "sommet.h"
53 #include "sg.h"
54 #include "sc.h"
55 #include "polyedre.h"
56 #include "properties.h"
57 #include "matrix.h"
58 
59 /* Pips includes */
60 #include "ri.h"
61 /* Types arc_label and vertex_label must be defined although they are
62  not used */
63 typedef void * arc_label;
64 typedef void * vertex_label;
65 #include "graph.h"
66 #include "paf_ri.h"
67 #include "database.h"
68 #include "ri-util.h"
69 #include "workspace-util.h"
70 #include "prettyprint.h"
71 #include "constants.h"
72 #include "misc.h"
73 #include "control.h"
74 #include "text-util.h"
75 #include "pipsdbm.h"
76 #include "resources.h"
77 #include "paf-util.h"
78 #include "static_controlize.h"
79 
80 /* Global Variables */
86 //static set io_functions_set;
88 
89 
90 /*=================================================================*/
91 /* static_control static_controlize_call( (call) c ) AL 05/93
92  * It computes now just a static-control assignement if it is
93  * an ASSIGN statement.
94  */
96 {
97  static_control sc;
98 
99  pips_debug( 3, "begin CALL\n");
100  pips_debug( 7,
101  "call : %s\n", entity_local_name( call_function(c) ) );
102  entity e = call_function(c);
103  tag tt;
104  if ((tt = value_intrinsic_p(entity_initial(e))))
105  {
106  sc = make_static_control(false,
108  /* _list_of_loop_dup(
109  Genclosing_loops ),*/
114  }
115  else
116  {
119 
120  sc = make_static_control(b,
122  /* _list_of_loop_dup(
123  Genclosing_loops ),*/
126  }
127  pips_debug( 3, "end CALL\n");
128  return sc;
129 }
130 
131 /*==================================================================*/
132 /* static_control static_controlize_loop( (loop) l )
133  * It computes the loop's static_control.
134  */
136 {
137  static_control sc;
138  expression low, up;
139 
140  pips_debug(3, "begin LOOP\n");
141 
142  low = range_lower( loop_range( l ) );
143  up = range_upper( loop_range( l ) );
146  if ( !constant_step_loop_p(l)
149  static_control_yes( sc ) = false;
150  }
153 
154  pips_debug(3, "end LOOP\n");
155  return( sc );
156 }
157 
158 
159 
160 
161 /*==================================================================*/
162 /* static_control static_controlize_forloop( (forloop) fl )
163  * It computes the forloop's static_control.
164  */
166 {
167  static_control sc;
168 
169  pips_debug(3, "begin FORLOOP\n");
170 
171 
173  static_control_yes( sc ) = false;
174 
176 
177  pips_debug(3, "end FORLOOP\n");
178  return( sc );
179 }
180 
181 /*==================================================================*/
182 /* static_control static_controlize_whileloop( (whileloop) l )
183  * It computes the whileloop's static_control.
184  */
186 {
187  static_control sc;
188 
189  pips_debug(3, "begin WHILELOOP\n");
190 
191 
193  static_control_yes( sc ) = false;
194 
196 
197  pips_debug(3, "end WHILELOOP\n");
198  return( sc );
199 }
200 
201 /*==================================================================*/
202 /* static_control static_controlize_statement((statement) s) AL 05/93
203  * Computes s's static_control
204  */
205 
206 // Global variables added in order to avoid changing the definition of several functions
208 
210 {
211  // Update of the list containing the variables assigned directly or indirectly by an array
213 
214  bool is_static = true, static_test = false;
216  static_control sc, sc1, sc2;
217  expression exp, exp1, exp2;
218 
219  pips_debug(3, "begin STATEMENT\n");
220  pips_debug(7, "statement_ordering = %zd \n", statement_ordering(s));
221 
222  switch(instruction_tag(inst))
223  {
224  case is_instruction_block :
225  {
226  FOREACH(STATEMENT, local_stmt, instruction_block(inst)) {
227  sc1 = static_controlize_statement( local_stmt );
228  SET_STATEMENT_MAPPING( Gstatic_control_map, local_stmt, sc1);
229  //printf("s=%p, sc=%p\n", local_stmt, sc1);
230  is_static = ( is_static && static_control_yes( sc1 ));
231  }
232  break;
233  }
234  case is_instruction_test :
235  {
236  test t = instruction_test(inst);
239 
240  /* We put condition under a normal disjunctive form */
243  //DK, don't change the structure of conditions
244  //test_condition( t ) = exp ;
245  static_test = true;
246  }
250  gen_remove( &Genclosing_tests, (void*) test_condition( t ));
251 
253  if ( (exp2 = sc_conditional(exp1, &Genclosing_loops)) ==
255  exp2 = exp1;
256  }
260  gen_remove( &Genclosing_tests, (void *) exp2 );
261  is_static = ( static_control_yes( sc1 )
262  && static_control_yes( sc2 )
263  && static_test );
264  break;
265  }
266  case is_instruction_loop :
267  {
268  loop the_loop = instruction_loop( inst );
271  sc1 = static_controlize_loop( the_loop );
272  is_static = static_control_yes( sc1 );
273  break;
274  }
276  {
277  forloop forl = instruction_forloop( inst );
280  sc1 = static_controlize_forloop( forl );
281  is_static = static_control_yes( sc1 );
282  break;
283  }
285  {
286  whileloop whilel = instruction_whileloop( inst );
289  sc1 = static_controlize_whileloop( whilel );
290  is_static = static_control_yes( sc1 );
291  break;
292  }
293  case is_instruction_call :
294  {
295  if (!(/*continue_statement_p(s) ||*/ declaration_statement_p(s)))
296  {
297  call the_call = instruction_call( inst);
299  is_static = static_control_yes(static_controlize_call( the_call ));
300  }
301  else
302  is_static = false;
303  if (!get_bool_property("STATIC_CONTROLIZE_ACROSS_USER_CALLS"))
304  {
307  is_static = false;
308  }
309  break;
310  }
311 
312  case is_instruction_goto :
313  {
314  pips_internal_error("No goto in code ressource\n");
315  is_static = false;
316  break;
317  }
319  {
320  is_static = true;
321  break;
322  }
324  {
325  unstructured local_un = instruction_unstructured( inst );
326  is_static =
328  break;
329  }
330  default :
331  {
332  pips_internal_error("Ill. instruction tag");
333  }
334  }
335  //if (!(continue_statement_p(s) || declaration_statement_p(s)))
336  sc = make_static_control(is_static,
340 
341  pips_debug(7,
342  " Returning static_control : \n bool : %s \n params : %s \n loops : %zd \n tests : %zd \n ",
343  ((is_static)?"TRUE":"FALSE"),
347  pips_debug(3, "end STATEMENT\n");
348 
349  return sc;
350 
351 }
352 
353 
354 /*==================================================================*/
355 /* static_control static_controlize_unstructered((unstructured) u) AL 05/93
356  * Computes an unstructured's static_control
357  */
359 unstructured u;
360 {
361  bool is_static = true;
362  list blocs = NIL;
364 
365  pips_debug(3, "begin UNSTRUCTURED\n");
367  blocs = gen_nreverse( blocs ) ;
368 
369  FOREACH(CONTROL, ctl, blocs) {
372  pips_assert("stmt is consistent", statement_consistent_p(stmt));
374  //fprintf(stdout, "stmt=%p, sharing=%p\n", stmt, sc);
375  is_static = is_static && static_control_yes( sc );
376  }
377 
378  gen_free_list(blocs);
379  ret_sc = make_static_control( is_static,
383 
384  pips_debug(7,
385 "\n Returning static_control : \n bool : %s \n params : %s \n loops : %zd \n tests : %zd \n ",
386  ((is_static)?"TRUE":"FALSE"),
390 
391  pips_debug(3, "end UNSTRUCTURED\n");
392  return( ret_sc );
393 }
394 
395 
396 
397  /* the following data structure describes an io intrinsic function: its
398  name */
399 
400 typedef struct IOIntrinsicDescriptor {
401  string name;
403 
405  {"WRITE"},
406  {"REWIND"},
407  {"BACKSPACE"},
408  {"OPEN"},
409  {"CLOSE"},
410  {"READ"},
411  {"BUFFERIN"},
412  {"BUFFEROUT"},
413  {"ENDFILE"},
414  {"INQUIRE"},
415  {IMPLIED_DO_NAME},
416 
417  {NULL}
418 };
419 
420 
421 /*=======================================================================*/
422 /* bool io_filter(st)
423  *
424  * Tests if the statement is a call to an IO function. In such a case, we
425  * put the statement inside a comment.
426  *
427  * AP, oct 9th 1995
428  */
429 
430 static bool io_filter(st)
431 statement st;
432 {
433  bool res_b;
434  instruction ins;
435 
436  res_b = true;
437  ins = statement_instruction(st);
438 
440  call ca = instruction_call(ins);
441  entity e = call_function(ca);
442 
443  /* There can be no statement inside a call, so gen_recurse() do not
444  need to go further. */
445  res_b = false;
446 
448  const char* s = entity_local_name(e);
450  bool found = false;
451 
452  while ((pid->name != NULL) && (!found)) {
453  if (strcmp(pid->name, s) == 0) {
454  char *comment;
455  statement stat;
456  list lstat;
457 
458  // BUG: missing overflow checks
459  comment = (char*) malloc(64);
460  sprintf(comment, "C %s\n",
461  words_to_string(Words_Call(ca, 0, true, true)));
462 
463  pips_assert("no buffer overflow", strlen(comment)<64);
464 
468  comment,
470  NIL, // No local declarations
471  NULL, // null or empty string...
473  lstat = CONS(STATEMENT, stat, NIL);
474 
476  /* Do not forget to move forbidden information associated with
477  block: */
479 
480  found = true;
481  }
482  pid += 1;
483  }
484  }
485  }
486 
487  return(res_b);
488 }
489 
490 
491 /*==================================================================*/
492 /* void static_controlize((char*) mod_name) AL 05/93
493  * Computes the static_control attached to module-name : mod_name.
494  */
495 bool static_controlize(string mod_name)
496 {
498  instruction mod_inst;
499  entity ent;
500  list formal_integers;
501  static_control sc;
502 
503  debug_on("STATIC_CONTROLIZE_DEBUG_LEVEL");
504 
505  ifdebug(2)
506  user_log("\n\n *** STATIC CONTROLIZE CODE for %s\n", mod_name);
507 
508  /*
509  * Set the current language
510  */
511  entity module = module_name_to_entity(mod_name);
512 
513 
515  if(value_code_p(mv)) {
516  code c = value_code(mv);
518  }
519 
520  Gcount_nsp = 0;
521  Gcount_nub = 0;
529 
530  ent = local_name_to_top_level_entity(mod_name);
532  formal_integers = sc_entity_to_formal_integer_parameters( ent );
533  pips_debug(7, "\n formal integers : %s \n",
534  print_structurals( formal_integers ));
535 
536  mod_stat = (statement) db_get_memory_resource(DBR_CODE, mod_name, true);
537 
538  mod_inst = statement_instruction( mod_stat );
539 
540  /* HAS TO BE REMOVED AS SOON AS POSSIBLE: as the IOs are not
541  treated as they would, all the instructions containing IOs are
542  put inside comments. AP, oct 9th 1995 */
544  /* Normalization of all loops */
545  /* Modification: loop_normalize_of_statement is used instead of */
546  /* loop_normalize_of_unstructured since we cannot ensure that */
547  /* mod_inst is an unstructured --11th Dec 1995, DB */
548 
549  /***
550  D.K desactivate the normalization of loops to preserve the
551  original code
552  */
553 
554  /*loop_normalize_of_statement(mod_stat,
555  Gforward_substitute_table,
556  &Genclosing_loops,
557  &Genclosing_tests,
558  &Gscalar_written_forward,
559  &Gcount_nlc);
560  */
561 
562 
563 
564 
565  /* The code has been modified, so the orderings are recomputed. */
567  verify_structural_parameters(formal_integers,
569 
572 
573  /* We compute the static control infos for each instruction. */
574  /* Same remark as before --DB */
575 
577  pips_assert("controlized statement mod_stat is consistent",
579  pips_assert("static_control sc is consistent",
581 
583 
585 
586  DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(mod_name), (char*) mod_stat);
587  DB_PUT_MEMORY_RESOURCE(DBR_STATIC_CONTROL, strdup(mod_name),
588  (char*) Gstatic_control_map);
589 
590  ifdebug(2)
591  user_log("\n\n *** STATIC CONTROLIZE CODE done\n");
592 
594 
595  debug_off();
596  // Reset of the assigned_var list after the phase is complete
598  assigned_var = NIL;
599 
600  return(true);
601 }
602 
603 /*==================================================================*/
604 
605 
606 
607 
608 
609 /*==================================================================*/
610 /* list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl,
611  * *swfl, int *Gcount_nlc) AL 04/93
612  *
613  * FI/SG Question: why change the loop index when it is not necessary?
614  * To have a uniform behavior when it is necessary?
615  */
616 list loop_normalize_of_loop( l, fst, ell, etl, swfl, Gcount_nlc)
617 loop l;
618 hash_table fst; /* forward substitute table */
619 list *ell, /* enclosing loops list */
620  *etl, /* enclosing tests list */
621  *swfl; /* scalar written forward list */
622 int *Gcount_nlc;
623 {
624  entity index, nlc_ent, max_ent;
625  expression rl, ru, ri, nub, nlc_exp, exp_plus;
626  expression nub2, nub3, index_exp, new_index_exp;
628  range lr;
630  statement end_stmt = statement_undefined;
631  list stmt_list = NIL;
632 
633  pips_debug(4, "begin LOOP\n");
634 
636  /* loop_body( l ) = make_block_with_stmt( loop_body( l ));*/
638  index = loop_index( l );
639 
640  /* If it is not a constant step, we just normalize the loop body */
641  if(!normalizable_loop_p(l)) {
642  ADD_ELEMENT_TO_LIST(*swfl, ENTITY, index);
643  (void) loop_normalize_of_statement(loop_body( l ), fst, ell,
644  etl, swfl, Gcount_nlc);
645  return( make_undefined_list() );
646  }
647 
648  lr = loop_range( l );
649  rl = range_lower( lr );
650  ru = range_upper( lr );
651  ri = range_increment( lr );
652 
653  /* new upper bound, or at least iteration count */
657  copy_expression(ru),
658  copy_expression(rl)),
659  copy_expression(ri)),
660  copy_expression(ri));
661  nub2 = copy_expression(nub);
662 
663  ADD_ELEMENT_TO_LIST( stmt_list, STATEMENT, before_stmt );
664 
665  /* Generate the new loop index and the new loop bounds */
666  nlc_ent = make_nlc_entity(Gcount_nlc);
667  ADD_ELEMENT_TO_LIST(*swfl, ENTITY, nlc_ent);
668  nlc_exp = make_entity_expression( nlc_ent, NIL);
669  loop_index( l ) = nlc_ent;
671  range_lower( lr ) = int_to_expression( 1 );
672  range_upper( lr ) = nub2;
673  }
674  else {
675  /* assume C */
676  range_lower( lr ) = int_to_expression( 0 );
678  int_to_expression(1));
679  }
680  range_increment( lr ) = int_to_expression( 1 );
681 
682  /* Generate the change of basis expression: the new index starts at
683  0 in C and 1 in Fortran:
684 
685  old_index = rl + (new_index * ri) // C
686 
687  old_index = rl + (new_index * ri) - ri // Fortran
688 
689  */
690  new_index_exp = make_op_exp(MULTIPLY_OPERATOR_NAME,
691  copy_expression(ri),
692  nlc_exp);
694  new_index_exp = make_op_exp(MINUS_OPERATOR_NAME,
695  new_index_exp,
696  copy_expression(ri));
697  }
698  new_index_exp = make_op_exp(PLUS_OPERATOR_NAME,
699  new_index_exp,
700  copy_expression(rl));
701  hash_put(fst, (char*) index, (char*) new_index_exp);
702 
703  /* Compute the value of the index when the loop is exited: exp_max */
704  nub3 = copy_expression( nub );
705  if ( expression_constant_p( nub3 )) {
706  int upper = expression_to_int( nub3 );
707  if ( upper > 0 )
708  /* nub3 is not used any longer */
709  exp_max = int_to_expression( upper );
710  }
711  else {
714  entity_domain);
715  /* FI: Why copy nub? it does not seem used anywhere else. */
716  exp_max = make_max_exp(max_ent, copy_expression( nub ),
717  int_to_expression( 0 ));
718  }
719  if ( exp_max == expression_undefined )
720  exp_plus = copy_expression( rl );
721  else
722  exp_plus = make_op_exp(PLUS_OPERATOR_NAME,
724  copy_expression( ri ),
725  exp_max),
726  copy_expression( rl ));
727  index_exp = make_entity_expression( index, NIL );
728  end_stmt = make_assign_statement(copy_expression(index_exp), exp_plus );
730 
731  loop_normalize_of_statement(loop_body(l), fst , ell, etl, swfl, Gcount_nlc);
732 
733  hash_del(fst, (char*) index );
734  pips_debug(4, "end LOOP\n");
735  return( stmt_list );
736 }
737 
738 
739 /*==================================================================*/
740 /* list loop_normalize_of_statement(statement s, hash_table fst, list
741  * *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement.
742  *
743  * Before walking down the statements, we forward-substitute the
744  * new-loop-counters on each type of statements.
745  * We then return a list of two statements to be put
746  * before and after statement 's'. These two new statements
747  * are generated by loops when they are treated.
748  * See document for more detail, section : "Normalisation des boucles".
749  */
751 statement s;
752 hash_table fst; /* forward substitute table */
753 list *ell, /* enclosing loops list */
754  *etl, /* enclosing tests list */
755  *swfl; /* scalar written forward list */
756 int *Gcount_nlc;
757 {
759  list return_list = NIL;
760 
761  pips_assert("statement s is consistent\n", statement_consistent_p(s));
762 
763  pips_debug(3, "begin STATEMENT\n");
764  return_list = make_undefined_list();
765 
766  switch(instruction_tag(inst))
767  {
768  case is_instruction_block :
769  {
770  list tail, head;
771 
772  tail = instruction_block(inst);
773  for(head = NIL ; tail != NIL; )
774  {
775  statement stmt, before_stmt, after_stmt;
776  list insert_stmt;
777 
778  stmt = STATEMENT(CAR(tail));
779  insert_stmt = loop_normalize_of_statement(stmt, fst, ell,
780  etl, swfl, Gcount_nlc);
781  before_stmt = STATEMENT(CAR( insert_stmt ));
782  after_stmt = STATEMENT(CAR(CDR( insert_stmt )));
783 
784  if( before_stmt != statement_undefined)
785  ADD_ELEMENT_TO_LIST( head, STATEMENT, before_stmt);
787  if (after_stmt != statement_undefined )
788  ADD_ELEMENT_TO_LIST( head, STATEMENT, after_stmt );
789 
790  tail = CDR(tail);
791  }
792  instruction_block(inst) = head;
793  break;
794  }
795  case is_instruction_test :
796  {
797  test t = instruction_test(inst);
798  (void) forward_substitute_in_exp(&test_condition(t), fst);
800  /*test_true(t) = make_block_with_stmt( test_true(t) );*/
802  /* test_false(t) = make_block_with_stmt( test_false(t) );*/
805  etl, swfl, Gcount_nlc);
807  etl, swfl, Gcount_nlc);
808  gen_remove(etl, (gen_chunk*) test_condition( t ));
809  break;
810  }
811  case is_instruction_loop :
812  {
814  ADD_ELEMENT_TO_LIST(*ell, LOOP, instruction_loop( inst ));
815  return_list = loop_normalize_of_loop(instruction_loop(inst), fst, ell,
816  etl, swfl, Gcount_nlc);
817  gen_remove(ell, (gen_chunk*) instruction_loop( inst ));
818  break;
819  }
820  case is_instruction_call :
821  {
822  (void) forward_substitute_in_call(&instruction_call(inst), fst);
824  etl, swfl);
825  break;
826  }
827  case is_instruction_goto : break;
829  {
831  etl, swfl, Gcount_nlc);
832  break;
833  }
834  default : pips_internal_error("Bad instruction tag");
835  }
836  pips_debug(3, "end STATEMENT\n");
837  return( return_list );
838 }
839 
840 
841 /*==================================================================*/
842 /* void loop_normalize_of_unstructured(unstructured u, fst): Normalization
843  * of an unstructured instruction.
844  */
845 void loop_normalize_of_unstructured(u, fst, ell, etl, swfl, Gcount_nlc)
846 unstructured u;
847 hash_table fst; /* forward substitute table */
848 list *ell, /* enclosing loops list */
849  *etl, /* enclosing tests list */
850  *swfl; /* scalar written forward list */
851 int *Gcount_nlc;
852 {
853  list blocs = NIL, lc;
854  list insert_stmts;
855 
856  pips_debug(2, "begin UNSTRUCTURED\n");
858  blocs = gen_nreverse( blocs ) ;
859 
860  for(lc = blocs; lc != NIL; lc = CDR(lc)) {
861  list head = NIL;
862  control ctl;
863  statement before_stmt, after_stmt, stmt;
864 
865  ctl = CONTROL(CAR( lc ));
866  stmt = control_statement( ctl );
867  insert_stmts = loop_normalize_of_statement(stmt, fst,
868  ell, etl,
869  swfl,
870  Gcount_nlc);
871  before_stmt = STATEMENT(CAR( insert_stmts ));
872  after_stmt = STATEMENT(CAR(CDR( insert_stmts )));
873 
874  if (!undefined_statement_list_p( insert_stmts )) {
875  if( before_stmt != statement_undefined)
876  ADD_ELEMENT_TO_LIST( head, STATEMENT, before_stmt );
878  if (after_stmt != statement_undefined )
879  ADD_ELEMENT_TO_LIST( head, STATEMENT, after_stmt );
880  /*stmt = make_block_with_stmt( stmt );*/
883  head = NIL;
884  }
885  }
886 
887  gen_free_list(blocs);
888  pips_debug(2, "end UNSTRUCTURED\n");
889 }
890 
void user_log(const char *format,...)
Definition: message.c:234
static_control make_static_control(bool a1, list a2, list a3, list a4)
Definition: paf_ri.c:655
bool static_control_consistent_p(static_control p)
Definition: paf_ri.c:628
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
bool statement_consistent_p(statement p)
Definition: ri.c:2195
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
Definition: ri.c:2222
synchronization make_synchronization_none(void)
Definition: ri.c:2424
list stmt_list
The "stmt_list" global variable is the list the assign statement of the program (with all fields empt...
Definition: adg_read_paf.c:144
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
string make_entity_fullname(const char *module_name, const char *local_name)
END_EOLE.
Definition: entity_names.c:230
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
static void comment(string_buffer code, spoc_hardware_type hw, dagvtx v, int stage, int side, bool flip)
Definition: freia_spoc.c:52
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
void * malloc(YYSIZE_T)
statement make_block_with_stmt_if_not_already(statement)
Build a statement block from a statement if not already a statement block.
Definition: statement.c:768
void control_map_get_blocs(control c, list *l)
Build recursively the list of all controls reachable from a control of an unstructured.
Definition: control.c:75
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
bool constant_step_loop_p(loop l)
Test if a loop has a constant step loop.
Definition: loop.c:733
list copy_loops(list ll)
Duplicate a loop list.
Definition: loop.c:826
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
#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 CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
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
statement make_assign_statement(expression, expression)
Definition: statement.c:583
bool statement_contains_user_call_p(statement)
Definition: statement.c:3939
statement make_continue_statement(entity)
Definition: statement.c:953
void fix_sequence_statement_attributes(statement)
Since blocks are not represented in Fortran, they cannot carry a label.
Definition: statement.c:2016
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
Definition: statement.c:224
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
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_warn_on_redefinition(void)
these function set the variable should_i_warn_on_redefinition to the value true or false
Definition: hash.c:183
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
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
Definition: expression.c:2453
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
void set_prettyprint_language_from_property(enum language_utype native)
set the prettyprint language according to the property PRETTYPRINT_LANGUAGE @description If the prope...
Definition: language.c:103
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
entity make_nlc_entity(int *Gcount_nlc)
================================================================
bool undefined_statement_list_p(list l)
=================================================================
expression make_max_exp(entity ent, expression exp1, expression exp2)
================================================================
void scalar_written_in_call(call the_call, list *ell, list *etl, list *swfl)
scalar_written_in_call((call) the_call) Detects and puts a scalar written in an assignement call,...
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
#define SET_STATEMENT_MAPPING(map, stat, val)
Definition: newgen-local.h:47
#define STATEMENT_ORDERING_UNDEFINED
mapping.h inclusion
Definition: newgen-local.h:35
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
@ hash_pointer
Definition: newgen_hash.h:32
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
int tag
TAG.
Definition: newgen_types.h:92
struct cons * list
Definition: newgen_types.h:106
#define static_control_yes(x)
Definition: paf_ri.h:753
#define static_control_undefined
Definition: paf_ri.h:727
static char * module
Definition: pips.c:74
list Words_Call(call obj, int precedence, bool leftmost, bool is_a_subroutine)
Definition: misc.c:2597
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
#define MAX_OPERATOR_NAME
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define STATEMENT_NUMBER_UNDEFINED
default values
#define IMPLIED_DO_NAME
Definition: ri-util-local.h:75
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define is_instruction_block
soft block->sequence transition
#define DIVIDE_OPERATOR_NAME
#define instruction_block(i)
#define MULTIPLY_OPERATOR_NAME
bool io_intrinsic_p(entity e)
rue is a statement s is an io intrinsic
Definition: entity.c:1655
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
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
entity entity_empty_label(void)
Definition: entity.c:1105
bool fortran_module_p(entity m)
Test if a module is in Fortran.
Definition: entity.c:2799
expression make_entity_expression(entity e, cons *inds)
Definition: expression.c:176
int expression_to_int(expression exp)
================================================================
Definition: expression.c:2205
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
Definition: expression.c:2012
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
Definition: expression.c:342
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
#define value_tag(x)
Definition: ri.h:3064
#define loop_body(x)
Definition: ri.h:1644
#define value_code_p(x)
Definition: ri.h:3065
#define LOOP(x)
LOOP.
Definition: ri.h:1606
#define call_function(x)
Definition: ri.h:709
#define range_upper(x)
Definition: ri.h:2290
#define value_intrinsic_p(x)
Definition: ri.h:3074
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define instruction_loop(x)
Definition: ri.h:1520
#define statement_ordering(x)
Definition: ri.h:2454
#define test_false(x)
Definition: ri.h:2837
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
@ is_value_intrinsic
Definition: ri.h:3034
#define CONTROL(x)
CONTROL.
Definition: ri.h:910
#define range_increment(x)
Definition: ri.h:2292
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define expression_undefined
Definition: ri.h:1223
@ 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_forloop
Definition: ri.h:1477
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define test_true(x)
Definition: ri.h:2835
#define value_code(x)
Definition: ri.h:3067
#define instruction_forloop(x)
Definition: ri.h:1538
#define loop_label(x)
Definition: ri.h:1646
#define test_condition(x)
Definition: ri.h:2833
#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 instruction_call(x)
Definition: ri.h:1529
#define loop_range(x)
Definition: ri.h:1642
#define call_arguments(x)
Definition: ri.h:711
#define control_statement(x)
Definition: ri.h:941
#define instruction_test(x)
Definition: ri.h:1517
#define code_language(x)
Definition: ri.h:792
#define language_tag(x)
Definition: ri.h:1590
#define forloop_body(x)
Definition: ri.h:1372
#define instruction_unstructured(x)
Definition: ri.h:1532
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
#define loop_index(x)
Definition: ri.h:1640
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
#define entity_initial(x)
Definition: ri.h:2796
char * strdup()
#define ifdebug(n)
Definition: sg.c:47
int Gcount_nlc
int Gcount_nsp
================================================================
int Gcount_nub
#define ENTITY_NOT
list loop_normalize_of_statement(statement s, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc)
=================================================================
static list Genclosing_tests
static list Gscalar_written_forward
void loop_normalize_of_unstructured(unstructured u, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc)
=================================================================
static_control static_controlize_unstructured(unstructured u)
=================================================================
list assigned_var
=================================================================
struct IOIntrinsicDescriptor IOIntrinsicDescriptor
the following data structure describes an io intrinsic function: its name
static_control static_controlize_whileloop(whileloop wl)
=================================================================
static_control static_controlize_forloop(forloop fl)
=================================================================
static_control static_controlize_call(call c)
================================================================
statement_mapping Gstatic_control_map
static list Genclosing_loops
static_control static_controlize_loop(loop l)
=================================================================
static bool io_filter(statement st)
======================================================================
static_control static_controlize_statement(statement s)
static hash_table Gforward_substitute_table
static IOIntrinsicDescriptor IOIntrinsicDescriptorTable[]
void * arc_label
Name : static_controlize.c package : static_controlize Author : Arnauld LESERVOT Date : May 93 Modifi...
void * vertex_label
list Gstructure_parameters
Global Variables
list loop_normalize_of_loop(loop l, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc)
=================================================================
bool static_controlize(string mod_name)
=================================================================
void forward_substitute_in_exp(expression *, hash_table)
Definition: utils.c:1148
list make_undefined_list(void)
================================================================
Definition: utils.c:815
list sc_list_of_exp_dup(list)
================================================================
Definition: utils.c:741
bool get_reference_assignments(statement, list *)
Allows the static_controlize phase to keep and update a list containing all the variables of the prog...
Definition: utils.c:1300
bool normalizable_loop_p(loop)
bool normalizable_loop_p(loop l) Returns true if "l" has a constant step.
Definition: utils.c:1172
expression sc_conditional(expression, list *)
================================================================
Definition: utils.c:596
bool sp_feautrier_expression_p(expression)
================================================================
Definition: utils.c:995
list sc_list_of_loop_dup(list)
================================================================
Definition: utils.c:778
string print_structurals(list)
================================================================
Definition: utils.c:732
list sc_list_of_entity_dup(list)
================================================================
Definition: utils.c:761
void forward_substitute_in_call(call *, hash_table)
Definition: utils.c:1157
void verify_structural_parameters(list, list *)
================================================================
Definition: utils.c:873
bool splc_linear_access_to_arrays_p(list, list *)
================================================================
Definition: utils.c:700
void forward_substitute_in_anyloop(void *, hash_table)
Definition: utils.c:1139
bool splc_feautrier_expression_p(expression, list *)
================================================================
Definition: utils.c:962
int stco_renumber_code(statement, int)
================================================================
Definition: utils.c:137
list sc_entity_to_formal_integer_parameters(entity)
================================================================
Definition: utils.c:900
the following data structure describes an io intrinsic function: its name
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: statement.c:54
string words_to_string(cons *lw)
Definition: print.c:211
A gen_chunk is used to store every object.
Definition: genC.h:58
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207