PIPS
reindexing.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "genC.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "ray_dte.h"
#include "sommet.h"
#include "sg.h"
#include "sc.h"
#include "polyedre.h"
#include "union.h"
#include "matrice.h"
#include "matrix.h"
#include "sparse_sc.h"
#include "ri.h"
#include "constants.h"
#include "control.h"
#include "ri-util.h"
#include "misc.h"
#include "complexity_ri.h"
#include "database.h"
#include "graph.h"
#include "dg.h"
#include "paf_ri.h"
#include "parser_private.h"
#include "property.h"
#include "reduction.h"
#include "text.h"
#include "text-util.h"
#include "tiling.h"
#include "pipsdbm.h"
#include "resources.h"
#include "static_controlize.h"
#include "paf-util.h"
#include "pips.h"
#include "array_dfg.h"
#include "prgm_mapping.h"
#include "conversion.h"
#include "scheduling.h"
#include "reindexing.h"
+ Include dependency graph for reindexing.c:

Go to the source code of this file.

Macros

#define STRING_BDT   "t"
 Name : reindexing.c Package : reindexing Author : Alexis Platonoff & Antoine Cloue Date : april 1994 Historic : More...
 
#define STRING_PLC   "p"
 
#define STRING_TAU   "q"
 
#define STRING_FLAG   "flag"
 
#define MAKE_STATEMENT(ins)   (make_statement(entity_empty_label(),STATEMENT_NUMBER_UNDEFINED,STATEMENT_ORDERING_UNDEFINED,string_undefined,ins))
 
#define INTEGER_DEC   0
 We define a set of constant in order to a more generic function for the insert of the declarations of the new created variables. More...
 
#define REAL_DEC   1
 
#define COMPLEX_DEC   2
 
#define LOGICAL_DEC   3
 
#define DOUBLE_DEC   4
 
#define CHARACTER_DEC   5
 
#define INTEGER_DECL   " INTEGER"
 
#define REAL_DECL   " REAL"
 
#define COMPLEX_DECL   " COMPLEX"
 
#define LOGICAL_DECL   " LOGICAL"
 
#define DOUBLE_DECL   " DOUBLE"
 
#define CHARACTER_DECL   " CHARACTER"
 
#define COLON   ":"
 
#define NEWLINE   "\n *"
 
#define ENDLINE   "\n"
 
#define LINE_LENGHT   68
 
#define MARGIN_LENGHT   7
 
#define IS_MIN   0
 
#define IS_MAX   1
 
#define DOUBLE_PRECISION_SIZE   8
 

Typedefs

typedef dfg_vertex_label vertex_label
 Local defines. More...
 
typedef dfg_arc_label arc_label
 

Functions

entity get_time_ent (int st, char *typ, int count)
 ================================================================== More...
 
void build_contraction_matrices (int s, Psysteme ps, Pmatrix mH, int *c, Pmatrix *mQ, Pmatrix *mQ_inv, Pmatrix *mC, list *ln, list *lom, Pbase indx, Pbase cnst)
 ======================================================================== More...
 
Psyslist build_list_of_min (Psyslist lsys, list lnew, Psysteme ps)
 ======================================================================= More...
 
list dataflows_on_reference (list cls, reference crhs, predicate pred, list *lm)
 ======================================================================= More...
 
instruction build_local_time_test (entity t, list l)
 ====================================================================== More...
 
expression build_global_time_test_with_exp (entity tg, expression exp)
 ====================================================================== More...
 
instruction build_flag_assign (entity f, bool val)
 ====================================================================== More...
 
instruction build_flag_test (entity f, entity t)
 ====================================================================== More...
 
instruction make_init_time (entity en, expression ex)
 ====================================================================== More...
 
instruction make_increment_instruction (entity t, int i)
 ===================================================================== More...
 
int get_number_of_ins (entity e)
 ====================================================================== More...
 
bool reindexing (char *mod_name)
 ====================================================================== More...
 

Variables

static int tc
 Internal variables
More...
 
hash_table h_node
 
hash_table delay_table
 Name : delay.c Package : reindexing Author : Alexis Platonoff Date : March 1995 Historic : More...
 
hash_table ht_ab
 
list lparams
 Array bounds. More...
 

Macro Definition Documentation

◆ CHARACTER_DEC

#define CHARACTER_DEC   5

Definition at line 125 of file reindexing.c.

◆ CHARACTER_DECL

#define CHARACTER_DECL   " CHARACTER"

Definition at line 132 of file reindexing.c.

◆ COLON

#define COLON   ":"

Definition at line 133 of file reindexing.c.

◆ COMPLEX_DEC

#define COMPLEX_DEC   2

Definition at line 122 of file reindexing.c.

◆ COMPLEX_DECL

#define COMPLEX_DECL   " COMPLEX"

Definition at line 129 of file reindexing.c.

◆ DOUBLE_DEC

#define DOUBLE_DEC   4

Definition at line 124 of file reindexing.c.

◆ DOUBLE_DECL

#define DOUBLE_DECL   " DOUBLE"

Definition at line 131 of file reindexing.c.

◆ DOUBLE_PRECISION_SIZE

#define DOUBLE_PRECISION_SIZE   8

Definition at line 143 of file reindexing.c.

◆ ENDLINE

#define ENDLINE   "\n"

Definition at line 135 of file reindexing.c.

◆ INTEGER_DEC

#define INTEGER_DEC   0

We define a set of constant in order to a more generic function for the insert of the declarations of the new created variables.

Definition at line 120 of file reindexing.c.

◆ INTEGER_DECL

#define INTEGER_DECL   " INTEGER"

Definition at line 127 of file reindexing.c.

◆ IS_MAX

#define IS_MAX   1

Definition at line 140 of file reindexing.c.

◆ IS_MIN

#define IS_MIN   0

Definition at line 139 of file reindexing.c.

◆ LINE_LENGHT

#define LINE_LENGHT   68

Definition at line 136 of file reindexing.c.

◆ LOGICAL_DEC

#define LOGICAL_DEC   3

Definition at line 123 of file reindexing.c.

◆ LOGICAL_DECL

#define LOGICAL_DECL   " LOGICAL"

Definition at line 130 of file reindexing.c.

◆ MAKE_STATEMENT

Definition at line 102 of file reindexing.c.

◆ MARGIN_LENGHT

#define MARGIN_LENGHT   7

Definition at line 137 of file reindexing.c.

◆ NEWLINE

#define NEWLINE   "\n *"

Definition at line 134 of file reindexing.c.

◆ REAL_DEC

#define REAL_DEC   1

Definition at line 121 of file reindexing.c.

◆ REAL_DECL

#define REAL_DECL   " REAL"

Definition at line 128 of file reindexing.c.

◆ STRING_BDT

#define STRING_BDT   "t"

Name : reindexing.c Package : reindexing Author : Alexis Platonoff & Antoine Cloue Date : april 1994 Historic :

Documents: SOON Comments : This file contains the functions for the transformation of a program to a single assignment form. The main function is reindexing(). Ansi includes
Newgen includes
C3 includes
Pips includes
Macro functions

Definition at line 97 of file reindexing.c.

◆ STRING_FLAG

#define STRING_FLAG   "flag"

Definition at line 100 of file reindexing.c.

◆ STRING_PLC

#define STRING_PLC   "p"

Definition at line 98 of file reindexing.c.

◆ STRING_TAU

#define STRING_TAU   "q"

Definition at line 99 of file reindexing.c.

Typedef Documentation

◆ arc_label

Definition at line 115 of file reindexing.c.

◆ vertex_label

Local defines.

Definition at line 114 of file reindexing.c.

Function Documentation

◆ build_contraction_matrices()

void build_contraction_matrices ( int  s,
Psysteme  ps,
Pmatrix  mH,
int c,
Pmatrix mQ,
Pmatrix mQ_inv,
Pmatrix mC,
list ln,
list lom,
Pbase  indx,
Pbase  cnst 
)

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

void build_contraction_matrices(mH, mQ, mQ_inv, mC, l)

From the matrix of Hermite mH, build the matrix mQ containing the periods of the different schedule dimension.

AC 94/03/31

build the matrix mC

Definition at line 197 of file reindexing.c.

204 {
205  int i, le = ps->nb_eq;
206  Value ppc = VALUE_ONE;
207  entity ent;
208  Psysteme sc = sc_new();
209  Pcontrainte cont;
210 
211  *ln = NIL;
212  *lom = NIL;
213  matrix_identity(*mQ, 0);
214  matrix_identity(*mQ_inv, 0);
215 
216  if (get_debug_level() > 5)
217  fprintf(stderr,"\nBuild_contraction matrice :");
218 
219  for (i = 1; i <= le; i++)
220  ppc = ppcm(ppc, value_abs(MATRIX_ELEM(mH, i, i)));
221 
222  for (i = 1; i <= MATRIX_NB_LINES(*mQ); i++) {
223  if (i <= le) {
224  Value p = value_div(ppc,MATRIX_ELEM(mH, i, i)), x;
225  MATRIX_ELEM(*mQ,i,i) = value_abs(p);
226  ent = get_time_ent(s, STRING_TAU, (*c));
227  (*c)++;
228  ADD_ELEMENT_TO_LIST(*ln, ENTITY, ent);
229 
230  x = value_abs(MATRIX_ELEM(mH,i,i));
232  }
233  else
234  value_product(MATRIX_ELEM(*mQ,i,i), ppc);
235  }
236 
237  MATRIX_DENOMINATOR(*mQ) = ppc;
238 
239  sc = matrix_to_system(*mQ, indx);
240 
241  cont = sc->egalites;
242 
243  while (ps->egalites != NULL) {
244  cont->vecteur = vect_substract(cont->vecteur, (ps->egalites)->vecteur);
245  cont = cont->succ;
246  ps->egalites = (ps->egalites)->succ;
247  ps->nb_eq--;
248  }
249 
250  /* build the matrix mC */
251  matrix_nulle(*mC);
252 
253  my_constraints_with_sym_cst_to_matrices(sc->egalites, indx, cnst, *mQ, *mC);
254 
255  MATRIX_DENOMINATOR(*mQ) = ppc;
256  MATRIX_DENOMINATOR(*mC) = ppc;
257 
258  matrix_general_inversion(*mQ, *mQ_inv);
259 
260  if (get_debug_level() > 5)
261  fprintf(stderr,"\nBuild_contraction_matrice fin\n");
262 }
#define VALUE_TO_INT(val)
int Value
#define value_product(v, w)
#define VALUE_ONE
#define value_abs(val)
#define value_div(v1, v2)
Value ppcm(Value, Value)
ppcm.c
Definition: ppcm.c:42
@ INT
Definition: atomic.c:48
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50
#define MATRIX_NB_LINES(matrix)
Definition: matrix-local.h:87
#define MATRIX_DENOMINATOR(matrix)
int MATRIX_DENONIMATOR(matrix): acces au denominateur global d'une matrice matrix
Definition: matrix-local.h:86
#define MATRIX_ELEM(matrix, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrix-local.h:80
void matrix_general_inversion(Pmatrix a, Pmatrix inv_a)
void matrix_general_inversion(Pmatrix a; Pmatrix inv_a) calcul de l'inversion du matrice general.
Definition: inversion.c:216
void matrix_nulle(Pmatrix Z)
void matrix_nulle(Pmatrix Z): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrix.c:293
void matrix_identity(Pmatrix, int)
void matrix_identity(Pmatrix ID, int level) Construction d'une sous-matrice identity dans ID(level+1....
Definition: sub-matrix.c:322
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
#define STRING_TAU
Definition: reindexing.c:99
entity get_time_ent(int st, char *typ, int count)
==================================================================
Definition: reindexing.c:156
Psysteme matrix_to_system(Pmatrix A, Pbase b)
==================================================================
void my_constraints_with_sym_cst_to_matrices(Pcontrainte pc, Pbase index_base, Pbase const_base, Pmatrix A, Pmatrix B)
=====================================================================
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static char * x
Definition: split_file.c:159
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte egalites
Definition: sc-local.h:70
int nb_eq
Definition: sc-local.h:72
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 ADD_ELEMENT_TO_LIST, Ssysteme::egalites, ENTITY, fprintf(), get_debug_level(), get_time_ent(), INT, MATRIX_DENOMINATOR, MATRIX_ELEM, matrix_general_inversion(), matrix_identity(), MATRIX_NB_LINES, matrix_nulle(), matrix_to_system(), my_constraints_with_sym_cst_to_matrices(), Ssysteme::nb_eq, NIL, ppcm(), sc_new(), STRING_TAU, Scontrainte::succ, value_abs, value_div, VALUE_ONE, value_product, VALUE_TO_INT, vect_substract(), Scontrainte::vecteur, and x.

Referenced by prepare_reindexing().

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

◆ build_flag_assign()

instruction build_flag_assign ( entity  f,
bool  val 
)

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

instruction build_flag_assign(f, val) :

build the instruction: flag = val.

AC 94/06/14

Definition at line 531 of file reindexing.c.

534 {
535  call ca;
536  list lexp;
537  expression e;
538 
539  if(val)
540  e = int_to_expression(1);
541  else
542  e = int_to_expression(0);
543 
547 
549 }
call make_call(entity a1, list a2)
Definition: ri.c:269
instruction make_instruction(enum instruction_utype tag, void *val)
Definition: ri.c:1166
static list lexp
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
#define ASSIGN_OPERATOR_NAME
Definition: ri-util-local.h:95
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
expression make_entity_expression(entity e, cons *inds)
Definition: expression.c:176
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
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
@ is_instruction_call
Definition: ri.h:1474
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References ADD_ELEMENT_TO_LIST, ASSIGN_OPERATOR_NAME, CONS, entity_intrinsic(), EXPRESSION, f(), int_to_expression(), is_instruction_call, lexp, make_call(), make_entity_expression(), make_instruction(), and NIL.

Referenced by re_do_it().

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

◆ build_flag_test()

instruction build_flag_test ( entity  f,
entity  t 
)

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

instruction build_flag_test(f, t)

Builds the instruction: IF flag == 1 THEN t = t + 1 ENDIF

AC 94/06/14

Definition at line 561 of file reindexing.c.

563 {
564  call ca;
565  list lexp;
566  instruction ins;
567  statement stat;
568  expression exp;
569 
570  ins = make_increment_instruction(t, 1);
571  stat = MAKE_STATEMENT(ins);
572 
577 
579  make_test(exp, stat, make_empty_statement())));
580 }
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
test make_test(expression a1, statement a2, statement a3)
Definition: ri.c:2607
syntax make_syntax(enum syntax_utype tag, void *val)
Definition: ri.c:2491
#define MAKE_STATEMENT(ins)
Definition: reindexing.c:102
instruction make_increment_instruction(entity t, int i)
=====================================================================
Definition: reindexing.c:610
#define EQUAL_OPERATOR_NAME
#define make_empty_statement
An alias for make_empty_block_statement.
#define normalized_undefined
Definition: ri.h:1745
@ is_syntax_call
Definition: ri.h:2693
@ is_instruction_test
Definition: ri.h:1470
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References ADD_ELEMENT_TO_LIST, CONS, entity_intrinsic(), EQUAL_OPERATOR_NAME, exp, EXPRESSION, f(), int_to_expression(), is_instruction_test, is_syntax_call, lexp, make_call(), make_empty_statement, make_entity_expression(), make_expression(), make_increment_instruction(), make_instruction(), MAKE_STATEMENT, make_syntax(), make_test(), NIL, and normalized_undefined.

Referenced by re_do_it().

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

◆ build_global_time_test_with_exp()

expression build_global_time_test_with_exp ( entity  tg,
expression  exp 
)

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

expression build_global_time_test_with_exp(tg, exp)

Builds the expression: tg == exp

AC 94/06/15

Definition at line 509 of file reindexing.c.

512 {
513  list lexp;
514  call ca;
515 
519 
522 }

References ADD_ELEMENT_TO_LIST, CONS, entity_intrinsic(), EQUAL_OPERATOR_NAME, exp, EXPRESSION, is_syntax_call, lexp, make_call(), make_entity_expression(), make_expression(), make_syntax(), NIL, and normalized_undefined.

Referenced by build_first_comb(), and build_third_comb().

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

◆ build_list_of_min()

Psyslist build_list_of_min ( Psyslist  lsys,
list  lnew,
Psysteme  ps 
)

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

build_list_of_min()

From the list of psystem "lsys", take each inequality (that is an expression of a possible lower bound), and create as many systems as necessary to raise the undetermination on the domain. This is done until the counter is equal to 0 meaning that all "t" variables have been treated.

AC 94/05/05

get the system corresponding to the current variable

there is already an unique minimum

add inequalities on the max

put the value of the min in the equality

search on the next t variable

for each possible minimum build new system

include new value of the min in the system

put the inequality on the current minimum

add inequalities on the max

put the minimum value that is the l in "t = omega*to + l"

in the equality part of the system. Problem if val != 1

get the next dimension

Definition at line 276 of file reindexing.c.

280 {
281  Psysteme sc_aux, ps_aux2;
282  Pcontrainte cont, cont2;
283  Pvecteur vect, vectp, vect2;
284  Value val, val2;
285  Psyslist lsys_aux = NULL, lsys_aux2 = NULL;
286  Variable var;
287 
288  if (get_debug_level() > 5)
289  fprintf(stderr, "\nBuild list of min begin \n");
290 
291  if (lsys != NULL) {
292  /* get the system corresponding to the current variable */
293  sc_aux = lsys->psys;
294  var = (Variable)ENTITY(CAR(lnew));
295 
296  if (get_debug_level() > 5) {
297  fprintf(stderr, "\nSysteme en cours d'etude:");
298  fprint_psysteme(stderr, sc_aux);
299  fprintf(stderr, "\nVariable relative : ");
300  fprint_entity_list(stderr,CONS(ENTITY, (entity)var, NIL));
301  fprintf(stderr,"\nSysteme en p a ajouter: ");
302  fprint_psysteme(stderr,ps);
303  }
304 
305  if (sc_aux->nb_ineq == 1) {
306  /* there is already an unique minimum */
307  vectp = vect_del_var(vect_dup((sc_aux->inegalites)->vecteur), var);
308 
309  /* add inequalities on the max */
310  cont = sc_aux->egalites;
311  while (sc_aux->egalites != NULL) {
312  cont = sc_aux->egalites;
313  sc_aux->egalites = (sc_aux->egalites)->succ;
314  cont->succ = NULL;
315  sc_add_inegalite(sc_aux, cont);
316  }
317  sc_aux = sc_append(sc_aux, ps);
318 
319  /* put the value of the min in the equality */
320  sc_add_egalite_at_end(sc_aux, contrainte_make(vectp));
321  sc_aux = my_clean_ps(sc_aux);
322 
323  /* search on the next t variable */
324  lsys_aux2 = build_list_of_min(lsys->succ, lnew->cdr, sc_aux);
325 
326  if (lsys_aux2 != NULL)
327  lsys_aux = add_sclist_to_sclist(lsys_aux, lsys_aux2);
328  else
329  lsys_aux = add_sc_to_sclist(sc_aux, lsys_aux);
330  }
331  else {
332  for (cont = sc_aux->inegalites; cont != NULL; cont = cont->succ) {
333  /* for each possible minimum build new system */
334  ps_aux2 = sc_dup(sc_aux);
335  vect = vect_dup(cont->vecteur);
336  val = vect_coeff(var, vect);
337  vectp = vect_del_var(vect_dup(cont->vecteur), var);
338 
339  /* include new value of the min in the system */
340  for (cont2 = ps_aux2->inegalites; cont2 != NULL; cont2 = cont2->succ) {
341  vect2 = cont2->vecteur;
342  val2 = vect_coeff(var, vect2);
343  vect2 = vect_del_var(vect2, var);
344  vect2 = vect_multiply(vect2, value_abs(val));
345  vect2 = vect_add(vect_multiply(vect_dup(vectp), val2), vect2);
346  cont2->vecteur = vect2;
347  }
348  /* put the inequality on the current minimum */
349  sc_add_inegalite(ps_aux2, contrainte_make(vect));
350 
351  /* add inequalities on the max */
352  cont2 = ps_aux2->egalites;
353  while (ps_aux2->egalites != NULL) {
354  cont2 = ps_aux2->egalites;
355  cont2->succ = NULL;
356  sc_add_inegalite(ps_aux2, cont2);
357  ps_aux2->egalites = (ps_aux2->egalites)->succ;
358  }
359 
360  ps_aux2 = sc_append(ps_aux2, sc_dup(ps));
361 
362  /* put the minimum value that is the l in "t = omega*to + l" */
363  /* in the equality part of the system. Problem if val != 1 */
364  sc_add_egalite_at_end(ps_aux2, contrainte_make(vectp));
365 
366  sc_normalize(ps_aux2);
367 
368  /* get the next dimension */
369  lsys_aux2 = build_list_of_min(lsys->succ, lnew->cdr, ps_aux2);
370 
371  if (lsys_aux2 != NULL)
372  lsys_aux = add_sclist_to_sclist(lsys_aux, lsys_aux2);
373  else
374  lsys_aux = add_sc_to_sclist(ps_aux2, lsys_aux);
375  }
376  }
377  }
378 
379  if (get_debug_level() > 5) {
380  fprintf(stderr, "\n Liste de systeme build part min : ");
381  sl_fprint(stderr, lsys, entity_local_name);
382  }
383 
384  return(lsys_aux);
385 }
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
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
Psyslist add_sc_to_sclist(Psysteme sc, Psyslist lsys)
=================================================================
Definition: makebdt.c:1985
void fprint_psysteme(FILE *, Psysteme)
===========================================================================
Definition: print.c:302
Psyslist build_list_of_min(Psyslist lsys, list lnew, Psysteme ps)
=======================================================================
Definition: reindexing.c:276
Psysteme my_clean_ps(Psysteme ps)
=======================================================================
Psyslist add_sclist_to_sclist(Psyslist l1, Psyslist l2)
=======================================================================
Psysteme sc_add_egalite_at_end(Psysteme ps, Pcontrainte co)
=======================================================================
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
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
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
void sl_fprint(in_fi, in_sl, char *(*in_fu)())
Definition: sc_list.c:447
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
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
Warning! Do not modify this file that is automatically generated!
Definition: union-local.h:3
Psysteme psys
Definition: union-local.h:4
struct Ssyslist * succ
Definition: union-local.h:5
Pcontrainte inegalites
Definition: sc-local.h:71
int nb_ineq
Definition: sc-local.h:73
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct cons * cdr
The pointer to the next element.
Definition: newgen_list.h:43
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
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
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53
Pvecteur vect_del_var(Pvecteur v_in, Variable var)
Pvecteur vect_del_var(Pvecteur v_in, Variable var): allocation d'un nouveau vecteur egal a la project...
Definition: unaires.c:206
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 add_sc_to_sclist(), add_sclist_to_sclist(), CAR, cons::cdr, CONS, contrainte_make(), Ssysteme::egalites, ENTITY, entity_local_name(), fprint_entity_list(), fprint_psysteme(), fprintf(), get_debug_level(), Ssysteme::inegalites, my_clean_ps(), Ssysteme::nb_ineq, NIL, sc_add_egalite_at_end(), sc_add_inegalite(), sc_append(), sc_dup(), sc_normalize(), sl_fprint(), Scontrainte::succ, value_abs, vect_add(), vect_coeff(), vect_del_var(), vect_dup(), vect_multiply(), and Scontrainte::vecteur.

Referenced by prepare_reindexing().

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

◆ build_local_time_test()

instruction build_local_time_test ( entity  t,
list  l 
)

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

instruction build_local_time_test(t, l)

Builds the insruction corresponding to: IF t_local > ub THEN t_local = -1 ENDIF

t = entity of the local time; l = list of the ub (expression);

AC 94/06/14

build the expression t-local = -1

make the test expression

Definition at line 471 of file reindexing.c.

474 {
475  expression upper = EXPRESSION(CAR(l)), exp;
476  instruction ins;
477  call ca;
478  list lexp;
479  statement stat;
480 
481  /* build the expression t-local = -1 */
486  stat = MAKE_STATEMENT(ins);
487 
488  /* make the test expression */
493 
496 
497  return(ins);
498 }
#define GREATER_THAN_OPERATOR_NAME

References ADD_ELEMENT_TO_LIST, ASSIGN_OPERATOR_NAME, CAR, CONS, entity_intrinsic(), exp, EXPRESSION, GREATER_THAN_OPERATOR_NAME, int_to_expression(), is_instruction_call, is_instruction_test, is_syntax_call, lexp, make_call(), make_empty_statement, make_entity_expression(), make_expression(), make_instruction(), MAKE_STATEMENT, make_syntax(), make_test(), NIL, and normalized_undefined.

Referenced by build_third_comb().

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

◆ dataflows_on_reference()

list dataflows_on_reference ( list  cls,
reference  crhs,
predicate  pred,
list lm 
)

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

list dataflows_on_reference(cls, crhs, pred, lm)

Selects in the list of successors cls the one that correspond to the domain pred on which we are working and for the current rhs. The list lm will contain the corresponding list of statement of the choosen dataflow.

AC 94/04/06

Definition at line 398 of file reindexing.c.

402 {
403  Psysteme psd = sc_dup(predicate_to_system(pred)), sys_pred;
404  list ldata, ldat, lpred, ld;
405  int stat_pred;
406  vertex vert_pred;
407 
408  ldat = NIL;
409  *lm = NIL;
410  ldata = NIL; ld = NIL;
411 
412  if (get_debug_level() > 6) {
413  fprintf(stderr, "\nDataflow on reference %s debut:",
415  fprintf(stderr, "\nDomain noeud:");
416  fprint_psysteme(stderr, psd);
417  }
418 
419  for (lpred = cls; lpred != NIL; POP(lpred)) {
420  successor suc = SUCCESSOR(CAR(lpred));
421  vert_pred = successor_vertex(suc);
422  stat_pred = vertex_int_stmt(vert_pred);
423 
424  if (get_debug_level() > 6)
425  fprintf(stderr,"\nSuccesseur en cours : %d\n",stat_pred);
426 
428 
429  for (ld = ldata; ld != NIL; POP(ld)) {
430  dataflow d = DATAFLOW(CAR(ld));
432  if (get_debug_level() > 6) {
433  fprintf(stderr, "\nDomain arc:");
434  fprint_psysteme(stderr, sys_pred);
435  }
436  sys_pred = sc_append(sys_pred, psd);
437  sc_normalize(sys_pred);
438 
439  if (reference_equal_p(crhs, dataflow_reference(d))) {
440  if (SC_RN_P(sys_pred) ||
442  if (get_debug_level() > 6) {
443  fprintf(stderr, "\nDomain inter donc faisabilite:");
444  fprint_psysteme(stderr, sys_pred);
445  }
446  ADD_ELEMENT_TO_LIST(ldat, DATAFLOW, d);
447  ADD_ELEMENT_TO_LIST(*lm, INT, stat_pred);
448  }
449  }
450  }
451  }
452 
453  if (get_debug_level() > 6)
454  fprintf(stderr, "\nDataflow on ref fin\n");
455 
456  return(ldat);
457 }
Psysteme predicate_to_system(predicate p)
=================================================================
Definition: bdt_utils.c:298
#define successor_vertex(x)
Definition: graph.h:118
#define successor_arc_label(x)
Definition: graph.h:116
#define SUCCESSOR(x)
SUCCESSOR.
Definition: graph.h:86
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
int vertex_int_stmt(vertex)
===========================================================================
Definition: utils.c:866
#define DATAFLOW(x)
DATAFLOW.
Definition: paf_ri.h:308
#define dfg_arc_label_dataflows(x)
Definition: paf_ri.h:378
#define dataflow_governing_pred(x)
Definition: paf_ri.h:344
#define dataflow_reference(x)
Definition: paf_ri.h:340
bool reference_equal_p(reference r1, reference r2)
Definition: expression.c:1500
#define reference_variable(x)
Definition: ri.h:2326
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
#define NO_OFL_CTRL

References ADD_ELEMENT_TO_LIST, CAR, DATAFLOW, dataflow_governing_pred, dataflow_reference, dfg_arc_label_dataflows, entity_local_name(), fprint_psysteme(), fprintf(), get_debug_level(), INT, NIL, NO_OFL_CTRL, POP, predicate_to_system(), reference_equal_p(), reference_variable, sc_append(), sc_dup(), sc_normalize(), sc_rational_feasibility_ofl_ctrl(), SUCCESSOR, successor_arc_label, successor_vertex, and vertex_int_stmt().

Referenced by build_third_comb(), and build_third_subcomb().

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

◆ get_number_of_ins()

int get_number_of_ins ( entity  e)

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

int get_number_of_ins(e): gives back the number of the node.

AC 94/07/28

Definition at line 638 of file reindexing.c.

640 {
641  int n = 0;
642  char *c;
643 
644  c = (char*) malloc(32);
645 
646  c = strcpy(c, (entity_local_name(e)+4));
647  n = atoi(c) + BASE_NODE_NUMBER;
648 
649  if (get_debug_level() > 5)
650  fprintf(stderr,"\nNumero de l'instruction de %s = %d",
651  entity_local_name(e), n);
652 
653  free(c);
654 
655  return(n);
656 }
void * malloc(YYSIZE_T)
void free(void *)
#define BASE_NODE_NUMBER

References BASE_NODE_NUMBER, entity_local_name(), fprintf(), free(), get_debug_level(), and malloc().

Referenced by reference_filter().

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

◆ get_time_ent()

entity get_time_ent ( int  st,
char *  typ,
int  count 
)

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

entity get_time_ent(typ, count)

Returns the entity that represents the global time variable "t_count" for the program. If it does not exist yet, we create it. AC 94/05/30

AP 95/04/20: entities must have in their full name the current module name instead of RE_MODULE_NAME.

full_name = strdup(concatenate(RE_MODULE_NAME, MODULE_SEP_STRING, name, NULL));

We create it, if it does not exist yet

Definition at line 156 of file reindexing.c.

159 {
160  char name[32], *full_name;
161  entity new_coeff;
162 
163  if (!strncmp(typ, STRING_BDT, 1))
164  sprintf(name, "%s%d%s%d", STAT_SYM, st, typ, count);
165  else
166  sprintf(name, "%s%d%s%d", STAT_SYM, st - BASE_NODE_NUMBER, typ, count);
167 
168  /* full_name = strdup(concatenate(RE_MODULE_NAME, MODULE_SEP_STRING,
169  name, NULL));
170  */
172  MODULE_SEP_STRING, name, NULL));
173 
175 
176  /* We create it, if it does not exist yet */
177  if (new_coeff == entity_undefined) {
178  if (!strncmp(typ, STRING_BDT, 1))
179  new_coeff = create_new_entity(st, STRING_BDT, count);
180  else
181  new_coeff = create_new_entity(st - BASE_NODE_NUMBER,
182  STRING_TAU, count);
183  }
184 
185  return(new_coeff);
186 }
string db_get_current_module_name(void)
Also used to check whether set...
Definition: database.c:1059
static int count
Definition: SDG.c:519
#define full_name(dir, name)
Definition: compile.c:414
#define MODULE_SEP_STRING
Definition: naming-local.h:30
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define STAT_SYM
#define STRING_BDT
Name : reindexing.c Package : reindexing Author : Alexis Platonoff & Antoine Cloue Date : april 1994 ...
Definition: reindexing.c:97
entity create_new_entity(int st, char *typ, int nb)
========================================================================
#define entity_undefined
Definition: ri.h:2761
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410
char * strdup()

References BASE_NODE_NUMBER, concatenate(), count, create_new_entity(), db_get_current_module_name(), entity_domain, entity_undefined, full_name, gen_find_tabulated(), MODULE_SEP_STRING, STAT_SYM, strdup(), STRING_BDT, and STRING_TAU.

Referenced by build_contraction_matrices(), build_first_comb(), build_third_comb(), and re_do_it().

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

◆ make_increment_instruction()

instruction make_increment_instruction ( entity  t,
int  i 
)

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

instruction make_increment_instruction(t, i): returns the instruction: t = t + i

AC 94/06/09

Definition at line 610 of file reindexing.c.

References ADD_ELEMENT_TO_LIST, ASSIGN_OPERATOR_NAME, CONS, entity_intrinsic(), EXPRESSION, int_to_expression(), is_instruction_call, is_syntax_call, lexp, make_call(), make_entity_expression(), make_expression(), make_instruction(), make_syntax(), NIL, normalized_undefined, and PLUS_OPERATOR_NAME.

Referenced by build_flag_test(), build_third_comb(), and re_do_it().

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

◆ make_init_time()

instruction make_init_time ( entity  en,
expression  ex 
)

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

instruction make_init_time(en, ex) : build the instruction: en = ex

AC 94/06/15

Definition at line 588 of file reindexing.c.

591 {
592  call ca;
593  list lexp = NIL;
594 
598 
600 }

References ADD_ELEMENT_TO_LIST, ASSIGN_OPERATOR_NAME, CONS, entity_intrinsic(), EXPRESSION, is_instruction_call, lexp, make_call(), make_entity_expression(), make_instruction(), and NIL.

Referenced by build_first_comb(), and build_third_comb().

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

◆ reindexing()

bool reindexing ( char*  mod_name)

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

void reindexing((char*) mod_name):

Initialize debugging functions

We get the required data: module entity, code, static_control,

dataflow graph.

mod_stat = copy_statement((statement) db_get_memory_resource(DBR_CODE, mod_name, true));

The DFG, the BDT and the PLC

First we count the number of nodes to initialize the hash tables

The temporary variables counter

Remove the old code:

And replace it by the new one:

print the values of the delay

Parameters
mod_nameodule

Definition at line 664 of file reindexing.c.

