PIPS
makebdt.c File Reference
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include <stdlib.h>
#include "genC.h"
#include "ri.h"
#include "constants.h"
#include "ri-util.h"
#include "misc.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 "complexity_ri.h"
#include "database.h"
#include "dg.h"
#include "parser_private.h"
#include "property.h"
#include "reduction.h"
#include "tiling.h"
#include "text.h"
#include "text-util.h"
#include "graph.h"
#include "paf_ri.h"
#include "paf-util.h"
#include "pipsdbm.h"
#include "resources.h"
#include "array_dfg.h"
#include "pip.h"
#include "static_controlize.h"
#include "scheduling.h"
+ Include dependency graph for makebdt.c:

Go to the source code of this file.

Data Structures

struct  n_coef
 
struct  bdt_node
 
struct  sys_list
 

Macros

#define my_polynome_fprint(fp, p)    polynome_fprint(fp,p,entity_local_name,default_is_inferior_var);
 

Typedefs

typedef dfg_arc_label arc_label
 C3 includes
More...
 
typedef dfg_vertex_label vertex_label
 
typedef struct n_coef n_coef
 
typedef struct n_coefPn_coef
 
typedef struct bdt_node bdt_node
 
typedef struct bdt_nodePbdt_node
 
typedef struct sys_list sys_list
 
typedef struct sys_listPsys_list
 

Functions

entity create_var_name (char *Type, int source, int dest, int count)
 ===================================================================== More...
 
static Psys_list add_elt_to_sys_list (Psys_list ls, int s, Psysteme ps)
 ===================================================================== More...
 
static void fprint_sys_list (FILE *fp, Psys_list ls)
 ===================================================================== More...
 
static Pn_coef make_n_coef (entity e, Pvecteur v)
 ===================================================================== More...
 
static Pn_coef add_n_coef_to_list (Pn_coef l1, Pn_coef l2)
 ===================================================================== More...
 
static void fprint_coef_list (FILE *fp, Pn_coef l)
 ===================================================================== More...
 
static Pn_coef add_lcoef_to_lcoef (Pn_coef l1, Pn_coef l2)
 ================================================================= More...
 
list extract_lambda_list (list l)
 ================================================================= More...
 
list reorder_base (list l, list lu)
 ================================================================= More...
 
static Pn_coef add_lambda_list (Pn_coef lunk, list lvar)
 ================================================================= More...
 
list make_x_list (int c)
 ================================================================= More...
 
static Pn_coef add_x_list (Pn_coef lunk, list lvar, entity *me)
 ================================================================= More...
 
static list extract_var_list (Pn_coef lc)
 ================================================================= More...
 
static void clean_list_of_unk (Pn_coef *l, Psysteme *sc)
 ================================================================= More...
 
list make_list_of_n (char *n, int c)
 ================================================================= More...
 
bool is_stat_in_pred_list (int stat, list pred_list)
 ===================================================================== More...
 
Psysteme include_parameters_in_sc (Psysteme sys, int source)
 ===================================================================== More...
 
static void create_farkas_poly (Psysteme Psys, char *Type, int source, int dest, Ppolynome *p, Pn_coef *l, int *c)
 ===================================================================== More...
 
static void make_proto (hash_table h, sccs rg)
 ================================================================= More...
 
bdt build_bdt_null (vertex v)
 ================================================================= More...
 
bool if_no_pred (scc s, bdt *b)
 ================================================================= More...
 
Psysteme erase_trivial_ineg (Psysteme p)
 ================================================================= More...
 
Ppolynome include_trans_in_poly (int s, Ppolynome p, list l, int *d)
 ================================================================= More...
 
Psysteme transform_in_ineq (Psysteme sc, list l)
 ================================================================= More...
 
int get_m_coef (expression *e, int *de)
 ================================================================= More...
 
bool coef_of_M_equal (expression *exp1, expression *exp2)
 ====================================================================== More...
 
bool list_of_exp_equals_1n_p (list l1, list l2, int n)
 ====================================================================== More...
 
quast compact_quast (quast q, int n)
 ====================================================================== More...
 
list get_list_of_all_param (int s, int t)
 ================================================================= More...
 
bool is_uniform_rec (list l, Ppolynome p)
 ================================================================= More...
 
Psysteme include_trans_in_sc (int s, Psysteme sys, list l)
 ================================================================= More...
 
Ppolynome make_polynome_Xe (int xc, entity *xe)
 ================================================================= More...
 
list add_others_variables (list lvar, list n_lvar)
 ================================================================= More...
 
Psysteme make_causal_internal (int stat_dest, Psysteme sys_dest, Ppolynome poly_dest, list ldata, int stat_pred, Psysteme sys_pred, Ppolynome poly_source, int *c, int xc, entity *xe, int den)
 ================================================================= More...
 
Psysteme make_causal_external (int stat_dest, Psysteme sys_dest, Ppolynome poly_dest, list ldata, int stat_pred, Psysteme sys_pred, Ppolynome poly_source, int *c, int den)
 ================================================================= More...
 
list make_sched_proto (matrice h, int lin, int col, list lu)
 ================================================================= More...
 
Psysteme system_new_var_subst (Psysteme sys, list l)
 ================================================================= More...
 
Psysteme add_constraint_on_x (Psysteme psys, list lx)
 ================================================================= More...
 
static Psysteme make_primal (Psysteme psys, list *lvar_u, list *lvp, list lxe)
 ================================================================= More...
 
list get_exp_schedule (expression e, entity me, int d)
 ================================================================= More...
 
static Psysteme get_unsatisfied_system (list lexp, Psys_list *lsys, list *lxe, Pn_coef *lunk, entity me, int de)
 ================================================================= More...
 
static void make_list_of_unk (Pn_coef *l, Psysteme *sc, entity *me, list lx)
 ================================================================= More...
 
Psysteme get_predicate_system_of_node (int st, scc s)
 ================================================================= More...
 
Psyslist add_sc_to_sclist (Psysteme sc, Psyslist lsys)
 ================================================================= More...
 
Psysteme simplify_predicate (Psysteme ps, Psysteme ps_eq, list l)
 ================================================================= More...
 
list simplify_dimension (list ld, Psysteme ps_eq, list l)
 ================================================================= More...
 
bdt simplify_bdt (bdt b, scc s)
 ================================================================= More...
 
static Psysteme make_dual (Psysteme psys, Psysteme *pcont, Pn_coef l, list *lvar_u, list lvp)
 ================================================================= More...
 
static Pn_coef extract_stat_lunk (int stat, Pn_coef lunk)
 ================================================================= More...
 
bdt include_results_in_bdt (bdt b, bdt baux, list lexp)
 ================================================================= More...
 
bool is_mu_stat_in_sc (int stat, Psysteme sc)
 ================================================================= More...
 
static bdt analyze_quast (quast q, int stat, Pn_coef lunk, Psys_list lsys, bdt b, list lxe, entity me)
 ================================================================= More...
 
bdt make_bdt_initial (int stat, scc s)
 ================================================================= More...
 
bdt write_resulting_bdt (scc s, int stat, bdt bs, bdt bg)
 ================================================================= More...
 
static bdt search_scc_bdt (scc s)
 ================================================================= More...
 
bdt search_graph_bdt (sccs rgraph)
 ================================================================= More...
 

Variables

hash_table h_node
 

Macro Definition Documentation

◆ my_polynome_fprint

#define my_polynome_fprint (   fp,
 
)     polynome_fprint(fp,p,entity_local_name,default_is_inferior_var);

Definition at line 82 of file makebdt.c.

Typedef Documentation

◆ arc_label

C3 includes

Pips includes
GO: include "loop_normalize.h" Local defines

Definition at line 79 of file makebdt.c.

◆ bdt_node

typedef struct bdt_node bdt_node

◆ n_coef

typedef struct n_coef n_coef

◆ Pbdt_node

typedef struct bdt_node* Pbdt_node

◆ Pn_coef

typedef struct n_coef * Pn_coef

◆ Psys_list

typedef struct sys_list * Psys_list

◆ sys_list

typedef struct sys_list sys_list

◆ vertex_label

Definition at line 80 of file makebdt.c.

Function Documentation

◆ add_constraint_on_x()

Psysteme add_constraint_on_x ( Psysteme  psys,
list  lx 
)

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

Psysteme add_constraint_on_x(psys, lx): in the Psysteme psys, we add the constraints on the introduced variables Xe: Xe <= 1.

AC 94/01/27

Definition at line 1691 of file makebdt.c.

1695 {
1696  entity e;
1697  Ppolynome p;
1698  Pcontrainte c;
1699  list l, lx_r;
1700 
1701  lx_r = gen_nreverse(lx);
1702 
1703  for (l = lx_r; l != NIL; l = CDR(l))
1704  {
1705  e = ENTITY(CAR(l));
1706  if (!strncmp(entity_local_name(e), "X", 1))
1707  {
1708  p = make_polynome((float)1, (Variable) e, 1);
1709  p = polynome_decr(p);
1710  c = polynome_to_contrainte(p);
1711  sc_add_inegalite(psys, c);
1712  psys->base = base_add_variable(psys->base, (Variable) e);
1713  psys->dimension++;
1714  }
1715  }
1716 
1717  lx = gen_nreverse(lx_r);
1718 
1719  return(psys);
1720 }
Pbase base_add_variable(Pbase b, Variable var)
Pbase base_add_variable(Pbase b, Variable v): add variable v as a new dimension to basis b at the end...
Definition: base.c:88
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
Pcontrainte polynome_to_contrainte(Ppolynome)
========================================================================
Definition: utils.c:1095
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
Ppolynome polynome_decr(Ppolynome pp)
Ppolynome polynome_decr(Ppolynome pp) returns pp - 1.
Definition: pnome-scal.c:246
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_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
Pbase base
Definition: sc-local.h:75
int dimension
Definition: sc-local.h:74
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
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 base_add_variable(), CAR, CDR, ENTITY, entity_local_name(), gen_nreverse(), make_polynome(), NIL, polynome_decr(), polynome_to_contrainte(), and sc_add_inegalite().

Referenced by get_unsatisfied_system(), and search_scc_bdt().

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

◆ add_elt_to_sys_list()

static Psys_list add_elt_to_sys_list ( Psys_list  ls,
int  s,
Psysteme  ps 
)
static

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

Psys_list add_elt_to_sys_list(ls, s, ps): add a system in the list of Psysteme.

AC 94/01/27

Definition at line 136 of file makebdt.c.

141 {
142  Psys_list aux, la, lb;
143 
144  aux = (Psys_list)malloc(sizeof(sys_list));
145  aux->nb = s;
146  aux->sys = sc_dup(ps);
147  aux->next = NULL;
148 
149  if (ls == NULL) ls = aux;
150  else
151  {
152  lb = ls;
153  while (lb != NULL)
154  {
155  la = lb;
156  lb = lb->next;
157  }
158  la->next = aux;
159  }
160 
161  return(ls);
162 }
void * malloc(YYSIZE_T)
struct sys_list * Psys_list
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
int aux
Definition: solpip.c:104
struct sys_list * next
Definition: makebdt.c:102

References aux, malloc(), sys_list::next, and sc_dup().

Referenced by get_unsatisfied_system(), and search_scc_bdt().

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

◆ add_lambda_list()

static Pn_coef add_lambda_list ( Pn_coef  lunk,
list  lvar 
)
static

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

Pn_coef add_lambda_list(lunk, lvar): lvar contains the lambda list that we transform in a list of Pn_coef that we append to lunk.

AC 93/11/15

Definition at line 337 of file makebdt.c.

341 {
342  Pn_coef aux;
343 
344  while (lvar != NIL)
345  {
346  aux = make_n_coef(ENTITY(CAR(lvar)), VECTEUR_NUL);
347  lunk = add_n_coef_to_list(lunk, aux);
348  lvar = CDR(lvar);
349  }
350 
351  return (lunk);
352 }
static Pn_coef add_n_coef_to_list(Pn_coef l1, Pn_coef l2)
=====================================================================
Definition: makebdt.c:213
static Pn_coef make_n_coef(entity e, Pvecteur v)
=====================================================================
Definition: makebdt.c:191
Definition: makebdt.c:87
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.

References add_n_coef_to_list(), aux, CAR, CDR, ENTITY, make_n_coef(), NIL, and VECTEUR_NUL.

Referenced by make_list_of_unk().

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

◆ add_lcoef_to_lcoef()

static Pn_coef add_lcoef_to_lcoef ( Pn_coef  l1,
Pn_coef  l2 
)
static

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

Pn_coef add_lcoef_to_lcoef(l1, l2): appends the list of Pn_coef l2 to l1.

AC 93/11/16

Definition at line 258 of file makebdt.c.

261 {
262  Pn_coef l;
263 
264  while (l2 != NULL)
265  {
266  l = l2;
267  l2 = l2->next;
268  l->next = NULL;
269  l1 = add_n_coef_to_list(l1, l);
270  }
271  return (l1);
272 }
struct n_coef * next
Definition: makebdt.c:90

References add_n_coef_to_list(), and n_coef::next.

Referenced by add_x_list(), make_causal_external(), make_causal_internal(), and search_scc_bdt().

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

◆ add_n_coef_to_list()

static Pn_coef add_n_coef_to_list ( Pn_coef  l1,
Pn_coef  l2 
)
static

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

Pn_coef add_n_coef_to_list(l1,l2): add the n_coef l2 at the end of the list l1.

AC 93/11/15

Definition at line 213 of file makebdt.c.

216 {
217  Pn_coef p = l1;
218 
219  if (p == NULL) l1 = l2;
220  else
221  {
222  while (p->next != NULL) p = p->next;
223  p->next = l2;
224  }
225 
226  return(l1);
227 }

References n_coef::next.

Referenced by add_lambda_list(), add_lcoef_to_lcoef(), add_x_list(), clean_list_of_unk(), create_farkas_poly(), extract_stat_lunk(), and make_list_of_unk().

+ Here is the caller graph for this function:

◆ add_others_variables()

list add_others_variables ( list  lvar,
list  n_lvar 
)

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

list add_others_variables(lvar, n_lvar): check if the elements of n_lvar are in lvar, if not add them in lvar.

AC 94/02/10

Definition at line 1286 of file makebdt.c.

1289 {
1290  entity ent;
1291 
1292  for (; n_lvar != NULL; n_lvar = CDR(n_lvar))
1293  {
1294  ent = ENTITY(CAR(n_lvar));
1295  if (!is_entity_in_list_p(ent, lvar))
1296  lvar = gen_append(lvar, CONS(ENTITY, ent, NIL));
1297  }
1298 
1299  return(lvar);
1300 }
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_append(list l1, const list l2)
Definition: list.c:471
bool is_entity_in_list_p(entity, list)
===========================================================================
Definition: utils.c:1281

References CAR, CDR, CONS, ENTITY, gen_append(), is_entity_in_list_p(), and NIL.

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:

◆ add_sc_to_sclist()

Psyslist add_sc_to_sclist ( Psysteme  sc,
Psyslist  lsys 
)

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

Psyslist add_sc_to_sclist(sc,lsys): add a system in the list of systems defined by Psyslist.

AC 93/12/23

Definition at line 1985 of file makebdt.c.

1989 {
1990  Psyslist lsys_aux;
1991 
1992  lsys_aux = (Psyslist)malloc(sizeof(Ssyslist));
1993 
1994  lsys_aux->psys = sc;
1995  lsys_aux->succ = lsys;
1996 
1997  return(lsys_aux);
1998 }
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
struct Ssyslist * Psyslist

References malloc(), Ssyslist::psys, and Ssyslist::succ.

Referenced by build_list_of_min(), prepare_reindexing(), search_scc_bdt(), separate_variables(), and separate_variables_2().

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

◆ add_x_list()

static Pn_coef add_x_list ( Pn_coef  lunk,
list  lvar,
entity me 
)
static

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

Pn_coef add_x_list(lunk, lvar, me): create the list of Pn_coef for the X, the second member is the big parameter we will use for PIP.

AC 94/01/27

Definition at line 391 of file makebdt.c.

396 {
397  Pn_coef aux, laux = NULL;
398  Pvecteur vect_m;
399 
400  *me = create_named_entity("My_Own_Private_M");
401  vect_m = vect_new((Variable)(*me), -1);
402 
403  while (lvar != NIL)
404  {
405  aux = make_n_coef(ENTITY(CAR(lvar)), vect_m);
406  laux = add_n_coef_to_list(laux, aux);
407  lvar = CDR(lvar);
408  }
409  lunk = add_lcoef_to_lcoef(laux, lunk);
410 
411  return(lunk);
412 }
entity create_named_entity(char *name)
=====================================================================
Definition: bdt_utils.c:85
static Pn_coef add_lcoef_to_lcoef(Pn_coef l1, Pn_coef l2)
=================================================================
Definition: makebdt.c:258
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
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

References add_lcoef_to_lcoef(), add_n_coef_to_list(), aux, CAR, CDR, create_named_entity(), ENTITY, make_n_coef(), NIL, and vect_new().

Referenced by make_list_of_unk().

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

◆ analyze_quast()

static bdt analyze_quast ( quast  q,
int  stat,
Pn_coef  lunk,
Psys_list  lsys,
bdt  b,
list  lxe,
entity  me 
)
static

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

bdt analyze_quast(q,lu,nb): this function substitute the new parameters that can appear, go down to each branch of the quast and analyze if all edge have been satisfied, if not find recur- sively the dimension of the schedule.

AC 94/01/27

see if there are some new parameters to replace

replace the new parameters in the predicate system

we process the true edge

we process the false edge

all the edges are satisfied, we get the schedule

some edges have not been satisfied: we get the

dimension of the schedule already calculated

and search the others

Definition at line 2446 of file makebdt.c.

2455 {
2456  list lsol, new_lsol, lnew, lst, lsf, ls, lu, lvp;
2457  predicate pred;
2458  conditional cond, cond_aux;
2459  quast_value quv;
2460  expression exp;
2461  quast_leaf qul;
2462  entity ent;
2463  var_val vv;
2464  Psysteme sys, st_sys, sf_sys;
2465  int m_coef, nb_arc, d;
2466  schedule st, sf;
2467  Pdisjunct dj;
2468  bdt bt, bf;
2469  quast qua;
2470  Pvecteur vu;
2471 
2472  new_lsol = NIL;
2473  lnew = NIL;
2474  quv = quast_quast_value(q);
2475  lnew = quast_newparms(q);
2476 
2477  ls = NIL;
2478  lst = NIL;
2479  lsf = NIL;
2480 
2481  if (quast_undefined_p(q))
2482  pips_internal_error("Quast should not be undefined!");
2483 
2484  if (bdt_undefined_p(b))
2485  {
2486  st = make_schedule(stat, predicate_undefined, NIL);
2487  b = make_bdt(CONS(SCHEDULE, st, NIL));
2488  }
2489  else st = SCHEDULE(CAR(bdt_schedules(b)));
2490 
2491  /* see if there are some new parameters to replace */
2492  if ((lnew != NIL) && (get_debug_level() > 5))
2493  {
2494  vv = VAR_VAL(CAR(lnew));
2495  ent = var_val_variable(vv);
2496  exp = var_val_value(vv);
2497  fprintf(stderr,"\nNouveau parametre :\n");
2498  fprint_entity_list(stderr, CONS(ENTITY,ent,NIL));
2499  fprintf(stderr," => ");
2501  }
2502 
2503  switch(quast_value_tag(quv))
2504  {
2506  cond = quast_value_conditional(quv);
2507  pred = conditional_predicate(cond);
2508  sys = sc_dup(predicate_to_system(pred));
2509 
2510  /* replace the new parameters in the predicate system */
2511  sys = system_new_var_subst(sys, lnew);
2512  sf = true_copy_schedule(st);
2515 
2516  /* we process the true edge */
2517  st_sys = sc_append(st_sys, sys);
2518 
2519  if (sc_rational_feasibility_ofl_ctrl(st_sys, NO_OFL_CTRL, true)) {
2520  st = make_schedule(stat, make_predicate(st_sys), NIL);
2521  bt = make_bdt(CONS(SCHEDULE, st, NIL));
2522  cond_aux = conditional_true_quast(cond);
2523  bt = analyze_quast(cond_aux, stat, lunk, lsys, bt, lxe, me);
2524  lst = bdt_schedules(bt);
2525  }
2526  else
2527  {
2528  lst = NIL;
2529  sc_rm(st_sys);
2530  }
2531 
2532  /* we process the false edge */
2533  dj = dj_system_complement(sys);
2534  sys = dj->psys;
2535  sf_sys = sc_append(sf_sys, sys);
2536 
2537  if (sc_rational_feasibility_ofl_ctrl(sf_sys, NO_OFL_CTRL, true))
2538  {
2539  sf = make_schedule(stat, make_predicate(sf_sys), NIL);
2540  bf = make_bdt(CONS(SCHEDULE, sf, NIL));
2541  cond_aux = conditional_false_quast(cond);
2542  bf = analyze_quast(cond_aux, stat, lunk, lsys, bf, lxe, me);
2543  lsf = bdt_schedules(bf);
2544  }
2545  else
2546  {
2547  lsf = NIL;
2548  sc_rm(sf_sys);
2549  }
2550 
2551  bdt_schedules(b) = gen_nconc(lst, lsf);
2552  sc_rm(sys);
2553  break;
2554 
2556  qul = quast_value_quast_leaf( quv );
2557  lsol = quast_leaf_solution( qul );
2558  exp = EXPRESSION(CAR(lsol));
2559  m_coef = get_m_coef(&exp, &d);
2560  nb_arc = gen_length(lxe);
2561  if (m_coef == nb_arc)
2562  {
2563  /* all the edges are satisfied, we get the schedule */
2564  if (get_debug_level() > 5)
2565  {
2566  fprintf(stderr,"\nTous les arcs sont satisfaits car\
2567  le coef de M est %d\n",m_coef);
2568  fprint_entity_list(stderr, lxe);
2569  fprint_entity_list(stderr,CONS(ENTITY,me,NIL));
2570  }
2571 
2572  schedule_dims(st) = get_exp_schedule(exp, me, d);
2573  }
2574  else
2575  {
2576  /* some edges have not been satisfied: we get the */
2577  /* dimension of the schedule already calculated */
2578  /* and search the others */
2579  if (get_debug_level() > 5)
2580  {
2581  fprintf(stderr,"\nTous les arcs ne sont pas satisfaits car\
2582  le coef de M est %d\n",m_coef);
2583  }
2584 
2585  new_lsol = get_exp_schedule(exp, me, d);
2586 
2587  sys = get_unsatisfied_system(lsol, &lsys, &lxe, me, d);
2588  clean_list_of_unk(&lunk, &sys);
2589 
2590  if (get_debug_level() > 5)
2591  {
2592  fprintf(stderr,"\nDimension trouvee :");
2593  fprint_list_of_exp(stderr, new_lsol);
2594  fprintf(stderr,"\n\n\nNb d'arc = %d", nb_arc);
2595  fprintf(stderr,"\nSYS LIST:\n");
2596  fprint_sys_list(stderr, lsys);
2597  fprint_entity_list(stderr, lxe);
2598  }
2599 
2600  bt = bdt_undefined;
2601 
2602  if (is_mu_stat_in_sc(stat, sys))
2603  {
2604  sys = make_primal(sys, &lu, &lvp, lxe);
2605 
2606  sys = make_dual(sys, &st_sys, lunk, &lu, lvp);
2607 
2608  vu = list_to_base(lu);
2609 
2610  if (get_debug_level() > 5)
2611  {
2612  fprint_psysteme(stderr,sys);
2613  fprintf(stderr,"\nSysteme de contraintes :\n");
2614  fprint_psysteme(stderr,st_sys);
2615  fprintf(stderr,"\nVct d'inconnues = \n");
2616  pu_vect_fprint(stderr, vu);
2617  fprintf(stderr,"\nBase de psys: ");
2618  pu_vect_fprint(stderr,sys->base);
2619  fprintf(stderr,"\nBase de sys_cont:");
2620  pu_vect_fprint(stderr,st_sys->base);
2621  }
2622 
2623  qua = pip_solve_min_with_big(sys, st_sys, vu, "My_Own_Private_M");
2624 
2625  qua = compact_quast(qua, gen_length(lxe));
2626 
2627  if (get_debug_level() > 5)
2628  {
2629  fprintf(stderr,"\n\nQuast de PIP (n_dim):");
2630  imprime_quast(stderr,qua);
2631  }
2632 
2633  bt = analyze_quast(qua, stat, lunk, lsys, bt, lxe, me);
2634 
2635  if (get_debug_level() > 5)
2636  {
2637  fprintf(stderr,"\nBdt apres analyze :");
2638  fprint_bdt(stderr,bt);
2639  }
2640  }
2641  b = include_results_in_bdt(b, bt, new_lsol);
2642  }
2643  break;
2644  }
2645 
2646  return(b);
2647 }
bdt make_bdt(list a)
Definition: paf_ri.c:54
schedule make_schedule(intptr_t a1, predicate a2, list a3)
Definition: paf_ri.c:613
predicate make_predicate(Psysteme a1)
Definition: ri.c:1820
schedule true_copy_schedule(schedule s)
=================================================================
Definition: bdt_utils.c:318
Psysteme predicate_to_system(predicate p)
=================================================================
Definition: bdt_utils.c:298
Pdisjunct dj_system_complement(Psysteme in_ps)
Pdisjunct dj_system_complement( (Psystem) in_ps ) AL 26/10/93 Input : A Psysteme.
Definition: disjunct.c:254
size_t gen_length(const list l)
Definition: list.c:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
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_m_coef(expression *e, int *de)
=================================================================
Definition: makebdt.c:954
static Psysteme make_primal(Psysteme psys, list *lvar_u, list *lvp, list lxe)
=================================================================
Definition: makebdt.c:1731
Psysteme system_new_var_subst(Psysteme sys, list l)
=================================================================
Definition: makebdt.c:1629
list get_exp_schedule(expression e, entity me, int d)
=================================================================
Definition: makebdt.c:1788
static void clean_list_of_unk(Pn_coef *l, Psysteme *sc)
=================================================================
Definition: makebdt.c:440
bool is_mu_stat_in_sc(int stat, Psysteme sc)
=================================================================
Definition: makebdt.c:2411
quast compact_quast(quast q, int n)
======================================================================
Definition: makebdt.c:1080
bdt include_results_in_bdt(bdt b, bdt baux, list lexp)
=================================================================
Definition: makebdt.c:2360
static void fprint_sys_list(FILE *fp, Psys_list ls)
=====================================================================
Definition: makebdt.c:171
static Psysteme make_dual(Psysteme psys, Psysteme *pcont, Pn_coef l, list *lvar_u, list lvp)
=================================================================
Definition: makebdt.c:2246
static bdt analyze_quast(quast q, int stat, Pn_coef lunk, Psys_list lsys, bdt b, list lxe, entity me)
=================================================================
Definition: makebdt.c:2446
static Psysteme get_unsatisfied_system(list lexp, Psys_list *lsys, list *lxe, Pn_coef *lunk, entity me, int de)
=================================================================
Definition: makebdt.c:1846
#define pips_internal_error
Definition: misc-local.h:149
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
Pbase list_to_base(list l)
Pbase list_to_base(list l): returns the Pbase that contains the variables of list "l",...
void pu_vect_fprint(FILE *, Pvecteur)
===========================================================================
Definition: print.c:446
void imprime_quast(FILE *, quast)
===========================================================================
Definition: print.c:514
void fprint_psysteme(FILE *, Psysteme)
===========================================================================
Definition: print.c:302
void fprint_bdt(FILE *, bdt)
===========================================================================
Definition: print.c:352
#define var_val_value(x)
Definition: paf_ri.h:795
#define conditional_true_quast(x)
Definition: paf_ri.h:302
#define var_val_variable(x)
Definition: paf_ri.h:793
#define bdt_undefined_p(x)
Definition: paf_ri.h:205
#define SCHEDULE(x)
SCHEDULE.
Definition: paf_ri.h:682
@ 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_newparms(x)
Definition: paf_ri.h:629
#define quast_leaf_solution(x)
Definition: paf_ri.h:591
#define quast_value_tag(x)
Definition: paf_ri.h:672
#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 VAR_VAL(x)
VAR_VAL.
Definition: paf_ri.h:763
#define quast_value_quast_leaf(x)
Definition: paf_ri.h:675
#define quast_undefined_p(x)
Definition: paf_ri.h:604
#define quast_quast_value(x)
Definition: paf_ri.h:627
#define conditional_predicate(x)
Definition: paf_ri.h:300
#define bdt_undefined
Definition: paf_ri.h:204
#define quast_value_conditional(x)
Definition: paf_ri.h:678
quast pip_solve_min_with_big(Psysteme ps_dep, Psysteme ps_context, Pvecteur pv_unknowns, char *big)
==========================================================================
Definition: pip.c:331
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
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define predicate_undefined
Definition: ri.h:2046
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Definition: sc_alloc.c:277
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207
#define NO_OFL_CTRL

References Ssysteme::base, bdt_schedules, bdt_undefined, bdt_undefined_p, CAR, clean_list_of_unk(), compact_quast(), conditional_false_quast, conditional_predicate, conditional_true_quast, CONS, dj_system_complement(), ENTITY, exp, EXPRESSION, fprint_bdt(), fprint_entity_list(), fprint_list_of_exp(), fprint_psysteme(), fprint_sys_list(), fprintf(), gen_length(), gen_nconc(), get_debug_level(), get_exp_schedule(), get_m_coef(), get_unsatisfied_system(), imprime_quast(), include_results_in_bdt(), is_mu_stat_in_sc(), is_quast_value_conditional, is_quast_value_quast_leaf, list_to_base(), make_bdt(), make_dual(), make_predicate(), make_primal(), make_schedule(), NIL, NO_OFL_CTRL, pip_solve_min_with_big(), pips_internal_error, predicate_to_system(), predicate_undefined, Ssyslist::psys, pu_vect_fprint(), quast_leaf_solution, quast_newparms, quast_quast_value, quast_undefined_p, quast_value_conditional, quast_value_quast_leaf, quast_value_tag, sc_append(), sc_dup(), sc_rational_feasibility_ofl_ctrl(), sc_rm(), SCHEDULE, schedule_dims, schedule_predicate, sys_list::sys, system_new_var_subst(), true_copy_schedule(), VAR_VAL, var_val_value, and var_val_variable.

Referenced by search_scc_bdt().

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

◆ build_bdt_null()

bdt build_bdt_null ( vertex  v)

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

build_bdt_null(v): update the hash table by making the schedule null

AC 93/10/29

Definition at line 733 of file makebdt.c.

736 {
737  Pbdt_node node;
738  int stat;
739  schedule sche;
740  expression exp;
741  list lexp, lsche;
742  bdt b;
743 
745  node = (Pbdt_node)hash_get(h_node, (char *) stat);
746  exp = int_to_expression(0);
747 
748  lexp = CONS(EXPRESSION, exp, NIL);
749  sche = make_schedule(stat, predicate_undefined, lexp);
750  lsche = CONS(SCHEDULE, sche, NIL);
751  b = make_bdt(lsche);
752  node->n_bdt = true_copy_bdt(b);
753 
754  if (get_debug_level() > 5) fprint_bdt(stderr,node->n_bdt);
755 
756  return(b);
757 }
static void node(FILE *out, string name)
Build for module name a node and link to its successors.
Definition: graph.c:56
static list lexp
bdt true_copy_bdt(bdt b)
=====================================================================
Definition: bdt_utils.c:354
#define vertex_vertex_label(x)
Definition: graph.h:152
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
hash_table h_node
Definition: makebdt.c:85
struct bdt_node * Pbdt_node
#define dfg_vertex_label_statement(x)
Definition: paf_ri.h:413
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 CONS, dfg_vertex_label_statement, exp, EXPRESSION, fprint_bdt(), get_debug_level(), h_node, hash_get(), int_to_expression(), lexp, make_bdt(), make_schedule(), NIL, node(), predicate_undefined, SCHEDULE, true_copy_bdt(), and vertex_vertex_label.

Referenced by if_no_pred().

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

◆ clean_list_of_unk()

static void clean_list_of_unk ( Pn_coef l,
Psysteme sc 
)
static

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

void clean_list_of_unk(l, sc): update the list of unknown for the problem by erasing the unknown that have been already calculated.

AC 94/01/27

Definition at line 440 of file makebdt.c.

444 {
445  Pn_coef lout, laux, lin = *l;
446  list base;
447 
448  lout = NULL;
449  base = base_to_list((*sc)->base);
450 
451  while (lin != NULL)
452  {
453  laux = lin;
454  lin = lin->next;
455  laux->next = NULL;
456  if (is_entity_in_list_p(laux->n_ent, base))
457  lout = add_n_coef_to_list(lout, laux);
458  }
459 
460  base = extract_var_list(lout);
461  (*sc)->base = list_to_base(base);
462 
463  *l = lout;
464 }
bdt base
Current expression.
Definition: bdt_read_paf.c:100
list base_to_list(Pbase base)
Most includes are centralized here.
static list extract_var_list(Pn_coef lc)
=================================================================
Definition: makebdt.c:421
entity n_ent
Definition: makebdt.c:88

References add_n_coef_to_list(), base, base_to_list(), extract_var_list(), is_entity_in_list_p(), list_to_base(), n_coef::n_ent, and n_coef::next.

Referenced by analyze_quast().

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

◆ coef_of_M_equal()

bool coef_of_M_equal ( expression exp1,
expression exp2 
)

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

bool coef_of_M_equal(exp1, exp2): tests if two expressions have the same coefficient of "M".

AC 94/02/08

Definition at line 1017 of file makebdt.c.

1020 {
1021  expression e1 = *exp1, e2 = *exp2;
1022  int d1, d2, m1, m2;
1023 
1024  m1 = get_m_coef(&e1, &d1);
1025  m2 = get_m_coef(&e2, &d2);
1026 
1027  return( !(m1-m2) );
1028 }

References get_m_coef().

Referenced by list_of_exp_equals_1n_p().

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

◆ compact_quast()

quast compact_quast ( quast  q,
int  n 
)

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

quast compact_quast(q, n): try to reduce a quast when it is a condi- tional quast by testing the possible equality between the false edge and the true edge, and if it exists, suppress one.

AC 94/01/03

may be possible source of bug here

Definition at line 1080 of file makebdt.c.

