PIPS
testdep_util.c File Reference
#include "local.h"
#include "prettyprint.h"
+ Include dependency graph for testdep_util.c:

Go to the source code of this file.

Macros

#define ILCMAX   100000
 Management of loop counters. More...
 

Functions

entity MakeDiVar (int l)
 This function creates di variables. More...
 
entity GetDiVar (int l)
 This functions looks up a di variable of nesting level l in table DiVars. More...
 
entity MakeLiVar (int l)
 This function creates li variables(thee ith loop index variable). More...
 
entity GetLiVar (int l)
 
entity MakeDsiVar (int l)
 This function creates dsi variables. More...
 
entity GetDsiVar (int l)
 
int DiVarLevel (entity e)
 this function returns the nesting level of a given di variable e. More...
 
void sc_add_di (int l, entity e, Psysteme s, int li)
 
void sc_add_dsi (int l, entity e, Psysteme s)
 
int sc_proj_on_di (int cl, Psysteme s)
 
Pbase MakeDibaseinorder (int n)
 Pbase MakeDibaseinorder(int n) make a base of D#1 ... More...
 
int FindMaximumCommonLevel (cons *n1, cons *n2)
 
void ResetLoopCounter ()
 
entity MakeLoopCounter ()
 Create a new loop counter variable. More...
 
int dep_type (action ac1, action ac2)
 int dep_type(action ac1,action ac2) This function test the type of the dependence. More...
 
int sc_proj_optim_on_di_ofl (int cl, Psysteme *psc)
 int sc_proj_optim_on_di_ofl(cl, sc)
More...
 
bool sc_faisabilite_optim (Psysteme sc)
 bool sc_faisabilite_optim (Psysteme sc) : More...
 
static bool combiner_ofl_with_test (Psysteme sc, Variable v)
 bool combiner_ofl_with_test(Psysteme sc, Variable v): More...
 
Psysteme sc_projection_optim_along_vecteur_ofl (Psysteme sc, Pvecteur pv)
 Psysteme sc_projection_optim_along_vecteur_ofl(Psysteme sc, Pvecteur pv) More...
 
