PIPS
paf-util.h File Reference
#include "matrix.h"
#include "matrice.h"
+ Include dependency graph for paf-util.h:
+ This graph shows which files directly or indirectly include this file:

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...
 

Macro Definition Documentation

◆ ADD_ELEMENT_TO_LIST

#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.

◆ BASE_NODE_NUMBER

#define BASE_NODE_NUMBER   1000

Definition at line 53 of file paf-util.h.

◆ COEFF_PREFIX

#define COEFF_PREFIX   "COEFF"

Definition at line 45 of file paf-util.h.

◆ DFG_MODULE_NAME

#define DFG_MODULE_NAME   "DFG"

Definition at line 42 of file paf-util.h.

◆ DIFF_PREFIX

#define DIFF_PREFIX   "DIFF"

Definition at line 44 of file paf-util.h.

◆ IS_MAX

#define IS_MAX   1

Definition at line 39 of file paf-util.h.

◆ IS_MIN

#define IS_MIN   0

Definition at line 38 of file paf-util.h.

◆ MAPPING_MODULE_NAME

#define MAPPING_MODULE_NAME   "MAPPING"

Definition at line 43 of file paf-util.h.

◆ NEGATIVE

#define NEGATIVE   0

Definition at line 48 of file paf-util.h.

◆ PAF_UTIL_MODULE_NAME

#define PAF_UTIL_MODULE_NAME   "PAFUTIL"

Definition at line 41 of file paf-util.h.

◆ PIP_SOLVE_MAX

#define PIP_SOLVE_MAX   1

Definition at line 36 of file paf-util.h.

◆ PIP_SOLVE_MIN

#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.

◆ POSITIVE

#define POSITIVE   1

Definition at line 47 of file paf-util.h.

Function Documentation

◆ adg_read_paf()

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.

200 {
201  extern list loop_list, stmt_list;
202 
203  FILE *paf_file;
204  char *paf_file_name;
205 
206  loop_list = NIL;
207  stmt_list = NIL;
208 
210 
211  paf_file_name = strdup(concatenate(s, DOT, PAF_STRING, (char *) NULL));
212 
213  if( (paf_file = fopen(paf_file_name, "r")) == NULL)
214  {
215  fprintf(stderr, "Cannot open file %s\n", paf_file_name);
216  exit(1);
217  }
218 
219 #if defined(HAS_ADGYY)
220 
221  adgyyin = paf_file;
222  (void) adgyyparse();
223 
224 #else
225 
226  pips_internal_error("not adgyy{in,parse} compiled in (HAS_ADGYY undef)");
227 
228 #endif
229 
230  fclose(paf_file);
231 
233 
234  return(dfg);
235 }
list stmt_list
The "stmt_list" global variable is the list the assign statement of the program (with all fields empt...
Definition: adg_read_paf.c:144
#define PAF_STRING
Definition: adg_read_paf.c:129
list loop_list
The "loop_list" global variable is the list the loops of the program (with all their characteristics:...
Definition: adg_read_paf.c:150
#define STMT_TO_STCT_SIZE
Definition: adg_read_paf.c:131
#define DOT
include "paf_ri.h"
Definition: adg_read_paf.c:128
static hash_table STS
The "STS" global variable is the hash table that maps the static_control on the statements.
Definition: adg_read_paf.c:155
graph dfg
Global variables
Definition: adg_read_paf.c:138
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
#define pips_internal_error
Definition: misc-local.h:149
#define exit(code)
Definition: misc-local.h:54
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
@ hash_int
Definition: newgen_hash.h:32
void set_current_stco_map(statement_mapping)
========================================================================
Definition: utils.c:2408
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

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.

+ Here is the call graph for this function:

◆ bdt_elim_last_pred()

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.

313 {
314  extern list pred_l;
315 
316  pred_l = CDR(pred_l);
317 }
static list pred_l
Current stmt (an integer)
Definition: bdt_read_paf.c:90
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111

References CDR, and pred_l.

◆ bdt_init_new_base()

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.

208 {
209  extern bdt base;
210 
211  base = make_bdt(NIL);
212 }
bdt make_bdt(list a)
Definition: paf_ri.c:54
bdt base
Current expression.
Definition: bdt_read_paf.c:100

References base, make_bdt(), and NIL.

+ Here is the call graph for this function:

◆ bdt_init_new_ins()

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.

Parameters
s_ins_ins

Definition at line 221 of file bdt_read_paf.c.

223 {
224  extern int crt_ins;
225  extern list pred_l, lin_exp_l;
226 
227  /* In PAF, a statement name is a string "ins_#", where "#" is the number
228  * associated with the statement. We get this number.
229  */
230  crt_ins = atoi(strdup(s_ins + INS_NAME_LENGTH));
231 
232  pred_l = NIL;
233  lin_exp_l = NIL;
234 }
static int crt_ins
Static global variables.
Definition: bdt_read_paf.c:89
#define INS_NAME_LENGTH
Definition: bdt_read_paf.c:83
static list lin_exp_l
Current list of predicates.
Definition: bdt_read_paf.c:91

References crt_ins, INS_NAME_LENGTH, lin_exp_l, NIL, pred_l, and strdup().

+ Here is the call graph for this function:

◆ bdt_init_op_exp()

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".

Parameters
op_namep_name

Definition at line 379 of file bdt_read_paf.c.

381 {
382  extern list lin_exp_l;
383 
385 }
lisp_expression make_lisp_expression(string a1, list a2)
Definition: paf_ri.c:348
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
#define LISP_EXPRESSION(x)
LISP_EXPRESSION.
Definition: paf_ri.h:457

References CONS, lin_exp_l, LISP_EXPRESSION, make_lisp_expression(), and NIL.

+ Here is the call graph for this function:

◆ bdt_new_shedule()

void bdt_new_shedule ( string  )

◆ bdt_read_paf()

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.

112 {
113  extern bdt base;
114 
115  FILE *bdt_file;
116  char *bdt_file_name;
117 
118  bdt_file_name = strdup(concatenate(s, DOT, BDT_STRING, (char *) NULL));
119 
120  if( (bdt_file = fopen(bdt_file_name, "r")) == NULL)
121  {
122  fprintf(stderr, "Cannot open file %s\n", bdt_file_name);
123  exit(1);
124  }
125 
126 #if defined(HAS_BDTYY)
127 
128  bdtyyin = bdt_file;
129  (void) bdtyyparse();
130 
131 #else
132 
133  pips_internal_error("not bdtyy{in,parse} compiled in (HAS_BDTYY undef)");
134 
135 #endif
136 
137  fclose(bdt_file);
138 
140 
141  return(base);
142 }
#define BDT_STRING
Definition: bdt_read_paf.c:85
void reorganize_bdt(bdt base)
===========================================================================
Definition: bdt_read_paf.c:171
#define DOT
Definition: bdt_read_paf.c:84

References base, BDT_STRING, concatenate(), DOT, exit, fprintf(), pips_internal_error, reorganize_bdt(), and strdup().

+ Here is the call graph for this function:

◆ bdt_save_exp()

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.

396 {
397  extern expression crt_exp;
398 
399  expression aux_exp;
400  lisp_expression aux_le;
401 
402  aux_le = LISP_EXPRESSION(CAR(lin_exp_l));
403  aux_exp = lisp_exp_to_ri_exp(aux_le);
404 
406 
407  if(lin_exp_l == NIL)
408  crt_exp = aux_exp;
409  else
410  {
413  CONS(EXPRESSION, aux_exp, NIL));
414  }
415 }
static expression crt_exp
Current list of linear expressions.
Definition: bdt_read_paf.c:92
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
expression lisp_exp_to_ri_exp(lisp_expression)
===========================================================================
Definition: utils.c:755
#define lisp_expression_args(x)
Definition: paf_ri.h:489
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217

References CAR, CDR, CONS, crt_exp, EXPRESSION, gen_nconc(), lin_exp_l, lisp_exp_to_ri_exp(), LISP_EXPRESSION, lisp_expression_args, and NIL.

+ Here is the call graph for this function:

◆ bdt_save_id()

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.

354 {
355  extern list lin_exp_l;
356  extern expression crt_exp;
357  expression aux_exp;
358 
359  aux_exp = make_id_expression(s);
360 
361  if(lin_exp_l == NIL)
362  crt_exp = aux_exp;
363  else
364  {
367  CONS(EXPRESSION, aux_exp, NIL));
368  }
369 }
expression make_id_expression(string)
===========================================================================
Definition: utils.c:672

References CAR, CONS, crt_exp, EXPRESSION, gen_nconc(), lin_exp_l, LISP_EXPRESSION, lisp_expression_args, make_id_expression(), and NIL.

+ Here is the call graph for this function:

◆ bdt_save_int()

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.

328 {
329  extern list lin_exp_l;
330  extern expression crt_exp;
331  expression aux_exp;
332 
333  aux_exp = int_to_expression(i);
334 
335  if(lin_exp_l == NIL)
336  crt_exp = aux_exp;
337  else
338  {
341  CONS(EXPRESSION, aux_exp, NIL));
342  }
343 }
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188

References CAR, CONS, crt_exp, EXPRESSION, gen_nconc(), int_to_expression(), lin_exp_l, LISP_EXPRESSION, lisp_expression_args, and NIL.

+ Here is the call graph for this function:

◆ bdt_save_pred()

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

Parameters
optionption

Definition at line 277 of file bdt_read_paf.c.

279 {
280  extern list pred_l, lin_exp_l;
281  extern expression crt_exp;
282 
283  expression aux_pred;
284 
285  if(option == POSITIVE)
286  {
288  pips_internal_error("current expression is undefined");
289 
292  }
293  else
294  /* option == NEGATIVE */
295  {
296  aux_pred = make_op_exp(PLUS_OPERATOR_NAME,
298  int_to_expression(1));
299 
300  pred_l = CONS(EXPRESSION, aux_pred, CDR(pred_l));
301  }
302 
303 /* Initialization of global variables */
304  lin_exp_l = NIL;
305 }
#define POSITIVE
Definition: bdt_read_paf.c:81
expression negate_expression(expression)
===========================================================================
Definition: utils.c:792
#define PLUS_OPERATOR_NAME
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
Definition: expression.c:2012
#define expression_undefined
Definition: ri.h:1223

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.

+ Here is the call graph for this function:

◆ better_elim_var_with_eg()

Psysteme better_elim_var_with_eg ( Psysteme  ps,
list init_l,
list elim_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.

Algo:

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().

Parameters
pss
init_lnit_l
elim_llim_l

Definition at line 1537 of file utils.c.

1540 {
1541  Psysteme sc_elim = sc_new();
1542 
1543  /* During the computation, we modify *init_l, so we duplicate it.
1544  * We use "el" not *elim_l, which should be empty at the beginning.
1545  */
1546  list vl = gen_append(*init_l, NIL),
1547  el = NIL,
1548  l;
1549  Pcontrainte eq, eg;
1550 
1551  for(l = vl; !ENDP(l); POP(l)) {
1552  Variable v = (Variable) ENTITY(CAR(l));
1553  Value coeff;
1554 
1555  if ((eq = contrainte_var_min_coeff(ps->egalites,v, &coeff, true))
1556  != NULL) {
1557 
1558  if(get_debug_level() > 7) {
1559 fprintf(stderr, "System is :");
1560 fprint_psysteme(stderr, ps);
1561 fprintf(stderr, "\t\tElim var %s in equation:", entity_local_name((entity) v));
1562 pu_vect_fprint(stderr, eq->vecteur);
1563 fprintf(stderr, "\n");
1564  }
1565 
1566  if(!egalite_normalize(eq))
1567  pips_internal_error("Strange equality");
1568 
1569  sc_nbre_egalites(ps)--;
1570  if (eq == (ps->egalites)) ps->egalites = eq->succ;
1571  /* si eq etait en tete il faut l'enlever de la liste, sinon, eq a
1572  ete enleve par la fonction contrainte_var_min_coeff(). */
1573 
1574  for(eg = ps->egalites; eg != NULL; eg = eg->succ)
1575  (void) contrainte_subst_ofl_ctrl(v, eq, eg, true, NO_OFL_CTRL);
1576  for(eg = ps->inegalites; eg != NULL; eg = eg->succ)
1577  (void) contrainte_subst_ofl_ctrl(v, eq, eg, false, NO_OFL_CTRL);
1578 
1579  for(eg = sc_elim->egalites; eg != NULL; eg = eg->succ)
1580  (void) contrainte_subst_ofl_ctrl(v, eq, eg, true, NO_OFL_CTRL);
1581  for(eg = sc_elim->inegalites; eg != NULL; eg = eg->succ)
1582  (void) contrainte_subst_ofl_ctrl(v, eq, eg, false, NO_OFL_CTRL);
1583 
1584  sc_add_egalite(sc_elim, eq);
1585  gen_remove(init_l, (void *) v);
1586  el = CONS(ENTITY, (entity) v, el);
1587  }
1588  }
1589 
1590  *elim_l = el;
1591  sc_elim->base = NULL;
1592  sc_creer_base(sc_elim);
1593 
1594  ifdebug(7) {
1595 fprintf(stderr, "[new_elim_var_with_eg] Results:\n");
1596 fprintf(stderr, "Elim sys:\n");
1597 fprint_entity_list(stderr, el);
1598 fprint_psysteme(stderr, sc_elim);
1599 fprintf(stderr, "Remnants sys:\n");
1600 fprint_entity_list(stderr, *init_l);
1601 fprint_psysteme(stderr, ps);
1602 fprintf(stderr, "\n");
1603  }
1604 
1605  return(sc_elim);
1606 }
int Value
int contrainte_subst_ofl_ctrl(Variable v, Pcontrainte def, Pcontrainte c, bool eq_p, int ofl_ctrl)
int contrainte_subst_ofl_ctrl(Variable v, Pcontrainte def, Pcontrainte c Boolean eq_p,...
Definition: binaires.c:107
Pcontrainte contrainte_var_min_coeff(Pcontrainte, Variable, Value *, bool)
Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list ...
Definition: unaires.c:345
bool egalite_normalize(Pcontrainte)
bool egalite_normalize(Pcontrainte eg): reduction d'une equation diophantienne par le pgcd de ses coe...
Definition: normalize.c:136
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
list gen_append(list l1, const list l2)
Definition: list.c:471
void fprint_entity_list(FILE *fp, list l)
void fprint_entity_list(FILE *fp,list l): prints a list of entities on file fp.
Definition: entity.c:3188
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
void pu_vect_fprint(FILE *, Pvecteur)
===========================================================================
Definition: print.c:446
void fprint_psysteme(FILE *, Psysteme)
===========================================================================
Definition: print.c:302
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Definition: sc_alloc.c:389
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
#define ifdebug(n)
Definition: sg.c:47
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
Pcontrainte egalites
Definition: sc-local.h:70
Pbase base
Definition: sc-local.h:75
#define NO_OFL_CTRL
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60

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.

+ Here is the call graph for this function:

◆ comp_exec_domain()

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));

