PIPS
contrainte.h File Reference

Go to the source code of this file.

Data Structures

struct  Scontrainte
 

Macros

#define CONTRAINTE   1005
 Warning! Do not modify this file that is automatically generated! More...
 
#define egalite_print(eg)   egalite_fprint(stdout,eg)
 MACROS ET CONSTANTES. More...
 
#define inegalite_print(ineg)   inegalite_fprint(stdout,ineg)
 FI: this macro requires an additional parameter or a default value as third parameter of inegalite_fprint() More...
 
#define contrainte_vecteur(c)   ((c)->vecteur)
 passage au champ vecteur d'une contrainte "a la Newgen" More...
 
#define contrainte_succ(c)   ((c)->succ)
 
#define CONTRAINTE_NULLE_P(c)   (VECTEUR_NUL_P(contrainte_vecteur(c)))
 contrainte nulle (non contrainte 0 == 0 ou 0 <= 0) More...
 
#define CONTRAINTE_UNDEFINED   ((Pcontrainte) NULL)
 
#define CONTRAINTE_UNDEFINED_P(c)   ((c)==CONTRAINTE_UNDEFINED)
 
#define COEFF_CST(c)   vect_coeff(TCST,(c)->vecteur)
 int COEFF_CST(Pcontrainte c): terme constant d'une contrainte More...
 
#define contrainte_rm(c)   (void) contrainte_free(c)
 the standard xxx_rm does not return a value More...
 
#define VERSION_FINALE
 
#define CONTRAINTE_RM(rd, f)   contrainte_rm(rd)
 

Typedefs

typedef struct Scontrainte Scontrainte
 
typedef struct ScontraintePcontrainte
 
typedef Scontrainte Segalite
 
typedef ScontraintePegalite
 
typedef Scontrainte Sinegalite
 
typedef ScontraintePinegalite
 

Functions

Pcontrainte contrainte_new (void)
 CONTRAINTE. More...
 
Pcontrainte contrainte_make (Pvecteur)
 Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecteur passe en parametre. More...
 
Pcontrainte contrainte_make_1D (Value, Variable, Value, bool)
 Generate a constraint a x <= b or a x >= b, according to less_p, or ax==b, regardless of less_p. More...
 
Pcontrainte contraintes_make (Pvecteur,...)
 Convert a list of vectors into a list of constraints. More...
 
Pcontrainte contrainte_dup (Pcontrainte)
 Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de la contrainte c_in (i.e. More...
 
Pcontrainte contraintes_dup (Pcontrainte)
 Pcontrainte contraintes_dup(Pcontrainte c_in) a list of constraints is copied. More...
 
Pcontrainte contrainte_free (Pcontrainte)
 Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c ainsi que de ses champs vecteur et saturations; seul le lien vers la contrainte suivante est ignore. More...
 
Pcontrainte contraintes_free (Pcontrainte)
 Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc. More...
 
void dbg_contrainte_rm (Pcontrainte, char *)
 void dbg_contrainte_rm(Pcontrainte c): version debug de contrainte rm; trace de la desallocation et impression de la contrainte sur stdout More...
 
Pcontrainte contrainte_copy (Pcontrainte)
 Have a look at contrainte_dup and contraintes_dup which reverse the order of the list This copy version (including vect_copy, sc_copy) maintains the order (DN,24/6/02) More...
 
Pcontrainte contraintes_copy (Pcontrainte)
 Pcontrainte contraintes_copy(Pcontrainte c_in) a list of constraints is copied with the same order In fact, here we only need to replace contrainte_dup by contrainte_copy Have a look at contrainte_copy (DN,24/6/02) More...
 
int contrainte_subst_ofl (Variable, Pcontrainte, Pcontrainte, bool)
 binaires.c More...
 
int contrainte_subst (Variable, Pcontrainte, Pcontrainte, bool)
 
Pcontrainte contrainte_substitute_dimension (Pcontrainte, Variable, Pvecteur)
 
Pcontrainte inegalite_comb (Pcontrainte, Pcontrainte, Variable)
 
Pcontrainte inegalite_comb_ofl (Pcontrainte, Pcontrainte, Variable)
 
int contrainte_subst_ofl_ctrl (Variable, Pcontrainte, Pcontrainte, bool, int)
 int contrainte_subst_ofl_ctrl(Variable v, Pcontrainte def, Pcontrainte c
Boolean eq_p, int ofl_ctrl): elimination d'une variable v entre une equation def et une contrainte, egalite ou inegalite, c. More...
 
Pcontrainte inegalite_comb_ofl_ctrl (Pcontrainte, Pcontrainte, Variable, int)
 Pcontrainte inegalite_comb_ofl_ctrl(Pcontrainte posit, Pcontrainte negat, Variable v, int ofl_ctrl): combinaison lineaire positive des deux inegalites posit et negat eliminant la variable v. More...
 
Value eq_diff_const (Pcontrainte, Pcontrainte)
 Value eq_diff_const(Pcontrainte c1, Pcontrainte c2): calcul de la difference des deux termes constants des deux equations c1 et c2. More...
 
Value eq_sum_const (Pcontrainte, Pcontrainte)
 Value eq_sum_const(Pcontrainte c1, Pcontrainte c2): calcul de la somme des deux termes constants des deux contraintes c1 et c2. More...
 
Pcontrainte contrainte_append (Pcontrainte, Pcontrainte)
 Pcontrainte contrainte_append(c1, c2) Pcontrainte c1, c2;. More...
 
Pcontrainte extract_common_constraints (Pcontrainte *, Pcontrainte *, bool)
 common (simply equal) contraints are extracted, whether equalities or inequalities. More...
 
void contrainte_error (char *, char *,...)
 error.c More...
 
void contrainte_fprint (FILE *, Pcontrainte, bool, char *(*)(Variable))
 io.c More...
 
void egalite_fprint (FILE *, Pcontrainte, char *(*)(Variable))
 
void egalite_dump (Pcontrainte)
 void egalite_dump(Pcontrainte c): impression "physique" d'une egalite; utilise en debugging More...
 
void inegalite_fprint (FILE *, Pcontrainte, char *(*)(Variable))
 
void inegalite_dump (Pcontrainte)
 void inegalite_dump(Pcontrainte c): impression "physique" d'une inegalite; utilise en debugging More...
 
void egalites_fprint (FILE *, Pcontrainte, char *(*)(Variable))
 
void egalites_dump (Pcontrainte)
 
void inegalites_fprint (FILE *, Pcontrainte, char *(*)(Variable))
 
void inegalites_dump (Pcontrainte)
 
void sprint_operator (char *, bool, bool)
 
char * contrainte_sprint (char *, Pcontrainte, bool, char *(*)(Variable))
 
char * contrainte_sprint_format (char *, Pcontrainte, bool, char *(*)(Variable), bool)
 
char * egalite_sprint (char *, Pcontrainte, char *(*)(Variable))
 
char * inegalite_sprint (char *, Pcontrainte, char *(*)(Variable))
 
char * egalite_sprint_format (char *, Pcontrainte, char *(*)(Variable), bool)
 
char * inegalite_sprint_format (char *, Pcontrainte, char *(*)(Variable), bool)
 
bool contrainte_in_liste (Pcontrainte, Pcontrainte)
 listes.c More...
 
int constraint_rank (Pcontrainte, Pcontrainte)
 Return the rank of constraint c in constraint list lc. More...
 
bool egalite_in_liste (Pcontrainte, Pcontrainte)
 bool egalite_in_liste(Pcontrainte eg, Pcontrainte leg): test si une egalite appartient a une liste d'egalites More...
 
int nb_elems_list (Pcontrainte)
 int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes More...
 
bool cyclic_constraint_list_p (Pcontrainte)
 Check if list l contains a cycle. More...
 
int safe_nb_elems_list (Pcontrainte, int)
 Compute the number of elements in the list if it is less than n. More...
 
Pcontrainte contrainte_remove_large_coef (Pcontrainte, Value)
 
bool contrainte_normalize (Pcontrainte, bool)
 normalize.c More...
 
bool egalite_normalize (Pcontrainte)
 bool egalite_normalize(Pcontrainte eg): reduction d'une equation diophantienne par le pgcd de ses coefficients; l'equation est infaisable si le terme constant n'est pas divisible par ce pgcd More...
 
bool inegalite_normalize (Pcontrainte)
 bool inegalite_normalize(Pcontrainte ineg): normalisation d'une inegalite a variables entieres; voir contrainte_normalize; retourne presque toujours true car une inegalite n'ayant qu'un terme constant est toujours faisable a moins qu'il ne reste qu'un terme constant strictement positif. More...
 
bool eq_smg (Pcontrainte, Pcontrainte)
 predicats.c More...
 
bool inequalities_opposite_p (Pcontrainte, Pcontrainte)
 bool inequalities_opposite_p(Pcontrainte c1, Pcontrainte c2): True if the non-constant part of c1 is the opposite of the non-constant part of c2. More...
 
bool egalite_equal (Pcontrainte, Pcontrainte)
 bool egalite_equal(Pcontrainte eg1, Pcontrainte eg2): teste l'equivalence de deux egalites; leurs coefficients peuvent etre tous egaux ou tous opposes; pour obtenir une meilleure equivalence il faut commencer par reduire leurs coefficients par les PGCD More...
 
bool contrainte_equal (Pcontrainte, Pcontrainte)
 bool contrainte_equal(Pcontrainte c1, Pcontrainte c2): test d'egalite des contraintes c1 et c2; elles sont egales si tous leurs coefficients et leur termes constants sont egaux; il faut les avoir normalisees auparavant pour etre sur de leur egalite; More...
 
bool contrainte_parallele (Pcontrainte, Pcontrainte, Value *, Value *)
 Les deux contraintes c1 et c2 sont paralleles s'il existe deux coefficients a1 et a2 tels que a1 c1 + a2 c2 est reduit un terme constant K. More...
 
bool contrainte_constante_p (Pcontrainte)
 bool contrainte_constante_p(Pcontrainte c): test de contrainte triviale sans variables (ie du type 0<= K ou 0<=0 ou 0 == 0 ou 0 == K) More...
 
bool vect_constant_p (Pvecteur)
 bool vect_constant_p(Pvecteur v): v contains only a constant term, may be zero More...
 
bool contrainte_verifiee (Pcontrainte, bool)
 bool contrainte_verifiee(Pcontrainte ineg, bool eq_p): test de faisabilite d'inegalite (eq_p == false) ou d'egalite triviale More...
 
bool contrainte_oppos (Pcontrainte, Pcontrainte)
 bool contrainte_oppos(Pcontrainte ineg1, Pcontrainte ineg2): indique si 2 inegalites forment une egalite ou si deux egalites sont equivalentes. More...
 
bool constraint_without_vars (Pcontrainte, Pbase)
 bool constraint_without_vars(c, vars) Pcontrainte c; Pbase vars; More...
 
bool constraints_without_vars (Pcontrainte, Pbase)
 bool constraints_without_vars(pc, vars) Pcontrainte pc; Pbase vars; More...
 
Value contrainte_eval (Pvecteur, Pvecteur)
 Evaluate constraint c according to values in v and return the constant obtained. More...
 
bool contrainte_eval_p (Pvecteur, Pvecteur, bool)
 Evaluate constraint c according to values in v and return true if the constraint is met. More...
 
bool equality_eval_p (Pvecteur, Pvecteur)
 
bool inequality_eval_p (Pvecteur, Pvecteur)
 
void norm_eq (Pcontrainte)
 unaires.c More...
 
void contrainte_chg_sgn (Pcontrainte)
 void contrainte_chg_sgn(Pcontrainte eq): changement de signe d'une contrainte, i.e. More...
 
void contrainte_reverse (Pcontrainte)
 void contrainte_reverse(Pcontrainte eq): changement de signe d'une contrainte, i.e. More...
 
void eq_set_vect_nul (Pcontrainte)
 void_eq_set_vect_nul(Pcontrainte c): transformation d'une contrainte en une contrainte triviale 0 == 0 More...
 
Pcontrainte contrainte_translate (Pcontrainte, Pbase, char *(*)(void))
 
Pcontrainte contrainte_variable_rename (Pcontrainte, Variable, Variable)
 Pcontrainte contrainte_variable_rename(Pcontrainte c, Variable v_old, Variable v_new): rename the potential coordinate v_old in c as v_new. More...
 
void Pcontrainte_separate_on_vars (Pcontrainte, Pbase, Pcontrainte *, Pcontrainte *)
 void Pcontrainte_separate_on_vars(initial, vars, pwith, pwithout) Pcontrainte initial; Pbase vars; Pcontrainte *pwith, *pwithout; More...
 
void constraints_for_bounds (Variable, Pcontrainte *, Pcontrainte *, Pcontrainte *)
 void constraints_for_bounds(var, pinit, plower, pupper) Variable var; Pcontrainte *pinit, *plower, *pupper; IN: var, *pinit; OUT: *pinit, *plower, *pupper; More...
 
Pcontrainte contrainte_dup_extract (Pcontrainte, Variable)
 Pcontrainte contrainte_dup_extract(c, var) Pcontrainte c; Variable var;. More...
 
Pcontrainte contrainte_extract (Pcontrainte *, Pbase, Variable)
 Pcontrainte contrainte_extract(pc, base, var) Pcontrainte *pc; Pbase base; Variable var;. More...
 
int level_contrainte (Pcontrainte, Pbase)
 int level_contrainte(Pcontrainte pc, Pbase base_index) compute the level (rank) of the constraint pc in the nested loops. More...
 
void contrainte_vect_sort (Pcontrainte, int(*)(Pvecteur *, Pvecteur *))
 
Pcontrainte contrainte_var_min_coeff (Pcontrainte, Variable, Value *, bool)
 Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list of constraints (euqalities or inequalities), a variable, and the location of an integer. More...
 
int equation_lexicographic_compare (Pcontrainte, Pcontrainte, int(*)(Pvecteur *, Pvecteur *))
 
int inequality_lexicographic_compare (Pcontrainte, Pcontrainte, int(*)(Pvecteur *, Pvecteur *))
 
Pcontrainte equations_lexicographic_sort (Pcontrainte, int(*)(Pvecteur *, Pvecteur *))
 
Pcontrainte inequalities_lexicographic_sort (Pcontrainte, int(*)(Pvecteur *, Pvecteur *))
 
Pcontrainte constraints_lexicographic_sort (Pcontrainte, int(*)(Pvecteur *, Pvecteur *))
 For historical reasons, equal to equations_lexicographic_sort() More...
 
Pcontrainte constraints_lexicographic_sort_generic (Pcontrainte, int(*)(Pvecteur *, Pvecteur *), bool)
 
Variable contrainte_simple_equality (Pcontrainte)
 returns whether a constraint is a simple equality: X == 12 the system is expected to be normalized? More...
 

Macro Definition Documentation

◆ COEFF_CST

#define COEFF_CST (   c)    vect_coeff(TCST,(c)->vecteur)

int COEFF_CST(Pcontrainte c): terme constant d'une contrainte

Definition at line 125 of file contrainte.h.

◆ CONTRAINTE

#define CONTRAINTE   1005

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/contrainte/contrainte-local.h instead, to add your own modifications. header file built by cproto contrainte-local.h package sur les contraintes.

Une contrainte est une egalite ou une inegalite. Elle est representee par un vecteur dont une coordonnee particuliere, TCST, represente le terme constant.

Les contraintes sont stockees sous forme de membres gauches, ce qui n'est utile a savoir que pour les inegalites:

 sum a x + b <= 0
  i   i i

ou b est le terme constant.

Les tableaux de saturations sont calcules en fonction de polyedre (systeme generateur ou systeme de contraintes) et leurs dimensions sont inconnues au niveau des contraintes. Ils sont ignores la plupart du temps.

Les contraintes sont traitees sous forme de liste de contraintes (systeme d'egalites ou systeme d'inegalites) et possedent un champ de chainage. Certaines des fonctions portent sur des listes de contraintes et non sur des contraintes. Cette double semantique complique beaucoup les choses.

Le pointeur NULL represente implicitement l'une des contraintes toujours faisables, 0 == 0 ou 0 <= 0. Au moins, la plupart du temps... car il represente la valeur CONTRAINTE_UNDEFINED dans les routines de gestion memoire.

Il vaut mieux utiliser la macro CONTRAINTE_NULLE_P() qui verifie que le vecteur associe est le VECTEUR_NUL.

Les contraintes trivialement faisables et infaisables sont representees par un unique terme constant: 0 == k, 0 <= k, 0 <= -k (k positif). Il existe deux fonctions pour les tester.

Autres packages a inclure:

Malik Imadache, Corinne Ancourt, Neil Butler, Francois Irigoin

Bugs:

  • melange de la notion de chainage et de la notion de terme constant
  • definition directe de TCST: on ne peut pas decider dynamiquement de la variable representant le terme constant
  • definition de TCST au niveau contrainte, alors que TCST doit etre utilise au niveau vecteur (cf. macro term_cst())

Modifications:

  • passage du terme constant a gauche (FI, 24/11/89)
  • deplacement de la definition du terme constant TCST et de la macro term_cst dans le package vecteur (PB, 06/06/90) constante associee a la structure de donnees "contrainte"

Definition at line 92 of file contrainte.h.

◆ CONTRAINTE_NULLE_P

#define CONTRAINTE_NULLE_P (   c)    (VECTEUR_NUL_P(contrainte_vecteur(c)))

contrainte nulle (non contrainte 0 == 0 ou 0 <= 0)

Definition at line 118 of file contrainte.h.

◆ contrainte_rm

#define contrainte_rm (   c)    (void) contrainte_free(c)

the standard xxx_rm does not return a value

Definition at line 128 of file contrainte.h.

◆ CONTRAINTE_RM

#define CONTRAINTE_RM (   rd,
  f 
)    contrainte_rm(rd)