bool sc_minmax_of_variable_optim (Psysteme volatile ps, Variable var, Value *pmin, Value *pmax)
 void sc_minmax_of_variable_optim(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour trouver le minimum et le maximum d'une variable apparaissant dans ce systeme par projection a la Fourier-Motzkin. More...
 
Psysteme sc_invers (Psysteme ps)
 Psysteme sc_invers(Psysteme ps): calcul un systeme des contraintes qui est l'invers du systeme initial. More...
 
void vect_chg_var_sign (Pvecteur *ppv, Variable var)
 void vect_chg_var_sign(Pvecteur *ppv, Variable var) changement de signe de la coordonnee var du vecteur *ppv More...
 

Variables

entity DiVars [MAXDEPTH]
 here is a collection of function intended to create and manipulate "di" variables and test of dependence. More...
 
entity LiVars [MAXDEPTH]
 
entity DsiVars [MAXSV]
 
static int ilc = ILCMAX
 

Macro Definition Documentation

◆ ILCMAX

#define ILCMAX   100000

Management of loop counters.

Definition at line 325 of file testdep_util.c.

Function Documentation

◆ combiner_ofl_with_test()

static bool combiner_ofl_with_test ( Psysteme  sc,
Variable  v 
)
static

bool combiner_ofl_with_test(Psysteme sc, Variable v):

the copy of combiner() adding the test of suffisants conditions of integer combination.

It returns true if exact

apres les combinaisons eliminer les elements devenus inutiles

mise a jour du systeme

Definition at line 533 of file testdep_util.c.

534 {
535  Psysteme sc1;
536  Pcontrainte pos, neg, nul;
537  Pcontrainte pc, pcp, pcn;
538  Value c;
539  int nnul, np, nn, i;
540 
541  pc = sc->inegalites;
542 
543  if(pc == NULL) {
544  FMComp[0]++;
545  return (true);
546  }
547 
548  sc1 = sc_dup(sc);
549  pos = neg = nul = NULL;
550  nnul = 0;
551  while(pc != NULL) {
552  Pcontrainte pcs = pc->succ;
553 
554  if(value_pos_p(c = vect_coeff(v,pc->vecteur))) {
555  pc->succ = pos;
556  pos = pc;
557  }
558  else if(value_neg_p(c)) {
559  pc->succ = neg;
560  neg = pc;
561  }
562  else {
563  pc->succ = nul;
564  nul = pc;
565  nnul += 1;
566  }
567 
568  pc = pcs;
569  }
570  sc->inegalites = NULL;
571  sc->nb_ineq = 0;
572 
573  np = nb_elems_list(pos);
574  nn = nb_elems_list(neg);
575 
576  if((i = np * nn) <= 16)
577  FMComp[i]++;
578  else
579  FMComp[17]++;
580 
581  for (pcp = pos; pcp != NULL; pcp = pcp->succ) {
582  for (pcn = neg; pcn != NULL; pcn = pcn->succ) {
583  bool int_comb_p = true;
584  Pcontrainte pcnew =
585  sc_integer_inequalities_combination_ofl_ctrl(sc1,
586  pcp,
587  pcn,
588  v,
589  &int_comb_p,
590  FWD_OFL_CTRL);
591 
592  if(contrainte_constante_p(pcnew)) {
593  if(contrainte_verifiee(pcnew, false)) {
594  contrainte_free(pcnew);
595  } else {
596  contraintes_free(pos);
597  contraintes_free(neg);
598  contraintes_free(nul);
599  contraintes_free(pcnew);
600  sc_rm(sc1);
601  return (false);
602  }
603  } else {
604  pcnew->succ = nul;
605  nul = pcnew;
606  nnul += 1;
607  if(!int_comb_p) {
608  if(is_test_exact)
609  is_test_exact = false;
610  if(is_test_inexact_fm == false)
611  is_test_inexact_fm = true;
612  }
613  }
614  }
615  }
616 
617  /* apres les combinaisons eliminer les elements devenus inutiles */
618  contraintes_free(pos);
619  contraintes_free(neg);
620 
621  /* mise a jour du systeme */
622  sc->inegalites = nul;
623  sc->nb_ineq = nnul;
624  sc_rm(sc1);
625  return (true);
626 }
#define value_pos_p(val)
int Value
#define value_neg_p(val)
Pcontrainte contraintes_free(Pcontrainte pc)
Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc.
Definition: alloc.c:226
Pcontrainte contrainte_free(Pcontrainte c)
Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c a...
Definition: alloc.c:184
int nb_elems_list(Pcontrainte)
int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes
Definition: listes.c:129
bool contrainte_constante_p(Pcontrainte)
bool contrainte_constante_p(Pcontrainte c): test de contrainte triviale sans variables (ie du type 0<...
Definition: predicats.c:192
bool contrainte_verifiee(Pcontrainte, bool)
bool contrainte_verifiee(Pcontrainte ineg, bool eq_p): test de faisabilite d'inegalite (eq_p == false...
Definition: predicats.c:234
bool is_test_inexact_fm
Definition: ricedg.h:157
int FMComp[18]
Definition: ricedg.h:154
bool is_test_exact
or counting the number of F-M complexity less than 16.
Definition: ricedg.h:155
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
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
int nb_ineq
Definition: sc-local.h:73
#define FWD_OFL_CTRL
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

References contrainte_constante_p(), contrainte_free(), contrainte_verifiee(), contraintes_free(), FMComp, FWD_OFL_CTRL, Ssysteme::inegalites, is_test_exact, is_test_inexact_fm, nb_elems_list(), Ssysteme::nb_ineq, sc_dup(), sc_rm(), Scontrainte::succ, value_neg_p, value_pos_p, vect_coeff(), and Scontrainte::vecteur.

Referenced by sc_projection_optim_along_vecteur_ofl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dep_type()

int dep_type ( action  ac1,
action  ac2 
)

int dep_type(action ac1,action ac2) This function test the type of the dependence.

ac1, ac2 are the action of two references.The representations of the result are as follows. 0 -— def-use dependence 1 -— use-def dependence 2 -— def-def dependence 3 -— use-use dependence (added in 20/01/92) FI->YY: we also have use-use dependence (also called input dependence); there is no reason to abort here; input dependences should just be ignored for parallelization, but not for tiling or cache optimization

to please gcc

Parameters
ac1c1
ac2c2

Definition at line 378 of file testdep_util.c.

379  {
380  if(action_write_p(ac1) && action_read_p(ac2))
381  return (0);
382  else if(action_read_p(ac1) && action_write_p(ac2))
383  return (1);
384  else if(action_write_p(ac1) && action_write_p(ac2))
385  return (2);
386  else if(action_read_p(ac1) && action_read_p(ac2))
387  return (3);
388  else
389  pips_internal_error("A undefined chain ---chains fault");
390 
391  /* to please gcc */
392  return -1;
393 }
#define action_write_p(x)
Definition: effects.h:314
#define action_read_p(x)
Definition: effects.h:311
#define pips_internal_error
Definition: misc-local.h:149

References action_read_p, action_write_p, and pips_internal_error.

Referenced by insert_impact_description_as_comment(), and TestCoupleOfReferences().

+ Here is the caller graph for this function:

◆ DiVarLevel()

int DiVarLevel ( entity  e)

this function returns the nesting level of a given di variable e.

Definition at line 185 of file testdep_util.c.

186  {
187  int i;
188 
189  for (i = 0; i < MAXDEPTH; i++)
190  if(e == DiVars[i])
191  return (i + 1);
192 
193  return (0);
194 }
#define MAXDEPTH
maximun number of nested loops
Definition: ricedg-local.h:28
entity DiVars[MAXDEPTH]
here is a collection of function intended to create and manipulate "di" variables and test of depende...
Definition: testdep_util.c:53

References DiVars, and MAXDEPTH.

Referenced by sc_proj_on_di(), sc_proj_optim_on_di_ofl(), and TestDependence().

+ Here is the caller graph for this function:

◆ FindMaximumCommonLevel()

int FindMaximumCommonLevel ( cons n1,
cons n2 
)
Parameters
n11
n22

Definition at line 307 of file testdep_util.c.

308  {
309  int cl = 0;
310 
311  while(n1 != NIL && n2 != NIL) {
312  if(LOOP(CAR(n1)) != LOOP(CAR(n2)))
313  break;
314  n1 = CDR(n1);
315  n2 = CDR(n2);
316  cl += 1;
317  }
318 
319  return (cl);
320 }
#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 LOOP(x)
LOOP.
Definition: ri.h:1606

References CAR, CDR, LOOP, and NIL.

Referenced by prettyprint_dependence_graph_view(), prettyprint_dot_dependence_graph(), search_parallel_loops(), TestCoupleOfReferences(), and TestDependence().

+ Here is the caller graph for this function:

◆ GetDiVar()

entity GetDiVar ( int  l)

This functions looks up a di variable of nesting level l in table DiVars.

di variables are created if they do not exist.

Definition at line 79 of file testdep_util.c.

80  {
81  entity e;
82 
83  if(l < 1 || l > MAXDEPTH)
84  user_error("parallelize", "too many nested loops\n");
85 
86  if((e = DiVars[l - 1]) == (entity)0) {
87  int i;
88  for (i = 0; i < MAXDEPTH; i++)
89  DiVars[i] = MakeDiVar(i + 1);
90 
91  e = DiVars[l - 1];
92  }
93 
94  return (e);
95 }
#define user_error(fn,...)
Definition: misc-local.h:265
entity MakeDiVar(int l)
This function creates di variables.
Definition: testdep_util.c:63

References DiVars, MakeDiVar(), MAXDEPTH, and user_error.

Referenced by dependence_system_add_lci_and_di(), gcd_and_constant_dependence_test(), MakeDibaseinorder(), sc_add_di(), TestDiCnst(), and TestDiVariables().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDsiVar()

entity GetDsiVar ( int  l)

Definition at line 164 of file testdep_util.c.

165  {
166  entity e;
167 
168  if(l < 1 || l > MAXSV)
169  user_error("parallelize", "too many scalar variables\n");
170 
171  if((e = DsiVars[l - 1]) == (entity)0) {
172  int i;
173  for (i = 0; i < MAXSV; i++)
174  DsiVars[i] = MakeDsiVar(i + 1);
175 
176  e = DsiVars[l - 1];
177  }
178 
179  return (e);
180 }
#define MAXSV
maximum number of scalar variables
Definition: ricedg-local.h:30
entity DsiVars[MAXSV]
Definition: testdep_util.c:55
entity MakeDsiVar(int l)
This function creates dsi variables.
Definition: testdep_util.c:146

References DsiVars, MakeDsiVar(), MAXSV, and user_error.

Referenced by gcd_and_constant_dependence_test(), and sc_add_dsi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetLiVar()

entity GetLiVar ( int  l)

Definition at line 121 of file testdep_util.c.

122  {
123  entity e;
124 
125  if(l < 1 || l > MAXDEPTH)
126  user_error("parallelize", "too many nested loops\n");
127 
128  if((e = LiVars[l - 1]) == (entity)0) {
129  int i;
130  for (i = 0; i < MAXDEPTH; i++)
131  LiVars[i] = MakeLiVar(i + 1);
132 
133  e = LiVars[l - 1];
134  }
135 
136  return (e);
137 }
entity MakeLiVar(int l)
This function creates li variables(thee ith loop index variable).
Definition: testdep_util.c:103
entity LiVars[MAXDEPTH]
Definition: testdep_util.c:54

References LiVars, MakeLiVar(), MAXDEPTH, and user_error.

Referenced by build_and_test_dependence_context(), dependence_system_add_lci_and_di(), and gcd_and_constant_dependence_test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeDibaseinorder()

Pbase MakeDibaseinorder ( int  n)

Pbase MakeDibaseinorder(int n) make a base of D#1 ...

D::n in order of D#1-> D#2, ...-> D::n.

Definition at line 296 of file testdep_util.c.

297  {
298  Pbase Dibase = BASE_NULLE;
299  int i;
300 
301  for (i = 1; i <= n; i++) {
302  Dibase = vect_add_variable(Dibase, (Variable)GetDiVar(n - i + 1));
303  }
304  return (Dibase);
305 }
Pbase vect_add_variable(Pbase b, Variable v)
package vecteur - routines sur les bases
Definition: base.c:61
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
entity GetDiVar(int l)
This functions looks up a di variable of nesting level l in table DiVars.
Definition: testdep_util.c:79
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 BASE_NULLE
MACROS SUR LES BASES.

References BASE_NULLE, GetDiVar(), and vect_add_variable().

Referenced by TestDependence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeDiVar()

entity MakeDiVar ( int  l)

This function creates di variables.

There are MAXDEPTH di variables which means that programs with more than MAXDEPTH nested loops cannot be parallelized by pips.

Parameters
lis the nesting level of the variable to create

Create a variable of this format: "d#X"

Definition at line 63 of file testdep_util.c.

63  {
64  entity e;
65  string s;
66  /* Create a variable of this format: "d#X" */
67  asprintf(&s, "%s%sd#%d", DI_VAR_MODULE_NAME, MODULE_SEP_STRING, l);
68 
71  else
72  free(s);
73 
74  return (e);
75 }
void free(void *)
#define asprintf
Definition: misc-local.h:225
#define MODULE_SEP_STRING
Definition: naming-local.h:30
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define make_entity(n, t, s, i)
#define DI_VAR_MODULE_NAME
#define value_undefined
Definition: ri.h:3016
#define entity_undefined
Definition: ri.h:2761
#define type_undefined
Definition: ri.h:2883
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
#define storage_undefined
Definition: ri.h:2476

References asprintf, DI_VAR_MODULE_NAME, entity_domain, entity_undefined, free(), gen_find_tabulated(), make_entity, MODULE_SEP_STRING, storage_undefined, type_undefined, and value_undefined.

Referenced by GetDiVar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeDsiVar()

entity MakeDsiVar ( int  l)

This function creates dsi variables.

There are MAXSV dsi variables which means that programs with more than MAXSV scalar variables cannot be parallelized by PIPS.

Parameters
lmeans to create Dsi[l] variable

Create a variable of this format: "ds#XXXX"

Definition at line 146 of file testdep_util.c.

146  {
147  entity e;
148  string s;
149  /* Create a variable of this format: "ds#XXXX" */
150  asprintf(&s, "%s%sds#%.4d", DI_VAR_MODULE_NAME, MODULE_SEP_STRING, l);
151 
154  else
155  free(s);
156 
157  return (e);
158 }

References asprintf, DI_VAR_MODULE_NAME, entity_domain, entity_undefined, free(), gen_find_tabulated(), make_entity, MODULE_SEP_STRING, storage_undefined, type_undefined, and value_undefined.

Referenced by GetDsiVar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeLiVar()

entity MakeLiVar ( int  l)

This function creates li variables(thee ith loop index variable).

There are MAXDEPTH li variables which means that programs with more than MAXDEPTH nested loops cannot be parallelized by pips.

Parameters
lis the nesting level of the variable to create

Create a variable of this format: "l#X"

Definition at line 103 of file testdep_util.c.

103  {
104  entity e;
105  string s;
106  /* Create a variable of this format: "l#X" */
107  asprintf(&s, "%s%sl#%d", DI_VAR_MODULE_NAME, MODULE_SEP_STRING, l);
108 
111  else
112  free(s);
113 
114  return (e);
115 }

References asprintf, DI_VAR_MODULE_NAME, entity_domain, entity_undefined, free(), gen_find_tabulated(), make_entity, MODULE_SEP_STRING, storage_undefined, type_undefined, and value_undefined.

Referenced by GetLiVar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MakeLoopCounter()

entity MakeLoopCounter ( void  )

Create a new loop counter variable.

Create a variable of this format: "lc#XXXXXX"

Try a new free one:

Definition at line 334 of file testdep_util.c.

334  {
335  entity e;
336  string s;
337  //static char lcn[] = "lc#XXXXXX";
338 
339  while(1) {
340  /* Create a variable of this format: "lc#XXXXXX" */
341  asprintf(&s,
342  "%s%slc#%06d",
345  ilc);
346 
348  pips_debug(8, "loop counter is %s\n", s);
349  return make_entity(strdup(s),
353  } else
354  free(s);
355 
356  /* Try a new free one: */
357  if((ilc += 1) == ILCMAX)
358  break;
359  }
360 
361  pips_internal_error("too many loop counters");
362  return (entity_undefined);
363 }
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define LOOP_COUNTER_MODULE_NAME
moved from ricedg-local.h
char * strdup()
static int ilc
Definition: testdep_util.c:327
#define ILCMAX
Management of loop counters.
Definition: testdep_util.c:325

References asprintf, entity_domain, entity_undefined, free(), gen_find_tabulated(), ilc, ILCMAX, LOOP_COUNTER_MODULE_NAME, make_entity, MODULE_SEP_STRING, pips_debug, pips_internal_error, storage_undefined, strdup(), type_undefined, and value_undefined.

Referenced by dependence_system_add_lci_and_di().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ResetLoopCounter()

void ResetLoopCounter ( void  )

Definition at line 329 of file testdep_util.c.

329  {
330  ilc = 0;
331 }

References ilc.

Referenced by rice_dependence_graph().

+ Here is the caller graph for this function:

◆ sc_add_di()

void sc_add_di ( int  l,
entity  e,
Psysteme  s,
int  li 
)
Parameters
lii

Definition at line 209 of file testdep_util.c.

210  {
211  Variable v = (Variable)GetDiVar(l);
212  Value vli = int_to_value(li);
213  Pcontrainte pc;
214 
215  for (pc = s->egalites; pc != NULL; pc = pc->succ) {
216  Value ve = vect_coeff((Variable)e, pc->vecteur);
217  value_product(ve, vli);
218  vect_add_elem(&(pc->vecteur), v, ve);
219  }
220 
221  for (pc = s->inegalites; pc != NULL; pc = pc->succ) {
222  Value ve = vect_coeff((Variable)e, pc->vecteur);
223  value_product(ve, vli);
224  vect_add_elem(&(pc->vecteur), v, ve);
225  }
226 }
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
#define value_product(v, w)
Pcontrainte egalites
Definition: sc-local.h:70
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

References Ssysteme::egalites, GetDiVar(), Ssysteme::inegalites, int_to_value, Scontrainte::succ, value_product, vect_add_elem(), vect_coeff(), and Scontrainte::vecteur.

Referenced by build_and_test_dependence_context().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sc_add_dsi()

void sc_add_dsi ( int  l,
entity  e,
Psysteme  s 
)

Definition at line 238 of file testdep_util.c.

239  {
240  Variable v = (Variable)GetDsiVar(l);
241  Pcontrainte pc;
242  for (pc = s->egalites; pc != NULL; pc = pc->succ) {
243  vect_add_elem(&(pc->vecteur), v, vect_coeff((Variable)e, pc->vecteur));
244  }
245 
246  for (pc = s->inegalites; pc != NULL; pc = pc->succ) {
247  vect_add_elem(&(pc->vecteur), v, vect_coeff((Variable)e, pc->vecteur));
248  }
249 }
entity GetDsiVar(int l)
Definition: testdep_util.c:164

References Ssysteme::egalites, GetDsiVar(), Ssysteme::inegalites, Scontrainte::succ, vect_add_elem(), vect_coeff(), and Scontrainte::vecteur.

Referenced by build_and_test_dependence_context().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sc_faisabilite_optim()

bool sc_faisabilite_optim ( Psysteme  sc)

bool sc_faisabilite_optim (Psysteme sc) :

Test system sc feasibility by successive projections along all variables in its basis.

carry out the projection with function sc_projection_optim_along_vecteur().

sc_normalize() is called here before the projection, which means that sc may be deallocated

result :

boolean : true if system is faisable false else

Modification:

Automatic variables read in a CATCH block need to be declared volatile as specified by the documentation

Parameters
scc

Definition at line 484 of file testdep_util.c.

485  {
486  debug(6, "sc_faisabilite_optim", "begin\n");
487  sc = sc_normalize(sc);
488  if(!sc_empty_p(sc)) {
489  /* Automatic variables read in a CATCH block need to be declared volatile as
490  * specified by the documentation*/
491  Psysteme volatile sc1 = sc_dup(sc);
492  is_test_Di = false;
493 
495  pips_debug(7, "overflow error, returning TRUE. \n");
496  sc_rm(sc1);
497  debug(6, "sc_faisabilite_optim", "end\n");
498  return (true);
499 
500  } TRY {
501  Pbase base_sc1 = base_dup(sc1->base);
502  sc1 = sc_projection_optim_along_vecteur_ofl(sc1, base_sc1);
503  base_rm(base_sc1);
504  if(sc_empty_p(sc1)) {
505  debug(7, "sc_faisabilite_optim", "system not feasible\n");
506  debug(6, "sc_faisabilite_optim", "end\n");
507  sc_rm(sc);
509  return (false);
510  } else {
511  sc_rm(sc1);
512  debug(7, "sc_faisabilite_optim", "system feasible\n");
513  debug(6, "sc_faisabilite_optim", "end\n");
515  return (true);
516  }
517  }
518  } else {
519  debug(7, "sc_faisabilite_optim", "normalized system not feasible\n");
520  debug(6, "sc_faisabilite_optim", "end\n");
521  sc_rm(sc);
522  return (false);
523  }
524 }
#define CATCH(what)
@ overflow_error
#define UNCATCH(what)
#define TRY
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
bool is_test_Di
Definition: ricedg.h:159
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_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
Pbase base
Definition: sc-local.h:75
Psysteme sc_projection_optim_along_vecteur_ofl(Psysteme sc, Pvecteur pv)
Psysteme sc_projection_optim_along_vecteur_ofl(Psysteme sc, Pvecteur pv)
Definition: testdep_util.c:648
#define base_rm(b)
Pbase base_dup(Pbase b)
Pbase base_dup(Pbase b) Note: this function changes the value of the pointer.
Definition: alloc.c:268

References Ssysteme::base, base_dup(), base_rm, CATCH, debug(), is_test_Di, overflow_error, pips_debug, sc_dup(), sc_empty_p(), sc_normalize(), sc_projection_optim_along_vecteur_ofl(), sc_rm(), TRY, and UNCATCH.

Referenced by TestDependence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sc_invers()

Psysteme sc_invers ( Psysteme  ps)

Psysteme sc_invers(Psysteme ps): calcul un systeme des contraintes qui est l'invers du systeme initial.

pour chaque element b dans le base initial, remplace b par -b dans le systeme initial.

Parameters
pss

Definition at line 1060 of file testdep_util.c.

1061  {
1062  Pbase b;
1063  Pcontrainte eq;
1064  Variable v;
1065 
1066  for (b = ps->base; !VECTEUR_NUL_P(b); b = b->succ) {
1067  v = vecteur_var(b);
1068  for (eq = ps->egalites; eq != NULL; eq = eq->succ)
1070 
1071  for (eq = ps->inegalites; eq != NULL; eq = eq->succ)
1073  }
1074  return (ps);
1075 }
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
struct Svecteur * succ
Definition: vecteur-local.h:92
void vect_chg_var_sign(Pvecteur *ppv, Variable var)
void vect_chg_var_sign(Pvecteur *ppv, Variable var) changement de signe de la coordonnee var du vecte...
#define vecteur_var(v)
#define VECTEUR_NUL_P(v)

References eq, Scontrainte::succ, Svecteur::succ, vect_chg_var_sign(), Scontrainte::vecteur, VECTEUR_NUL_P, and vecteur_var.

Referenced by TestDependence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sc_minmax_of_variable_optim()

bool sc_minmax_of_variable_optim ( Psysteme volatile  ps,
Variable  var,
Value pmin,
Value pmax 
)

void sc_minmax_of_variable_optim(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour trouver le minimum et le maximum d'une variable apparaissant dans ce systeme par projection a la Fourier-Motzkin.

la procedure retourne la valeur false si le systeme est infaisable et true sinon

le systeme ps est detruit.

projection sur toutes les variables sauf var

cette contrainte nous donne une borne max

cette contrainte nous donne une borne min

Parameters
pss
varar
pminmin
pmaxmax

Definition at line 975 of file testdep_util.c.

976  {
977  Value val;
978  Pcontrainte pc;
979  Pbase b;
980  Pvecteur pv = NULL;
981 
982  *pmax = VALUE_MAX;
983  *pmin = VALUE_MIN;
984 
985  if(sc_value_of_variable(ps, var, &val) == true) {
986  *pmin = val;
987  *pmax = val;
988  return true;
989  }
990 
991  /* projection sur toutes les variables sauf var */
992  for (b = ps->base; !VECTEUR_NUL_P(b); b = b->succ) {
993  Variable v = vecteur_var(b);
994  if(v != var) {
995  vect_add_elem(&pv, v, 1);
996  }
997  }
998 
1000  debug(6,
1001  "sc_minmax_of_variable_optim",
1002  " overflow error, returning INT_MAX and INT_MIN. \n");
1003  *pmax = INT_MAX;
1004  *pmin = INT_MIN;
1005  } TRY {
1006 
1008  if(sc_empty_p(ps)) {
1009  sc_rm(ps);
1011  return false;
1012  }
1013  if(sc_empty_p(ps = sc_normalize(ps))) {
1014  sc_rm(ps);
1016  return false;
1017  }
1018 
1019  if(sc_value_of_variable(ps, var, &val) == true) {
1020  *pmin = val;
1021  *pmax = val;
1023  return true;
1024  }
1025 
1026  for (pc = ps->inegalites; pc != NULL; pc = pc->succ) {
1027  Value cv = vect_coeff(var, pc->vecteur);
1029 
1030  if(value_pos_p(cv)) {
1031  /* cette contrainte nous donne une borne max */
1032  Value bs = value_pdiv(cc,cv);
1033  if(value_lt(bs,*pmax))
1034  *pmax = bs;
1035  } else if(value_neg_p(cv)) {
1036  /* cette contrainte nous donne une borne min */
1037  Value bi = value_pdiv(cc,cv);
1038  if(value_gt(bi,*pmin))
1039  *pmin = bi;
1040  }
1041  }
1042 
1044  vect_rm(pv);
1045  }
1046 
1047  if(value_lt(*pmax,*pmin))
1048  return false;
1049 
1050  sc_rm(ps);
1051 
1052  return true;
1053 }
#define value_gt(v1, v2)
#define value_pdiv(v1, v2)
#define value_uminus(val)
unary operators on values
#define VALUE_MIN
#define VALUE_MAX
#define value_lt(v1, v2)
bool sc_value_of_variable(Psysteme ps, Variable var, Value *pval)
bool sc_value_for_variable(Psysteme ps, Variable var, Value *pval): examine les egalites du systeme p...
Definition: sc_eval.c:70
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References CATCH, debug(), overflow_error, sc_empty_p(), sc_normalize(), sc_projection_optim_along_vecteur_ofl(), sc_rm(), sc_value_of_variable(), Scontrainte::succ, Svecteur::succ, TCST, TRY, UNCATCH, value_gt, value_lt, VALUE_MAX, VALUE_MIN, value_neg_p, value_pdiv, value_pos_p, value_uminus, vect_add_elem(), vect_coeff(), vect_rm(), Scontrainte::vecteur, VECTEUR_NUL_P, and vecteur_var.

Referenced by TestDiVariables().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sc_proj_on_di()

int sc_proj_on_di ( int  cl,
Psysteme  s 
)
Parameters
cll

Definition at line 267 of file testdep_util.c.

268  {
269  Pbase coord;
270 
271  for (coord = s->base; !VECTEUR_NUL_P(coord); coord = coord->succ) {
272  Variable v = vecteur_var(coord);
273  int l = DiVarLevel((entity)v);
274 
275  if(l <= 0 || l > cl) {
276  debug(8,
277  "ProjectOnDi",
278  "projection sur %s\n",
280  if(SC_EMPTY_P(s = sc_projection_pure(s, v))) {
281  debug(8, "ProjectOnDi", "infaisable\n");
282  return (false);
283  }
284  debug(8, "ProjectOnDi", "faisable\n");
285  }
286  }
287 
288  return (true);
289 }
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
int DiVarLevel(entity e)
this function returns the nesting level of a given di variable e.
Definition: testdep_util.c:185

References Ssysteme::base, debug(), DiVarLevel(), entity_local_name(), Svecteur::succ, VECTEUR_NUL_P, and vecteur_var.

+ Here is the call graph for this function:

◆ sc_proj_optim_on_di_ofl()

int sc_proj_optim_on_di_ofl ( int  cl,
Psysteme psc 
)

int sc_proj_optim_on_di_ofl(cl, sc)

This function projects a system onto a set of di variables. This set is defined by cl, the common nesting level of the two array references being tested: only di variables whose nesting level is less than or equal to cl are kept in the projected system (i.e. outermost loops).

The projection is performed by first eliminating variables in the equations. Variables whose coefficients are 1 or -1 are considered first. (in such case it's integer elimination). Remaining inequalities are projected by Fourier-Motzkin elimination.

cl is the common nesting level. sc is the system to project. sc is modified but psc always points to a consistent Psysteme on return (i.e. it's up to the caller to free it). *psc on return is sc_empty() if *psc on entry turns out to be non-feasible. a long jump buffer must have been initialized to handle overflows The value returned is true if the system is feasible, false otherwise.

find the set of variables to be eliminated

find one

Parameters
cll
pscsc

Definition at line 415 of file testdep_util.c.

416 {
417  Pbase coord;
418  Pvecteur pv = VECTEUR_NUL;
419  Variable v;
420  int l;
421  int res;
422 
423  pips_debug(6, "begin\n");
424 
425  /* find the set of variables to be eliminated */
426  for (coord = (*psc)->base; !VECTEUR_NUL_P(coord); coord = coord->succ) {
427  v = vecteur_var(coord);
428  l = DiVarLevel((entity)v);
429 
430  if(l <= 0 || l > cl) /* find one */
431  vect_add_elem(&pv, v, 1);
432  }
433 
434  ifdebug(6) {
435  fprintf(stderr, "The list of variables to be eliminated is :\n");
436  vect_debug(pv);
437  }
438  is_test_Di = true;
439 
440  pips_assert("Dependence system *psc is consistent before projection",
441  sc_consistent_p(*psc));
442 
443  *psc = sc_projection_optim_along_vecteur_ofl(*psc, pv);
444 
445  pips_assert("Dependence system *psc is consistent after projection",
446  sc_consistent_p(*psc));
447 
448  if(sc_empty_p(*psc))
449  res = false;
450  else
451  res = true;
452 
453 
454  vect_rm(pv);
455 
456 
457  pips_assert("Dependence system *psc is consistent after empty test",
458  sc_consistent_p(*psc));
459  pips_debug(6, "end\n");
460 
461  return res;
462 }
void vect_debug(Pvecteur v)
constraint.c
Definition: constraint.c:43
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
bool sc_consistent_p(Psysteme sc)
bool sc_consistent_p(Psysteme sc): check that sc is well defined, that the numbers of equalities and ...
Definition: sc.c:282
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define ifdebug(n)
Definition: sg.c:47
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.

References DiVarLevel(), fprintf(), ifdebug, is_test_Di, pips_assert, pips_debug, sc_consistent_p(), sc_empty_p(), sc_projection_optim_along_vecteur_ofl(), Svecteur::succ, vect_add_elem(), vect_debug(), vect_rm(), VECTEUR_NUL, VECTEUR_NUL_P, and vecteur_var.

Referenced by TestDependence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sc_projection_optim_along_vecteur_ofl()

Psysteme sc_projection_optim_along_vecteur_ofl ( Psysteme  sc,
Pvecteur  pv 
)

Psysteme sc_projection_optim_along_vecteur_ofl(Psysteme sc, Pvecteur pv)

This fonction returns the projected system resulting of the SUCCESSIVE projections of the system sc along the variables contained in vecteur pv. Variables are only more or less projected according to their order in pv.

The projection is done first by eliminating variables constrained by equations. The variables whose coefficients are 1 (or -1?) are considered first (in such case it is a valide integer elimination), then variables appearing in equations with non unit coefficient, and finally all left over variables in pv using Fourier-Motzkin elimination. At each step, the order in pv is used.

If the system sc is not faisable, SC_EMPTY is returned.

FI: this function could be moved to linear... but for the debugging stuff. Also, it could be broken into three parts. And the number of return statements should be reduced to one.

The elimination of variables using equations

First,carry out the integer elimination possible

coeff == 1, do this integer elimination for variable v with the others contrainte(equations and inequations

remove v from the list of variables to be projected pve

it's in head

carry out the non-exact elimination if necessary and possible using other equations

find a variable which appears in the equations, eliminate it

liminate v in the list of variables pve

it's in head

carry out the elimination using Fourier-Motzkin for the other variables

detection of non feasability of Psysteme sc

sc->inegalites = contrainte_sort(sc->inegalites, sc->base, BASE_NULLE,

true, false);

ifdebug(8) {

debug(8, "", "Sorted system :\n");

sc_syst_debug(sc);

}

Are we done? This used to be always true, but sc_normalize() may promote inequalities as equations. Since the projection steps may reveal some implicit equations, we are not sure here that all projections have been performed by the three steps (equations, equations, inequalities).

See for instance the test dependence in SAC/sgemm for such an example.

Update the base and the dimension of the constraint system sc

Clean up auxiliary data structures

Parameters
scc
pvv

Definition at line 648 of file testdep_util.c.

649 {
650  Pcontrainte eq;
651  Pvecteur pv1, prv, pve;
652  Variable v;
653  Value coeff;
654  int syst_size_init;
655  Pbase base_sc = base_dup(sc->base);
656  Pbase lb = BASE_NULLE;
657 
658  pips_assert("The input constraint system is consistent", sc_consistent_p(sc));
659  ifdebug(7) {
660  pips_debug(7, "All variables to project: ");
661  vect_dump(pv);
662  }
663 
664  pve = vect_dup(pv);
665  Pvecteur pve_to_free = pve;
666 
667  do {
668  /* The elimination of variables using equations */
669  if(pve != NULL && sc->nb_eq != 0) {
670 
671  /* First,carry out the integer elimination possible */
672  pips_debug(7, "carry out the integer elimination by equation:\n");
673 
674  prv = NULL;
675  pv1 = pve;
676  while(!VECTEUR_NUL_P(pv1) && (sc->nb_eq != 0)) {
677  v = pv1->var;
678  eq = contrainte_var_min_coeff(sc->egalites, v, &coeff, false);
679  if((eq == NULL) || value_notone_p(coeff)) {
680  prv = pv1;
681  pv1 = pv1->succ;
682  } else {
683  ifdebug(7) {
684  fprintf(stderr, "eliminate %s by :", entity_local_name((entity)v));
685  egalite_debug(eq);
686  }
687  /* coeff == 1, do this integer elimination for variable
688  * v with the others contrainte(equations and inequations */
689  sc = sc_variable_substitution_with_eq_ofl_ctrl(sc, eq, v, FWD_OFL_CTRL);
690 
691  if(sc_empty_p(sc)) {
692  if(is_test_Di)
693  NbrTestProjEqDi++;
694  else
695  NbrTestProjEq++;
696  pips_debug(7, "projection infaisable\n");
697  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
698  v = pv1->var;
700  }
701  base_rm(base_sc);
702  vect_rm(pve_to_free);
703 
704  pips_debug(7, "Return 1: empty\n");
705  return (sc);
706  }
707  sc = sc_normalize(sc);
708 
709  if(sc_empty_p(sc)) { // FI: another normalization step is going to occur here
710  if(is_test_Di)
711  NbrTestProjEqDi++;
712  else
713  NbrTestProjEq++;
714  pips_debug(7, "normalisation infaisable\n");
715 
716  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
717  v = pv1->var;
719  }
720 
721  vect_rm(pve_to_free);
722 
723  pips_debug(7, "Return 2: empty\n");
724  return (sc);
725 
726  }
727 
728  // The removal is delayed till the end of the function. sc is
729  // still consistent. However, too many variables might be left if an
730  // intermediate return occurs
731  // sc_base_remove_variable(sc, v);
732 
733  ifdebug(7) {
734  fprintf(stderr, "projected normalised system is:\n");
735  sc_syst_debug(sc);
736  }
737 
738  /* remove v from the list of variables to be projected pve */
739  if(prv == NULL) /* it's in head */
740  pve = pv1 = pv1->succ;
741  else {
742  prv->succ = pv1->succ;
743  free(pv1);
744  pv1 = prv->succ;
745  }
746  }
747  }
748  }
749 
750  pips_assert("sc is consistent after the first use of equations",
751  sc_consistent_p(sc));
752  ifdebug(7) {
753  pips_debug(7, "Variables left to project after the first step: ");
754  vect_dump(pv);
755  }
756 
757  /* carry out the non-exact elimination if necessary and possible
758  using other equations */
759  if(pve != NULL && sc->egalites != NULL) {
760  pips_debug(7, "carry out the non integer elimination by equation:\n");
761  pv1 = pve;
762  prv = NULL;
763  while((sc->egalites != 0) && (pv1 != NULL)) {
764  v = pv1->var;
765  eq = contrainte_var_min_coeff(sc->egalites, v, &coeff, true);
766  if(eq == NULL && pv1 != NULL) {
767  prv = pv1;
768  pv1 = pv1->succ;
769  } else {
770  if(eq != NULL) {
771  /* find a variable which appears in the equations, eliminate it*/
772  ifdebug(7) {
773  fprintf(stderr, "eliminate %s by :", entity_local_name((entity)v));
774  egalite_debug(eq);
775  }
776  if(is_test_inexact_eq == false)
777  is_test_inexact_eq = true;
778  if(is_test_exact)
779  is_test_exact = false;
780 
781  sc = sc_variable_substitution_with_eq_ofl_ctrl(sc,
782  eq,
783  v,
784  FWD_OFL_CTRL);
785  if(sc_empty_p(sc)) {
786  if(is_test_Di)
787  NbrTestProjEqDi++;
788  else
789  NbrTestProjEq++;
790  pips_debug(7, "projection-infaisable\n");
791 
792  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
793  v = pv1->var;
795  }
796  base_rm(base_sc);
797  vect_rm(pve_to_free);
798 
799  pips_debug(7, "Return 3: empty\n");
800  return sc;
801  }
802 
803  sc = sc_normalize(sc);
804 
805  if(sc_empty_p(sc)) { // FI: should be sc_is_empty_p... or
806  // the normalization is repeated...
807  pips_debug(7, "normalization detects a non-feasible constraint system\n");
808  if(is_test_Di)
809  NbrTestProjEqDi++;
810  else
811  NbrTestProjEq++;
812 
813  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
814  v = pv1->var;
816  }
817 
818  vect_rm(pve_to_free);
819 
820  pips_debug(7, "Return 4: empty\n");
821  return sc;
822  }
823 
824  // FI: the removal is delayed to end of this function, but
825  // sc is nevertheless consistent
826  // sc_base_remove_variable(sc, v);
827  ifdebug(7) {
828  fprintf(stderr, "projected normalised system is:\n");
829  sc_syst_debug(sc);
830  }
831  /*eliminate v in the list of variables pve*/
832  if(prv == NULL) /* it's in head */
833  pve = pv1 = pv1->succ;
834  else
835  prv->succ = pv1 = pv1->succ;
836  }
837  }
838  }
839  }
840 
841  pips_assert("sc is consistent after the second use of equations",
842  sc_consistent_p(sc));
843  ifdebug(7) {
844  pips_debug(7, "Variables left to project with Fourier-Motzkin: ");
845  vect_dump(pve);
846  }
847 
848  /* carry out the elimination using Fourier-Motzkin for the other variables */
849 
850  if(pve != NULL) {
851  pv1 = pve;
852 
853  while(pv1 != NULL) {
854 
855  NbrProjFMTotal++;
856  syst_size_init = nb_elems_list(sc->inegalites);
857  v = pv1->var;
858 
859  ifdebug(7) {
860  fprintf(stderr, "eliminate %s by F-M\n", entity_local_name((entity)v));
861  pips_debug(7, "is_test_exact before: ");
862  if(is_test_exact)
863  fprintf(stderr, "%s\n", "exact");
864  else
865  fprintf(stderr, "%s\n", "not exact");
866  }
867 
868  if(combiner_ofl_with_test(sc, v) == false) {
869  /* detection of non feasability of Psysteme sc */
870  if(is_test_Di)
871  NbrTestProjFMDi++;
872  else
873  NbrTestProjFM++;
874  sc_rm(sc);
875  sc = sc_empty(base_sc);
876  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
877  v = pv1->var;
879  }
880 
881  vect_rm(pve_to_free);
882 
883  pips_debug(7, "Return 5: empty\n");
884  return sc;
885  }
886 
887  sc = sc_normalize(sc);
888 
889  if(sc_empty_p(sc)) {
890  if(is_test_Di)
891  NbrTestProjFMDi++;
892  else
893  NbrTestProjFM++;
894  pips_debug(7, "normalisation-infaisable\n");
895  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
896  v = pv1->var;
898  }
899 
900  vect_rm(pve_to_free);
901 
902  pips_debug(7, "Return 6: empty\n");
903  return sc;
904  }
905 
906  /* sc->inegalites = contrainte_sort(sc->inegalites, sc->base, BASE_NULLE, */
907  /* true, false); */
908 
909  /* ifdebug(8) { */
910  /* debug(8, "", "Sorted system :\n"); */
911  /* sc_syst_debug(sc); */
912  /* } */
913 
915 
916  ifdebug(7) {
917  pips_debug(7, "is_test_exact after: ");
918  if(is_test_exact)
919  fprintf(stderr, "%s\n", "exact");
920  else
921  fprintf(stderr, "%s\n", "not exact");
922  fprintf(stderr, "projected normalised system is:\n");
923  sc_syst_debug(sc);
924  }
925  if(nb_elems_list(sc->inegalites) <= syst_size_init)
926  NbrFMSystNonAug++;
927  pv1 = pv1->succ;
928  }
929  }
930 
931  pips_assert("sc is consistent before base update", sc);
932 
933  /* Are we done? This used to be always true, but sc_normalize()
934  may promote inequalities as equations. Since the projection
935  steps may reveal some implicit equations, we are not sure here
936  that all projections have been performed by the three steps
937  (equations, equations, inequalities).
938 
939  See for instance the test dependence in SAC/sgemm for such an example.
940  */
941  Pbase mb = sc_to_minimal_basis(sc);
942  lb = base_intersection(mb, pv);
943  vect_rm(mb);
944 
945  } while(!BASE_NULLE_P(lb)); // No need to free lb since it is empty
946 
947  /* Update the base and the dimension of the constraint system sc */
948 
949  sc->nb_ineq = nb_elems_list(sc->inegalites);
950  for (pv1 = pv; pv1 != NULL; pv1 = pv1->succ) {
951  v = pv1->var;
953  }
954 
955  pips_assert("sc is consistent after base update", sc);
956 
957  /* Clean up auxiliary data structures */
958  vect_rm(pve_to_free);
959  base_rm(base_sc);
960 
961  pips_debug(7, "final return: faisable\n");
962 
963  return sc;
964 }
#define value_notone_p(val)
Pbase base_intersection(Pbase b1, Pbase b2)
Return variables/dimensions present in bases b1 and b2.
Definition: base.c:473
void prv(Pvecteur pv)
Definition: comp_util.c:246
void sc_syst_debug(Psysteme s)
constraint_to_text.c
void egalite_debug(Pcontrainte c)
Pcontrainte contrainte_var_min_coeff(Pcontrainte, Variable, Value *, bool)
Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list ...
Definition: unaires.c:345
void vect_dump(Pvecteur v)
void vect_dump(Pvecteur v): print sparse vector v on stderr.
Definition: io.c:304
int NbrTestProjFMDi
Definition: ricedg.h:148
int NbrFMSystNonAug
Definition: ricedg.h:153
int NbrProjFMTotal
Definition: ricedg.h:152
bool is_test_inexact_eq
Definition: ricedg.h:156
int NbrTestProjEq
Definition: ricedg.h:149
int NbrTestProjEqDi
Definition: ricedg.h:147
int NbrTestProjFM
Definition: ricedg.h:150
void sc_base_remove_variable(Psysteme sc, Variable v)
Definition: sc.c:239
Psysteme sc_empty(Pbase b)
Psysteme sc_empty(Pbase b): build a Psysteme with one unfeasible constraint to define the empty subsp...
Definition: sc_alloc.c:319
Pbase sc_to_minimal_basis(Psysteme ps)
creation d'une base contenant toutes les variables apparaissant avec des coefficients non-nuls dans l...
Definition: sc_alloc.c:76
void build_sc_nredund_2pass_ofl_ctrl(Psysteme volatile *psc, int ofl_ctrl)
int nb_eq
Definition: sc-local.h:72
Variable var
Definition: vecteur-local.h:90
static bool combiner_ofl_with_test(Psysteme sc, Variable v)
bool combiner_ofl_with_test(Psysteme sc, Variable v):
Definition: testdep_util.c:533
#define BASE_NULLE_P(b)
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