666 {
667  extern int tc;
668 
669  graph the_dfg;
670  bdt the_bdt;
671  plc the_plc;
672  entity ent;
673  static_control stco;
674  statement mod_stat, new_mod_stat;
675  int nb_nodes;
676  list l;
678 
679  /* Initialize debugging functions */
680  debug_on("REINDEXING_DEBUG_LEVEL");
681  if (get_debug_level() > 0)
682  user_log("\n\n *** COMPUTE REINDEXING for %s\n", mod_name);
683 
684  /* We get the required data: module entity, code, static_control, */
685  /* dataflow graph. */
686  ent = local_name_to_top_level_entity( mod_name );
687 
688  if (ent != get_current_module_entity())
689  {
692  }
693 
694  /* mod_stat = copy_statement((statement) db_get_memory_resource(DBR_CODE, mod_name,
695  true));*/
696  mod_stat = (statement) db_get_memory_resource(DBR_CODE, mod_name, false);
697  STS = (statement_mapping)db_get_memory_resource(DBR_STATIC_CONTROL,
698  mod_name, false);
701 
703 
704  if (stco == static_control_undefined)
705  pips_internal_error("This is an undefined static control !");
706 
707  if (!static_control_yes(stco))
708  pips_internal_error("This is not a static control program !");
709 
710 
711  /* The DFG, the BDT and the PLC */
712  the_dfg = (graph)db_get_memory_resource(DBR_ADFG, mod_name, true);
713  the_bdt = (bdt)db_get_memory_resource(DBR_BDT, mod_name, true);
714  the_plc = (plc)db_get_memory_resource(DBR_PLC, mod_name, true);
715 
716  if (get_debug_level() > 0)
717  {
718  fprint_dfg(stderr, the_dfg);
719  fprint_bdt(stderr, the_bdt);
720  fprint_plc(stderr, the_plc);
721  }
722 
723  /* First we count the number of nodes to initialize the hash tables */
724  nb_nodes = 0;
725  for(l = graph_vertices(the_dfg); !ENDP(l); POP(l))
726  nb_nodes++;
730 
731  /* The temporary variables counter */
732  tc = 0;
733 
734  new_mod_stat = re_do_it(the_dfg, the_bdt, the_plc);
735 
736  /* Remove the old code: */
738  /* And replace it by the new one: */
740  new_mod_stat,
741  NIL));
742  DB_PUT_MEMORY_RESOURCE(DBR_REINDEXED_CODE, strdup(mod_name),
743  (char*) mod_stat);
746  db_get_memory_resource(DBR_CODE,
747  mod_name, true) );
749 
750  DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(mod_name), (char*) mod_stat);
752 
753  /* print the values of the delay */
754  if (get_debug_level() > 0)
755  fprint_delay(stderr, the_dfg, delay_table);
756 
757  if(get_debug_level() > 0)
758  user_log("\n\n *** REINDEXING done\n");
759 
762 
765 
766  debug_off();
767 
768  return(true);
769 }
void user_log(const char *format,...)
Definition: message.c:234
void free_instruction(instruction p)
Definition: ri.c:1118
void fprint_dfg(FILE *fp, graph obj)
===========================================================================
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
statement re_do_it(graph the_dfg, bdt the_bdt, plc the_plc)
======================================================================
Definition: cell.c:3038
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
#define graph_vertices(x)
Definition: graph.h:82
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
instruction make_instruction_block(list statements)
Build an instruction block from a list of statements.
Definition: instruction.c:106
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
#define debug_on(env)
Definition: misc-local.h:157
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
hash_table statement_mapping
these macros are obsolete! newgen functions (->) should be used instead
Definition: newgen-local.h:42
@ hash_int
Definition: newgen_hash.h:32
void reset_current_stco_map(void)
========================================================================
Definition: utils.c:2423
static_control get_stco_from_current_map(statement)
========================================================================
Definition: utils.c:2429
void set_current_stco_map(statement_mapping)
========================================================================
Definition: utils.c:2408
void fprint_bdt(FILE *, bdt)
===========================================================================
Definition: print.c:352
struct _newgen_struct_bdt_ * bdt
Definition: paf_ri.h:72
#define static_control_params(x)
Definition: paf_ri.h:755
#define static_control_yes(x)
Definition: paf_ri.h:753
#define static_control_undefined
Definition: paf_ri.h:727
struct _newgen_struct_plc_ * plc
Definition: paf_ri.h:144
void fprint_plc(FILE *fp, plc obj)
========================================================================
Definition: print.c:85
graph the_dfg
The placement function.
Definition: prgm_mapping.c:99
int nb_nodes
The timing function.
Definition: prgm_mapping.c:101
bdt the_bdt
The data flow graph.
Definition: prgm_mapping.c:100
void fprint_delay(FILE *fp, graph g, hash_table t)
======================================================================
Definition: delay.c:221
static int tc
Internal variables
Definition: reindexing.c:107
hash_table h_node
Definition: reindexing.c:108
hash_table ht_ab
Definition: reindexing.c:110
list lparams
Array bounds.
Definition: reindexing.c:111
hash_table delay_table
Name : delay.c Package : reindexing Author : Alexis Platonoff Date : March 1995 Historic :
Definition: reindexing.c:109
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
#define statement_instruction(x)
Definition: ri.h:2458
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References CONS, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, delay_table, ENDP, fprint_bdt(), fprint_delay(), fprint_dfg(), fprint_plc(), free_instruction(), get_current_module_entity(), get_current_module_statement(), get_debug_level(), get_stco_from_current_map(), graph_vertices, h_node, hash_int, hash_table_free(), hash_table_make(), ht_ab, local_name_to_top_level_entity(), lparams, make_instruction_block(), mod_stat, nb_nodes, NIL, pips_internal_error, POP, re_do_it(), reset_current_module_entity(), reset_current_module_statement(), reset_current_stco_map(), set_current_module_entity(), set_current_module_statement(), set_current_stco_map(), STATEMENT, statement_instruction, static_control_params, static_control_undefined, static_control_yes, strdup(), STS, tc, the_bdt, the_dfg, and user_log().

+ Here is the call graph for this function:

Variable Documentation

◆ delay_table

hash_table delay_table

Name : delay.c Package : reindexing Author : Alexis Platonoff Date : March 1995 Historic :

Documents: SOON Comments : This file contains the functions dealing with the dealy. Ansi includes
Newgen includes
C3 includes
Pips includes
External variables

Definition at line 109 of file reindexing.c.

Referenced by build_first_comb(), calculate_delay(), fprint_delay(), make_array_bounds(), re_do_it(), reference_filter(), and reindexing().

◆ h_node

hash_table h_node

◆ ht_ab

hash_table ht_ab

Definition at line 110 of file reindexing.c.

Referenced by make_array_bounds(), prepare_array_bounds(), and reindexing().

◆ lparams

◆ tc