PIPS
|
#include <stdio.h>
#include <string.h>
#include "genC.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "ray_dte.h"
#include "sommet.h"
#include "sg.h"
#include "sc.h"
#include "polyedre.h"
#include "matrix.h"
#include "linear.h"
#include "ri.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "constants.h"
#include "paf_ri.h"
#include "graph.h"
#include "dg.h"
#include "text.h"
#include "text-util.h"
#include "misc.h"
#include "paf-util.h"
#include "static_controlize.h"
Go to the source code of this file.
Macros | |
#define | STRING_FOUR_OPERATION_P(s) |
Macro functions. More... | |
#define | ENTITY_FOUR_OPERATION_P(s) (ENTITY_PLUS_P(s) || ENTITY_MINUS_P(s) || ENTITY_MULTIPLY_P(s) || ENTITY_DIVIDE_P(s)) |
#define | MINMAX_REF_NAME "MMREF" |
Typedefs | |
typedef dfg_arc_label | arc_label |
Name : utils.c Package : paf-util Author : Alexis Platonoff Date : july 1993. More... | |
typedef dfg_vertex_label | vertex_label |
Functions | |
statement_mapping | get_current_stco_map (void) |
======================================================================== More... | |
void | pu_matrices_to_contraintes (Pcontrainte *pc, Pbase b, matrice A, matrice B, int n, int m) |
Global variables More... | |
void | pu_contraintes_to_matrices (Pcontrainte pc, Pbase b, matrice A, matrice B, int n, int m) |
=========================================================================== More... | |
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. More... | |
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) |
vertex | in_dfg_vertex_list (list l, vertex v) |
=========================================================================== More... | |
vertex | in_dg_vertex_list (list l, vertex v) |
====================================================================== More... | |
expression | make_id_expression (string s) |
=========================================================================== More... | |
expression | make_array_ref (list l) |
=========================================================================== More... | |
expression | make_func_op (string func_name, list args) |
=========================================================================== More... | |
expression | lisp_exp_to_ri_exp (lisp_expression le) |
=========================================================================== More... | |
expression | negate_expression (expression exp) |
=========================================================================== More... | |
predicate | expressions_to_predicate (list exp_l) |
=========================================================================== More... | |
int | vertex_int_stmt (vertex v) |
=========================================================================== More... | |
void | comp_exec_domain (graph g, hash_table STS) |
=========================================================================== More... | |
Psysteme | make_expression_equalities (list le) |
=========================================================================== More... | |
static list | find_el_with_num (int stmt) |
=========================================================================== More... | |
Pbase | make_base_of_nest (int stmt) |
=========================================================================== More... | |
successor | first_succ_of_vertex (vertex v) |
=========================================================================== More... | |
dataflow | first_df_of_succ (successor s) |
=========================================================================== More... | |
loop | loop_dup (loop l) |
=========================================================================== More... | |
list | static_control_to_indices (static_control stct) |
package mapping : Alexis Platonoff, july 1993 More... | |
Pvecteur | polynome_to_vecteur (Ppolynome pp) |
======================================================================== More... | |
Pcontrainte | polynome_to_contrainte (Ppolynome pp) |
======================================================================== More... | |
Psysteme | old_polynome_to_sc (Ppolynome pp, list l) |
=========================================================================== More... | |
Psysteme | polynome_to_sc (Ppolynome pp, list l) |
=========================================================================== More... | |
void | substitute_var_with_vec (Psysteme ps, entity var, Value val, Pvecteur vec) |
=========================================================================== More... | |
bool | is_entity_in_list_p (entity e, list l) |
=========================================================================== More... | |
Psysteme | elim_var_with_eg (Psysteme ps, list *init_l, list *elim_l) |
=========================================================================== More... | |
Psysteme | better_elim_var_with_eg (Psysteme ps, list *init_l, list *elim_l) |
=========================================================================== More... | |
bool | single_var_vecteur_p (Pvecteur pv) |
=========================================================================== More... | |
list | vecteur_to_list (Pvecteur v) |
=========================================================================== More... | |
Ppolynome | old_vecteur_to_polynome (Pvecteur vec) |
=========================================================================== More... | |
list | meld (list l1, list l2, bool(*compare_obj)()) |
=========================================================================== More... | |
static int | compare_objects (gen_chunk **p1, gen_chunk **p2) |
list | new_general_merge_sort (list l, bool(*compare_obj)()) |
no way validate Prgm_mapping with this function... More... | |
list | general_merge_sort (list l, bool(*compare_obj)()) |
I guess there is some kind of memory leaks here... More... | |
expression | rational_op_exp (string op_name, expression exp1, expression exp2) |
======================================================================== More... | |
Pvecteur | vect_var_subst (Pvecteur vect, Variable var, Pvecteur new_vect) |
================================================================= More... | |
Ppolynome | prototype_var_subst (Ppolynome pp, Variable var, Ppolynome ppsubst) |
================================================================= More... | |
Ppolynome | vecteur_mult (Pvecteur v1, Pvecteur v2) |
======================================================================== More... | |
Pvecteur | prototype_factorize (Ppolynome pp, Variable var) |
======================================================================== More... | |
Pcontrainte | simplify_minmax_contrainte (Pcontrainte pc, Psysteme ps_cont, int min_or_max) |
================================================================== More... | |
list | vectors_to_expressions (Pcontrainte pc) |
================================================================= More... | |
Pcontrainte | expressions_to_vectors (list lexp) |
================================================================= More... | |
list | simplify_minmax (list lexp, Psysteme ps_cont, int min_or_max) |
================================================================= More... | |
Psysteme | find_implicit_equation (Psysteme ps) |
======================================================================== More... | |
void | set_current_stco_map (statement_mapping scm) |
======================================================================== More... | |
void | reset_current_stco_map (void) |
======================================================================== More... | |
static_control | get_stco_from_current_map (statement s) |
======================================================================== More... | |
expression | make_rational_exp (Pvecteur v, Value d) |
===================================================================== More... | |
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. More... | |
Variables | |
static bool(* | bool_compare_objects )() |
=========================================================================== More... | |
static statement_mapping | current_stco_map = hash_table_undefined |
These three functions respectively initialize, return and reset the static map of the static control on the statements. More... | |
#define ENTITY_FOUR_OPERATION_P | ( | s | ) | (ENTITY_PLUS_P(s) || ENTITY_MINUS_P(s) || ENTITY_MULTIPLY_P(s) || ENTITY_DIVIDE_P(s)) |
#define STRING_FOUR_OPERATION_P | ( | s | ) |
Macro functions.
typedef dfg_arc_label arc_label |
Name : utils.c Package : paf-util Author : Alexis Platonoff Date : july 1993.
Historic :
Documents:
Comments : This file contains useful functions used for the computation of paf_ri. Ansi includes
include <varargs.h> (not ANSI but SUN:-) Newgen includes
C3 includes
Pips includes
typedef dfg_vertex_label vertex_label |
===========================================================================
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.
Definition at line 1712 of file utils.c.
References bool_compare_objects.
Referenced by new_general_merge_sort().
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().
===========================================================================
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().
===========================================================================
static list find_el_with_num(int stmt): returns the englobing loops list corresponding to the statement number "stmt".
This function uses an hash table, which contains the static_control associated to each statement.
Definition at line 964 of file utils.c.
References get_current_stco_map(), hash_get(), and static_control_loops.
Referenced by make_base_of_nest().
========================================================================
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().
===========================================================================
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().
I guess there is some kind of memory leaks here...
I tried the one above, but I could not go thru the validation...
FC 02/01/94
First step
current sublist containing sorted objects
tail of "ch"
Current sublist stops here, we put it in our LIFO queue and ...
... we reinitialize our current sublist.
Else, current sublist increases.
The last current sublist is put in our LIFO queue.
Second step
Definition at line 1748 of file utils.c.
References CAR, CDR, CHUNK, CONS, CONSP, ENDP, meld(), NIL, pips_debug, and POP.
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 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.
===========================================================================
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().
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().
===========================================================================
list meld(list l1, list l2, bool (*compare_obj)()):
Definition at line 1665 of file utils.c.
References CAR, CDR, CHUNK, CONS, ENDP, gen_nconc(), and NIL.
Referenced by general_merge_sort().
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().
no way validate Prgm_mapping with this function...
push
sort
pop
Definition at line 1720 of file utils.c.
References bool_compare_objects, compare_objects(), current, gen_copy_seq(), and gen_sort_list().
===========================================================================
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().
Global variables
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().
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 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().
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 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().
=================================================================
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().
========================================================================
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().
|
static |
===========================================================================
list general_merge_sort(list l, bool (*compare_obj)()): returns the result of sorting the list "l" using the comparison function "compare_obj". This bool function should retuns true if its first argument has to be placed before its second argument in the sorted list, else FALSE.
This is a generic function that accepts any homogene list of newgen objects. The comparison function must be coded by the user, its prototype should be: bool my_compare_obj(chunk * obj1, chunk * obj2);
This function uses the merge sort algorithm which has a mean and worst case complexity of n*log(n). There are two steps. First, we look for sublists that are in the right order, each time we found one we put it in a list of lists, a LIFO queue ("head" is the out point, "tail" is the in point). Second, we take the first two lists of our LIFO queue (i.e. at the "head") and meld then into one list that we put again in our LIFO (i.e. at the "tail"). We continue until there remains only one list in our LIFO queue, which in that case is the sorted list we wanted. hack to preserve the bool comparison while using qsort...
Definition at line 1711 of file utils.c.
Referenced by compare_objects(), and new_general_merge_sort().
|
static |
These three functions respectively initialize, return and reset the static map of the static control on the statements.
Definition at line 2405 of file utils.c.
Referenced by get_current_stco_map(), reset_current_stco_map(), and set_current_stco_map().