Definition at line 134 of file contrainte.h.

◆ contrainte_succ

#define contrainte_succ (   c)    ((c)->succ)

Definition at line 115 of file contrainte.h.

◆ CONTRAINTE_UNDEFINED

#define CONTRAINTE_UNDEFINED   ((Pcontrainte) NULL)

Definition at line 120 of file contrainte.h.

◆ CONTRAINTE_UNDEFINED_P

#define CONTRAINTE_UNDEFINED_P (   c)    ((c)==CONTRAINTE_UNDEFINED)

Definition at line 122 of file contrainte.h.

◆ contrainte_vecteur

#define contrainte_vecteur (   c)    ((c)->vecteur)

passage au champ vecteur d'une contrainte "a la Newgen"

Definition at line 113 of file contrainte.h.

◆ egalite_print

#define egalite_print (   eg)    egalite_fprint(stdout,eg)

MACROS ET CONSTANTES.

Definition at line 107 of file contrainte.h.

◆ inegalite_print

#define inegalite_print (   ineg)    inegalite_fprint(stdout,ineg)

FI: this macro requires an additional parameter or a default value as third parameter of inegalite_fprint()

Definition at line 110 of file contrainte.h.

◆ VERSION_FINALE

#define VERSION_FINALE

Definition at line 130 of file contrainte.h.

Typedef Documentation

◆ Pcontrainte

typedef struct Scontrainte* Pcontrainte

◆ Pegalite

typedef Scontrainte * Pegalite

Definition at line 101 of file contrainte.h.

◆ Pinegalite

Definition at line 103 of file contrainte.h.

◆ Scontrainte

typedef struct Scontrainte Scontrainte

◆ Segalite

Definition at line 101 of file contrainte.h.

◆ Sinegalite

Definition at line 103 of file contrainte.h.

Function Documentation

◆ constraint_rank()

int constraint_rank ( Pcontrainte  c,
Pcontrainte  lc 
)

Return the rank of constraint c in constraint list lc.

1 for the first element, and so on, Fortran style. 0 when c is not in lc.

The comparisons are based on the pointers, not on the values of the constraints. It is mainly useful to detect cycles in constraint list.

Parameters
lcc

Definition at line 75 of file listes.c.

76 {
77  Pcontrainte cc;
78  int rank = 0;
79 
81 
82  if (CONTRAINTE_NULLE_P(c))
83  ;
84  else {
85  for (cc=lc; !CONTRAINTE_UNDEFINED_P(cc); cc=cc->succ) {
86  rank++;
87  // This would be useful to detect duplicate constraints
88  // if (vect_equal((c1->vecteur),(c->vecteur))) {
89 
90  // Physical check
91  if(cc==c)
92  break;
93  }
94  }
95 
96  return rank;
97 }
#define CONTRAINTE_UNDEFINED_P(c)
#define CONTRAINTE_NULLE_P(c)
contrainte nulle (non contrainte 0 == 0 ou 0 <= 0)
static entity rank
#define assert(ex)
Definition: newgen_assert.h:41
struct Scontrainte * succ

References assert, CONTRAINTE_NULLE_P, CONTRAINTE_UNDEFINED_P, rank, and Scontrainte::succ.

Referenced by cyclic_constraint_list_p().

+ Here is the caller graph for this function:

◆ constraint_without_vars()

bool constraint_without_vars ( Pcontrainte  c,
Pbase  vars 
)

bool constraint_without_vars(c, vars) Pcontrainte c; Pbase vars;

IN: c, vars

OUT: returned boolean

returns if the current constraint uses none of the variables in vars.

(c) FC 16/05/94

Parameters
varsars

Definition at line 276 of file predicats.c.

279 {
280  Pbase
281  b = BASE_NULLE;
282 
283  for(b=vars;
284  b!=BASE_NULLE;
285  b=b->succ)
286  if (vect_coeff(var_of(b), c->vecteur)!=(Value) 0) return(false);
287 
288  return(true);
289 }
int Value
Pvecteur vecteur
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
#define var_of(varval)
#define BASE_NULLE
MACROS SUR LES BASES.
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 BASE_NULLE, Svecteur::succ, var_of, and vect_coeff().

Referenced by constraints_without_vars(), and Pcontrainte_separate_on_vars().

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

◆ constraints_for_bounds()

void constraints_for_bounds ( Variable  var,
Pcontrainte pinit,
Pcontrainte plower,
Pcontrainte pupper 
)

void constraints_for_bounds(var, pinit, plower, pupper) Variable var; Pcontrainte *pinit, *plower, *pupper; IN: var, *pinit; OUT: *pinit, *plower, *pupper;

separate the constraints involving var for upper and lower bounds The constraints are removed from the original system. everything is touched. Should be fast because there is no allocation.

FC 28/11/94

v==0

Parameters
varar
pinitinit
plowerlower
pupperupper

Definition at line 176 of file unaires.c.

179 {
180  Value
181  v;
183  c, next,
184  remain = NULL,
185  lower = NULL,
186  upper = NULL;
187 
188  for(c = *pinit, next=(c==NULL ? NULL : c->succ);
189  c!=NULL;
190  c=next, next=(c==NULL ? NULL : c->succ))
191  {
192  v = vect_coeff(var, c->vecteur);
193 
194  if (value_pos_p(v))
195  c->succ = upper, upper = c;
196  else if (value_neg_p(v))
197  c->succ = lower, lower = c;
198  else /* v==0 */
199  c->succ = remain, remain = c;
200  }
201 
202  *pinit = remain,
203  *plower = lower,
204  *pupper = upper;
205 }
#define value_pos_p(val)
#define value_neg_p(val)

References Scontrainte::succ, value_neg_p, value_pos_p, vect_coeff(), and Scontrainte::vecteur.

Referenced by do_array_expansion(), do_check_isolate_statement_preconditions_on_call(), do_isolate_statement_preconditions_satisified_p(), do_solve_hardware_constraints_on_nb_proc(), make_rectangular_area(), region_to_minimal_dimensions(), statement_insertion_fix_access(), systeme_to_loop_nest(), and variable_to_dimensions().

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

◆ constraints_lexicographic_sort()

Pcontrainte constraints_lexicographic_sort ( Pcontrainte  cl,
int(*)(Pvecteur *, Pvecteur *)  compare 
)

For historical reasons, equal to equations_lexicographic_sort()

Parameters
cll

Definition at line 461 of file unaires.c.

463 {
465 
466  result = constraints_lexicographic_sort_generic(cl, compare, true);
467 
468  return result;
469 }
#define CONTRAINTE_UNDEFINED
Pcontrainte constraints_lexicographic_sort_generic(Pcontrainte cl, int(*compare)(Pvecteur *, Pvecteur *), bool is_equation)
Definition: unaires.c:472

References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.

+ Here is the call graph for this function:

◆ constraints_lexicographic_sort_generic()

Pcontrainte constraints_lexicographic_sort_generic ( Pcontrainte  cl,
int(*)(Pvecteur *, Pvecteur *)  compare,
bool  is_equation 
)

the temporary table is created and initialized

sort!

the vector is regenerated in order

clean and return

Parameters
cll
is_equations_equation

Definition at line 472 of file unaires.c.

475 {
476  int n = nb_elems_list(cl);
478  Pcontrainte * table = NULL;
479  Pcontrainte * elem = NULL;
480  Pcontrainte ce;
481 
482  if ( n==0 || n==1 )
483  return cl;
484 
485  lexicographic_compare = compare;
486 
487  /* the temporary table is created and initialized
488  */
489  table = (Pcontrainte*) malloc(sizeof(Pcontrainte)*n);
490  assert(table!=NULL);
491 
492  for (ce=cl, elem=table; ce!=CONTRAINTE_UNDEFINED; ce=ce->succ, elem++)
493  *elem=ce;
494 
495  /* sort!
496  */
497  if(is_equation)
498  qsort((char *) table, n, sizeof(Pcontrainte),
499  (int (*)()) internal_equation_compare);
500  else
501  qsort((char *) table, n, sizeof(Pcontrainte),
502  (int (*)()) internal_inequality_compare);
503 
504  /* the vector is regenerated in order
505  */
506  for (elem=table; n>1; elem++, n--)
507  (*elem)->succ=*(elem+1);
508 
509  (*elem)->succ= CONTRAINTE_UNDEFINED;
510 
511  /* clean and return
512  */
513  result = *table;
514  free(table);
515  return result;
516 }
static int internal_equation_compare(Pcontrainte *pc1, Pcontrainte *pc2)
Definition: unaires.c:408
static int internal_inequality_compare(Pcontrainte *pc1, Pcontrainte *pc2)
Definition: unaires.c:429
static int(* lexicographic_compare)(Pvecteur *, Pvecteur *)
Required because qsort (and C) do no let us parametrize the comparison function (no lambda closure).
Definition: unaires.c:392
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
void * malloc(YYSIZE_T)
void free(void *)

References assert, CONTRAINTE_UNDEFINED, free(), internal_equation_compare(), internal_inequality_compare(), lexicographic_compare, malloc(), nb_elems_list(), and Scontrainte::succ.

Referenced by constraints_lexicographic_sort(), equations_lexicographic_sort(), and inequalities_lexicographic_sort().

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

◆ constraints_without_vars()

bool constraints_without_vars ( Pcontrainte  pc,
Pbase  vars 
)

bool constraints_without_vars(pc, vars) Pcontrainte pc; Pbase vars;

IN: c, vars

OUT: returned boolean

returns true if none of the constraints use the variables in vars.

Parameters
pcc
varsars

Definition at line 300 of file predicats.c.

303 {
304  Pcontrainte c;
305 
306  for (c=pc;
307  c!=NULL;
308  c=c->succ)
309  if (!constraint_without_vars(c, vars)) return(false);
310 
311  return(true);
312 }
bool constraint_without_vars(Pcontrainte c, Pbase vars)
bool constraint_without_vars(c, vars) Pcontrainte c; Pbase vars;
Definition: predicats.c:276

References constraint_without_vars(), and Scontrainte::succ.

+ Here is the call graph for this function:

◆ contrainte_append()

Pcontrainte contrainte_append ( Pcontrainte  c1,
Pcontrainte  c2 
)

Pcontrainte contrainte_append(c1, c2) Pcontrainte c1, c2;.