1084 {
1085  quast tq, fq;
1086  quast_value qv;
1087  conditional cond;
1088  list lf, lt;
1089 
1090  if (q == quast_undefined) return (q);
1091 
1092  qv = quast_quast_value(q);
1093  if (qv == quast_value_undefined) return(q);
1094 
1095  if (quast_value_quast_leaf_p(qv)) return(q);
1096  else
1097  {
1098  cond = quast_value_conditional(qv);
1099  tq = conditional_true_quast(cond);
1100  fq = conditional_false_quast(cond);
1101 
1102  /* may be possible source of bug here */
1103  if (quast_undefined_p(tq) || \
1105  return(fq);
1106 
1107  else if (quast_undefined_p(fq) ||\
1109  return(tq);
1110 
1113  {
1115  (quast_quast_value(tq)));
1117  (quast_quast_value(fq)));
1118 
1119  if (list_of_exp_equals_1n_p(lt, lf, n))
1120  {
1121  free_quast(fq);
1122  return(tq);
1123  }
1124  else return(q);
1125  }
1126  else
1127  {
1128  tq = compact_quast(tq, n);
1129  fq = compact_quast(fq, n);
1130 
1133  {
1135  (quast_quast_value(tq)));
1137  (quast_quast_value(fq)));
1138  if (list_of_exp_equals_1n_p(lt, lf, n))
1139  {
1140  q = tq;
1141  free_quast(fq);
1142  return(q);
1143  }
1144  else
1145  {
1146  conditional_true_quast(cond) = tq;
1147  conditional_false_quast(cond) = fq;
1148  return(q);
1149  }
1150  }
1151  else
1152  {
1153  conditional_true_quast(cond) = tq;
1154  conditional_false_quast(cond) = fq;
1155  return(q);
1156  }
1157  }
1158  }
1159 }
void free_quast(quast p)
Definition: paf_ri.c:483
bool list_of_exp_equals_1n_p(list l1, list l2, int n)
======================================================================
Definition: makebdt.c:1037
#define quast_undefined
Definition: paf_ri.h:603
#define quast_value_undefined
Definition: paf_ri.h:639
#define quast_value_quast_leaf_p(x)
Definition: paf_ri.h:673
#define quast_value_undefined_p(x)
Definition: paf_ri.h:640

References conditional_false_quast, conditional_true_quast, free_quast(), list_of_exp_equals_1n_p(), quast_leaf_solution, quast_quast_value, quast_undefined, quast_undefined_p, quast_value_conditional, quast_value_quast_leaf, quast_value_quast_leaf_p, quast_value_undefined, and quast_value_undefined_p.

Referenced by analyze_quast(), and search_scc_bdt().

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

◆ create_farkas_poly()

static void create_farkas_poly ( Psysteme  Psys,
char *  Type,
int  source,
int  dest,
Ppolynome p,
Pn_coef l,
int c 
)
static

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

create_farkas_poly() : that function creates the farkas polynom of a node, from the execution domain "psys". The coefficients created have the form NAME_i_j_k with i the statement of the source node, j the statement of the destination node (=0 in the case of a MU polynom) and k the number of the coefficient. The name NAME is given by Type. The polynome created is put in "p", each coefficient created is put in the list of Pn_coef "l" with the vector he is the coef. of, (0 in case of a Lambda coef), and "c" is a counter of tthe created coefficient.

AC 93/10/28

creation of the constant term of the polynom

exploring the Psystem, i.e. each inegality of the execution

domain, and making each component

exploring the Psystem, i.e. each inegality of the execution

domain, and making each component

Definition at line 580 of file makebdt.c.

588 {
589  int i, count = *c;
590  Pcontrainte cont;
591  Pvecteur vect, vect_aux;
592  Ppolynome poly, poly_aux;
593  entity ent;
594  Pn_coef coef;
595 
596  poly = *p;
597 
598  if (get_debug_level() > 5)
599  fprintf(stderr,"\nXXX creer equation farkas XXX\n");
600 
601  if (POLYNOME_UNDEFINED_P(poly))
602  {
603  /* creation of the constant term of the polynom */
604  ent = create_var_name(Type, source, dest, count);
605  vect = vect_new((Variable)TCST, (Value)1);
606  coef = make_n_coef(ent, vect);
607  *l = add_n_coef_to_list(*l, coef);
608  poly = make_polynome((float)1, (Variable)ent, (Value)1);
609  count++;
610 
611  if (!SC_UNDEFINED_P(Psys))
612  {
614  cont = Psys->inegalites;
615 
616  /* exploring the Psystem, i.e. each inegality of the execution */
617  /* domain, and making each component */
618  for (i = 0 ; i < Psys->nb_ineq ; i++)
619  {
620  vect = vect_dup(cont->vecteur);
621  ent = create_var_name(Type, source, dest, count);
622 
623  vect_aux = vect_new((Variable)ent, (Value)1);
624  vect_chg_sgn(vect);
625 
626  coef = make_n_coef(ent, vect);
627  *l = add_n_coef_to_list(*l, coef);
628 
629  poly_aux = vecteur_mult(vect, vect_aux);
630  polynome_add(&poly, poly_aux);
631 
632  count++;
633  cont = cont->succ;
634  }
635  }
636  }
637  else
638  {
639  if (!SC_UNDEFINED_P(Psys))
640  {
642  cont = Psys->inegalites;
643 
644  /* exploring the Psystem, i.e. each inegality of the execution */
645  /* domain, and making each component */
646  for (i = 0 ; i< Psys->nb_ineq ; i++)
647  {
648  vect = vect_dup(cont->vecteur);
649  ent = create_var_name(Type, source, dest, count);
650 
651  vect_aux = vect_new((Variable)ent, (Value)1);
652  vect_chg_sgn(vect);
653 
654  coef = make_n_coef(ent, vect);
655  *l = add_n_coef_to_list(*l, coef);
656 
657  poly_aux = vecteur_mult(vect, vect_aux);
658  polynome_add(&poly, poly_aux);
659 
660  count++;
661  cont = cont->succ;
662  }
663  }
664  }
665 
666  *p = poly;
667 
668  if (get_debug_level() > 5)
669  {
670  fprintf(stderr,"\nP[%d] = ",source);
671  my_polynome_fprint(stderr, poly);
672  fprintf(stderr,"\n");
673  }
674 
675  *c = count;
676 }
static int count
Definition: SDG.c:519
int Value
#define my_polynome_fprint(fp, p)
Definition: makebdt.c:82
entity create_var_name(char *Type, int source, int dest, int count)
=====================================================================
Definition: makebdt.c:113
Ppolynome vecteur_mult(Pvecteur, Pvecteur)
========================================================================
Definition: utils.c:2024
void polynome_add(Ppolynome *ppp, Ppolynome pp2)
void polynome_add(Ppolynome* ppp, Ppolynome pp2) (*ppp) = (*ppp) + pp2.
Definition: pnome-bin.c:171
#define POLYNOME_UNDEFINED_P(pp)
void sc_transform_eg_in_ineg(Psysteme sc)
Package sc.
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
Pvecteur vect_aux
Definition: solpip.c:102
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
int nb_ineq
Definition: sc-local.h:73
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
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

References add_n_coef_to_list(), count, create_var_name(), fprintf(), get_debug_level(), make_n_coef(), make_polynome(), my_polynome_fprint, polynome_add(), POLYNOME_UNDEFINED_P, sc_transform_eg_in_ineg(), Scontrainte::succ, TCST, vect_aux, vect_chg_sgn(), vect_dup(), vect_new(), Scontrainte::vecteur, and vecteur_mult().

Referenced by make_causal_external(), make_causal_internal(), and make_proto().

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

◆ create_var_name()

entity create_var_name ( char *  Type,
int  source,
int  dest,
int  count 
)

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

entity create_var_name(type,source,dest,count) : create the variable to iut in the vector that we construct in "create_farkas_poly". Returns an entity for printing commmodities.

AC 93/11/28

Definition at line 113 of file makebdt.c.

119 {
120  char *name;
121 
122  asprintf(&name, "%s_%d_%d_%d", Type, source, dest, count);
123 
124  entity e = (create_named_entity(name));
125  free(name);
126  return e;
127 }
void free(void *)
#define asprintf
Definition: misc-local.h:225

References asprintf, count, create_named_entity(), and free().

Referenced by create_farkas_poly().

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

◆ erase_trivial_ineg()

Psysteme erase_trivial_ineg ( Psysteme  p)

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

Psysteme erase_trivial_ineg(p): erase from the psysteme p all inequalities like -MU<=0.

AC 93/11/22

Definition at line 796 of file makebdt.c.

799 {
800  Pcontrainte cont;
801  Pvecteur vect;
802 
803  if (!SC_UNDEFINED_P(p))
804  {
805  for (cont = p->inegalites ; cont != NULL ; cont = cont->succ)
806  {
807  vect = cont->vecteur;
808  if ((vect != NULL)&&value_negz_p(vect->val)&&(vect->succ == NULL))
809  {
810  vect_rm(cont->vecteur);
811  cont->vecteur = NULL;
812  }
813  }
814  }
815 
816  return(p);
817 }
#define value_negz_p(val)
Value val
Definition: vecteur-local.h:91
struct Svecteur * succ
Definition: vecteur-local.h:92
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References Scontrainte::succ, Svecteur::succ, Svecteur::val, value_negz_p, vect_rm(), and Scontrainte::vecteur.

Referenced by search_scc_bdt().

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

◆ extract_lambda_list()

list extract_lambda_list ( list  l)

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

list extract_lambda_list(l): from the list l, extract the sublist of entities whose name is beginning by "LAMBDA".

AC 93/11/15

Definition at line 281 of file makebdt.c.

284 {
285  entity ent;
286  char *name;
287  list laux = NIL;
288 
289  while (l != NIL)
290  {
291  ent = ENTITY(CAR(l));
292  name = entity_local_name(ent);
293  if (!strncmp(name, "LAMBDA", 6))
294  ADD_ELEMENT_TO_LIST(laux, ENTITY, ent);
295  l = CDR(l);
296  }
297 
298  return (laux);
299 }
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50

References ADD_ELEMENT_TO_LIST, CAR, CDR, ENTITY, entity_local_name(), and NIL.

Referenced by make_list_of_unk().

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

◆ extract_stat_lunk()

static Pn_coef extract_stat_lunk ( int  stat,
Pn_coef  lunk 
)
static

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

static Pn_coef extract_stat_lunk(stat, lunk): creates the good second member for the dual problem based on the general second member lunk. This function is used when we search the schedule of each node in a scc one after the other.

AC 94/01/10

Definition at line 2322 of file makebdt.c.

2326 {
2327  Pn_coef lv_coef, laux, pn;
2328  char *name;
2329  int len;
2330  entity ent;
2331 
2332  asprintf(&name, "%s_%d", "MU", stat);
2333  len = strlen(name);
2334  lv_coef = NULL;
2335 
2336  for (laux = lunk; laux != NULL; laux = laux->next)
2337  {
2338  ent = laux->n_ent;
2339  if (!strncmp(name, entity_local_name(ent), len))
2340  pn = make_n_coef(ent, laux->n_vect);
2341  else if (!strncmp("X", entity_local_name(ent), 1))
2342  pn = make_n_coef(ent, laux->n_vect);
2343  else pn = make_n_coef(ent, VECTEUR_NUL);
2344  lv_coef = add_n_coef_to_list(lv_coef, pn);
2345  }
2346  free(name);
2347 
2348  return(lv_coef);
2349 }
Pvecteur n_vect
Definition: makebdt.c:89

References add_n_coef_to_list(), asprintf, entity_local_name(), free(), make_n_coef(), n_coef::n_ent, n_coef::n_vect, n_coef::next, and VECTEUR_NUL.

Referenced by search_scc_bdt().

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

◆ extract_var_list()

static list extract_var_list ( Pn_coef  lc)
static

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

list extract_var_list(lc): extract from the list of Pn_coef lc the variables and put them in a list it returns.

AC 93/11/15

Definition at line 421 of file makebdt.c.

424 {
425  list l = NIL;
426 
427  for ( ; lc != NULL; lc = lc->next)
429 
430  return(l);
431 }

References ADD_ELEMENT_TO_LIST, ENTITY, and NIL.

Referenced by clean_list_of_unk(), make_causal_external(), make_causal_internal(), and make_list_of_unk().

+ Here is the caller graph for this function:

◆ fprint_coef_list()

static void fprint_coef_list ( FILE *  fp,
Pn_coef  l 
)
static

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

void fprint_coef_list(fp,l): print in the file fp the list of Pn_coef l.

AC 93/11/15

Definition at line 236 of file makebdt.c.

240 {
241  while (l != NULL)
242  {
243  fprintf(fp,"Entite : ");
244  fprintf(fp,"%s",entity_local_name(l->n_ent));
245  fprintf(fp,", Vecteur : ");
246  pu_vect_fprint(fp,l->n_vect);
247  l = l->next;
248  }
249 }

References entity_local_name(), fprintf(), n_coef::n_ent, n_coef::n_vect, n_coef::next, and pu_vect_fprint().

Referenced by search_scc_bdt().

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

◆ fprint_sys_list()

static void fprint_sys_list ( FILE *  fp,
Psys_list  ls 
)
static

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

void fprint_sys_list(fp,ls): print in the file fp the list of systems ls.

AC 94/01/27

Definition at line 171 of file makebdt.c.

175 {
176  for (; ls != NULL; ls = ls->next)
177  {
178  fprintf(fp,"\n");
179  fprint_psysteme(fp, ls->sys);
180  fprintf(fp,"\n");
181  }
182 }
Psysteme sys
Definition: makebdt.c:101

References fprint_psysteme(), fprintf(), sys_list::next, and sys_list::sys.

Referenced by analyze_quast().

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

◆ get_exp_schedule()

list get_exp_schedule ( expression  e,
entity  me,
int  d 
)

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

list get_exp_schedule(e,me,d): extract form the expression exp given by the resulting quast of PIP the expression of the schedule we search: it takes the expression, put the coef of "M" to 0, and change the sign of the vector.

AC 94/01/27

Definition at line 1788 of file makebdt.c.

1793 {
1794  list lexp;
1795  Pvecteur v;
1796  expression exp;
1797  call ca;
1798  syntax syn;
1799  entity func;
1800 
1801  if (!expression_undefined_p(e))
1802  {
1803  if (d == 1)
1804  {
1807  vect_chg_coeff(&v, (Variable) me, 0);
1808  vect_chg_sgn(v);
1809  e = make_vecteur_expression(v);
1811  }
1812  else
1813  {
1814  ca = syntax_call(expression_syntax(e));
1815  lexp = call_arguments(ca);
1816  func = call_function(ca);
1817  exp = EXPRESSION(CAR(lexp));
1819  lexp = CDR(lexp);
1821  vect_chg_coeff(&v, (Variable) me, 0);
1822  vect_chg_sgn(v);
1825  lexp = CONS(EXPRESSION, exp, lexp);
1826  ca = make_call(func, lexp);
1827  syn = make_syntax(is_syntax_call, ca);
1829  }
1830  }
1831 
1832  return(CONS(EXPRESSION, e, NIL));
1833 }
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
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 NORMALIZE_EXPRESSION(e)
expression make_vecteur_expression(Pvecteur pv)
make expression for vector (Pvecteur)
Definition: expression.c:1650
#define normalized_undefined
Definition: ri.h:1745
#define call_function(x)
Definition: ri.h:709
@ is_syntax_call
Definition: ri.h:2693
#define expression_normalized(x)
Definition: ri.h:1249
#define syntax_call(x)
Definition: ri.h:2736
#define expression_undefined_p(x)
Definition: ri.h:1224
#define call_arguments(x)
Definition: ri.h:711
#define normalized_linear(x)
Definition: ri.h:1781
#define expression_syntax(x)
Definition: ri.h:1247
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 call_arguments, call_function, CAR, CDR, CONS, exp, EXPRESSION, expression_normalized, expression_syntax, expression_undefined_p, is_syntax_call, lexp, make_call(), make_expression(), make_syntax(), make_vecteur_expression(), NIL, NORMALIZE_EXPRESSION, normalized_linear, normalized_undefined, syntax_call, unnormalize_expression(), vect_chg_coeff(), and vect_chg_sgn().

Referenced by analyze_quast().

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

◆ get_list_of_all_param()

list get_list_of_all_param ( int  s,
int  t 
)

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

list get_list_of_all_param(s, t): get the entire list of the parame- ters for a deisganted node.

AC 94/02/08

Definition at line 1168 of file makebdt.c.

1171 {
1172  static_control stct;
1173  list l, m;
1174  entity ent;
1175 
1177  l = static_control_params(stct);
1178  l = gen_append(l, static_control_to_indices(stct));
1179 
1181  m = static_control_params(stct);
1182  m = gen_append(m, static_control_to_indices(stct));
1183 
1184  for (; m != NIL; m = CDR(m))
1185  {
1186  ent = ENTITY(CAR(m));
1187  if (!is_entity_in_list_p(ent, l))
1188  l = gen_append(l, CONS(ENTITY, ent, NIL));
1189  }
1190 
1191  return(l);
1192 }
statement adg_number_to_statement(int in_nb)
======================================================================
Definition: adg_utils.c:461
list static_control_to_indices(static_control)
package mapping : Alexis Platonoff, july 1993
Definition: utils.c:1037
static_control get_stco_from_current_map(statement)
========================================================================
Definition: utils.c:2429
#define static_control_params(x)
Definition: paf_ri.h:755

References adg_number_to_statement(), CAR, CDR, CONS, ENTITY, gen_append(), get_stco_from_current_map(), is_entity_in_list_p(), NIL, static_control_params, and static_control_to_indices().

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:

◆ get_m_coef()

int get_m_coef ( expression e,
int de 
)

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

int get_m_coef(e, de): get the coefficient of the variable "m" in the expression "e".

AC 94/01/20

Definition at line 954 of file makebdt.c.

958 {
959  int d, mc = 0;
960  Pvecteur vect;
961  expression exp, e_aux = *e;
962  entity ent;
963 
964  analyze_expression(&e_aux, &d);
965 
966  if (d == 1)
967  {
968  NORMALIZE_EXPRESSION(e_aux);
970 
971  while (!VECTEUR_NUL_P(vect))
972  {
973  if (vect->var != TCST)
974  {
975  ent = (entity)vect->var;
976  if (!strncmp(entity_local_name(ent), "My_Own_Private_M", 16))
977  mc = VALUE_TO_INT(vect->val);
978  }
979  vect = vect->succ;
980  }
981  }
982  else
983  {
985  (expression_syntax(e_aux)))));
988 
989  while (!VECTEUR_NUL_P(vect))
990  {
991  if (vect->var != TCST)
992  {
993  ent = (entity)vect->var;
994  if (!strncmp(entity_local_name(ent), "My_Own_Private_M", 16))
995  mc = VALUE_TO_INT(vect->val);
996  }
997  vect = vect->succ;
998  }
999  mc/=d;
1000  }
1001 
1002  unnormalize_expression(e_aux);
1003 
1004  *de = d;
1005  *e = e_aux;
1006 
1007  return (mc);
1008 }
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14
#define VALUE_TO_INT(val)
void analyze_expression(expression *e, int *d)
=====================================================================
Definition: bdt_utils.c:480
if(!(yy_init))
Definition: genread_lex.c:1029
Variable var
Definition: vecteur-local.h:90
#define VECTEUR_NUL_P(v)

References analyze_expression(), call_arguments, CAR, entity_local_name(), exp, EXPRESSION, expression_normalized, expression_syntax, if(), NORMALIZE_EXPRESSION, normalized_linear, Svecteur::succ, syntax_call, TCST, unnormalize_expression(), Svecteur::val, VALUE_TO_INT, Svecteur::var, and VECTEUR_NUL_P.

Referenced by analyze_quast(), coef_of_M_equal(), and get_unsatisfied_system().

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

◆ get_predicate_system_of_node()

Psysteme get_predicate_system_of_node ( int  st,
scc  s 
)

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

Psysteme get_predicate_system_of_node(st,s): get the system of constraints of a node of statement "st" in a given scc.

AC 93/12/20

Definition at line 1950 of file makebdt.c.

1954 {
1955  list lver;
1956  vertex ver;
1957  Psysteme sys = SC_UNDEFINED;
1958  bool not_found = true;
1959 
1960  lver = scc_vertices(s);
1961 
1962  while ((lver != NIL) && (not_found))
1963  {
1964  ver = VERTEX(CAR(lver));
1965 
1966  if (st == vertex_int_stmt(ver))
1967  {
1970  not_found = false;
1971  }
1972  lver = CDR(lver);
1973  }
1974 
1975  return(sys);
1976 }
#define scc_vertices(x)
Definition: dg.h:345
#define VERTEX(x)
VERTEX.
Definition: graph.h:122
int vertex_int_stmt(vertex)
===========================================================================
Definition: utils.c:866
#define dfg_vertex_label_exec_domain(x)
Definition: paf_ri.h:415

References CAR, CDR, dfg_vertex_label_exec_domain, NIL, predicate_to_system(), scc_vertices, sys_list::sys, VERTEX, vertex_int_stmt(), and vertex_vertex_label.

Referenced by make_bdt_initial(), and simplify_bdt().

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

◆ get_unsatisfied_system()

static Psysteme get_unsatisfied_system ( list  lexp,
Psys_list lsys,
list lxe,
Pn_coef lunk,
entity  me,
int  de 
)
static

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

Psysteme get_unsatisfied_system(): we check the coefficient of "m" in the solution of the dual variable of "xe", if it is nil we update the list of system that could be unsatis- fied, the list of Xe, and we build the new system for the primal problem. lsys is updated, lunk too. "me" contains the entity "M".

AC 94/01/20

this edge is unsatisfied

we have to add the constraints X<=1

Definition at line 1846 of file makebdt.c.

1853 {
1854  Psys_list ls, ls_new;
1855  list lx, lx_new;
1856  Psysteme sys;
1857  expression exp;
1858 
1859  lexp = CDR(lexp);
1860  lx = *lxe;
1861  sys = sc_new();
1862  lx_new = NIL;
1863  ls_new = NULL;
1864 
1865  if (get_debug_level() > 5)
1866  {
1867  fprintf(stderr,"\nList :");
1868  fprint_list_of_exp(stderr,lexp);
1869  }
1870 
1871  for (ls = *lsys; ls != NULL; ls = ls->next)
1872  {
1873  exp = EXPRESSION(CAR(lexp));
1874  if (get_m_coef(&exp, &de) == 0)
1875  {
1876  /* this edge is unsatisfied */
1877  ls_new = add_elt_to_sys_list(ls_new, 0, ls->sys);
1878  ADD_ELEMENT_TO_LIST(lx_new, ENTITY, ENTITY(CAR(lx)));
1879  sys = sc_append(sys, ls->sys);
1880  }
1881  lexp = CDR(lexp);
1882  lx = CDR(lx);
1883  }
1884 
1885  /* we have to add the constraints X<=1 */
1886  sys = add_constraint_on_x(sys, lx_new);
1887 
1888  *lsys = ls_new;
1889  *lxe = lx_new;
1890 
1891  return(sys);
1892 }
static Psys_list add_elt_to_sys_list(Psys_list ls, int s, Psysteme ps)
=====================================================================
Definition: makebdt.c:136
Psysteme add_constraint_on_x(Psysteme psys, list lx)
=================================================================
Definition: makebdt.c:1691
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55

References add_constraint_on_x(), ADD_ELEMENT_TO_LIST, add_elt_to_sys_list(), CAR, CDR, ENTITY, exp, EXPRESSION, fprint_list_of_exp(), fprintf(), get_debug_level(), get_m_coef(), lexp, sys_list::next, NIL, sc_append(), sc_new(), and sys_list::sys.

Referenced by analyze_quast().

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

◆ if_no_pred()

bool if_no_pred ( scc  s,
bdt b 
)

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

if_no_pred(s, b): that function tests if the scc studied has only 1 vertex and no predecessor. Returns true in this case. At the same time, this function updates the field schedule of the hash table with the proper schedule, that is time=0

AC 93/10/29

Definition at line 768 of file makebdt.c.

772 {
773  list lver_a, lver_b, lsucc;
774  vertex v;
775 
776  lver_a = scc_vertices(s);
777  lver_b = CDR(lver_a);
778  v = VERTEX(CAR(lver_a));
779  lsucc = vertex_successors(v);
780 
781  if ((lver_b == NIL) && (lsucc == NIL))
782  {
783  *b = build_bdt_null(v);
784  return(true);
785  }
786  else return(false) ;
787 }
#define vertex_successors(x)
Definition: graph.h:154
bdt build_bdt_null(vertex v)
=================================================================
Definition: makebdt.c:733

References build_bdt_null(), CAR, CDR, NIL, scc_vertices, VERTEX, and vertex_successors.

Referenced by search_graph_bdt().

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

◆ include_parameters_in_sc()

Psysteme include_parameters_in_sc ( Psysteme  sys,
int  source 
)

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

Psysteme include_parameters_in_sc(sys,source): include in the systeme "sys" the parameters that it does not contain at that moment, and put them under an inequality (for example: n>=0).

AC 94/01/05

Definition at line 533 of file makebdt.c.

537 {
538  list lent;
539  Variable var;
540  Pvecteur vect;
541  Pcontrainte cont;
542  static_control stct;
543 
545  lent = static_control_params(stct);
546 
547  if (sys == NULL) sys = sc_new();
548 
549  for (; lent != NIL; lent = CDR(lent))
550  {
551  var = (Variable)ENTITY(CAR(lent));
552 
553  if (!system_contains_var(sys, var))
554  {
555  vect = vect_new(var, (Value)-1);
556  cont = contrainte_make(vect);
557  sc_add_inegalite(sys, cont);
558  sys->base = base_add_variable(sys->base, var);
559  sys->dimension++;
560  }
561  }
562 
563  return(sys);
564 }
bool system_contains_var(Psysteme ps, Variable var)
=====================================================================
Definition: bdt_utils.c:382
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73

References adg_number_to_statement(), Ssysteme::base, base_add_variable(), CAR, CDR, contrainte_make(), Ssysteme::dimension, ENTITY, get_stco_from_current_map(), NIL, sc_add_inegalite(), sc_new(), static_control_params, sys_list::sys, system_contains_var(), and vect_new().

Referenced by make_causal_external(), make_causal_internal(), and make_proto().

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

◆ include_results_in_bdt()

bdt include_results_in_bdt ( bdt  b,
bdt  baux,
list  lexp 
)

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

bdt include_results_in_bdt(b, baux, lexp): in case of a multi dimensionnal bdt, this function is used to append the dimension calculated at this step (lexp) with the dimensions calculated before (b) and the dimensions calculated after (baux);

AC 94/10/27

update the predicate

update the list of expressions

Definition at line 2360 of file makebdt.c.

2364 {
2365  list ls, le, lexp_aux;
2366  schedule sched;
2367  Psysteme sys, sc;
2368  predicate pred;
2369 
2370  if (!bdt_undefined_p(baux))
2371  {
2372  ls = bdt_schedules(baux);
2374  sys = predicate_to_system(pred);
2375 
2376  for (; ls != NIL; ls = CDR(ls))
2377  {
2378  lexp_aux = CONS(EXPRESSION,(EXPRESSION(CAR(lexp))),NIL);
2379 
2380  /* update the predicate */
2381  sched = SCHEDULE(CAR(ls));
2383  sc = sc_append(sc,sys);
2384  schedule_predicate(sched) = make_predicate(sc);
2385 
2386  /* update the list of expressions */
2387  le = schedule_dims(sched);
2388  le = gen_nconc(lexp_aux, le);
2389  schedule_dims(sched) = le;
2390  }
2391  b = baux;
2392  }
2393  else
2394  {
2395  ls = bdt_schedules(b);
2396  sched = SCHEDULE(CAR(ls));
2397  schedule_dims(sched) = lexp;
2398  bdt_schedules(b) = CONS(SCHEDULE, sched, NIL);
2399  }
2400 
2401  return(b);
2402 }

References bdt_schedules, bdt_undefined_p, CAR, CDR, CONS, EXPRESSION, gen_nconc(), lexp, make_predicate(), NIL, predicate_to_system(), sc_append(), SCHEDULE, schedule_dims, schedule_predicate, and sys_list::sys.

Referenced by analyze_quast().

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

◆ include_trans_in_poly()

Ppolynome include_trans_in_poly ( int  s,
Ppolynome  p,
list  l,
int d 
)

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

Ppolynome include_trans_in_poly((int)s,(Ppolynome)p,(list)l): list contains the list of expression defining the edge trans- formation we want to apply to the node of statement s. This function replaces the old variable values by their new values in the polynome p. This is done in 2 steps; first we replace each variable by a local one,and put this one in a list; then we replace the local variable by the expression of the transformation.

AC 93/11/03

we get the list of the englobing loop of the studied node

replace all variables by a local one

replace all local variables by the transformation

Definition at line 832 of file makebdt.c.

837 {
838  list lindice, lexp, lind, lvar, lv;
839  static_control stct;
840  char *name;
841  expression exp;
842  Ppolynome poly_trans;
843  int count = 0, den = 1;
844  Variable var, v;
845  entity ent;
846 
847  if ((p != (Ppolynome)NIL)||(l != NIL))
848  {
849  /* we get the list of the englobing loop of the studied node */
851  lindice = static_control_to_indices(stct);
852 
853  lvar = NIL;
854  name = (char*) malloc(100);
855 
856  /* replace all variables by a local one */
857  for (lind = lindice; lind != NIL; lind = CDR(lind))
858  {
859  var = (Variable)ENTITY(CAR(lind));
860  sprintf(name, "myownprivatevariable_%d", count);
861  ent = create_named_entity(name);
862 
863  if (polynome_contains_var(p, var))
864  poly_chg_var(p, var, (Variable)ent);
865  ADD_ELEMENT_TO_LIST(lvar, ENTITY, ent);
866  count++;
867  }
868  free(name);
869 
870  /* replace all local variables by the transformation */
871  lexp = l;
872 
873  for (lv = lvar; lv != NIL; lv = CDR(lv))
874  {
875  exp = EXPRESSION(CAR(lexp));
876  analyze_expression(&exp, &den);
877  poly_trans = expression_to_polynome(exp);
878  v = (Variable)ENTITY(CAR(lv));
879  if (polynome_contains_var(p, v))
880  p = prototype_var_subst(p, v, poly_trans);
881  lexp = CDR(lexp);
882  }
883 
884  gen_free_list(lindice);
885  gen_free_list(lvar);
886  }
887 
888  *d = den;
889 
890  return(p);
891 }
void poly_chg_var(Ppolynome pp, Variable v_old, Variable v_new)
=================================================================
Definition: bdt_utils.c:399
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
Ppolynome prototype_var_subst(Ppolynome, Variable, Ppolynome)
=================================================================
Definition: utils.c:1978
bool polynome_contains_var(Ppolynome pp, Variable var)
bool polynome_contains_var(Ppolynome pp, Variable var) PRIVATE returns true if variable var is in pol...
Definition: pnome-reduc.c:238
Ppolynome expression_to_polynome(expression exp)
===========================================================================
Definition: expression.c:3650

References ADD_ELEMENT_TO_LIST, adg_number_to_statement(), analyze_expression(), CAR, CDR, count, create_named_entity(), ENTITY, exp, EXPRESSION, expression_to_polynome(), free(), gen_free_list(), get_stco_from_current_map(), lexp, malloc(), NIL, poly_chg_var(), polynome_contains_var(), prototype_var_subst(), and static_control_to_indices().

Referenced by include_trans_in_sc(), make_causal_external(), and make_causal_internal().

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

◆ include_trans_in_sc()

Psysteme include_trans_in_sc ( int  s,
Psysteme  sys,
list  l 
)

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

Psysteme include_trans_in_sc(s,sys,l): include in a system the indice transformation introduced by an edge.

AC 93/12/20

Definition at line 1227 of file makebdt.c.

1232 {
1233  Pcontrainte cont;
1234  Pvecteur vect;
1235  Ppolynome poly;
1236  int d;
1237 
1238  for (cont = sys->inegalites; cont != NULL; cont = cont->succ)
1239  {
1240  vect = cont->vecteur;
1241  poly = vecteur_to_polynome(vect);
1242  poly = include_trans_in_poly(s, poly, l, &d);
1243  if (d != 1) cont->vecteur = vect_multiply(polynome_to_vecteur(poly), d);
1244  else cont->vecteur = polynome_to_vecteur(poly);
1245  }
1246 
1247  sys->base = BASE_UNDEFINED;
1248  sc_creer_base(sys);
1249 
1250  return(sys);
1251 }
Ppolynome include_trans_in_poly(int s, Ppolynome p, list l, int *d)
=================================================================
Definition: makebdt.c:832
Pvecteur polynome_to_vecteur(Ppolynome)
========================================================================
Definition: utils.c:1063
Ppolynome vecteur_to_polynome(Pvecteur pv)
===========================================================================
Definition: pnome-bin.c:406
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
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
#define BASE_UNDEFINED

References Ssysteme::base, BASE_UNDEFINED, include_trans_in_poly(), Ssysteme::inegalites, polynome_to_vecteur(), sc_creer_base(), Scontrainte::succ, sys_list::sys, vect_multiply(), Scontrainte::vecteur, and vecteur_to_polynome().

Referenced by compatible_pc_p(), and search_scc_bdt().

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

◆ is_mu_stat_in_sc()

bool is_mu_stat_in_sc ( int  stat,
Psysteme  sc 
)

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

bool is_mu_stat_in_sc(stat, sc): check if the system "sc" contains some variable of type "MU_stat".

AC 94/01/27

Definition at line 2411 of file makebdt.c.

2415 {
2416  entity ent;
2417  char *name;
2418  int len;
2419  list lbase;
2420  bool is_here = false;
2421 
2422  asprintf(&name, "%s_%d", "MU", stat);
2423  len = strlen(name);
2424 
2425  lbase = base_to_list(sc->base);
2426 
2427  for (; lbase != NIL; lbase = CDR(lbase))
2428  {
2429  ent = ENTITY(CAR(lbase));
2430  if (!strncmp(name, entity_local_name(ent), len))
2431  is_here = true;
2432  }
2433  free(name);
2434  return(is_here);
2435 }

References asprintf, Ssysteme::base, base_to_list(), CAR, CDR, ENTITY, entity_local_name(), free(), and NIL.

Referenced by analyze_quast().

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

◆ is_stat_in_pred_list()

bool is_stat_in_pred_list ( int  stat,
list  pred_list 
)

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

bool is_stat_in_pred_list(stat, pred_list): tests if the stat is in the list pred_list.

AC 93/12/06

Definition at line 502 of file makebdt.c.

506 {
507  list l;
508  bool bool = false;
509  int s;
510 
511  l = pred_list;
512 
513  if (l == NIL)
514  bool = false;
515  else {
516  for ( ; l != NIL; l = CDR(l)) {
517  s = INT(CAR(l));
518  if (s == stat)
519  bool = true;
520  }
521  }
522  return(bool);
523 }
@ INT
Definition: atomic.c:48

References CAR, CDR, INT, and NIL.

◆ is_uniform_rec()

bool is_uniform_rec ( list  l,
Ppolynome  p 
)

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

bool is_uniform_rec(l, p): test if a causality condition is linear, that is independent of the structure parameters and all the loop counters.

AC 93/11/22

Definition at line 1202 of file makebdt.c.

1206 {
1207  list lindice = l;
1208  Variable var;
1209  bool bool = false;
1210 
1211  for ( ; lindice != NIL; lindice = CDR(lindice))
1212  {
1213  var = (Variable)ENTITY(CAR(lindice));
1214  bool = (polynome_contains_var(p, var)) || (bool);
1215  }
1216 
1217  return(!bool);
1218 }

References CAR, CDR, ENTITY, NIL, and polynome_contains_var().

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:

◆ list_of_exp_equals_1n_p()

bool list_of_exp_equals_1n_p ( list  l1,
list  l2,
int  n 
)

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

bool list_of_exp_equals_1n_p(l1,l2,n): tests the equality of 2 lists of expressions on the first n terms.

AC 94/01/25

Definition at line 1037 of file makebdt.c.

1041 {
1042  bool is_equal = true;
1043  expression exp1, exp2;
1044  int i;
1045 
1046  if (get_debug_level() > 5)
1047  {
1048  fprintf(stderr,"\nPremiere liste: ");
1049  fprint_list_of_exp(stderr, l1);
1050  fprintf(stderr,"\nDeuxieme liste: ");
1051  fprint_list_of_exp(stderr, l2);
1052  }
1053 
1054  exp1 = EXPRESSION(CAR(l1));
1055  exp2 = EXPRESSION(CAR(l2));
1056  is_equal = exp_equals_p(exp1, exp2);
1057  l1 = CDR(l1);
1058  l2 = CDR(l2);
1059 
1060  for (i = 1; (i <= (n-1))&&(is_equal) ; i++)
1061  {
1062  exp1 = EXPRESSION(CAR(l1));
1063  exp2 = EXPRESSION(CAR(l2));
1064  is_equal = coef_of_M_equal(&exp1, &exp2);
1065  l1 = CDR(l1);
1066  l2 = CDR(l2);
1067  }
1068 
1069  return(is_equal);
1070 }
bool exp_equals_p(expression e1, expression e2)
======================================================================
Definition: bdt_utils.c:820
bool coef_of_M_equal(expression *exp1, expression *exp2)
======================================================================
Definition: makebdt.c:1017

References CAR, CDR, coef_of_M_equal(), exp_equals_p(), EXPRESSION, fprint_list_of_exp(), fprintf(), and get_debug_level().

Referenced by compact_quast().

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

◆ make_bdt_initial()

bdt make_bdt_initial ( int  stat,
scc  s 
)

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

bdt make_bdt_initial(stat, s): write the initial bdt with as a predicate, the definition domaine of the node.

94/01/27

Definition at line 2656 of file makebdt.c.

2660 {
2661  bdt b;
2662  schedule st;
2663  predicate pred;
2664  Psysteme sc;
2665 
2666  sc = sc_dup(get_predicate_system_of_node(stat, s));
2667  pred = make_predicate(sc);
2668  st = make_schedule(stat, pred, NIL);
2669  b = make_bdt(CONS(SCHEDULE, st, NIL));
2670 
2671  return(b);
2672 }
Psysteme get_predicate_system_of_node(int st, scc s)
=================================================================
Definition: makebdt.c:1950

References CONS, get_predicate_system_of_node(), make_bdt(), make_predicate(), make_schedule(), NIL, sc_dup(), and SCHEDULE.

Referenced by search_scc_bdt().

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

◆ make_causal_external()

Psysteme make_causal_external ( int  stat_dest,
Psysteme  sys_dest,
Ppolynome  poly_dest,
list  ldata,
int  stat_pred,
Psysteme  sys_pred,
Ppolynome  poly_source,
int c,
int  den 
)

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

Psysteme make_causal_external(): same function as make_causal internal, but in this case we do not introduce the new variables Xe, and we write the causality condition under the following form: Pdest - Pinit >= 1

AC 94/01/27

write the causality condition under the following form:

P_dest - P_source -1 = 0

case of a uniform causality condition

make the polynom of unknown lambda

list of the variables to identify

Now we add the conditions on the edge, caus' we livin' on

the edge

write the causality condition under the following form:

P_dest - P_source - P_lambda -1 = 0

simplify the system and transform it in inequalities

Definition at line 1460 of file makebdt.c.

1468 {
1469  list ltrans, lvar, llambda, llambda_el;
1470  predicate pred_edge;
1471  Psysteme psys_aux, sys_edge, pred_sys = SC_RN;
1472  Ppolynome poly_lambda, poly_res, p_source;
1473  dataflow pred_data;
1474  Pn_coef llam1, llam2;
1475  int co = *c, d, ppc;
1476 
1477  lvar = get_list_of_all_param(stat_dest, stat_pred);
1478  llam1 = NULL;
1479  llam2 = NULL;
1480  sys_edge = SC_RN;
1481  psys_aux = sc_new();
1482  poly_lambda = POLYNOME_UNDEFINED;
1483  p_source = polynome_dup(poly_source);
1484 
1485  pred_data = DATAFLOW(CAR(ldata));
1486  ltrans = dataflow_transformation(pred_data);
1487  pred_sys = sc_dup(sys_pred);
1488 
1489  p_source = include_trans_in_poly(stat_pred, p_source, ltrans, &d);
1490 
1491  ppc = sol_ppcm(den, d);
1492 
1493  if (get_debug_level() > 5)
1494  {
1495  fprintf(stderr,"\nTRANSFORMATION :\n");
1496  fprint_list_of_exp(stderr,ltrans);
1497  fprintf(stderr,"\nPred_sys :");
1498  fprint_psysteme(stderr,pred_sys);
1499  fprintf(stderr,"\n\nPoly_source : ");
1500  my_polynome_fprint(stderr,p_source);
1501  }
1502 
1503  /* write the causality condition under the following form: */
1504  /* P_dest - P_source -1 = 0 */
1505  poly_res = polynome_dup(poly_dest);
1506  polynome_negate(&p_source);
1507  polynome_add(&poly_res, p_source);
1508  polynome_decr(poly_res);
1509 
1510  if (get_debug_level() > 5)
1511  {
1512  fprintf(stderr,"\nInequation de causalite :\n");
1513  my_polynome_fprint(stderr,poly_res);
1514  }
1515 
1516  if (is_uniform_rec(lvar, poly_res))
1517  {
1518  /* case of a uniform causality condition */
1519  if (get_debug_level() > 5) fprintf(stderr,"\nRecurrence uniforme :\n");
1520  polynome_negate(&poly_res);
1521  psys_aux = polynome_to_sc(poly_res, lvar);
1522  psys_aux = transform_in_ineq(psys_aux, NIL);
1523  }
1524  else
1525  {
1526  /* make the polynom of unknown lambda */
1527  sys_edge = sc_dup(sys_dest);
1528  sys_edge = sc_append(sys_edge, pred_sys);
1529  sys_edge = include_parameters_in_sc(sys_edge, stat_dest);
1530  my_sc_normalize(sys_edge);
1531 
1532  /* list of the variables to identify */
1533  if (!SC_UNDEFINED_P(sys_edge))
1534  lvar = add_others_variables(lvar, base_to_list(sys_edge->base));
1535 
1536  create_farkas_poly(sys_edge, "LAMBDA", stat_pred, stat_dest,\
1537  &poly_lambda, &llam1, &co);
1538  sc_rm(sys_edge);
1539  sys_edge = NULL;
1540 
1541  /* Now we add the conditions on the edge, caus' we livin' on */
1542  /* the edge */
1543  pred_edge = dataflow_governing_pred(pred_data);
1544  sys_edge = sc_dup(predicate_to_system(pred_edge));
1545 
1546  if (!SC_UNDEFINED_P(sys_edge))
1547  lvar = add_others_variables(lvar, base_to_list(sys_edge->base));
1548 
1549  create_farkas_poly(sys_edge, "LAMBDA", stat_pred, stat_dest,\
1550  &poly_lambda, &llam2, &co);
1551 
1552  llam1 = add_lcoef_to_lcoef(llam1, llam2);
1553  llambda = extract_var_list(llam1);
1554 
1555  /* write the causality condition under the following form: */
1556  /* P_dest - P_source - P_lambda -1 = 0 */
1557  polynome_negate(&poly_lambda);
1558  polynome_add(&poly_res, poly_lambda);
1559 
1560  if (ppc != 1) polynome_scalar_mult(&poly_res, (float)ppc);
1561 
1562  psys_aux = polynome_to_sc(poly_res, lvar);
1563 
1564  psys_aux = elim_var_with_eg(psys_aux, &llambda, &llambda_el);
1565 
1566  /* simplify the system and transform it in inequalities */
1567  llambda_el = gen_nreverse(llambda_el);
1568  psys_aux = transform_in_ineq(psys_aux, llambda_el);
1569  }
1570 
1571  if (get_debug_level() > 5)
1572  {
1573  fprintf(stderr,"\nPoly_resultat : ");
1574  my_polynome_fprint(stderr,poly_res);
1575  fprintf(stderr,"\n\n");
1576  }
1577 
1578  polynome_rm(&poly_res);
1579  polynome_rm(&p_source);
1580  *c = co;
1581 
1582  return(psys_aux);
1583 }
Psysteme my_sc_normalize(Psysteme ps)
==============================================================
Definition: bdt_utils.c:254
list add_others_variables(list lvar, list n_lvar)
=================================================================
Definition: makebdt.c:1286
list get_list_of_all_param(int s, int t)
=================================================================
Definition: makebdt.c:1168
bool is_uniform_rec(list l, Ppolynome p)
=================================================================
Definition: makebdt.c:1202
static void create_farkas_poly(Psysteme Psys, char *Type, int source, int dest, Ppolynome *p, Pn_coef *l, int *c)
=====================================================================
Definition: makebdt.c:580
Psysteme transform_in_ineq(Psysteme sc, list l)
=================================================================
Definition: makebdt.c:902
Psysteme include_parameters_in_sc(Psysteme sys, int source)
=====================================================================
Definition: makebdt.c:533
Psysteme elim_var_with_eg(Psysteme, list *, list *)
===========================================================================
Definition: utils.c:1361
Psysteme polynome_to_sc(Ppolynome, list)
===========================================================================
Definition: utils.c:1158
#define DATAFLOW(x)
DATAFLOW.
Definition: paf_ri.h:308
#define dataflow_transformation(x)
Definition: paf_ri.h:342
#define dataflow_governing_pred(x)
Definition: paf_ri.h:344
int sol_ppcm()
Ppolynome polynome_dup(Ppolynome pp)
Ppolynome polynome_dup(Ppolynome pp) creates and returns a copy of pp.
Definition: pnome-alloc.c:211
void polynome_rm(Ppolynome *ppp)
void polynome_rm(Ppolynome* ppp) frees space occupied by polynomial *ppp returns *ppp pointing to POL...
Definition: pnome-alloc.c:170
void polynome_scalar_mult(Ppolynome *ppp, float factor)
void polynome_scalar_mult(Ppolynome* ppp, float factor) (*ppp) = factor * (*ppp) !...
Definition: pnome-scal.c:46
void polynome_negate(Ppolynome *ppp)
void polynome_negate(Ppolynome *ppp); changes sign of polynomial *ppp.
Definition: pnome-unaires.c:45
#define POLYNOME_UNDEFINED

References add_lcoef_to_lcoef(), add_others_variables(), Ssysteme::base, base_to_list(), CAR, create_farkas_poly(), DATAFLOW, dataflow_governing_pred, dataflow_transformation, elim_var_with_eg(), extract_var_list(), fprint_list_of_exp(), fprint_psysteme(), fprintf(), gen_nreverse(), get_debug_level(), get_list_of_all_param(), include_parameters_in_sc(), include_trans_in_poly(), is_uniform_rec(), my_polynome_fprint, my_sc_normalize(), NIL, polynome_add(), polynome_decr(), polynome_dup(), polynome_negate(), polynome_rm(), polynome_scalar_mult(), polynome_to_sc(), POLYNOME_UNDEFINED, predicate_to_system(), sc_append(), sc_dup(), sc_new(), sc_rm(), sol_ppcm(), and transform_in_ineq().

Referenced by search_scc_bdt().

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

◆ make_causal_internal()

Psysteme make_causal_internal ( int  stat_dest,
Psysteme  sys_dest,
Ppolynome  poly_dest,
list  ldata,
int  stat_pred,
Psysteme  sys_pred,
Ppolynome  poly_source,
int c,
int  xc,
entity xe,
int  den 
)

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

Psysteme make_causal_internal(): build the causality condition. If the causality condition is already linear, we do not need to apply Farkas lemma to create a Lambda polynom. This function identifies the different variables and writes them in a Psystem it returns. The integer c is usefull for the creation of the parameters LAMBDA in the case of a multi-edge. This function is used in the case of an internal edge of the scc where we introduce the variable "switch" Xe. The causality condition is written as: Pdest - Pinit >= Xe

AC 94/01/27

write the causality condition under the following form:

P_dest - P_source -Xe = 0

case of a uniform causality condition

make the polynom of unknown lambda

list of the variables to identify

Now we add the conditions on the edge, caus' we livin' on

the edge

list of the variables to identify

write the causality condition under the following form:

P_dest - P_source - P_lambda -1 = 0

simplify the system and transform it in inequalities

Definition at line 1317 of file makebdt.c.

1327 {
1328  list ltrans, lvar, llambda, llambda_el;
1329  predicate pred_edge;
1330  Psysteme psys_aux, sys_edge, pred_sys = SC_RN;
1331  Ppolynome poly_lambda, poly_res, p_source, poly_x;
1332  dataflow pred_data;
1333  Pn_coef llam1, llam2;
1334  entity xe_a;
1335  int co = *c, d, ppc;
1336 
1337  lvar = get_list_of_all_param(stat_dest, stat_pred);
1338  llam1 = NULL;
1339  llam2 = NULL;
1340  xe_a = *xe;
1341  sys_edge = SC_RN;
1342  psys_aux = sc_new();
1343  poly_lambda = POLYNOME_UNDEFINED;
1344  poly_res = POLYNOME_UNDEFINED;
1345  p_source = polynome_dup(poly_source);
1346  pred_sys = sc_dup(sys_pred);
1347 
1348  pred_data = DATAFLOW(CAR(ldata));
1349  ltrans = dataflow_transformation(pred_data);
1350 
1351  p_source = include_trans_in_poly(stat_pred, p_source, ltrans, &d);
1352 
1353  ppc = sol_ppcm(den, d);
1354 
1355  if (get_debug_level() > 5)
1356  {
1357  fprintf(stderr,"\nTRANSFORMATION :\n");
1358  fprint_list_of_exp(stderr,ltrans);
1359  fprintf(stderr,"\n\nPoly_source : ");
1360  my_polynome_fprint(stderr,p_source);
1361  }
1362 
1363  /* write the causality condition under the following form: */
1364  /* P_dest - P_source -Xe = 0 */
1365  poly_res = polynome_dup(poly_dest);
1366  polynome_negate(&p_source);
1367  polynome_add(&poly_res, p_source);
1368  poly_x = make_polynome_Xe(xc, &xe_a);
1369  polynome_negate(&poly_x);
1370  polynome_add(&poly_res, poly_x);
1371 
1372  if (get_debug_level() > 5)
1373  {
1374  fprintf(stderr,"\nInequation de causalite :\n");
1375  my_polynome_fprint(stderr,poly_res);
1376  }
1377 
1378  if (is_uniform_rec(lvar, poly_res))
1379  {
1380  /* case of a uniform causality condition */
1381  if (get_debug_level() > 5) fprintf(stderr,"\nRecurrence uniforme :\n");
1382  polynome_negate(&poly_res);
1383  psys_aux = polynome_to_sc(poly_res, lvar);
1384  psys_aux = transform_in_ineq(psys_aux, NIL);
1385  }
1386  else
1387  {
1388  /* make the polynom of unknown lambda */
1389  sys_edge = sc_dup(sys_dest);
1390  sys_edge = sc_append(sys_edge, pred_sys);
1391  sys_edge = include_parameters_in_sc(sys_edge, stat_dest);
1392  my_sc_normalize(sys_edge);
1393 
1394  /* list of the variables to identify */
1395  if (!SC_UNDEFINED_P(sys_edge))
1396  lvar = add_others_variables(lvar, base_to_list(sys_edge->base));
1397 
1398  create_farkas_poly(sys_edge, "LAMBDA", stat_pred, stat_dest,\
1399  &poly_lambda, &llam1, &co);
1400 
1401  /* Now we add the conditions on the edge, caus' we livin' on */
1402  /* the edge */
1403  pred_edge = dataflow_governing_pred(pred_data);
1404  sys_edge = sc_dup(predicate_to_system(pred_edge));
1405 
1406  /* list of the variables to identify */
1407  if (!SC_UNDEFINED_P(sys_edge))
1408  lvar = add_others_variables(lvar, base_to_list(sys_edge->base));
1409 
1410  create_farkas_poly(sys_edge, "LAMBDA", stat_pred, stat_dest,\
1411  &poly_lambda, &llam2, &co);
1412 
1413  sc_rm(sys_edge);
1414 
1415  llam1 = add_lcoef_to_lcoef(llam1, llam2);
1416  llambda = extract_var_list(llam1);
1417 
1418  /* write the causality condition under the following form: */
1419  /* P_dest - P_source - P_lambda -1 = 0 */
1420  polynome_negate(&poly_lambda);
1421  polynome_add(&poly_res, poly_lambda);
1422 
1423  if (ppc != 1) polynome_scalar_mult(&poly_res, (float)ppc);
1424 
1425  psys_aux = polynome_to_sc(poly_res, lvar);
1426  psys_aux = elim_var_with_eg(psys_aux, &llambda, &llambda_el);
1427 
1428  /* simplify the system and transform it in inequalities */
1429  psys_aux = my_sc_normalize(psys_aux);
1430  llambda_el = gen_nreverse(llambda_el);
1431  psys_aux = transform_in_ineq(psys_aux, llambda_el);
1432  }
1433 
1434  if (get_debug_level() > 5)
1435  {
1436  fprintf(stderr,"\nPoly_resultat : ");
1437  my_polynome_fprint(stderr,poly_res);
1438  fprintf(stderr,"\n\n");
1439  }
1440 
1441  polynome_rm(&poly_res);
1442  polynome_rm(&p_source);
1443 
1444  *xe = xe_a;
1445  *c = co;
1446 
1447  return(psys_aux);
1448 }
Ppolynome make_polynome_Xe(int xc, entity *xe)
=================================================================
Definition: makebdt.c:1260

References add_lcoef_to_lcoef(), add_others_variables(), Ssysteme::base, base_to_list(), CAR, create_farkas_poly(), DATAFLOW, dataflow_governing_pred, dataflow_transformation, elim_var_with_eg(), extract_var_list(), fprint_list_of_exp(), fprintf(), gen_nreverse(), get_debug_level(), get_list_of_all_param(), include_parameters_in_sc(), include_trans_in_poly(), is_uniform_rec(), make_polynome_Xe(), my_polynome_fprint, my_sc_normalize(), NIL, polynome_add(), polynome_dup(), polynome_negate(), polynome_rm(), polynome_scalar_mult(), polynome_to_sc(), POLYNOME_UNDEFINED, predicate_to_system(), sc_append(), sc_dup(), sc_new(), sc_rm(), sol_ppcm(), and transform_in_ineq().

Referenced by search_scc_bdt().

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

◆ make_dual()

static Psysteme make_dual ( Psysteme  psys,
Psysteme pcont,
Pn_coef  l,
list lvar_u,
list  lvp 
)
static

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

Psysteme make_dual(psys,pcont,l,lvar_u,lvp): makes the dual problem in the case of a scc containing a single node. In this case, we do not introduce a set of "v" in the second member we put directly the proper value function of the program parameters.

AC 93/12/20

for each inequalities, build the second member of the system

and at the same time the system of constraints.

build and put the economic function in 1st position in psys

Definition at line 2246 of file makebdt.c.

2251 {
2252  Pcontrainte cont;
2253  Psysteme sys_cont;
2254  Pvecteur vect, vect_aux, vect_pro, vp;
2255  list lbase, lp, laux;
2256  entity ent;
2257 
2258  sys_cont = sc_new();
2259  lp = lvp;
2260  vp = VECTEUR_NUL;
2261 
2262  /* for each inequalities, build the second member of the system */
2263  /* and at the same time the system of constraints. */
2264 
2265  for (cont = psys->inegalites ; cont != NULL ; cont = cont->succ)
2266  {
2267  vect = vect_dup(cont->vecteur);
2268  vect_chg_sgn(vect);
2269  vect_aux = vect_dup(l->n_vect);
2271  cont->vecteur = vect_add(vect, vect_aux);
2272 
2274 
2275  vect_pro = vect_new((Variable) TCST, INT(CAR(lp)));
2276  vp = vect_add(vp, vect_pro);
2277 
2278  l = l->next;
2279  lp = CDR(lp);
2280  }
2281 
2282  /* build and put the economic function in 1st position in psys */
2283 
2284  ent = create_named_entity("u0");
2285  vect = vect_new((Variable)ent,1);
2286  lp = lvp;
2287 
2288  for (laux = *lvar_u; laux != NIL; laux = CDR(laux))
2289  {
2290  vect_aux = vect_new((Variable) ENTITY(CAR(laux)), INT(CAR(lp)));
2291  vect = vect_add(vect, vect_aux);
2292  lp = CDR(lp);
2293  }
2294 
2295  vect_chg_sgn(vect);
2296  sc_add_inegalite(psys, contrainte_make(vect));
2297  *lvar_u = CONS(ENTITY, ent, *lvar_u);
2298 
2299  psys->base = NULL;
2300  sys_cont->base = NULL;
2301  sc_creer_base(psys);
2302  sc_creer_base(sys_cont);
2303 
2304  lbase = base_to_list(psys->base);
2305  lbase = reorder_base(lbase, *lvar_u);
2306  psys->base = list_to_base(lbase);
2307 
2308  *pcont = my_sc_normalize(sys_cont);
2309 
2310  return(psys);
2311 }
list reorder_base(list l, list lu)
=================================================================
Definition: makebdt.c:308
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53

References Ssysteme::base, base_to_list(), CAR, CDR, CONS, contrainte_make(), create_named_entity(), ENTITY, INT, list_to_base(), my_sc_normalize(), n_coef::n_vect, n_coef::next, NIL, reorder_base(), sc_add_inegalite(), sc_creer_base(), sc_new(), Scontrainte::succ, TCST, vect_add(), vect_aux, vect_chg_sgn(), vect_dup(), vect_new(), Scontrainte::vecteur, and VECTEUR_NUL.

Referenced by analyze_quast(), and search_scc_bdt().

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

◆ make_list_of_n()

list make_list_of_n ( char *  n,
int  c 
)

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

list make_list_of_n(n,c) : function that creates a list of new entities as "u1" or "u2" it returns.

AC 93/11/16

Definition at line 473 of file makebdt.c.

477 {
478  entity ent;
479  list l = NIL;
480  char *name;
481  int i;
482 
483  name = (char*) malloc(10);
484 
485  for (i = 1; i <= c; i++)
486  {
487  sprintf(name, "%s%d", n, i);
488  ent = create_named_entity(name);
489  ADD_ELEMENT_TO_LIST(l, ENTITY, ent);
490  }
491  free(name);
492  return(l);
493 }

References ADD_ELEMENT_TO_LIST, create_named_entity(), ENTITY, free(), malloc(), and NIL.

Referenced by make_primal().

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

◆ make_list_of_unk()

static void make_list_of_unk ( Pn_coef l,
Psysteme sc,
entity me,
list  lx 
)
static

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

void make_list_of_unk(l, sc, me, lx): build the complete list of Pn_coef for the primal problem. At the beginning, l only contains the "MU" introduced by the inequation of causality. We check if SOME "MU" have been eliminated, we build the list of Xe that we put in first position, then we append the list of LAMBDA.

AC 94/01/27

First we check if some MU have been eliminated

we add at the beginning of lout the list about the Xs

we add at the end of lout the list about the lambda

Definition at line 1904 of file makebdt.c.

1910 {
1911  Pn_coef laux, lout, lin = *l;
1912  list llambda, base;
1913  entity m;
1914 
1915  lout = NULL;
1916 
1917  base = base_to_list((*sc)->base);
1918 
1919  /* First we check if some MU have been eliminated */
1920  while (lin != NULL)
1921  {
1922  laux = lin;
1923  lin = lin->next;
1924  laux->next = NULL;
1925  if (is_entity_in_list_p(laux->n_ent, base))
1926  lout = add_n_coef_to_list(lout, laux);
1927  }
1928 
1929  /* we add at the beginning of lout the list about the Xs */
1930  lout = add_x_list(lout, lx, &m);
1931 
1932  /* we add at the end of lout the list about the lambda */
1933  llambda = extract_lambda_list(base);
1934  lout = add_lambda_list(lout, llambda);
1935 
1936  base = extract_var_list(lout);
1937  (*sc)->base = list_to_base(base);
1938 
1939  *me = m;
1940  *l = lout;
1941 }
static Pn_coef add_lambda_list(Pn_coef lunk, list lvar)
=================================================================
Definition: makebdt.c:337
list extract_lambda_list(list l)
=================================================================
Definition: makebdt.c:281
static Pn_coef add_x_list(Pn_coef lunk, list lvar, entity *me)
=================================================================
Definition: makebdt.c:391

References add_lambda_list(), add_n_coef_to_list(), add_x_list(), base, base_to_list(), extract_lambda_list(), extract_var_list(), is_entity_in_list_p(), list_to_base(), n_coef::n_ent, and n_coef::next.

Referenced by search_scc_bdt().

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

◆ make_n_coef()

static Pn_coef make_n_coef ( entity  e,
Pvecteur  v 
)
static

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

Pn_coef make_n_coef(e,v): allocating the space for a Pn_coef, that is a cell containing an entity and a Pvecteur, and returns a Pn_coef.

AC 93/11/15

Definition at line 191 of file makebdt.c.

195 {
196  Pn_coef aux;
197 
198  aux = (Pn_coef)malloc(sizeof(n_coef));
199  aux->n_ent = e;
200  aux->n_vect = v;
201  aux->next = NULL;
202 
203  return (aux);
204 }
struct n_coef * Pn_coef

References aux, and malloc().

Referenced by add_lambda_list(), add_x_list(), create_farkas_poly(), and extract_stat_lunk().

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

◆ make_polynome_Xe()

Ppolynome make_polynome_Xe ( int  xc,
entity xe 
)

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

Ppolynome make_polynome_Xe(xc, xe): make the polynom of unknown xe = "X_xc".

AC 94/01/27

Definition at line 1260 of file makebdt.c.

1264 {
1265  Ppolynome p;
1266  entity e;
1267  char *n;
1268 
1269  asprintf(&n, "X%d", xc);
1270  e = create_named_entity(n);
1271  free(n);
1272 
1273  p = make_polynome((float)1, (Variable)e, 1);
1274 
1275  *xe = e;
1276  return(p);
1277 }

References asprintf, create_named_entity(), free(), and make_polynome().

Referenced by make_causal_internal().

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

◆ make_primal()

static Psysteme make_primal ( Psysteme  psys,
list lvar_u,
list lvp,
list  lxe 
)
static

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

Psysteme make_primal(psys,lvar_u,lvp,lxe): build the primal problem. In fact, it does more then that, because it prepares the construc- tion of the dual problem by transposing the matrice coming from the input Psysteme.

AC 93/12/20

transform the system into a matrix

Now, we begin to make the dual problem

Definition at line 1731 of file makebdt.c.

1735 {
1736  int lin, col;
1737  matrice G, tG, h, f;
1738  Pbase base;
1739  Pcontrainte cont;
1740 
1741  if (get_debug_level() > 5)
1742  {
1743  fprintf(stderr,"\nPsysteme primal:\n");
1744  fprint_psysteme(stderr, psys);
1745  }
1746 
1747  col = gen_length(base_to_list(psys->base));
1748  lin = psys->nb_ineq;
1749 
1750  G = matrice_new(lin, col);
1751  tG = matrice_new(col, lin);
1752  h = matrice_new(lin, 1);
1753  f = matrice_new(col, 1);
1754 
1755  /* transform the system into a matrix */
1756  sc_to_matrices(psys, psys->base, G, h, lin, col);
1757 
1758  /* Now, we begin to make the dual problem */
1759  matrice_transpose(G, tG, lin, col);
1760  matrice_nulle(f, col, 1);
1761 
1762  *lvar_u = make_list_of_n("u", lin);
1763  base = list_to_base(*lvar_u);
1764 
1765  *lvp = make_sched_proto(h, lin, col, *lvar_u);
1766 
1767  pu_matrices_to_contraintes(&cont, base, tG, f, col, lin);
1768 
1769  psys = sc_make(NULL, cont);
1770 
1771  matrice_free(G);
1772  matrice_free(tG);
1773  matrice_free(h);
1774  matrice_free(f);
1775 
1776  return(psys);
1777 }
list make_list_of_n(char *n, int c)
=================================================================
Definition: makebdt.c:473
list make_sched_proto(matrice h, int lin, int col, list lu)
=================================================================
Definition: makebdt.c:1592
#define matrice_free(m)
Definition: matrice-local.h:78
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Definition: matrice-local.h:77
Value * matrice
package matrice
Definition: matrice-local.h:71
void matrice_transpose(matrice a, matrice a_t, int n, int m)
package matrice
Definition: matrice.c:48
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
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
void pu_matrices_to_contraintes(Pcontrainte *, Pbase, matrice, matrice, int, int)
utils.c
Definition: utils.c:350
Psysteme sc_make(Pcontrainte leg, Pcontrainte lineg)
Psysteme sc_make(Pcontrainte leg, Pcontrainte lineg): allocation et initialisation d'un systeme d'equ...
Definition: sc.c:78
#define G(j, a, b)
maybe most of them should be functions?
void sc_to_matrices(Psysteme, Pbase, matrice, matrice, int, int)
Creation de la matrice A correspondant au systeme lineaire et de la matrice correspondant a la partie...

References base, base_to_list(), f(), fprint_psysteme(), fprintf(), G, gen_length(), get_debug_level(), list_to_base(), make_list_of_n(), make_sched_proto(), matrice_free, matrice_new, matrice_nulle(), matrice_transpose(), pu_matrices_to_contraintes(), sc_make(), and sc_to_matrices().

Referenced by analyze_quast(), and search_scc_bdt().

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

◆ make_proto()

static void make_proto ( hash_table  h,
sccs  rg 
)
static

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

void make_proto((hash_table)h, (sccs)rg): function that goes through the reverse graph "rg", and for each node of each scc, initialize the node structure associated with each node, that is, creates the Farkas polynom of each node.

AC 93/10/28

Definition at line 687 of file makebdt.c.

691 {
692  list lscc, lver;
693  Pbdt_node this_node;
694  Ppolynome this_poly;
695  Psysteme this_sys;
696  int this_stat, count;
697  vertex this_ver;
698  Pn_coef lvar;
699 
700  for (lscc = sccs_sccs(rg); lscc != NIL; lscc = CDR(lscc))
701  {
702  scc scc_an = SCC(CAR(lscc));
703  for (lver = scc_vertices(scc_an); lver != NIL; lver = CDR(lver))
704  {
705  lvar = NULL;
706  this_poly = POLYNOME_UNDEFINED;
707  this_ver = VERTEX(CAR(lver));
709  vertex_vertex_label(this_ver));
712  this_sys = include_parameters_in_sc(this_sys, this_stat);
713  count = 0;
714  create_farkas_poly(this_sys, "MU", this_stat, 0, &this_poly,\
715  &lvar, &count);
716  this_node = (Pbdt_node)malloc(sizeof(bdt_node));
717  this_node->n_poly = this_poly;
718  this_node->n_bdt = (bdt)NIL;
719  this_node->n_var = lvar;
720 
721  hash_put(h, (char *) this_stat, (char *) this_node);
722  }
723  }
724 }
#define SCC(x)
SCC.
Definition: dg.h:315
#define sccs_sccs(x)
Definition: dg.h:311
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
struct _newgen_struct_bdt_ * bdt
Definition: paf_ri.h:72
#define predicate_system(x)
Definition: ri.h:2069
Pn_coef n_var
Definition: makebdt.c:96
bdt n_bdt
Definition: makebdt.c:95
Ppolynome n_poly
Definition: makebdt.c:94

References CAR, CDR, count, create_farkas_poly(), dfg_vertex_label_exec_domain, dfg_vertex_label_statement, hash_put(), include_parameters_in_sc(), malloc(), bdt_node::n_bdt, bdt_node::n_poly, bdt_node::n_var, NIL, POLYNOME_UNDEFINED, predicate_system, SCC, scc_vertices, sccs_sccs, VERTEX, and vertex_vertex_label.

Referenced by search_graph_bdt().

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

◆ make_sched_proto()

list make_sched_proto ( matrice  h,
int  lin,
int  col,
list  lu 
)

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

list make_sched_proto(h,lin,,col,lu): make the vector-list representing the prototype of the schedule we search.

AC 93/12/06

complete the vector to the dimension of the dual problem

Definition at line 1592 of file makebdt.c.

1597 {
1598  list p, lvp = NIL;
1599  int i;
1600 
1601  p = lu;
1602  i = 1;
1603 
1604  while (p != NIL)
1605  {
1606  Value v = ACCESS(h,lin,i,1);
1608  i++;
1609  p = CDR(p);
1610  }
1611 
1612  /* complete the vector to the dimension of the dual problem */
1613  if (gen_length(lvp) != col)
1614  {
1615  for (i = 1; i <= (col-lin); i++)
1616  ADD_ELEMENT_TO_LIST(lvp, INT, 0);
1617  }
1618 
1619  return(lvp);
1620 }
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrice-local.h:86

References ACCESS, ADD_ELEMENT_TO_LIST, CDR, gen_length(), INT, NIL, and VALUE_TO_INT.

Referenced by make_primal().

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

◆ make_x_list()

list make_x_list ( int  c)

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

list make_x_list(c): build a list of entity of type X_nb where nb is a number between 0 and c.

AC 94/01/27

Definition at line 361 of file makebdt.c.

364 {
365  entity ent;
366  char *name;
367  list laux = NIL;
368  int i;
369 
370  name = (char*) malloc(10);
371 
372  for (i = 0; i <= c; i++)
373  {
374  sprintf(name, "X_%d", i);
375  ent = create_named_entity(name);
376  ADD_ELEMENT_TO_LIST(laux, ENTITY, ent);
377  }
378  free(name);
379 
380  return(laux);
381 }

References ADD_ELEMENT_TO_LIST, create_named_entity(), ENTITY, free(), malloc(), and NIL.

+ Here is the call graph for this function:

◆ reorder_base()

list reorder_base ( list  l,
list  lu 
)

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

list reorder_base(l,lu) : reorder the base list l with the unknows lu contains in first positions in the list.

AC 93/11/17

Definition at line 308 of file makebdt.c.

311 {
312  list laux = NIL;
313  entity ent;
314 
315  for (; lu != NIL; lu = CDR(lu))
316  {
317  ent = ENTITY(CAR(lu));
318  ADD_ELEMENT_TO_LIST(laux, ENTITY, ent);
319  }
320 
321  for (; l != NIL; l = CDR(l))
322  {
323  ent = ENTITY(CAR(l));
324  if (!(is_entity_in_list_p(ent, laux)))
325  ADD_ELEMENT_TO_LIST(laux, ENTITY, ent);
326  }
327  return(laux);
328 }

References ADD_ELEMENT_TO_LIST, CAR, CDR, ENTITY, is_entity_in_list_p(), and NIL.

Referenced by make_dual().

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

◆ search_graph_bdt()

bdt search_graph_bdt ( sccs  rgraph)

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

bdt search_graph_bdt( (sccs) rgraph ) : function that goes through the reverse graph "rgraph" and search the set of bdt for each reduced node.

AC 93/10/27

test of the existence of a predecessor

search the set of bdt for this scc

add the found bdt to the already calculated ones

Definition at line 3001 of file makebdt.c.

3004 {
3005  list lscc, lsched, lschedg;
3006  bdt bdt_graph, bdt_scc;
3007  bool no_pred;
3008 
3009  bdt_graph = bdt_undefined;
3011  make_proto(h_node, rgraph);
3012 
3013  for (lscc = sccs_sccs(rgraph); lscc != NIL; lscc = CDR(lscc))
3014  {
3015  scc scc_an = SCC(CAR(lscc));
3016  bdt_scc = bdt_undefined;
3017 
3018  /* test of the existence of a predecessor */
3019  no_pred = if_no_pred(scc_an, &bdt_scc);
3020 
3021  /* search the set of bdt for this scc */
3022  if (!no_pred) bdt_scc = search_scc_bdt(scc_an);
3023 
3024  /* add the found bdt to the already calculated ones */
3025  if (!bdt_undefined_p(bdt_graph))
3026  {
3027  lsched = bdt_schedules(bdt_scc);
3028  lschedg = bdt_schedules(bdt_graph);
3029  bdt_schedules(bdt_graph) = gen_nconc(lschedg, lsched);
3030  }
3031  else bdt_graph = bdt_scc;
3032  }
3033 
3035 
3036  return (bdt_graph);
3037 }
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
bool if_no_pred(scc s, bdt *b)
=================================================================
Definition: makebdt.c:768
static bdt search_scc_bdt(scc s)
=================================================================
Definition: makebdt.c:2709
static void make_proto(hash_table h, sccs rg)
=================================================================
Definition: makebdt.c:687
@ hash_int
Definition: newgen_hash.h:32

References bdt_schedules, bdt_undefined, bdt_undefined_p, CAR, CDR, gen_nconc(), h_node, hash_int, hash_table_free(), hash_table_make(), if_no_pred(), make_proto(), NIL, SCC, sccs_sccs, and search_scc_bdt().

Referenced by scheduling().

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

◆ search_scc_bdt()

static bdt search_scc_bdt ( scc  s)
static

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

bdt search_scc_bdt( (scc) s) : from a given scc, make for each vertex the causality condition under its Farkas form and place it in a system. Then build the primal problem, then the dual problem, and finally solve it by PIP.

AC 93/10/29

for each node of the studied scc, get the characteristics of

the node we want the schedule

for each predecessor of the studied node, make the causality

condition under its Farkas form and write it in a Psystem

test if the vertex has already its schedule, and if yes

convert it to use it in the causality condition

this edge is an internal edge, so the predececssor

has not already a schedule

get the polynom of the source

the edge is an external edge, so the predecessor

has alredy a schedule. We only consider the first

dimension of this schedule in case of a multidimen-

sionnal one.

get the list of schedules of the source

for each schedule, write the causality condition

this is a particular case where we introduce

an Xe if we want the primal problem to be

consistent with the theory.

we have to add the constraints on the Xs: X<=1

Now we have in "psys" the complete Psystem in mu-lambda to solve

We now transform it in the primal problem

Definition at line 2709 of file makebdt.c.

2712 {
2713  Psysteme psys, psys_aux, sys_dest, sys_pred, sys;
2714  list lver, lpred, lsched, lexp, ldata, lu, lstat, ltrans;
2715  list lxe, lvp;
2716  Ppolynome poly_dest, poly_source;
2717  int stat_dest, stat_pred, count, stat, xcount, den;
2718  Pbdt_node node_dest, node_pred;
2719  schedule sched;
2720  predicate pred_dest, pred_pred;
2721  bdt bdt_pred, scc_bdt, stat_bdt;
2722  expression exp;
2723  vertex vert_pred;
2724  Pn_coef lunk, lunk2, lunkx;
2725  quast qua;
2726  Psyslist lbdt_pred = NULL;
2727  Psys_list lsys = NULL;
2728  entity xe, me;
2729  bool all_external = false;
2730  Pvecteur vu;
2731 
2732  psys = sc_new();
2733  lunk = NULL;
2734  lunk2 = NULL;
2735  lunkx = NULL;
2736  lstat = NIL;
2737  scc_bdt = bdt_undefined;
2738  xcount = 0;
2739  lxe = NIL;
2740  lvp = NIL;
2741 
2742  if (get_debug_level() > 5)
2743  {
2744  fprintf(stderr,"\nDEBUT DE CALCUL SUR UNE SCC :\n");
2745  fprintf(stderr,"\n=============================\n");
2746  }
2747 
2748  lver = scc_vertices(s);
2749  if (lver->cdr == NIL) all_external = true;
2750 
2751  /* for each node of the studied scc, get the characteristics of */
2752  /* the node we want the schedule */
2753  for (lver = scc_vertices(s); lver != NIL; lver = CDR(lver))
2754  {
2755  vertex ver = VERTEX(CAR(lver));
2756  stat_dest = vertex_int_stmt(ver);
2758  vertex_vertex_label(ver));
2759  sys_dest = sc_dup(predicate_to_system(pred_dest));
2760  node_dest = (Pbdt_node) hash_get(h_node, (char *) stat_dest);
2761  poly_dest = node_dest->n_poly;
2762  lunk = add_lcoef_to_lcoef(lunk, node_dest->n_var);
2763  ADD_ELEMENT_TO_LIST(lstat, INT, stat_dest);
2764 
2765  if (get_debug_level() > 5)
2766  {
2767  fprintf(stderr,"\nOn s'interesse au noeud n.%d",stat_dest);
2768  fprintf(stderr,"\n===========================\n");
2769  fprintf(stderr,"de predicat : ");
2770  fprint_psysteme(stderr,sys_dest);
2771  fprintf(stderr,"\nde polynome : ");
2772  my_polynome_fprint(stderr,poly_dest);
2773  }
2774 
2775  /* for each predecessor of the studied node, make the causality */
2776  /* condition under its Farkas form and write it in a Psystem */
2777  for (lpred=vertex_successors(ver); lpred!=NIL; lpred=CDR(lpred))
2778  {
2779  successor suc = SUCCESSOR(CAR(lpred));
2780  vert_pred = successor_vertex(suc);
2781  stat_pred = vertex_int_stmt(vert_pred);
2782  node_pred = (Pbdt_node)hash_get(h_node, (char *) stat_pred);
2783  count = 0;
2784  den = 1;
2786  successor_arc_label(suc));
2787 
2788  while (ldata != NIL)
2789  {
2790  /* test if the vertex has already its schedule, and if yes */
2791  /* convert it to use it in the causality condition */
2792  if (node_pred->n_bdt == (schedule)NIL)
2793  {
2794  /* this edge is an internal edge, so the predececssor */
2795  /* has not already a schedule */
2796  xcount++;
2797 
2798  if (get_debug_level() > 5)
2799  {
2800  fprintf(stderr,"\n\nPredecesseur n.%d:pas de\
2801  schedule\n", stat_pred);
2802  fprintf(stderr,"-------------------------------\n\n");
2803  }
2804 
2805  /* get the polynom of the source */
2806  poly_source = polynome_dup(node_pred->n_poly);
2807 
2808  psys_aux = make_causal_internal(stat_dest, sys_dest,\
2809  poly_dest, ldata, stat_pred, SC_RN,\
2810  poly_source, &count, xcount, &xe, den);
2811 
2812  all_external = false;
2813  ADD_ELEMENT_TO_LIST(lxe, ENTITY, xe);
2814  lsys = add_elt_to_sys_list(lsys, xcount, psys_aux);
2815  }
2816  else
2817  {
2818  /* the edge is an external edge, so the predecessor */
2819  /* has alredy a schedule. We only consider the first */
2820  /* dimension of this schedule in case of a multidimen- */
2821  /* sionnal one. */
2822  if (get_debug_level() > 5)
2823  {
2824  fprintf(stderr,"\n\nPredecesseur n.%d : schedule!!\n",\
2825  stat_pred);
2826  fprintf(stderr,"------------------------------\n");
2827  }
2828 
2829  psys_aux = SC_RN;
2830  /* get the list of schedules of the source */
2831  bdt_pred = true_copy_bdt(node_pred->n_bdt);
2832 
2833  if (get_debug_level() > 5)
2834  {
2835  fprintf(stderr,"\nBdt du predecesseur :\n");
2836  fprint_bdt(stderr,bdt_pred);
2837  }
2838 
2839  /* for each schedule, write the causality condition */
2840  for (lsched=bdt_schedules(bdt_pred); lsched!=NIL;lsched=CDR(lsched))
2841  {
2842  sched = SCHEDULE(CAR(lsched));
2843  pred_pred = schedule_predicate(sched);
2844  sys_pred = sc_dup(predicate_to_system(pred_pred));
2845  ltrans = dataflow_transformation(DATAFLOW(CAR(ldata)));
2846 
2847  if (!SC_UNDEFINED_P(sys_pred))
2848  {
2849  sys_pred = include_trans_in_sc(stat_pred, sys_pred,\
2850  ltrans);
2851  lbdt_pred = add_sc_to_sclist(sys_pred, lbdt_pred);
2852  }
2853 
2854  lexp = schedule_dims(sched);
2855  exp = EXPRESSION(CAR(lexp));
2856  analyze_expression(&exp,&den);
2857 
2858  poly_source = expression_to_polynome(exp);
2859 
2860  if (get_debug_level() > 5)
2861  {
2862  fprint_list_of_exp(stderr,lexp);
2863  fprintf(stderr,"\nPsystem du predecesseur: \n");
2864  fprint_psysteme(stderr,sys_pred);
2865  }
2866 
2867  if (all_external)
2868  {
2869  /* this is a particular case where we introduce */
2870  /* an Xe if we want the primal problem to be */
2871  /* consistent with the theory. */
2872  xcount++;
2873  sys = make_causal_internal(stat_dest, sys_dest,\
2874  poly_dest, ldata, stat_pred, sys_pred,\
2875  poly_source, &count, xcount, &xe, den);
2876 
2877  ADD_ELEMENT_TO_LIST(lxe, ENTITY, xe);
2878  lsys = add_elt_to_sys_list(lsys, xcount, sys);
2879  all_external = false;
2880  }
2881  else
2882  sys = make_causal_external(stat_dest, sys_dest,\
2883  poly_dest, ldata, stat_pred, sys_pred,\
2884  poly_source, &count, den);
2885  if (get_debug_level() > 5)
2886  {
2887  fprintf(stderr,"\nSysteme pour arc:\n");
2888  fprint_psysteme(stderr,sys);
2889  }
2890 
2891  psys_aux = sc_append(psys_aux, sys);
2892  }
2893  }
2894 
2895  if (get_debug_level() > 5)
2896  {
2897  fprintf(stderr,"\nSysteme:\n");
2898  fprint_psysteme(stderr,psys_aux);
2899  }
2900 
2901  psys = sc_append(psys, psys_aux);
2902  sc_rm(psys_aux);
2903  ldata = CDR(ldata);
2904  }
2905  }
2906  psys = erase_trivial_ineg(psys);
2907  }
2908 
2909  my_sc_normalize(psys);
2910  psys = sc_dup(psys);
2911 
2912  /* we have to add the constraints on the Xs: X<=1 */
2913  psys = add_constraint_on_x(psys, lxe);
2914 
2915  /* Now we have in "psys" the complete Psystem in mu-lambda to solve */
2916  /* We now transform it in the primal problem */
2917 
2918  make_list_of_unk(&lunk, &psys, &me, lxe);
2919  psys = make_primal(psys, &lu, &lvp, lxe);
2920 
2921  if (get_debug_level() > 5)
2922  {
2923  fprintf(stderr,"\nSysteme primal :\n");
2924  fprint_psysteme(stderr,psys);
2925  fprintf(stderr,"\nVariables :\n");
2926  fprint_coef_list(stderr,lunk);
2927  }
2928 
2929  for (; lstat != NIL; lstat = CDR(lstat))
2930  {
2931  psys_aux = sc_dup(sc_dup(psys));
2932  stat = INT(CAR(lstat));
2933  lunk2 = extract_stat_lunk(stat, lunk);
2934  psys_aux = make_dual(psys_aux, &sys_dest, lunk2, &lu, lvp);
2935  sys_dest = sc_dup(sys_dest);
2936  vu = list_to_base(lu);
2937 
2938  if (get_debug_level() > 5)
2939  {
2940  fprintf(stderr,"\nSysteme dual :\n");
2941  fprint_psysteme(stderr,psys_aux);
2942  fprintf(stderr,"\nSysteme de contraintes :\n");
2943  fprint_psysteme(stderr,sys_dest);
2944  fprintf(stderr,"\nVct d'inconnues = \n");
2945  pu_vect_fprint(stderr, vu);
2946  fprintf(stderr,"\nBase de psys: ");
2947  pu_vect_fprint(stderr,psys_aux->base);
2948  fprintf(stderr,"\nBase de sys_cont:");
2949  pu_vect_fprint(stderr,sys_dest->base);
2950  }
2951 
2952  qua = pip_solve_min_with_big(psys_aux, sys_dest, vu, "My_Own_Private_M");
2953 
2954  qua = compact_quast(qua, gen_length(lxe));
2955 
2956  if (get_debug_level() > 5)
2957  {
2958  fprintf(stderr,"\n\nQuast de PIP pour %d:", stat);
2959  imprime_quast(stderr,qua);
2960  }
2961 
2962  stat_bdt = make_bdt_initial(stat, s);
2963  stat_bdt = analyze_quast(qua, stat, lunk2, lsys, stat_bdt, lxe, me);
2964 
2965  if (get_debug_level() > 5)
2966  {
2967  fprintf(stderr,"\nBDT AVANT:\n");
2968  fprint_bdt(stderr, stat_bdt);
2969  }
2970 
2971  scc_bdt = write_resulting_bdt(s, stat, stat_bdt, scc_bdt);
2972 
2973  if (get_debug_level() > 5)
2974  {
2975  fprintf(stderr,"\nBDT APRES:\n");
2976  fprint_bdt(stderr, stat_bdt);
2977  }
2978 
2979  lu = CDR(lu);
2980  }
2981 
2982  if (get_debug_level() > 5)
2983  {
2984  fprintf(stderr,"\nBDT :\n");
2985  fprint_bdt(stderr,scc_bdt);
2986  }
2987 
2988  sc_rm(psys);
2989 
2990  return(scc_bdt);
2991 }
#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
static void make_list_of_unk(Pn_coef *l, Psysteme *sc, entity *me, list lx)
=================================================================
Definition: makebdt.c:1904
Psysteme make_causal_external(int stat_dest, Psysteme sys_dest, Ppolynome poly_dest, list ldata, int stat_pred, Psysteme sys_pred, Ppolynome poly_source, int *c, int den)
=================================================================
Definition: makebdt.c:1460
Psysteme include_trans_in_sc(int s, Psysteme sys, list l)
=================================================================
Definition: makebdt.c:1227
bdt write_resulting_bdt(scc s, int stat, bdt bs, bdt bg)
=================================================================
Definition: makebdt.c:2681
Psyslist add_sc_to_sclist(Psysteme sc, Psyslist lsys)
=================================================================
Definition: makebdt.c:1985
bdt make_bdt_initial(int stat, scc s)
=================================================================
Definition: makebdt.c:2656
Psysteme make_causal_internal(int stat_dest, Psysteme sys_dest, Ppolynome poly_dest, list ldata, int stat_pred, Psysteme sys_pred, Ppolynome poly_source, int *c, int xc, entity *xe, int den)
=================================================================
Definition: makebdt.c:1317
Psysteme erase_trivial_ineg(Psysteme p)
=================================================================
Definition: makebdt.c:796
static void fprint_coef_list(FILE *fp, Pn_coef l)
=====================================================================
Definition: makebdt.c:236
static Pn_coef extract_stat_lunk(int stat, Pn_coef lunk)
=================================================================
Definition: makebdt.c:2322
#define dfg_arc_label_dataflows(x)
Definition: paf_ri.h:378
struct cons * cdr
The pointer to the next element.
Definition: newgen_list.h:43

References add_constraint_on_x(), ADD_ELEMENT_TO_LIST, add_elt_to_sys_list(), add_lcoef_to_lcoef(), add_sc_to_sclist(), analyze_expression(), analyze_quast(), Ssysteme::base, bdt_schedules, bdt_undefined, CAR, cons::cdr, CDR, compact_quast(), count, DATAFLOW, dataflow_transformation, dfg_arc_label_dataflows, dfg_vertex_label_exec_domain, ENTITY, erase_trivial_ineg(), exp, EXPRESSION, expression_to_polynome(), extract_stat_lunk(), fprint_bdt(), fprint_coef_list(), fprint_list_of_exp(), fprint_psysteme(), fprintf(), gen_length(), get_debug_level(), h_node, hash_get(), imprime_quast(), include_trans_in_sc(), INT, lexp, list_to_base(), make_bdt_initial(), make_causal_external(), make_causal_internal(), make_dual(), make_list_of_unk(), make_primal(), my_polynome_fprint, my_sc_normalize(), bdt_node::n_bdt, bdt_node::n_poly, bdt_node::n_var, NIL, pip_solve_min_with_big(), polynome_dup(), predicate_to_system(), pu_vect_fprint(), sc_append(), sc_dup(), sc_new(), sc_rm(), scc_vertices, SCHEDULE, schedule_dims, schedule_predicate, SUCCESSOR, successor_arc_label, successor_vertex, sys_list::sys, true_copy_bdt(), VERTEX, vertex_int_stmt(), vertex_successors, vertex_vertex_label, and write_resulting_bdt().

Referenced by search_graph_bdt().

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

◆ simplify_bdt()

bdt simplify_bdt ( bdt  b,
scc  s 
)

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