Parameters
STSTS

Definition at line 877 of file utils.c.

880 {
881  int stmt;
882  list loop_l, dfg_edge_l;
883 
884  /* We update the graph global variable with the exec domain. */
885  dfg_edge_l = graph_vertices(g);
886  for(; dfg_edge_l != NIL; dfg_edge_l = CDR(dfg_edge_l)) {
887  vertex v = VERTEX(CAR(dfg_edge_l));
888  dfg_vertex_label dvl;
889  Psysteme new_sc = sc_new();
890 
892  stmt = vertex_int_stmt(v);
894  (char *) ((long)stmt)));
895 
896  for( ; loop_l != NIL; loop_l = CDR(loop_l))
897  {
898  Pvecteur vect_index, vect;
899  normalized nub, nlb;
900  /* loop aux_loop = ENTITY(CAR(loop_l)); */
901  loop aux_loop = LOOP(CAR(loop_l));
902  entity index_ent = loop_index(aux_loop);
903 
904  vect_index = vect_new((char *) index_ent, VALUE_ONE);
905  nlb = NORMALIZE_EXPRESSION(range_lower(loop_range(aux_loop)));
906  nub = NORMALIZE_EXPRESSION(range_upper(loop_range(aux_loop)));
907 
908  if (normalized_linear_p(nlb))
909  {
910  vect = vect_substract((Pvecteur) normalized_linear(nlb), vect_index);
911  if(!VECTEUR_NUL_P(vect))
912  sc_add_inegalite(new_sc, contrainte_make(vect));
913  }
914  if (normalized_linear_p(nub))
915  {
916  vect = vect_substract(vect_index, (Pvecteur) normalized_linear(nub));
917  if(!VECTEUR_NUL_P(vect))
918  sc_add_inegalite(new_sc, contrainte_make(vect));
919  }
920  }
921  sc_creer_base(new_sc);
922 
924  }
925 }
predicate make_predicate(Psysteme a1)
Definition: ri.c:1820
#define VALUE_ONE
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
#define vertex_vertex_label(x)
Definition: graph.h:152
#define graph_vertices(x)
Definition: graph.h:82
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
int vertex_int_stmt(vertex v)
===========================================================================
Definition: utils.c:866
#define static_control_loops(x)
Definition: paf_ri.h:757
struct _newgen_struct_dfg_vertex_label_ * dfg_vertex_label
Definition: paf_ri.h:112
#define dfg_vertex_label_exec_domain(x)
Definition: paf_ri.h:415
#define NORMALIZE_EXPRESSION(e)
#define LOOP(x)
LOOP.
Definition: ri.h:1606
#define normalized_linear_p(x)
Definition: ri.h:1779
#define range_upper(x)
Definition: ri.h:2290
#define range_lower(x)
Definition: ri.h:2288
#define loop_range(x)
Definition: ri.h:1642
#define normalized_linear(x)
Definition: ri.h:1781
#define loop_index(x)
Definition: ri.h:1640
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Definition: statement.c:54
#define VECTEUR_NUL_P(v)
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
Definition: binaires.c:75

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.

+ Here is the call graph for this function:

◆ contraintes_with_sym_cst_to_matrices()

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

Parameters
pcc
index_basendex_base
const_baseonst_base
m11
m22

Definition at line 446 of file utils.c.

452 {
453 
454  int i,j;
455  Pcontrainte eq;
456  Pvecteur pv;
457 
458  matrice_nulle(B,n,m2);
459  matrice_nulle(A,n,m1);
460 
461  for (eq = pc,i=1; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,i++) {
462  for(pv = index_base, j=1; pv != NULL; pv = pv->succ, j++){
463  ACCESS(A,n,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur);
464  }
465  for(pv = const_base, j=1; pv != NULL; pv = pv->succ, j++){
466  ACCESS(B,n,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur);
467  }
468  ACCESS(B,n,i,m2) = vect_coeff(TCST,eq->vecteur);
469  }
470 
471 }
#define CONTRAINTE_UNDEFINED_P(c)
#define B(A)
Definition: iabrev.h:61
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrice-local.h:86
void matrice_nulle(matrice Z, int n, int m)
void matrice_nulle(matrice Z, int n, int m): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrice.c:311
Definition: pip__tab.h:25
struct Svecteur * succ
Definition: vecteur-local.h:92
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define vecteur_var(v)
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ elim_last_pred()

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.

486 {
487  pred_l = CDR(pred_l);
488 }
static list pred_l
Current list of linear expressions.
Definition: adg_read_paf.c:171

References CDR, and pred_l.

◆ elim_var_with_eg()

Psysteme elim_var_with_eg ( Psysteme  ps,
list init_l,
list elim_l 
)

===========================================================================

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.

Algo:

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.

Parameters
pss
init_lnit_l
elim_llim_l

Definition at line 1361 of file utils.c.

1362 {
1363  Psysteme sc_elim = sc_new();
1364  Pcontrainte eqs;
1365  list vl = *init_l, /* We use "vl" during the computation, not *init_l */
1366  el = NIL, /* We use "el" during the computation, not *elim_l */
1367  l;
1368 
1369  /* Nothing do if there is no variable to eliminate */
1370  if(!ENDP(vl)) {
1371  /* This elimination works only on equalities. While there remains
1372  * equalities, we can eliminate variables. */
1373  eqs = ps->egalites;
1374  while(eqs != NULL)
1375  {
1376  bool coeff_one_not_found, var_found;
1377  entity var = entity_undefined;
1378  Value val = VALUE_ZERO;
1379  Pvecteur init_vec, pv_elim;
1380  Pcontrainte next = eqs->succ;
1381 
1382  init_vec = vect_dup(eqs->vecteur);
1383 
1384  /* We look, in vl (i.e. init_l), for a variable that we can
1385  * eliminate in init_vec, i.e. with a coefficient not equal to
1386  * 0. We prefer a coefficient * equal to 1 or -1, so we scan
1387  * all the equality. We take the first * variable of "init_l"
1388  * that has a coeff of 1 or -1. If there is no such *
1389  * variable, we take the first with a coeff not equal to zero.
1390  */
1391  var_found = false;
1392  coeff_one_not_found = true;
1393 
1394  for(l = vl ; (l != NIL) && coeff_one_not_found; l = CDR(l))
1395  {
1396  entity crt_var = ENTITY(CAR(l));
1397  Value crt_val = vect_coeff((Variable) crt_var, init_vec);
1398 
1399  if(value_one_p(crt_val) || value_mone_p(crt_val))
1400  {
1401  coeff_one_not_found = false;
1402  var_found = true;
1403  var = crt_var;
1404  val = crt_val;
1405  }
1406  else if((value_notzero_p(crt_val)) && !var_found)
1407  {
1408  var_found = true;
1409  var = crt_var;
1410  val = crt_val;
1411  }
1412  }
1413 
1414  if(var_found) /* If we get such a variable, we eliminate it. */
1415  {
1416  /* First, we remove it from "vl". */
1417  gen_remove(&vl, (void *) var);
1418 
1419  /* Then, we add it to "el". */
1420  el = CONS(ENTITY, var, el);
1421 
1422  /* We compute the expression (pv_elim) by which we are
1423  * going to substitute our variable (var):
1424  *
1425  * We have: val*var = pv_elim
1426  *
1427  * The equality is: V = 0, with: V = val*var + Vaux
1428  *
1429  * So, we have: pv_elim = -Vaux, with: Vaux = V - val*var
1430  *
1431  * So: pv_elim = val*var - V
1432  *
1433  * ??? memory leak...
1434  */
1435  pv_elim = vect_cl2_ofl_ctrl
1436  (VALUE_MONE, vect_dup(init_vec),
1437  VALUE_ONE, vect_new((Variable) var, val),
1438  NO_OFL_CTRL);
1439 
1440  /* substitute "val*var" by its value (pv_elim) in the system */
1441  substitute_var_with_vec(ps, var, val, vect_dup(pv_elim));
1442  /*ps = sc_normalize(ps);*/
1443  ps = sc_elim_db_constraints(ps);
1444 
1445  /* We substitute var by its value (pv_elim) in "sc_elim". */
1446  substitute_var_with_vec(sc_elim, var, val, vect_dup(pv_elim));
1447 
1448  /* The initial equality is added to "sc_elim". */
1449  sc_add_egalite(sc_elim, contrainte_make(vect_dup(init_vec)));
1450 
1451  /* We reinitialize the list of equalities. */
1452  eqs = ps->egalites;
1453  }
1454  /* Else, we try on the next equality. */
1455  else
1456  eqs = next;
1457 
1458  vect_rm(init_vec);
1459  }
1460  }
1461  *init_l = vl;
1462  *elim_l = el;
1463  sc_elim->base = NULL;
1464  sc_creer_base(sc_elim);
1465 
1466  return(sc_elim);
1467 }
#define VALUE_ZERO
#define value_mone_p(val)
#define value_notzero_p(val)
#define value_one_p(val)
#define VALUE_MONE
void substitute_var_with_vec(Psysteme ps, entity var, Value val, Pvecteur vec)
===========================================================================
Definition: utils.c:1210
#define entity_undefined
Definition: ri.h:2761
Psysteme sc_elim_db_constraints(Psysteme ps)
Psysteme sc_elim_db_constraints(Psysteme ps): elimination des egalites et des inegalites identiques o...
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78
Pvecteur vect_cl2_ofl_ctrl(Value x1, Pvecteur v1, Value x2, Pvecteur v2, int ofl_ctrl)
Pvecteur vect_cl2_ofl(Value x1, Pvecteur v1, Value x2, Pvecteur v2): allocation d'un vecteur v dont l...
Definition: binaires.c:204

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expressions_to_predicate()

predicate expressions_to_predicate ( list  exp_l)

===========================================================================

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.

Parameters
exp_lxp_l

Definition at line 826 of file utils.c.

828 {
829  predicate new_pred;
830  Psysteme new_sc;
831  list l;
832 
833  if(exp_l == NIL)
834  return(predicate_undefined);
835 
836  new_sc = sc_new();
837 
838  for(l = exp_l; l != NIL; l = CDR(l))
839  {
842 
843  if(normalized_linear_p(nexp))
844  {
845  Pvecteur new_vec = (Pvecteur) normalized_linear(nexp);
846  sc_add_inegalite(new_sc, contrainte_make(new_vec));
847  }
848  else
849  {
850  printf("\nNon linear expression :");
851  printf(" %s\n", expression_to_string(exp));
852  }
853  }
854 
855  sc_creer_base(new_sc);
856  new_pred = make_predicate(new_sc);
857 
858  return(new_pred);
859 }
string expression_to_string(expression e)
Definition: expression.c:77
#define predicate_undefined
Definition: ri.h:2046
int printf()
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
struct Svecteur * Pvecteur

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expressions_to_vectors()

Pcontrainte expressions_to_vectors ( list  lexp)

=================================================================

Parameters
lexpexp

Definition at line 2260 of file utils.c.

2262 {
2263  list ll;
2265 
2266  for(ll = lexp; !ENDP(ll); POP(ll)){
2267  Pvecteur pv;
2268  expression cexp = EXPRESSION(CAR(ll));
2269  normalized cnor;
2270 
2271  cnor = NORMALIZE_EXPRESSION(cexp);
2273  pips_internal_error("Expressions MUST be linear");
2274 
2275  pv = (Pvecteur) normalized_linear(cnor);
2276 
2277  if(CONTRAINTE_UNDEFINED_P(pc)) {
2278  pc = contrainte_make(pv);
2279  epc = pc;
2280  }
2281  else {
2282  Pcontrainte apc = contrainte_make(pv);
2283  epc->succ = apc;
2284  epc = epc->succ;
2285  }
2286  }
2287  return(pc);
2288 }
static list lexp
#define CONTRAINTE_UNDEFINED
#define normalized_tag(x)
Definition: ri.h:1778
@ is_normalized_complex
Definition: ri.h:1761

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_implicit_equation()

Psysteme find_implicit_equation ( Psysteme  ps)

========================================================================

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

Parameters
pss

Definition at line 2350 of file utils.c.