append directly c2 to c1. Neither c1 nor c2 are relevant when the result is returned.

Parameters
c11
c22

Definition at line 267 of file binaires.c.

269 {
270  Pcontrainte c;
271 
272  if (c1==NULL) return(c2);
273  if (c2==NULL) return(c1);
274  for (c=c1; c->succ!=NULL; c=c->succ);
275  c->succ=c2;
276  return(c1);
277 }

References Scontrainte::succ.

Referenced by algorithm_row_echelon_generic(), and sc_bounded_normalization().

+ Here is the caller graph for this function:

◆ contrainte_chg_sgn()

void contrainte_chg_sgn ( Pcontrainte  c)

void contrainte_chg_sgn(Pcontrainte eq): changement de signe d'une contrainte, i.e.

multiplication par -1. Les equations ne sont pas modifiees mais les inequations sont transformees.

Ancien nom: ch_sgn

Definition at line 56 of file unaires.c.

58 {
60 }
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151

References vect_chg_sgn().

Referenced by contrainte_reverse(), contrainte_var_min_coeff(), eq_redund_with_sc_p(), make_tile_constraints(), sc_supress_same_constraints(), and tile_membership().

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

◆ contrainte_constante_p()

bool contrainte_constante_p ( Pcontrainte  c)

bool contrainte_constante_p(Pcontrainte c): test de contrainte triviale sans variables (ie du type 0<= K ou 0<=0 ou 0 == 0 ou 0 == K)

Les equations non-faisables ne sont pas detectees.

Modifications:

Definition at line 192 of file predicats.c.

194 {
195 
196  if (CONTRAINTE_NULLE_P(c))
197  return(true);
198  else {
200  }
201 }
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
bool vect_constant_p(Pvecteur v)
bool vect_constant_p(Pvecteur v): v contains only a constant term, may be zero
Definition: predicats.c:211

References CONTRAINTE_NULLE_P, contrainte_vecteur, and vect_constant_p().

Referenced by combiner_ofl_with_test(), contrainte_subst_ofl_ctrl(), contrainte_verifiee(), gcd_and_constant_dependence_test(), sc_force_variable_to_zero(), and sc_strong_normalize_and_check_feasibility().

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

◆ contrainte_copy()

Pcontrainte contrainte_copy ( Pcontrainte  c_in)

Have a look at contrainte_dup and contraintes_dup which reverse the order of the list This copy version (including vect_copy, sc_copy) maintains the order (DN,24/6/02)

Parameters
c_in_in

Definition at line 254 of file alloc.c.

255 {
256  Pcontrainte c_out = NULL;
257 
258  if(c_in!=NULL) {
259  c_out = contrainte_new();
260  c_out->vecteur = vect_copy(c_in->vecteur);
261  }
262  return c_out;
263 }
FILE * c_in
Definition: c_syntax.h:291
FILE * c_out
Pcontrainte contrainte_new(void)
package contrainte - allocations et desallocations
Definition: alloc.c:47
Pbase vect_copy(Pvecteur b)
direct duplication.
Definition: alloc.c:240

References c_in, c_out, contrainte_new(), and vect_copy().

Referenced by bound_redund_with_sc_p(), build_integer_sc_nredund(), build_sc_nredund_1pass_ofl_ctrl(), contraintes_copy(), eq_redund_with_sc_p(), extract_nredund_subsystem(), ineq_redund_with_sc_p(), sc_append(), sc_safe_append(), sc_strong_normalize2(), sc_strong_normalize_and_check_feasibility(), and sc_strong_normalize_and_check_feasibility2().

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

◆ contrainte_dup()

