PIPS
|
Go to the source code of this file.
Macros | |
#define | PIP_SOLVE_MIN 0 |
Warning! Do not modify this file that is automatically generated! More... | |
#define | PIP_SOLVE_MAX 1 |
#define | IS_MIN 0 |
#define | IS_MAX 1 |
#define | PAF_UTIL_MODULE_NAME "PAFUTIL" |
#define | DFG_MODULE_NAME "DFG" |
#define | MAPPING_MODULE_NAME "MAPPING" |
#define | DIFF_PREFIX "DIFF" |
#define | COEFF_PREFIX "COEFF" |
#define | POSITIVE 1 |
#define | NEGATIVE 0 |
#define | ADD_ELEMENT_TO_LIST(_list, _type, _element) (_list = gen_nconc( _list, CONS( _type, _element, NIL))) |
#define | BASE_NODE_NUMBER 1000 |
Functions | |
graph | adg_read_paf (char *) |
Current loop instruction. More... | |
void | init_new_dfg (void) |
=========================================================================== More... | |
void | new_param (string) |
=========================================================================== More... | |
void | init_new_df_sink_ins (void) |
=========================================================================== More... | |
void | init_new_df_source (char *) |
=========================================================================== More... | |
void | new_df_trans_exp (void) |
=========================================================================== More... | |
void | finish_new_df_source (void) |
=========================================================================== More... | |
void | init_new_df_gov_pred (void) |
=========================================================================== More... | |
void | save_pred (int) |
=========================================================================== More... | |
void | elim_last_pred (void) |
=========================================================================== More... | |
void | new_df_gov_pred (void) |
=========================================================================== More... | |
void | init_new_df_ref (char *) |
=========================================================================== More... | |
void | save_int (int) |
=========================================================================== More... | |
void | save_id (string) |
=========================================================================== More... | |
void | init_op_name (string) |
=========================================================================== More... | |
void | init_op_exp (string) |
=========================================================================== More... | |
void | save_exp (void) |
=========================================================================== More... | |
void | new_df_ref_ind (string) |
void | finish_new_df_ref (void) |
=========================================================================== More... | |
void | new_df_sink_ins (char *) |
=========================================================================== More... | |
void | init_new_do_loop (char *) |
=========================================================================== More... | |
void | init_loop_ctrl (char *) |
=========================================================================== More... | |
void | lbound_exp (void) |
=========================================================================== More... | |
void | step_exp (void) |
=========================================================================== More... | |
void | ubound_exp (void) |
=========================================================================== More... | |
void | finish_new_do_loop (void) |
=========================================================================== More... | |
void | init_new_gd_ins (char *) |
=========================================================================== More... | |
void | new_eng_loop (char *) |
=========================================================================== More... | |
void | finish_new_gd_ins (void) |
=========================================================================== More... | |
bdt | bdt_read_paf (char *) |
=========================================================================== More... | |
bool | same_predicate_p (predicate, predicate) |
=========================================================================== More... | |
void | reorganize_bdt (bdt) |
=========================================================================== More... | |
void | bdt_init_new_base (void) |
=========================================================================== More... | |
void | bdt_init_new_ins (char *) |
=========================================================================== More... | |
void | bdt_new_shedule (string) |
void | bdt_save_pred (int) |
=========================================================================== More... | |
void | bdt_elim_last_pred (void) |
=========================================================================== More... | |
void | bdt_save_int (int) |
=========================================================================== More... | |
void | bdt_save_id (string) |
=========================================================================== More... | |
void | bdt_init_op_exp (string) |
=========================================================================== More... | |
void | bdt_save_exp (void) |
=========================================================================== More... | |
void | pu_matrices_to_contraintes (Pcontrainte *, Pbase, matrice, matrice, int, int) |
utils.c More... | |
void | pu_contraintes_to_matrices (Pcontrainte, Pbase, matrice, matrice, int, int) |
=========================================================================== More... | |
void | contraintes_with_sym_cst_to_matrices (Pcontrainte, Pbase, Pbase, matrice, matrice, int, int, int) |
Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie constante B Le systeme peut contenir des constantes symboliques. More... | |
void | matrices_to_contraintes_with_sym_cst (Pcontrainte *, Pbase, Pbase, matrice, matrice, int, int, int) |
vertex | in_dfg_vertex_list (list, vertex) |
=========================================================================== More... | |
vertex | in_dg_vertex_list (list, vertex) |
====================================================================== More... | |
expression | make_id_expression (string) |
=========================================================================== More... | |
expression | make_array_ref (list) |
=========================================================================== More... | |
expression | make_func_op (string, list) |
=========================================================================== More... | |
expression | lisp_exp_to_ri_exp (lisp_expression) |
=========================================================================== More... | |
expression | negate_expression (expression) |
=========================================================================== More... | |
predicate | expressions_to_predicate (list) |
=========================================================================== More... | |
int | vertex_int_stmt (vertex) |
=========================================================================== More... | |
void | comp_exec_domain (graph, hash_table) |
=========================================================================== More... | |
Psysteme | make_expression_equalities (list) |
=========================================================================== More... | |
Pbase | make_base_of_nest (int) |
=========================================================================== More... | |
successor | first_succ_of_vertex (vertex) |
=========================================================================== More... | |
dataflow | first_df_of_succ (successor) |
=========================================================================== More... | |
loop | loop_dup (loop) |
=========================================================================== More... | |
list | static_control_to_indices (static_control) |
package mapping : Alexis Platonoff, july 1993 More... | |
Pvecteur | polynome_to_vecteur (Ppolynome) |
======================================================================== More... | |
Pcontrainte | polynome_to_contrainte (Ppolynome) |
======================================================================== More... | |
Psysteme | old_polynome_to_sc (Ppolynome, list) |
=========================================================================== More... | |
Psysteme | polynome_to_sc (Ppolynome, list) |
=========================================================================== More... | |
void | substitute_var_with_vec (Psysteme, entity, Value, Pvecteur) |
=========================================================================== More... | |
bool | is_entity_in_list_p (entity, list) |
=========================================================================== More... | |
Psysteme | elim_var_with_eg (Psysteme, list *, list *) |
=========================================================================== More... | |
Psysteme | better_elim_var_with_eg (Psysteme, list *, list *) |
=========================================================================== More... | |
bool | single_var_vecteur_p (Pvecteur) |
=========================================================================== More... | |
list | vecteur_to_list (Pvecteur) |
=========================================================================== More... | |
Ppolynome | old_vecteur_to_polynome (Pvecteur) |
=========================================================================== More... | |
list | meld (list, list, bool(*)(void)) |
list | new_general_merge_sort (list, bool(*)(void)) |
list | general_merge_sort (list, bool(*)(void)) |
expression | rational_op_exp (string, expression, expression) |
======================================================================== More... | |
Pvecteur | vect_var_subst (Pvecteur, Variable, Pvecteur) |
================================================================= More... | |
Ppolynome | prototype_var_subst (Ppolynome, Variable, Ppolynome) |
================================================================= More... | |
Ppolynome | vecteur_mult (Pvecteur, Pvecteur) |
======================================================================== More... | |
Pvecteur | prototype_factorize (Ppolynome, Variable) |
======================================================================== More... | |
Pcontrainte | simplify_minmax_contrainte (Pcontrainte, Psysteme, int) |
================================================================== More... | |
list | vectors_to_expressions (Pcontrainte) |
================================================================= More... | |
Pcontrainte | expressions_to_vectors (list) |
================================================================= More... | |
list | simplify_minmax (list, Psysteme, int) |
================================================================= More... | |
Psysteme | find_implicit_equation (Psysteme) |
======================================================================== More... | |
void | set_current_stco_map (statement_mapping) |
======================================================================== More... | |
statement_mapping | get_current_stco_map (void) |
======================================================================== More... | |
void | reset_current_stco_map (void) |
======================================================================== More... | |
static_control | get_stco_from_current_map (statement) |
======================================================================== More... | |
expression | make_rational_exp (Pvecteur, Value) |
===================================================================== More... | |
int | stco_common_loops_of_statements (statement_mapping, statement, statement) |
AP, sep 25th 1995 : I have added a function from static_controlise/utils.c. More... | |
void | pu_inegalite_fprint (FILE *, Pcontrainte, const char *(*)(entity)) |
print.c More... | |
void | pu_egalite_fprint (FILE *, Pcontrainte, const char *(*)(entity)) |
void | vecteur_fprint (FILE *, Pcontrainte, const char *(*)(entity)) |
void | fprint_dataflow (FILE *, int, dataflow) |
=========================================================================== More... | |
void | fprint_pred (FILE *, predicate) |
=========================================================================== More... | |
void | fprint_psysteme (FILE *, Psysteme) |
=========================================================================== More... | |
void | fprint_sc_pvecteur (FILE *, Psysteme) |
=========================================================================== More... | |
void | fprint_bdt (FILE *, bdt) |
=========================================================================== More... | |
const char * | pu_variable_name (Variable) |
package mapping : Alexis Platonoff, april 1993 More... | |
bool | pu_is_inferior_var (Variable, Variable) |
void | pu_vect_fprint (FILE *, Pvecteur) |
=========================================================================== More... | |
void | fprint_indent (FILE *, int) |
=========================================================================== More... | |
void | imprime_quast (FILE *, quast) |
=========================================================================== More... | |
Variables | |
graph | dfg |
cproto-generated files More... | |
list | stmt_list |
The "stmt_list" global variable is the list the assign statement of the program (with all fields empty but two: ordering (the number of the statement) and comments (the string name of the statement)). More... | |
list | loop_list |
The "loop_list" global variable is the list the loops of the program (with all their characteristics: index, bounds, step). More... | |
bdt | base |
bdt_read_paf.c More... | |
#define ADD_ELEMENT_TO_LIST | ( | _list, | |
_type, | |||
_element | |||
) | (_list = gen_nconc( _list, CONS( _type, _element, NIL))) |
Definition at line 50 of file paf-util.h.
#define BASE_NODE_NUMBER 1000 |
Definition at line 53 of file paf-util.h.
#define COEFF_PREFIX "COEFF" |
Definition at line 45 of file paf-util.h.
#define DFG_MODULE_NAME "DFG" |
Definition at line 42 of file paf-util.h.
#define DIFF_PREFIX "DIFF" |
Definition at line 44 of file paf-util.h.
#define IS_MAX 1 |
Definition at line 39 of file paf-util.h.
#define IS_MIN 0 |
Definition at line 38 of file paf-util.h.
#define MAPPING_MODULE_NAME "MAPPING" |
Definition at line 43 of file paf-util.h.
#define NEGATIVE 0 |
Definition at line 48 of file paf-util.h.
#define PAF_UTIL_MODULE_NAME "PAFUTIL" |
Definition at line 41 of file paf-util.h.
#define PIP_SOLVE_MAX 1 |
Definition at line 36 of file paf-util.h.
#define PIP_SOLVE_MIN 0 |
Warning! Do not modify this file that is automatically generated!
Modify src/Libs/paf-util/paf-util-local.h instead, to add your own modifications. header file built by cproto paf_util-local.h
Definition at line 35 of file paf-util.h.
#define POSITIVE 1 |
Definition at line 47 of file paf-util.h.
graph adg_read_paf | ( | char * | s | ) |
Current loop instruction.
Local typedef =========================================================================== void adg_read_paf(char * s) :
computes the DFG of the PAF program name given in argument and returns it.
The global variables "loop_list" and "stmt_list" are initialized to NIL.
The DFG is put in the variable "dfg", which is the value returned.
Note : This function creates a statement_mapping (i.e. a hash_table) which is initialized in this function. This is done by set_current_stco_map(), see paf-util/utils.c. To use this hash_table, you do not have to know its name, only call get_current_stco_map() which returns it.
Definition at line 198 of file adg_read_paf.c.
References concatenate(), dfg, DOT, exit, fprintf(), hash_int, hash_table_make(), loop_list, NIL, PAF_STRING, pips_internal_error, set_current_stco_map(), stmt_list, STMT_TO_STCT_SIZE, strdup(), and STS.
void bdt_elim_last_pred | ( | void | ) |
===========================================================================
void bdt_elim_last_pred(): When POSITIVE and NEGATIVE cases of one predicate have been completed, we eliminate the corresponding expression which is the first one of the list "pred_l".
Definition at line 312 of file bdt_read_paf.c.
void bdt_init_new_base | ( | void | ) |
===========================================================================
void bdt_init_new_base() : initializes the computation of the BDT, i.e. the creation of the BDT in the "base" variable.
Definition at line 207 of file bdt_read_paf.c.
References base, make_bdt(), and NIL.
void bdt_init_new_ins | ( | char * | s_ins | ) |
===========================================================================
void bdt_init_new_ins(char *s_ins): initializes the computation of the current statement for which we are now parsing its BDT. This statement is represented by its ordering contained in its name "s_ins". Also, we initialize "lin_exp_l" used for the parsing of the lisp expressions and "pred_l" used for the parsing of the predicates.
In PAF, a statement name is a string "ins_#", where "#" is the number associated with the statement. We get this number.
s_ins | _ins |
Definition at line 221 of file bdt_read_paf.c.
References crt_ins, INS_NAME_LENGTH, lin_exp_l, NIL, pred_l, and strdup().
void bdt_init_op_exp | ( | string | op_name | ) |
===========================================================================
void bdt_init_op_exp(string op_name): initializes a new lisp expression with the operation "op_name". This expression is put at the beginning of "lin_exp_l", it is the expression the parser is currently reading.
If "op_name" is the string "0" then the operator used is "crt_op_name", else the operator name is contained in "op_name".
op_name | p_name |
Definition at line 379 of file bdt_read_paf.c.
References CONS, lin_exp_l, LISP_EXPRESSION, make_lisp_expression(), and NIL.
void bdt_new_shedule | ( | string | ) |
bdt bdt_read_paf | ( | char * | s | ) |
===========================================================================
bdt bdt_read_paf(char *s) : computes the BDT of the PAF program name given in argument and returns it.
bdtyyparse() do the parsing over the ".bdt" file and put the timing function into the global variable "base" which is returned.
Definition at line 110 of file bdt_read_paf.c.
References base, BDT_STRING, concatenate(), DOT, exit, fprintf(), pips_internal_error, reorganize_bdt(), and strdup().
void bdt_save_exp | ( | void | ) |
===========================================================================
void bdt_save_exp(): the parser has completed the reading of one lisp expression, this is the first lisp expression of "lin_exp_l". We extract it from this list and translate it into a Pips expression. If there is no other lisp expression in "lin_exp_l", then this expression becomes the current expression, else it becomes an argument of the next lisp expression which is now the first object of "lin_exp_l".
Definition at line 395 of file bdt_read_paf.c.
References CAR, CDR, CONS, crt_exp, EXPRESSION, gen_nconc(), lin_exp_l, lisp_exp_to_ri_exp(), LISP_EXPRESSION, lisp_expression_args, and NIL.
void bdt_save_id | ( | string | s | ) |
===========================================================================
void bdt_save_id(string s): The parser has found a variable as a part of a lisp expression. We save it in our global variable "lin_exp_l".
If "lin_exp_l" is empty, then this variable becomes the current expression. If not, it becomes an argument of the first lisp expression of "lin_exp_l".
Definition at line 352 of file bdt_read_paf.c.
References CAR, CONS, crt_exp, EXPRESSION, gen_nconc(), lin_exp_l, LISP_EXPRESSION, lisp_expression_args, make_id_expression(), and NIL.
void bdt_save_int | ( | int | i | ) |
===========================================================================
void bdt_save_int(int i): The parser has found an integer as a part of a lisp expression. We save it in our global variable "lin_exp_l".
If "lin_exp_l" is empty, then this integer becomes the current expression. If not, it becomes an argument of the first lisp expression of "lin_exp_l".
Definition at line 326 of file bdt_read_paf.c.
References CAR, CONS, crt_exp, EXPRESSION, gen_nconc(), int_to_expression(), lin_exp_l, LISP_EXPRESSION, lisp_expression_args, and NIL.
void bdt_save_pred | ( | int | option | ) |
===========================================================================
void bdt_save_pred(int option): computes one expression of the predicate. Each expression is used twice ; indeed, an expression may be greater or equal than zero (>=) and smaller than zero (<). "option" says in which case we are: POSITIVE indicates that the predicate is >=, with NEGATIVE it is <. However, the C3 library always represents its inequalities with <=. So, the inequality "A >= 0" becomes "-A <= 0" and "A < 0" becomes "A + 1 <= 0".
This function updates the global list "pred_l" that contains the current list of predicates. When a new predicate expression is parsed, the POSITIVE is always considered first (that is why only in that case we use "crt_exp"). When the NEGATICE case is considered, the corresponding expression (used in the POSITIVE case) is the first expression of the list "pred_l". So, we only have to replace this expression by it equivalent for the NEGATIVE case (that is why the expression is multiplied by -1).
option == NEGATIVE
Initialization of global variables
option | ption |
Definition at line 277 of file bdt_read_paf.c.
References CAR, CDR, CONS, crt_exp, EXPRESSION, expression_undefined, int_to_expression(), lin_exp_l, make_op_exp(), negate_expression(), NIL, pips_internal_error, PLUS_OPERATOR_NAME, POSITIVE, and pred_l.
===========================================================================
Psysteme better_elim_var_with_eg(Psysteme ps, list *init_l, list *elim_l): Computes the elimination of variables in the system "ps" using its equalities. All the used equalities are removed directly from "ps".
However, we keep all these "used" equalities in "sc_elim". The return value of this function is this system.
Initially, "init_l" gives the list of variables that can be eliminated and "elim_l" is empty. At the end, "init_l" contains the variables that are not eliminated and "elim_l" contains the variables that are eliminated. We keep the order of "init_l" in our process of elimination.
At the end, to each equality of "sc_elim" will be associated a variable of "elim_l". These lists are built so as to be able to match them directly. Each variable of "elim_l" appears in one constraint of "sc_elim" and only one. There will be as many equalities in "sc_elim" as variables in "elim_l"
A variable can be eliminated using a given equality if it appears in this equality, i.e. its associated coefficient is not equal to zero. Moreover, for a given variable, we look for the equation in which it has the smallest coefficient.
BEGIN vl = a copy of init_l; el = NIL; sc_elim = system with no constraints; loop over the list of variables to eliminate vl v = current variable; eq = the equality of ps in which the coefficient of v is the smallest if eq is not NULL eq is taken off the list of equalities of ps loop over the list of equalities of ps eg = current equality substitute in eg the value of v given by eq end loop loop over the list of inequalities of ps eg = current inequality substitute in eg the value of v given by eq end loop loop over the list of equalities of sc_elim eg = current equality substitute in eg the value of v given by eq end loop loop over the list of inequalities of sc_elim eg = current inequality substitute in eg the value of v given by eq end loop add eq in the list of equalities of sc_elim remove v from init_l add v in el end if end loop
elim_l = el END
Note: Here is how we "substitute in eg the value of v given by eq": if eg and eq are as follows (Vaux and Vsub do not contained v): eg <=> c*v + Vaux = 0 eq <=> val*v = Vsub let p = gcd(val,c) after the substitution, we have: eg <=> (c/p)*Vsub + (val/p)*Vaux = 0
During the computation, we modify *init_l, so we duplicate it. We use "el" not *elim_l, which should be empty at the beginning.
si eq etait en tete il faut l'enlever de la liste, sinon, eq a ete enleve par la fonction contrainte_var_min_coeff().
ps | s |
init_l | nit_l |
elim_l | lim_l |
Definition at line 1537 of file utils.c.
References Ssysteme::base, CAR, CONS, contrainte_subst_ofl_ctrl(), contrainte_var_min_coeff(), egalite_normalize(), Ssysteme::egalites, ENDP, ENTITY, entity_local_name(), eq, fprint_entity_list(), fprint_psysteme(), fprintf(), gen_append(), gen_remove(), get_debug_level(), ifdebug, Ssysteme::inegalites, NIL, NO_OFL_CTRL, pips_internal_error, POP, pu_vect_fprint(), sc_add_egalite(), sc_creer_base(), sc_new(), Scontrainte::succ, and Scontrainte::vecteur.
void comp_exec_domain | ( | graph | g, |
hash_table | STS | ||
) |
===========================================================================
void comp_exec_domain(graph g, STS): computes the execution domain of each statement. The englobing loops are obtained through the static control map.
We update the graph global variable with the exec domain.
loop aux_loop = ENTITY(CAR(loop_l));
STS | TS |
Definition at line 877 of file utils.c.
References CAR, CDR, contrainte_make(), dfg_vertex_label_exec_domain, graph_vertices, hash_get(), LOOP, loop_index, loop_range, make_predicate(), NIL, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, range_lower, range_upper, sc_add_inegalite(), sc_creer_base(), sc_new(), static_control_loops, STS, VALUE_ONE, vect_new(), vect_substract(), VECTEUR_NUL_P, VERTEX, vertex_int_stmt(), and vertex_vertex_label.
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 constante B Le systeme peut contenir des constantes symboliques.
Dans ce cas, la base index_base ne doit contenir que les variables etant des indices de boucles et la base const_base les constantes symboliques. La matrice B represente toutes les contraintes sur les constantes.
Les parametres de la fonction :
Psysteme ps : systeme lineaire !int A[] : matrice !int B[] : matrice int n : nombre de lignes de la matrice int m : nombre de colonnes de la matrice
pc | c |
index_base | ndex_base |
const_base | onst_base |
m1 | 1 |
m2 | 2 |
Definition at line 446 of file utils.c.
References ACCESS, B, CONTRAINTE_UNDEFINED_P, eq, matrice_nulle(), Scontrainte::succ, Svecteur::succ, TCST, vect_coeff(), Scontrainte::vecteur, and vecteur_var.
Referenced by broadcast_conditions(), system_inversion_restrict(), and vecteurs_libres_p().
void elim_last_pred | ( | void | ) |
===========================================================================
void elim_last_pred(): When POSITIVE and NEGATIVE cases of one predicate have been completed, we eliminate the corresponding expression which is the first one of the list "pred_l".
Definition at line 485 of file adg_read_paf.c.
===========================================================================
Psysteme elim_var_with_eg(Psysteme ps, list *init_l, list *elim_l): Computes the elimination of variables in the system "ps" using its equalities. All the used equalities are removed directly from "ps".
However, we keep all these "used" equalities in "sc_elim". The return value of this function is this system.
Initially, "init_l" gives the list of variables that can be eliminated and "elim_l" is empty. At the end, "init_l" contains the variables that are not eliminated and "elim_l" contains the variables that are eliminated.
At the end, to each equality of "sc_elim" will be associated a variable of "elim_l". These lists are built so as to be able to match them directly. Each variable of "elim_l" appears in one constraint of "sc_elim" and only one. There will be as many equalities in "sc_elim" as variables in "elim_l"
A variable can be eliminated using a given equality if it appears in this equality, i.e. its associated coefficient is not equal to zero. Moreover, it is easier to eliminate a variable with a value of 1 or -1. So, first we try to find such a variable.
BEGIN vl = init_l; el = NIL; eqs = list of equalities of ps sc_elim = system with no constraints while eqs is not empty init_vec = vector of the first equality of eqs var_not_found = TRUE coeff_one_not_found = TRUE l = vl while coeff_one_not_found and l is not empty crt_var = first variable of l crt_val = its value in init_vec if crt_val is 1 or -1 coeff_one_not_found = FALSE var_not_found = FALSE (var, val) = (crt_var, crt_val) else if crt_val is not 0 and var_not_found var_not_found = FALSE (var, val) = (crt_var, crt_val) end if l = CDR(l) end while if var_not_found is false (means that a variable has been found) (var, val) = variable and its value to eliminate in init_vec remove var from vl add var to el pv_elim = val*var - init_vec substitute val*var by pv_elim in ps substitute val*var by pv_elim in sc_elim add init_vec to sc_elim eqs = new list of equalities of ps else eqs = CDR(eqs) end if end while init_l = vl elim_l = el END
Note: the substitution of val*var by pv_elim in a vector V uses the gcd: V = c*var + Vaux p = gcd(val,c) Vnew = (c/p)*pv_elim + (val/p)*Vaux
BUG: reuse of freed memory.
We use "vl" during the computation, not *init_l
We use "el" during the computation, not *elim_l
Nothing do if there is no variable to eliminate
This elimination works only on equalities. While there remains equalities, we can eliminate variables.
We look, in vl (i.e. init_l), for a variable that we can eliminate in init_vec, i.e. with a coefficient not equal to 0. We prefer a coefficient * equal to 1 or -1, so we scan all the equality. We take the first * variable of "init_l" that has a coeff of 1 or -1. If there is no such * variable, we take the first with a coeff not equal to zero.
If we get such a variable, we eliminate it.
First, we remove it from "vl".
Then, we add it to "el".
We compute the expression (pv_elim) by which we are going to substitute our variable (var):
We have: val*var = pv_elim
The equality is: V = 0, with: V = val*var + Vaux
So, we have: pv_elim = -Vaux, with: Vaux = V - val*var
So: pv_elim = val*var - V
??? memory leak...
substitute "val*var" by its value (pv_elim) in the system
s = sc_normalize(ps);
We substitute var by its value (pv_elim) in "sc_elim".
The initial equality is added to "sc_elim".
We reinitialize the list of equalities.
Else, we try on the next equality.
ps | s |
init_l | nit_l |
elim_l | lim_l |
Definition at line 1361 of file utils.c.
References Ssysteme::base, CAR, CDR, CONS, contrainte_make(), Ssysteme::egalites, ENDP, ENTITY, entity_undefined, gen_remove(), NIL, NO_OFL_CTRL, sc_add_egalite(), sc_creer_base(), sc_elim_db_constraints(), sc_new(), substitute_var_with_vec(), Scontrainte::succ, VALUE_MONE, value_mone_p, value_notzero_p, VALUE_ONE, value_one_p, VALUE_ZERO, vect_cl2_ofl_ctrl(), vect_coeff(), vect_dup(), vect_new(), vect_rm(), and Scontrainte::vecteur.
Referenced by compose_vvs(), edge_weight(), make_causal_external(), make_causal_internal(), partial_broadcast_coefficients(), plc_make_distance(), simplify_bdt(), valuer(), and vvs_on_vvs().
===========================================================================
predicate expressions_to_predicate(list exp_l): returns the predicate that has the inequalities given as expressions in "exp_l". For example: if A is an expresion of "exp_l" then we'll have the inequality A <= 0 in the predicate.
If an expression is not linear, we warn the user.
Note: if "exp_l" is empty then we return an undefined predicate.
exp_l | xp_l |
Definition at line 826 of file utils.c.
References CAR, CDR, contrainte_make(), exp, EXPRESSION, expression_to_string(), make_predicate(), NIL, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, predicate_undefined, printf(), sc_add_inegalite(), sc_creer_base(), and sc_new().
Referenced by bdt_new_shedule(), and new_df_gov_pred().
Pcontrainte expressions_to_vectors | ( | list | lexp | ) |
=================================================================
lexp | exp |
Definition at line 2260 of file utils.c.
References CAR, contrainte_make(), CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, ENDP, EXPRESSION, is_normalized_complex, lexp, NORMALIZE_EXPRESSION, normalized_linear, normalized_tag, pips_internal_error, POP, and Scontrainte::succ.
Referenced by simplify_minmax().
========================================================================
We put the equalities of the system in our implicit system.
We duplicate "ps" in order to keep it unchanged.
We make the test on each inequality. We count them.
We replace the original inequality (Expr <= 0) by the modified one (Expr + 1 <= 0).
We test the feasibility. If it is not feasible, we add one more implicit equation in our implicit system : Expr == 0.
We put the old value back
ps | s |
Definition at line 2350 of file utils.c.
References contrainte_dup(), contrainte_make(), Ssysteme::egalites, entity_local_name(), fprintf(), get_debug_level(), Ssysteme::inegalites, NO_OFL_CTRL, pu_egalite_fprint(), sc_add_egalite(), sc_creer_base(), sc_dup(), sc_new(), sc_normalize(), sc_rational_feasibility_ofl_ctrl(), Scontrainte::succ, TCST, VALUE_ONE, vect_add(), vect_new(), and Scontrainte::vecteur.
Referenced by broadcast_of_dataflow(), count_implicit_equation(), plc_make_distance(), and simplify_bdt().
void finish_new_df_ref | ( | void | ) |
===========================================================================
void finish_new_df_ref(): the parser has completed the reading of the current reference with all its indices. We update our current reference and update all nodes contained in "crt_node_l".
Definition at line 683 of file adg_read_paf.c.
References CAR, CDR, crt_node_l, dataflow_reference, first_df_of_succ(), first_succ_of_vertex(), NIL, ref, ref_inds, reference_indices, and VERTEX.
void finish_new_df_source | ( | void | ) |
===========================================================================
void finish_new_df_source(): The reading of source of the current dataflow is completed. We create this dataflow, the successor to which it is attached and the node from which the dataflow comes. This node is put in the global list "crt_node_l" that contains all the computed edges that have the same sink statement (which is still not known).
At this time of the computation, only the source statement and the list of transformations are known. The governing predicate will be added on all the node of "crt_node_l", as well as the reference and the execution domain will be computed afterwards, when all the graph will be made.
Definition at line 399 of file adg_read_paf.c.
References communication_undefined, CONS, crt_node, crt_node_l, DATAFLOW, exec_dom, gen_nconc(), gov_pred, make_dataflow(), make_dfg_arc_label(), make_dfg_vertex_label(), make_successor(), make_vertex(), NIL, ref, sccflags_undefined, source_stmt, SUCCESSOR, trans_l, VERTEX, and vertex_undefined.
void finish_new_do_loop | ( | void | ) |
===========================================================================
void finish_new_do_loop(): This function update the global list of loops with the current loop.
Definition at line 851 of file adg_read_paf.c.
void finish_new_gd_ins | ( | void | ) |
===========================================================================
void finish_new_gd_ins(): completes the parsing of the DFG. We copy the list of englobing loops in order to store it in the global static control map (it contains the static_controls associated to the statements).
We compute the execution domain (for the dfg) for all sink instructions named "crt_stmt". comp_exec_domain(dfg, crt_stmt, crt_el);
Make a copy to store in the hash table "STS"
loop l = EFFECT(CAR(cl));
should be a long int for crt_stmt
Definition at line 950 of file adg_read_paf.c.
References CAR, CONS, crt_el, crt_stmt, gen_nconc(), hash_put(), LOOP, loop_dup(), make_static_control(), MAPL, NIL, param_l, and STS.
===========================================================================
dataflow first_df_of_succ(successor s): returns the first dataflow of "s".
Definition at line 1004 of file utils.c.
References CAR, DATAFLOW, dfg_arc_label_dataflows, and successor_arc_label.
Referenced by finish_new_df_ref(), and new_df_gov_pred().
===========================================================================
successor first_succ_of_vertex(vertex v): returns the first successor of "v".
Definition at line 994 of file utils.c.
References CAR, SUCCESSOR, and vertex_successors.
Referenced by finish_new_df_ref(), new_df_gov_pred(), and new_df_sink_ins().
void fprint_bdt | ( | FILE * | fp, |
bdt | obj | ||
) |
===========================================================================
Mod by AP, oct 6th 199595: the number of the instruction is the vertex number minus BASE_NODE_NUMBER.
fp | p |
obj | bj |
Definition at line 352 of file print.c.
References BASE_NODE_NUMBER, bdt_schedules, bdt_undefined, CAR, CDR, crt_stmt, Ssysteme::egalites, entity_local_name(), exp, EXPRESSION, expression_to_string(), fprintf(), Ssysteme::inegalites, NIL, predicate_system, predicate_undefined, pu_egalite_fprint(), pu_inegalite_fprint(), SCHEDULE, schedule_dims, schedule_predicate, schedule_statement, and Scontrainte::succ.
Referenced by analyze_quast(), build_bdt_null(), prgm_mapping(), print_bdt(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), reindexing(), and search_scc_bdt().
===========================================================================
void fprint_dataflow(FILE *fp, int stmt, dataflow df)
Prints in the file "fp" the dataflow "df" with a sink statement "stmt".
printf(fp, "\t\t Communication general \n");
fp | p |
stmt | tmt |
df | f |
Definition at line 229 of file print.c.
References communication_broadcast, communication_reduction, communication_shift, communication_undefined, dataflow_communication, dataflow_governing_pred, dataflow_reference, dataflow_transformation, fprint_list_of_exp(), fprint_pred(), fprint_sc_pvecteur(), fprintf(), gov_pred, predicate_system, predicate_undefined, ref, reference_to_string(), and trans_l.
Referenced by broadcast_conditions(), build_third_comb(), compatible_pc_p(), count_dataflows_on_ref(), edge_weight(), fprint_dfg(), fprint_sccs(), plc_fprint_dfs(), plc_fprint_distance(), plc_make_distance(), and prgm_mapping().
void fprint_indent | ( | FILE * | fp, |
int | indent | ||
) |
===========================================================================
fp | p |
indent | ndent |
Definition at line 502 of file print.c.
References fprintf(), and INDENT_FACTOR.
Referenced by imprime_quast().
void fprint_pred | ( | FILE * | fp, |
predicate | pred | ||
) |
===========================================================================
void fprint_pred(FILE *fp, predicate pred): prints in the file "fp" the predicate "pred".
fp | p |
pred | red |
Definition at line 287 of file print.c.
References fprint_psysteme(), and predicate_system.
Referenced by broadcast_conditions(), fprint_dataflow(), fprint_dfg(), and predicate_to_expression().
void fprint_psysteme | ( | FILE * | fp, |
Psysteme | ps | ||
) |
===========================================================================
void fprint_psysteme(FILE *fp, Psysteme ps): prints in the file "fp" the Psysteme "ps". Each constraint is printed either with pu_inegalite_fprint() or pu_egalite_fprint(), both redefined above. See pu_contrainte_fprint() for details.
fp | p |
ps | s |
Definition at line 302 of file print.c.
References Ssysteme::egalites, entity_local_name(), fprintf(), Ssysteme::inegalites, pu_egalite_fprint(), pu_inegalite_fprint(), and Scontrainte::succ.
Referenced by adg_dataflowgraph(), adg_dataflowgraph_with_extremities(), analyze_quast(), better_elim_var_with_eg(), broadcast_conditions(), build_list_of_min(), build_third_comb(), compatible_pc_p(), constraint_to_bound(), cutting_conditions(), dataflows_on_reference(), edge_weight(), fprint_l_psysteme(), fprint_mytest(), fprint_pred(), fprint_sys_list(), get_bounds_expression(), imprime_quast(), imprime_special_quast(), include_trans_on_LC_in_ref(), make_bounds(), make_causal_external(), make_primal(), make_reindex(), mapping_on_broadcast(), matrix_to_system(), my_substitute_var_with_vec(), new_elim_var_with_eg(), nullify_factors(), partial_broadcast_coefficients(), pip_solve(), pip_solve_min_with_big(), plc_elim_var_with_eg(), plc_make_distance(), prepare_reindexing(), prgm_mapping(), prototype_dimension(), sc_to_tableau(), search_scc_bdt(), simplify_bdt(), substitute_var_with_vec(), and valuer().
void fprint_sc_pvecteur | ( | FILE * | fp, |
Psysteme | ps | ||
) |
===========================================================================
void fprint_sc_pvecteur(FILE *fp, Psysteme ps): prints in the file "fp" the Psysteme "ps" as a list of vectors. Each constraint is printed with vecteur_fprint() defined above. See pu_contrainte_fprint() for details.
fp | p |
ps | s |
Definition at line 329 of file print.c.
References Ssysteme::egalites, entity_local_name(), fprintf(), Ssysteme::inegalites, Scontrainte::succ, and vecteur_fprint().
Referenced by fprint_dataflow().
Referenced by plc_make_vvs_with_vector(), prgm_mapping(), sort_dfg_node(), sort_eq_in_systems(), sort_unknowns(), and valuer().
statement_mapping get_current_stco_map | ( | void | ) |
========================================================================
Definition at line 2417 of file utils.c.
References current_stco_map.
Referenced by find_el_with_num(), and get_stco_from_current_map().
static_control get_stco_from_current_map | ( | statement | s | ) |
========================================================================
Definition at line 2429 of file utils.c.
References get_current_stco_map(), GET_STATEMENT_MAPPING, and STS.
Referenced by broadcast_conditions(), broadcast_of_dataflow(), cmf_layout_align(), craft_layout_align(), cutting_conditions(), dims_of_nest(), edge_weight(), get_list_of_all_param(), include_parameters_in_sc(), include_trans_in_poly(), is_not_trivial_p(), mapping_on_broadcast(), partial_broadcast_coefficients(), plc_make_dim(), plc_make_distance(), plc_make_min_dim(), plc_make_proto(), prepare_reindexing(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), reindexing(), sa_do_it(), simplify_bdt(), single_assign(), sort_dfg_node(), and valuer().
void imprime_quast | ( | FILE * | fp, |
quast | qu | ||
) |
===========================================================================
fp | p |
qu | u |
Definition at line 514 of file print.c.
References CAR, CDR, conditional_false_quast, conditional_predicate, conditional_true_quast, EXPRESSION, expression_to_string(), fprint_indent(), fprint_psysteme(), fprintf(), imprime_quast(), is_quast_value_conditional, is_quast_value_quast_leaf, leaf_label_depth, leaf_label_statement, leaf_label_undefined, NIL, ordering_to_statement(), predicate_system, predicate_undefined, quast_depth, quast_leaf_leaf_label, quast_leaf_solution, quast_leaf_undefined, quast_quast_value, quast_undefined, quast_value_conditional, quast_value_quast_leaf, quast_value_tag, quast_value_undefined, and statement_number.
Referenced by analyze_quast(), imprime_quast(), pip_solve(), pip_solve_min_with_big(), search_scc_bdt(), and valuer().
===========================================================================
void pu_egalites_to_matrice(matrice a, int n m, Pcontrainte leg, Pbase b): constructs the matrix "a" with the equalities contained in "leg". The base "b" gives the column number of each variable. The first element of the matrix is a(1,1), the ACCESS macro makes the conversion to the C array numbering which begins at (0,0).
The constant term is not included. The matrix "a" is supposed to have been already allocated in memory.
"n" must be the exact number of equalities contained in "leg". "m" must be the exact number of variables contained in "b". never called void pu_egalites_to_matrice(a, n, m, leg, b) matrice a; int n; int m; Pcontrainte leg; Pbase b; { Pvecteur v; Pcontrainte peq; int ligne = 1;
matrice_nulle(a, n, m);
for(peq = leg; peq != NULL; peq = peq->succ, ligne++) { pips_assert("pu_egalites_to_matrice",ligne<=n);
for(v = peq->vecteur; !VECTEUR_UNDEFINED_P(v); v = v->succ) { int rank; if(vecteur_var(v) != TCST) { rank = base_find_variable_rank(base_dup(b), vecteur_var(v), pu_variable_name); pips_assert("pu_egalites_to_matrice", rank <= m);
ACCESS(a, n, ligne, rank) = vecteur_val(v); } } } } end MATRIX functions ====================================================================== vertex in_dfg_vertex_list( (list) l, (vertex) v ) AL 30/06/93 Input : A list l of vertices. A vertex v of a dependence graph. Returns vertex_undefined if v is not in list l. Returns v' that has the same statement_ordering than v.
Definition at line 620 of file utils.c.
References CAR, dfg_vertex_label_statement, ENDP, pips_debug, POP, VERTEX, vertex_undefined, and vertex_vertex_label.
Referenced by adg_update_dfg().
======================================================================
vertex in_dg_vertex_list( (list) l, (vertex) v ) AL 30/06/93 Input : A list l of vertices. A vertex v of a dependence graph. Returns vertex_undefined if v is not in list l. Returns v' that has the same statement_ordering than v.
Definition at line 647 of file utils.c.
References CAR, dg_vertex_label_statement, ENDP, pips_debug, POP, VERTEX, vertex_undefined, and vertex_vertex_label.
void init_loop_ctrl | ( | char * | s_ind | ) |
===========================================================================
void init_loop_ctrl(char *s_ind): initializes the parsing of the control of a loop. The name that was parsed is the name of the loop index. Then we create the corresponding entity and update our current loop.
U
s_ind | _ind |
Definition at line 784 of file adg_read_paf.c.
References concatenate(), crt_loop, DFG_MODULE_NAME, entity_domain, entity_undefined, gen_find_tabulated(), is_storage_ram, is_type_variable, is_value_unknown, lin_exp_l, loop_index, make_basic_int(), make_entity, make_storage(), make_type(), make_value(), make_variable(), MODULE_SEP_STRING, NIL, ram_undefined, strdup(), and UU.
void init_new_df_gov_pred | ( | void | ) |
===========================================================================
void init_new_df_gov_pred(): Initializes the computation of the governing predicate.
For this, we initialize "pred_l" (expressions that will be contained in the predicate) and "lin_exp_l" (for the parsing of each expression).
Definition at line 426 of file adg_read_paf.c.
References gov_pred, lin_exp_l, NIL, pred_l, and predicate_undefined.
void init_new_df_ref | ( | char * | s_ref | ) |
===========================================================================
void init_new_df_ref(ichar *s_ref): the parser has gotten the name of the reference on which the current dataflow depends. We compute it and update the global variable "ref".
UU
Initialization of global variables
s_ref | _ref |
Definition at line 514 of file adg_read_paf.c.
References concatenate(), DFG_MODULE_NAME, entity_domain, entity_undefined, gen_find_tabulated(), is_storage_ram, is_type_variable, is_value_unknown, lin_exp_l, make_basic_int(), make_entity, make_reference(), make_storage(), make_type(), make_value(), make_variable(), MODULE_SEP_STRING, NIL, ram_undefined, ref, ref_inds, strdup(), and UU.
void init_new_df_sink_ins | ( | void | ) |
===========================================================================
void init_new_df_sink_ins(): initializes the computation of the sink statement of a datadflow. The structure of the file is such that all dependences with the same sink statement are grouped together. As our graph structure groups the dependences on the same source statement, we have to create a node for each dependence found for this sink statement. All these nodes are kept in "crt_node_l". The sink statement will be known when all these nodes will be computed, that's why they are kept in a special list.
Definition at line 297 of file adg_read_paf.c.
References crt_node, crt_node_l, NIL, ref, reference_undefined, sink_stmt, and vertex_undefined.
void init_new_df_source | ( | char * | s_ins | ) |
===========================================================================
void init_new_df_source(char *s_ins): initializes the computation of the source statement of a datadflow. This statement is represented by its ordering contained in its name "s_ins". We initialize the list of transformations that will be associated with source statement ("trans_l"). Also, we initialize "lin_exp_l" which is used for the parsing of the lisp expressions.
Note: We don't forget to update the list of statements "stmt_list".
In PAF, an statement name is a string "ins_#", where "#" is the number associated with the statement. We get this number.
We update the global list of statements
Initialization of global variables
s_ins | _ins |
Definition at line 342 of file adg_read_paf.c.
References CONS, empty_extensions(), entity_undefined, find_stmt_with_num(), INS_NAME_LENGTH, instruction_undefined, lin_exp_l, make_statement(), make_synchronization_none(), NIL, source_stmt, STATEMENT, statement_undefined, stmt_list, strdup(), and trans_l.
void init_new_dfg | ( | void | ) |
===========================================================================
void init_new_dfg() : initializes the computation of the DFG, i.e. the creation of the DFG in the "dfg" variable and the initialization of the global variables "exec_dom" and "gov_pred".
The list of vertices is empty at the beginning
Definition at line 245 of file adg_read_paf.c.
References dfg, exec_dom, gov_pred, make_graph(), NIL, param_l, and predicate_undefined.
void init_new_do_loop | ( | char * | s_loop | ) |
===========================================================================
void init_new_do_loop(char *s_loop): initializes the parsing of the paf file ".do". The parser has read the name of a loop. With this name we create a new loop which becomes the current loop. The name of the loop is put in the loop label.
s_loop | _loop |
Definition at line 751 of file adg_read_paf.c.
References concatenate(), crt_loop, DFG_MODULE_NAME, entity_domain, entity_undefined, execution_undefined, expression_undefined, gen_find_tabulated(), is_storage_ram, is_type_statement, is_value_unknown, make_entity, make_loop(), make_range(), make_storage(), make_type(), make_value(), MODULE_SEP_STRING, NIL, ram_undefined, statement_undefined, strdup(), and UU.
void init_new_gd_ins | ( | char * | s_ins | ) |
===========================================================================
void init_new_gd_ins(char *s_ins): initializes the parsing of the paf file ".gd". The parser has read the name of a statement. We get the number contained in this name and put in our current statement "crt_stmt".
"crt_el" is the list of the current englobing loops, i.e. the englobing loops of the current statement. It is initializes to NIL.
s_ins | _ins |
Definition at line 867 of file adg_read_paf.c.
References crt_el, crt_stmt, INS_NAME_LENGTH, NIL, and strdup().
void init_op_exp | ( | string | op_name | ) |
===========================================================================
void init_op_exp(string op_name): initializes a new lisp expression with the operation "op_name". This expression is put at the beginning of "lin_exp_l", it is the expression the parser is currently reading.
If "op_name" is the string "0" then the operator used is "crt_op_name", else the operator name is contained in "op_name".
op_name | p_name |
Definition at line 618 of file adg_read_paf.c.
References CONS, crt_op_name, lin_exp_l, LISP_EXPRESSION, make_lisp_expression(), and NIL.
void init_op_name | ( | string | op_name | ) |
===========================================================================
void init_op_name(string op_name): this function initializes the global variable "crt_op_name". It gives the current operation that the parser is dealing with.
op_name | p_name |
Definition at line 601 of file adg_read_paf.c.
References crt_op_name.
===========================================================================
bool is_entity_in_list_p(entity e, list l): returns true if entity "e" is in the list of entities "l", false otherwise. FI: many similar functions. See ri-util/arguments.c which deals with entity lists, i.e. entities.
Definition at line 1281 of file utils.c.
References CAR, CDR, ENTITY, NIL, and same_entity_p().
Referenced by add_others_variables(), adg_dataflowgraph_with_extremities(), adg_get_read_entity_vertices(), clean_list_of_unk(), get_list_of_all_param(), make_list_of_unk(), read_reference_list(), reorder_base(), and system_new_var_subst().
void lbound_exp | ( | void | ) |
===========================================================================
void lbound_exp(): The parser has read the lower bound expression of the current loop. This expression is contained in "crt_exp". We update our current loop.
Definition at line 814 of file adg_read_paf.c.
References crt_exp, crt_loop, lin_exp_l, loop_range, NIL, and range_lower.
expression lisp_exp_to_ri_exp | ( | lisp_expression | le | ) |
===========================================================================
expression lisp_exp_to_ri_exp(lisp_expression le): returns the expression that represent the lisp_expression given in argument ("le"). A lisp_expression is a Newgen structure that defines an expression as a list with the operator as the first object and the arguments as the rest of the list.
There are a few cases. If the operator is "aref" or "aset" then this lisp expression is a reference to an array. We use make_array_ref(). If the operator is not one of the four operations (+,-,*,/), then we use make_func_op(). Else (the operator is one of the four operation) we use rational_op_exp().
le | e |
Definition at line 755 of file utils.c.
References CAR, CDR, EXPRESSION, lisp_expression_args, lisp_expression_operation, make_array_ref(), make_func_op(), NIL, pips_internal_error, rational_op_exp(), and STRING_FOUR_OPERATION_P.
Referenced by bdt_save_exp(), and save_exp().
===========================================================================
loop loop_dup(loop l): returns the duplication of "l".
Definition at line 1014 of file utils.c.
References copy_loop().
Referenced by finish_new_gd_ins().
expression make_array_ref | ( | list | l | ) |
===========================================================================
expression make_array_ref(list l): returns an expression which is a reference to an array. The list "l" is composed of expressions, the first one is the array itself and the others are the indices. In order to create the desire expression, we only have to put the CDR of "l" into the list of indices of the reference contained in the first expression of "l".
Definition at line 702 of file utils.c.
References CAR, CDR, EXPRESSION, expression_syntax, NIL, pips_internal_error, reference_indices, syntax_reference, and syntax_reference_p.
Referenced by lisp_exp_to_ri_exp().
===========================================================================
Pbase make_base_of_nest(int stmt): returns the Pbase that contains the indices of the englobing loops of "stmt".
stmt | tmt |
Definition at line 977 of file utils.c.
References CAR, CDR, find_el_with_num(), LOOP, loop_index, NIL, VALUE_ONE, and vect_add_elem().
===========================================================================
Psysteme make_expression_equalities(list le): returns a Psysteme that has equalities computed from "le", a list of expressions.
le | e |
Definition at line 931 of file utils.c.
References CAR, CDR, contrainte_make(), exp, EXPRESSION, expression_to_string(), NIL, NORMALIZE_EXPRESSION, normalized_linear, normalized_linear_p, printf(), sc_add_egalite(), sc_creer_base(), and sc_new().
Referenced by broadcast_of_dataflow(), and edge_weight().
expression make_func_op | ( | string | func_name, |
list | args | ||
) |
===========================================================================
expression make_func_op(string func_name, list args): returns an expression that represent the call to "func_name" with "args" as arguments.
func_name | unc_name |
args | rgs |
Definition at line 725 of file utils.c.
References entity_domain, entity_undefined, gen_find_tabulated(), is_syntax_call, make_call(), make_entity_fullname(), make_expression(), make_syntax(), normalized_undefined, pips_internal_error, and TOP_LEVEL_MODULE_NAME.
Referenced by lisp_exp_to_ri_exp().
expression make_id_expression | ( | string | s | ) |
===========================================================================
expression make_id_expression(string s): makes an expression with the name of a variable. For this variable, we create a new entity if it does not exist yet.
U
Definition at line 672 of file utils.c.
References concatenate(), DFG_MODULE_NAME, entity_domain, entity_undefined, gen_find_tabulated(), is_storage_ram, is_syntax_reference, is_type_variable, make_basic_int(), make_entity, make_expression(), make_reference(), make_storage(), make_syntax(), make_type(), make_value_unknown(), make_variable(), MODULE_SEP_STRING, NIL, normalized_undefined, ram_undefined, and strdup().
Referenced by bdt_save_id(), and save_id().
expression make_rational_exp | ( | Pvecteur | v, |
Value | d | ||
) |
=====================================================================
expression make_rational_exp(v, d)
From the vector v and the integer d creates the expression of the following form: v/d . AC 94/03/25
Modification: this is an extension that verifies that v is not a multiple of d, in which case it can be simplified, and no divide operation is needed. AP 94/08/19
make a "zero" expression
divide "v" by "d", and make the expression with no denominator
build the denominator
build the numerator
create the symbol of dividing
make the expression
Definition at line 2446 of file utils.c.
References CONS, DIVIDE_OPERATOR_NAME, entity_domain, EXPRESSION, gen_find_tabulated(), int_to_expression(), is_syntax_call, make_call(), make_entity_fullname(), make_expression(), make_syntax(), make_vecteur_expression(), NIL, normalized_undefined, TOP_LEVEL_MODULE_NAME, value_abs, value_mod, Value_to_expression(), value_zero_p, vect_div(), vect_normalize(), vect_pgcd_all(), and VECTEUR_NUL_P.
Referenced by constraint_to_bound(), get_bounds_expression(), make_array_bounds(), and simplify_dimension().
void matrices_to_contraintes_with_sym_cst | ( | Pcontrainte * | pc, |
Pbase | index_base, | ||
Pbase | const_base, | ||
matrice | A, | ||
matrice | B, | ||
int | n, | ||
int | m1, | ||
int | m2 | ||
) |
build the constant terme if it exists
build a new vecteur if there is not constant term
build a new vecteur if there is not constant term
pc | c |
index_base | ndex_base |
const_base | onst_base |
m1 | 1 |
m2 | 2 |
Definition at line 503 of file utils.c.
References ACCESS, B, base_union(), contrainte_new(), cp, DENOMINATOR, Svecteur::succ, TCST, value_mult, value_notzero_p, vect_chg_coeff(), vect_new(), and vecteur_var.
Referenced by partial_broadcast_coefficients().
expression negate_expression | ( | expression | exp | ) |
===========================================================================
expression negate_expression(expression exp): returns the negation of the expression given in argument "exp".
In fact this computation is done only if the expression is linear with integer coefficients. If so, we use the Pvecteur form. Else, we return the duplication of the expression.
exp | xp |
Definition at line 792 of file utils.c.
References copy_expression(), exp, make_vecteur_expression(), NORMALIZE_EXPRESSION, normalized_complex_p, normalized_linear, vect_chg_sgn(), and vect_dup().
Referenced by bdt_save_pred(), and save_pred().
void new_df_gov_pred | ( | void | ) |
===========================================================================
void new_df_gov_pred(): the parser has found the all predicate of the dataflow of the current node, we have to compute it. This predicate is formed with the list of expressions of "pred_l". The function expressions_to_predicate() translates a list of expressions into a predicate.
Definition at line 498 of file adg_read_paf.c.
References crt_node, dataflow_governing_pred, expressions_to_predicate(), first_df_of_succ(), first_succ_of_vertex(), gov_pred, and pred_l.
void new_df_ref_ind | ( | string | ) |
void new_df_sink_ins | ( | char * | s_ins | ) |
===========================================================================
void new_df_sink_ins(char *s_ins): the parser has read the name of the sink statement. With this name we get its number. We update the global list of statements and the list "crt_node_l". At this time, all the informations needed for the nodes of "crt_node_l" are present, we then concatenate these nodes into the list of vertices of the graph.
In PAF, an instruction name is a string "ins_#", where "#" is the number associated with the instruction. We get this number.
FI: removed because of problems. paf_ri.h and/or paf_util.h or something else should be included and might cause conflict between newgen data structures
s_ins | _ins |
Definition at line 706 of file adg_read_paf.c.
References CAR, CDR, CONS, crt_node_l, dfg, empty_extensions(), entity_undefined, exec_dom, find_stmt_with_num(), first_succ_of_vertex(), gen_nconc(), graph_vertices, INS_NAME_LENGTH, instruction_undefined, make_dfg_vertex_label(), make_statement(), make_synchronization_none(), make_vertex(), NIL, sccflags_undefined, sink_stmt, STATEMENT, statement_undefined, stmt_list, strdup(), successor_vertex, VERTEX, and vertex_undefined.
void new_df_trans_exp | ( | void | ) |
===========================================================================
void new_df_trans_exp(): The parser has now completed the reading of one transformation expression. We update "trans_l" and reinitialize "lin_exp_l" for the next expression.
Initialization of global variables
Definition at line 374 of file adg_read_paf.c.
References CONS, crt_exp, EXPRESSION, expression_undefined, gen_nconc(), lin_exp_l, NIL, pips_internal_error, and trans_l.
void new_eng_loop | ( | char * | s_loop | ) |
===========================================================================
void new_eng_loop(char *s_loop): the parser has found a new englobing loop. If it does not exist yet (we call find_loop_with_name()) we create it. We update "crt_el" with this loop (at the end): we want to construct an ordered list from the most external list to the innermost loop, and the parsing gets the loops in this order.
s_loop | _loop |
Definition at line 909 of file adg_read_paf.c.
References concatenate(), CONS, crt_el, DFG_MODULE_NAME, entity_domain, entity_undefined, execution_undefined, expression_undefined, find_loop_with_name(), gen_find_tabulated(), gen_nconc(), is_storage_ram, is_type_statement, is_value_unknown, LOOP, loop_undefined, make_entity, make_loop(), make_range(), make_storage(), make_type(), make_value(), MODULE_SEP_STRING, NIL, ram_undefined, statement_undefined, strdup(), and UU.
void new_param | ( | string | s | ) |
===========================================================================
void new_param(s) : adds a new structure parameters to the global list "param_l".
Fi: UU is not a proper argument for make_basic_int()
UU
Definition at line 262 of file adg_read_paf.c.
References concatenate(), CONS, DFG_MODULE_NAME, ENTITY, entity_domain, entity_undefined, gen_find_tabulated(), is_storage_ram, is_value_unknown, make_basic_int(), make_entity, make_storage(), make_type_variable(), make_value(), make_variable(), MODULE_SEP_STRING, NIL, param_l, ram_undefined, strdup(), and UU.
Referenced by make_start_ru_module().
===========================================================================
Psysteme polynome_to_sc(Ppolynome pp, list l): returns a system of equalities ("new_ps") computed from a polynome "pp" and a list of variables "l".
This list gives the variables of the polynome for which we need to nullify the factor. Thus, the resulting system contains the equations that nullify these factors (the degree of the polynome must be less or equal to two).
When all these equations are computed, the remaining polynome, from each we have removed all the occurences of these variables, is also nullify and the equation added to the system (then, this remnant must be of degree 1).
For each variable, we nullify its factor in the polynome.
We get the current variable.
We get its factor in the polynome.
We add a new equality in the system.
We delete the occurences of this variable in the polynome.
The remnant is added to the system.
pp | p |
Definition at line 1115 of file utils.c.
References CAR, CDR, ENTITY, NIL, polynome_dup(), polynome_factorize(), POLYNOME_NUL, polynome_to_contrainte(), prototype_var_subst(), sc_add_egalite(), sc_creer_base(), and sc_new().
===========================================================================
Ppolynome old_vecteur_to_polynome(Pvecteur vec): translates a Pvecteur into a Ppolynome. FI: To be moved
vec | ec |
Definition at line 1648 of file utils.c.
References make_polynome(), polynome_add(), POLYNOME_NUL, Svecteur::succ, Svecteur::val, VALUE_ONE, VALUE_TO_FLOAT, and Svecteur::var.
Pcontrainte polynome_to_contrainte | ( | Ppolynome | pp | ) |
========================================================================
pp | p |
Definition at line 1095 of file utils.c.
References contrainte_make(), and polynome_to_vecteur().
Referenced by add_constraint_on_x(), nullify_factors(), old_polynome_to_sc(), and polynome_to_sc().
===========================================================================
Psysteme new_polynome_to_sc(Ppolynome pp, list l): returns a system of equalities ("new_ps") computed from a polynome "pp" and a list of variables "l".
This list gives the variables of the polynome for which we need to nullify the factor. Thus, the resulting system contains the equations that nullify these factors (the degree of the polynome must be less or equal to two).
When all these equations are computed, the remaining polynome, from each we have removed all the occurences of these variables, is also nullify and the equation added to the system (then, this remnant must be of degree 1).
For each variable, we nullify its factor in the polynome.
We get the current variable.
We get its factor in the polynome.
We delete the occurences of this variable in the polynome.
The remnant is added to the system.
pp | p |
Definition at line 1158 of file utils.c.
References CAR, CDR, contrainte_make(), ENTITY, NIL, polynome_dup(), POLYNOME_NUL, polynome_to_contrainte(), prototype_factorize(), prototype_var_subst(), sc_add_egalite(), sc_creer_base(), sc_new(), and VECTEUR_NUL_P.
Referenced by make_causal_external(), and make_causal_internal().
========================================================================
pp | p |
Definition at line 1063 of file utils.c.
References float_to_value, Spolynome::monome, pips_internal_error, Spolynome::succ, Svecteur::succ, term(), Svecteur::var, vect_add_elem(), VECTEUR_NUL, and VECTEUR_NUL_P.
Referenced by include_trans_in_sc(), polynome_to_contrainte(), and prgm_mapping().
========================================================================
pp | p |
var | ar |
Definition at line 2070 of file utils.c.
References entity_undefined, f(), float_to_value, Spolynome::monome, pips_internal_error, POLYNOME_NUL_P, polynome_TCST(), same_entity_p(), Spolynome::succ, Svecteur::succ, TCST, term(), Svecteur::var, VARIABLE_UNDEFINED, vect_new(), and VECTEUR_NUL.
Referenced by broadcast_dimensions(), nullify_factors(), partial_broadcast_coefficients(), partition_unknowns(), plc_make_distance(), polynome_to_sc(), prototype_dimension(), and sort_unknowns().
=================================================================
pp | p |
var | ar |
ppsubst | psubst |
Definition at line 1978 of file utils.c.
References entity_undefined, Spolynome::monome, pips_internal_error, polynome_dup(), POLYNOME_NUL_P, POLYNOME_UNDEFINED, POLYNOME_UNDEFINED_P, polynome_var_subst(), same_entity_p(), Spolynome::succ, Svecteur::succ, term(), and Svecteur::var.
Referenced by include_trans_in_poly(), nullify_factors(), old_polynome_to_sc(), plc_make_distance(), polynome_to_sc(), and vvs_on_polynome().
===========================================================================
void pu_contraintes_to_matrices(Pcontrainte pc, Pbase b, matrice A B, int n m): constructs the matrices "A" and "B" corresponding to the linear constraints "pc", so: Ab + B <=> pc(b).
The base "b" gives the variables of the linear system.
The matrices "A" and "B" are supposed to have been already allocated in memory, respectively of dimension (n, m) and (n, 1).
"n" must be the exact number of constraints contained in "pc". "m" must be the exact number of variables contained in "b".
pc | c |
Definition at line 408 of file utils.c.
References ACCESS, B, CONTRAINTE_UNDEFINED_P, eq, matrice_nulle(), Scontrainte::succ, Svecteur::succ, vect_coeff(), Scontrainte::vecteur, and vecteur_var.
Referenced by broadcast_of_dataflow(), partial_broadcast_coefficients(), and prototype_dimension().
void pu_egalite_fprint | ( | FILE * | , |
Pcontrainte | , | ||
const char * | *)(entity | ||
) |
Referenced by find_implicit_equation(), fprint_bdt_with_stat(), and solve_system_by_succ_elim().
void pu_inegalite_fprint | ( | FILE * | , |
Pcontrainte | , | ||
const char * | *)(entity | ||
) |
Referenced by apply_farkas(), is_not_trivial_p(), mapping_on_broadcast(), nullify_factors(), partition_unknowns(), plc_make_distance(), prgm_mapping(), prototype_dimension(), valuer(), and vvs_on_polynome().
utils.c
utils.c
Internal variables
Local defines: FI, they are needed earlier in the file because newgen is now fully typed statically begin MATRIX functions ======================================================================== never called void matrix_scalar_multiply(A, nb) Pmatrix A; int nb; { int i, j, m, n, d, p;
m = MATRIX_NB_LINES(A); n = MATRIX_NB_COLUMNS(A); d = MATRIX_DENOMINATOR(A); p = pgcd(d, nb);
MATRIX_DENOMINATOR(A) = d/p; for (i = 1; i <= m; i++) for (j = 1; j <= n; j++) MATRIX_ELEM(A,i,j) = (nb/p) * MATRIX_ELEM(A,i,j); } ==================================================================== never called void pu_matrix_add(a,b,c) Pmatrix a; Pmatrix b, c; { int d1, d2, i, j, n, m;
n = MATRIX_NB_LINES(a); m = MATRIX_NB_COLUMNS(a); pips_assert("matrix_add", (n > 0) && (m > 0));
d1 = MATRIX_DENOMINATOR(b); d2 = MATRIX_DENOMINATOR(c); if (d1 == d2) { for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) MATRIX_ELEM(a,i,j)=MATRIX_ELEM(b,i,j)+MATRIX_ELEM(c,i,j); MATRIX_DENOMINATOR(a) = d1; } else { int lcm = ppcm(d1,d2); d1 = lcm/d1; d2 = lcm/d2; for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) MATRIX_ELEM(a,i,j)=MATRIX_ELEM(b,i,j)*d1+MATRIX_ELEM(c,i,j)*d2; MATRIX_DENOMINATOR(a) = lcm; } } ======================================================================= never called void pu_constraints_with_sym_cst_to_matrices(pc,ib,cb,A,B) Pcontrainte pc; Pbase ib,cb; Pmatrix A, B; { int i,j; Pcontrainte eq; Pvecteur pv; int n, m1, m2;
for (eq = pc, n = 0; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ) { n++; } m1 = vect_size(ib); m2 = vect_size(cb) + 1;
pips_assert("constraints_with_sym_cst_to_matrices", (MATRIX_NB_LINES(A) == n) && (MATRIX_NB_COLUMNS(A) == m1) && (MATRIX_NB_LINES(B) == n) && (MATRIX_NB_COLUMNS(B) == m2));
matrix_nulle(B); matrix_nulle(A);
for (eq = pc,i=1; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,i++) { for(pv = ib, j=1; pv != NULL; pv = pv->succ, j++){ MATRIX_ELEM(A,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur); } for(pv = cb, j=1; pv != NULL; pv = pv->succ, j++){ MATRIX_ELEM(B,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur); } MATRIX_ELEM(B,i,m2) = vect_coeff(TCST,eq->vecteur); } } ======================================================================= never called void pu_matrices_to_constraints_with_sym_cst(pc,ib,cb,A,B) Pcontrainte *pc; Pbase ib,cb; Pmatrix A, B; { Pcontrainte newpc = NULL; int i, j, coeff, dena, denb, n, m1, m2, lcm;
n = MATRIX_NB_LINES(A); m1 = MATRIX_NB_COLUMNS(A); m2 = MATRIX_NB_COLUMNS(B);
pips_assert("constraints_with_sym_cst_to_matrices", (MATRIX_NB_LINES(B) == n) && (vect_size(ib) == m1) && ((vect_size(cb) + 1) == m2));
dena = MATRIX_DENOMINATOR(A); denb = MATRIX_DENOMINATOR(B); lcm = ppcm(dena, denb);
for (i=n;i>=1; i–) { bool found = false; Pcontrainte cp = contrainte_new(); Pvecteur vect, pv = NULL;
if ((coeff = MATRIX_ELEM(B,i,m2)) != 0) { pv = vect_new(TCST, (lcm/denb) * coeff); found = true; } for (j=1, vect=ib;j<=m1;vect=vect->succ,j++) { if ((coeff = MATRIX_ELEM(A,i,j)) != 0) if (found) vect_chg_coeff(&pv, vecteur_var(vect),(lcm/dena) * coeff); else { pv = vect_new(vecteur_var(vect), (lcm/dena) * coeff); found = true; } } for (j=1, vect=cb;j<=m2-1;vect=vect->succ,j++) { if ((coeff = MATRIX_ELEM(B,i,j)) != 0) if (found) vect_chg_coeff(&pv, vecteur_var(vect),(lcm/denb) * coeff); else { pv = vect_new(vecteur_var(vect), (lcm/denb) * coeff); found = true; } } cp->vecteur = pv; cp->succ = newpc; newpc = cp; } pc = newpc; } =========================================================================== void pu_matrices_to_contraintes(Pcontrainte *pc, Pbase b, matrice A B, int n m): constructs the constraints "pc" corresponding to the matrices "A" and "B" so: pc(b) <=> Ab + B
B represents the constant term.
The base "b" gives the variables of the linear system. The matrices "A" and "B" are respectively of dimension (n, m) and (n, 1).
"n" will be the exact number of constraints contained in "pc". "m" must be the exact number of variables contained in "b".
build the constant terme if it is null
build a new vecteur if there is a null constant term
pc | c |
Definition at line 350 of file utils.c.
References ACCESS, B, contrainte_new(), cp, DENOMINATOR, Svecteur::succ, TCST, value_mult, value_notzero_p, vect_chg_coeff(), vect_new(), and vecteur_var.
Referenced by broadcast_conditions(), make_primal(), and system_inversion_restrict().
const char* pu_variable_name | ( | Variable | v | ) |
package mapping : Alexis Platonoff, april 1993
===========================================================================
Definition at line 421 of file print.c.
References entity_local_name(), and TCST.
Referenced by calculate_delay(), constraint_to_bound(), fprint_pla_pp_dims(), is_not_trivial_p(), make_reindex(), mapping_on_broadcast(), nullify_factors(), partition_unknowns(), plc_fprint_distance(), plc_make_distance(), prgm_mapping(), prototype_dimension(), solve_system_by_succ_elim(), and valuer().
void pu_vect_fprint | ( | FILE * | fp, |
Pvecteur | v | ||
) |
===========================================================================
void pu_vect_fprint(FILE *fp, Pvecteur v): impression d'un vecteur creux v sur le fichier fp.
There exist a function "vect_fprint" in C3 which takes a third argument. arg, also in array_dfg.
on admet plusieurs occurences du terme constant!?!
fp | p |
Definition at line 446 of file print.c.
References entity_local_name(), fprint_Value(), fprintf(), Svecteur::succ, TCST, Svecteur::val, value_addto, value_notzero_p, value_one_p, value_oppose, value_pos_p, VALUE_ZERO, Svecteur::var, and VECTEUR_NUL_P.
Referenced by adg_dataflowgraph(), adg_dataflowgraph_with_extremities(), analyze_quast(), better_elim_var_with_eg(), build_third_comb(), calculate_delay(), constraint_to_bound(), fprint_coef_list(), fprint_vv(), make_reindex(), mapping_on_broadcast(), new_elim_var_with_eg(), nullify_factors(), plc_elim_var_with_eg(), predicate_to_expression(), prepare_reindexing(), prototype_dimension(), search_scc_bdt(), simplify_dimension(), and solve_system_by_succ_elim().
expression rational_op_exp | ( | string | op_name, |
expression | exp1, | ||
expression | exp2 | ||
) |
========================================================================
expression rational_op_exp(char *op_name, expression exp1 exp2): Returns an expression containing the operation "op_name" between "exp1" and "exp2". "op_name" must be one of the four classic operations : +, -, * or /.
If both expressions are integer constant values and the operation result is an integer then the returned expression contained the calculated result, but this calculus is a rational one, not an integer one as in make_op_exp().
Else, we treat five special cases : _ exp1 and exp2 are integer linear and op_name is + or -. This case is resolved by make_lin_op_exp(). _ exp1 = 0 _ exp1 = 1 _ exp2 = 0 _ exp2 = 1
Else, we create a new expression with a binary call.
Note: The function MakeBinaryCall() comes from Pips/.../syntax/expression.c The function int_to_expression() comes from ri-util. Note: This function is almost equivalent to make_op_exp() but for the rational calculus. FI: to be moved in ri-util/expression.c
rational calculus
We need to know the integer linearity of both expressions.
ENTITY_MULTIPLY_P(op_ent) || ENTITY_DIVIDE_P(op_ent)
Both expressions are unnormalized because they might be reused in an unnormalized expression.
op_name | p_name |
exp1 | xp1 |
exp2 | xp2 |
Definition at line 1846 of file utils.c.
References ENTITY_DIVIDE_P, entity_domain, ENTITY_FOUR_OPERATION_P, ENTITY_MINUS_P, ENTITY_MULTIPLY_P, ENTITY_PLUS_P, expression_constant_p(), expression_equal_integer_p(), expression_to_int(), expression_to_string(), expression_undefined, gen_find_tabulated(), int_to_expression(), is_normalized_linear, make_entity_fullname(), make_lin_op_exp(), MakeBinaryCall(), MakeUnaryCall(), NORMALIZE_EXPRESSION, normalized_tag, pips_debug, TOP_LEVEL_MODULE_NAME, UNARY_MINUS_OPERATOR_NAME, unnormalize_expression(), and user_error.
Referenced by lisp_exp_to_ri_exp().
void reorganize_bdt | ( | bdt | base | ) |
===========================================================================
void reorganize_bdt(bdt base):
base | ase |
Definition at line 171 of file bdt_read_paf.c.
References base, bdt_schedules, CAR, CONS, ENDP, EXPRESSION, gen_nconc(), NIL, POP, same_predicate_p(), SCHEDULE, schedule_dims, schedule_predicate, and schedule_statement.
Referenced by bdt_read_paf().
void reset_current_stco_map | ( | void | ) |
========================================================================
Definition at line 2423 of file utils.c.
References current_stco_map, and hash_table_undefined.
Referenced by prgm_mapping(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), reindexing(), scheduling(), and single_assign().
===========================================================================
If the predicate are defined, we consider them as always different
p1 | 1 |
p2 | 2 |
Definition at line 145 of file bdt_read_paf.c.
References predicate_undefined.
Referenced by reorganize_bdt().
void save_exp | ( | void | ) |
===========================================================================
void save_exp(): the parser has completed the reading of one lisp expression, this is the first lisp expression of "lin_exp_l". We extract it from this list and translate it into a Pips expression. If there is no other lisp expression in "lin_exp_l", then this expression becomes the current expression, else it becomes an argument of the next lisp expression which is now the first object of "lin_exp_l".
Definition at line 642 of file adg_read_paf.c.
References CAR, CDR, CONS, crt_exp, EXPRESSION, gen_nconc(), lin_exp_l, lisp_exp_to_ri_exp(), LISP_EXPRESSION, lisp_expression_args, and NIL.
void save_id | ( | string | s | ) |
===========================================================================
void save_id(string s): The parser has found a variable as a part of a lisp expression. We save it in our global variable "lin_exp_l".
If "lin_exp_l" is empty, then this variable becomes the current expression. If not, it becomes an argument of the first lisp expression of "lin_exp_l".
Definition at line 576 of file adg_read_paf.c.
References CAR, CONS, crt_exp, EXPRESSION, gen_nconc(), lin_exp_l, LISP_EXPRESSION, lisp_expression_args, make_id_expression(), and NIL.
void save_int | ( | int | i | ) |
===========================================================================
void save_int(int i): The parser has found an integer as a part of a lisp expression. We save it in our global variable "lin_exp_l".
If "lin_exp_l" is empty, then this integer becomes the current expression. If not, it becomes an argument of the first lisp expression of "lin_exp_l".
Definition at line 549 of file adg_read_paf.c.
References CAR, CONS, crt_exp, EXPRESSION, gen_nconc(), int_to_expression(), lin_exp_l, LISP_EXPRESSION, lisp_expression_args, and NIL.
void save_pred | ( | int | option | ) |
===========================================================================
void save_pred(int option): computes one expression of the predicate. Each expression is used twice ; indeed, an expression may be greater or equal than zero (>=) and smaller than zero (<). "option" says in which case we are: POSITIVE indicates that the predicate is >=, with NEGATIVE it is <. However, the C3 library always represents its inequalities with <=. So, the inequality "A >= 0" becomes "-A <= 0" and "A < 0" becomes "A + 1 <= 0".
This function updates the global list "pred_l" that contains the current list of predicates. When a new predicate expression is parsed, the POSITIVE is always considered first (that is why only in that case we use "crt_exp"). When the NEGATICE case is considered, the corresponding expression (used in the POSITIVE case) is the first expression of the list "pred_l". So, we only have to replace this expression by it equivalent for the NEGATIVE case (that is why the expression is multiplied by -1).
"A >= 0" becomes "-A <= 0"
option == NEGATIVE
"A < 0" becomes "A + 1 <= 0"
Initialization of global variables
option | ption |
Definition at line 450 of file adg_read_paf.c.
References CAR, CDR, CONS, crt_exp, EXPRESSION, expression_undefined, int_to_expression(), lin_exp_l, make_op_exp(), negate_expression(), NIL, pips_internal_error, PLUS_OPERATOR_NAME, POSITIVE, and pred_l.
void set_current_stco_map | ( | statement_mapping | scm | ) |
========================================================================
scm | cm |
Definition at line 2408 of file utils.c.
References current_stco_map, hash_table_undefined, and pips_assert.
Referenced by adg_read_paf(), prgm_mapping(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), reindexing(), scheduling(), and single_assign().
=================================================================
list simplify_minmax(list lexp, Psysteme ps_cont, int min_or_max)
Parameters : _ lexp : list of LINEAR expressions _ ps_cont : system of equations, called the context _ min_or_max : flag, says in which case we are (MIN or MAX)
Result : list of LINEAR expressions
Aims : simplify "lexp", i.e. suppress one or more of its expressions. A given expression can be suppressed if it surely smaller (case MAX) or greater (case MIN) than one of the other. The case (MIN or MAX) is given by "min_or_max". If two expressions can not be compared, both are kept.The context allows the user to introduce relationship between variables without which some vectors can not be eliminate.
Algorithm : see simplify_minmax_contrainte().
Note : "lexp" is not changed, the returned list of expressions is a new one.
lexp | exp |
ps_cont | s_cont |
min_or_max | in_or_max |
Definition at line 2313 of file utils.c.
References expressions_to_vectors(), lexp, NIL, simplify_minmax_contrainte(), and vectors_to_expressions().
Referenced by re_do_it().
Pcontrainte simplify_minmax_contrainte | ( | Pcontrainte | pc, |
Psysteme | ps_cont, | ||
int | min_or_max | ||
) |
==================================================================
We get (or create) our special variable "X".
U
We put our special variable in our vectors.
min_or_max == IS_MAX
We add the context.
We remove our MINMAX variable.
pc | c |
ps_cont | s_cont |
min_or_max | in_or_max |
Definition at line 2154 of file utils.c.
References Ssysteme::base, concatenate(), contrainte_make(), CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, count, entity_domain, entity_undefined, gen_find_tabulated(), Ssysteme::inegalites, IS_MAX, IS_MIN, is_storage_ram, is_type_variable, make_basic_int(), make_entity, make_storage(), make_type(), make_value_unknown(), make_variable(), MINMAX_REF_NAME, MODULE_SEP_STRING, Ssysteme::nb_ineq, NIL, PAF_UTIL_MODULE_NAME, ram_undefined, sc_creer_base(), sc_dup(), sc_elim_redund(), strdup(), Scontrainte::succ, value_mone_p, value_one_p, vect_add_elem(), vect_chg_sgn(), vect_coeff(), vect_dup(), vect_erase_var(), and Scontrainte::vecteur.
Referenced by simplify_minmax().
===========================================================================
bool single_var_vecteur_p(Pvecteur pv): returns true if the vector "pv" contains only one element.
Note: This element should not be a constant term (this is not tested).
pv | v |
Definition at line 1615 of file utils.c.
References vect_size().
list static_control_to_indices | ( | static_control | stct | ) |
package mapping : Alexis Platonoff, july 1993
=========================================================================== list static_control_to_indices(static_control stct): returns the list of the loop indices (entities) corresponding to the list of loops contained in "stct". The list of indices is in the same order than the list of loop, i.e. for example, if "stct" contains a list of loops like (LOOP1, LOOP3, LOOP5, LOOP2) then the list of indices will be (I1, I3, I5, I2).
We keep the same order.
stct | tct |
Definition at line 1037 of file utils.c.
References CAR, CDR, CONS, ENTITY, gen_nconc(), LOOP, loop_index, NIL, and static_control_loops.
Referenced by broadcast_conditions(), broadcast_of_dataflow(), cmf_layout_align(), craft_layout_align(), cutting_conditions(), edge_weight(), get_list_of_all_param(), include_trans_in_poly(), is_not_trivial_p(), mapping_on_broadcast(), partial_broadcast_coefficients(), plc_make_dim(), plc_make_distance(), plc_make_min_dim(), plc_make_proto(), prepare_reindexing(), sa_do_it(), simplify_bdt(), sort_dfg_node(), and valuer().
int stco_common_loops_of_statements | ( | statement_mapping | in_map, |
statement | in_s, | ||
statement | in_s2 | ||
) |
AP, sep 25th 1995 : I have added a function from static_controlise/utils.c.
====================================================================== int stco_common_loops_of_statements(in_map, in_s, in_s2 ) AL 22/10/93 Input : A statement mapping in_map wich associates a static_control to each statement, and two statements in_s and in_s2. Output : Number of same enclosing loops around ins_s and in_s2.
in_map | n_map |
in_s | n_s |
in_s2 | n_s2 |
Definition at line 2497 of file utils.c.
References debug(), gen_length(), and stco_same_loops().
Referenced by adg_dataflowgraph(), adg_max_of_leaves(), adg_path_max_source(), and adg_path_possible_source().
void step_exp | ( | void | ) |
===========================================================================
void step_exp(): The parser has read the step expression of the current loop. This expression is contained in "crt_exp". We update our current loop.
Definition at line 826 of file adg_read_paf.c.
References crt_exp, crt_loop, lin_exp_l, loop_range, NIL, and range_increment.
===========================================================================
void substitute_var_with_vec(Psysteme ps, entity var, int val, Pvecteur vec): Substitutes in a system ("ps") a variable ("var"), factor of a positive value ("val"), by an expression ("vec").
This substitution is done on all assertions of the system (equalities and inequalities). For each assertion (represented by a vector Vold) we have:
Vold = c*var + Vaux val*var = vec
Vnew represents the new assertion. With: p = pgcd(c, val) >= 1, we have:
Vnew = (c/p)*vec + (val/p)*Vaux = (c/p)*vec + (val/p)*(Vold - c*var)
Note: we have: Vold == 0 <=> (val/p)*Vold == 0 Vold > 0 <=> (val/p)*Vold > 0 ...
because "val" is positive.
"val" must be positive.
Vnew = (c/p)*vec + (val/p)*Vaux = (c/p)*vec + (val/p)*(Vold - c*var)
ps | s |
var | ar |
val | al |
vec | ec |
Definition at line 1210 of file utils.c.
References assert, fprint_psysteme(), fprintf(), ifdebug, NO_OFL_CTRL, pgcd_slow(), sc_creer_base(), value_div, VALUE_MONE, value_neg_p, value_notzero_p, VALUE_ONE, value_oppose, vect_chg_sgn(), vect_cl2_ofl_ctrl(), vect_coeff(), vect_new(), and vect_rm().
Referenced by build_third_comb(), change_base_in_sc(), elim_var_with_eg(), and vvs_on_systeme().
void ubound_exp | ( | void | ) |
===========================================================================
void ubound_exp(): The parser has read the upper bound expression of the current loop. This expression is contained in "crt_exp". We update our current loop.
Definition at line 839 of file adg_read_paf.c.
References crt_exp, crt_loop, lin_exp_l, loop_range, NIL, and range_upper.
=================================================================
Pvecteur vect_var_subst(vect,var,new_vect): substitute in the vector "vect", the variable "var" by new_vect. (vect) = (val)x(var) + (vect_aux) => (vect) = (val)x(new_vect) + (vect_aux)
AC 93/12/06
vect | ect |
var | ar |
new_vect | ew_vect |
Definition at line 1948 of file utils.c.
References vect_add(), vect_aux, vect_coeff(), vect_erase_var(), and vect_multiply().
Referenced by constraint_to_bound(), and converti_psysmin_psysmax().
void vecteur_fprint | ( | FILE * | , |
Pcontrainte | , | ||
const char * | *)(entity | ||
) |
Referenced by constraint_to_bound(), and make_reindex().
========================================================================
v1 | 1 |
v2 | 2 |
Definition at line 2024 of file utils.c.
References f(), make_polynome(), pips_assert, polynome_add(), POLYNOME_NUL, same_entity_p(), Svecteur::succ, TCST, term(), Svecteur::val, VALUE_CONST, value_mult, VALUE_ONE, VALUE_TO_FLOAT, Svecteur::var, vect_new(), and VECTEUR_NUL_P.
Referenced by apply_farkas(), and create_farkas_poly().
===========================================================================
list vecteur_to_list(Pvecteur v): translates a Pvecteur into a list of entities, in the same order. FI: same comment as above: to be moved
Definition at line 1626 of file utils.c.
References CONS, ENTITY, gen_nconc(), NIL, Svecteur::succ, TCST, and Svecteur::var.
Referenced by compose_vvs(), plc_make_vvs_with_vector(), system_new_var_subst(), and vvs_on_vvs().
list vectors_to_expressions | ( | Pcontrainte | pc | ) |
=================================================================
pc | c |
Definition at line 2245 of file utils.c.
References ADD_ELEMENT_TO_LIST, EXPRESSION, lexp, make_vecteur_expression(), NIL, Scontrainte::succ, and Scontrainte::vecteur.
Referenced by simplify_minmax().
===========================================================================
int vertex_int_stmt(vertex v): returns the statement number contained in the vertex. It is a "dfg" vertex.
Definition at line 866 of file utils.c.
References dfg_vertex_label_statement, and vertex_vertex_label.
Referenced by adg_fprint_dfg(), broadcast(), comp_exec_domain(), compare_nodes_dim(), dataflows_on_reference(), edge_weight(), fprint_dfg(), fprint_sccs(), get_predicate_system_of_node(), is_not_trivial_p(), partition_unknowns(), plc_fprint_distance(), plc_make_dim(), plc_make_distance(), plc_make_min_dim(), prgm_mapping(), search_scc_bdt(), sort_dfg_node(), sort_unknowns(), valuer(), and vvs_on_prototypes().
|
extern |
Global variables This global variable is the current BDT being computed. Its type is defined in paf_ri.h
Definition at line 100 of file bdt_read_paf.c.
Referenced by bdt_init_new_base(), bdt_new_shedule(), bdt_read_paf(), check_the_reference(), clean_list_of_unk(), contrainte_extract(), contrainte_sort(), contrainte_to_matrix_ligne(), create_pointer_to_array_stub_points_to(), create_private_integer_variable_for_new_module(), create_private_variable_for_new_module(), do_symbolic_tiling(), expression_to_transformer(), expression_try_find_size(), find_bd_call(), find_bd_expression(), find_bd_parameter(), find_bd_reference(), find_bd_type_variable(), find_or_create_scalar_entity(), find_or_create_typed_entity(), hpfc_algorithm_row_echelon(), hpfc_fclose(), hpfc_fopen(), make_array_entity(), make_bound_expression(), make_list_of_unk(), make_new_reduction_function(), make_packing_function(), make_primal(), make_reduction_function(), make_reduction_vector_entity(), make_scalar_entity(), MakeFileName(), new_ecrit_ligne(), pip_solve(), position_in_the_area(), rank_of_variable(), region_to_com_nest(), region_to_loop_nest(), reorganize_bdt(), sc_of_constrs(), sc_of_rays(), scanning_base_to_vect(), search_higher_rank(), search_var_of_higher_rank(), set_sort_context(), sg_of_constrs(), sg_of_rays(), sort_entities_with_dep(), terapix_init_row(), variable_of_rank(), vecteur_of_zvec(), and zmat_set_row().
|
extern |
cproto-generated files
cproto-generated files
The "dfg" global variable is the current DFG being computed. Its type is defined in graph.h and paf_ri.h.
Definition at line 138 of file adg_read_paf.c.
Referenced by adg_read_paf(), init_new_dfg(), new_df_sink_ins(), and scheduling().
|
extern |
The "loop_list" global variable is the list the loops of the program (with all their characteristics: index, bounds, step).
The loop type is "loop" defined in ri.h.
Definition at line 150 of file adg_read_paf.c.
Referenced by adg_read_paf(), find_loop_with_name(), and finish_new_do_loop().
|
extern |
The "stmt_list" global variable is the list the assign statement of the program (with all fields empty but two: ordering (the number of the statement) and comments (the string name of the statement)).
Definition at line 144 of file adg_read_paf.c.
Referenced by adg_read_paf(), find_stmt_with_num(), init_new_df_source(), loop_normalize_of_loop(), and new_df_sink_ins().