2351 {
2352  Pcontrainte ineg, eg;
2353  Psysteme impl_ps, aux_ps;
2354 
2355  if(ps == NULL)
2356  return(NULL);
2357 
2358  /* We put the equalities of the system in our implicit system. */
2359  impl_ps = sc_new();
2360  for(eg = ps->egalites; eg != NULL; eg = eg->succ)
2361  sc_add_egalite(impl_ps, contrainte_dup(eg));
2362 
2363  /* We duplicate "ps" in order to keep it unchanged. */
2364  aux_ps = sc_dup(ps);
2365 
2366  /* We make the test on each inequality. We count them. */
2367  for(ineg = aux_ps->inegalites; ineg != NULL; ineg = ineg->succ) {
2368  Pvecteur expr;
2369 
2370  /* We replace the original inequality (Expr <= 0) by the modified
2371  * one (Expr + 1 <= 0).
2372  */
2373  expr = ineg->vecteur;
2374  ineg->vecteur = vect_add(expr, vect_new(TCST, VALUE_ONE));
2375 
2376  /* We test the feasibility. If it is not feasible, we add one more
2377  * implicit equation in our implicit system : Expr == 0.
2378  */
2379  if(! sc_rational_feasibility_ofl_ctrl(aux_ps, NO_OFL_CTRL, true)) {
2380  Pcontrainte pc_expr = contrainte_make(expr);
2381 
2382  if(get_debug_level() > 7) {
2383  fprintf(stderr, "Equation implicit : ");
2384  pu_egalite_fprint(stderr, pc_expr, entity_local_name);
2385  fprintf(stderr, "\n");
2386  }
2387  sc_add_egalite(impl_ps, pc_expr);
2388  }
2389 
2390  /* We put the old value back */
2391  ineg->vecteur = expr;
2392  }
2393 
2394  sc_creer_base(impl_ps);
2395  impl_ps = sc_normalize(impl_ps);
2396 
2397  return(impl_ps);
2398 }
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
Definition: alloc.c:132
void pu_egalite_fprint(FILE *, Pcontrainte, const char *(*)(entity))
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finish_new_df_ref()

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.

684 {
685  list aux_l;
686 
688 
689  for(aux_l = crt_node_l; aux_l != NIL; aux_l = CDR(aux_l))
690  {
691  dataflow df;
692 
694  dataflow_reference(df) = ref;
695  }
696 }
static list crt_node_l
Current execution domain.
Definition: adg_read_paf.c:167
static list ref_inds
Current list of transformations.
Definition: adg_read_paf.c:169
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
successor first_succ_of_vertex(vertex)
===========================================================================
Definition: utils.c:994
dataflow first_df_of_succ(successor)
===========================================================================
Definition: utils.c:1004
#define dataflow_reference(x)
Definition: paf_ri.h:340
#define reference_indices(x)
Definition: ri.h:2328

References CAR, CDR, crt_node_l, dataflow_reference, first_df_of_succ(), first_succ_of_vertex(), NIL, ref, ref_inds, reference_indices, and VERTEX.

+ Here is the call graph for this function:

◆ finish_new_df_source()

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.

400 {
401  extern predicate exec_dom;
402 
403  successor source_succ;
404  list crt_df;
405 
408  source_succ = make_successor(make_dfg_arc_label(crt_df),
410 
413  CONS(SUCCESSOR, source_succ, NIL));
414 
416 }
successor make_successor(arc_label a1, vertex a2)
Definition: graph.c:98
vertex make_vertex(vertex_label a1, list a2)
Definition: graph.c:140
dataflow make_dataflow(reference a1, list a2, predicate a3, communication a4)
Definition: paf_ri.c:180
dfg_arc_label make_dfg_arc_label(list a)
Definition: paf_ri.c:222
dfg_vertex_label make_dfg_vertex_label(intptr_t a1, predicate a2, sccflags a3)
Definition: paf_ri.c:264
static vertex crt_node
Internal variables
Definition: adg_read_paf.c:159
static list trans_l
Current list of nodes.
Definition: adg_read_paf.c:168
static int source_stmt
Current sink statement.
Definition: adg_read_paf.c:161
static predicate exec_dom
Current governing predicate.
Definition: adg_read_paf.c:166
static predicate gov_pred
Current expression.
Definition: adg_read_paf.c:165
#define sccflags_undefined
Definition: dg.h:247
#define vertex_undefined
Definition: graph.h:128
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define DATAFLOW(x)
DATAFLOW.
Definition: paf_ri.h:308
#define communication_undefined
Definition: paf_ri.h:236

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.

+ Here is the call graph for this function:

◆ finish_new_do_loop()

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.

852 {
853  extern list loop_list;
854 
856 }
static loop crt_loop
Current operator name.
Definition: adg_read_paf.c:175

References CONS, crt_loop, LOOP, and loop_list.

◆ finish_new_gd_ins()

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.

951 {
952  extern list crt_el, param_l;
953  extern int crt_stmt;
954 
955  list new_el;
956 
957  /* We compute the execution domain (for the dfg) for all sink instructions
958  * named "crt_stmt".
959  comp_exec_domain(dfg, crt_stmt, crt_el);
960  */
961 
962  /* Make a copy to store in the hash table "STS" */
963  new_el = NIL;
964  MAPL(cl, {
965  /* loop l = EFFECT(CAR(cl)); */
966  loop l = LOOP(CAR(cl));
967  loop nl = loop_dup(l);
968  new_el = gen_nconc(new_el, CONS(LOOP, nl, NIL));
969  }, crt_el);
970 
971  /* should be a long int for crt_stmt */
972  hash_put(STS, (void *) ((long)crt_stmt),
973  (void *) make_static_control(true, param_l, new_el, NIL));
974 }
static_control make_static_control(bool a1, list a2, list a3, list a4)
Definition: paf_ri.c:655
static int crt_stmt
Current source statement.
Definition: adg_read_paf.c:162
static list param_l
Current list of englobing loops.
Definition: adg_read_paf.c:173
static list crt_el
Current list of predicates.
Definition: adg_read_paf.c:172
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
loop loop_dup(loop)
===========================================================================
Definition: utils.c:1014

References CAR, CONS, crt_el, crt_stmt, gen_nconc(), hash_put(), LOOP, loop_dup(), make_static_control(), MAPL, NIL, param_l, and STS.

+ Here is the call graph for this function:

◆ first_df_of_succ()

dataflow first_df_of_succ ( successor  s)

===========================================================================

dataflow first_df_of_succ(successor s): returns the first dataflow of "s".

Definition at line 1004 of file utils.c.

1006 {
1008 successor_arc_label(s)))));
1009 }
#define successor_arc_label(x)
Definition: graph.h:116
#define dfg_arc_label_dataflows(x)
Definition: paf_ri.h:378

References CAR, DATAFLOW, dfg_arc_label_dataflows, and successor_arc_label.

Referenced by finish_new_df_ref(), and new_df_gov_pred().

+ Here is the caller graph for this function:

◆ first_succ_of_vertex()

successor first_succ_of_vertex ( vertex  v)

===========================================================================

successor first_succ_of_vertex(vertex v): returns the first successor of "v".

Definition at line 994 of file utils.c.

995 {
996  return(SUCCESSOR(CAR(vertex_successors(v))));
997 }
#define vertex_successors(x)
Definition: graph.h:154

References CAR, SUCCESSOR, and vertex_successors.

Referenced by finish_new_df_ref(), new_df_gov_pred(), and new_df_sink_ins().

+ Here is the caller graph for this function:

◆ fprint_bdt()

void fprint_bdt ( FILE *  fp,
bdt  obj 
)

===========================================================================

PRINT

Mod by AP, oct 6th 199595: the number of the instruction is the vertex number minus BASE_NODE_NUMBER.

Parameters
fpp
objbj

Definition at line 352 of file print.c.

355 {
356  list sched_l;
357 
358  fprintf(fp,"\n Scheduling:\n");
359  fprintf(fp,"============\n");
360 
361  if(obj == bdt_undefined) {
362  fprintf(fp, "\tNot computed\n\n");
363  return;
364  }
365 
366  sched_l = bdt_schedules(obj);
367 
368  for(; sched_l != NIL; sched_l = CDR(sched_l)) {
369  schedule crt_sched;
370  int crt_stmt;
371  list dim_l;
372  predicate crt_pred;
373 
374  crt_sched = SCHEDULE(CAR(sched_l));
375  crt_stmt = schedule_statement(crt_sched);
376  dim_l = schedule_dims(crt_sched);
377  crt_pred = schedule_predicate(crt_sched);
378 
379  /* PRINT */
380  /* Mod by AP, oct 6th 199595: the number of the instruction is the
381  vertex number minus BASE_NODE_NUMBER. */
382  fprintf(fp,"ins_%d:\n", crt_stmt-BASE_NODE_NUMBER);
383 
384  if(crt_pred != predicate_undefined) {
385  Psysteme ps = (Psysteme) predicate_system(crt_pred);
386  Pcontrainte peq;
387 
388  if (ps != NULL) {
389  fprintf(fp,"\t pred: ");
390 
391  for (peq = ps->inegalites; peq!=NULL;
392  pu_inegalite_fprint(fp,peq,entity_local_name),peq=peq->succ);
393 
394  for (peq = ps->egalites; peq!=NULL;
395  pu_egalite_fprint(fp,peq,entity_local_name),peq=peq->succ);
396 
397  fprintf(fp,"\n");
398  }
399  else
400  fprintf(fp, "\t pred: TRUE\n");
401  }
402  else
403  fprintf(fp, "\t pred: TRUE\n");
404 
405  fprintf(fp, "\t dims: ");
406  for(; dim_l != NIL; dim_l = CDR(dim_l)) {
407  expression exp = EXPRESSION(CAR(dim_l));
408  fprintf(fp,"%s", expression_to_string(exp));
409  if(CDR(dim_l) != NIL)
410  fprintf(fp," , ");
411  }
412  fprintf(fp,"\n");
413  }
414 }
#define BASE_NODE_NUMBER
void pu_egalite_fprint(FILE *fp, Pcontrainte eg, const char *(*variable_name)(entity))
===========================================================================
Definition: print.c:205
void pu_inegalite_fprint(FILE *fp, Pcontrainte ineg, const char *(*variable_name)(entity))
===========================================================================
Definition: print.c:194
#define SCHEDULE(x)
SCHEDULE.
Definition: paf_ri.h:682
#define schedule_predicate(x)
Definition: paf_ri.h:715
#define bdt_schedules(x)
Definition: paf_ri.h:226
#define schedule_dims(x)
Definition: paf_ri.h:717
#define schedule_statement(x)
Definition: paf_ri.h:713
#define bdt_undefined
Definition: paf_ri.h:204
#define predicate_system(x)
Definition: ri.h:2069
struct Ssysteme * Psysteme

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fprint_dataflow()

void fprint_dataflow ( FILE *  fp,
int  stmt,
dataflow  df 
)

===========================================================================

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");

Parameters
fpp
stmttmt
dff

Definition at line 229 of file print.c.

233 {
238 
239  fprintf(fp,
240  " ---Def-Use---> ins_%d:\n Reference: %s\n Transformation: [",
242 
244  fprintf(fp,"]\n");
245  fprintf(fp," Governing predicate:\n");
247  fprint_pred(fp, gov_pred);
248  else
249  fprintf(fp, " {nil} \n");
250 
251  if(comm == communication_undefined)
252  {
253  /*fprintf(fp, "\t\t Communication general \n");*/
254  }
255  else
256  {
257  predicate pred;
258 
259  pred = communication_broadcast(comm);
260  if(pred != predicate_undefined)
261  {
262  fprintf(fp,"\t\t Broadcast vector(s):");
264  }
265 
266  pred = communication_reduction(comm);
267  if(pred != predicate_undefined)
268  {
269  fprintf(fp,"\t\t Reduction vector(s):");
271  }
272 
273  pred = communication_shift(comm);
274  if(pred != predicate_undefined)
275  {
276  fprintf(fp,"\t\t Shift vector(s):");
278  }
279  }
280 }
void fprint_sc_pvecteur(FILE *fp, Psysteme ps)
===========================================================================
Definition: print.c:329
void fprint_pred(FILE *fp, predicate pred)
===========================================================================
Definition: print.c:287
#define communication_shift(x)
Definition: paf_ri.h:265
#define dataflow_communication(x)
Definition: paf_ri.h:346
#define dataflow_transformation(x)
Definition: paf_ri.h:342
#define dataflow_governing_pred(x)
Definition: paf_ri.h:344
#define communication_reduction(x)
Definition: paf_ri.h:263
#define communication_broadcast(x)
Definition: paf_ri.h:261
void fprint_list_of_exp(FILE *fp, list exp_l)
void fprint_list_of_exp(FILE *fp, list exp_l): prints in the file "fp" the list of expression "exp_l"...
Definition: expression.c:229
string reference_to_string(reference r)
Definition: expression.c:87

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fprint_indent()

void fprint_indent ( FILE *  fp,
int  indent 
)

===========================================================================

Parameters
fpp
indentndent

Definition at line 502 of file print.c.

505 {
506  int i;
507 
508  fprintf(fp, "\n");
509  for(i = 0; i < (indent * INDENT_FACTOR); i++) fprintf(fp, " ");
510 }
#define INDENT_FACTOR
Definition: print.c:499

References fprintf(), and INDENT_FACTOR.

Referenced by imprime_quast().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fprint_pred()

void fprint_pred ( FILE *  fp,
predicate  pred 
)

===========================================================================

void fprint_pred(FILE *fp, predicate pred): prints in the file "fp" the predicate "pred".

Parameters
fpp
predred

Definition at line 287 of file print.c.

290 {
291  Psysteme ps = (Psysteme) predicate_system(pred);
292 
293  fprint_psysteme(fp, ps);
294 }
void fprint_psysteme(FILE *fp, Psysteme ps)
===========================================================================
Definition: print.c:302

References fprint_psysteme(), and predicate_system.

Referenced by broadcast_conditions(), fprint_dataflow(), fprint_dfg(), and predicate_to_expression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fprint_psysteme()

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.

Parameters
fpp
pss

Definition at line 302 of file print.c.

305 {
306  Pcontrainte peq;
307 
308  if (ps != NULL) {
309  fprintf(fp,"{\n");
310  for (peq = ps->inegalites; peq!=NULL; peq=peq->succ) {
312  fprintf(fp, "\n");
313  }
314  for (peq = ps->egalites; peq!=NULL; peq=peq->succ) {
316  fprintf(fp, "\n");
317  }
318  fprintf(fp,"} \n");
319  }
320  else
321  fprintf(fp," { nil }\n");
322 }

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fprint_sc_pvecteur()

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.

Parameters
fpp
pss

Definition at line 329 of file print.c.

332 {
333  Pcontrainte peq;
334 
335  if (ps != NULL) {
336  fprintf(fp,"{ ");
337 
338  for (peq = ps->inegalites; peq!=NULL;
339  vecteur_fprint(fp,peq,entity_local_name),peq=peq->succ);
340 
341  for (peq = ps->egalites; peq!=NULL;
342  vecteur_fprint(fp,peq,entity_local_name),peq=peq->succ);
343 
344  fprintf(fp," } \n");
345  }
346  else
347  fprintf(fp,"(nil)\n");
348 }
void vecteur_fprint(FILE *fp, Pcontrainte vec, const char *(*variable_name)(entity))
===========================================================================
Definition: print.c:216

References Ssysteme::egalites, entity_local_name(), fprintf(), Ssysteme::inegalites, Scontrainte::succ, and vecteur_fprint().

Referenced by fprint_dataflow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ general_merge_sort()

list general_merge_sort ( list  ,
bool(*)(void)   
)

Referenced by plc_make_vvs_with_vector(), prgm_mapping(), sort_dfg_node(), sort_eq_in_systems(), sort_unknowns(), and valuer().

+ Here is the caller graph for this function:

◆ get_current_stco_map()

statement_mapping get_current_stco_map ( void  )

========================================================================

Definition at line 2417 of file utils.c.

2418 {
2419  return current_stco_map;
2420 }
static statement_mapping current_stco_map
These three functions respectively initialize, return and reset the static map of the static control ...
Definition: utils.c:2405

References current_stco_map.

Referenced by find_el_with_num(), and get_stco_from_current_map().

+ Here is the caller graph for this function:

◆ get_stco_from_current_map()

static_control get_stco_from_current_map ( statement  s)

========================================================================

Definition at line 2429 of file utils.c.

2430 {
2432 
2434 }
#define GET_STATEMENT_MAPPING(map, stat)
Definition: newgen-local.h:49
statement_mapping get_current_stco_map(void)
========================================================================
Definition: utils.c:2417

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ imprime_quast()

void imprime_quast ( FILE *  fp,
quast  qu 
)

===========================================================================

Parameters
fpp
quu

Definition at line 514 of file print.c.

517 {
518  Psysteme paux = SC_UNDEFINED;
519  predicate pred_aux = predicate_undefined;
520  conditional cond_aux;
521  quast_value quv;
522  quast_leaf qul;
523  leaf_label ll;
524  list sol;
525 
526  if( (qu == quast_undefined) || (qu == NULL) ) {
528  fprintf(fp, "Empty Quast ");
529  return;
530  }
531  quv = quast_quast_value(qu);
532  if( quv == quast_value_undefined ) {
534  fprintf(fp, "Empty Quast ");
535  return;
536  }
537  quv = quast_quast_value(qu);
538 
539  switch( quast_value_tag(quv)) {
541  cond_aux = quast_value_conditional(quv);
542  pred_aux = conditional_predicate(cond_aux);
543  if (pred_aux != predicate_undefined)
544  paux = (Psysteme) predicate_system(pred_aux);
545 
547  fprintf(fp, "IF ");
548  fprint_psysteme(fp, paux);
549 
551  fprintf(fp, "THEN");
552  quast_depth++;
553  imprime_quast(fp, conditional_true_quast (cond_aux) );
554  quast_depth--;
555 
557  fprintf(fp, "ELSE");
558  quast_depth++;
559  imprime_quast(fp, conditional_false_quast (cond_aux) );
560  quast_depth--;
561 
563  fprintf(fp, "FI");
564  break;
565 
567  qul = quast_value_quast_leaf( quv );
568  if (qul == quast_leaf_undefined) {fprintf(fp,"Empty Quast Leaf\n");break;}
569  sol = quast_leaf_solution( qul );
570  ll = quast_leaf_leaf_label( qul );
571  if (ll != leaf_label_undefined) {
573  fprintf(fp, "Statement source number : %"PRIdPTR,
575 
577  fprintf(fp, "Depth : %"PRIdPTR, leaf_label_depth(ll));
578  }
580  while (sol != NIL) {
581  fprintf(fp, "%s, ", expression_to_string(EXPRESSION(CAR(sol))));
582  sol = CDR(sol);
583  }
584  break;
585  }
586 }
statement ordering_to_statement(int o)
Get the statement associated to a given ordering.
Definition: ordering.c:111
void fprint_indent(FILE *fp, int indent)
===========================================================================
Definition: print.c:502
static int quast_depth
Global variables
Definition: print.c:87
void imprime_quast(FILE *fp, quast qu)
===========================================================================
Definition: print.c:514
#define conditional_true_quast(x)
Definition: paf_ri.h:302
#define quast_undefined
Definition: paf_ri.h:603
#define quast_value_undefined
Definition: paf_ri.h:639
#define leaf_label_statement(x)
Definition: paf_ri.h:451
@ is_quast_value_quast_leaf
Definition: paf_ri.h:654
@ is_quast_value_conditional
Definition: paf_ri.h:655
#define conditional_false_quast(x)
Definition: paf_ri.h:304
#define quast_leaf_solution(x)
Definition: paf_ri.h:591
#define quast_value_tag(x)
Definition: paf_ri.h:672
#define quast_leaf_undefined
Definition: paf_ri.h:567
#define leaf_label_undefined
Definition: paf_ri.h:427
#define leaf_label_depth(x)
Definition: paf_ri.h:453
#define quast_value_quast_leaf(x)
Definition: paf_ri.h:675
#define quast_leaf_leaf_label(x)
Definition: paf_ri.h:593
#define quast_quast_value(x)
Definition: paf_ri.h:627
#define conditional_predicate(x)
Definition: paf_ri.h:300
#define quast_value_conditional(x)
Definition: paf_ri.h:678
#define statement_number(x)
Definition: ri.h:2452

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ in_dfg_vertex_list()

vertex in_dfg_vertex_list ( list  l,
vertex  v 
)

===========================================================================

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.

621 {
622  vertex ver;
623  int in;
624 
625  pips_debug(9, "doing \n");
626 
628  vertex_vertex_label(v) );
629  for(;!ENDP(l); POP(l)) {
630  int prov_i;
631  ver = VERTEX(CAR( l ));
633  vertex_vertex_label(ver) );
634  if ( prov_i == in ) return( ver );
635  }
636 
637  return vertex_undefined;
638 }
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define dfg_vertex_label_statement(x)
Definition: paf_ri.h:413

References CAR, dfg_vertex_label_statement, ENDP, pips_debug, POP, VERTEX, vertex_undefined, and vertex_vertex_label.

Referenced by adg_update_dfg().

+ Here is the caller graph for this function:

◆ in_dg_vertex_list()

vertex in_dg_vertex_list ( list  l,
vertex  v 
)

======================================================================

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.

648 {
649  vertex ver;
650  int in;
651 
652  pips_debug(9, "doing \n");
653 
655  vertex_vertex_label(v) );
656  for(;!ENDP(l); POP(l)) {
657  int prov_i;
658  ver = VERTEX(CAR( l ));
660  vertex_vertex_label(ver) );
661  if ( prov_i == in ) return( ver );
662  }
663 
664  return vertex_undefined;
665 }
#define dg_vertex_label_statement(x)
Definition: dg.h:235

References CAR, dg_vertex_label_statement, ENDP, pips_debug, POP, VERTEX, vertex_undefined, and vertex_vertex_label.

◆ init_loop_ctrl()

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

Parameters
s_ind_ind

Definition at line 784 of file adg_read_paf.c.

786 {
787  string index_full_name;
788  entity var_ind;
789 
791  s_ind, (char *) NULL));
792 
793  var_ind = gen_find_tabulated(index_full_name, entity_domain);
794 
795  if(var_ind == entity_undefined)
796  var_ind = make_entity(index_full_name,
798  make_variable(make_basic_int(4/*UU*/),
799  NIL, NIL)),
802 
803  loop_index(crt_loop) = var_ind;
804 
805  lin_exp_l = NIL;
806 }
storage make_storage(enum storage_utype tag, void *val)
Definition: ri.c:2273
basic make_basic_int(intptr_t _field_)
Definition: ri.c:158
value make_value(enum value_utype tag, void *val)
Definition: ri.c:2832
variable make_variable(basic a1, list a2, list a3)
Definition: ri.c:2895
type make_type(enum type_utype tag, void *val)
Definition: ri.c:2706
static list lin_exp_l
Current list of reference indices.
Definition: adg_read_paf.c:170
#define MODULE_SEP_STRING
Definition: naming-local.h:30
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define UU
Definition: newgen_types.h:98
#define DFG_MODULE_NAME
#define make_entity(n, t, s, i)
#define ram_undefined
Definition: ri.h:2221
@ is_value_unknown
Definition: ri.h:3035
@ is_storage_ram
Definition: ri.h:2492
@ is_type_variable
Definition: ri.h:2900
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410

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.

+ Here is the call graph for this function:

◆ init_new_df_gov_pred()

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.

427 {
429  pred_l = NIL;
430  lin_exp_l = NIL;
431 }

References gov_pred, lin_exp_l, NIL, pred_l, and predicate_undefined.

◆ init_new_df_ref()

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

Parameters
s_ref_ref

Definition at line 514 of file adg_read_paf.c.

516 {
517  entity ent_ref;
518  string ref_full_name;
519 
520  ref_inds = NIL;
521 
523  s_ref, (char *) NULL));
524 
525  ent_ref = gen_find_tabulated(ref_full_name, entity_domain);
526 
527  if(ent_ref == entity_undefined)
528  ent_ref = make_entity(ref_full_name,
530  make_variable(make_basic_int(4 /* UU */),
531  NIL, NIL)),
534 
535  ref = make_reference(ent_ref, NIL);
536 
537 /* Initialization of global variables */
538  lin_exp_l = NIL;
539 }
reference make_reference(entity a1, list a2)
Definition: ri.c:2083

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.

+ Here is the call graph for this function:

◆ init_new_df_sink_ins()

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.

298 {
299  crt_node_l = NIL;
300 
301  sink_stmt = -1;
304 }
static int sink_stmt
Current source node.
Definition: adg_read_paf.c:160
#define reference_undefined
Definition: ri.h:2302

References crt_node, crt_node_l, NIL, ref, reference_undefined, sink_stmt, and vertex_undefined.

◆ init_new_df_source()

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

Parameters
s_ins_ins

Definition at line 342 of file adg_read_paf.c.

344 {
345  extern list trans_l, stmt_list;
346 
347  trans_l = NIL;
348 
349  /* In PAF, an statement name is a string "ins_#", where "#" is the number
350  * associated with the statement. We get this number.
351  */
352  source_stmt = atoi(strdup(s_ins + INS_NAME_LENGTH));
353 
354  /* We update the global list of statements */
359  NIL, // No local declarations
360  NULL, // null or empty string...
362  stmt_list);
363 
364 /* Initialization of global variables */
365  lin_exp_l = NIL;
366 }
statement make_statement(entity a1, intptr_t a2, intptr_t a3, string a4, instruction a5, list a6, string a7, extensions a8, synchronization a9)
Definition: ri.c:2222
synchronization make_synchronization_none(void)
Definition: ri.c:2424
#define INS_NAME_LENGTH
Definition: adg_read_paf.c:130
static statement find_stmt_with_num(int n)
===========================================================================
Definition: adg_read_paf.c:314
extensions empty_extensions(void)
extension.c
Definition: extension.c:43
#define instruction_undefined
Definition: ri.h:1454
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

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.

+ Here is the call graph for this function:

◆ init_new_dfg()

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.

246 {
247  extern predicate exec_dom, gov_pred;
248  extern list param_l;
249 
250  dfg = make_graph(NIL); /* The list of vertices is empty at the beginning */
251 
252  param_l = NIL;
255 }
graph make_graph(list a)
Definition: graph.c:56

References dfg, exec_dom, gov_pred, make_graph(), NIL, param_l, and predicate_undefined.

+ Here is the call graph for this function:

◆ init_new_do_loop()

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.

Parameters
s_loop_loop

Definition at line 751 of file adg_read_paf.c.

753 {
754  extern loop crt_loop;
755  entity loop_ent;
756  string loop_full_name;
757 
758  loop_full_name = strdup(concatenate(DFG_MODULE_NAME,
760  s_loop, (char *) NULL));
761 
762  loop_ent = gen_find_tabulated(loop_full_name, entity_domain);
763 
764  if(loop_ent == entity_undefined)
765  loop_ent = make_entity(loop_full_name,
769 
775  loop_ent, execution_undefined, NIL);
776 }
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
Definition: ri.c:1301
range make_range(expression a1, expression a2, expression a3)
Definition: ri.c:2041
#define execution_undefined
Definition: ri.h:1174
@ is_type_statement
Definition: ri.h:2898

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.

+ Here is the call graph for this function:

◆ init_new_gd_ins()

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.

Parameters
s_ins_ins

Definition at line 867 of file adg_read_paf.c.

869 {
870  extern list crt_el;
871  extern int crt_stmt;
872 
873  crt_stmt = atoi(strdup(s_ins + INS_NAME_LENGTH));
874  crt_el = NIL;
875 }

References crt_el, crt_stmt, INS_NAME_LENGTH, NIL, and strdup().

+ Here is the call graph for this function:

◆ init_op_exp()

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".

Parameters
op_namep_name

Definition at line 618 of file adg_read_paf.c.

620 {
621  extern list lin_exp_l;
622 
623  lisp_expression new_le;
624 
625  if(strncmp(op_name, "0", 1) == 0)
627  else
628  new_le = make_lisp_expression(op_name, NIL);
629 
631 }
static string crt_op_name
Current list of structure parameters.
Definition: adg_read_paf.c:174

References CONS, crt_op_name, lin_exp_l, LISP_EXPRESSION, make_lisp_expression(), and NIL.

+ Here is the call graph for this function:

◆ init_op_name()

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.

Parameters
op_namep_name

Definition at line 601 of file adg_read_paf.c.

603 {
604  extern string crt_op_name;
605 
606  crt_op_name = op_name;
607 }

References crt_op_name.

◆ is_entity_in_list_p()

bool is_entity_in_list_p ( entity  e,
list  l 
)

===========================================================================

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.

1282 {
1283  bool is_in_list = false;
1284  for( ; (l != NIL) && (! is_in_list); l = CDR(l))
1285  if(same_entity_p(e, ENTITY(CAR(l))))
1286  is_in_list = true;
1287  return(is_in_list);
1288 }
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lbound_exp()

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.

815 {
817 
818  lin_exp_l = NIL;
819 }
static expression crt_exp
Current reference.
Definition: adg_read_paf.c:164

References crt_exp, crt_loop, lin_exp_l, loop_range, NIL, and range_lower.

◆ lisp_exp_to_ri_exp()

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().

Parameters
lee

Definition at line 755 of file utils.c.

757 {
758  expression exp1, exp2;
759  string exp_op = lisp_expression_operation(le);
760  list exp_args = lisp_expression_args(le);
761 
762  if( (strncmp(exp_op, "aref", 4) == 0) || (strncmp(exp_op, "aset", 4) == 0) )
763  return(make_array_ref(exp_args));
764 
765  if(! STRING_FOUR_OPERATION_P(exp_op))
766  return(make_func_op(exp_op, exp_args));
767 
768  exp1 = EXPRESSION(CAR(exp_args));
769  exp_args = CDR(exp_args);
770 
771  if(exp_args == NIL)
772  pips_internal_error("Only 1 argument for a binary (or more) operation");
773 
774  for(; exp_args != NIL; exp_args = CDR(exp_args))
775  {
776  exp2 = EXPRESSION(CAR(exp_args));
777 
778  exp1 = rational_op_exp(exp_op, exp1, exp2);
779  }
780  return(exp1);
781 }
expression rational_op_exp(string op_name, expression exp1, expression exp2)
========================================================================
Definition: utils.c:1846
expression make_array_ref(list l)
===========================================================================
Definition: utils.c:702
#define STRING_FOUR_OPERATION_P(s)
Macro functions.
Definition: utils.c:102
expression make_func_op(string func_name, list args)
===========================================================================
Definition: utils.c:725
#define lisp_expression_operation(x)
Definition: paf_ri.h:487

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loop_dup()

loop loop_dup ( loop  l)

===========================================================================

loop loop_dup(loop l): returns the duplication of "l".

Definition at line 1014 of file utils.c.

1015 {
1016  /*
1017  loop new_loop;
1018 
1019  new_loop = make_loop(loop_index(l), range_dup(loop_range(l)), loop_body(l),
1020  loop_label(l), loop_execution(l), loop_locals(l));
1021 
1022  return(new_loop);
1023  */
1024  return copy_loop(l);
1025 }
loop copy_loop(loop p)
LOOP.
Definition: ri.c:1265

References copy_loop().

Referenced by finish_new_gd_ins().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_array_ref()

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.

703 {
704  expression new_exp;
705  list array_inds;
706 
707  if(l == NIL)
708  pips_internal_error("No args for array ref");
709 
710  new_exp = EXPRESSION(CAR(l));
711  array_inds = CDR(l);
712 
713  if(! syntax_reference_p(expression_syntax(new_exp)))
714  pips_internal_error("Array ref is not a reference");
715 
716  reference_indices(syntax_reference(expression_syntax(new_exp))) = array_inds;
717 
718  return(new_exp);
719 }
#define syntax_reference_p(x)
Definition: ri.h:2728
#define syntax_reference(x)
Definition: ri.h:2730
#define expression_syntax(x)
Definition: ri.h:1247

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().

+ Here is the caller graph for this function:

◆ make_base_of_nest()

Pbase make_base_of_nest ( int  stmt)

===========================================================================

Pbase make_base_of_nest(int stmt): returns the Pbase that contains the indices of the englobing loops of "stmt".

Parameters
stmttmt

Definition at line 977 of file utils.c.

978 {
979  Pbase new_b = NULL;
980  list el_l;
981 
982  for(el_l = find_el_with_num(stmt) ; el_l != NIL; el_l = CDR(el_l))
983  vect_add_elem((Pvecteur *) &new_b,
984  (Variable) loop_index(LOOP(CAR(el_l))),
985  VALUE_ONE);
986 
987  return(new_b);
988 }
static list find_el_with_num(int stmt)
===========================================================================
Definition: utils.c:964
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

References CAR, CDR, find_el_with_num(), LOOP, loop_index, NIL, VALUE_ONE, and vect_add_elem().

+ Here is the call graph for this function:

◆ make_expression_equalities()

Psysteme make_expression_equalities ( list  le)

===========================================================================

Psysteme make_expression_equalities(list le): returns a Psysteme that has equalities computed from "le", a list of expressions.

Parameters
lee

Definition at line 931 of file utils.c.

932 {
933  Psysteme new_sc;
934  list l;
935 
936  new_sc = sc_new();
937 
938  for(l = le; l != NIL; l = CDR(l))
939  {
942 
943  if(normalized_linear_p(nexp))
944  {
945  Pvecteur new_vec = (Pvecteur) normalized_linear(nexp);
946  sc_add_egalite(new_sc, contrainte_make(new_vec));
947  }
948  else
949  {
950  printf("\nNon linear expression :");
951  printf(" %s\n", expression_to_string(exp));
952  }
953  }
954  sc_creer_base(new_sc);
955  return(new_sc);
956 }

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_func_op()

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.

Parameters
func_nameunc_name
argsrgs

Definition at line 725 of file utils.c.

728 {
729  entity func_ent;
730 
732  func_name), entity_domain);
733 
734  if(func_ent == entity_undefined)
735  pips_internal_error("Function unknown : %s", func_name);
736 
738  make_call(func_ent, args)),
740 }
call make_call(entity a1, list a2)
Definition: ri.c:269
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
string make_entity_fullname(const char *module_name, const char *local_name)
END_EOLE.
Definition: entity_names.c:230
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
#define normalized_undefined
Definition: ri.h:1745
@ is_syntax_call
Definition: ri.h:2693

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_id_expression()

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.

673 {
674  entity new_ent;
675  string exp_full_name;
676 
678  s, (char *) NULL));
679 
680  new_ent = gen_find_tabulated(exp_full_name, entity_domain);
681 
682  if(new_ent == entity_undefined)
683  new_ent = make_entity(exp_full_name,
685  make_variable(make_basic_int(4/*UU*/),
686  NIL, NIL)),
689 
691  make_reference(new_ent,NIL)),
693 }
value make_value_unknown(void)
Definition: ri.c:2847
@ is_syntax_reference
Definition: ri.h:2691

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_rational_exp()

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.

2449 {
2450  expression e;
2451 
2452  if(VECTEUR_NUL_P(v))
2453  /* make a "zero" expression */
2454  e = int_to_expression(0);
2455  else if(value_zero_p(value_mod(vect_pgcd_all(v), value_abs(d))))
2456  /* divide "v" by "d", and make the expression with no denominator */
2457  e = make_vecteur_expression(vect_div(v, d));
2458  else {
2459  expression e1, e2;
2460  entity ent;
2461  list le = NIL;
2462 
2463  /* build the denominator */
2464  e2 = Value_to_expression(d);
2465  le = CONS(EXPRESSION, e2, NIL);
2466 
2467  /* build the numerator */
2468  vect_normalize(v);
2469  e1 = make_vecteur_expression(v);
2470  le = CONS(EXPRESSION, e1, le);
2471 
2472  /* create the symbol of dividing */
2475  entity_domain);
2476 
2477  /* make the expression */
2479  make_call(ent, le)),
2481  }
2482 
2483  return(e);
2484 }
#define value_zero_p(val)
#define value_abs(val)
#define value_mod(v1, v2)
Value vect_pgcd_all(Pvecteur v)
Value vect_pgcd(Pvecteur v): calcul du pgcd de tous les coefficients non nul d'un vecteur v.
Definition: reductions.c:108
#define DIVIDE_OPERATOR_NAME
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
Definition: expression.c:1650
expression Value_to_expression(Value v)
added interface for linear stuff.
Definition: expression.c:1251
Pvecteur vect_div(Pvecteur v, Value x)
Pvecteur vect_div(Pvecteur v, Value x): division du vecteur v par le scalaire x, si x est different d...
Definition: scalaires.c:52
void vect_normalize(Pvecteur v)
void vect_normalize(Pvecteur v): division de tous les coefficients de v par leur pgcd; "normalisation...
Definition: unaires.c:59

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ matrices_to_contraintes_with_sym_cst()

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

Parameters
pcc
index_basendex_base
const_baseonst_base
m11
m22

Definition at line 503 of file utils.c.

508 {
509  Pvecteur vect,pv=NULL;
510  Pcontrainte cp,newpc= NULL;
511  int i,j;
512  Value cst,coeff,dena,denb;
513  bool trouve ;
514 
515  dena = DENOMINATOR(A);
516  denb = DENOMINATOR(B);
517 
518  for (i=n;i>=1; i--) {
519  trouve = false;
520  cp = contrainte_new();
521 
522  /* build the constant terme if it exists */
523  if (value_notzero_p(cst = ACCESS(B,n,i,m2))) {
524  pv = vect_new(TCST, value_mult(dena,cst));
525  trouve = true;
526  }
527 
528  for (vect = base_union(index_base, const_base),j=1;
529  j<=m1;vect=vect->succ,j++) {
530  if (value_notzero_p(coeff = ACCESS(A,n,i,j))) {
531  if (trouve) {
532  vect_chg_coeff(&pv, vecteur_var(vect),
533  value_mult(denb, coeff));
534  }
535  else {
536  /* build a new vecteur if there is not constant term */
537  pv = vect_new(vecteur_var(vect), value_mult(denb, coeff));
538  trouve = true;
539  }
540  }
541  }
542 
543  for (j=1;j<=m2-1;vect=vect->succ,j++) {
544  if (value_notzero_p(coeff = ACCESS(B,n,i,j))) {
545  if (trouve) {
546  vect_chg_coeff(&pv, vecteur_var(vect),
547  value_mult(denb, coeff));
548  }
549  else {
550  /* build a new vecteur if there is not constant term */
551  pv = vect_new(vecteur_var(vect),
552  value_mult(denb, coeff));
553  trouve = true;
554  }
555  }
556  }
557 
558  cp->vecteur = pv;
559  cp->succ = newpc;
560  newpc = cp;
561  }
562  *pc = newpc;
563 }
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
Pbase base_union(Pbase b1, Pbase b2)
Pbase base_union(Pbase b1, Pbase b2): compute a new basis containing all elements of b1 and all eleme...
Definition: base.c:428
Pcontrainte contrainte_new(void)
package contrainte - allocations et desallocations
Definition: alloc.c:47
#define DENOMINATOR(matrix)
int DENOMINATEUR(matrix): acces au denominateur global d'une matrice matrix La combinaison *(&()) est...
Definition: matrice-local.h:93
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
Definition: sc_read.c:87
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ meld()

list meld ( list  ,
list  ,
bool(*)(void)   
)

◆ negate_expression()

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.

Parameters
expxp

Definition at line 792 of file utils.c.

794 {
795  expression neg_exp;
796  normalized nexp;
797 
798  nexp = NORMALIZE_EXPRESSION(exp);
799 
800  if(normalized_complex_p(nexp))
801  neg_exp = copy_expression(exp);
802  else
803  {
804  Pvecteur vexp, new_vec;
805 
806  vexp = (Pvecteur) normalized_linear(nexp);
807  new_vec = vect_dup(vexp);
808  vect_chg_sgn(new_vec);
809 
810  neg_exp = make_vecteur_expression(new_vec);
811  }
812 
813  return(neg_exp);
814 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
#define normalized_complex_p(x)
Definition: ri.h:1782
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ new_df_gov_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.

499 {
500  dataflow df;
501 
503 
506 }
predicate expressions_to_predicate(list)
===========================================================================
Definition: utils.c:826

References crt_node, dataflow_governing_pred, expressions_to_predicate(), first_df_of_succ(), first_succ_of_vertex(), gov_pred, and pred_l.

+ Here is the call graph for this function:

◆ new_df_ref_ind()

void new_df_ref_ind ( string  )

◆ new_df_sink_ins()

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

Parameters
s_ins_ins

Definition at line 706 of file adg_read_paf.c.

708 {
709  extern list stmt_list;
710  extern predicate exec_dom;
711 
712  list aux_l;
713 
714  /* In PAF, an instruction name is a string "ins_#", where "#" is the number
715  * associated with the instruction. We get this number.
716  */
717  sink_stmt = atoi(strdup(s_ins + INS_NAME_LENGTH));
718 
723  NIL, // No local declarations
724  NULL, // null or empty string...
726  stmt_list);
727 
728  for(aux_l = crt_node_l; aux_l != NIL; aux_l = CDR(aux_l))
729  {
730  successor succ = first_succ_of_vertex(VERTEX(CAR(aux_l)));
731  /* FI: removed because of problems. paf_ri.h and/or paf_util.h or something else
732  should be included and might cause conflict between newgen
733  data structures */
736  exec_dom,
738  NIL);
739  }
740 
742 }
#define successor_vertex(x)
Definition: graph.h:118

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.

+ Here is the call graph for this function:

◆ new_df_trans_exp()

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.

375 {
377  pips_internal_error("current expression is undefined");
378 
381 
382 /* Initialization of global variables */
383  lin_exp_l = NIL;
384 }

References CONS, crt_exp, EXPRESSION, expression_undefined, gen_nconc(), lin_exp_l, NIL, pips_internal_error, and trans_l.

+ Here is the call graph for this function:

◆ new_eng_loop()

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.

Parameters
s_loop_loop

Definition at line 909 of file adg_read_paf.c.

911 {
912  extern list crt_el;
913 
914  loop aux_loop;
915 
916  aux_loop = find_loop_with_name(s_loop);
917  if(aux_loop == loop_undefined)
918  {
919  entity loop_ent;
920  string loop_full_name;
921 
922  loop_full_name = strdup(concatenate(DFG_MODULE_NAME,
924  s_loop, (char *) NULL));
925 
926  loop_ent = gen_find_tabulated(loop_full_name, entity_domain);
927 
928  if(loop_ent == entity_undefined)
929  loop_ent = make_entity(loop_full_name,
933 
934  aux_loop = make_loop(entity_undefined,
939  loop_ent, execution_undefined, NIL);
940  }
941  crt_el = gen_nconc(crt_el, CONS(LOOP, aux_loop, NIL));
942 }
static loop find_loop_with_name(string s)
===========================================================================
Definition: adg_read_paf.c:883
#define loop_undefined
Definition: ri.h:1612

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.

+ Here is the call graph for this function:

◆ new_general_merge_sort()

list new_general_merge_sort ( list  ,
bool(*)(void)   
)

◆ new_param()

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.

264 {
265  extern list param_l;
266 
267  entity new_ent;
268  string param_full_name;
269 
271  s, (char *) NULL));
272 
273  new_ent = gen_find_tabulated(param_full_name, entity_domain);
274 
275  if(new_ent == entity_undefined)
276  /* Fi: UU is not a proper argument for make_basic_int() */
277  new_ent = make_entity(param_full_name,
279  make_variable(make_basic_int(4 /* UU */),
280  NIL, NIL)),
283 
284  param_l = CONS(ENTITY, new_ent, param_l);
285 }
type make_type_variable(variable _field_)
Definition: ri.c:2715

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ old_polynome_to_sc()

Psysteme old_polynome_to_sc ( Ppolynome  pp,
list  l 
)

===========================================================================

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.

Parameters
ppp

Definition at line 1115 of file utils.c.

1118 {
1119  Ppolynome aux_pp = polynome_dup(pp);
1120  Psysteme new_ps = sc_new();
1121 
1122  /* For each variable, we nullify its factor in the polynome. */
1123  for( ; l != NIL; l = CDR(l))
1124  {
1125  /* We get the current variable. */
1126  entity var = ENTITY(CAR(l));
1127 
1128  /* We get its factor in the polynome. */
1129  Ppolynome pp_fac = polynome_factorize(aux_pp, (Variable) var, 1);
1130 
1131  /* We add a new equality in the system. */
1132  sc_add_egalite(new_ps, polynome_to_contrainte(pp_fac));
1133 
1134  /* We delete the occurences of this variable in the polynome. */
1135  aux_pp = prototype_var_subst(aux_pp, (Variable) var, POLYNOME_NUL);
1136  }
1137  /* The remnant is added to the system. */
1138  sc_add_egalite(new_ps, polynome_to_contrainte(aux_pp));
1139 
1140  sc_creer_base(new_ps);
1141  return(new_ps);
1142 }
Ppolynome prototype_var_subst(Ppolynome pp, Variable var, Ppolynome ppsubst)
=================================================================
Definition: utils.c:1978
Pcontrainte polynome_to_contrainte(Ppolynome pp)
========================================================================
Definition: utils.c:1095
Ppolynome polynome_dup(Ppolynome pp)
Ppolynome polynome_dup(Ppolynome pp) creates and returns a copy of pp.
Definition: pnome-alloc.c:211
Ppolynome polynome_factorize(Ppolynome pp, Variable var, int n)
Ppolynome polynome_factorize(Ppolynome pp, Variable var, int n) returns the (polynomial) coefficient ...
Definition: pnome-reduc.c:131
#define POLYNOME_NUL

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().

+ Here is the call graph for this function:

◆ old_vecteur_to_polynome()

Ppolynome old_vecteur_to_polynome ( Pvecteur  vec)

===========================================================================

Ppolynome old_vecteur_to_polynome(Pvecteur vec): translates a Pvecteur into a Ppolynome. FI: To be moved

Parameters
vecec

Definition at line 1648 of file utils.c.

1649 {
1650  Ppolynome pp_new = POLYNOME_NUL;
1651 
1652  for( ; vec != NULL; vec = vec->succ)
1653  polynome_add(&pp_new,
1654  make_polynome(VALUE_TO_FLOAT(vec->val), vec->var, VALUE_ONE));
1655 
1656  return(pp_new);
1657 }
#define VALUE_TO_FLOAT(val)
Ppolynome make_polynome(float coeff, Variable var, Value expo)
Ppolynome make_polynome(float coeff, Variable var, Value expo) PRIVATE allocates space for,...
Definition: pnome-alloc.c:100
void polynome_add(Ppolynome *ppp, Ppolynome pp2)
void polynome_add(Ppolynome* ppp, Ppolynome pp2) (*ppp) = (*ppp) + pp2.
Definition: pnome-bin.c:171
Value val
Definition: vecteur-local.h:91
Variable var
Definition: vecteur-local.h:90

References make_polynome(), polynome_add(), POLYNOME_NUL, Svecteur::succ, Svecteur::val, VALUE_ONE, VALUE_TO_FLOAT, and Svecteur::var.

+ Here is the call graph for this function:

◆ polynome_to_contrainte()

Pcontrainte polynome_to_contrainte ( Ppolynome  pp)

========================================================================

Parameters
ppp

Definition at line 1095 of file utils.c.

1097 {
1098  return(contrainte_make(polynome_to_vecteur(pp)));
1099 }
Pvecteur polynome_to_vecteur(Ppolynome pp)
========================================================================
Definition: utils.c:1063

References contrainte_make(), and polynome_to_vecteur().

Referenced by add_constraint_on_x(), nullify_factors(), old_polynome_to_sc(), and polynome_to_sc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ polynome_to_sc()

Psysteme polynome_to_sc ( Ppolynome  pp,
list  l 
)

===========================================================================

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.

Parameters
ppp

Definition at line 1158 of file utils.c.

1161 {
1162  Ppolynome aux_pp = polynome_dup(pp);
1163  Psysteme new_ps = sc_new();
1164 
1165  /* For each variable, we nullify its factor in the polynome. */
1166  for( ; l != NIL; l = CDR(l))
1167  {
1168  /* We get the current variable. */
1169  entity var = ENTITY(CAR(l));
1170 
1171  /* We get its factor in the polynome. */
1172  Pvecteur pv_fac = prototype_factorize(aux_pp, (Variable) var);
1173 
1174  if(!VECTEUR_NUL_P(pv_fac)) {
1175  sc_add_egalite(new_ps, contrainte_make(pv_fac));
1176 
1177  /* We delete the occurences of this variable in the polynome. */
1178  aux_pp = prototype_var_subst(aux_pp, (Variable) var, POLYNOME_NUL);
1179  }
1180  }
1181  /* The remnant is added to the system. */
1182  sc_add_egalite(new_ps, polynome_to_contrainte(aux_pp));
1183 
1184  sc_creer_base(new_ps);
1185  return(new_ps);
1186 }
Pvecteur prototype_factorize(Ppolynome pp, Variable var)
========================================================================
Definition: utils.c:2070

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ polynome_to_vecteur()

Pvecteur polynome_to_vecteur ( Ppolynome  pp)

========================================================================

Parameters
ppp

Definition at line 1063 of file utils.c.

1064 {
1065  Pvecteur new_pv = VECTEUR_NUL;
1066  Ppolynome ppp;
1067 
1068  for(ppp = pp; ppp != NULL; ppp = ppp->succ) {
1069  entity var;
1070  Value val;
1071  Pvecteur pv = (ppp->monome)->term;
1072 
1073  if(VECTEUR_NUL_P(pv))
1074  pips_internal_error("A null vector in a monome");
1075  else if(pv->succ != NULL)
1076  pips_internal_error("Polynome is not of degree one");
1077 
1078  var = (entity) pv->var;
1079  val = float_to_value((ppp->monome)->coeff);
1080  vect_add_elem(&new_pv, (Variable) var, val);
1081  }
1082  return(new_pv);
1083 }
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
#define float_to_value(f)
static void term(Pproblem XX, int s, Value k, int x)
Definition: isolve.c:315
Pmonome monome
struct Spolynome * succ
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prototype_factorize()

Pvecteur prototype_factorize ( Ppolynome  pp,
Variable  var 
)

========================================================================

Parameters
ppp
varar

Definition at line 2070 of file utils.c.

2071 {
2072  Pvecteur pv = NULL;
2073 
2074  if(POLYNOME_NUL_P(pp))
2075  pv = VECTEUR_NUL;
2076  else if(var == TCST)
2077  {
2078  float f = polynome_TCST(pp);
2079  pv = vect_new(TCST, float_to_value(f));
2080  }
2081  else {
2082  Ppolynome ppp;
2083 
2084  for(ppp = pp; ppp != NULL; ppp = ppp->succ) {
2085  Variable newvar = VARIABLE_UNDEFINED;
2086  Value newval;
2087  Pvecteur vec, newpv;
2088  entity first = entity_undefined, second = entity_undefined;
2089  bool factor_found = true;
2090 
2091  vec = (ppp->monome)->term;
2092  for(; (vec != NULL) && (second == entity_undefined); vec = vec->succ) {
2093  second = first;
2094  first = (entity) vec->var;
2095  }
2096  if(vec != NULL)
2097  pips_internal_error("Vecteur should contains 2 var");
2098  else if(same_entity_p(first, (entity) var))
2099  if(second == entity_undefined)
2100  newvar = TCST;
2101  else
2102  newvar = (Variable) second;
2103  else if(same_entity_p(second, (entity) var))
2104  newvar = (Variable) first;
2105  else
2106  factor_found = false;
2107 
2108  if(factor_found) {
2109  newval = float_to_value((ppp->monome)->coeff);
2110  newpv = vect_new(newvar, newval);
2111  newpv->succ = pv;
2112  pv = newpv;
2113  }
2114  }
2115  }
2116 
2117  return(pv);
2118 }
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
float polynome_TCST(Ppolynome pp)
float polynome_TCST(Ppolynome pp) returns the constant term of polynomial pp.
Definition: pnome-reduc.c:156
#define POLYNOME_NUL_P(pp)
#define VARIABLE_UNDEFINED
Definition: vecteur-local.h:64

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prototype_var_subst()

Ppolynome prototype_var_subst ( Ppolynome  pp,
Variable  var,
Ppolynome  ppsubst 
)

=================================================================

Parameters
ppp
varar
ppsubstpsubst

Definition at line 1978 of file utils.c.

1982 {
1983  Ppolynome newpp;
1984 
1985  if(POLYNOME_NUL_P(ppsubst)) {
1986  Ppolynome ppp, p = POLYNOME_UNDEFINED;
1987  Pvecteur pv;
1988 
1989  newpp = polynome_dup(pp);
1990  for(ppp = newpp; ppp != NULL; ppp = ppp->succ) {
1991  entity first = entity_undefined,
1992  second = entity_undefined;
1993  pv = (ppp->monome)->term;
1994  for(; (pv != NULL) && (second == entity_undefined); pv = pv->succ) {
1995  second = first;
1996  first = (entity) pv->var;
1997  }
1998  if(pv != NULL)
1999  pips_internal_error("Vecteur should contains 2 var");
2000  else if( same_entity_p(first, (entity) var) ||
2001  same_entity_p(second, (entity) var)) {
2002  if(POLYNOME_UNDEFINED_P(p)) {
2003  newpp = ppp->succ;
2004  }
2005  else
2006  p->succ = ppp->succ;
2007  }
2008  else
2009  p = ppp;
2010  }
2011  }
2012  else
2013  newpp = polynome_var_subst(pp, var, ppsubst);
2014  return(newpp);
2015 }
Ppolynome polynome_var_subst(Ppolynome pp, Variable var, Ppolynome ppsubst)
Ppolynome polynome_var_subst(Ppolynome pp, Variable var, Ppolynome ppsubst) creates and returns a Ppo...
Definition: pnome-reduc.c:47
#define POLYNOME_UNDEFINED
#define POLYNOME_UNDEFINED_P(pp)

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pu_contraintes_to_matrices()

void pu_contraintes_to_matrices ( Pcontrainte  pc,
Pbase  b,
matrice  A,
matrice  B,
int  n,
int  m 
)

===========================================================================

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".

Parameters
pcc

Definition at line 408 of file utils.c.

414 {
415  int i,j;
416  Pvecteur pv;
417  Pcontrainte eq;
418  matrice_nulle(B,n,1);
419  matrice_nulle(A,n,m);
420 
421  for(eq = pc,i=1; !CONTRAINTE_UNDEFINED_P(eq); eq=eq->succ,i++) {
422  for(pv = b, j=1; pv != NULL; pv = pv->succ, j++){
423  ACCESS(A,n,i,j) = vect_coeff(vecteur_var(pv),eq->vecteur);
424  }
425  ACCESS(B,n,i,1) = vect_coeff(0,eq->vecteur);
426  }
427 }

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pu_egalite_fprint()

void pu_egalite_fprint ( FILE *  ,
Pcontrainte  ,
const char *  *)(entity 
)

Referenced by find_implicit_equation(), fprint_bdt_with_stat(), and solve_system_by_succ_elim().

+ Here is the caller graph for this function:

◆ pu_inegalite_fprint()

void pu_inegalite_fprint ( FILE *  ,
Pcontrainte  ,
const char *  *)(entity 
)

print.c

Referenced by fprint_bdt_with_stat().

+ Here is the caller graph for this function:

◆ pu_is_inferior_var()

◆ pu_matrices_to_contraintes()

void pu_matrices_to_contraintes ( Pcontrainte pc,
Pbase  b,
matrice  A,
matrice  B,
int  n,
int  m 
)

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

Parameters
pcc

Definition at line 350 of file utils.c.

355 {
356  Pvecteur vect,pv=NULL;
357  Pcontrainte cp, newpc= NULL;
358  int i,j;
359  Value cst,coeff,dena,denb;
360  bool trouve ;
361 
362  dena = DENOMINATOR(A);
363  denb = DENOMINATOR(B);
364 
365  for (i=n;i>=1; i--) {
366  trouve = false;
367  cp = contrainte_new();
368 
369  /* build the constant terme if it is null */
370  if (value_notzero_p(cst = ACCESS(B,n,i,1))) {
371  pv = vect_new(TCST, value_mult(dena,cst));
372  trouve = true;
373  }
374 
375  for (vect = b,j=1;j<=m;vect=vect->succ,j++) {
376  if (value_notzero_p(coeff = ACCESS(A,n,i,j))) {
377  if (trouve)
378  vect_chg_coeff(&pv, vecteur_var(vect),
379  value_mult(denb,coeff));
380  else {
381  /* build a new vecteur if there is a null constant term */
382  pv = vect_new(vecteur_var(vect), value_mult(denb,coeff));
383  trouve = true;
384  }
385  }
386  }
387  cp->vecteur = pv;
388  cp->succ = newpc;
389  newpc = cp;
390  }
391  *pc = newpc;
392 }

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pu_variable_name()

const char* pu_variable_name ( Variable  v)

package mapping : Alexis Platonoff, april 1993

===========================================================================

Definition at line 421 of file print.c.

423 {
424  if(v == TCST)
425  return("TCST");
426  else
427  return(entity_local_name((entity) v));
428 }

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pu_vect_fprint()

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!?!

Parameters
fpp

Definition at line 446 of file print.c.

447 {
448  short int debut = 1;
449  Value constante = VALUE_ZERO;
450  char signe;
451  while (!VECTEUR_NUL_P(v)) {
452  if (v->var!=TCST) {
453  Value coeff = v->val;
454 
455  if (value_notzero_p(coeff)) {
456  if (value_pos_p(coeff))
457  signe = (debut) ? ' ' : '+';
458  else {
459  signe = '-';
460  value_oppose(coeff);
461  }
462  debut = 0;
463  if (value_one_p(coeff))
464  fprintf(fp,"%c %s ", signe,
466  else
467  {
468  fprintf(fp,"%c ", signe);
469  fprint_Value(fp, coeff);
470  fprintf(fp, " %s ", entity_local_name((entity) v->var));
471  }
472  }
473  }
474  else
475  /* on admet plusieurs occurences du terme constant!?! */
476  value_addto(constante, v->val);
477  v = v->succ;
478  }
479  if(debut)
480  fprint_Value(fp, constante);
481  else if(value_notzero_p(constante)) {
482  if(value_pos_p(constante))
483  signe = (debut) ? ' ' : '+';
484  else {
485  signe = '-';
486  value_oppose(constante);
487  }
488  (void) fprintf(fp,"%c ", signe);
489  fprint_Value(fp, constante);
490  fprintf(fp, "\n");
491  }
492  else
493  (void) fprintf(fp, "\n");
494 }
#define value_pos_p(val)
#define value_oppose(ref)
#define value_addto(ref, val)
void fprint_Value(FILE *, Value)
Definition: io.c:42

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rational_op_exp()

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

ENTITY_DIVIDE_P(op_ent)

rational calculus

We need to know the integer linearity of both expressions.

ENTITY_MULTIPLY_P(op_ent) || ENTITY_DIVIDE_P(op_ent)

ENTITY_DIVIDE_P(op_ent)

Both expressions are unnormalized because they might be reused in an unnormalized expression.

Parameters
op_namep_name
exp1xp1
exp2xp2

Definition at line 1846 of file utils.c.

1847 {
1848  expression result_exp = expression_undefined;
1849  entity op_ent, unary_minus_ent;
1850 
1851  pips_debug(7, "doing\n");
1853  op_name), entity_domain);
1854  unary_minus_ent =
1857  entity_domain);
1858 
1859  pips_debug(5, "begin OP EXP : %s %s %s\n",
1860  expression_to_string(exp1),
1861  op_name,
1862  expression_to_string(exp2));
1863 
1864  if( ! ENTITY_FOUR_OPERATION_P(op_ent) )
1865  user_error("rational_op_exp", "operation must be : +, -, * or /");
1866 
1867  if( expression_constant_p(exp1) && expression_constant_p(exp2) ) {
1868  int val1, val2;
1869 
1870  pips_debug(6, "Constant expressions\n");
1871  val1 = expression_to_int(exp1);
1872  val2 = expression_to_int(exp2);
1873 
1874  if (ENTITY_PLUS_P(op_ent))
1875  result_exp = int_to_expression(val1 + val2);
1876  else if(ENTITY_MINUS_P(op_ent))
1877  result_exp = int_to_expression(val1 - val2);
1878  else if(ENTITY_MULTIPLY_P(op_ent))
1879  result_exp = int_to_expression(val1 * val2);
1880  else { /* ENTITY_DIVIDE_P(op_ent) */
1881  /* rational calculus */
1882  if((val1 % val2) == 0)
1883  result_exp = int_to_expression((int) (val1 / val2));
1884  }
1885  }
1886  else {
1887  /* We need to know the integer linearity of both expressions. */
1888  normalized nor1 = NORMALIZE_EXPRESSION(exp1);
1889  normalized nor2 = NORMALIZE_EXPRESSION(exp2);
1890 
1891  if((normalized_tag(nor1) == is_normalized_linear) &&
1892  (normalized_tag(nor2) == is_normalized_linear) &&
1893  (ENTITY_PLUS_P(op_ent) || ENTITY_MINUS_P(op_ent)) ) {
1894  pips_debug(6, "Linear operation\n");
1895 
1896  result_exp = make_lin_op_exp(op_ent, exp1, exp2);
1897  }
1898  else if(expression_equal_integer_p(exp1, 0)) {
1899  if (ENTITY_PLUS_P(op_ent))
1900  result_exp = exp2;
1901  else if(ENTITY_MINUS_P(op_ent))
1902  result_exp = MakeUnaryCall(unary_minus_ent, exp2);
1903  else /* ENTITY_MULTIPLY_P(op_ent) || ENTITY_DIVIDE_P(op_ent) */
1904  result_exp = int_to_expression(0);
1905  }
1906  else if(expression_equal_integer_p(exp1, 1)) {
1907  if(ENTITY_MULTIPLY_P(op_ent))
1908  result_exp = exp2;
1909  }
1910  else if(expression_equal_integer_p(exp2, 0)) {
1911  if (ENTITY_PLUS_P(op_ent) || ENTITY_MINUS_P(op_ent))
1912  result_exp = exp1;
1913  else if (ENTITY_MULTIPLY_P(op_ent))
1914  result_exp = int_to_expression(0);
1915  else /* ENTITY_DIVIDE_P(op_ent) */
1916  user_error("rational_op_exp", "division by zero");
1917  }
1918  else if(expression_equal_integer_p(exp2, 1)) {
1919  if(ENTITY_MULTIPLY_P(op_ent) || ENTITY_DIVIDE_P(op_ent))
1920  result_exp = exp1;
1921  }
1922 
1923  /* Both expressions are unnormalized because they might be reused in
1924  * an unnormalized expression. */
1925  unnormalize_expression(exp1);
1926  unnormalize_expression(exp2);
1927  }
1928 
1929  if(result_exp == expression_undefined)
1930  result_exp = MakeBinaryCall(op_ent, exp1, exp2);
1931 
1932  pips_debug(5, "end OP EXP : %s\n",
1933  expression_to_string(result_exp));
1934 
1935  return (result_exp);
1936 }
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
Definition: expression.c:2453
#define user_error(fn,...)
Definition: misc-local.h:265
#define ENTITY_FOUR_OPERATION_P(s)
Definition: utils.c:107
void unnormalize_expression(void *st)
void unnormalize_expression(expression exp): puts all the normalized field of expressions in "st" to ...
Definition: normalize.c:452
#define ENTITY_DIVIDE_P(e)
#define ENTITY_MINUS_P(e)
#define ENTITY_PLUS_P(e)
#define ENTITY_MULTIPLY_P(e)
#define UNARY_MINUS_OPERATOR_NAME
expression make_lin_op_exp(entity op_ent, expression exp1, expression exp2)
================================================================
Definition: expression.c:2147
int expression_to_int(expression exp)
================================================================
Definition: expression.c:2205
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
Definition: expression.c:342
bool expression_equal_integer_p(expression exp, int i)
================================================================
Definition: expression.c:1977
@ is_normalized_linear
Definition: ri.h:1760

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reorganize_bdt()

void reorganize_bdt ( bdt  base)

===========================================================================

void reorganize_bdt(bdt base):

Parameters
basease

Definition at line 171 of file bdt_read_paf.c.

173 {
174  list sch_l, new_sch_l = NIL, l;
175 
176  for(sch_l = bdt_schedules(base); !ENDP(sch_l); POP(sch_l)) {
177  schedule sch = SCHEDULE(CAR(sch_l));
178  int stmt = schedule_statement(sch);
179  predicate pred = schedule_predicate(sch);
180  bool to_add = true;
181 
182  for(l = new_sch_l; (!ENDP(l)) && to_add; POP(l)) {
183  schedule nsch = SCHEDULE(CAR(l));
184  int nstmt = schedule_statement(nsch);
185  predicate npred = schedule_predicate(nsch);
186 
187  if(stmt == nstmt) {
188  if(same_predicate_p(pred, npred)) {
189  expression nexp = EXPRESSION(CAR(schedule_dims(sch)));
190  schedule_dims(nsch) = gen_nconc(schedule_dims(nsch),
191  CONS(EXPRESSION, nexp, NIL));
192  to_add = false;
193  }
194  }
195  }
196  if(to_add)
197  new_sch_l = gen_nconc(new_sch_l, CONS(SCHEDULE, sch, NIL));
198  }
199  bdt_schedules(base) = new_sch_l;
200 }
bool same_predicate_p(predicate p1, predicate p2)
===========================================================================
Definition: bdt_read_paf.c:145

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset_current_stco_map()

void reset_current_stco_map ( void  )

========================================================================

Definition at line 2423 of file utils.c.

2424 {
2426 }
#define hash_table_undefined
Value of an undefined hash_table.
Definition: newgen_hash.h:49

References current_stco_map, and hash_table_undefined.

Referenced by prgm_mapping(), print_parallelizedCMF_code(), print_parallelizedCRAFT_code(), reindexing(), scheduling(), and single_assign().

+ Here is the caller graph for this function:

◆ same_predicate_p()

bool same_predicate_p ( predicate  p1,
predicate  p2 
)

===========================================================================

If the predicate are defined, we consider them as always different

Parameters
p11
p22

Definition at line 145 of file bdt_read_paf.c.

147 {
148 
149  if( (p1 == predicate_undefined) && (p2 == predicate_undefined) )
150  return(true);
151  else if(p1 == predicate_undefined)
152  return(false);
153  else if(p2 == predicate_undefined)
154  return(false);
155 
156  if( (p1 == NULL) && (p2 == NULL) )
157  return(true);
158  else if(p1 == NULL)
159  return(false);
160  else if(p2 == NULL)
161  return(false);
162 
163  /* If the predicate are defined, we consider them as always different */
164  return(false);
165 }

References predicate_undefined.

Referenced by reorganize_bdt().

+ Here is the caller graph for this function:

◆ save_exp()

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.

643 {
644  expression aux_exp;
645  lisp_expression aux_le;
646 
647  aux_le = LISP_EXPRESSION(CAR(lin_exp_l));
648  aux_exp = lisp_exp_to_ri_exp(aux_le);
649 
651 
652  if(lin_exp_l == NIL)
653  crt_exp = aux_exp;
654  else
655  {
658  CONS(EXPRESSION, aux_exp, NIL));
659  }
660 }

References CAR, CDR, CONS, crt_exp, EXPRESSION, gen_nconc(), lin_exp_l, lisp_exp_to_ri_exp(), LISP_EXPRESSION, lisp_expression_args, and NIL.

+ Here is the call graph for this function:

◆ save_id()

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.

578 {
579  extern list lin_exp_l;
580  extern expression crt_exp;
581  expression aux_exp;
582 
583  aux_exp = make_id_expression(s);
584 
585  if(lin_exp_l == NIL)
586  crt_exp = aux_exp;
587  else
588  {
591  CONS(EXPRESSION, aux_exp, NIL));
592  }
593 }

References CAR, CONS, crt_exp, EXPRESSION, gen_nconc(), lin_exp_l, LISP_EXPRESSION, lisp_expression_args, make_id_expression(), and NIL.

+ Here is the call graph for this function:

◆ save_int()

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.

551 {
552  extern list lin_exp_l;
553  extern expression crt_exp;
554  expression aux_exp;
555 
556  aux_exp = int_to_expression(i);
557 
558  if(lin_exp_l == NIL)
559  crt_exp = aux_exp;
560  else
561  {
564  CONS(EXPRESSION, aux_exp, NIL));
565  }
566 }

References CAR, CONS, crt_exp, EXPRESSION, gen_nconc(), int_to_expression(), lin_exp_l, LISP_EXPRESSION, lisp_expression_args, and NIL.

+ Here is the call graph for this function:

◆ save_pred()

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

Parameters
optionption

Definition at line 450 of file adg_read_paf.c.

452 {
453  expression aux_pred;
454 
455  if(option == POSITIVE)
456  {
458  pips_internal_error("current expression is undefined");
459 
460  /* "A >= 0" becomes "-A <= 0"*/
463  }
464  else
465  /* option == NEGATIVE */
466  {
467  /* "A < 0" becomes "A + 1 <= 0"*/
468  aux_pred = make_op_exp(PLUS_OPERATOR_NAME,
470  int_to_expression(1));
471 
472  pred_l = CONS(EXPRESSION, aux_pred, CDR(pred_l));
473  }
474 
475 /* Initialization of global variables */
476  lin_exp_l = NIL;
477 }

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.

+ Here is the call graph for this function:

◆ set_current_stco_map()

void set_current_stco_map ( statement_mapping  scm)

========================================================================

Parameters
scmcm

Definition at line 2408 of file utils.c.

2409 {
2410  pips_assert("current_stco_map is defined", current_stco_map ==
2412 
2413  current_stco_map = scm;
2414 }
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172

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().

+ Here is the caller graph for this function:

◆ simplify_minmax()

list simplify_minmax ( list  lexp,
Psysteme  ps_cont,
int  min_or_max 
)

=================================================================

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.

Parameters
lexpexp
ps_conts_cont
min_or_maxin_or_max

Definition at line 2313 of file utils.c.

2317 {
2318  list new_lexp = NIL;
2319  Pcontrainte pc, new_pc;
2320 
2322 
2323  new_pc = simplify_minmax_contrainte(pc, ps_cont, min_or_max);
2324 
2325  new_lexp = vectors_to_expressions(new_pc);
2326 
2327  return(new_lexp);
2328 }
Pcontrainte expressions_to_vectors(list lexp)
=================================================================
Definition: utils.c:2260
Pcontrainte simplify_minmax_contrainte(Pcontrainte pc, Psysteme ps_cont, int min_or_max)
==================================================================
Definition: utils.c:2154
list vectors_to_expressions(Pcontrainte pc)
=================================================================
Definition: utils.c:2245

References expressions_to_vectors(), lexp, NIL, simplify_minmax_contrainte(), and vectors_to_expressions().

Referenced by re_do_it().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simplify_minmax_contrainte()

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.

Parameters
pcc
ps_conts_cont
min_or_maxin_or_max

Definition at line 2154 of file utils.c.

2158 {
2159  Pcontrainte newnew_pc, new_pc, apc, pcc = CONTRAINTE_UNDEFINED,
2160  epc = CONTRAINTE_UNDEFINED;
2161  Psysteme psc, new_ps;
2162  entity ref_ent;
2163  int count;
2164  string exp_full_name;
2165 
2166  /* We get (or create) our special variable "X". */
2167  exp_full_name = strdup(concatenate(PAF_UTIL_MODULE_NAME,
2169  MINMAX_REF_NAME, (char *) NULL));
2170  ref_ent = gen_find_tabulated(exp_full_name, entity_domain);
2171  if(ref_ent == entity_undefined)
2172  ref_ent = make_entity(exp_full_name,
2174  make_variable(make_basic_int(4/*UU*/),
2175  NIL, NIL)),
2177  make_value_unknown());
2178 
2179 
2180  /* We put our special variable in our vectors. */
2181  for(apc = pc, count = 0; apc != NULL; apc = apc->succ, count++) {
2182  Pvecteur pv;
2183  Pcontrainte aapc;
2184 
2185  pv = vect_dup(apc->vecteur);
2186  if(min_or_max == IS_MIN) {
2187  vect_chg_sgn(pv);
2188  vect_add_elem(&pv, (Variable) ref_ent, (Value) 1);
2189  }
2190  else {/* min_or_max == IS_MAX */
2191  vect_add_elem(&pv, (Variable) ref_ent, (Value) -1);
2192  }
2193 
2194  aapc = contrainte_make(pv);
2195  if(CONTRAINTE_UNDEFINED_P(pcc)) {
2196  pcc = aapc;
2197  epc = aapc;
2198  }
2199  else {
2200  epc->succ = aapc;
2201  epc = epc->succ;
2202  }
2203  }
2204 
2205  /* We add the context. */
2206  psc = sc_dup(ps_cont);
2207  epc->succ = psc->inegalites;
2208  psc->inegalites = pcc;
2209  psc->nb_ineq += count;
2210  psc->base = NULL;
2211  sc_creer_base(psc);
2212 
2213  new_ps = sc_elim_redund(psc);
2214 
2215  new_pc = new_ps->inegalites;
2216 
2217  /* We remove our MINMAX variable. */
2218  newnew_pc = CONTRAINTE_UNDEFINED;
2219  for(apc = new_pc; apc != NULL; apc = apc->succ) {
2220  Pvecteur pv;
2221  Pcontrainte aapc;
2222  Value xc;
2223 
2224  pv = vect_dup(apc->vecteur);
2225  xc = vect_coeff((Variable) ref_ent, pv);
2226  if(value_one_p(xc) && (min_or_max == IS_MIN)) {
2227  vect_erase_var(&pv, (Variable) ref_ent);
2228  vect_chg_sgn(pv);
2229  aapc = contrainte_make(pv);
2230  aapc->succ = newnew_pc;
2231  newnew_pc = aapc;
2232  }
2233  else if(value_mone_p(xc) && (min_or_max == IS_MAX)) {
2234  vect_erase_var(&pv, (Variable) ref_ent);
2235  aapc = contrainte_make(pv);
2236  aapc->succ = newnew_pc;
2237  newnew_pc = aapc;
2238  }
2239  }
2240  return(newnew_pc);
2241 }
static int count
Definition: SDG.c:519
#define PAF_UTIL_MODULE_NAME
#define IS_MIN
#define IS_MAX
#define MINMAX_REF_NAME
Definition: utils.c:2121
Psysteme sc_elim_redund(Psysteme ps)
Psysteme sc_elim_redund(Psysteme ps): elimination des contraintes lineaires redondantes dans le syste...
int nb_ineq
Definition: sc-local.h:73
void vect_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
Definition: unaires.c:106

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ single_var_vecteur_p()

bool single_var_vecteur_p ( Pvecteur  pv)

===========================================================================

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).

Parameters
pvv

Definition at line 1615 of file utils.c.

1616 {
1617  return(vect_size(pv) == 1);
1618 }
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47

References vect_size().

+ Here is the call graph for this function:

◆ static_control_to_indices()

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.

Parameters
stcttct

Definition at line 1037 of file utils.c.

1039 {
1040  list lo_l = static_control_loops(stct);
1041  list ind_l = NIL;
1042 
1043  for( ; lo_l != NIL; lo_l = CDR(lo_l))
1044  {
1045  loop lo = LOOP(CAR(lo_l));
1046 
1047  /* We keep the same order. */
1048  ind_l = gen_nconc(ind_l, CONS(ENTITY, loop_index(lo), NIL));
1049  }
1050  return(ind_l);
1051 }

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stco_common_loops_of_statements()

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.

Parameters
in_mapn_map
in_sn_s
in_s2n_s2

Definition at line 2497 of file utils.c.

2500 {
2501  debug(9, "stco_common_loops_of_statements","doing\n");
2502  return( gen_length(stco_same_loops( in_map, in_s, in_s2 )) );
2503 }
size_t gen_length(const list l)
Definition: list.c:150
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
list stco_same_loops(statement_mapping in_map, statement in_s, statement in_s2)
======================================================================
Definition: utils.c:98

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ step_exp()

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.

827 {
829 
830  lin_exp_l = NIL;
831 }
#define range_increment(x)
Definition: ri.h:2292

References crt_exp, crt_loop, lin_exp_l, loop_range, NIL, and range_increment.

◆ substitute_var_with_vec()

void substitute_var_with_vec ( Psysteme  ps,
entity  var,
Value  val,
Pvecteur  vec 
)

===========================================================================

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)

Parameters
pss
varar
valal
vecec

Definition at line 1210 of file utils.c.

1215 {
1216  Variable Var = (Variable) var;
1218 
1219  ifdebug(7) {
1220 fprintf(stdout, "\t\t\tAvant Sub: \n");
1221 fprint_psysteme(stdout, ps);
1222 fprintf(stdout, "\n");
1223  }
1224 
1225  /* "val" must be positive. */
1226  if(value_neg_p(val)) {
1227  value_oppose(val);
1228  vect_chg_sgn(vec);
1229  }
1230 
1231  /* Vnew = (c/p)*vec + (val/p)*Vaux = (c/p)*vec + (val/p)*(Vold - c*var) */
1232  for(assert = ps->egalites; assert != NULL; assert = assert->succ) {
1233  Pvecteur v_old = assert->vecteur;
1234  Value coeff = vect_coeff(Var, v_old);
1235  if(value_notzero_p(coeff)) {
1236  Value p = pgcd_slow(coeff, val);
1237 
1238  assert->vecteur = vect_cl2_ofl_ctrl
1239  (value_div(coeff,p), vec,
1240  value_div(val,p),
1242  vect_new(Var, coeff),
1243  NO_OFL_CTRL),
1244  NO_OFL_CTRL);
1245  }
1246  }
1247  for(assert = ps->inegalites; assert != NULL; assert = assert->succ) {
1248  Pvecteur v_old = assert->vecteur;
1249  Value coeff = vect_coeff(Var, v_old);
1250  if(value_notzero_p(coeff)) {
1251  Value p = pgcd_slow(coeff, val);
1252 
1253  assert->vecteur = vect_cl2_ofl_ctrl
1254  (value_div(coeff,p), vec,
1255  value_div(val,p),
1257  vect_new(Var, coeff),
1258  NO_OFL_CTRL),
1259  NO_OFL_CTRL);
1260  }
1261  }
1262  vect_rm((Pvecteur) ps->base);
1263  ps->base = (Pbase) NULL;
1264  sc_creer_base(ps);
1265 
1266  ifdebug(7) {
1267  fprintf(stdout, "\t\t\tApres Sub: \n");
1268  fprint_psysteme(stdout, ps);
1269  fprintf(stdout, "\n");
1270  }
1271 
1272 }
#define value_neg_p(val)
#define value_div(v1, v2)
Value pgcd_slow(Value, Value)
pgcd.c
Definition: pgcd.c:44
#define assert(ex)
Definition: newgen_assert.h:41
struct Svecteur * Pbase

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ubound_exp()

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.

840 {
842 
843  lin_exp_l = NIL;
844 }

References crt_exp, crt_loop, lin_exp_l, loop_range, NIL, and range_upper.

◆ vect_var_subst()

Pvecteur vect_var_subst ( Pvecteur  vect,
Variable  var,
Pvecteur  new_vect 
)

=================================================================

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

Parameters
vectect
varar
new_vectew_vect

Definition at line 1948 of file utils.c.

1952 {
1954  Value val;
1955 
1956  if ((val = vect_coeff(var,vect)) != 0)
1957  {
1958  vect_erase_var(&vect,var);
1959  vect_aux = vect_multiply(new_vect,val);
1960  vect = vect_add(vect, vect_aux);
1961  }
1962 
1963  return(vect);
1964 }
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
Definition: scalaires.c:123
Pvecteur vect_aux
Definition: solpip.c:102

References vect_add(), vect_aux, vect_coeff(), vect_erase_var(), and vect_multiply().

Referenced by constraint_to_bound(), and converti_psysmin_psysmax().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vecteur_fprint()

void vecteur_fprint ( FILE *  ,
Pcontrainte  ,
const char *  *)(entity 
)

Referenced by constraint_to_bound(), and make_reindex().

+ Here is the caller graph for this function:

◆ vecteur_mult()

Ppolynome vecteur_mult ( Pvecteur  v1,
Pvecteur  v2 
)

========================================================================

Parameters
v11
v22

Definition at line 2024 of file utils.c.

2025 {
2026  Ppolynome pp = POLYNOME_NUL, new_pp;
2027  Pvecteur pv1, pv2, ppv;
2028 
2029  if(VECTEUR_NUL_P(v1) || VECTEUR_NUL_P(v2))
2030  return(POLYNOME_NUL);
2031 
2032  for(pv1 = v1; pv1 != NULL; pv1 = pv1->succ) {
2033  Variable var1 = pv1->var;
2034  Value val1 = pv1->val;
2035  for(pv2 = v2; pv2 != NULL; pv2 = pv2->succ) {
2036  Variable var2 = pv2->var;
2037  Value val2 = pv2->val;
2038  Value p = value_mult(val1,val2);
2039  float f = VALUE_TO_FLOAT(p);
2040 
2041  if(var1 == TCST)
2042  new_pp = make_polynome(f, var2, VALUE_ONE);
2043  else if(var2 == TCST)
2044  new_pp = make_polynome(f, var1, VALUE_ONE);
2045  else if(same_entity_p((entity) var1, (entity) var2))
2046  new_pp = make_polynome(f, var1, VALUE_CONST(2));
2047  else {
2048  new_pp = make_polynome(f, var1, VALUE_ONE);
2049  ppv = (new_pp->monome)->term;
2050  pips_assert("succ is NULL", ppv->succ == NULL);
2051  ppv->succ = vect_new(var2, VALUE_ONE);
2052  }
2053  polynome_add(&pp, new_pp);
2054  }
2055  }
2056  return(pp);
2057 }
#define VALUE_CONST(val)

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vecteur_to_list()

list vecteur_to_list ( Pvecteur  v)

===========================================================================

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.

1627 {
1628  list l = NIL;
1629 
1630  for( ; v != NULL; v = v->succ)
1631  {
1632  entity var = (entity) v->var;
1633  if(var != (entity) TCST)
1634  l = gen_nconc(l, CONS(ENTITY, var, NIL));
1635  }
1636 
1637  return(l);
1638 }

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vectors_to_expressions()

list vectors_to_expressions ( Pcontrainte  pc)

=================================================================

Parameters
pcc

Definition at line 2245 of file utils.c.

2247 {
2248  list lexp = NIL;
2249  Pcontrainte apc;
2250 
2251  for(apc = pc; apc != NULL; apc = apc->succ) {
2252  expression new_exp = make_vecteur_expression(apc->vecteur);
2253  ADD_ELEMENT_TO_LIST(lexp, EXPRESSION, new_exp);
2254  }
2255  return(lexp);
2256 }
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50

References ADD_ELEMENT_TO_LIST, EXPRESSION, lexp, make_vecteur_expression(), NIL, Scontrainte::succ, and Scontrainte::vecteur.

Referenced by simplify_minmax().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vertex_int_stmt()

int vertex_int_stmt ( vertex  v)

===========================================================================

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().

+ Here is the caller graph for this function:

Variable Documentation

◆ base

◆ dfg

graph dfg
extern

cproto-generated files

adg_read_paf.c

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().

◆ loop_list

list loop_list
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().

◆ stmt_list

list stmt_list
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().