25 #include "pips_config.h"
73 #include "constants.h"
81 #include "prgm_mapping.h"
112 bool (*compare_obj)();
114 list al, aal, nl =
NIL, nnl, nnl_q;
115 chunk * ngo, * aux_ngo;
118 for(al = l; al !=
NIL; al =
CDR(al)) {
124 for(aal = nl; (aal !=
NIL) && not_inserted ; aal =
CDR(aal)) {
126 if(compare_obj(ngo, aux_ngo)) {
128 not_inserted =
false;
266 fprintf(stderr,
"\n[rm_non_x_var] Bases de depart :\n");
272 for(aux_l = l; !
ENDP(aux_l);
POP(aux_l)) {
285 fprintf(stderr,
"\n[rm_non_x_var] Base d'arrivee :\n");
308 for(; (!
ENDP(l1)) && (!found);
POP(l1)) {
340 list *init_l, *elim_l;
352 for(l = vl; !
ENDP(l);
POP(l)) {
360 fprintf(stderr,
"System is :");
370 sc_nbre_egalites(ps)--;
371 if (
eq == (ps->egalites)) ps->egalites =
eq->
succ;
375 for(eg = ps->egalites; eg != NULL; eg = eg->
succ)
377 for(eg = ps->inegalites; eg != NULL; eg = eg->
succ)
392 sc_elim->
base = NULL;
396 fprintf(stderr,
"[new_elim_var_with_eg] Results:\n");
397 fprintf(stderr,
"Elim sys:\n");
400 fprintf(stderr,
"Remnants sys:\n");
428 list *init_l, *elim_l;
449 fprintf(stderr,
"System is :");
451 fprintf(stderr,
"\t\tConsidered Vect :");
459 var_not_found =
true;
460 for(l = vl ; (l !=
NIL) && var_not_found; l =
CDR(l)) {
463 if((crt_val == 1) || (crt_val == -1))
464 var_not_found =
false;
517 fprintf(stderr,
"New System is :");
534 sc_elim->
base = NULL;
538 fprintf(stderr,
"[plc_elim_var_with_eg] Results:\n");
539 fprintf(stderr,
"Elim sys:\n");
542 fprintf(stderr,
"Remnants sys:\n");
574 return(ps->nb_ineq + ps->nb_eq);
577 fprintf(stderr,
"Number of equations in Implicit system : %d\n", impl_ps->
nb_eq);
579 return(impl_ps->
nb_eq);
676 int cl = *count_lambdas;
678 list local_l =
NIL, params_in_D, l, ll;
694 for(pc =
D->inegalites; pc != NULL; pc = pc->
succ) {
702 for(last_P->
succ = pp_v; last_P->
succ != NULL; last_P = last_P->
succ) {}
706 for(pc =
D->egalites; pc != NULL; pc = pc->
succ) {
714 for(last_P->
succ = pp_v; last_P->
succ != NULL; last_P = last_P->
succ) {}
721 for(last_P->
succ = pp_v; last_P->
succ != NULL; last_P = last_P->
succ) {}
729 bool not_found =
true;
731 for(ll = params_in_D; !
ENDP(ll) && (not_found);
POP(ll)) {
742 for(last_P->
succ = pp_v; last_P->
succ != NULL; last_P = last_P->
succ) {}
796 list proto_lambda, prec,
pl;
807 proto_lambda =
CDR(proto_lambda);
812 return(proto_lambda);
840 for(l = var_l; (!
ENDP(l)) && (new_ps->nb_eq < dim);
POP(l)) {
879 for(; (!
ENDP(l2)) && (!found);
POP(l2)) {
905 Pbase v_base, c_base;
959 for(prec = NULL; pc1 != NULL; pc1 = pc1->
succ)
966 M1->nb_eq +=
M2->nb_eq;
987 for(ppp = *pp; ppp != NULL; ppp = ppp->
succ) {
1036 fprintf(stderr,
"[nullify_factors] polynome is :");
1044 for(l = var_l; l !=
NIL; l =
CDR(l)) {
1052 fprintf(stderr,
"[nullify_factors] factor is :");
1071 fprintf(stderr,
"[nullify_factors] final new sys :");
1229 fprintf(stderr,
"\t\t\tAvant Sub: \n");
1257 int p =
pgcd(coeff, val);
1272 int p =
pgcd(coeff, val);
1284 ps->base = (
Pbase) NULL;
1288 fprintf(stderr,
"\t\t\tApres Sub: \n");
1308 else if(var ==
TCST)
1313 for(ppp = pp; ppp != NULL; ppp = ppp->
succ) {
1318 bool factor_found =
true;
1335 factor_found =
false;
basic make_basic(enum basic_utype tag, void *val)
storage make_storage(enum storage_utype tag, void *val)
value make_value(enum value_utype tag, void *val)
variable make_variable(basic a1, list a2, list a3)
type make_type(enum type_utype tag, void *val)
struct _newgen_struct_entity_ * entity
#define pgcd(a, b)
Pour la recherche de performance, selection d'une implementation particuliere des fonctions.
void const char const char const int
#define A(i, j)
comp_matrice.c
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
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,...
Pcontrainte contrainte_var_min_coeff(Pcontrainte, Variable, Value *, bool)
Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list ...
bool egalite_normalize(Pcontrainte)
bool egalite_normalize(Pcontrainte eg): reduction d'une equation diophantienne par le pgcd de ses coe...
#define vertex_successors(x)
#define SUCCESSOR(x)
SUCCESSOR.
#define graph_vertices(x)
#define ENDP(l)
Test if a list is empty.
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define CAR(pcons)
Get the value of the first element of a list.
#define CDR(pcons)
Get the list less its first element.
list gen_append(list l1, const list l2)
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
void fprint_entity_list(FILE *fp, list l)
void fprint_entity_list(FILE *fp,list l): prints a list of entities on file fp.
list base_to_list(Pbase base)
Most includes are centralized here.
static void term(Pproblem XX, int s, Value k, int x)
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Value * matrice
package matrice
int matrice_hermite_rank(matrice a, int n, int m __attribute__((unused)))
int matrice_hermite_rank(matrice a, int n, int m): rang d'une matrice en forme de hermite
void matrice_hermite(Value *MAT, int n, int m, Value *P, Value *H, Value *Q, Value *det_p, Value *det_q)
package matrice
#define pips_internal_error
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Pbase list_to_base(list l)
Pbase list_to_base(list l): returns the Pbase that contains the variables of list "l",...
#define MODULE_SEP_STRING
string concatenate(const char *,...)
Return the concatenation of the given strings.
void * gen_find_tabulated(const char *, int)
int bool
we cannot use an enum or stdbool because we need to be compatible with newgen, thus boolean need to h...
#define MAPPING_MODULE_NAME
dfg_arc_label arc_label
Name : utils.c Package : paf-util Author : Alexis Platonoff Date : july 1993.
Ppolynome vecteur_mult(Pvecteur v1, Pvecteur v2)
========================================================================
Psysteme find_implicit_equation(Psysteme ps)
========================================================================
dfg_vertex_label vertex_label
Ppolynome prototype_var_subst(Ppolynome pp, Variable var, Ppolynome ppsubst)
=================================================================
int vertex_int_stmt(vertex v)
===========================================================================
Pvecteur prototype_factorize(Ppolynome pp, Variable var)
========================================================================
void contraintes_with_sym_cst_to_matrices(Pcontrainte pc, Pbase index_base, Pbase const_base, matrice A, matrice B, int n, int m1, int m2)
Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie...
Pcontrainte polynome_to_contrainte(Ppolynome pp)
========================================================================
const char * pu_variable_name(Variable)
package mapping : Alexis Platonoff, april 1993
void pu_vect_fprint(FILE *, Pvecteur)
===========================================================================
bool pu_is_inferior_var(Variable, Variable)
void fprint_psysteme(FILE *, Psysteme)
===========================================================================
#define communication_shift(x)
#define dataflow_communication(x)
#define communication_undefined
#define communication_reduction(x)
#define communication_broadcast(x)
Ppolynome make_polynome(float coeff, Variable var, Value expo)
Ppolynome make_polynome(float coeff, Variable var, Value expo) PRIVATE allocates space for,...
void polynome_fprint(FILE *fd, Ppolynome pp, char *(*variable_name)(Variable), int *is_inferior_var)
void polynome_fprint(FILE* fd, Ppolynome pp, char* (*variable_name)(), bool (*is_inferior_var)()) Out...
Pbase polynome_used_var(Ppolynome pp, int *is_inferior_var)
Pbase polynome_used_var(Ppolynome pp, bool *is_inferior_var()) PRIVATE Returns, in a Pbase,...
float polynome_TCST(Ppolynome pp)
float polynome_TCST(Ppolynome pp) returns the constant term of polynomial pp.
#define POLYNOME_UNDEFINED
#define POLYNOME_UNDEFINED_P(pp)
#define POLYNOME_NUL_P(pp)
#define SUCC_DATAFLOWS(s)
Ppolynome apply_farkas(Ppolynome F, Psysteme D, list *L, int *count_lambdas)
void my_substitute_var_with_vec(Psysteme ps, entity var, int val, Pvecteur vec)
===========================================================================
Psysteme new_elim_var_with_eg(Psysteme ps, list *init_l, list *elim_l)
========================================================================
bool is_shift_p(dataflow df)
========================================================================
list rm_non_x_var(list l)
========================================================================
bool is_broadcast_p(dataflow df)
========================================================================
Psysteme plc_elim_var_with_eg(Psysteme ps, list *init_l, list *elim_l)
========================================================================
bool compare_dfs_weight(chunk *d1, chunk *d2)
========================================================================
list get_stmt_index_coeff(int stmt, hash_table StoL)
========================================================================
list unify_lists(list l1, list l2)
========================================================================
int count_implicit_equation(Psysteme ps)
========================================================================
entity find_or_create_coeff(string prefix, int n)
========================================================================
list prgm_parameter_l
lint
int communication_dim(dataflow df)
========================================================================
Pvecteur old_prototype_factorize(Ppolynome pp, Variable var)
========================================================================
bool is_index_coeff_p(entity e)
========================================================================
list insert_sort(list l, bool(*compare_obj)())
========================================================================
list get_graph_dataflows(graph g)
========================================================================
bool is_reduction_p(dataflow df)
========================================================================
Psysteme completer_base(Psysteme sys, list var_l, list par_l)
========================================================================
bool vecteurs_libres_p(Psysteme sys, Pbase v_base, Pbase c_base)
========================================================================
bool compare_nodes_dim(chunk *n1, chunk *n2)
========================================================================
bool(* argh)(Pvecteur *, Pvecteur *)
========================================================================
list diff_lists(list l1, list l2)
========================================================================
char vcid_prgm_mapping_utils[]
Psysteme append_eg(Psysteme M1, Psysteme M2)
========================================================================
entity make_coeff(string prefix, int n)
========================================================================
Psysteme nullify_factors(Ppolynome *pp, list var_l, bool with_remnants)
========================================================================
bool compare_coeff(chunk *c1, chunk *c2)
========================================================================
void di_polynome_var_subst_null(Ppolynome *pp, entity var)
========================================================================
list put_source_ind(list le)
========================================================================
bool compare_unks_frenq(chunk *e1, chunk *e2)
========================================================================
hash_table DtfToWgh
Mapping from a dataflow to its distance.
hash_table StmtToDim
Mapping from a statement to the dim of its bdt.
hash_table UnkToFrenq
Mapping from a stmt to its mu coeff.
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
static const char * prefix
#define MINUS_OPERATOR_NAME
#define NORMALIZE_EXPRESSION(e)
#define make_entity(n, t, s, i)
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...
bool same_entity_p(entity e1, entity e2)
predicates on entities
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
expression make_entity_expression(entity e, cons *inds)
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
#define EXPRESSION(x)
EXPRESSION.
#define normalized_tag(x)
#define predicate_undefined
#define expression_normalized(x)
#define normalized_linear(x)
#define predicate_system(x)
#define entity_domain
newgen_syntax_domain_defined
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_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
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 ...
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
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.
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
#define VARIABLE_UNDEFINED
#define base_dimension(b)
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
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_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...
Pvecteur vect_cl_ofl_ctrl(Pvecteur v, Value lambda, Pvecteur u, int ofl_ctrl)
Pvecteur vect_cl_ofl_ctrl(Pvecteur v, Value lambda, Pvecteur u, int ofl_ctrl): etape d'acculumulation...
void vect_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...