Pcontrainte contrainte_dup ( Pcontrainte  c_in)

Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de la contrainte c_in (i.e.

duplication d'une contrainte); les tableaux de saturations ne sont pas recopies car on n'en connait pas la dimension. Le lien vers le successeur est aussi ignore pour ne pas cree de sharing intempestif.

allocate c_out; c_out := c_in; return c_out;

Ancien nom: eq_dup() et cp_eq()

Parameters
c_in_in

Definition at line 132 of file alloc.c.

133 {
134  Pcontrainte c_out = NULL;
135 
136  if(c_in!=NULL) {
137  c_out = contrainte_new();
138  c_out->vecteur = vect_dup(c_in->vecteur);
139  }
140  return c_out;
141 }
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 c_in, c_out, contrainte_new(), and vect_dup().

Referenced by build_transfer_equations(), contrainte_dup_extract(), contraintes_dup(), dj_simple_inegs_to_eg(), elim_redund_sc_with_sc(), find_implicit_equation(), find_motif(), get_bounds_expression(), insert_2ineq_end_sc(), insert_ineq_begin_sc(), insert_ineq_end_sc(), make_bounds(), make_tile_constraints(), mapping_on_broadcast(), sc_minmax_of_variable2(), sc_supress_parallel_redund_constraints(), sc_supress_same_constraints(), sc_transform_eg_in_ineg(), sc_transform_ineg_in_eg(), separate_variables(), separate_variables_2(), test_bound_generation(), tile_membership(), and valuer().

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

◆ contrainte_dup_extract()

Pcontrainte contrainte_dup_extract ( Pcontrainte  c,
Variable  var 
)

Pcontrainte contrainte_dup_extract(c, var) Pcontrainte c; Variable var;.

returns a copy of the constraints of c which contain var.

FC 27/09/94

Parameters
varar

Definition at line 215 of file unaires.c.

218 {
220  result = NULL,
221  pc, ctmp;
222 
223  for (pc=c; pc!=NULL; pc=pc->succ)
224  if ((var==NULL) || vect_coeff(var, pc->vecteur)!=0)
225  ctmp = contrainte_dup(pc),
226  ctmp->succ = result,
227  result = ctmp;
228 
229  return(result);
230 }
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
Definition: alloc.c:132

References contrainte_dup(), Scontrainte::succ, and vect_coeff().

Referenced by algorithm_row_echelon_generic().

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

◆ contrainte_equal()

bool contrainte_equal ( Pcontrainte  c1,
Pcontrainte  c2 
)

bool contrainte_equal(Pcontrainte c1, Pcontrainte c2): test d'egalite des contraintes c1 et c2; elles sont egales si tous leurs coefficients et leur termes constants sont egaux; il faut les avoir normalisees auparavant pour etre sur de leur egalite;

La contrainte CONTRAINTE_UNDEFINED est assimilee a la contrainte nulle

Ancien nom: ineg_same()

Modifications:

Parameters
c11
c22

Definition at line 128 of file predicats.c.

129 {
130  register bool
131  undef1 = CONTRAINTE_UNDEFINED_P(c1),
132  undef2 = CONTRAINTE_UNDEFINED_P(c2);
133 
134  if (undef1 || undef2)
135  return(undef1 && undef2);
136 
137  return(vect_equal(contrainte_vecteur(c1),
138  contrainte_vecteur(c2)));
139 }
bool vect_equal(Pvecteur v1, Pvecteur v2)
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
Definition: reductions.c:278

References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, and vect_equal().

Referenced by extract_common_constraints(), sc_elim_db_constraints(), sc_elim_double_constraints(), sc_kill_db_eg(), sc_safe_elim_db_constraints(), and sc_safe_kill_db_eg().

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

◆ contrainte_error()

void contrainte_error ( char *  name,
char *  fmt,
  ... 
)

error.c

error.c

INTLIBRARY void contrainte_error(va_dcl va_alist) should be called to terminate execution and to core dump when data structures are corrupted or when an undefined operation is requested (zero divide for instance). CONTRAINTE_ERROR should be called as:

CONTRAINTE_ERROR(function_name, format, expression-list)

where function_name is a string containing the name of the function calling CONTRAINTE_ERROR, and where format and expression-list are passed as arguments to vprintf. CONTRAINTE_ERROR terminates execution with abort. ARARGS0

print name of function causing error

print out remainder of message

create a core file for debug

Parameters
nameame
fmtmt

Definition at line 49 of file error.c.

50 {
51  va_list args;
52 
53  va_start(args, fmt);
54 
55  /* print name of function causing error */
56  (void) fprintf(stderr, "contrainte error in %s: ", name);
57 
58  /* print out remainder of message */
59  (void) vfprintf(stderr, fmt, args);
60  va_end(args);
61 
62  /* create a core file for debug */
63  (void) abort();
64 }
#define abort()
Definition: misc-local.h:53
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References abort, and fprintf().

Referenced by contrainte_sprint_format(), and contrainte_text_format().

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

◆ contrainte_eval()

Value contrainte_eval ( Pvecteur  c,
Pvecteur  v 
)

Evaluate constraint c according to values in v and return the constant obtained.

The constraint may be an equality or an inequality.

If c is an equality, the value return must be zero or the point does not belong to the hyperplane defined by c.

If c is an inequality, the value returned is negative if v belongs to the half-space defined by c. If it is zero, the point v belongs to the constraint, i.e. is on the boundary of any constraint system containing c, i.e. to the hyperplane defined by c. If the value returned is stricly positive, v does not belong to the half-space defined by c.

Note: this function is not a predicate but it is used by the next function, which is a predicate.

Definition at line 331 of file predicats.c.

332 {
333  Value k = VALUE_ZERO;
334  Pvecteur cc = VECTEUR_NUL;
335 
336  for(cc=c; !VECTEUR_NUL_P(cc); cc = vecteur_succ(cc)) {
337  Variable var = vecteur_var(cc);
338  Value coef = vecteur_val(cc);
339  if(var==TCST) {
340  value_addto(k, coef);
341  }
342  else {
343  Value val = vect_coeff(var, v);
344  value_addto(k, value_direct_multiply(coef, val));
345  }
346  }
347 
348  return k;
349 }
#define VALUE_ZERO
#define value_direct_multiply(v1, v2)
#define value_addto(ref, val)
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define vecteur_val(v)
#define vecteur_var(v)
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define vecteur_succ(v)
#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

References TCST, value_addto, value_direct_multiply, VALUE_ZERO, vect_coeff(), VECTEUR_NUL, VECTEUR_NUL_P, vecteur_succ, vecteur_val, and vecteur_var.

Referenced by contrainte_eval_p(), and sc_internal_p().

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

◆ contrainte_eval_p()

bool contrainte_eval_p ( Pvecteur  c,
Pvecteur  v,
bool  is_equality_p 
)

Evaluate constraint c according to values in v and return true if the constraint is met.

The constraint may be an equality or an inequality depending on is_equality_p

Parameters
is_equality_ps_equality_p

Definition at line 354 of file predicats.c.

355 {
356  Value k = VALUE_ZERO;
357  bool is_met_p = true;
358 
359  k = contrainte_eval(c, v);
360 
361  if(is_equality_p)
362  is_met_p = value_zero_p(k);
363  else
364  is_met_p = value_negz_p(k);
365 
366  return is_met_p;
367 }
#define value_negz_p(val)
#define value_zero_p(val)
Value contrainte_eval(Pvecteur c, Pvecteur v)
Evaluate constraint c according to values in v and return the constant obtained.
Definition: predicats.c:331

References contrainte_eval(), value_negz_p, VALUE_ZERO, and value_zero_p.

Referenced by equality_eval_p(), and inequality_eval_p().

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

◆ contrainte_extract()

Pcontrainte contrainte_extract ( Pcontrainte pc,
Pbase  base,
Variable  var 
)

Pcontrainte contrainte_extract(pc, base, var) Pcontrainte *pc; Pbase base; Variable var;.

returns the constraints of *pc of which the higher rank variable from base is var. These constraints are removed from *pc.

FC 27/09/94

Parameters
pcc
basease
varar

Definition at line 242 of file unaires.c.

246 {
247  int
248  rank = rank_of_variable(base, var);
250  ctmp = NULL,
251  result = NULL,
252  cprev = NULL,
253  c = *pc;
254 
255  while (c!=NULL)
256  {
257  if (search_higher_rank(c->vecteur, base)==rank)
258  {
259  /*
260  * c must be extracted
261  */
262  ctmp = c->succ,
263  c->succ = result,
264  result = c,
265  c = ctmp;
266 
267  if (cprev==NULL)
268  *pc = ctmp;
269  else
270  cprev->succ=ctmp;
271  }
272  else
273  c=c->succ,
274  cprev=(cprev==NULL) ? *pc : cprev->succ;
275  }
276 
277  return(result);
278 }
int rank_of_variable(Pbase base, Variable var)
this function returns the rank of the variable var in the base 0 encodes TCST, but I do not know why,...
Definition: base.c:497
int search_higher_rank(Pvecteur vect, Pbase base)
int search_higher_rank(): this fonction returns the rank of the variable of higher rank in the vecteu...
Definition: base.c:541
bdt base
Current expression.
Definition: bdt_read_paf.c:100

References base, rank, rank_of_variable(), search_higher_rank(), and Scontrainte::succ.

+ Here is the call graph for this function:

◆ contrainte_fprint()

void contrainte_fprint ( FILE *  ,
Pcontrainte  ,
bool  ,
char *  *)(Variable 
)

io.c

Referenced by dj_variable_substitution_with_eqs_ofl_ctrl(), make_bound_expression(), and show_nredund().

+ Here is the caller graph for this function:

◆ contrainte_free()

Pcontrainte contrainte_free ( Pcontrainte  c)

Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c ainsi que de ses champs vecteur et saturations; seul le lien vers la contrainte suivante est ignore.

Utilisation standard: c = contrainte_free(c);

Autre utilisation possible: (void) contrainte_free(c); c = NULL;

comme toujours, les champs pointeurs sont remis a NULL avant la desallocation pour detecter au plus tot les erreurs dues a l'allocation dynamique de memoire.

Modification:

  • renvoi systematique de CONTRAINTE_NULLE comme valeur de la fonction; ca permet de diminuer la taille du code utilisateur et d'assurer plus facilement la mise a CONTRAINTE_NULLE de pointeurs referencant une zone desallouee (FI, 24/11/89)

Definition at line 184 of file alloc.c.

185 {
186  // Cannot be used at the contrainte level
187  //ifscdebug(1)
188  // fprintf(stderr, "Constraint %p is going to be freed\n", c);
189  if (!CONTRAINTE_UNDEFINED_P(c))
190  {
191  if (c->eq_sat != NULL) {
192  free((char *)c->eq_sat);
193  c->eq_sat = NULL;
194  }
195 
196  if (c->r_sat != NULL) {
197  free((char *)c->r_sat);
198  c->r_sat = NULL;
199  }
200 
201  if (c->s_sat != NULL) {
202  free((char *)c->s_sat);
203  c->s_sat = NULL;
204  }
205 
206  if (c->vecteur != VECTEUR_UNDEFINED) {
207  vect_rm(c->vecteur);
208  c->vecteur = NULL;
209  }
210 
211  c->succ = NULL;
212 
213  free((char *)c);
214  }
215 
216  return CONTRAINTE_UNDEFINED;
217 }
#define VECTEUR_UNDEFINED
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, Scontrainte::eq_sat, free(), Scontrainte::r_sat, Scontrainte::s_sat, Scontrainte::succ, vect_rm(), Scontrainte::vecteur, and VECTEUR_UNDEFINED.

Referenced by combiner_ofl_with_test(), contrainte_remove_large_coef(), contraintes_free(), dj_simple_inegs_to_eg(), eq_redund_with_sc_p(), extract_common_constraints(), loop_executed_approximation(), pa_path_to_few_disjunct_ofl_ctrl(), region_sc_minimal(), sc_elim_empty_constraints(), sc_elim_redund_with_first_ofl_ctrl(), sc_force_variable_to_zero(), sc_rm_empty_constraints(), sc_supress_same_constraints(), and top_down_abc_dimension().

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

◆ contrainte_in_liste()

bool contrainte_in_liste ( Pcontrainte  c,
Pcontrainte  lc 
)

listes.c

listes.c

bool contrainte_in_liste(Pcontrainte c, Pcontrainte lc): test de l'appartenance d'une contrainte c a une liste de contrainte lc

Les contrainte sont supposees normalisees (coefficients reduits par leur PGCD, y compris les termes constants).

On considere que la contrainte nulle, qui ne represente aucune contrainte (elle est toujours verifiee) appartient a toutes les listes de contraintes.

Parameters
lcc

Definition at line 52 of file listes.c.

53 {
54  Pcontrainte c1;
55 
57 
58  if (CONTRAINTE_NULLE_P(c))
59  return true;
60 
61  for (c1=lc; !CONTRAINTE_UNDEFINED_P(c1); c1=c1->succ) {
62  if (vect_equal((c1->vecteur),(c->vecteur))) {
63  return true;
64  }
65  }
66  return false;
67 }

References assert, CONTRAINTE_NULLE_P, CONTRAINTE_UNDEFINED_P, Scontrainte::succ, vect_equal(), and Scontrainte::vecteur.

Referenced by dj_simple_inegs_to_eg(), pa_path_to_few_disjunct_ofl_ctrl(), and sc_supress_same_constraints().

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

◆ contrainte_make()

Pcontrainte contrainte_make ( Pvecteur  pv)

Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecteur passe en parametre.

Modifications:

  • le signe du terme constant n'est plus modifie (FI, 24/11/89)
Parameters
pvv

Definition at line 73 of file alloc.c.

74 {
76  contrainte_vecteur(c) = pv;
77  return(c);
78 }

References contrainte_new(), and contrainte_vecteur.

Referenced by __attribute__(), add_equivalence_equality(), adg_dataflowgraph(), adg_dataflowgraph_with_extremities(), adg_get_conjonctions(), adg_get_predicate_of_loops(), adg_max_of_leaves(), adg_suppress_2nd_in_1st_ps(), affine_to_transformer(), base_complete(), broadcast_conditions(), broadcast_dimensions(), broadcast_of_dataflow(), build_convex_constraints_from_vertices(), build_list_of_min(), build_sc_machine(), build_sc_with_several_uniform_ref(), c_convex_effects_on_actual_parameter_forward_translation(), check_range_wrt_precondition(), comp_exec_domain(), completer_base(), completer_n_base(), compose_vvs(), compute_entity_to_declaration_constraints(), constraint_to_bound(), contrainte_make_1D(), converti_psysmin_psysmax(), dependence_cone_positive(), dependence_system_add_lci_and_di(), dj_simple_inegs_to_eg(), dj_system_complement(), do_solve_hardware_constraints_on_nb_proc(), efficient_sc_check_inequality_feasibility(), elim_var_with_eg(), expression_less_than_in_context(), expressions_to_predicate(), expressions_to_vectors(), find_implicit_equation(), find_intermediate_constraints(), find_intermediate_constraints_recursively(), find_motif(), find_pattern(), fortran_user_function_call_to_transformer(), free_guards(), full_linearization(), gcd_and_constant_dependence_test(), generate_system_for_equal_variables(), generate_work_sharing_system(), generic_equality_to_transformer(), generic_minmax_to_transformer(), hpfc_compute_align_constraints(), hpfc_compute_distribute_constraints(), hpfc_compute_entity_to_new_declaration(), hpfc_compute_unicity_constraints(), include_parameters_in_sc(), integer_divide_to_transformer(), integer_power_to_transformer(), integer_right_shift_to_transformer(), interlaced_basic_workchunk_regions_p(), local_tile_constraints(), logical_binary_function_to_transformer(), logical_constant_to_transformer(), loop_basic_workchunk_to_workchunk(), loop_bounds_to_tile_bounds(), loop_executed_approximation(), loop_index_domaine_to_contrainte(), loop_regions_normalize(), make_context_of_loop(), make_dual(), make_expression_equalities(), make_reindex(), make_scanning_over_one_tile(), matrix_to_system(), my_adg_expressions_to_predicate(), nullify_factors(), pa_path_to_few_disjunct_ofl_ctrl(), partial_broadcast_coefficients(), partial_linearization(), Pcontrainte_separate_on_vars(), plc_elim_var_with_eg(), polynome_to_contrainte(), polynome_to_sc(), prepare_reindexing(), processor_loop(), prototype_dimension(), put_variables_in_ordered_lists(), re_do_it(), relation_to_transformer(), sc_elim_double_constraints(), sc_empty(), sc_find_equalities(), sc_gen_read(), sc_image_computation(), sc_minmax_of_variables(), sc_multiply_constant_terms(), sc_of_constrs(), sc_supress_same_constraints(), separate_variables(), set_dimensions_of_local_variable_family(), simple_addition_to_transformer(), simple_affine_to_transformer(), simplify_minmax_contrainte(), small_positive_slope_reduce_coefficients_with_bounding_box(), stmt_bdt_directions(), suppress_sc_in_sc(), tile_change_of_basis(), tile_hyperplane_constraints(), tile_membership_constraints(), top_down_abc_dimension(), transformer_add_loop_index_initialization(), transformer_add_sign_information(), transformer_add_variable_incrementation(), transformer_constraint_add(), transformer_convex_hulls(), transformer_derivative_constraints(), transformer_derivative_fix_point(), transformer_equality_fix_point(), transformer_list_generic_transitive_closure(), translate_global_value(), valuer(), vvs_on_vvs(), and vvs_to_sc().

+ Here is the call graph for this function:

◆ contrainte_make_1D()

Pcontrainte contrainte_make_1D ( Value  a,
Variable  x,
Value  b,
bool  less_p 
)

Generate a constraint a x <= b or a x >= b, according to less_p, or ax==b, regardless of less_p.

Since equalities and inequalities are not distinguished, less_p is not relevant when equations are built.

Parameters
less_pess_p

Definition at line 86 of file alloc.c.

87 {
89  if(less_p)
90  v = vect_make_1D(a, x, value_uminus(b));
91  else
92  v = vect_make_1D(value_uminus(a), x, b);
94  return c;
95 }
#define value_uminus(val)
unary operators on values
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
static char * x
Definition: split_file.c:159
Pvecteur vect_make_1D(Value a, Variable x, Value b)
Generate a sparse vector a x + b TCST.
Definition: alloc.c:226

References contrainte_make(), value_uminus, vect_make_1D(), VECTEUR_UNDEFINED, and x.

Referenced by add_bounding_box_constraints().

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

◆ contrainte_new()

Pcontrainte contrainte_new ( void  )

CONTRAINTE.

cproto-generated files alloc.c

CONTRAINTE.

INTLIBRARY Pcontrainte contrainte_new(): allocation et initialisation d'une contrainte vide

Anciens noms: init_eq(), creer_eq

= (Pcontrainte)MALLOC(sizeof (Scontrainte),CONTRAINTE, "contrainte_new");

Definition at line 47 of file alloc.c.

48 {
49  Pcontrainte c;
50 
51  /*c = (Pcontrainte)MALLOC(sizeof (Scontrainte),CONTRAINTE,
52  "contrainte_new");*/
53  c = (Pcontrainte) malloc(sizeof (Scontrainte));
54  if (c == NULL) {
55  (void) fprintf(stderr,"contrainte_new: Out of memory space\n");
56  exit(-1);
57  }
58  c->eq_sat = NULL;
59  c->s_sat = NULL;
60  c->r_sat = NULL;
61  c->vecteur = NULL;
62  c->succ = NULL;
63 
64  return c;
65 }
struct Scontrainte * Pcontrainte
#define exit(code)
Definition: misc-local.h:54

References Scontrainte::eq_sat, exit, fprintf(), malloc(), Scontrainte::r_sat, Scontrainte::s_sat, Scontrainte::succ, and Scontrainte::vecteur.

Referenced by adg_sc_dup(), contrainte_copy(), contrainte_dup(), contrainte_make(), contraintes_make(), creer_Psysteme(), inegalite_comb_ofl_ctrl(), make_tile_constraints(), mat_sys_conv(), matrices_to_constraints(), matrices_to_constraints_with_sym_cst(), matrices_to_contraintes_with_sym_cst(), matrices_to_loop_sc(), matrices_to_sc(), my_matrices_to_constraints_with_sym_cst(), my_matrices_to_constraints_with_sym_cst_2(), pu_matrices_to_contraintes(), sc_copy(), sc_dup1(), tile_membership(), and var_posit().

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

◆ contrainte_normalize()

bool contrainte_normalize ( Pcontrainte  c,
bool  is_egalite 
)

normalize.c

normalize.c

INTLIBRARY bool contrainte_normalize(Pcontrainte c, bool is_egalite): reduction par le pgcd de ses coefficients d'une egalite (is_egalite==true) ou d'une inegalite (is_egalite==false)

Dans le cas des egalites, la faisabilite est testee et retournee

Modifications:

  • double changement du signe du terme constant pour le traitement des inegalites (Francois Irigoin, 30 octobre 1991)
  • ajout d'un test pour les egalites du type 0 == k et les inegalites 0 <= -k quand k est une constante numerique entiere strictement positive (Francois Irigoin, 15 novembre 1995)

is_c_norm: si is_egalite=true, equation faisable

pgcd des termes non constant de c

modulo(abs(b0),a)

si le coefficient du terme constant est inferieur a ABS(a), on va obtenir un couple (TCST,coeff) avec un coefficient qui vaut 0, ceci est contraire a nos conventions

mise a jour du resultat de la division C if ( b0 < 0 && nb0 > 0) vect_add_elem(&(c->vecteur),0,-1); On n'en a plus besoin parce que vect_div utilise la division a reste toujours positif dont on a besoin

is_inegalite

Parameters
is_egalites_egalite

Definition at line 56 of file normalize.c.

59 {
60  /* is_c_norm: si is_egalite=true, equation faisable */
61  bool is_c_norm = true;
62  /* pgcd des termes non constant de c */
63  Value a;
64  /* modulo(abs(b0),a) */
65  Value nb0 = VALUE_ZERO;
66 
67  if(c!=NULL && (c->vecteur != NULL))
68  {
70  if (value_notzero_p(a)) {
71  Pvecteur v;
72 
73  nb0 = value_abs(vect_coeff(TCST,c->vecteur));
74  nb0 = value_mod(nb0,a);
75 
76  if (is_egalite) {
77  if (value_zero_p(nb0)) {
78  (void) vect_div(c->vecteur,value_abs(a));
79 
80  /* si le coefficient du terme constant est inferieur
81  * a ABS(a), on va obtenir un couple (TCST,coeff) avec
82  * un coefficient qui vaut 0, ceci est contraire a nos
83  * conventions
84  */
85  c->vecteur = vect_clean(c->vecteur);
86  }
87  else
88  is_c_norm= false;
89  }
90 
91  else {
94  (void) vect_div(c->vecteur,value_abs(a));
95  c->vecteur= vect_clean(c->vecteur);
96  vect_chg_coeff(&(c->vecteur), TCST,
98  /* mise a jour du resultat de la division C
99  * if ( b0 < 0 && nb0 > 0)
100  * vect_add_elem(&(c->vecteur),0,-1);
101  * On n'en a plus besoin parce que vect_div utilise la
102  * division a reste toujours positif dont on a besoin
103  */
104  }
105  v=c->vecteur;
106  if(is_c_norm
107  && !VECTEUR_NUL_P(v)
108  && (vect_size(v) == 1)
109  && term_cst(v)) {
110  if(is_egalite) {
112  is_c_norm = false;
113  }
114  else { /* is_inegalite */
115  is_c_norm = value_negz_p(vecteur_val(v)) ;
116  }
117  }
118  }
119  }
120 
121  return is_c_norm;
122 }
#define value_notzero_p(val)
#define value_abs(val)
#define value_mod(v1, v2)
Value vect_pgcd_except(Pvecteur v, Variable var)
Value vect_pgcd_except(Pvecteur v, Variable var): calcul du pgcd de tous les coefficients non nul d'u...
Definition: reductions.c:130
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
Pvecteur vect_clean(Pvecteur v)
Pvecteur vect_clean(Pvecteur v): elimination de tous les couples dont le coefficient vaut 0 dans le v...
Definition: scalaires.c:80
Pvecteur vect_div(Pvecteur v, Value x)
Pvecteur vect_div(Pvecteur v, Value x): division du vecteur v par le scalaire x, si x est different d...
Definition: scalaires.c:52
#define term_cst(varval)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143

References assert, TCST, term_cst, value_abs, value_mod, value_negz_p, value_notzero_p, value_uminus, VALUE_ZERO, value_zero_p, vect_chg_coeff(), vect_clean(), vect_coeff(), vect_div(), vect_pgcd_except(), vect_size(), Scontrainte::vecteur, VECTEUR_NUL_P, and vecteur_val.

Referenced by egalite_normalize(), inegalite_normalize(), sc_bounded_normalization(), sc_elim_double_constraints(), and sc_gcd_normalize().

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

◆ contrainte_oppos()

bool contrainte_oppos ( Pcontrainte  ineg1,
Pcontrainte  ineg2 
)

bool contrainte_oppos(Pcontrainte ineg1, Pcontrainte ineg2): indique si 2 inegalites forment une egalite ou si deux egalites sont equivalentes.

return(ineg1 == -ineg2);

Parameters
ineg1neg1
ineg2neg2

Definition at line 258 of file predicats.c.

260 {
261  return(vect_oppos(ineg1->vecteur,ineg2->vecteur));
262 }
bool vect_oppos(Pvecteur v1, Pvecteur v2)
bool vect_oppos(Pvecteur v1, Pvecteur v2): test de l'opposition de deux vecteurs
Definition: reductions.c:360

References vect_oppos().

+ Here is the call graph for this function:

◆ contrainte_parallele()

bool contrainte_parallele ( Pcontrainte  c1,
Pcontrainte  c2,
Value pa1,
Value pa2 
)

Les deux contraintes c1 et c2 sont paralleles s'il existe deux coefficients a1 et a2 tels que a1 c1 + a2 c2 est reduit un terme constant K.

On cherche une composante quelconque relative a une variable

Parameters
c11
c22
pa1a1
pa2a2

Definition at line 145 of file predicats.c.

146 {
147  bool parallel_p = false;
148  register bool
149  undef1 = CONTRAINTE_UNDEFINED_P(c1),
150  undef2 = CONTRAINTE_UNDEFINED_P(c2);
151 
152  if (undef1 || undef2)
153  parallel_p = (undef1 && undef2);
154  else {
155  /* On cherche une composante quelconque relative a une variable */
156  Pvecteur v1 = contrainte_vecteur(c1);
157  Pvecteur v2 = contrainte_vecteur(c2);
158  if(vect_constant_p(v1))
159  parallel_p = vect_constant_p(v2);
160  else if(vect_constant_p(v2))
161  parallel_p = false;
162  else {
163  Pvecteur v;
164  for(v=v1; !VECTEUR_NUL_P(v); v = vecteur_succ(v)) {
165  if(vecteur_var(v)!=TCST)
166  break;
167  }
168  Variable var = vecteur_var(v);
169  *pa1 = vect_coeff(var, v1);
170  *pa2 = -vect_coeff(var, v2);
171  Pvecteur nv1 = vect_multiply(vect_copy(v1), *pa2);
172  Pvecteur nv2 = vect_multiply(vect_copy(v2), *pa1);
173  Pvecteur nv = vect_add(nv1, nv2);
174  if(vect_size(nv)==0 || (vect_size(nv)==1 && vecteur_var(nv)==TCST))
175  parallel_p = true;
176  vect_rm(nv1), vect_rm(nv2), vect_rm(nv);
177  }
178  }
179  return parallel_p;
180 }
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
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53

References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, TCST, vect_add(), vect_coeff(), vect_constant_p(), vect_copy(), vect_multiply(), vect_rm(), vect_size(), VECTEUR_NUL_P, vecteur_succ, and vecteur_var.

Referenced by sc_safe_elim_db_constraints().

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

◆ contrainte_remove_large_coef()

Pcontrainte contrainte_remove_large_coef ( Pcontrainte  lc,
Value  val 
)
Returns
a constraint list without constraint with large coeffs
Parameters
lclist of constraint, which is modified
valmaximum value allowed for coefficients
Parameters
lcc
valal

Definition at line 179 of file listes.c.

180 {
181  linear_assert("value must be positive", value_posz_p(val));
182 
183  Pcontrainte first = lc, previous = NULL;
184 
185  if (value_zero_p(val)) // nothing to do
186  return lc;
187 
188  while (lc!=NULL)
189  {
190  if (vect_larger_coef_p(lc->vecteur, val))
191  {
192  // unlink and free
193  Pcontrainte next = lc->succ;
194  lc->succ = NULL;
195  contrainte_free(lc);
196  if (lc==first) first = next;
197  if (previous) previous->succ = next;
198  // "previous" constraint itself is unchanged
199  lc = next;
200  }
201  else
202  {
203  previous = lc;
204  lc = lc->succ;
205  }
206  }
207  return first;
208 }
#define value_posz_p(val)
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
bool vect_larger_coef_p(Pvecteur v, Value val)
Definition: reductions.c:564
#define linear_assert(msg, ex)
Definition: linear_assert.h:51

References contrainte_free(), linear_assert, Scontrainte::succ, value_posz_p, value_zero_p, vect_larger_coef_p(), and Scontrainte::vecteur.

Referenced by sc_remove_large_coef().

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

◆ contrainte_reverse()

void contrainte_reverse ( Pcontrainte  c)

void contrainte_reverse(Pcontrainte eq): changement de signe d'une contrainte, i.e.

multiplication par -1, et ajout de la constante 1.

Definition at line 67 of file unaires.c.

69 {
72 }
#define VALUE_ONE
void contrainte_chg_sgn(Pcontrainte c)
void contrainte_chg_sgn(Pcontrainte eq): changement de signe d'une contrainte, i.e.
Definition: unaires.c:56
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 contrainte_chg_sgn(), TCST, VALUE_ONE, and vect_add_elem().

Referenced by build_integer_sc_nredund(), build_sc_nredund_1pass_ofl_ctrl(), ineq_redund_with_sc_p(), sc_elim_redund_with_first_ofl_ctrl(), sc_inequations_elim_redund(), sc_triang_elim_redund(), and sc_triang_elim_redund_n_first().

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

◆ contrainte_simple_equality()

Variable contrainte_simple_equality ( Pcontrainte  e)

returns whether a constraint is a simple equality: X == 12 the system is expected to be normalized?

Definition at line 521 of file unaires.c.

522 {
523  Pvecteur v = e->vecteur;
524  int size = vect_size(v);
525  switch (size) {
526  case 0: return NULL;
527  case 1: if (v->var) return v->var; else return NULL;
528  case 2:
529  if (v->var && !v->succ->var) return v->var;
530  if (!v->var && v->succ->var) return v->succ->var;
531  }
532  return NULL;
533 }
Variable var
Definition: vecteur-local.h:90

References Svecteur::succ, Svecteur::var, vect_size(), and Scontrainte::vecteur.

+ Here is the call graph for this function:

◆ contrainte_sprint()

char* contrainte_sprint ( char *  ,
Pcontrainte  ,
bool  ,
char *  *)(Variable 
)

◆ contrainte_sprint_format()

char* contrainte_sprint_format ( char *  ,
Pcontrainte  ,
bool  ,
char *  *)(Variable,
bool   
)

◆ contrainte_subst()

int contrainte_subst ( Variable  v,
Pcontrainte  def,
Pcontrainte  c,
bool  eq_p 
)
Parameters
defef
eq_pq_p

Definition at line 48 of file binaires.c.

52 {
53  return( contrainte_subst_ofl_ctrl(v,def,c,eq_p, NO_OFL_CTRL));
54 
55 }
int contrainte_subst_ofl_ctrl(Variable v, Pcontrainte def, Pcontrainte c, bool eq_p, int ofl_ctrl)
int contrainte_subst_ofl_ctrl(Variable v, Pcontrainte def, Pcontrainte c Boolean eq_p,...
Definition: binaires.c:107
#define NO_OFL_CTRL

References contrainte_subst_ofl_ctrl(), and NO_OFL_CTRL.

+ Here is the call graph for this function:

◆ contrainte_subst_ofl()

int contrainte_subst_ofl ( Variable  v,
Pcontrainte  def,
Pcontrainte  c,
bool  eq_p 
)

binaires.c

binaires.c

Parameters
defef
eq_pq_p

Definition at line 40 of file binaires.c.

44 {
45  return( contrainte_subst_ofl_ctrl(v,def,c,eq_p, FWD_OFL_CTRL));
46 }
#define FWD_OFL_CTRL

References contrainte_subst_ofl_ctrl(), and FWD_OFL_CTRL.

+ Here is the call graph for this function:

◆ contrainte_subst_ofl_ctrl()

int contrainte_subst_ofl_ctrl ( Variable  v,
Pcontrainte  def,
Pcontrainte  c,
bool  eq_p,
int  ofl_ctrl 
)

int contrainte_subst_ofl_ctrl(Variable v, Pcontrainte def, Pcontrainte c
Boolean eq_p, int ofl_ctrl): elimination d'une variable v entre une equation def et une contrainte, egalite ou inegalite, c.

La contrainte c est modifiee en substituant v par sa valeur impliquee par def.

La contrainte c est interpretee comme une inegalite et la valeur retournee vaut: -1 si la contrainte c est trivialement verifiee et peut etre eliminee 0 si la contrainte c est trivialement impossible 1 sinon (tout va bien) Si la contrainte c passee en argument etait trivialement impossible ou trivialement verifiee, aucune subsitution n'a lieu et la valeur 1 est retournee.

La substitution d'une variable dans une inegalite peut aussi introduire une non-faisabilite testable par calcul de PGCD, mais cela n'est pas fait puisqu'on ne sait pas si c est une egalite ou une inegalite. Le traitement du terme constant n'est pas decidable.

Note: il faudrait separer le probleme de la combinaison lineaire a coefficients positifs de celui de la faisabilite et de la trivialite

Le controle de l'overflow est effectue et traite par le retour du contexte correspondant au dernier CATCH(overflow_error) effectue.

cv_def = coeff de v dans def

cv_c = coeff de v dans c

il faut que cv_def soit non nul pour que la variable v puisse etre eliminee

il n'y a rien a faire si la variable v n'apparait pas dans la contrainte c

substitution inutile: variable v absente

on garde trace de la valeur de c avant substitution pour pouvoir la desallouer apres le calcul de la nouvelle

on ne fait pas de distinction entre egalites et inegalites, mais on prend soin de toujours multiplier la contrainte, inegalite potentielle, par un coefficient positif

reste malikien: cette partie ne peut pas etre faite sans savoir si on est en train de traiter une egalite ou une inegalite

=> eliminer cette c inutile

=> systeme non faisable

Parameters
defef
eq_pq_p
ofl_ctrlfl_ctrl

Definition at line 107 of file binaires.c.

112 {
113  Pvecteur save_c;
114 
115  /* cv_def = coeff de v dans def */
116  Value cv_def = vect_coeff(v,def->vecteur);
117  /* cv_c = coeff de v dans c */
118  Value cv_c = vect_coeff(v,c->vecteur);
119 
120  /* il faut que cv_def soit non nul pour que la variable v puisse etre
121  eliminee */
122  assert(value_notzero_p(cv_def));
123 
124  /* il n'y a rien a faire si la variable v n'apparait pas dans la
125  contrainte c */
126  /* substitution inutile: variable v absente */
127  if (value_zero_p(cv_c)) return 1;
128 
129  /* on garde trace de la valeur de c avant substitution pour pouvoir
130  la desallouer apres le calcul de la nouvelle */
131  save_c = c->vecteur;
132  /* on ne fait pas de distinction entre egalites et inegalites, mais
133  on prend soin de toujours multiplier la contrainte, inegalite
134  potentielle, par un coefficient positif */
135  if (value_neg_p(cv_def)) {
137  c->vecteur,cv_c,
138  def->vecteur,
139  ofl_ctrl);
140  }
141  else {
142  c->vecteur = vect_cl2_ofl_ctrl(cv_def,c->vecteur,
143  value_uminus(cv_c),
144  def->vecteur, ofl_ctrl);
145  }
146  vect_rm(save_c);
147 
148  /* reste malikien: cette partie ne peut pas etre faite sans savoir
149  si on est en train de traiter une egalite ou une inegalite */
150  if(contrainte_constante_p(c)) {
151  if(contrainte_verifiee(c,eq_p))
152  /* => eliminer cette c inutile */
153  return(-1);
154  else
155  /* => systeme non faisable */
156  return(false);
157  }
158  return(true);
159 }
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
Pvecteur vect_cl2_ofl_ctrl(Value x1, Pvecteur v1, Value x2, Pvecteur v2, int ofl_ctrl)
Pvecteur vect_cl2_ofl(Value x1, Pvecteur v1, Value x2, Pvecteur v2): allocation d'un vecteur v dont l...
Definition: binaires.c:204

References assert, contrainte_constante_p(), contrainte_verifiee(), value_neg_p, value_notzero_p, value_uminus, value_zero_p, vect_cl2_ofl_ctrl(), vect_coeff(), vect_rm(), and Scontrainte::vecteur.

Referenced by better_elim_var_with_eg(), contrainte_subst(), contrainte_subst_ofl(), and new_elim_var_with_eg().

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

◆ contrainte_substitute_dimension()

Pcontrainte contrainte_substitute_dimension ( Pcontrainte  e,
Variable  i,
Pvecteur  v 
)

Definition at line 57 of file binaires.c.

58 {
61  return e;
62 }
Pvecteur vect_substitute_dimension(Pvecteur v, Variable i, Pvecteur s)
Pvecteur vect_substitute_dimension(Pvecteur v, Variable i, Pvecteur s)
Definition: binaires.c:99

References contrainte_vecteur, and vect_substitute_dimension().

Referenced by sc_substitute_dimension().

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

◆ contrainte_translate()

Pcontrainte contrainte_translate ( Pcontrainte  ,
Pbase  ,
char *  *)(void 
)

Referenced by sc_translate().

+ Here is the caller graph for this function:

◆ contrainte_var_min_coeff()

Pcontrainte contrainte_var_min_coeff ( Pcontrainte  contraintes,
Variable  v,
Value coeff,
bool  rm_if_not_first_p 
)

Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list of constraints (euqalities or inequalities), a variable, and the location of an integer.

output : the constraint in "contraintes" where the coefficient of "v" is the smallest (but non-zero). modifies : nothing. comment : the returned constraint is not removed from the list if rm_if_not_first_p is false. if rm_if_not_first_p is true, the returned contraint is remove only if it is not the first constraint.

Parameters
contraintesontraintes
coeffoeff
rm_if_not_first_pm_if_not_first_p

Definition at line 345 of file unaires.c.

350 {
351  Value sc = VALUE_ZERO, cv = VALUE_ZERO;
352  Pcontrainte result, eq, pred, eq1;
353 
354  if (contraintes == NULL)
355  return(NULL);
356 
357  result = pred = eq1 = NULL;
358 
359  for (eq = contraintes; eq != NULL; eq = eq->succ) {
360  Value c, ca;
361  c = vect_coeff(v, eq->vecteur);
362  ca = value_abs(c);
363  if ((value_lt(ca,cv) && value_pos_p(ca)) ||
364  (value_zero_p(cv) && value_notzero_p(c))) {
365  cv = ca;
366  sc = c;
367  result = eq;
368  pred = eq1;
369  }
370  }
371 
372  if (value_neg_p(sc))
373  contrainte_chg_sgn(result);
374 
375  if (rm_if_not_first_p && pred != NULL) {
376  pred->succ = result->succ;
377  result->succ = NULL;
378  }
379 
380  *coeff = cv;
381  return result;
382 }
#define value_lt(v1, v2)
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108

References contrainte_chg_sgn(), eq, Scontrainte::succ, value_abs, value_lt, value_neg_p, value_notzero_p, value_pos_p, VALUE_ZERO, value_zero_p, vect_coeff(), and Scontrainte::vecteur.

Referenced by better_elim_var_with_eg(), new_elim_var_with_eg(), remove_variables_if_possible(), and sc_projection_optim_along_vecteur_ofl().

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

◆ contrainte_variable_rename()

Pcontrainte contrainte_variable_rename ( Pcontrainte  c,
Variable  v_old,
Variable  v_new 
)

Pcontrainte contrainte_variable_rename(Pcontrainte c, Variable v_old, Variable v_new): rename the potential coordinate v_old in c as v_new.

Parameters
v_old_old
v_new_new

Definition at line 115 of file unaires.c.

119 {
120  if(!CONTRAINTE_UNDEFINED_P(c))
122  v_old, v_new);
123 
124  return c;
125 }
Pvecteur vect_variable_rename(Pvecteur v, Variable v_old, Variable v_new)
Pvecteur vect_variable_rename(Pvecteur v, Variable v_old, Variable v_new): rename the potential coord...
Definition: base.c:366

References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, and vect_variable_rename().

Referenced by sc_variable_rename().

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

◆ contrainte_vect_sort()

void contrainte_vect_sort ( Pcontrainte  ,
int(*)(Pvecteur *, Pvecteur *)   
)

Referenced by sc_lexicographic_sort(), and sc_vect_sort().

+ Here is the caller graph for this function:

◆ contrainte_verifiee()

bool contrainte_verifiee ( Pcontrainte  ineg,
bool  eq_p 
)

bool contrainte_verifiee(Pcontrainte ineg, bool eq_p): test de faisabilite d'inegalite (eq_p == false) ou d'egalite triviale

Le test est different pour les egalites.

Modifications:

  • test de l'absence d'un successeur dans vecteur (ajout d'un test succ == NULL)
  • changement de cote du terme constant (FI, 08/12/89)
  • ajout d'un assert pour pallier partiellement le bug 1 (FI, 08/12/89)
  • utilisation de la macro CONTRAINTE_NULLE_P() (FI, 08/12/89) Bugs:
  • si on passe une inegalite non constante en argument, le resultat depend du premier terme du vecteur; il faudrait pouvoir retourner la valeur bottom pour les inegalites non constantes;
  • le nom devrait etre inegalite_verifiee()

l'inegalite 0 <= 0 est representee par un vecteur nul

l'inegalite 0 <= K est representee par un vecteur a un element

Parameters
inegneg
eq_pq_p

Definition at line 234 of file predicats.c.

237 {
238  Value v;
240 
241  /* l'inegalite 0 <= 0 est representee par un vecteur nul */
242  if (CONTRAINTE_NULLE_P(ineg))
243  return(true);
244 
245  /* l'inegalite 0 <= K est representee par un vecteur a un element */
246  v = val_of(ineg->vecteur);
247 
248  return (!eq_p && value_negz_p(v) && ineg->vecteur->succ==NULL)
249  || ( eq_p && value_zero_p(v) && ineg->vecteur->succ==NULL);
250 }
bool contrainte_constante_p(Pcontrainte c)
bool contrainte_constante_p(Pcontrainte c): test de contrainte triviale sans variables (ie du type 0<...
Definition: predicats.c:192
#define val_of(varval)

References assert, contrainte_constante_p(), CONTRAINTE_NULLE_P, val_of, value_negz_p, and value_zero_p.

Referenced by combiner_ofl_with_test(), contrainte_subst_ofl_ctrl(), and sc_strong_normalize_and_check_feasibility().

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

◆ contraintes_copy()

Pcontrainte contraintes_copy ( Pcontrainte  c_in)

Pcontrainte contraintes_copy(Pcontrainte c_in) a list of constraints is copied with the same order In fact, here we only need to replace contrainte_dup by contrainte_copy Have a look at contrainte_copy (DN,24/6/02)

Parameters
c_in_in

Definition at line 270 of file alloc.c.

271 {
273  c_tmp = contrainte_copy(c_in),
274  c_out = c_tmp,
275  c = NULL;
276 
277  for (c=(c_in==NULL?NULL:c_in->succ);
278  c!=NULL;
279  c=c->succ)
280  c_tmp->succ = contrainte_copy(c),
281  c_tmp = c_tmp->succ;
282 
283  return c_out;
284 }
Pcontrainte contrainte_copy(Pcontrainte c_in)
Have a look at contrainte_dup and contraintes_dup which reverse the order of the list This copy versi...
Definition: alloc.c:254

References c_in, c_out, contrainte_copy(), and Scontrainte::succ.

Referenced by build_sc_nredund_1pass_ofl_ctrl().

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

◆ contraintes_dup()

Pcontrainte contraintes_dup ( Pcontrainte  c_in)

Pcontrainte contraintes_dup(Pcontrainte c_in) a list of constraints is copied.

Parameters
c_in_in

Definition at line 146 of file alloc.c.

147 {
149  c_tmp = contrainte_dup(c_in),
150  c_out = c_tmp,
151  c = NULL;
152 
153  for (c=(c_in==NULL?NULL:c_in->succ);
154  c!=NULL;
155  c=c->succ)
156  c_tmp->succ = contrainte_dup(c),
157  c_tmp = c_tmp->succ;
158 
159  return c_out;
160 }

References c_in, c_out, contrainte_dup(), and Scontrainte::succ.

Referenced by constraints_to_loop_bound(), and dj_simple_inegs_to_eg().

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

◆ contraintes_free()

Pcontrainte contraintes_free ( Pcontrainte  pc)

Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc.

chaque contrainte est detruite par un appel a contrainte_free.

Ancien nom: elim_tte_ineg()

Parameters
pcc

Definition at line 226 of file alloc.c.

227 {
228  while (!CONTRAINTE_UNDEFINED_P(pc)) {
229  Pcontrainte pcs = pc->succ;
230  (void) contrainte_free(pc);
231  pc = pcs;
232  }
233  return CONTRAINTE_UNDEFINED;
234 }

References contrainte_free(), CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, and Scontrainte::succ.

Referenced by apply_abstract_effect_to_transformer(), combiner_ofl_with_test(), extract_lattice(), generic_minmax_to_transformer(), hpfc_broadcast_buffers(), hpfc_compute_lid(), make_rectangular_area(), reset_equivalence_equalities(), sc_resol_smith(), sc_rm(), sc_transform_eg_in_ineg(), smith_int(), systeme_to_loop_nest(), transformer_basic_fix_point(), transformer_pattern_fix_point(), and translate_to_module_frame().

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

◆ contraintes_make()

Pcontrainte contraintes_make ( Pvecteur  pv,
  ... 
)

Convert a list of vectors into a list of constraints.

Parameters
pvv

Definition at line 99 of file alloc.c.

100 {
101  va_list the_args;
102 
104  Pcontrainte lc = c;
105  contrainte_vecteur(c) = pv;
106 
107  va_start(the_args, pv);
108  Pvecteur nv = pv;
109  while(nv!=VECTEUR_NUL) {
110  nv = va_arg(the_args, Pvecteur);
112  contrainte_vecteur(nc) = nv;
113  contrainte_succ(lc) = nc;
114  lc = nc;
115  }
116 
117  return(c);
118 }
#define contrainte_succ(c)

References contrainte_new(), contrainte_succ, contrainte_vecteur, and VECTEUR_NUL.

Referenced by find_intermediate_constraints().

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

◆ cyclic_constraint_list_p()

bool cyclic_constraint_list_p ( Pcontrainte  l)

Check if list l contains a cycle.

Definition at line 141 of file listes.c.

142 {
143  int i;
144  Pcontrainte c;
145  bool cyclic_p = false;
146 
147  for(i=0, c=l; c!=NULL; i++, c=c->succ) {
148  int r = constraint_rank(c, l);
149  if(r>0 && r<i) {
150  cyclic_p = true;
151  break;
152  }
153  }
154 
155  return cyclic_p;
156 }
int constraint_rank(Pcontrainte c, Pcontrainte lc)
Return the rank of constraint c in constraint list lc.
Definition: listes.c:75

References constraint_rank(), and Scontrainte::succ.

Referenced by sc_bounded_normalization().

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

◆ dbg_contrainte_rm()

void dbg_contrainte_rm ( Pcontrainte  c,
char *  f 
)

void dbg_contrainte_rm(Pcontrainte c): version debug de contrainte rm; trace de la desallocation et impression de la contrainte sur stdout

rint_eq(c);

REE((char *)c,CONTRAINTE,f);

Definition at line 239 of file alloc.c.

240 {
241  (void) printf("destruction de EQ dans %s\n",f);
242  /*print_eq(c);*/
243  dbg_vect_rm(c->vecteur,f);
244  /*FREE((char *)c,CONTRAINTE,f);*/
245  free((char *)c);
246 }
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
int printf()
void dbg_vect_rm(Pvecteur v, char __attribute__((unused)) *f)
void dbg_vect_rm(Pvecteur v, char * f): desallocation d'un vecteur avec marquage de la fonction provo...
Definition: alloc.c:139

References dbg_vect_rm(), f(), free(), printf(), and Scontrainte::vecteur.

+ Here is the call graph for this function:

◆ egalite_dump()

void egalite_dump ( Pcontrainte  c)

void egalite_dump(Pcontrainte c): impression "physique" d'une egalite; utilise en debugging

Definition at line 160 of file io.c.

160  {
162 }
void egalite_fprint(FILE *fp, Pcontrainte eg, char *(*variable_name)(Variable))
void egalite_fprint(FILE * fp, Pcontrainte eg, char * (*variable_name)()): impression d'une egalite e...
Definition: io.c:152
char *(* variable_debug_name)(Variable)
Debug support: pointer to the function used by debug print outs.
Definition: variable.c:114

References egalite_fprint(), and variable_debug_name.

+ Here is the call graph for this function:

◆ egalite_equal()

bool egalite_equal ( Pcontrainte  eg1,
Pcontrainte  eg2 
)

bool egalite_equal(Pcontrainte eg1, Pcontrainte eg2): teste l'equivalence de deux egalites; leurs coefficients peuvent etre tous egaux ou tous opposes; pour obtenir une meilleure equivalence il faut commencer par reduire leurs coefficients par les PGCD

Soit eg1, sum a1i xi = b1, et eg2, sum a2i xi = b2. i i return a1i == a2i || a1i == -a2i; i i

Note: 2x=2 est different de x=1

Parameters
eg1g1
eg2g2

Definition at line 98 of file predicats.c.

101 {
102  bool result;
103 
105  result = true;
106  else if(CONTRAINTE_UNDEFINED_P(eg1) || CONTRAINTE_UNDEFINED_P(eg2))
107  result = false;
108  else
109  result = vect_equal(eg1->vecteur,eg2->vecteur) ||
110  vect_oppos(eg1->vecteur,eg2->vecteur);
111 
112  return(result);
113 }

References CONTRAINTE_UNDEFINED_P, vect_equal(), vect_oppos(), and Scontrainte::vecteur.

Referenced by extract_common_constraints(), free_guards(), sc_elim_db_constraints(), sc_elim_double_constraints(), sc_kill_db_eg(), sc_safe_elim_db_constraints(), and sc_safe_kill_db_eg().

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

◆ egalite_fprint()

void egalite_fprint ( FILE *  ,
Pcontrainte  ,
char *  *)(Variable 
)

Referenced by egalite_debug(), put_variables_in_ordered_lists(), sc_fprint(), and sl_fprint_tab().

+ Here is the caller graph for this function:

◆ egalite_in_liste()

bool egalite_in_liste ( Pcontrainte  v,
Pcontrainte  listev 
)

bool egalite_in_liste(Pcontrainte eg, Pcontrainte leg): test si une egalite appartient a une liste d'egalites

Une egalite peut avoir ete multipliee par moins 1 mais ses coefficients, comme les coefficients des egalites de la liste, doivent avoir ete reduits par leur PGCD auparavant

Ancien nom: vect_in_liste1()

Parameters
listevistev

Definition at line 108 of file listes.c.

109 {
110  Pcontrainte v1;
111 
112  if (v->vecteur == NULL) return(true);
113  for (v1=listev;v1!=NULL;v1=v1->succ) {
114  if (vect_equal((v1->vecteur),(v->vecteur)) ||
115  vect_oppos((v1->vecteur),(v->vecteur))) {
116  return true;
117  }
118  }
119  return false;
120 }

References Scontrainte::succ, vect_equal(), vect_oppos(), and Scontrainte::vecteur.

+ Here is the call graph for this function:

◆ egalite_normalize()

bool egalite_normalize ( Pcontrainte  eg)

bool egalite_normalize(Pcontrainte eg): reduction d'une equation diophantienne par le pgcd de ses coefficients; l'equation est infaisable si le terme constant n'est pas divisible par ce pgcd

Soit eg == sum ai xi = b i Soit k = pgcd ai i eg := eg/k

return b % k == 0 || all ai == 0 && b != 0;

Parameters
egg

Definition at line 136 of file normalize.c.

138 {
139  return(contrainte_normalize(eg, true));
140 }
bool contrainte_normalize(Pcontrainte c, bool is_egalite)
package contrainte - NORMALISATION D'UN CONTRAINTE
Definition: normalize.c:56

References contrainte_normalize().

Referenced by better_elim_var_with_eg(), gcd_and_constant_dependence_test(), new_elim_var_with_eg(), sc_add_normalize_eq(), sc_bounded_normalization(), sc_minmax_of_variable2(), sc_normalize(), sc_strong_normalize2(), sc_strong_normalize_and_check_feasibility(), and sc_strong_normalize_and_check_feasibility2().

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

◆ egalite_sprint()

char* egalite_sprint ( char *  ,
Pcontrainte  ,
char *  *)(Variable 
)

◆ egalite_sprint_format()

char* egalite_sprint_format ( char *  ,
Pcontrainte  ,
char *  *)(Variable,
bool   
)

◆ egalites_dump()

void egalites_dump ( Pcontrainte  eg)
Parameters
egg

Definition at line 201 of file io.c.

202 {egalites_fprint(stderr, eg, variable_debug_name);}
void egalites_fprint(FILE *fp, Pcontrainte eg, char *(*variable_name)(Variable))
void egalites_fprint(FILE * fp, Pcontrainte eg, char * (*variable_name)()): impression d'une liste d'...
Definition: io.c:192

References egalites_fprint(), and variable_debug_name.

+ Here is the call graph for this function:

◆ egalites_fprint()

void egalites_fprint ( FILE *  ,
Pcontrainte  ,
char *  *)(Variable 
)

Referenced by build_transfer_equations(), sc_default_dump(), sc_default_dump_to_files(), sc_dump(), and sc_fprint_for_sc_fscan().

+ Here is the caller graph for this function:

◆ eq_diff_const()

Value eq_diff_const ( Pcontrainte  c1,
Pcontrainte  c2 
)

Value eq_diff_const(Pcontrainte c1, Pcontrainte c2): calcul de la difference des deux termes constants des deux equations c1 et c2.

Notes:

  • cette routine fait l'hypothese que CONTRAINTE_UNDEFINED=>CONTRAINTE_NULLE

Modifications:

  • renvoie d'une valeur non nulle meme si une des contraintes est nulles
Parameters
c11
c22

Definition at line 218 of file binaires.c.

220 {
221  if(c1!=NULL)
222  if(c2!=NULL) {
223  Value b1 = vect_coeff(TCST,c1->vecteur),
224  b2 = vect_coeff(TCST,c2->vecteur);
225  return value_minus(b1,b2);
226  }
227  else
228  return vect_coeff(TCST,c1->vecteur);
229  else
230  if(c2!=NULL)
231  return value_uminus(vect_coeff(TCST,c2->vecteur));
232  else
233  return VALUE_ZERO;
234 }
#define value_minus(v1, v2)
Value b2
Definition: sc_gram.c:105
Value b1
booleen indiquant quel membre est en cours d'analyse
Definition: sc_gram.c:105

References b1, b2, TCST, value_minus, value_uminus, VALUE_ZERO, and vect_coeff().

Referenced by sc_check_inequality_redundancy(), sc_elim_simple_redund_with_eq(), and sc_elim_simple_redund_with_ineq().

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

◆ eq_set_vect_nul()

void eq_set_vect_nul ( Pcontrainte  c)

void_eq_set_vect_nul(Pcontrainte c): transformation d'une contrainte en une contrainte triviale 0 == 0

cette fonction est utile lorsque l'on veut eliminer plusieurs
contraintes du systeme sans avoir a le restructurer apres chaque
elimination.

Pour eliminer toutes ces "fausses" contraintes on utilise a la fin la
fonction "syst_elim_eq" (ou "sc_rm_empty_constraints"...)

Definition at line 84 of file unaires.c.

86 {
87  if(!CONTRAINTE_UNDEFINED_P(c)) {
90  }
91 }

References CONTRAINTE_UNDEFINED_P, contrainte_vecteur, vect_rm(), and VECTEUR_NUL.

Referenced by elim_redund_sc_with_sc(), sc_bounded_normalization(), sc_elim_db_constraints(), sc_elim_double_constraints(), sc_elim_redund_with_first_ofl_ctrl(), sc_elim_simple_redund_with_eq(), sc_elim_simple_redund_with_ineq(), sc_inequations_elim_redund(), sc_kill_db_eg(), sc_safe_elim_db_constraints(), sc_safe_kill_db_eg(), sc_strong_normalize_and_check_feasibility(), sc_transform_ineg_in_eg(), sc_triang_elim_redund(), sc_triang_elim_redund_n_first(), simplify_big_coeff(), and sys_int_redond().

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

◆ eq_smg()

bool eq_smg ( Pcontrainte  c1,
Pcontrainte  c2 
)

predicats.c

predicats.c

INTLIBRARY bool eq_smg(Pcontrainte c1, Pcontrainte c2): comparaison des coefficients de deux contraintes pour savoir si elles ont le meme membre gauche.

Note: this works for inequalities. Similar equations may differ by a factor of -1.

Parameters
c11
c22

Definition at line 52 of file predicats.c.

54 {
55  bool result;
56 
57  if(c1==NULL && c2==NULL)
58  result = true;
59  else if(c1==NULL || c2==NULL)
60  result = false;
61  else
62  result = vect_equal_except(c1->vecteur,c2->vecteur,TCST);
63 
64  return result;
65 }
bool vect_equal_except(Pvecteur v1, Pvecteur v2, Variable var)
bool vect_equal_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon ...
Definition: reductions.c:319

References TCST, and vect_equal_except().

Referenced by sc_check_inequality_redundancy(), sc_elim_double_constraints(), sc_elim_simple_redund_with_eq(), and sc_elim_simple_redund_with_ineq().

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

◆ eq_sum_const()

Value eq_sum_const ( Pcontrainte  c1,
Pcontrainte  c2 
)

Value eq_sum_const(Pcontrainte c1, Pcontrainte c2): calcul de la somme des deux termes constants des deux contraintes c1 et c2.

Notes:

  • cette routine fait l'hypothese que CONTRAINTE_UNDEFINED=>CONTRAINTE_NULLE
Parameters
c11
c22

Definition at line 243 of file binaires.c.

245 {
246  if(c1!=NULL)
247  if(c2!=NULL) {
248  Value b1 = vect_coeff(TCST,c1->vecteur),
249  b2 = vect_coeff(TCST,c2->vecteur);
250  return value_plus(b1, b2);
251  }
252  else
253  return vect_coeff(TCST,c1->vecteur);
254  else
255  if(c2!=NULL)
256  return vect_coeff(TCST,c2->vecteur);
257  else
258  return VALUE_ZERO;
259 }
#define value_plus(v1, v2)
binary operators on values

References b1, b2, TCST, value_plus, VALUE_ZERO, and vect_coeff().

Referenced by sc_check_inequality_redundancy().

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

◆ equality_eval_p()

bool equality_eval_p ( Pvecteur  c,
Pvecteur  v 
)

Definition at line 369 of file predicats.c.

370 {
371  return contrainte_eval_p(c, v, true);
372 }
bool contrainte_eval_p(Pvecteur c, Pvecteur v, bool is_equality_p)
Evaluate constraint c according to values in v and return true if the constraint is met.
Definition: predicats.c:354

References contrainte_eval_p().

Referenced by sc_belongs_p(), and sc_internal_p().

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

◆ equation_lexicographic_compare()

int equation_lexicographic_compare ( Pcontrainte  c1,
Pcontrainte  c2,
int(*)(Pvecteur *, Pvecteur *)  compare 
)

it is assumed that constraints c1 and c2 are already lexicographically sorted

Parameters
c11
c22

Definition at line 395 of file unaires.c.

397 {
398  /* it is assumed that constraints c1 and c2 are already
399  lexicographically sorted */
400  int cmp = 0;
401 
402  cmp = vect_lexicographic_compare(c1->vecteur, c2->vecteur, compare);
403 
404  return cmp;
405 }
int vect_lexicographic_compare(Pvecteur v1, Pvecteur v2, int(*compare)(Pvecteur *, Pvecteur *))
qsort() is not safe if the comparison function is not antisymmetric.
Definition: unaires.c:433

References vect_lexicographic_compare(), and Scontrainte::vecteur.

Referenced by internal_equation_compare().

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

◆ equations_lexicographic_sort()

Pcontrainte equations_lexicographic_sort ( Pcontrainte  cl,
int(*)(Pvecteur *, Pvecteur *)  compare 
)
Parameters
cll

Definition at line 438 of file unaires.c.

440 {
442 
443  result = constraints_lexicographic_sort_generic(cl, compare, true);
444 
445  return result;
446 }

References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.

Referenced by sc_lexicographic_sort().

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

◆ extract_common_constraints()

Pcontrainte extract_common_constraints ( Pcontrainte pc1,
Pcontrainte pc2,
bool  eq 
)

common (simply equal) contraints are extracted, whether equalities or inequalities.

returns the common extracted constaints. WARNING: *pc1 and *pc2 are modified.

common!

link to result.

clean

get to next.

Parameters
pc1c1
pc2c2
eqq

Definition at line 285 of file binaires.c.

286 {
287  Pcontrainte c = CONTRAINTE_UNDEFINED, c1, c2, c1p, c2p, nc1, nc2;
288 
289  for (c1 = *pc1,
290  c1p = CONTRAINTE_UNDEFINED,
291  nc1 = c1? c1->succ: CONTRAINTE_UNDEFINED;
292  c1;
293  c1p = (c1==nc1)? c1p: c1,
294  c1 = nc1,
295  nc1 = c1? c1->succ: CONTRAINTE_UNDEFINED)
296  {
297  for (c2 = *pc2,
298  c2p = CONTRAINTE_UNDEFINED,
299  nc2 = c2? c2->succ: CONTRAINTE_UNDEFINED;
300  c2;
301  c2p = (c2==nc2)? c2p: c2,
302  c2 = nc2,
303  nc2 = c2? c2->succ: CONTRAINTE_UNDEFINED)
304  {
305  if ((eq && egalite_equal(c1, c2)) || (!eq && contrainte_equal(c1, c2)))
306  {
307  /* common! */
308  Pcontrainte sc1 = c1->succ, sc2 = c2->succ;
309 
310  c1->succ = c, c = c1; /* link to result. */
311  c2->succ = NULL, contrainte_free(c2); /* clean */
312 
313  if (c1p) c1p->succ = sc1; else *pc1 = sc1;
314  if (c2p) c2p->succ = sc2; else *pc2 = sc2;
315 
316  /* get to next. */
317  c1 = nc1;
318  c2 = nc2 = CONTRAINTE_UNDEFINED;
319  }
320  }
321  }
322 
323  return c;
324 }
bool contrainte_equal(Pcontrainte, Pcontrainte)
bool contrainte_equal(Pcontrainte c1, Pcontrainte c2): test d'egalite des contraintes c1 et c2; elles...
Definition: predicats.c:128
bool egalite_equal(Pcontrainte, Pcontrainte)
bool egalite_equal(Pcontrainte eg1, Pcontrainte eg2): teste l'equivalence de deux egalites; leurs coe...
Definition: predicats.c:98

References contrainte_equal(), contrainte_free(), CONTRAINTE_UNDEFINED, egalite_equal(), eq, and Scontrainte::succ.

Referenced by extract_common_syst().

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

◆ inegalite_comb()

Pcontrainte inegalite_comb ( Pcontrainte  posit,
Pcontrainte  negat,
Variable  v 
)
Parameters
positosit
negategat

Definition at line 65 of file binaires.c.

68 {
69  return( inegalite_comb_ofl_ctrl(posit,negat,v, NO_OFL_CTRL));
70 }
Pcontrainte inegalite_comb_ofl_ctrl(Pcontrainte posit, Pcontrainte negat, Variable v, int ofl_ctrl)
Pcontrainte inegalite_comb_ofl_ctrl(Pcontrainte posit, Pcontrainte negat, Variable v,...
Definition: binaires.c:179

References inegalite_comb_ofl_ctrl(), and NO_OFL_CTRL.

+ Here is the call graph for this function:

◆ inegalite_comb_ofl()

Pcontrainte inegalite_comb_ofl ( Pcontrainte  posit,
Pcontrainte  negat,
Variable  v 
)
Parameters
positosit
negategat

Definition at line 72 of file binaires.c.

75 {
76  return( inegalite_comb_ofl_ctrl(posit,negat,v, FWD_OFL_CTRL));
77 
78 }

References FWD_OFL_CTRL, and inegalite_comb_ofl_ctrl().

+ Here is the call graph for this function:

◆ inegalite_comb_ofl_ctrl()

Pcontrainte inegalite_comb_ofl_ctrl ( Pcontrainte  posit,
Pcontrainte  negat,
Variable  v,
int  ofl_ctrl 
)

Pcontrainte inegalite_comb_ofl_ctrl(Pcontrainte posit, Pcontrainte negat, Variable v, int ofl_ctrl): combinaison lineaire positive des deux inegalites posit et negat eliminant la variable v.

Une nouvelle contrainte est allouee et renvoyee.

Si le coefficient de v dans negat egale -1 ou si le coefficient de v dans posit egale 1, la nouvelle contrainte est equivalente en nombres entiers avec posit et negat.

Modifications:

  • use gcd to reduce the combination coefficients in hope to reduce integer overflow risk (Francois Irigoin, 17 December 1991)

Le controle de l'overflow est effectue et traite par le retour du contexte correspondant au dernier CATCH(overflow_error) effectue.

pdiv ???

Parameters
positosit
negategat
ofl_ctrlfl_ctrl

Definition at line 179 of file binaires.c.

183 {
184  Value cv_p, cv_n, d;
185  Pcontrainte ineg;
186 
187  cv_p = vect_coeff(v,posit->vecteur);
188  cv_n = vect_coeff(v,negat->vecteur);
189 
190  assert(value_pos_p(cv_p) && value_neg_p(cv_n));
191 
192  d = pgcd(cv_p, value_uminus(cv_n));
193  if(value_notone_p(d)) {
194  cv_p = value_div(cv_p,d); /* pdiv ??? */
195  cv_n = value_div(cv_n,d);
196  }
197 
198  ineg = contrainte_new();
199 
200  ineg->vecteur = vect_cl2_ofl_ctrl(cv_p,negat->vecteur,
201  value_uminus(cv_n),
202  posit->vecteur, ofl_ctrl);
203  return(ineg);
204 }
#define pgcd(a, b)
Pour la recherche de performance, selection d'une implementation particuliere des fonctions.
#define value_notone_p(val)
#define value_div(v1, v2)

References assert, contrainte_new(), pgcd, value_div, value_neg_p, value_notone_p, value_pos_p, value_uminus, vect_cl2_ofl_ctrl(), vect_coeff(), and Scontrainte::vecteur.

Referenced by inegalite_comb(), and inegalite_comb_ofl().

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

◆ inegalite_dump()

void inegalite_dump ( Pcontrainte  c)

void inegalite_dump(Pcontrainte c): impression "physique" d'une inegalite; utilise en debugging

Definition at line 182 of file io.c.

182  {
184 }
void inegalite_fprint(FILE *fp, Pcontrainte ineg, char *(*variable_name)(Variable))
void inegalite_fprint(FILE * fp, Pcontrainte ineg, char * (*variable_name)()): impression d'une inega...
Definition: io.c:171

References inegalite_fprint(), and variable_debug_name.

+ Here is the call graph for this function:

◆ inegalite_fprint()

void inegalite_fprint ( FILE *  ,
Pcontrainte  ,
char *  *)(Variable 
)

Referenced by inegalite_debug(), sc_fprint(), and sl_fprint_tab().

+ Here is the caller graph for this function:

◆ inegalite_normalize()

bool inegalite_normalize ( Pcontrainte  ineg)

bool inegalite_normalize(Pcontrainte ineg): normalisation d'une inegalite a variables entieres; voir contrainte_normalize; retourne presque toujours true car une inegalite n'ayant qu'un terme constant est toujours faisable a moins qu'il ne reste qu'un terme constant strictement positif.

Soit eg == sum ai xi <= b i Soit k = pgcd ai i eg := eg/k

return true unless all ai are 0 and b < 0

Parameters
inegneg

Definition at line 156 of file normalize.c.

158 {
159  return(contrainte_normalize(ineg ,false));
160 }

References contrainte_normalize().

Referenced by sc_add_normalize_ineq(), sc_bounded_normalization(), sc_normalize(), and sc_strong_normalize_and_check_feasibility().

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

◆ inegalite_sprint()

char* inegalite_sprint ( char *  ,
Pcontrainte  ,
char *  *)(Variable 
)

◆ inegalite_sprint_format()

char* inegalite_sprint_format ( char *  ,
Pcontrainte  ,
char *  *)(Variable,
bool   
)

◆ inegalites_dump()

void inegalites_dump ( Pcontrainte  eg)
Parameters
egg

Definition at line 220 of file io.c.

void inegalites_fprint(FILE *fp, Pcontrainte ineg, char *(*variable_name)(Variable))
void inegalites_fprint(FILE * fp, Pcontrainte ineg, char * (*variable_name)()): impression d'une list...
Definition: io.c:211

References inegalites_fprint(), and variable_debug_name.

Referenced by build_convex_constraints_from_vertices(), check_coefficient_reduction(), and sc_bounded_normalization().

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

◆ inegalites_fprint()

void inegalites_fprint ( FILE *  ,
Pcontrainte  ,
char *  *)(Variable 
)

Referenced by constraints_to_loop_bound(), sc_default_dump(), sc_default_dump_to_files(), sc_dump(), and sc_fprint_for_sc_fscan().

+ Here is the caller graph for this function:

◆ inequalities_lexicographic_sort()

Pcontrainte inequalities_lexicographic_sort ( Pcontrainte  cl,
int(*)(Pvecteur *, Pvecteur *)  compare 
)
Parameters
cll

Definition at line 449 of file unaires.c.

451 {
453 
454  result = constraints_lexicographic_sort_generic(cl, compare, false);
455 
456  return result;
457 }

References constraints_lexicographic_sort_generic(), and CONTRAINTE_UNDEFINED.

Referenced by sc_lexicographic_sort().

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

◆ inequalities_opposite_p()

bool inequalities_opposite_p ( Pcontrainte  c1,
Pcontrainte  c2 
)

bool inequalities_opposite_p(Pcontrainte c1, Pcontrainte c2): True if the non-constant part of c1 is the opposite of the non-constant part of c2.

Parameters
c11
c22

Definition at line 71 of file predicats.c.

73 {
74  bool result;
75 
76  if(c1==NULL && c2==NULL)
77  result = true;
78  else if(c1==NULL || c2==NULL)
79  result = false;
80  else
81  result = vect_opposite_except(c1->vecteur,c2->vecteur,TCST);
82 
83  return result;
84 }
bool vect_opposite_except(Pvecteur v1, Pvecteur v2, Variable var)
bool vect_opposite_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections sel...
Definition: reductions.c:399

References TCST, and vect_opposite_except().

Referenced by sc_check_inequality_redundancy().

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

◆ inequality_eval_p()

bool inequality_eval_p ( Pvecteur  c,
Pvecteur  v 
)

Definition at line 374 of file predicats.c.

375 {
376  return contrainte_eval_p(c, v, false);
377 }

References contrainte_eval_p().

Referenced by sc_belongs_p().

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

◆ inequality_lexicographic_compare()

int inequality_lexicographic_compare ( Pcontrainte  c1,
Pcontrainte  c2,
int(*)(Pvecteur *, Pvecteur *)  compare 
)

it is assumed that constraints c1 and c2 are already lexicographically sorted

Parameters
c11
c22

Definition at line 416 of file unaires.c.

418 {
419  /* it is assumed that constraints c1 and c2 are already
420  lexicographically sorted */
421  int cmp = 0;
422 
423  cmp = vect_lexicographic_compare2(c1->vecteur, c2->vecteur, compare);
424 
425  return cmp;
426 }
int vect_lexicographic_compare2(Pvecteur v1, Pvecteur v2, int(*compare)(Pvecteur *, Pvecteur *))
Version for inequalities.
Definition: unaires.c:449

References vect_lexicographic_compare2(), and Scontrainte::vecteur.

Referenced by internal_inequality_compare().

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

◆ level_contrainte()

int level_contrainte ( Pcontrainte  pc,
Pbase  base_index 
)

int level_contrainte(Pcontrainte pc, Pbase base_index) compute the level (rank) of the constraint pc in the nested loops.

base_index is the index basis in the good order The result corresponds to the rank of the greatest index in the constraint, and the sign of the result corresponds to the sign of the coefficient of this index

For instance: base_index :I->J->K , I - J <=0 ==> level -2 I + J + K <=0 ==> level +3

Parameters
pcc
base_indexase_index

Definition at line 292 of file unaires.c.

295 {
296  Pvecteur pv;
297  Pbase pb;
298  int level = 0;
299  int i;
300  int sign=1;
301  bool trouve = false;
302 
303  for (pv = pc->vecteur;
304  pv!=NULL;
305  pv = pv->succ)
306  {
307  for (i=1, trouve=false, pb=base_index;
308  pb!=NULL && !trouve;
309  i++, pb=pb->succ)
310  if (pv->var == pb->var)
311  {
312  trouve = true;
313  if (i>level)
314  level = i, sign = value_sign(pv->val);
315  }
316  }
317  return(sign*level);
318 }
#define value_sign(v)
trian operators on values
#define level
Value val
Definition: vecteur-local.h:91

References level, Svecteur::succ, Svecteur::val, value_sign, and Svecteur::var.

Referenced by make_bound_expression(), and sc_triang_elim_redund().

+ Here is the caller graph for this function:

◆ nb_elems_list()

int nb_elems_list ( Pcontrainte  list)

int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes

Ancien nom: nb_elems_eq()

Cycles are not detected

Parameters
listist

Definition at line 129 of file listes.c.

130 {
131  int i;
132  Pcontrainte c;
133 
134  for(i=0, c=list;c!=NULL;i++,c=c->succ)
135  ;
136 
137  return i;
138 }
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References Scontrainte::succ.

Referenced by bounds_equal_p(), build_third_comb(), combiner_ofl_with_test(), constraints_lexicographic_sort_generic(), constraints_sort_info(), loop_iteration_domaine_to_sc(), prepare_reindexing(), region_sc_minimal(), sc_add_egalites(), sc_add_inegalites(), sc_elim_var(), sc_fix(), sc_make(), sc_projection_optim_along_vecteur_ofl(), sc_remove_large_coef(), and sc_weak_consistent_p().

+ Here is the caller graph for this function:

◆ norm_eq()

void norm_eq ( Pcontrainte  nr)

unaires.c

unaires.c

norm_eq: normalisation d'une contrainte par le pgcd de TOUS les coefficients, i.e. y compris le terme constant

Parameters
nrr

Definition at line 44 of file unaires.c.

46 {
48 }
void vect_normalize(Pvecteur v)
void vect_normalize(Pvecteur v): division de tous les coefficients de v par leur pgcd; "normalisation...
Definition: unaires.c:59

References vect_normalize().

Referenced by norm_syst().

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

◆ Pcontrainte_separate_on_vars()

void Pcontrainte_separate_on_vars ( Pcontrainte  initial,
Pbase  vars,
Pcontrainte pwith,
Pcontrainte pwithout 
)

void Pcontrainte_separate_on_vars(initial, vars, pwith, pwithout) Pcontrainte initial; Pbase vars; Pcontrainte *pwith, *pwithout;

IN: initial, vars

OUT: pwith, pwithout

builds two Pcontraintes from the one given, using the constraint_without_vars criterium.

(c) FC 16/05/94

Parameters
initialnitial
varsars
pwithwith
pwithoutwithout

Definition at line 140 of file unaires.c.

144 {
146  c = (Pcontrainte) NULL,
147  new = CONTRAINTE_UNDEFINED;
148 
149  for(c=initial,
150  *pwith=(Pcontrainte)NULL,
151  *pwithout=(Pcontrainte)NULL;
152  c!=(Pcontrainte) NULL;
153  c=c->succ)
154  if (constraint_without_vars(c, vars))
155  new = contrainte_make(vect_dup(c->vecteur)),
156  new->succ = *pwithout,
157  *pwithout = new;
158  else
159  new = contrainte_make(vect_dup(c->vecteur)),
160  new->succ = *pwith,
161  *pwith = new;
162 }
bool constraint_without_vars(Pcontrainte, Pbase)
bool constraint_without_vars(c, vars) Pcontrainte c; Pbase vars;
Definition: predicats.c:276

References constraint_without_vars(), contrainte_make(), CONTRAINTE_UNDEFINED, Scontrainte::succ, vect_dup(), and Scontrainte::vecteur.

Referenced by get_other_constraints(), and sc_separate_on_vars().

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

◆ safe_nb_elems_list()

int safe_nb_elems_list ( Pcontrainte  list,
int  n 
)

Compute the number of elements in the list if it is less than n.

n is assumed positive. A negative value is returned if the number of elements is strictly greater than n, for instance because the list is cyclic.

Parameters
listist

Definition at line 162 of file listes.c.

163 {
164  int i;
165  Pcontrainte c;
166 
167  assert(n>=0);
168 
169  for(i=0, c=list;c!=NULL && i<=n ;i++,c=c->succ)
170  ;
171 
172  return i<=n? i : -1;
173 }

References assert, and Scontrainte::succ.

Referenced by sc_consistent_p().

+ Here is the caller graph for this function:

◆ sprint_operator()

void sprint_operator ( char *  s,
bool  is_inegalite,
bool  a_la_fortran 
)
Parameters
is_inegalites_inegalite
a_la_fortran_la_fortran

Definition at line 224 of file io.c.

225 {
226  (void) sprintf(s, "%s",(is_inegalite? (a_la_fortran? ".LE.": "<="):
227  (a_la_fortran? ".EQ.": "==")));
228 }

Referenced by heuristique_1(), and heuristique_3().

+ Here is the caller graph for this function:

◆ vect_constant_p()

bool vect_constant_p ( Pvecteur  v)

bool vect_constant_p(Pvecteur v): v contains only a constant term, may be zero

Bugs:

  • this function should not be in contrainte.dir; it should be moved into vecteur.dir with TCST...
  • should assert !VECTEUR_UNDEFINED_P(v)

Definition at line 211 of file predicats.c.

213 {
214  return(VECTEUR_NUL_P(v) || (v->var == TCST && v->succ == NULL));
215 }

References TCST, and VECTEUR_NUL_P.

Referenced by add_declaration_list_information(), add_reference_information(), contrainte_constante_p(), contrainte_parallele(), convert_bound_expression(), dims_array_init(), expression_and_precondition_to_integer_interval(), expression_equal_in_context_p(), expression_less_than_in_context(), expression_to_int(), IsExprConst(), loop_index_domaine_to_contrainte(), loop_regions_normalize(), region_projection_along_index_safe_p(), sc_elim_double_constraints(), signed_integer_constant_expression_value(), text_equivalence_class(), and trivial_expression_p().

+ Here is the caller graph for this function: