PIPS
alloc.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
+ Include dependency graph for alloc.c:

Go to the source code of this file.

Functions

Pcontrainte contrainte_new (void)
 package contrainte - allocations et desallocations More...
 
Pcontrainte contrainte_make (Pvecteur pv)
 Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecteur passe en parametre. More...
 
Pcontrainte contrainte_make_1D (Value a, Variable x, Value b, bool less_p)
 Generate a constraint a x <= b or a x >= b, according to less_p, or ax==b, regardless of less_p. More...
 
Pcontrainte contraintes_make (Pvecteur pv,...)
 Convert a list of vectors into a list of constraints. More...
 
Pcontrainte contrainte_dup (Pcontrainte c_in)
 Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de la contrainte c_in (i.e. More...
 
Pcontrainte contraintes_dup (Pcontrainte c_in)
 Pcontrainte contraintes_dup(Pcontrainte c_in) a list of constraints is copied. More...
 
Pcontrainte contrainte_free (Pcontrainte c)
 Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c ainsi que de ses champs vecteur et saturations; seul le lien vers la contrainte suivante est ignore. More...
 
Pcontrainte contraintes_free (Pcontrainte pc)
 Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc. More...
 
void dbg_contrainte_rm (Pcontrainte c, char *f)
 void dbg_contrainte_rm(Pcontrainte c): version debug de contrainte rm; trace de la desallocation et impression de la contrainte sur stdout More...
 
Pcontrainte contrainte_copy (Pcontrainte c_in)
 Have a look at contrainte_dup and contraintes_dup which reverse the order of the list This copy version (including vect_copy, sc_copy) maintains the order (DN,24/6/02) More...
 
Pcontrainte contraintes_copy (Pcontrainte c_in)
 Pcontrainte contraintes_copy(Pcontrainte c_in) a list of constraints is copied with the same order In fact, here we only need to replace contrainte_dup by contrainte_copy Have a look at contrainte_copy (DN,24/6/02) More...
 

Function Documentation

◆ contrainte_copy()

Pcontrainte contrainte_copy ( Pcontrainte  c_in)

Have a look at contrainte_dup and contraintes_dup which reverse the order of the list This copy version (including vect_copy, sc_copy) maintains the order (DN,24/6/02)

Parameters
c_in_in

Definition at line 254 of file alloc.c.

255 {
256  Pcontrainte c_out = NULL;
257 
258  if(c_in!=NULL) {
259  c_out = contrainte_new();
260  c_out->vecteur = vect_copy(c_in->vecteur);
261  }
262  return c_out;
263 }
FILE * c_in
Definition: c_syntax.h:291
FILE * c_out
Pcontrainte contrainte_new(void)
package contrainte - allocations et desallocations
Definition: alloc.c:47
Pbase vect_copy(Pvecteur b)
direct duplication.
Definition: alloc.c:240

References c_in, c_out, contrainte_new(), and vect_copy().

Referenced by bound_redund_with_sc_p(), build_integer_sc_nredund(), build_sc_nredund_1pass_ofl_ctrl(), contraintes_copy(), eq_redund_with_sc_p(), extract_nredund_subsystem(), ineq_redund_with_sc_p(), sc_append(), sc_safe_append(), sc_strong_normalize2(), sc_strong_normalize_and_check_feasibility(), and sc_strong_normalize_and_check_feasibility2().

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

◆ contrainte_dup()

Pcontrainte contrainte_dup ( Pcontrainte  c_in)

Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de la contrainte c_in (i.e.

duplication d'une contrainte); les tableaux de saturations ne sont pas recopies car on n'en connait pas la dimension. Le lien vers le successeur est aussi ignore pour ne pas cree de sharing intempestif.

allocate c_out; c_out := c_in; return c_out;

Ancien nom: eq_dup() et cp_eq()

Parameters
c_in_in

Definition at line 132 of file alloc.c.

133 {
134  Pcontrainte c_out = NULL;
135 
136  if(c_in!=NULL) {
137  c_out = contrainte_new();
138  c_out->vecteur = vect_dup(c_in->vecteur);
139  }
140  return c_out;
141 }
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 c_in, c_out, contrainte_new(), and vect_dup().

Referenced by build_transfer_equations(), contrainte_dup_extract(), contraintes_dup(), dj_simple_inegs_to_eg(), elim_redund_sc_with_sc(), find_implicit_equation(), find_motif(), get_bounds_expression(), insert_2ineq_end_sc(), insert_ineq_begin_sc(), insert_ineq_end_sc(), make_bounds(), make_tile_constraints(), mapping_on_broadcast(), sc_minmax_of_variable2(), sc_supress_parallel_redund_constraints(), sc_supress_same_constraints(), sc_transform_eg_in_ineg(), sc_transform_ineg_in_eg(), separate_variables(), separate_variables_2(), test_bound_generation(), tile_membership(), and valuer().

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

◆ contrainte_free()

Pcontrainte contrainte_free ( Pcontrainte  c)

Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c ainsi que de ses champs vecteur et saturations; seul le lien vers la contrainte suivante est ignore.

Utilisation standard: c = contrainte_free(c);

Autre utilisation possible: (void) contrainte_free(c); c = NULL;

comme toujours, les champs pointeurs sont remis a NULL avant la desallocation pour detecter au plus tot les erreurs dues a l'allocation dynamique de memoire.

Modification:

  • renvoi systematique de CONTRAINTE_NULLE comme valeur de la fonction; ca permet de diminuer la taille du code utilisateur et d'assurer plus facilement la mise a CONTRAINTE_NULLE de pointeurs referencant une zone desallouee (FI, 24/11/89)

Definition at line 184 of file alloc.c.

185 {
186  // Cannot be used at the contrainte level
187  //ifscdebug(1)
188  // fprintf(stderr, "Constraint %p is going to be freed\n", c);
189  if (!CONTRAINTE_UNDEFINED_P(c))
190  {
191  if (c->eq_sat != NULL) {
192  free((char *)c->eq_sat);
193  c->eq_sat = NULL;
194  }
195 
196  if (c->r_sat != NULL) {
197  free((char *)c->r_sat);
198  c->r_sat = NULL;
199  }
200 
201  if (c->s_sat != NULL) {
202  free((char *)c->s_sat);
203  c->s_sat = NULL;
204  }
205 
206  if (c->vecteur != VECTEUR_UNDEFINED) {
207  vect_rm(c->vecteur);
208  c->vecteur = NULL;
209  }
210 
211  c->succ = NULL;
212 
213  free((char *)c);
214  }
215 
216  return CONTRAINTE_UNDEFINED;
217 }
#define CONTRAINTE_UNDEFINED_P(c)
#define CONTRAINTE_UNDEFINED
void free(void *)
Pvecteur vecteur
struct Scontrainte * succ
#define VECTEUR_UNDEFINED
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, Scontrainte::eq_sat, free(), Scontrainte::r_sat, Scontrainte::s_sat, Scontrainte::succ, vect_rm(), Scontrainte::vecteur, and VECTEUR_UNDEFINED.

Referenced by combiner_ofl_with_test(), contrainte_remove_large_coef(), contraintes_free(), dj_simple_inegs_to_eg(), eq_redund_with_sc_p(), extract_common_constraints(), loop_executed_approximation(), pa_path_to_few_disjunct_ofl_ctrl(), region_sc_minimal(), sc_elim_empty_constraints(), sc_elim_redund_with_first_ofl_ctrl(), sc_force_variable_to_zero(), sc_rm_empty_constraints(), sc_supress_same_constraints(), and top_down_abc_dimension().

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

◆ contrainte_make()

Pcontrainte contrainte_make ( Pvecteur  pv)

Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecteur passe en parametre.

Modifications:

  • le signe du terme constant n'est plus modifie (FI, 24/11/89)
Parameters
pvv

Definition at line 73 of file alloc.c.

74 {
76  contrainte_vecteur(c) = pv;
77  return(c);
78 }
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"

References contrainte_new(), and contrainte_vecteur.

Referenced by __attribute__(), add_equivalence_equality(), adg_dataflowgraph(), adg_dataflowgraph_with_extremities(), adg_get_conjonctions(), adg_get_predicate_of_loops(), adg_max_of_leaves(), adg_suppress_2nd_in_1st_ps(), affine_to_transformer(), base_complete(), broadcast_conditions(), broadcast_dimensions(), broadcast_of_dataflow(), build_convex_constraints_from_vertices(), build_list_of_min(), build_sc_machine(), build_sc_with_several_uniform_ref(), c_convex_effects_on_actual_parameter_forward_translation(), check_range_wrt_precondition(), comp_exec_domain(), completer_base(), completer_n_base(), compose_vvs(), compute_entity_to_declaration_constraints(), constraint_to_bound(), contrainte_make_1D(), converti_psysmin_psysmax(), dependence_cone_positive(), dependence_system_add_lci_and_di(), dj_simple_inegs_to_eg(), dj_system_complement(), do_solve_hardware_constraints_on_nb_proc(), efficient_sc_check_inequality_feasibility(), elim_var_with_eg(), expression_less_than_in_context(), expressions_to_predicate(), expressions_to_vectors(), find_implicit_equation(), find_intermediate_constraints(), find_intermediate_constraints_recursively(), find_motif(), find_pattern(), fortran_user_function_call_to_transformer(), free_guards(), full_linearization(), gcd_and_constant_dependence_test(), generate_system_for_equal_variables(), generate_work_sharing_system(), generic_equality_to_transformer(), generic_minmax_to_transformer(), hpfc_compute_align_constraints(), hpfc_compute_distribute_constraints(), hpfc_compute_entity_to_new_declaration(), hpfc_compute_unicity_constraints(), include_parameters_in_sc(), integer_divide_to_transformer(), integer_power_to_transformer(), integer_right_shift_to_transformer(), interlaced_basic_workchunk_regions_p(), local_tile_constraints(), logical_binary_function_to_transformer(), logical_constant_to_transformer(), loop_basic_workchunk_to_workchunk(), loop_bounds_to_tile_bounds(), loop_executed_approximation(), loop_index_domaine_to_contrainte(), loop_regions_normalize(), make_context_of_loop(), make_dual(), make_expression_equalities(), make_reindex(), make_scanning_over_one_tile(), matrix_to_system(), my_adg_expressions_to_predicate(), nullify_factors(), pa_path_to_few_disjunct_ofl_ctrl(), partial_broadcast_coefficients(), partial_linearization(), Pcontrainte_separate_on_vars(), plc_elim_var_with_eg(), polynome_to_contrainte(), polynome_to_sc(), prepare_reindexing(), processor_loop(), prototype_dimension(), put_variables_in_ordered_lists(), re_do_it(), relation_to_transformer(), sc_elim_double_constraints(), sc_empty(), sc_find_equalities(), sc_gen_read(), sc_image_computation(), sc_minmax_of_variables(), sc_multiply_constant_terms(), sc_of_constrs(), sc_supress_same_constraints(), separate_variables(), set_dimensions_of_local_variable_family(), simple_addition_to_transformer(), simple_affine_to_transformer(), simplify_minmax_contrainte(), small_positive_slope_reduce_coefficients_with_bounding_box(), stmt_bdt_directions(), suppress_sc_in_sc(), tile_change_of_basis(), tile_hyperplane_constraints(), tile_membership_constraints(), top_down_abc_dimension(), transformer_add_loop_index_initialization(), transformer_add_sign_information(), transformer_add_variable_incrementation(), transformer_constraint_add(), transformer_convex_hulls(), transformer_derivative_constraints(), transformer_derivative_fix_point(), transformer_equality_fix_point(), transformer_list_generic_transitive_closure(), translate_global_value(), valuer(), vvs_on_vvs(), and vvs_to_sc().

+ Here is the call graph for this function:

◆ contrainte_make_1D()

Pcontrainte contrainte_make_1D ( Value  a,
Variable  x,
Value  b,
bool  less_p 
)

Generate a constraint a x <= b or a x >= b, according to less_p, or ax==b, regardless of less_p.

Since equalities and inequalities are not distinguished, less_p is not relevant when equations are built.

Parameters
less_pess_p

Definition at line 86 of file alloc.c.

87 {
89  if(less_p)
90  v = vect_make_1D(a, x, value_uminus(b));
91  else
92  v = vect_make_1D(value_uminus(a), x, b);
94  return c;
95 }
#define value_uminus(val)
unary operators on values
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
static char * x
Definition: split_file.c:159
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Pvecteur vect_make_1D(Value a, Variable x, Value b)
Generate a sparse vector a x + b TCST.
Definition: alloc.c:226

References contrainte_make(), value_uminus, vect_make_1D(), VECTEUR_UNDEFINED, and x.

Referenced by add_bounding_box_constraints().

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

◆ contrainte_new()

Pcontrainte contrainte_new ( void  )

package contrainte - allocations et desallocations

CONTRAINTE.

INTLIBRARY Pcontrainte contrainte_new(): allocation et initialisation d'une contrainte vide

Anciens noms: init_eq(), creer_eq

= (Pcontrainte)MALLOC(sizeof (Scontrainte),CONTRAINTE, "contrainte_new");

Definition at line 47 of file alloc.c.

48 {
49  Pcontrainte c;
50 
51  /*c = (Pcontrainte)MALLOC(sizeof (Scontrainte),CONTRAINTE,
52  "contrainte_new");*/
53  c = (Pcontrainte) malloc(sizeof (Scontrainte));
54  if (c == NULL) {
55  (void) fprintf(stderr,"contrainte_new: Out of memory space\n");
56  exit(-1);
57  }
58  c->eq_sat = NULL;
59  c->s_sat = NULL;
60  c->r_sat = NULL;
61  c->vecteur = NULL;
62  c->succ = NULL;
63 
64  return c;
65 }
struct Scontrainte * Pcontrainte
void * malloc(YYSIZE_T)
#define exit(code)
Definition: misc-local.h:54
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References Scontrainte::eq_sat, exit, fprintf(), malloc(), Scontrainte::r_sat, Scontrainte::s_sat, Scontrainte::succ, and Scontrainte::vecteur.

Referenced by adg_sc_dup(), contrainte_copy(), contrainte_dup(), contrainte_make(), contraintes_make(), creer_Psysteme(), inegalite_comb_ofl_ctrl(), make_tile_constraints(), mat_sys_conv(), matrices_to_constraints(), matrices_to_constraints_with_sym_cst(), matrices_to_contraintes_with_sym_cst(), matrices_to_loop_sc(), matrices_to_sc(), my_matrices_to_constraints_with_sym_cst(), my_matrices_to_constraints_with_sym_cst_2(), pu_matrices_to_contraintes(), sc_copy(), sc_dup1(), tile_membership(), and var_posit().

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

◆ contraintes_copy()

Pcontrainte contraintes_copy ( Pcontrainte  c_in)

Pcontrainte contraintes_copy(Pcontrainte c_in) a list of constraints is copied with the same order In fact, here we only need to replace contrainte_dup by contrainte_copy Have a look at contrainte_copy (DN,24/6/02)

Parameters
c_in_in

Definition at line 270 of file alloc.c.

271 {
273  c_tmp = contrainte_copy(c_in),
274  c_out = c_tmp,
275  c = NULL;
276 
277  for (c=(c_in==NULL?NULL:c_in->succ);
278  c!=NULL;
279  c=c->succ)
280  c_tmp->succ = contrainte_copy(c),
281  c_tmp = c_tmp->succ;
282 
283  return c_out;
284 }
Pcontrainte contrainte_copy(Pcontrainte c_in)
Have a look at contrainte_dup and contraintes_dup which reverse the order of the list This copy versi...
Definition: alloc.c:254

References c_in, c_out, contrainte_copy(), and Scontrainte::succ.

Referenced by build_sc_nredund_1pass_ofl_ctrl().

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

◆ contraintes_dup()

Pcontrainte contraintes_dup ( Pcontrainte  c_in)

Pcontrainte contraintes_dup(Pcontrainte c_in) a list of constraints is copied.

Parameters
c_in_in

Definition at line 146 of file alloc.c.

147 {
149  c_tmp = contrainte_dup(c_in),
150  c_out = c_tmp,
151  c = NULL;
152 
153  for (c=(c_in==NULL?NULL:c_in->succ);
154  c!=NULL;
155  c=c->succ)
156  c_tmp->succ = contrainte_dup(c),
157  c_tmp = c_tmp->succ;
158 
159  return c_out;
160 }
Pcontrainte contrainte_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
Definition: alloc.c:132

References c_in, c_out, contrainte_dup(), and Scontrainte::succ.

Referenced by constraints_to_loop_bound(), and dj_simple_inegs_to_eg().

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

◆ contraintes_free()

Pcontrainte contraintes_free ( Pcontrainte  pc)

Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc.

chaque contrainte est detruite par un appel a contrainte_free.

Ancien nom: elim_tte_ineg()

Parameters
pcc

Definition at line 226 of file alloc.c.

227 {
228  while (!CONTRAINTE_UNDEFINED_P(pc)) {
229  Pcontrainte pcs = pc->succ;
230  (void) contrainte_free(pc);
231  pc = pcs;
232  }
233  return CONTRAINTE_UNDEFINED;
234 }
Pcontrainte contrainte_free(Pcontrainte c)
Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c a...
Definition: alloc.c:184

References contrainte_free(), CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, and Scontrainte::succ.

Referenced by apply_abstract_effect_to_transformer(), combiner_ofl_with_test(), extract_lattice(), generic_minmax_to_transformer(), hpfc_broadcast_buffers(), hpfc_compute_lid(), make_rectangular_area(), reset_equivalence_equalities(), sc_resol_smith(), sc_rm(), sc_transform_eg_in_ineg(), smith_int(), systeme_to_loop_nest(), transformer_basic_fix_point(), transformer_pattern_fix_point(), and translate_to_module_frame().

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

◆ contraintes_make()

Pcontrainte contraintes_make ( Pvecteur  pv,
  ... 
)

Convert a list of vectors into a list of constraints.

Parameters
pvv

Definition at line 99 of file alloc.c.

100 {
101  va_list the_args;
102 
104  Pcontrainte lc = c;
105  contrainte_vecteur(c) = pv;
106 
107  va_start(the_args, pv);
108  Pvecteur nv = pv;
109  while(nv!=VECTEUR_NUL) {
110  nv = va_arg(the_args, Pvecteur);
112  contrainte_vecteur(nc) = nv;
113  contrainte_succ(lc) = nc;
114  lc = nc;
115  }
116 
117  return(c);
118 }
#define contrainte_succ(c)
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.

References contrainte_new(), contrainte_succ, contrainte_vecteur, and VECTEUR_NUL.

Referenced by find_intermediate_constraints().

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

◆ dbg_contrainte_rm()

void dbg_contrainte_rm ( Pcontrainte  c,
char *  f 
)

void dbg_contrainte_rm(Pcontrainte c): version debug de contrainte rm; trace de la desallocation et impression de la contrainte sur stdout

rint_eq(c);

REE((char *)c,CONTRAINTE,f);

Definition at line 239 of file alloc.c.

240 {
241  (void) printf("destruction de EQ dans %s\n",f);
242  /*print_eq(c);*/
243  dbg_vect_rm(c->vecteur,f);
244  /*FREE((char *)c,CONTRAINTE,f);*/
245  free((char *)c);
246 }
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
int printf()
void dbg_vect_rm(Pvecteur v, char __attribute__((unused)) *f)
void dbg_vect_rm(Pvecteur v, char * f): desallocation d'un vecteur avec marquage de la fonction provo...
Definition: alloc.c:139

References dbg_vect_rm(), f(), free(), printf(), and Scontrainte::vecteur.

+ Here is the call graph for this function: