25 #include "pips_config.h"
98 for(c=constraint; c; c=c->
succ)
141 if (size>2 || size<1)
return false;
144 if (var==
TCST && size<=1)
return false;
179 if (bound_uppers_p(var))
181 int old = load_uppers(var);
182 if (old>val) update_uppers(var, val);
185 store_uppers(var, val);
195 if (bound_lowers_p(var))
197 int old = load_lowers(var);
198 if (old<val) update_lowers(var, val);
201 store_lowers(var, val);
220 for (c=sc_egalites(s); c; c=c->
succ)
232 for (c=sc_inegalites(s); c; c=c->
succ)
269 if (lowers_undefined_p() || uppers_undefined_p())
272 if (!bound_lowers_p((
entity) var) || !bound_uppers_p((
entity) var))
286 Value bound = 0, val;
289 if (lowers_undefined_p() || uppers_undefined_p())
305 if (!bound_lowers_p((
entity) var))
308 il = load_lowers((
entity) var);
312 if (!bound_uppers_p((
entity) var))
315 il = load_uppers((
entity) var);
380 int len = 0, sign = is_lower? -1: +1;
385 pips_debug(5,
"computing %ser bound for variable %s\n",
390 fprintf(stderr,
"[constraints_to_loop_bound] constraints are:\n");
405 for(c=sc_inegalites(s); c; c=c->
succ)
430 for (v=vdiv; v; v=v->
succ)
439 for (v=vadd; v; v=v->succ)
508 pips_assert(
"More than one constant expression in loop bounds", nb_constant == 1);
540 Value val_lower, val_upper, the_ppcm;
590 if (
ENDP(vars))
return body;
594 c = sc_inegalites(s);
655 sc_inegalites(s)=c,
sc_rm(s);
execution make_execution(enum execution_utype tag, void *val)
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
instruction make_instruction(enum instruction_utype tag, void *val)
range make_range(expression a1, expression a2, expression a3)
#define value_sign(v)
trian operators on values
#define int_to_value(i)
end LINEAR_VALUE_IS_INT
#define value_minus(v1, v2)
#define VALUE_TO_INT(val)
#define value_oppose(ref)
#define value_pdiv(v1, v2)
#define value_uminus(val)
unary operators on values
#define value_zero_p(val)
#define value_addto(ref, val)
#define value_eq(v1, v2)
bool operators on values
#define value_plus(v1, v2)
binary operators on values
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
#define value_mod(v1, v2)
#define value_pdivision(ref, val)
#define value_div(v1, v2)
#define value_posz_p(val)
Value ppcm(Value, Value)
ppcm.c
int compare_Pvecteur(Pvecteur *pv1, Pvecteur *pv2)
comparison function for Pvecteur in pips, to be used by qsort.
#define CONTRAINTE_UNDEFINED_P(c)
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
Pcontrainte contraintes_free(Pcontrainte pc)
Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc.
Pcontrainte contraintes_dup(Pcontrainte c_in)
Pcontrainte contraintes_dup(Pcontrainte c_in) a list of constraints is copied.
int nb_elems_list(Pcontrainte)
int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes
void constraints_for_bounds(Variable, Pcontrainte *, Pcontrainte *, Pcontrainte *)
void constraints_for_bounds(var, pinit, plower, pupper) Variable var; Pcontrainte *pinit,...
void inegalites_fprint(FILE *, Pcontrainte, char *(*)(Variable))
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
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.
entity get_current_module_entity(void)
Get the entity of the current module.
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
#define NIL
The empty list (nil in Lisp)
list gen_copy_seq(list l)
Copy a list structure.
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.
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
statement make_assign_statement(expression, expression)
statement st_make_nice_test(expression, list, list)
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
int vect_size(Pvecteur v)
package vecteur - reductions
#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 message_assert(msg, ex)
#define MAX_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define EQUAL_OPERATOR_NAME
#define PIPS_C_MAX_OPERATOR_NAME
#define DIVIDE_OPERATOR_NAME
#define PIPS_C_MIN_OPERATOR_NAME
PIPS run-time support for C code generation.
#define LESS_OR_EQUAL_OPERATOR_NAME
#define make_empty_statement
An alias for make_empty_block_statement.
#define MIN_OPERATOR_NAME
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...
entity entity_empty_label(void)
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
expression make_call_expression(entity e, list l)
Build an expression that call an function entity with an argument list.
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
expression expression_list_to_conjonction(list l)
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
expression Value_to_expression(Value v)
added interface for linear stuff.
bool c_language_module_p(entity m)
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define expression_undefined
@ is_execution_sequential
#define STATEMENT(x)
STATEMENT.
Psysteme sc_make(Pcontrainte leg, Pcontrainte lineg)
Psysteme sc_make(Pcontrainte leg, Pcontrainte lineg): allocation et initialisation d'un systeme d'equ...
bool sc_rn_p(Psysteme sc)
bool sc_rn_p(Psysteme sc): check if the set associated to sc is the whole space, rn
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Psysteme sc_sort_constraints(Psysteme ps, Pbase base_index)
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
t_real sum(int n1, int n2, int n3, t_real u[n1][n2][n3])
GENERIC_LOCAL_FUNCTION(directives, step_directives)
Copyright 2007, 2008, 2009 Alain Muller, Frederique Silber-Chaussumier.
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.
static bool range_of_variable(Variable var, Value *lb, Value *ub)
this functions returns bounds for variable var if both are available.
static Value vecteur_lower_bound(Pvecteur v)
returns v lower bound if found, or INT_MIN.
static bool evaluate_divide_if_possible(Pvecteur v, Value denominator, Value *result)
statement systeme_to_loop_nest(Psysteme sc, list vars, statement body, entity divide)
sc is used to generate the loop nest bounds for variables vars.
void set_information_for_code_optimizations(Psysteme s)
I could keep the system for further optimizations...
statement generate_optional_if(Psysteme sc, statement stat)
statement generate_optional_if(sc, stat)
expression constraints_to_loop_bound(Pcontrainte c, Variable var, bool is_lower, entity divide)
expression constraints_to_loop_bound(c, var, is_lower)
static bool vect_simple_definition_p(Pvecteur v, Variable *pvar, Value *pcoe, Value *pcst)
here I store simple bounds on variables appearing in the systems to allow the code generation phase t...
bool bounds_equal_p(Variable var, Pcontrainte lower, Pcontrainte upper)
this function checks whether the lower and upper constraints are going to generate the same bound on ...
static void store_a_lower(entity var, int val)
static void store_an_upper(entity var, int val)
list Pcontrainte_to_expression_list(Pcontrainte constraint, entity operator)
expression Psysteme_to_expression(Psysteme systeme)
Standard includes.
void reset_information_for_code_optimizations()
#define exp
Avoid some warnings from "gcc -Wshadow".
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
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....
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
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
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...
Pvecteur vect_del_var(Pvecteur v_in, Variable var)
Pvecteur vect_del_var(Pvecteur v_in, Variable var): allocation d'un nouveau vecteur egal a la project...
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
void Pvecteur_separate_on_sign(Pvecteur v, Pvecteur *pvpos, Pvecteur *pvneg)
void Pvecteur_separate_on_sign(v, pvpos, pvneg) Pvecteur v, *pvpos, *pvneg;
Pvecteur vect_sort(Pvecteur v, int *compare)
Pvecteur vect_sort(v, compare) Pvecteur v; int (*compare)();.
void vect_normalize(Pvecteur v)
void vect_normalize(Pvecteur v): division de tous les coefficients de v par leur pgcd; "normalisation...