bdt simplify_bdt(b,s): simplify the list of schedule of a node by comparing the predicate of the schedule with the domain on which the node is defined. Moreover, replace variables by their value when it is possible in the predicate and the expression. (i.e. if I == N and dims==N+I+1 => dims==2*N+1 )

AC 93/12/20

Definition at line 2160 of file makebdt.c.

2164 {
2165  schedule sc;
2166  list ls, lvar, lvar_e, ldims;
2167  int st;
2168  Psysteme s_bdt, s_node, s_eq, s_aux;
2169  static_control stct;
2170 
2171  if (get_debug_level() > 5) fprintf(stderr,"\nSIMPLIFY BEGIN\n");
2172 
2173  for (ls = bdt_schedules(b); ls != NIL; ls = CDR(ls))
2174  {
2175  if (get_debug_level() > 5) fprintf(stderr,"\nSIMPLIFY new branche\n");
2176  sc = SCHEDULE(CAR(ls));
2177  st = schedule_statement(sc);
2178  ldims = schedule_dims(sc);
2180  lvar = static_control_to_indices(stct);
2181  lvar = gen_append(lvar, static_control_params(stct));
2182  lvar_e = NIL;
2183 
2184  if (get_debug_level() > 5)
2185  {
2186  fprintf(stderr, "\nListe des variables;");
2187  fprint_entity_list(stderr, lvar);
2188  }
2189 
2191  s_node = get_predicate_system_of_node(st, s);
2192 
2193  if (!SC_RN_P(s_bdt))
2194  {
2195  if (get_debug_level() > 5)
2196  {
2197  fprintf(stderr,"\nSYSTEME BDT en entree :");
2198  fprint_psysteme(stderr,s_bdt);
2199  }
2200 
2201  s_eq = find_implicit_equation(s_bdt);
2202  s_aux = elim_var_with_eg(s_eq, &lvar, &lvar_e);
2203 
2204  if (get_debug_level() > 5)
2205  {
2206  fprintf(stderr,"\nSYSTEME D EGALITES apres :");
2207  fprint_psysteme(stderr,s_aux);
2208  fprintf(stderr,"\nListe des eliminees:");
2209  fprint_entity_list(stderr, lvar_e);
2210  }
2211 
2212  if ((lvar_e != NIL)&&(!SC_RN_P(s_bdt)))
2213  {
2214  ldims = simplify_dimension(ldims, s_aux, lvar_e);
2215  s_bdt = simplify_predicate(s_bdt, s_aux, lvar_e);
2216  }
2217 
2218  if (get_debug_level() > 5)
2219  {
2220  fprintf(stderr,"\nSYSTEME BDT en sortie :");
2221  fprint_psysteme(stderr,s_bdt);
2222  }
2223 
2224  s_bdt = suppress_sc_in_sc(s_bdt, s_node);
2225  my_sc_normalize(s_bdt);
2226  schedule_predicate(sc) = make_predicate(s_bdt);
2227  schedule_dims(sc) = ldims;
2228  }
2229  }
2230 
2231  if (get_debug_level() > 5) fprintf(stderr,"\nSIMPLIFY END\n");
2232 
2233  return(b);
2234 }
Psysteme suppress_sc_in_sc(Psysteme in_ps1, Psysteme in_ps2)
======================================================================
Definition: bdt_utils.c:426
list simplify_dimension(list ld, Psysteme ps_eq, list l)
=================================================================
Definition: makebdt.c:2056
Psysteme simplify_predicate(Psysteme ps, Psysteme ps_eq, list l)
=================================================================
Definition: makebdt.c:2008
Psysteme find_implicit_equation(Psysteme)
========================================================================
Definition: utils.c:2350
#define schedule_statement(x)
Definition: paf_ri.h:713

References adg_number_to_statement(), bdt_schedules, CAR, CDR, elim_var_with_eg(), find_implicit_equation(), fprint_entity_list(), fprint_psysteme(), fprintf(), gen_append(), get_debug_level(), get_predicate_system_of_node(), get_stco_from_current_map(), make_predicate(), my_sc_normalize(), NIL, predicate_to_system(), SCHEDULE, schedule_dims, schedule_predicate, schedule_statement, simplify_dimension(), simplify_predicate(), static_control_params, static_control_to_indices(), and suppress_sc_in_sc().

Referenced by write_resulting_bdt().

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

◆ simplify_dimension()

list simplify_dimension ( list  ld,
Psysteme  ps_eq,
list  l 
)

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

list simplify_dimension(ld, ps_eq, l): implify the different dimensions f the schedule in the list ld with the variables in l with the equalities that ps_eq contains.

AC 94/03/28

loop on the dimension of the schedule to process

loop on the variables to eliminate

try next variable

Definition at line 2056 of file makebdt.c.

2060 {
2061  Pcontrainte cte = ps_eq->egalites;
2062  list lv, ln = NIL, ldi;
2063  Value coi, coe, ppc;
2064  int d;
2065  Pvecteur vi, ve;
2066  expression exp, ex;
2067  entity ent;
2068  bool change = false;
2069 
2070  /* loop on the dimension of the schedule to process */
2071  for (ldi = ld; ldi != NIL; ldi = CDR(ldi))
2072  {
2073  exp = EXPRESSION(CAR(ldi));
2074  analyze_expression(&exp, &d);
2075  cte = ps_eq->egalites;
2076 
2077  if (get_debug_level() > 5)
2078  {
2079  fprintf(stderr,"\nExpression en entree :");
2081  fprintf(stderr,"\nd = %d",d);
2082  }
2083 
2084  if (d == 1)
2085  {
2088  }
2089  else
2090  {
2092  (expression_syntax(exp)))));
2095  }
2096 
2097  /* loop on the variables to eliminate */
2098  for (lv = l; lv != NIL; lv = CDR(lv))
2099  {
2100  ent = ENTITY(CAR(lv));
2101  if (get_debug_level() > 5)
2102  {
2103  fprintf(stderr,"\nEntite a eliminer :");
2104  fprint_entity_list(stderr,CONS(ENTITY,ent,NIL));
2105  }
2106 
2107  if (base_contains_variable_p(vi, (Variable) ent))
2108  {
2109  change = true;
2110  coe = vect_coeff((Variable) ent, cte->vecteur);
2111  coi = vect_coeff((Variable) ent, vi);
2112  ve = vect_dup(cte->vecteur);
2113  ppc = ppcm(coe, coi);
2114  vi = vect_multiply(vi, value_abs(value_div(ppc,coi)));
2115  ve = vect_multiply(ve, value_abs(value_div(ppc,coe)));
2116  if (value_posz_p(value_mult(coe,coi)))
2117  vi = vect_substract(vi,ve);
2118  else vi = vect_add(vi, ve);
2119  }
2120  /* try next variable */
2121  cte = cte->succ;
2122  }
2123 
2124  if (change)
2125  {
2126  if (VECTEUR_UNDEFINED_P(vi))
2127  exp = int_to_expression(0);
2128  else
2129  {
2130  if (d == 1) exp = Pvecteur_to_expression(vi);
2131  else exp = make_rational_exp(vi, d);
2132  }
2133  }
2134 
2135  if (get_debug_level() > 5)
2136  {
2137  fprintf(stderr,"\nvi = ");
2138  pu_vect_fprint(stderr, vi);
2139  fprintf(stderr,"\nd = %d", d);
2140  fprintf(stderr,"\nExpression en sortie :");
2142  }
2143 
2145  }
2146 
2147  return(ln);
2148 }
#define value_abs(val)
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
#define value_div(v1, v2)
#define value_posz_p(val)
Value ppcm(Value, Value)
ppcm.c
Definition: ppcm.c:42
bool base_contains_variable_p(Pbase b, Variable v)
bool base_contains_variable_p(Pbase b, Variable v): returns true if variable v is one of b's elements...
Definition: base.c:136
expression make_rational_exp(Pvecteur, Value)
=====================================================================
Definition: utils.c:2446
expression Pvecteur_to_expression(Pvecteur vect)
AP, sep 25th 95 : some usefull functions moved from static_controlize/utils.c.
Definition: expression.c:1825
Pcontrainte egalites
Definition: sc-local.h:70
#define VECTEUR_UNDEFINED_P(v)
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
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_ELEMENT_TO_LIST, analyze_expression(), base_contains_variable_p(), call_arguments, CAR, CDR, CONS, ENTITY, exp, EXPRESSION, expression_normalized, expression_syntax, fprint_entity_list(), fprint_list_of_exp(), fprintf(), get_debug_level(), int_to_expression(), make_rational_exp(), NIL, NORMALIZE_EXPRESSION, normalized_linear, ppcm(), pu_vect_fprint(), Pvecteur_to_expression(), Scontrainte::succ, syntax_call, value_abs, value_div, value_mult, value_posz_p, vect_add(), vect_coeff(), vect_dup(), vect_multiply(), vect_substract(), Scontrainte::vecteur, and VECTEUR_UNDEFINED_P.

Referenced by simplify_bdt().

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

◆ simplify_predicate()

Psysteme simplify_predicate ( Psysteme  ps,
Psysteme  ps_eq,
list  l 
)

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

Psysteme simplify_predicate(ps, ps_eq, l): simplify the psysteme ps by replacing the new variables in l by their expression in ps_eq (in the same order).

AC 94/03/28

Definition at line 2008 of file makebdt.c.

2012 {
2013  Pcontrainte cti, cte = ps_eq->egalites;
2014  list lv;
2015  Value coi, coe, ppc;
2016  Pvecteur vi, ve;
2017  entity ent;
2018 
2019  for (lv = l; lv != NIL; lv = CDR(lv))
2020  {
2021  ent = ENTITY(CAR(lv));
2022 
2023  for (cti = ps->inegalites; cti != NULL; cti = cti->succ)
2024  {
2025  vi = cti->vecteur;
2026  if (base_contains_variable_p(vi, (Variable) ent))
2027  {
2028  coe = vect_coeff((Variable) ent, cte->vecteur);
2029  coi = vect_coeff((Variable) ent, cti->vecteur);
2030  ve = vect_dup(cte->vecteur);
2031  ppc = value_abs(ppcm(coe, coi));
2032  vi = vect_multiply(vi, value_abs(value_div(ppc,coi)));
2033  ve = vect_multiply(ve, value_abs(value_div(ppc,coe)));
2034  if (value_posz_p(value_mult(coe,coi)))
2035  vi = vect_substract(vi,ve);
2036  else vi = vect_add(vi, ve);
2037  cti->vecteur = vi;
2038  }
2039  }
2040  cte = cte->succ;
2041  }
2042 
2043  ps->egalites = ps_eq->egalites;
2044 
2045  return(ps);
2046 }

References base_contains_variable_p(), CAR, CDR, Ssysteme::egalites, ENTITY, Ssysteme::inegalites, NIL, ppcm(), Scontrainte::succ, value_abs, value_div, value_mult, value_posz_p, vect_add(), vect_coeff(), vect_dup(), vect_multiply(), vect_substract(), and Scontrainte::vecteur.

Referenced by simplify_bdt().

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

◆ system_new_var_subst()

Psysteme system_new_var_subst ( Psysteme  sys,
list  l 
)

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

Psysteme system_new_var_subst(sys, l): replace in a psyteme the new variables introduced by PIP by their value.

AC 93/12/20

extract the new parameter

extract the numerator

extract the denominator

Definition at line 1629 of file makebdt.c.

1633 {
1634  Pcontrainte cont;
1635  Pvecteur new_vect;
1636  list le, lexp, lvect;
1637  entity ent;
1638  Value val, va;
1639  expression exp, exp1, exp2;
1640  var_val vv;
1641  call ca;
1642  int d;
1643 
1644  for (cont = sys->inegalites; cont != NULL; cont = cont->succ)
1645  {
1646  for (le = l; le != NIL; le = CDR(le))
1647  {
1648  /* extract the new parameter */
1649  vv = VAR_VAL(CAR(le));
1650  ent = var_val_variable(vv);
1651 
1652  lvect = vecteur_to_list(cont->vecteur);
1653  if (is_entity_in_list_p(ent, lvect))
1654  {
1655  exp = var_val_value(vv);
1656  analyze_expression(&exp, &d);
1658  lexp = call_arguments(ca);
1659 
1660  /* extract the numerator */
1661  exp1 = EXPRESSION(CAR(lexp));
1662  NORMALIZE_EXPRESSION(exp1);
1663  new_vect = normalized_linear(expression_normalized(exp1));
1664 
1665  /* extract the denominator */
1666  lexp = CDR(lexp);
1667  exp2 = EXPRESSION(CAR(lexp));
1668  val = (Value)expression_to_int(exp2);
1669  va = vect_coeff((Variable)ent, cont->vecteur);
1670  vect_erase_var(&(cont->vecteur), (Variable)ent);
1671  cont->vecteur = vect_multiply(cont->vecteur, val);
1672  new_vect = vect_multiply(new_vect, va);
1673  cont->vecteur = vect_add(cont->vecteur, new_vect);
1674  vect_normalize(cont->vecteur);
1675  }
1676  }
1677  }
1678 
1679  sys->base = BASE_NULLE;
1680  sc_creer_base(sys);
1681  return(sys);
1682 }
list vecteur_to_list(Pvecteur)
===========================================================================
Definition: utils.c:1626
int expression_to_int(expression exp)
================================================================
Definition: expression.c:2205
static list lvect
#define BASE_NULLE
MACROS SUR LES BASES.
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
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 analyze_expression(), Ssysteme::base, BASE_NULLE, call_arguments, CAR, CDR, exp, EXPRESSION, expression_normalized, expression_syntax, expression_to_int(), Ssysteme::inegalites, is_entity_in_list_p(), lexp, lvect, NIL, NORMALIZE_EXPRESSION, normalized_linear, sc_creer_base(), Scontrainte::succ, syntax_call, sys_list::sys, VAR_VAL, var_val_value, var_val_variable, vect_add(), vect_coeff(), vect_erase_var(), vect_multiply(), vect_normalize(), Scontrainte::vecteur, and vecteur_to_list().

Referenced by analyze_quast().

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

◆ transform_in_ineq()

Psysteme transform_in_ineq ( Psysteme  sc,
list  l 
)

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

Psysteme transform_in_ineq((Psysteme)sc,(list)l):change a system of equalities in a system of inequalities, and at the same time, try to eliminate some lambda variables that are useless.

AC 93/11/08

in each vector, isolate a lambda variable if it exists

transform each equality in an inequality

Definition at line 902 of file makebdt.c.

906 {
907  Psysteme Psyst = sc_dup(sc);
908  Pvecteur v;
909  Pcontrainte c;
910  Variable var;
911  Value val;
912 
913  /* in each vector, isolate a lambda variable if it exists */
914  c = Psyst->egalites;
915 
916  while ((c != NULL) && (l != NIL))
917  {
918  var = (Variable)ENTITY(CAR(l));
919  v = c->vecteur;
920 
921  if (base_contains_variable_p((Pbase)v, var))
922  {
923  val = vect_coeff(var, v);
924  if (value_negz_p(val)) vect_chg_sgn(c->vecteur);
925  vect_erase_var(&c->vecteur, var);
926  }
927  c = c->succ;
928  l = CDR(l);
929  }
930 
931  /* transform each equality in an inequality */
932  sc_elim_empty_constraints(Psyst, true);
933  sc->inegalites = Psyst->egalites;
934  Psyst->egalites = sc->egalites;
935  Psyst->nb_eq = sc->nb_eq;
936  sc->nb_ineq = sc->nb_eq;
937  sc->nb_eq = 0;
938  sc->egalites = NULL;
939 
940  sc_rm(Psyst);
941  sc->base = NULL;
942  sc_creer_base(sc);
943 
944  return(sc);
945 }
void sc_elim_empty_constraints(Psysteme ps, bool process_equalities)
void sc_elim_empty_constraints(Psysteme ps, bool process_equalities): elimination des "fausses" contr...
int nb_eq
Definition: sc-local.h:72

References Ssysteme::base, base_contains_variable_p(), CAR, CDR, Ssysteme::egalites, ENTITY, Ssysteme::inegalites, Ssysteme::nb_eq, Ssysteme::nb_ineq, NIL, sc_creer_base(), sc_dup(), sc_elim_empty_constraints(), sc_rm(), Scontrainte::succ, value_negz_p, vect_chg_sgn(), vect_coeff(), vect_erase_var(), and Scontrainte::vecteur.

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:

◆ write_resulting_bdt()

bdt write_resulting_bdt ( scc  s,
int  stat,
bdt  bs,
bdt  bg 
)

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

bdt write_resulting_bdt(s, stat, bs, bg): simplify the bdt found and update the hash table.

AC 94/01/27

Definition at line 2681 of file makebdt.c.

2686 {
2687  Pbdt_node node;
2688  list lsc;
2689 
2690  bs = simplify_bdt(bs, s);
2691  node = (Pbdt_node) hash_get(h_node, (char *) stat);
2692  node->n_bdt = true_copy_bdt(bs);
2693  lsc = bdt_schedules(true_copy_bdt(bs));
2694  if (bdt_undefined_p(bg)) bg = bs;
2695  else bdt_schedules(bg) = gen_nconc(bdt_schedules(bg), lsc);
2696 
2697  return(bg);
2698 }
bdt simplify_bdt(bdt b, scc s)
=================================================================
Definition: makebdt.c:2160

References bdt_schedules, bdt_undefined_p, gen_nconc(), h_node, hash_get(), node(), simplify_bdt(), and true_copy_bdt().

Referenced by search_scc_bdt().

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

Variable Documentation

◆ h_node

hash_table h_node

Definition at line 85 of file makebdt.c.

Referenced by build_bdt_null(), search_graph_bdt(), search_scc_bdt(), and write_resulting_bdt().