25 #include "pips_config.h"
174 (void)
fprintf(stderr,
"%s: %s\n",
"loop_to_transformer",
175 "tf1 after renaming =");
180 (void)
fprintf(stderr,
"%s: %s\n",
"loop_to_transformer",
"tf1 =");
190 (void)
fprintf(stderr,
"%s: %s\n",
"loop_to_transformer",
"tf2 =");
198 (void)
fprintf(stderr,
"%s: %s\n",
"loop_to_transformer",
"tf12 =");
206 (void)
fprintf(stderr,
"%s: %s\n",
"loop_to_transformer",
"tf23 =");
215 (void)
fprintf(stderr,
"%s: %s\n",
"loop_to_transformer",
"tf_star =");
293 pips_debug(8,
"begin for transformer %p\n", tf);
334 for(i=1; i<= n_eq; i++) {
357 for(i=1; i <= n_eq &&
360 n_inv = n_eq - i + 1;
361 pips_debug(8,
"number of useful invariants: %d\n", n_inv-1);
368 for(i = n_eq - n_inv + 1 ; i <= n_eq; i++) {
377 for(j = 1; j<= n_eq; j++) {
467 pips_debug(8,
"preliminary transfer equations:\n");
491 bool preserve =
true;
533 pips_debug(8,
"results\ntransfer equations:\n");
629 ACCESS(a, n_eq, nv_rank, ov_rank) =
634 ACCESS(a, n_eq, nv_rank, n_eq) =
650 bool is_a_sub_basis =
true;
657 return is_a_sub_basis;
717 pips_debug(8,
"Begin for transformer %p:\n", tf);
741 pips_debug(8,
"after constant term elimination=\n");
755 pips_debug(8,
"after non-invariant elimination=\n");
771 sc_nbre_egalites(fix_sc) = 0;
774 sc_nbre_inegalites(fix_sc) = 0;
837 if(
ABS(c_inc) <
ABS(inc) || c_inc == 1) {
936 bool invariant =
true;
1017 pips_assert(
"sc is defined", !SC_UNDEFINED_P(sc));
1072 pips_debug(8,
"Begin for transformer %p:\n", tf);
1119 pips_debug(8,
"with difference equations=\n");
1125 sc = sc_projection_ofl_along_variables(sc, b);
1128 pips_debug(8,
"Non-homogeneous constraints on derivatives=\n");
1140 sc = sc_projection_ofl(sc, (
Variable) ik);
1148 pips_debug(8,
"All invariants on derivatives=\n");
1181 "All invariants on derivatives with difference variables=\n");
1187 sc = sc_projection_ofl_along_variables(sc, diffb);
1190 pips_debug(8,
"All invariants on differences=\n");
1201 pips_debug(8,
"All invariants with proper basis =\n");
1293 sc_nbre_egalites(sc) = 0;
1294 sc_nbre_inegalites(sc) = 0;
1319 bool assume_previous_iteration_p)
1340 fprintf(stderr,
"t_enter:\n");
1346 fprintf(stderr,
"post_init:\n");
1350 if(assume_previous_iteration_p)
1359 for(ck=2; ck<=k; ck++)
1361 t_fbody_star = (* transformer_fix_point_operator)(t_fbody_k);
1414 fprintf(stderr,
"t_body_star:\n");
void free_transformer(transformer p)
predicate make_predicate(Psysteme a1)
transformer copy_transformer(transformer p)
TRANSFORMER.
struct _newgen_struct_entity_ * entity
cons * dup_arguments(cons *args)
#define value_mone_p(val)
#define value_oppose(ref)
#define value_notzero_p(val)
#define value_uminus(val)
unary operators on values
void const char const char const int
#define value_zero_p(val)
#define ABS(x)
was: #define value_mult(v,w) value_direct_multiply(v,w) #define value_product(v,w) value_direct_produ...
#define value_substract(ref, val)
Pbase base_add_variable(Pbase b, Variable var)
Pbase base_add_variable(Pbase b, Variable v): add variable v as a new dimension to basis b at the end...
Pbase base_difference(Pbase b1, Pbase b2)
Pbase base_difference(Pbase b1, Pbase b2): allocate b; b = b1 - b2 – with the set meaning return b;.
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,...
Pbase base_remove_variable(Pbase b, Variable v)
Pbase base_remove_variable(b, v): remove basis vector relative to v from b; abort if v is not in b;.
bool base_contains_variable_p(Pbase b, Variable v)
bool base_contains_variable_p(Pbase b, Variable v): returns true if variable v is one of b's elements...
Pbase vect_add_variable(Pbase b, Variable v)
package vecteur - routines sur les bases
transformer transformer_dup(transformer t_in)
transformer package - basic routines
void transformer_free(transformer t)
transformer transformer_identity()
Allocate an identity transformer.
bool transformer_consistency_p(transformer t)
FI: I do not know if this procedure should always return or fail when an inconsistency is found.
#define CONTRAINTE_UNDEFINED_P(c)
#define contrainte_succ(c)
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
#define CONTRAINTE_UNDEFINED
#define contrainte_rm(c)
the standard xxx_rm does not return a value
Pcontrainte contraintes_free(Pcontrainte pc)
Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc.
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
void egalites_fprint(FILE *, Pcontrainte, char *(*)(Variable))
bool transfer_equation_p(Pvecteur eq)
A transfer equation is an explicit equation giving one new value as a function of old values and a co...
Pvecteur look_for_the_best_counter(Pcontrainte egs)
Try to identify a loop counter among the equation egs.
void build_transfer_equations(Pcontrainte leq, Pcontrainte *plteq, Pbase *pb_new)
static void build_transfer_matrix(matrice *, Pcontrainte, int, Pbase)
Must be declared explicity to keep a logical order in this C file.
Psysteme sc_keep_invariants_only(Psysteme sc)
This function cannot be moved into the Linear library.
list transformers_derivative_fix_point(list tl)
Psysteme sc_multiply_constant_terms(Psysteme sc, Variable ik, bool star_p)
Specific for the derivative fix point: each constant term in the constraints is multiplied by ik whic...
Psysteme sc_eliminate_constant_terms(Psysteme sc, Pvecteur v)
Eliminate all constant terms in sc using v.
void equations_to_bases(Pcontrainte lteq, Pbase *pb_new, Pbase *pb_old)
bool sub_basis_p(Pbase b1, Pbase b2)
FI: should be moved in base.c.
transformer any_transformer_to_k_closure(transformer t_init, transformer t_enter, transformer t_next, transformer t_body, transformer post_init, int k, bool assume_previous_iteration_p)
Derived from any_loop_to_k_transformer()
transformer(* transformer_fix_point_operator)(transformer)
transformer package - fix-point or transitive closure computations
transformer transformer_basic_fix_point(transformer tf)
Computation of a fix point: drop all constraints, remember which variables are changed.
transformer transformer_equality_fix_point(transformer tf)
Let A be the affine loop transfert function.
Pcontrainte constraints_keep_invariants_only(Pcontrainte lc)
transformer transformer_halbwachs_fix_point(transformer tf)
bool invariant_vector_p(Pvecteur v)
A vector (in fact, a constraint) represents an invariant if it is a sum of delta for each variable.
Pcontrainte constraints_eliminate_constant_terms(Pcontrainte lc, Pvecteur v)
entity new_value_in_transfer_equation(Pvecteur eq)
transformer transformer_pattern_fix_point(transformer tf)
This fixpoint function was developped to present a talk at FORMA.
transformer transformer_derivative_fix_point(transformer tf)
Computation of a transitive closure using constraints on the discrete derivative.
list gen_nreverse(list cp)
reverse a list in place
#define NIL
The empty list (nil in Lisp)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
void base_fprint(FILE *f, Pbase b, get_variable_name_t variable_name)
void base_fprint(FILE * f, Pbase b, char * (*variable_name)()): impression d'une base sur le fichier ...
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
int vect_size(Pvecteur v)
package vecteur - reductions
#define DENOMINATOR(matrix)
int DENOMINATEUR(matrix): acces au denominateur global d'une matrice matrix La combinaison *(&()) est...
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Value * matrice
package matrice
#define MATRICE_UNDEFINED
void matrice_nulle(matrice Z, int n, int m)
void matrice_nulle(matrice Z, int n, int m): Initialisation de la matrice Z a la valeur matrice nulle
void matrice_smith(matrice, int, int, matrice, matrice, matrice)
smith.c
void matrice_fprint(FILE *, matrice, int, int)
matrice_io.c
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
string bool_to_string(bool)
#define print_transformer(t)
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
#define transformer_undefined
#define TRANSFORMER(x)
TRANSFORMER.
#define entity_undefined_p(x)
#define transformer_relation(x)
#define transformer_arguments(x)
struct _newgen_struct_transformer_ * transformer
#define predicate_system(x)
struct Ssysteme * Psysteme
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Pbase sc_to_minimal_basis(Psysteme ps)
creation d'une base contenant toutes les variables apparaissant avec des coefficients non-nuls dans l...
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Psysteme sc_elim_redund(Psysteme ps)
Psysteme sc_elim_redund(Psysteme ps): elimination des contraintes lineaires redondantes dans le syste...
Value b1
booleen indiquant quel membre est en cours d'analyse
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Psysteme sc_equation_add(Psysteme sc, Pcontrainte c)
The basis of the constraint system is updated.
Variable variable_of_rank()
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
struct Scontrainte * succ
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
The structure used to build lists in NewGen.
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define VECTEUR_UNDEFINED
char *(* get_variable_name_t)(Variable)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
#define base_dimension(b)
#define BASE_NULLE
MACROS SUR LES BASES.
#define VECTEUR_UNDEFINED_P(v)
#define base_add_dimension(b, v)
Pvecteur vect_make(Pvecteur v, Variable var, Value val,...)
Pvecteur vect_make(v, [var, val,]* 0, val) Pvecteur v; // may be NULL, use assigne anyway Variable va...
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Pbase base_dup(Pbase b)
Pbase base_dup(Pbase b) Note: this function changes the value of the pointer.
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Pvecteur vect_cl(Pvecteur v, Value lambda, Pvecteur u)
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...
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...