References Ssysteme::base, base_dup(), base_intersection(), BASE_NULLE, BASE_NULLE_P, base_rm, build_sc_nredund_2pass_ofl_ctrl(), combiner_ofl_with_test(), contrainte_var_min_coeff(), egalite_debug(), Ssysteme::egalites, entity_local_name(), eq, fprintf(), free(), FWD_OFL_CTRL, ifdebug, Ssysteme::inegalites, is_test_Di, is_test_exact, is_test_inexact_eq, nb_elems_list(), Ssysteme::nb_eq, Ssysteme::nb_ineq, NbrFMSystNonAug, NbrProjFMTotal, NbrTestProjEq, NbrTestProjEqDi, NbrTestProjFM, NbrTestProjFMDi, pips_assert, pips_debug, prv(), sc_base_remove_variable(), sc_consistent_p(), sc_empty(), sc_empty_p(), sc_normalize(), sc_rm(), sc_syst_debug(), sc_to_minimal_basis(), Svecteur::succ, value_notone_p, Svecteur::var, vect_dump(), vect_dup(), vect_rm(), and VECTEUR_NUL_P.

Referenced by sc_faisabilite_optim(), sc_minmax_of_variable_optim(), and sc_proj_optim_on_di_ofl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vect_chg_var_sign()

