PIPS
partial_redundancy_elimination.c
Go to the documentation of this file.
1 /*
2 
3  $Id: partial_redundancy_elimination.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25 // do not compile unless required
26 #include "phases.h"
27 #ifdef BUILDER_PARTIAL_REDUNDANCY_ELIMINATION
28 
29 #ifdef HAVE_CONFIG_H
30  #include "pips_config.h"
31 #endif
32 /******************************************************************
33  *
34  *
35  * PARTIAL REDUNDANCY ELIMINATION
36  *
37  *
38  *******************************************************************/
39 
40 #include <stdio.h>
41 #include <string.h>
42 
43 #include "genC.h"
44 #include "linear.h"
45 
46 #include "pipsdbm.h"
47 #include "misc.h"
48 
49 #include "effects.h"
50 #include "ri.h"
51 #include "ri-util.h"
52 #include "prettyprint.h" // for debugging
53 
54 #include "control.h" // module_reorder
55 #include "expressions.h" // stmt_prec
56 
57 #include "semantics.h" // for module_to_value_mappings()
58 
59 #include "dg.h"
60 typedef dg_arc_label arc_label;
62 #include "graph.h"
63 #include "ricedg.h" // sc_restricted_to_variables_transitive_closure
64 
65 
66 /* Statistic variables: */
67 static int number_of_simplified_expressions;
68 static int number_of_simplified_assign_expressions;
69 static int number_of_simplified_if_conditions;
70 static int number_of_false_while_conditions;
71 static int number_of_false_if_conditions;
72 static int number_of_true_if_conditions;
73 
74 static void initialize_partial_redundancy_elimination_statistics(void)
75 {
76  number_of_simplified_expressions = 0;
77  number_of_simplified_assign_expressions = 0;
78  number_of_simplified_if_conditions = 0;
79  number_of_false_while_conditions = 0;
80  number_of_false_if_conditions = 0;
81  number_of_true_if_conditions = 0;
82 }
83 
84 static void display_partial_redundancy_elimination_statistics(void)
85 {
86  number_of_simplified_expressions =
87  number_of_simplified_assign_expressions +
88  number_of_false_while_conditions +
89  number_of_simplified_if_conditions;
90 
91  if (number_of_simplified_expressions > 0)
92  {
93  user_log("* There %s %d simplified expression%s including :*\n",
94  number_of_simplified_expressions > 1 ? "are" : "is",
95  number_of_simplified_expressions ,
96  number_of_simplified_expressions > 1 ? "s" : "");
97  }
98  if (number_of_simplified_assign_expressions > 0)
99  {
100  user_log("*\t %d simplified assign expression%s *\n",
101  number_of_simplified_assign_expressions ,
102  number_of_simplified_assign_expressions > 1 ? "s" : "");
103  }
104  if (number_of_simplified_expressions > 0)
105  {
106  user_log("*\t %d simplified if condition%s *\n",
107  number_of_simplified_if_conditions ,
108  number_of_simplified_if_conditions > 1 ? "s" : "");
109  }
110  if (number_of_false_while_conditions > 0)
111  {
112  user_log("*\t %d false while loop condition%s *\n",
113  number_of_false_while_conditions,
114  number_of_false_while_conditions > 1 ? "s" : "");
115  }
116  if (number_of_false_if_conditions > 0)
117  {
118  user_log("* There %s %d if statement%s with false condition *\n",
119  number_of_false_if_conditions > 1 ? "are" : "is",
120  number_of_false_if_conditions,
121  number_of_false_if_conditions > 1 ? "s" : "");
122  }
123  if (number_of_true_if_conditions > 0)
124  {
125  user_log("* There %s %d if statement%s with true condition *\n",
126  number_of_true_if_conditions > 1 ? "are" : "is",
127  number_of_true_if_conditions,
128  number_of_true_if_conditions > 1 ? "s" : "");
129  }
130 }
131 
132 /* should be moved to linear. FC.
133  * returns whether ineq is redundant or not wrt prec.
134  * how : first fast check, then actual feasibility.
135  * default to feasible
136  This function removes all the inequalities
137  with big coefficient (> MAXCOEFFICIENT) in the system to avoid overflow */
138 
139 static bool all_variables_in_precondition(Pvecteur v, Psysteme p)
140 {
141  Pbase b = p->base;
142  Pvecteur vec;
143  for (vec = v; vec != NULL; vec = vec->succ)
144  {
145  Variable var = vec->var;
146  if ((var !=TCST) && (!base_contains_variable_p(b,var)))
147  return false;
148  }
149  return true;
150 }
151 
152 static expression
153 partial_redundancy_elimination_expression(expression e, Psysteme prec)
154 {
156  {
157  /* Treat all possible cases :
158  e1 < e2, e1 <= e2, e1 >= e2, e1 > e2, e1.EQ.e2, e1.NE.e2
159  .NOT.e1, e1.AND.e2, e1.OR.e2, e1.EQV.e2, e1.NEQV.e2, */
162  expression e1 = EXPRESSION(CAR(args));
164  if (!ENDP(CDR(args)))
165  /* if op = .NOT. => there is only one argument e1*/
166  e2 = EXPRESSION(CAR(CDR(args)));
167  ifdebug(2)
168  {
169  fprintf(stderr, " Logical expression to be simplified:");
170  print_expression(e);
171  fprintf(stderr, " \n with precondition : ");
172  sc_fprint(stderr,prec, (char * (*)(Variable)) entity_local_name);
173  }
175  {
176  /* Fast check : check if e is trivial true or FALSE
177  * Slow check : see if e is true or false wrt the precondition prec
178  * if (e + prec = infeasible) => e = false
179  * if (NOT(e) + prec = infeasible) => e = TRUE
180  * if not => no conclusion, return e itself
181  *
182  * ATTENTION : to calcul the feasibility or not of a system of contrainsts
183  * this function uses the function:
184  * sc_rational_feasibility_ofl_ctrl(sc, ofl_ctrl, ofl_res) in which:
185  *
186  * ofl_ctrl = OFL_CTRL means that the overflows are treated in the
187  * called procedure (sc_rational_feasibility_ofl_ctrl())
188  *
189  * ofl_res = true means that if the overflows occur, function
190  * sc_rational_feasibility_ofl_ctrl will return the value TRUE
191  * we have no conclusion : retour = copy_expression (e)
192  *
193  * The function sc_rational_feasibility_ofl_ctrl() is less expensive
194  * than the function sc_integer_feasibility_ofl_ctrl()
195  *
196  * 4 December 2000 : I (Nga Nguyen) try to replace sc_rational
197  * by sc_integer ===> re-measure the speed
198  * But maybe sc_integer is suitable for PRE because our goal is to
199  * reduce the number of array bound check as much as possible ?
200  */
204  {
205  Pvecteur v1 = normalized_linear(n1);
206  Pvecteur v2 = normalized_linear(n2);
207  Pvecteur v = vect_substract(v1,v2);
208  Pvecteur v_one = vect_new(TCST,1);
209  ifdebug(2)
210  {
211  fprintf(stderr, "\n Relational expression and linear normalizations: ");
212  print_expression(e);
213  }
214  /* If there exists a variable belonging to e but not to Prec
215  => we can not simplify e => stop*/
216  if (all_variables_in_precondition(v,prec))
217  {
218  ifdebug(2)
219  {
220  fprintf(stderr, "\n All variables are in the base of the precondition: ");
221  vect_fprint(stderr,v, (char * (*)(Variable)) entity_local_name);
222  }
223  /* The normal form of a vecteur is :
224  * a x + b <= 0 (inegalite)
225  * a x + b == 0 (egalite)
226  * So we have to transform an expression to the normal form,
227  * depending on the operator of the expression (op= {<=,<,>=,>,==,!=})
228  *
229  * Before checking the feasibility of the 2 following cases,
230  * we do a fast and trivial check if the vector is constant.
231  * + Normal form of the expression e
232  * + Normal form of the negation expression of the expression e */
233  if (ENTITY_NON_EQUAL_P(op))
234  {
235  /* Initial expression : v != 0
236  * Form + : v + 1 <= 0 || -v + 1 <= 0
237  * Negation : v == 0
238  * Form - : v == 0 */
239  if (vect_constant_p(v))
240  {
241  if (VECTEUR_NUL_P(v) || value_zero_p(val_of(v))) return make_false_expression();
242  if (value_notzero_p(val_of(v))) return make_true_expression();
243  }
244  else
245  {
246  Psysteme prec_dup = sc_dup(prec);
247  sc_constraint_add(prec_dup,contrainte_make(v),true);
248  if (!sc_integer_feasibility_ofl_ctrl(prec_dup, OFL_CTRL,true))
249  {
250  /* Not e + prec = infeasible => e = TRUE*/
251  sc_rm(prec_dup);
252  return make_true_expression();
253  }
254  else
255  {
256  Pvecteur v_1 = vect_add(v,v_one);
257  Pvecteur v_temp = vect_multiply(vect_dup(v),-1);
258  Pvecteur v_2 = vect_add(v_temp,v_one);
259  sc_rm(prec_dup);
262  /* e + prec = infeasible => e = FALSE*/
263  return make_false_expression();
264  }
265  }
266  }
267  if (ENTITY_EQUAL_P(op))
268  {
269  /* Initial expression : v == 0
270  * Form + : v == 0
271  * Negation : v != 0
272  * Form - : v + 1 <= 0 || -v + 1 <= 0*/
273  if (vect_constant_p(v))
274  {
275  if (VECTEUR_NUL_P(v) || value_zero_p(val_of(v))) return make_true_expression();
276  if (value_notzero_p(val_of(v))) return make_false_expression();
277  }
278  else
279  {
280  Psysteme prec_dup = sc_dup(prec);
281  sc_constraint_add(prec_dup,contrainte_make(v),true);
282  /* for union5.f, sc_rational_feasibility can not eliminate the second test
283  * it works with sc_integer_feasibility */
284  if (!sc_integer_feasibility_ofl_ctrl(prec_dup, OFL_CTRL,true))
285  {
286  /* e + prec = infeasible => e = FALSE*/
287  sc_rm(prec_dup);
288  return make_false_expression();
289  }
290  else
291  {
292  Pvecteur v_1 = vect_add(v,v_one);
293  Pvecteur v_temp = vect_multiply(vect_dup(v),-1);
294  Pvecteur v_2 = vect_add(v_temp,v_one);
295  sc_rm(prec_dup);
298  /* Not e + prec = infeasible => e = TRUE*/
299  return make_true_expression();
300  }
301  }
302  }
304  {
305  /* Initial expression : v >= 0
306  * Form + : -v <= 0
307  * Negation : v <= -1
308  * Form - : v + 1 <= 0*/
309  if (vect_constant_p(v))
310  {
311  if (VECTEUR_NUL_P(v) || value_posz_p(val_of(v)) ) return make_true_expression();
312  if (value_neg_p(val_of(v))) return make_false_expression();
313  }
314  else
315  {
316  Pvecteur v_1 = vect_multiply(vect_dup(v),-1);
317  Pvecteur v_2 = vect_add(v,v_one);
319  /* e + prec = infeasible => e = FALSE*/
320  return make_false_expression();
322  /* Not e + prec = infeasible => e = TRUE*/
323  return make_true_expression();
324  }
325  }
326  if (ENTITY_LESS_OR_EQUAL_P(op))
327  {
328  /* Initial expression : v <= 0
329  * Form + : v <= 0
330  * Negation : v >= 1
331  * Form - : -v + 1 <= 0*/
332  if (vect_constant_p(v))
333  {
334  if (VECTEUR_NUL_P(v) || value_negz_p(val_of(v))) return make_true_expression();
335  if (value_pos_p(val_of(v))) return make_false_expression();
336  }
337  else
338  {
339  Pvecteur v_1 = vect_dup(v);
340  Pvecteur v_temp = vect_multiply(vect_dup(v),-1);
341  Pvecteur v_2 = vect_add(v_temp,v_one);
343  /* e + prec = infeasible => e = FALSE*/
344  return make_false_expression();
346  /* Not e + prec = infeasible => e = TRUE*/
347  return make_true_expression();
348  }
349  }
350  if (ENTITY_LESS_THAN_P(op))
351  {
352  /* Initial expression : v < 0
353  * Form + : v +1 <= 0
354  * Negation : v >= 0
355  * Form - : -v <= 0*/
356  if (vect_constant_p(v))
357  {
358  if (VECTEUR_NUL_P(v) || value_posz_p(val_of(v)) ) return make_false_expression();
359  if (value_neg_p(val_of(v))) return make_true_expression();
360  }
361  else
362  {
363  Pvecteur v_1 = vect_add(v,v_one);
364  Pvecteur v_2 = vect_multiply(vect_dup(v),-1);
366  /* e + prec = infeasible => e = FALSE*/
367  return make_false_expression();
369  /* Not e + prec = infeasible => e = TRUE*/
370  return make_true_expression();
371  }
372  }
373  if (ENTITY_GREATER_THAN_P(op))
374  {
375  /* Initial expression : v > 0
376  * Form + : -v + 1 <= 0
377  * Negation : v <= 0
378  * Form - : v <= 0*/
379  if (vect_constant_p(v))
380  {
381  if (VECTEUR_NUL_P(v) || value_negz_p(val_of(v)) ) return make_false_expression();
382  if (value_pos_p(val_of(v))) return make_true_expression();
383  }
384  else
385  {
386  Pvecteur v_temp = vect_multiply(vect_dup(v),-1);
387  Pvecteur v_1 = vect_add(v_temp,v_one);
388  Pvecteur v_2 = vect_dup(v);
390  /* e + prec = infeasible => e = FALSE*/
391  return make_false_expression();
393  /* Not e + prec = infeasible => e = TRUE*/
394  return make_true_expression();
395  }
396  }
397  }
398  }
399  }
400  else if (logical_operator_expression_p(e))
401  {
402  if (ENTITY_NOT_P(op))
403  {
404  expression retour1 = partial_redundancy_elimination_expression(e1,prec);
405  if (true_expression_p(retour1)) return make_false_expression();
406  if (false_expression_p(retour1)) return make_true_expression();
407  return not_expression(retour1);
408  }
409  if (ENTITY_AND_P(op))
410  {
411  expression retour1 = partial_redundancy_elimination_expression(e1,prec);
412  expression retour2 = partial_redundancy_elimination_expression(e2,prec);
413  if (false_expression_p(retour1) || false_expression_p(retour2))
414  return make_false_expression();
415  if (true_expression_p(retour1)) return retour2;
416  if (true_expression_p(retour2)) return retour1;
417  return and_expression(retour1,retour2);
418  }
419  if (ENTITY_OR_P(op))
420  {
421  expression retour1= partial_redundancy_elimination_expression(e1,prec);
422  expression retour2= partial_redundancy_elimination_expression(e2,prec);
423  ifdebug(2)
424  {
425  fprintf(stderr, " Simplified OR expression: retour1 + retour2");
426  print_expression(retour1);
427  print_expression(retour2);
428  }
429  if (true_expression_p(retour1) || true_expression_p(retour2))
430  return make_true_expression();
431  if (false_expression_p(retour1)) return retour2;
432  if (false_expression_p(retour2)) return retour1;
433  return or_expression(retour1,retour2);
434  }
435  if (ENTITY_EQUIV_P(op))
436  {
437  expression retour1 = partial_redundancy_elimination_expression(e1,prec);
438  expression retour2 = partial_redundancy_elimination_expression(e2,prec);
439  if ((true_expression_p(retour1) && true_expression_p(retour2)) ||
440  (false_expression_p(retour1) && false_expression_p(retour2)) )
441  return make_true_expression();
442  if ((true_expression_p(retour1) && false_expression_p(retour2)) ||
443  (false_expression_p(retour1) && true_expression_p(retour2)) )
444  return make_false_expression();
445  return binary_intrinsic_expression(EQUIV_OPERATOR_NAME, retour1, retour2);
446  }
447  if (ENTITY_NON_EQUIV_P(op))
448  {
449  expression retour1 = partial_redundancy_elimination_expression(e1,prec);
450  expression retour2 = partial_redundancy_elimination_expression(e2,prec);
451  if ((true_expression_p(retour1) && true_expression_p(retour2)) ||
452  (false_expression_p(retour1) && false_expression_p(retour2)) )
453  return make_false_expression();
454  if ((true_expression_p(retour1) && false_expression_p(retour2)) ||
455  (false_expression_p(retour1) && true_expression_p(retour2)) )
456  return make_true_expression();
457  return binary_intrinsic_expression(NON_EQUIV_OPERATOR_NAME, retour1, retour2);
458  }
459  }
460  }
461  /* return e itself if the expression e can not be simplified */
462  return copy_expression(e);
463 }
464 
465 static void
466 partial_redundancy_elimination_rwt(statement s,
468 {
469  Psysteme prec = stmt_prec(s);
470  if (!sc_empty_p(prec) && !sc_rn_p(prec))
471  {
472  /* Else : P = False (dead code) => all tests in s are redundant
473  or P = True, we can not simplify anything */
475  tag t = instruction_tag(i);
476  switch(t)
477  {
478  case is_instruction_call:
479  {
480  call c = instruction_call(i);
481  entity func = call_function(c);
482  if (strcmp(entity_local_name(func),ASSIGN_OPERATOR_NAME)==0)
483  {
484  list args = call_arguments(c);
485  expression e = EXPRESSION(CAR(CDR(args)));
486  if (logical_expression_p(e))
487  {
488  expression retour = partial_redundancy_elimination_expression(e,prec);
489  ifdebug(3)
490  {
491  fprintf(stderr, " Assign statement with logical expression:");
492  print_statement(s);
493  fprintf(stderr, " \n with non empty / not true precondition : ");
494  sc_fprint(stderr,prec, (char * (*)(Variable)) entity_local_name);
495  }
496  if (!expression_equal_p(retour,e))
497  {
498  /* e is simplified, replace e by retour in the call c*/
500  copy_expression(retour));
503  number_of_simplified_assign_expressions++;
504  }
505  }
506  }
507  break;
508  }
510  {
513  expression retour = partial_redundancy_elimination_expression(e,prec);
514  ifdebug(3)
515  {
516  fprintf(stderr, " Whileloop statement:");
517  print_statement(s);
518  fprintf(stderr, " \n with non empty / not true precondition : ");
519  sc_fprint(stderr,prec, (char * (*)(Variable)) entity_local_name);
520  }
521  /* Try to simplify the whileloop's condition
522  if (retour=.FALSE.) then
523  eliminate this while loop (a trivial case of dead code elimination)
524  else keep the loop */
525  if (false_expression_p(retour))
526  {
527  number_of_false_while_conditions++;
528  // free_instruction(statement_instruction(s));
531  }
532  break;
533  }
534  case is_instruction_test:
535  {
536  test it = instruction_test(i);
537  expression e = test_condition(it);
538  expression retour = partial_redundancy_elimination_expression(e,prec);
539  ifdebug(3)
540  {
541  fprintf(stderr, " Test statement:");
542  print_statement(s);
543  fprintf(stderr, " Simplified expression:");
544  print_expression(retour);
545  fprintf(stderr, " \n with non empty / not true precondition : ");
546  sc_fprint(stderr,prec, (char * (*)(Variable)) entity_local_name);
547  }
548  if (!expression_equal_p(retour,e))
549  {
550  number_of_simplified_if_conditions++;
551  /* the test's condition e is simplified,
552  + if (retour=.FALSE.) then delete the test and its true branch
553  + if (retour=.TRUE.) then delete the test and its false branch
554  (a trivial case of dead code elimination)
555  + otherwise, replace e by retour.
556 
557  Attention : in the unstructured case, the test it has
558  2 successors, we need to remove the dead control link for the
559  first two cases (true branch or false branch is dead) */
560 
561  if (false_expression_p(retour))
562  {
563  // the true branch is dead
564  number_of_false_if_conditions++;
566  {
567  // unstructured case
569  if (!ENDP(CDR(control_successors(c))))
570  {
571  control true_control = CONTROL(CAR(control_successors(c)));
572  control false_control = CONTROL(CAR(CDR(control_successors(c))));
573  // remove the link to the THEN control node
574  gen_remove(&control_successors(c),true_control);
575  gen_remove(&control_predecessors(true_control),c);
576  // replace c by false_control as successor of each predecessor of c
577  MAP(CONTROL, co,
578  {
579  MAPL(lc,
580  {
581  if (CONTROL(CAR(lc))==c)
582  CONTROL_(CAR(lc)) = false_control;
583  }, control_successors(co));
584  },control_predecessors(c));
585  }
586  }
587  else
588  {
589  //structured case
592  }
593  }
594  else
595  if (true_expression_p(retour))
596  {
597  // the false branch is dead
598  number_of_true_if_conditions++;
600  {
601  // unstructured case
603  if (!ENDP(CDR(control_successors(c))))
604  {
605  control false_control = CONTROL(CAR(CDR(control_successors(c))));
606  control true_control = CONTROL(CAR(control_successors(c)));
607  // remove the link to the ELSE control node
608  gen_remove(&control_successors(c),false_control);
609  gen_remove(&control_predecessors(false_control),c);
610  // replace c by true_control as successor of each predecessor of c
611  MAP(CONTROL, co,
612  {
613  MAPL(lc,
614  {
615  if (CONTROL(CAR(lc))==c)
616  CONTROL_(CAR(lc)) = true_control;
617  }, control_successors(co));
618  },control_predecessors(c));
619  }
620  }
621  else
622  {
623  //structured case
626  }
627  }
628  else
629  {
630  test new = make_test(copy_expression(retour),
635  }
636  }
637  break;
638  }
640  case is_instruction_loop:
642  break;
643  default:
644  pips_internal_error("Unexpected instruction tag %d ", t );
645  break;
646  }
647  }
648 }
649 
651 {
653  return true;
654 }
655 
656 static void
657 partial_redundancy_elimination_statement(statement module_statement)
658 {
663  statement_domain, gen_true, partial_redundancy_elimination_rwt,
664  NULL);
666 }
667 
668 
669 /* This transformation may be used to reduce the number of logical
670  expressions generated by array_bound_check.
671 
672  Logical expressions such as the condition in: IF (1.LE.I .AND.I.LE.N)
673  THEN ... are simplified if {1>I } can be proved false wrt the
674  precondition. So the simplified test is: IF (1.LE.N) THEN ....
675 
676  Logical assignment statement such as: FLAG =
677  (A+B).GT.C.AND.(B+C).GT.A.AND.(C+A).GT.B where we have (C+A).LE.B will
678  be FLAG = .FALSE.
679 
680  If test conditions are simplified to true or false, the test statement
681  is replaced by the true or the false branch right away to avoid a
682  re-computation of transformers and preconditions. FORMAT statements in
683  the eliminated branch are preserved by moving them in the remaining
684  statement. Some FORMAT statements may become useless but this is not
685  tested.
686 
687  If a WHILE condition is simplified to false, the WHILE is eliminated.
688 
689  @param[in] module_name is the name of the module we want to apply
690  partial_redundancy_elimination on
691 
692  @return true since we are confident that everything goes fine
693  */
695 {
700 
703  db_get_memory_resource(DBR_PRECONDITIONS,
704  module_name,
705  true));
706  debug_on("PARTIAL_REDUNDANCY_ELIMINATION_DEBUG_LEVEL");
707  ifdebug(1){
708  debug(1, "Partial redundancy elimination for logical expressions","Begin for %s\n", module_name);
709  pips_assert("Statement is consistent ...", statement_consistent_p(module_statement));
710  }
711  initialize_partial_redundancy_elimination_statistics();
712  partial_redundancy_elimination_statement(module_statement);
713  display_partial_redundancy_elimination_statistics();
715  ifdebug(1){
716  pips_assert("Statement is consistent ...", statement_consistent_p(module_statement));
717  debug(1, "Partial redundancy elimination","End for %s\n", module_name);
718  }
719  debug_off();
725  return true;
726 }
727 
728 #endif // BUILDER_PARTIAL_REDUNDANCY_ELIMINATION
void user_log(const char *format,...)
Definition: message.c:234
instruction copy_instruction(instruction p)
INSTRUCTION.
Definition: ri.c:1115
persistant_statement_to_control make_persistant_statement_to_control(void)
Definition: ri.c:1594
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
statement copy_statement(statement p)
STATEMENT.
Definition: ri.c:2186
bool statement_consistent_p(statement p)
Definition: ri.c:2195
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
control apply_persistant_statement_to_control(persistant_statement_to_control f, statement k)
Definition: ri.c:1597
void free_instruction(instruction p)
Definition: ri.c:1118
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
bool bound_persistant_statement_to_control_p(persistant_statement_to_control f, statement k)
Definition: ri.c:1609
void extend_persistant_statement_to_control(persistant_statement_to_control f, statement k, control v)
Definition: ri.c:1603
void free_persistant_statement_to_control(persistant_statement_to_control p)
Definition: ri.c:1561
dg_vertex_label vertex_label
Definition: delay.c:64
dg_arc_label arc_label
Definition: delay.c:63
static statement module_statement
Definition: alias_check.c:125
#define value_pos_p(val)
#define value_notzero_p(val)
#define value_negz_p(val)
#define value_zero_p(val)
#define value_neg_p(val)
#define value_posz_p(val)
static bool store_mapping(control c, bottom_up_abc_context_p context)
bool base_contains_variable_p(Pbase b, Variable v)
bool base_contains_variable_p(Pbase b, Variable v): returns true if variable v is one of b's elements...
Definition: base.c:136
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
bool vect_constant_p(Pvecteur)
bool vect_constant_p(Pvecteur v): v contains only a constant term, may be zero
Definition: predicats.c:211
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
Psysteme stmt_prec(statement)
Definition: partial_eval.c:230
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
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
Definition: genClib.c:3373
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
instruction make_assign_instruction(expression l, expression r)
Definition: instruction.c:87
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
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
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#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
#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
statement update_statement_instruction(statement, instruction)
Replace the instruction in statement s by instruction i.
Definition: statement.c:3039
void fix_sequence_statement_attributes(statement)
Since blocks are not represented in Fortran, they cannot carry a label.
Definition: statement.c:2016
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
Definition: io.c:124
#define debug_on(env)
Definition: misc-local.h:157
#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
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
int tag
TAG.
Definition: newgen_types.h:92
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
Definition: expression.c:58
void print_statement(statement)
Print a statement on stderr.
Definition: statement.c:98
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
#define ENTITY_OR_P(e)
#define ENTITY_AND_P(e)
#define ENTITY_NON_EQUAL_P(e)
#define ENTITY_EQUAL_P(e)
#define EQUIV_OPERATOR_NAME
#define ENTITY_LESS_THAN_P(e)
#define NORMALIZE_EXPRESSION(e)
#define NON_EQUIV_OPERATOR_NAME
#define and_expression(e1, e2)
#define ENTITY_NOT_P(e)
#define binary_intrinsic_expression(name, e1, e2)
#define ENTITY_GREATER_THAN_P(e)
#define ENTITY_NON_EQUIV_P(e)
#define not_expression(e)
#define ENTITY_LESS_OR_EQUAL_P(e)
#define ENTITY_GREATER_OR_EQUAL_P(e)
#define or_expression(e1, e2)
#define ASSIGN_OPERATOR_NAME
Definition: ri-util-local.h:95
#define ENTITY_EQUIV_P(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
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
bool false_expression_p(expression e)
Definition: expression.c:1118
bool logical_operator_expression_p(expression e)
C xor is missing.
Definition: expression.c:573
bool true_expression_p(expression e)
Definition: expression.c:1113
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
Definition: expression.c:1347
bool logical_expression_p(expression e)
Definition: expression.c:610
expression make_false_expression()
Definition: expression.c:1108
bool relational_expression_p(expression e)
Definition: expression.c:587
expression make_true_expression()
Definition: expression.c:1103
#define CONTROL_(x)
Definition: ri.h:913
#define normalized_linear_p(x)
Definition: ri.h:1779
#define call_function(x)
Definition: ri.h:709
#define control_predecessors(x)
Definition: ri.h:943
#define test_false(x)
Definition: ri.h:2837
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define control_domain
newgen_controlmap_domain_defined
Definition: ri.h:98
#define CONTROL(x)
CONTROL.
Definition: ri.h:910
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define expression_undefined
Definition: ri.h:1223
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_sequence
Definition: ri.h:1469
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define test_true(x)
Definition: ri.h:2835
#define syntax_call(x)
Definition: ri.h:2736
#define control_successors(x)
Definition: ri.h:945
#define test_condition(x)
Definition: ri.h:2833
#define instruction_whileloop(x)
Definition: ri.h:1523
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#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 whileloop_condition(x)
Definition: ri.h:3160
#define normalized_linear(x)
Definition: ri.h:1781
#define expression_syntax(x)
Definition: ri.h:1247
bool sc_rn_p(Psysteme sc)
bool sc_rn_p(Psysteme sc): check if the set associated to sc is the whole space, rn
Definition: sc_alloc.c:369
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Definition: sc_alloc.c:277
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Definition: sc_alloc.c:350
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
bool efficient_sc_check_inequality_feasibility(Pvecteur v, Psysteme prec)
bool sc_integer_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
Psysteme sc_constraint_add(Psysteme sc, Pcontrainte c, bool equality)
Definition: sc_insert_eq.c:115
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
Definition: scalaires.c:123
void reset_precondition_map(void)
void set_precondition_map(statement_mapping)
#define ifdebug(n)
Definition: sg.c:47
Pbase base
Definition: sc-local.h:75
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
bool partial_redundancy_elimination(const string)
partial_redundancy_elimination.c
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define val_of(varval)
#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
#define OFL_CTRL
I do thing that overflows are managed in a very poor manner.
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
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53
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