PIPS
debug.c
Go to the documentation of this file.
1 /*
2 
3  $Id: debug.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31 
32 #include "genC.h"
33 #include "linear.h"
34 #include "ri.h"
35 #include "effects.h"
36 #include "database.h"
37 
38 #include "ri-util.h"
39 #include "effects-util.h"
40 #include "constants.h"
41 #include "misc.h"
42 #include "text-util.h"
43 #include "text.h"
44 
45 
46 
47 #include "effects-generic.h"
48 #include "effects-convex.h"
49 
51 {
52 #define MY_MAX_CHECK VALUE_CONST(100000000)
53  bool consistent = true;
54  Psysteme sc;
55  Pbase b, t;
56  Pcontrainte c;
57 
58  pips_assert("it is a region", effect_consistent_p(reg));
59 
60  /* FI->BC: it might be better to use descriptors even for regions
61  linked to store and type declarations. Not much time to think
62  about it now. */
64  pips_assert("the descriptor is defined", !descriptor_none_p(effect_descriptor(reg)));
65 
66  /* the system must be defined */
67  consistent = consistent && !SC_UNDEFINED_P(region_system(reg));
68  pips_assert("the region system is defined", consistent);
69 
70  /* check the Psysteme consistency */
71  sc = region_system(reg);
72  consistent = consistent && sc_weak_consistent_p(sc);
73  pips_assert("the region system is consitent", consistent);
74 
75  /* the TCST variable must not belong to the base */
76  b = sc_base(sc);
77  for( t = b; !BASE_UNDEFINED_P(t) && consistent; t = t->succ)
78  {
79  consistent = consistent && !term_cst(t);
80  }
81  pips_assert("no TCST variable in the base", consistent);
82 
83 
84  /* and there must be no high coefficient (or it should have raised an
85  * exception before
86  */
87  c = sc_egalites(sc);
88  while (c != (Pcontrainte) NULL)
89  {
90  Pvecteur v;
91  for(v = c->vecteur; !VECTEUR_NUL_P(v); v = v->succ)
92  {
94  pips_assert("no high coefficient for PHI variables in region system.\n",
96  }
97  c = c->succ;
98  }
99  c = sc_inegalites(sc);
100  while (c != (Pcontrainte) NULL)
101  {
102  Pvecteur v;
103  for(v = c->vecteur; !VECTEUR_NUL_P(v); v = v->succ)
104  {
106  pips_assert("no high coefficient for PHI variables in region system.\n",
108  }
109  c = c->succ;
110  }
111  }
112  return consistent;
113 }
114 
115 
117 {
118  bool consistent = true;
119  MAP(EFFECT, reg,
120  consistent = consistent && region_consistent_p(reg),l_reg);
121  return consistent;
122 }
123 
bool effect_consistent_p(effect p)
Definition: effects.c:457
#define value_lt(v1, v2)
#define region_system(reg)
#define region
simulation of the type region
bool region_consistent_p(region reg)
Definition: debug.c:50
bool regions_consistent_p(list l_reg)
Definition: debug.c:116
#define MY_MAX_CHECK
#define variable_phi_p(e)
true if e is a phi variable PHI entities have a name like: REGIONS:PHI#, where # is a number.
#define effect_descriptor(x)
Definition: effects.h:646
#define descriptor_none_p(x)
Definition: effects.h:602
#define EFFECT(x)
EFFECT.
Definition: effects.h:608
#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
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
bool sc_weak_consistent_p(Psysteme sc)
check that sc is well defined, that the numbers of equalities and inequalities are consistent with th...
Definition: sc.c:362
Pvecteur vecteur
struct Scontrainte * succ
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct Svecteur * succ
Definition: vecteur-local.h:92
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
#define vecteur_val(v)
#define vecteur_var(v)
#define BASE_UNDEFINED_P(b)
#define VECTEUR_NUL_P(v)
#define term_cst(varval)