25 #include "pips_config.h"
38 #include "resources.h"
90 return (coef * val +
cons ) ;
94 Value val0,val1,val2,val;
130 statement s1=NULL,s2=NULL,s_in_loop_in_side=NULL,st=NULL;
132 bool first1=
true,first2=
true;
133 Value val1=0,val2=0,f1_val1,f1_val2,f2_val1,f2_val2,e=0;
134 loop copyloop,loop_in_side=NULL;
174 lis1par=
CDR(lis1par);
186 lis1par=
CDR(lis1par);
193 s_in_loop_in_side=
loop_body( loop_in_side );
205 f1_val1=
eval(pv1,val1,var1);
206 f1_val2=
eval(pv1,val2,var1);
207 f2_val1=
eval(pv2,val1,var1);
208 f2_val2=
eval(pv2,val2,var1);
209 if ( (f2_val1 >=f1_val1)&&(f2_val2 >=f1_val2)){
214 if ( (f2_val1 >=f1_val1)&&(f2_val2 <f1_val2)){
220 if ( (f2_val1 < f1_val1)&&(f2_val2 >= f1_val2)){
234 if ( (! first1 )&&(i !=0)) {
244 lis2par=
CDR(lis2par);
256 lis2par=
CDR(lis2par);
312 loop_body(loop_in_side)=s_in_loop_in_side;
364 loop_body(loop_in_side)=s_in_loop_in_side;
438 loop_body(loop_in_side)=s_in_loop_in_side;
474 Pbase base_oldindex = NULL;
475 Pbase base_newindex = NULL;
498 name_file =
user_request(
"nom du fichier pour la matrice T");
507 printf(
" tototototo \n");
528 for (pb=base_newindex; pb!=NULL; pb=pb->
succ) {
547 int isoler =-1,isoler2=-1;
551 list lisi,lisj,lisjcopy,lis,lisjcopy2,lisp;
555 Pvecteur pv1,pv2=NULL,pvif1=NULL,pvif2=NULL,pv_i_lower,pv_i_upper;
565 range range_i,range1,range2,range3;
592 printf(
" le nombre de sommet est %d \n", nbr_vertice);
594 for (e = vertice; e != NULL; e = e->
succ) {
599 for(i=0;i<=nbr_vertice-1;i++)
601 for(j=i+1;j<= nbr_vertice;j++)
602 if( sommetg[j]< sommetg[i] )
606 sommetg[i]= sommetg[j];
610 for(i=0;i<= nbr_vertice-1;i++)
612 if( sommetg[i]== sommetg[i+1] )
614 for (j=i;j<=nbr_vertice-1;j++)
615 sommetg[j]=sommetg[j+1];
687 for(i=0;i<=2*nbr_vertice-2;i++){
695 bool condition1=
false,condition2=
false;
702 Value minjp=-100,maxjp=100;
710 Value constante,val1,val2;
716 if (
eval2(constante,val1,val2, sommetg[indice])>minjp ){
717 minjp=
eval2(constante,val1,val2, sommetg[indice]);
721 if (
eval2(constante,val1,val2, sommetg[indice])==minjp ){
723 Value constantep,val1p,val2p;
744 if (
eval2(constante,val1,val2, sommetg[indice])<maxjp ){
745 maxjp=
eval2(constante,val1,val2, sommetg[indice]);
749 if (
eval2(constante,val1,val2, sommetg[indice])==maxjp ){
751 Value constantep,val1p,val2p;
772 for (e = vertice; e != NULL; e = e->
succ) {
776 if (sommetg[indice]==
vect_coeff(indice1,pv1)){
800 Value minjp1=-100,minjp2=-100,maxjp1=100,maxjp2=100;
808 Value constante,val1,val2;
814 if ( (
eval2(constante,val1,val2, sommetg[indice])>=minjp1 )
815 &&(
eval2(constante,val1,val2, sommetg[indice+1]) >=minjp2)){
816 if ( (
eval2(constante,val1,val2, sommetg[indice])==minjp1 )
817 &&(
eval2(constante,val1,val2, sommetg[indice+1]) ==minjp2))
820 Value constantep,val1p,val2p;
833 (val1p,sommetg[indice+1])+ constantep ,-val2)))
835 minjp1=
eval2(constante,val1,val2, sommetg[indice]);
836 minjp2=
eval2(constante,val1,val2, sommetg[indice+1]);
841 minjp1=
eval2(constante,val1,val2, sommetg[indice]);
842 minjp2=
eval2(constante,val1,val2, sommetg[indice+1]);
848 if ( (
eval2(constante,val1,val2, sommetg[indice])<=maxjp1 )&&
849 (
eval2(constante,val1,val2, sommetg[indice+1]) <=maxjp2)){
850 if ( (
eval2(constante,val1,val2, sommetg[indice])==maxjp1 )
851 &&(
eval2(constante,val1,val2, sommetg[indice+1]) ==maxjp2))
854 Value constantep,val1p,val2p;
868 maxjp1=
eval2(constante,val1,val2, sommetg[indice]);
869 maxjp2=
eval2(constante,val1,val2, sommetg[indice+1]);
874 maxjp1=
eval2(constante,val1,val2, sommetg[indice]);
875 maxjp2=
eval2(constante,val1,val2, sommetg[indice+1]);
947 if (i==2*nbr_vertice-2){
954 isoler=2*nbr_vertice-2;
962 isoler=2*nbr_vertice-2;
967 if ((condition1==
false) && (condition2==
false)){
1140 if (condition1||condition2) isoler =i;
1149 i++;
if((i!=isoler)&&(i%2==0)&&(i!=isoler2)) {
1156 if(i==2*nbr_vertice-2){
1167 loop2 =
s1; },lisi) ;
1175 loop2 =
s1; },lisi) ;
1183 loop2 =
s1; },lisi) ;
1218 debug_on(
"GUARD_ELIMINATION_DEBUG_LEVEL");
1236 "(give its ordering): ");
1246 str =
user_request(
"for Which nid do you want apply unimodular "
1247 "transformation ?\n" "(give its ordering): ");
1254 ;lis=
CDR(lis) ;},lis)
instruction make_instruction_loop(loop _field_)
call make_call(entity a1, list a2)
loop copy_loop(loop p)
LOOP.
expression make_expression(syntax a1, normalized a2)
expression copy_expression(expression p)
EXPRESSION.
statement copy_statement(statement p)
STATEMENT.
test make_test(expression a1, statement a2, statement a3)
instruction make_instruction_sequence(sequence _field_)
syntax make_syntax(enum syntax_utype tag, void *val)
sequence make_sequence(list a)
struct _newgen_struct_expression_ * expression
#define value_direct_multiply(v1, v2)
#define value_plus(v1, v2)
binary operators on values
#define value_mod(v1, v2)
#define value_div(v1, v2)
void change_of_base_index(Pbase base_oldindex, Pbase *base_newindex)
void change_of_base_index(Pbase base_oldindex, Pbase *base_newindex) change of variable index from ba...
Psysteme sc_change_baseindex(Psysteme sc, Pbase base_old, Pbase base_new)
Psysteme sc_change_baseindex(Psysteme sc, Pbase base_old, Pbase base_new) le changement de base d'ind...
Ptsg sc_to_sg_chernikova(Psysteme sc)
chernikova_mulprec.c
struct _newgen_struct_statement_ * statement
expression expression_to_expression_newbase(expression e_old, pvg, Pbase base_oldindex)
expression expression_to_expression_newbase(expression e_old,Pvecteur pvg[], Pbase base_oldindex) com...
Pvecteur vect_change_base(Pvecteur pv_old, Pbase base_oldindex, pvg)
Pvecteur vect_change_base(Pvecteur pv_old, Pvecteur pvg[], Pbase base_oldindex, Pbase base_newindex) ...
void scanning_base_to_vect(matrice G, int n, Pbase base, pvg)
void scanning_base_to_vect(matrice G,int n,Pbase base,Pvecteur pvg[n]) compute G*base and put the res...
statement code_generation(list lls, Pvecteur pvg[], Pbase base_oldindex, Pbase base_newindex, Psysteme sc_newbase, bool preserve_entry_label_p)
package hyperplane
#define A(i, j)
comp_matrice.c
void sc_syst_debug(Psysteme s)
constraint_to_text.c
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
bool egalite_equal(Pcontrainte, Pcontrainte)
bool egalite_equal(Pcontrainte eg1, Pcontrainte eg2): teste l'equivalence de deux egalites; leurs coe...
Psysteme loop_iteration_domaine_to_sc(list, Pbase *)
loop_iteration_domaine_to_sc.c
FILE * safe_fopen(const char *filename, const char *what)
int safe_fclose(FILE *stream, const char *filename)
statement make_block_statement(list)
Make a block statement from a list of statement.
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
void reset_current_module_entity(void)
Reset the current module entity.
void reset_current_module_statement(void)
Reset the current module statement.
statement set_current_module_statement(statement)
Set the current module statement.
entity set_current_module_entity(entity)
static.c
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
list gen_nreverse(list cp)
reverse a list in place
#define NIL
The empty list (nil in Lisp)
list gen_concatenate(const list l1x, const list l2x)
concatenate two lists.
struct cons cons
The structure used to build lists in NewGen.
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)
#define CAR(pcons)
Get the value of the first element of a list.
list gen_last(list l)
Return the last element of a list.
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define CDR(pcons)
Get the list less its first element.
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
list gen_full_copy_list(list l)
Copy a list structure with element copy.
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
static bool stmt_flt(statement s, context_p context)
bool guard_elimination(string module)
static Value intersection(Pvecteur pv1, Pvecteur pv2, Variable var, floor)
statement free_guards(statement s)
Psysteme sc_newbase
include <sys/ddi.h>
struct context_p context_t
static void stmt_rwt(statement s, context_p context)
static Value myfloor(Value k, Value m)
static bool loop_flt(loop l, context_p context)
static Value myceil(Value k, Value m)
static Value eval(Pvecteur pv, Value val, Variable var)
static Value eval2(Value val0, Value val1, Value val2, Value val)
bool vect_equal(Pvecteur v1, Pvecteur v2)
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
bool vect_oppos(Pvecteur v1, Pvecteur v2)
bool vect_oppos(Pvecteur v1, Pvecteur v2): test de l'opposition de deux vecteurs
loop loop1
tiling_sequence.c
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Value * matrice
package matrice
void matrice_general_inversion(matrice a, matrice inv_a, int n)
void matrice_general_inversion(matrice a; matrice inv_a; int n) calcul de l'inversion du matrice gene...
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r)
void matrice_multiply(matrice a, matrice b, matrice c, int p, int q, int r): multiply rational matrix...
void matrice_fscan(FILE *, matrice *, int *, int *)
void matrice_fscan(FILE * f, matrice * a, int * n, int * m): read an (nxm) rational matrix in an ASCI...
struct _newgen_struct_range_ * range
#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
string user_request(const char *,...)
void * stack_head(const stack)
returns the item on top of stack s
void stack_push(void *, stack)
stack use
stack stack_make(int, int, int)
allocation
void * stack_pop(stack)
POPs one item from stack s.
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
void normalize_all_expressions_of(void *obj)
static void norm(struct rproblem *RR)
cette procedure normalise la fonction cout, calcule les valeurs des seconds membres resultant d'une n...
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
#define loop_to_statement(l)
#define test_to_statement(t)
#define eq_expression(e1, e2)
#define MODULO_OPERATOR_NAME
void make_bound_expression(Variable index, Pbase base, Psysteme sc, expression *lower, expression *upper)
void make_bound_expression(variable index, Pbase base, Psysteme sc, expression *lower,...
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression make_contrainte_expression(Pcontrainte pc, Variable index)
A wrapper around make_constraint_expression() for compatibility.
bool range_equal_p(range r1, range r2)
#define normalized_undefined
#define instruction_sequence_p(x)
#define normalized_linear_p(x)
#define instruction_loop_p(x)
#define loop_domain
newgen_language_domain_defined
#define instruction_loop(x)
#define statement_ordering(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define EXPRESSION(x)
EXPRESSION.
struct _newgen_struct_call_ * call
#define expression_normalized(x)
struct _newgen_struct_syntax_ * syntax
#define sequence_statements(x)
#define instruction_sequence(x)
#define instruction_call_p(x)
#define test_condition(x)
#define statement_instruction(x)
#define instruction_call(x)
#define call_arguments(x)
#define instruction_test(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define STATEMENT(x)
STATEMENT.
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
void sc_dump(Psysteme sc)
void sc_dump(Psysteme sc): dump to stderr
Psysteme new_loop_bound(Psysteme scn, Pbase base_index)
Psysteme new_loop_bound(Psysteme scn, Pbase base_index) computation of the new iteration space (given...
#define G(j, a, b)
maybe most of them should be functions?
#define sg_sommets(sg)
vieilles definitions des fonctions d'impression void sg_fprint(); #define print_sg(sg) sg_fprint(stdo...
#define sg_nbre_sommets(sg)
nombre de sommets: int sg_nbre_sommets(Ptsg)
void sys_matrice_index(Psysteme, Pbase, matrice, int, int)
Warning! Do not modify this file that is automatically generated!
void matrice_index_sys(Psysteme, Pbase, matrice, int, int)
void matrice_index_sys(Psysteme sc, Pbase base_index, matrice AG, int n, int m) replace the coefficie...
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.
cette structure contient une pile.
structure de donnees Sommet
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
A gen_chunk is used to store every object.
#define exp
Avoid some warnings from "gcc -Wshadow".
#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 base_dimension(b)
struct Svecteur Svecteur
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
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_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
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....
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...
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...