void vect_chg_var_sign ( Pvecteur ppv,
Variable  var 
)

void vect_chg_var_sign(Pvecteur *ppv, Variable var) changement de signe de la coordonnee var du vecteur *ppv

Parameters
ppvpv
varar

Definition at line 1080 of file testdep_util.c.

1081  {
1082  Pvecteur pvcour;
1083 
1084  for (pvcour = (*ppv); pvcour != NULL; pvcour = pvcour->succ)
1085  if(pvcour->var == var)
1086  value_oppose(pvcour->val);
1087 
1088  return;
1089 }
#define value_oppose(ref)
Value val
Definition: vecteur-local.h:91

References Svecteur::succ, Svecteur::val, value_oppose, and Svecteur::var.

Referenced by sc_invers().

+ Here is the caller graph for this function:

Variable Documentation

◆ DiVars

entity DiVars[MAXDEPTH]

here is a collection of function intended to create and manipulate "di" variables and test of dependence.

testdep_util.c

di variables are pseudo variables created by PIPS and not accessible to the user that represent the distance between two dependent statement iterations. the sign of this distance is sufficient for Kennedy's way of parallelizing programs, but the exact value migth be of interest for other algorithms such as systolic algorithms.

Written by Remi, Yi-Qing; reorganized by Yi-Qing (18/09/91) To deal with overflow errors occuring during the projection of a Psysteme along a variable The tables of di variables, li variables and ds variables.

Variable DiVars[i-1] or LiVars[i-1] is associated to the loop at nesting level i. A di variable represents the difference in iteration number between the two references considered.

The variable DsiVars[i] is associated to the ith element in the list of scalar variables modified in the loops

Definition at line 53 of file testdep_util.c.

Referenced by DiVarLevel(), and GetDiVar().

◆ DsiVars

entity DsiVars[MAXSV]

Definition at line 55 of file testdep_util.c.

Referenced by GetDsiVar().

◆ ilc

int ilc = ILCMAX
static

Definition at line 327 of file testdep_util.c.

Referenced by MakeLoopCounter(), and ResetLoopCounter().

◆ LiVars

entity LiVars[MAXDEPTH]

Definition at line 54 of file testdep_util.c.

Referenced by GetLiVar().