PIPS
sc_alloc.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "arithmetique.h"
#include "linear_assert.h"
#include "boolean.h"
#include "vecteur.h"
#include "contrainte.h"
#include "sc.h"
+ Include dependency graph for sc_alloc.c:

Go to the source code of this file.

Macros

#define MALLOC(s, t, f)   malloc(s)
 package sc More...
 

Functions

Psysteme sc_new (void)
 Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles, puis retourne ce systeme en resultat. More...
 
Pbase sc_to_minimal_basis (Psysteme ps)
 creation d'une base contenant toutes les variables apparaissant avec des coefficients non-nuls dans les egalites ou les inegalites de ps More...
 
void sc_creer_base (Psysteme ps)
 void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineaire en nombres entiers ps, i.e. More...
 
void sc_fix (Psysteme s)
 fix system s for coherency of the base and number of things. More...
 
Pbase sc_base_dup (int nbv, Pbase b)
 Variable * sc_base_dup(int nbv, Variable * b): duplication de la table des variables base, qui contient nbv elements. More...
 
Psysteme sc_dup (Psysteme ps)
 Psysteme sc_dup(Psysteme ps): should becomes a link. More...
 
Psysteme sc_copy (Psysteme ps)
 Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans sharing) More...
 
void sc_rm (Psysteme ps)
 void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps; More...
 
Psysteme sc_init_with_sc (Psysteme sc)
 This function returns a new empty system which has been initialized with the same dimension and base than sc. More...
 
Psysteme sc_empty (Pbase b)
 Psysteme sc_empty(Pbase b): build a Psysteme with one unfeasible constraint to define the empty subspace in a space R^n, where n is b's dimension. More...
 
Psysteme sc_rn (Pbase b)
 Psysteme sc_rn(Pbase b): build a Psysteme without constraints to define R^n, where n is b's dimension. More...
 
bool sc_empty_p (Psysteme sc)
 bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not. More...
 
bool sc_rn_p (Psysteme sc)
 bool sc_rn_p(Psysteme sc): check if the set associated to sc is the whole space, rn More...
 
void sc_add_egalite (Psysteme p, Pcontrainte e)
 void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base n'est pas mise a jour; il faut faire ensuite un appel a sc_creer_base(); il vaut mieux utiliser sc_make() More...
 
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 base n'est pas mise a jour; il faut ensuite faire un appel a sc_creer_base(); il vaut mieux utiliser sc_make(); More...
 
void sc_add_egalites (Psysteme p, Pcontrainte i)
 
void sc_add_inegalites (Psysteme p, Pcontrainte i)
 

Macro Definition Documentation

◆ MALLOC

#define MALLOC (   s,
  t,
  f 
)    malloc(s)

package sc

Definition at line 42 of file sc_alloc.c.

Function Documentation

◆ sc_add_egalite()

void sc_add_egalite ( Psysteme  p,
Pcontrainte  e 
)

void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base n'est pas mise a jour; il faut faire ensuite un appel a sc_creer_base(); il vaut mieux utiliser sc_make()

sc_add_eg est (a peu pres) equivalent a sc_add_egalite, mais le parametre e n'est utilise qu'une fois ce qui permet d'eviter des surprises en cas de e++ et autres effects de bords a chaque evaluation de e; sc_add_egalite est donc plus sur que sc_add_eg

If the system basis should be updated, use sc_constraint_add() and the two related function in sc_insert.c

Definition at line 389 of file sc_alloc.c.

390 {
391  assert(p && e && !e->succ);
392 
393  e->succ = p->egalites;
394  p->egalites = e;
395  p->nb_eq++;
396 }
#define assert(ex)
Definition: newgen_assert.h:41
struct Scontrainte * succ
Pcontrainte egalites
Definition: sc-local.h:70
int nb_eq
Definition: sc-local.h:72

References assert, Ssysteme::egalites, Ssysteme::nb_eq, and Scontrainte::succ.

Referenced by adg_sc_dup(), base_complete(), better_elim_var_with_eg(), broadcast_conditions(), broadcast_dimensions(), broadcast_of_dataflow(), completer_base(), completer_n_base(), compose_vvs(), dj_simple_inegs_to_eg(), do_solve_hardware_constraints_on_nb_proc(), elim_var_with_eg(), find_implicit_equation(), generate_system_for_equal_variables(), generate_work_sharing_system(), hpfc_compute_align_constraints(), hpfc_compute_distribute_constraints(), hpfc_compute_entity_to_new_declaration(), hpfc_compute_unicity_constraints(), local_tile_constraints(), loop_bounds_to_tile_bounds(), loop_regions_normalize(), make_expression_equalities(), make_scanning_over_one_tile(), mapping_on_broadcast(), new_elim_var_with_eg(), nullify_factors(), old_polynome_to_sc(), partial_broadcast_coefficients(), plc_elim_var_with_eg(), polynome_to_sc(), prepare_reindexing(), prototype_dimension(), sc_append(), sc_constraint_add(), sc_copy(), sc_dup1(), sc_elim_double_constraints(), sc_find_equalities(), sc_gen_read(), sc_restricted_to_variables_transitive_closure(), sc_safe_append(), sc_strong_normalize2(), sc_strong_normalize_and_check_feasibility(), sc_strong_normalize_and_check_feasibility2(), separate_variables(), set_dimensions_of_local_variable_family(), stmt_bdt_directions(), tile_change_of_basis(), transformer_add_sign_information(), transformer_equality_fix_point(), translate_global_value(), valuer(), vvs_on_vvs(), and vvs_to_sc().

◆ sc_add_egalites()

void sc_add_egalites ( Psysteme  p,
Pcontrainte  i 
)

Adjust the number of equalities

Definition at line 415 of file sc_alloc.c.

416 {
417  if(CONTRAINTE_UNDEFINED_P(sc_egalites(p))) {
418  sc_egalites(p) = i;
419  }
420  else {
422  for(ineq = sc_egalites(p);
424  ineq = contrainte_succ(ineq)) {
425  }
426  contrainte_succ(ineq) = i;
427  }
428  /* Adjust the number of equalities */
429  sc_nbre_egalites(p) = nb_elems_list(sc_egalites(p));
430 }
#define CONTRAINTE_UNDEFINED_P(c)
#define contrainte_succ(c)
#define CONTRAINTE_UNDEFINED
int nb_elems_list(Pcontrainte)
int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes
Definition: listes.c:129

References contrainte_succ, CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, and nb_elems_list().

Referenced by add_bounding_box_constraints().

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

◆ sc_add_inegalite()

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 base n'est pas mise a jour; il faut ensuite faire un appel a sc_creer_base(); il vaut mieux utiliser sc_make();

sc_add_ineg est (a peu pres) equivalent a sc_add_inegalite; cf supra pour l'explication des differences

Definition at line 406 of file sc_alloc.c.

407 {
408  assert(p && i && !i->succ);
409 
410  i->succ = p->inegalites;
411  p->inegalites = i;
412  p->nb_ineq++;
413 }
Pcontrainte inegalites
Definition: sc-local.h:71
int nb_ineq
Definition: sc-local.h:73

References assert, Ssysteme::inegalites, Ssysteme::nb_ineq, and Scontrainte::succ.

Referenced by add_constraint_on_x(), adg_get_conjonctions(), adg_get_predicate_of_loops(), adg_sc_dup(), build_integer_sc_nredund(), build_list_of_min(), build_sc_nredund_1pass_ofl_ctrl(), comp_exec_domain(), compute_entity_to_declaration_constraints(), dj_simple_inegs_to_eg(), do_solve_hardware_constraints_on_nb_proc(), expressions_to_predicate(), generate_work_sharing_system(), get_bounds_expression(), hpfc_compute_distribute_constraints(), hpfc_compute_entity_to_new_declaration(), include_parameters_in_sc(), ineq_redund_with_sc_p(), interlaced_basic_workchunk_regions_p(), loop_regions_normalize(), make_bounds(), make_dual(), make_tile_constraints(), my_adg_expressions_to_predicate(), processor_loop(), re_do_it(), sc_append(), sc_constraint_add(), sc_copy(), sc_dup1(), sc_gen_read(), sc_image_computation(), sc_multiply_constant_terms(), sc_restricted_to_variables_transitive_closure(), sc_safe_append(), sc_strong_normalize_and_check_feasibility(), sc_supress_parallel_redund_constraints(), sc_supress_same_constraints(), separate_variables(), separate_variables_2(), tile_hyperplane_constraints(), tile_membership(), tile_membership_constraints(), transformer_add_sign_information(), and valuer().

+ Here is the caller graph for this function:

◆ sc_add_inegalites()

void sc_add_inegalites ( Psysteme  p,
Pcontrainte  i 
)

Adjust the number of inequalities

Definition at line 432 of file sc_alloc.c.

433 {
434  if(CONTRAINTE_UNDEFINED_P(sc_inegalites(p))) {
435  sc_inegalites(p) = i;
436  }
437  else {
439  for(ineq = sc_inegalites(p);
441  ineq = contrainte_succ(ineq)) {
442  }
443  contrainte_succ(ineq) = i;
444  }
445  /* Adjust the number of inequalities */
446  sc_nbre_inegalites(p) = nb_elems_list(sc_inegalites(p));
447 }

References contrainte_succ, CONTRAINTE_UNDEFINED, CONTRAINTE_UNDEFINED_P, and nb_elems_list().

Referenced by add_bounding_box_constraints(), and sc_bounded_normalization().

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

◆ sc_base_dup()

Pbase sc_base_dup ( int  nbv,
Pbase  b 
)

Variable * sc_base_dup(int nbv, Variable * b): duplication de la table des variables base, qui contient nbv elements.

Modifications:

  • on renvoie un pointeur NULL si le nombre de variables nbv est nul
  • changement de num_var en base; cette fonction perd tout interet et n'est conservee que pour faciliter la mise a jour des modules de plint (FI, 19/12/89)

ancien nom: tab_dup

Definition at line 162 of file sc_alloc.c.

165 {
166  assert(nbv==base_dimension(b));
167 
168  return((Pbase) base_copy(b));
169 }
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
#define base_dimension(b)
Pbase base_copy(Pbase b)
Direct duplication.
Definition: alloc.c:300

References assert, base_copy(), and base_dimension.

+ Here is the call graph for this function:

◆ sc_copy()

Psysteme sc_copy ( Psysteme  ps)

Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans sharing)

replace sc_dup(ps), which now becomes a link

Ancien nom (obsolete): cp_sc()

Modification: L'ordre des egalites, inegalites, la base et des variables dans le syteme est recopie egalement. (CA, 28/08/91),(DN,24/6/02)

We can use contrainte_copy, contraintes_copy here If we test the size of system here for debugging purposes, il may cost more time ...

Definition at line 230 of file sc_alloc.c.

231 {
232  Psysteme cp = SC_UNDEFINED;
233  int i,j;
234 
235  if (!SC_UNDEFINED_P(ps)) {
236  Pcontrainte eq, eq_cp;
237  cp = sc_new();
238 
239  for (j=ps->nb_eq;j>0;j--) {
240  for (eq = ps->egalites,i=1;i<j; eq = eq->succ,i++) {/**/}
241  eq_cp = contrainte_new();
243  sc_add_egalite(cp, eq_cp);
244  }
245 
246  for (j=ps->nb_ineq;j>0;j--) {
247  for (eq = ps->inegalites,i=1;i<j; eq = eq->succ,i++) {/**/}
248  eq_cp = contrainte_new();
250  sc_add_inegalite(cp, eq_cp);
251  }
252 
253  if(ps->dimension==0) {
254  cp->dimension = 0;
255  cp->base = VECTEUR_UNDEFINED;
256  }
257  else {
258  cp->dimension = ps->dimension;
259  cp->base = base_copy(ps->base);
260  }
261  }
262 
263  return cp;
264 }
#define contrainte_vecteur(c)
passage au champ vecteur d'une contrainte "a la Newgen"
Pcontrainte contrainte_new(void)
package contrainte - allocations et desallocations
Definition: alloc.c:47
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Definition: sc_alloc.c:389
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
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
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
Definition: sc_read.c:87
Pbase base
Definition: sc-local.h:75
int dimension
Definition: sc-local.h:74
#define VECTEUR_UNDEFINED
Pbase vect_copy(Pvecteur b)
direct duplication.
Definition: alloc.c:240

References Ssysteme::base, base_copy(), contrainte_new(), contrainte_vecteur, cp, Ssysteme::dimension, Ssysteme::egalites, eq, Ssysteme::inegalites, Ssysteme::nb_eq, Ssysteme::nb_ineq, sc_add_egalite(), sc_add_inegalite(), sc_new(), vect_copy(), and VECTEUR_UNDEFINED.

Referenced by ineq_redund_with_sc_p(), interlaced_basic_workchunk_regions_p(), main(), sc_append(), sc_dup(), sc_fourier_motzkin_feasibility_ofl_ctrl_timeout_ctrl(), sc_gen_copy_tree(), sc_intersection(), sc_intersection_empty_p_ofl(), sc_janus_feasibility_ofl_ctrl_timeout_ctrl(), sc_normalize2(), sc_projection_concat_proj_on_variables(), sc_safe_append(), sc_safe_intersection(), sc_simplexe_feasibility_ofl_ctrl_timeout_ctrl(), sc_strong_normalize2(), sc_strong_normalize_and_check_feasibility(), sc_strong_normalize_and_check_feasibility2(), text_pointer_value(), text_points_to_relation(), text_transformer(), transformer_derivative_constraints(), and transformer_list_generic_transitive_closure().

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

◆ sc_creer_base()

void sc_creer_base ( Psysteme  ps)

void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineaire en nombres entiers ps, i.e.

de la base implicite correspondant aux egalites et inegalites du systeme;

Attention, cette base ne reste pas coherente apres un ajout de nouvelles egalites ou inegalites (risque d'ajout de nouvelles variables), ni apres des suppressions (certaines variables de la base risque de n'apparaitre dans aucune contrainte).

dimension : nombre de variables du systeme (i.e. differentes de TCST, le terme constant)

Modifications:

  • passage de num_var a base (FI, 13/12/89)

Definition at line 129 of file sc_alloc.c.

131 {
132  if (ps) {
133  assert(ps->base == (Pbase) NULL);
134  ps->base = sc_to_minimal_basis(ps);
135  ps->dimension = vect_size(ps->base);
136  }
137 }
int vect_size(Pvecteur v)
package vecteur - reductions
Definition: reductions.c:47
Pbase sc_to_minimal_basis(Psysteme ps)
creation d'une base contenant toutes les variables apparaissant avec des coefficients non-nuls dans l...
Definition: sc_alloc.c:76

References assert, sc_to_minimal_basis(), and vect_size().

Referenced by adg_compact_quast(), adg_dup_disjunctive_nodes(), adg_get_conjonctions(), adg_get_predicate_of_loops(), adg_path_max_source(), adg_sc_update_base(), adg_update_dfg(), algorithm_tiling(), append_eg(), base_complete(), better_elim_var_with_eg(), broadcast_of_dataflow(), build_and_test_dependence_context(), build_sc_with_several_uniform_ref(), build_third_comb(), change_base_in_sc(), clean_shared_io_system(), clean_the_system(), comp_exec_domain(), completer_base(), completer_n_base(), compute_entity_to_declaration_constraints(), creer_predicat(), dependence_system_add_lci_and_di(), dj_simple_inegs_to_eg(), elim_var_with_eg(), expressions_to_predicate(), extract_lattice(), find_implicit_equation(), generate_distributed_io_system(), generate_shared_io_system(), generate_system_for_distributed_variable(), generate_system_for_equal_variables(), generate_work_sharing_system(), hpfc_compute_align_constraints(), hpfc_compute_distribute_constraints(), hpfc_compute_entity_to_new_declaration(), hpfc_compute_unicity_constraints(), include_trans_in_sc(), ineq_redund_with_sc_p(), interlaced_basic_workchunk_regions_p(), loop_basic_workchunk_to_workchunk(), loop_iteration_domaine_to_sc(), loop_regions_normalize(), make_dual(), make_expression_equalities(), make_scanning_over_one_tile(), make_scanning_over_tiles(), make_tile_constraints(), my_adg_expressions_to_predicate(), my_sc_normalize(), my_substitute_var_with_vec(), new_elim_var_with_eg(), nullify_factors(), old_polynome_to_sc(), partial_broadcast_coefficients(), plc_elim_var_with_eg(), polynome_to_sc(), prepare_reindexing(), prototype_dimension(), put_variables_in_ordered_lists(), re_do_it(), region_translation(), remove_variables_if_possible(), sc_concatenate(), sc_constraint_add(), sc_find_equalities(), sc_fix(), sc_fourier_motzkin_feasibility_ofl_ctrl(), sc_make(), sc_minmax_of_variable2(), sc_restricted_to_variables_transitive_closure(), sc_simplex_feasibility_ofl_ctrl_fixprec(), sc_substitute_dimension(), sc_supress_parallel_redund_constraints(), sc_supress_same_constraints(), simplify_deducable_variables(), simplify_minmax_contrainte(), stmt_bdt_directions(), substitute_var_with_vec(), system_contains_var(), system_new_var_subst(), tile_hyperplane_constraints(), tile_membership(), tile_membership_constraints(), transform_in_ineq(), transformer_equality_fix_point(), valuer(), and vvs_to_sc().

+ Here is the call graph for this function:

◆ sc_dup()

Psysteme sc_dup ( Psysteme  ps)

Psysteme sc_dup(Psysteme ps): should becomes a link.

Ancien nom (obsolete): cp_sc()

Definition at line 176 of file sc_alloc.c.

177 {
178  return sc_copy(ps);
179  /*
180  Psysteme cp = SC_UNDEFINED;
181 
182  if (!SC_UNDEFINED_P(ps)) {
183  Pcontrainte eq, eq_cp;
184  cp = sc_new();
185 
186  for (eq = ps->egalites; eq != NULL; eq = eq->succ) {
187  eq_cp = contrainte_new();
188  contrainte_vecteur(eq_cp) = vect_dup(contrainte_vecteur(eq));
189  sc_add_egalite(cp, eq_cp);
190  }
191 
192  for(eq=ps->inegalites;eq!=NULL;eq=eq->succ) {
193  eq_cp = contrainte_new();
194  contrainte_vecteur(eq_cp) = vect_dup(contrainte_vecteur(eq));
195  sc_add_inegalite(cp, eq_cp);
196  }
197 
198  if(ps->dimension==0) {
199  assert(VECTEUR_UNDEFINED_P(ps->base));
200  cp->dimension = 0;
201  cp->base = VECTEUR_UNDEFINED;
202  }
203  else {
204  assert(ps->dimension==vect_size(ps->base));
205  cp->dimension = ps->dimension;
206  cp->base = base_dup(ps->base);
207  }
208  }
209 
210  return cp;
211  */
212 }
Psysteme sc_copy(Psysteme ps)
Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans...
Definition: sc_alloc.c:230

References sc_copy().

Referenced by __attribute__(), add_elt_to_sys_list(), adg_compact_quast(), adg_dataflowgraph(), adg_dataflowgraph_with_extremities(), adg_make_disjunctions(), adg_predicate_list_dup(), adg_update_dfg(), algorithm_row_echelon_generic(), analyze_quast(), base_complete(), broadcast_conditions(), broadcast_of_dataflow(), build_first_comb(), build_list_of_min(), build_sc_with_several_uniform_ref(), build_third_comb(), build_third_subcomb(), check_range_wrt_precondition(), combiner_ofl_with_test(), compatible_pc_p(), completer_base(), completer_n_base(), converti_psysmin_psysmax(), convex_cells_intersection_p(), copy_write_statement_with_cumulated_regions(), dataflows_on_reference(), dependence_cone_positive(), dj_intersection_ofl_ctrl(), dj_simple_inegs_to_eg(), do_check_isolate_statement_preconditions_on_call(), do_group_statement_constant(), do_isolate_statement_preconditions_satisified_p(), do_solve_hardware_constraints_on_nb_proc(), edge_weight(), efficient_sc_check_inequality_feasibility(), elementary_convex_union(), elim_redund_sc_with_sc(), evaluate_var_to_complexity(), expression_and_precondition_to_integer_interval(), expression_less_than_in_context(), find_implicit_equation(), find_pattern(), first_precondition_of_module(), GENERATION(), hyperplane(), integer_expression_and_precondition_to_integer_interval(), integer_value_and_precondition_to_integer_interval(), local_tile_constraints(), loop_bounds_to_tile_bounds(), loop_executed_approximation(), loop_nest_to_tile(), main(), make_bdt_initial(), make_causal_external(), make_causal_internal(), make_load_blocks(), make_movements_loop_body_wp65(), make_rectangular_area(), make_scanning_over_one_tile(), make_scanning_over_tiles(), make_store_blocks(), mapping_on_broadcast(), movement_computation(), new_system_with_only_live_variable(), pa_dup(), pa_intersect_complement(), pa_intersect_system(), pa_path_to_disjunct_ofl_ctrl(), pa_path_to_disjunct_rule4_ofl_ctrl(), pa_path_to_few_disjunct_ofl_ctrl(), pa_supress_same_constraints(), pa_system_difference_ofl_ctrl(), parallel_tiling(), parametric_transformer_empty_p(), partial_eval_reference(), plint(), precondition_minmax_of_value(), predicate_dup(), prepare_reindexing(), processor_loop(), region_range_nul_p(), region_to_minimal_dimensions(), regions_may_convex_hull(), regions_must_convex_hull(), regions_transformer_apply(), sc_cute_convex_hull(), sc_elim_redund_with_first_ofl_ctrl(), sc_enveloppe_chernikova_ofl_ctrl(), sc_faisabilite_optim(), sc_find_equalities(), sc_image_computation(), sc_minmax_of_variables(), sc_projection_concat_proj_on_variables(), sc_resol_smith(), sc_restricted_to_variables_transitive_closure(), sc_supress_parallel_redund_constraints(), sc_supress_same_constraints(), search_scc_bdt(), separate_variables(), separate_variables_2(), set_dimensions_of_local_variable_family(), simplify_minmax_contrainte(), sl_dup(), smith_int(), stmt_bdt_directions(), sys_int_fais(), sys_int_redond(), syst_smith(), systeme_to_loop_nest(), TestDependence(), TestDiCnst(), TestDiVariables(), text_region_no_action(), tiling_transformation(), top_down_abc_dimension(), transform_in_ineq(), transformer_combine(), transformer_convex_hulls(), transformer_general_intersection(), transformer_normalize(), translate_to_module_frame(), true_copy_schedule(), unimodular(), variable_to_dimensions(), xml_Call(), xml_Loop(), xml_Pattern_Paving(), xml_Region_Range(), and xml_tiling().

+ Here is the call graph for this function:

◆ sc_empty()

Psysteme sc_empty ( Pbase  b)

Psysteme sc_empty(Pbase b): build a Psysteme with one unfeasible constraint to define the empty subspace in a space R^n, where n is b's dimension.

b is shared by sc.

The unfeasible constraint is the equations 0 == 1

Definition at line 319 of file sc_alloc.c.

321 {
322  Psysteme sc = SC_UNDEFINED;
326 
327  sc_base(sc) = b;
328  sc_dimension(sc) = base_dimension(b);
329 
330  return sc;
331 }
#define VALUE_ONE
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
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 TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
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 base_dimension, contrainte_make(), CONTRAINTE_UNDEFINED, eq, sc_make(), TCST, VALUE_ONE, and vect_new().

Referenced by algorithm_row_echelon_generic(), algorithm_tiling(), build_sc_nredund_1pass_ofl_ctrl(), dependence_cone_positive(), dj_empty(), elementary_convex_union(), empty_transformer(), get_other_constraints(), main(), pa_empty(), region_sc_projection_along_variables_ofl_ctrl(), region_sc_projection_ofl_along_parameter(), sc_bounded_normalization(), sc_elim_redund_with_first_ofl_ctrl(), sc_enveloppe_chernikova_ofl_ctrl(), sc_find_equalities(), sc_min(), sc_normalize(), sc_projection_concat_proj_on_variables(), sc_projection_optim_along_vecteur_ofl(), sc_restricted_to_variables_transitive_closure(), sc_safe_build_sc_nredund_1pass(), sc_safe_build_sc_nredund_2pass(), sc_safe_elim_db_constraints(), sc_safe_elim_redund(), sc_safe_kill_db_eg(), sc_strong_normalize_and_check_feasibility(), sc_supress_parallel_redund_constraints(), transformer_combine(), transformer_convex_hulls(), transformer_empty(), transformer_list_generic_transitive_closure(), transformer_normalize(), and transformer_projection_with_redundancy_elimination_and_check().

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

◆ sc_empty_p()

bool sc_empty_p ( Psysteme  sc)

bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.

More expensive tests like sc_faisabilite() are necessary to handle the general case.

Definition at line 350 of file sc_alloc.c.

352 {
353  bool empty = false;
354 
355  assert(!SC_UNDEFINED_P(sc));
356  if(sc_nbre_inegalites(sc)==0 && sc_nbre_egalites(sc)==1) {
357  Pvecteur eq = contrainte_vecteur(sc_egalites(sc));
358 
359  empty = vect_size(eq) == 1 && vecteur_var(eq) == TCST;
360  if(empty)
361  assert(vecteur_val(eq)!=0);
362  }
363  return empty;
364 }
@ empty
b1 < bj -> h1/hj = empty
Definition: union-local.h:64
#define vecteur_val(v)
#define vecteur_var(v)

References assert, contrainte_vecteur, empty, eq, TCST, vect_size(), vecteur_val, and vecteur_var.

Referenced by adg_update_dfg(), algorithm_row_echelon_generic(), algorithm_tiling(), build_and_test_dependence_context(), build_integer_sc_nredund(), build_sc_nredund_1pass_ofl_ctrl(), build_sc_nredund_2pass_ofl_ctrl(), build_third_comb(), c_convex_effects_on_actual_parameter_forward_translation(), cell_reference_sc_exact_projection_along_variable(), convex_cells_inclusion_p(), convex_cells_intersection_p(), dependence_cone_positive(), disjunction_to_list_of_regions(), dj_empty_p(), dj_simple_inegs_to_eg(), dj_system_complement(), elementary_convex_union(), expression_less_than_in_context(), generate_io_collect_or_update(), generate_optional_if(), get_other_constraints(), main(), my_system_remove_variables(), pa_empty_p(), pa_path_to_disjunct_ofl_ctrl(), pa_path_to_disjunct_rule4_ofl_ctrl(), pa_reduce_simple_complement(), pa_system_difference_ofl_ctrl(), parametric_transformer_empty_p(), region_exact_projection_along_parameters(), region_exact_projection_along_variable(), region_exact_projection_along_variables(), region_inf_difference(), region_intersection(), region_non_exact_projection_along_parameters(), region_non_exact_projection_along_variables(), region_sup_difference(), regions_may_convex_hull(), regions_must_convex_hull(), regions_transformer_apply(), remove_temporal_variables_from_system(), sc_enveloppe_chernikova_ofl_ctrl(), sc_faisabilite_optim(), sc_feasibility_ofl_ctrl(), sc_fm_project_variables(), sc_fourier_motzkin_feasibility_ofl_ctrl(), sc_lexicographic_sort(), sc_min(), sc_minmax_of_variable_optim(), sc_normalize(), sc_proj_optim_on_di_ofl(), sc_projection_optim_along_vecteur_ofl(), sc_remove_large_coef(), sc_restricted_to_variables_transitive_closure(), sc_reversal(), sc_safe_append(), sc_safe_build_sc_nredund_1pass(), sc_safe_build_sc_nredund_2pass(), sc_supress_parallel_redund_constraints(), sc_vect_sort(), sl_fprint_tab(), sl_max_constraints_nb(), statement_weakly_feasible_p(), system_sorted_text_format(), TestDependence(), top_down_abc_dimension(), transformer_argument_general_consistency_p(), transformer_combine(), transformer_convex_hulls(), transformer_filter(), transformer_is_empty_p(), transformer_normalize(), and transformer_projection_with_redundancy_elimination_and_check().

+ Here is the call graph for this function:

◆ sc_fix()

void sc_fix ( Psysteme  s)

fix system s for coherency of the base and number of things.

Definition at line 141 of file sc_alloc.c.

142 {
143  if (s) {
144  s->nb_eq = nb_elems_list(s->egalites);
146  if (s->base) base_rm(s->base), s->base = NULL;
147  sc_creer_base(s);
148  }
149 }
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
#define base_rm(b)

References Ssysteme::base, base_rm, Ssysteme::egalites, Ssysteme::inegalites, nb_elems_list(), Ssysteme::nb_eq, Ssysteme::nb_ineq, and sc_creer_base().

Referenced by extract_common_syst(), sc_cute_convex_hull(), sc_feasibility_ofl_ctrl(), sc_janus_feasibility_ofl_ctrl_timeout_ctrl(), and transitive_closure_system().

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

◆ sc_init_with_sc()

Psysteme sc_init_with_sc ( Psysteme  sc)

This function returns a new empty system which has been initialized with the same dimension and base than sc.

Definition at line 303 of file sc_alloc.c.

305 {
306 
307  Psysteme sc1= sc_new();
308  sc1->dimension = sc->dimension;
309  sc1->base = base_copy(sc->base);
310  return(sc1);
311 }

References Ssysteme::base, base_copy(), Ssysteme::dimension, and sc_new().

Referenced by bound_distribution(), bound_generation(), build_sc_machine(), build_sc_nredund_1pass_ofl_ctrl(), constraint_distribution(), elim_redund_sc_with_sc(), movement_computation(), parallel_tiling(), and sc_projection_concat_proj_on_variables().

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

◆ sc_new()

Psysteme sc_new ( void  )

Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles, puis retourne ce systeme en resultat.

Attention, sc_new ne fabrique pas un systeme coherent comportant une base. Un tel systeme s'obtient par appel a la fonction sc_creer_base, apres avoir ajoute des equations et des inequations au systeme. La base n'est pas entretenue lorsque le systeme est modifie.

Ancien nom: init_systeme()

Definition at line 55 of file sc_alloc.c.

56 {
57  Psysteme p = (Psysteme) malloc(sizeof(Ssysteme));
58 
59  assert(p);
60 
61  p->nb_eq = 0;
62  p->nb_ineq = 0;
63  p->dimension = 0;
64 
65  p->egalites = (Pcontrainte) NULL;
66  p->inegalites = (Pcontrainte) NULL;
67  p->base = BASE_NULLE;
68 
69  return p;
70 }
struct Scontrainte * Pcontrainte
void * malloc(YYSIZE_T)
struct Ssysteme * Psysteme
#define BASE_NULLE
MACROS SUR LES BASES.

References assert, Ssysteme::base, BASE_NULLE, Ssysteme::dimension, Ssysteme::egalites, Ssysteme::inegalites, malloc(), Ssysteme::nb_eq, and Ssysteme::nb_ineq.

Referenced by adg_get_conjonctions(), adg_get_predicate_of_loops(), adg_sc_dup(), args_to_transformer(), base_complete(), better_elim_var_with_eg(), broadcast_dimensions(), broadcast_of_dataflow(), build_and_test_dependence_context(), build_contraction_matrices(), build_integer_sc_nredund(), build_sc_with_several_uniform_ref(), c_convex_effects_on_actual_parameter_forward_translation(), comp_exec_domain(), completer_base(), completer_n_base(), compose_vvs(), compute_entity_to_declaration_constraints(), creer_Psysteme(), cutting_conditions(), do_isolate_statement_preconditions_satisified_p(), effects_to_dma(), elim_var_with_eg(), entity_assumed_declaration_sc(), expressions_to_predicate(), find_implicit_equation(), generate_work_sharing_system(), get_bounds_expression(), get_unsatisfied_system(), hpfc_compute_align_constraints(), hpfc_compute_distribute_constraints(), hpfc_compute_unicity_constraints(), include_parameters_in_sc(), loop_basic_workchunk_to_workchunk(), loop_iteration_domaine_to_sc(), loop_nest_to_wp65_code(), loop_regions_normalize(), main(), make_bounds(), make_causal_external(), make_causal_internal(), make_context_of_loop(), make_dual(), make_expression_equalities(), make_reindex(), make_tile_constraints(), mapping_on_broadcast(), matrix_to_system(), my_adg_expressions_to_predicate(), new_elim_var_with_eg(), nullify_factors(), old_polynome_to_sc(), partial_broadcast_coefficients(), plc_elim_var_with_eg(), plc_make_distance(), polynome_to_sc(), prepare_reindexing(), prettyprint_dependence_graph(), prettyprint_dependence_graph_view(), prototype_dimension(), re_do_it(), read_syst_from_file(), sc_copy(), sc_dup1(), sc_full(), sc_gen_read(), sc_image_computation(), sc_init_with_sc(), sc_of_constrs(), sc_restricted_to_variables_transitive_closure(), sc_rn(), search_scc_bdt(), separate_variables(), separate_variables_2(), simple_reference_to_convex_reference_conversion(), stmt_bdt_directions(), test_file(), tile_hyperplane_constraints(), tile_membership(), tile_membership_constraints(), transformer_equality_fix_point(), valuer(), vvs_on_vvs(), and vvs_to_sc().

+ Here is the call graph for this function:

◆ sc_rm()

void sc_rm ( Psysteme  ps)

void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;

utilisation standard: sc_rm(s); s = 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

Definition at line 277 of file sc_alloc.c.

279 {
280  if (ps != NULL) {
281  if (ps->inegalites != NULL) {
283  ps->inegalites = NULL;
284  }
285 
286  if (ps->egalites != NULL) {
288  ps->egalites = NULL;
289  }
290 
291  if (!VECTEUR_NUL_P(ps->base)) {
292  vect_rm(ps->base);
293  ps->base = VECTEUR_UNDEFINED;
294  }
295 
296  free((char *) ps);
297  }
298 }
Pcontrainte contraintes_free(Pcontrainte pc)
Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc.
Definition: alloc.c:226
void free(void *)
#define VECTEUR_NUL_P(v)
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References contraintes_free(), free(), vect_rm(), VECTEUR_NUL_P, and VECTEUR_UNDEFINED.

Referenced by __attribute__(), add_var_sup(), algorithm_row_echelon_generic(), algorithm_tiling(), analyze_quast(), base_complete(), broadcast_of_dataflow(), build_sc_nredund_1pass_ofl_ctrl(), cell_reference_sc_exact_projection_along_variable(), cell_reference_system_remove_psi_variables(), cell_reference_system_remove_rho_variables(), check_range_wrt_precondition(), combiner_ofl_with_test(), completer_base(), completer_n_base(), constraints_to_loop_bound(), convex_cells_intersection_p(), dependence_cone_positive(), disjunction_to_list_of_regions(), do_array_expansion(), do_check_isolate_statement_preconditions_on_call(), dual_positive(), efficient_sc_check_inequality_feasibility(), eq_in_ineq(), find_eg(), find_pattern(), generate_remapping_code(), generate_remapping_system(), GENERATION(), get_other_constraints(), hpf_remapping(), hpfc_simplify_condition(), ineq_redund_with_sc_p(), interlaced_basic_workchunk_regions_p(), loop_executed_approximation(), loop_regions_normalize(), main(), make_causal_external(), make_causal_internal(), make_rectangular_area(), make_reindex(), mapping_on_broadcast(), move_transformer(), new_loop_bound(), old_transformer_free(), parallel_tiling(), parametric_transformer_empty_p(), plint(), primal_positive(), processor_loop(), region_exact_projection_along_parameters(), region_exact_projection_along_variable(), region_exact_projection_along_variables(), region_non_exact_projection_along_parameters(), region_non_exact_projection_along_variables(), region_sc_projection_ofl_along_parameter(), regions_may_convex_hull(), regions_must_convex_hull(), regions_transformer_apply(), sc_add_normalize_eq(), sc_add_normalize_ineq(), sc_append(), sc_bounded_normalization(), sc_cute_convex_hull(), sc_elim_db_constraints(), sc_elim_double_constraints(), sc_elim_redund(), sc_faisabilite_optim(), sc_find_equalities(), sc_fourier_motzkin_feasibility_ofl_ctrl(), sc_fourier_motzkin_feasibility_ofl_ctrl_timeout_ctrl(), sc_free(), sc_fusion(), sc_gen_free(), sc_intersection(), sc_intersection_empty_p_ofl(), sc_janus_feasibility_ofl_ctrl_timeout_ctrl(), sc_kill_db_eg(), sc_minmax_of_variable2(), sc_minmax_of_variable_optim(), sc_normalize(), sc_normalize2(), sc_of_sg(), sc_projection_optim_along_vecteur_ofl(), sc_rational_feasibility(), sc_resol_smith(), sc_restricted_to_variables_transitive_closure(), sc_safe_append(), sc_safe_elim_db_constraints(), sc_safe_intersection(), sc_safe_kill_db_eg(), sc_simplexe_feasibility_ofl_ctrl_timeout_ctrl(), sc_strong_normalize2(), sc_strong_normalize_and_check_feasibility(), sc_strong_normalize_and_check_feasibility2(), sc_triang_elim_redund(), sc_union(), search_scc_bdt(), set_dimensions_of_local_variables(), smith_int(), statement_insertion_fix_access(), sys_int_fais(), syst_smith(), systeme_to_loop_nest(), TestDependence(), TestDiCnst(), text_pointer_value(), text_points_to_relation(), text_region_no_action(), text_transformer(), top_down_abc_dimension(), transform_in_ineq(), transformer_combine(), transformer_convex_hulls(), transformer_normalize(), translate_to_module_frame(), var_ecart_sup(), xml_Region_Range(), and xml_Task().

+ Here is the call graph for this function:

◆ sc_rn()

Psysteme sc_rn ( Pbase  b)

Psysteme sc_rn(Pbase b): build a Psysteme without constraints to define R^n, where n is b's dimension.

b is shared by sc.

Definition at line 336 of file sc_alloc.c.

338 {
339  Psysteme sc = sc_new();
340 
341  sc_base(sc) = b;
342  sc_dimension(sc) = base_dimension(b);
343 
344  return sc;
345 }

References base_dimension, and sc_new().

Referenced by algorithm_row_echelon_generic(), algorithm_tiling(), build_third_comb(), elementary_convex_union(), generate_distributed_io_system(), generate_shared_io_system(), generate_system_for_distributed_variable(), generate_system_for_equal_variables(), hpfc_compute_entity_to_new_declaration(), loop_basic_workchunk_to_workchunk(), prepare_reindexing(), regions_must_convex_hull(), sc_cute_convex_hull(), sc_enveloppe_chernikova_ofl_ctrl(), sc_restricted_to_variables_transitive_closure(), and TestDependence().

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

◆ sc_rn_p()

bool sc_rn_p ( Psysteme  sc)

bool sc_rn_p(Psysteme sc): check if the set associated to sc is the whole space, rn

Definition at line 369 of file sc_alloc.c.

371 {
372  assert(!SC_UNDEFINED_P(sc));
373  return sc_nbre_inegalites(sc)==0 && sc_nbre_egalites(sc)==0;
374 }

References assert.

Referenced by build_sc_nredund_1pass_ofl_ctrl(), build_sc_nredund_2pass_ofl_ctrl(), build_third_comb(), cell_reference_sc_exact_projection_along_variable(), convex_cells_inclusion_p(), convex_cells_intersection_p(), dependence_cone_positive(), elementary_convex_union(), expression_less_than_in_context(), generate_optional_if(), main(), my_system_remove_variables(), region_exact_projection_along_parameters(), region_exact_projection_along_variable(), region_exact_projection_along_variables(), region_inf_difference(), region_non_exact_projection_along_parameters(), region_non_exact_projection_along_variables(), region_sup_difference(), regions_may_convex_hull(), regions_must_convex_hull(), regions_transformer_apply(), remove_temporal_variables_from_system(), sc_elim_simple_redund_with_eq(), sc_elim_simple_redund_with_ineq(), sc_enveloppe_chernikova_ofl_ctrl(), sc_feasibility_ofl_ctrl(), sc_fusion(), sc_lexicographic_sort(), sc_minmax_of_variable(), sc_normalize(), sc_remove_large_coef(), sc_restricted_to_variables_transitive_closure(), sc_reversal(), sc_safe_append(), sc_safe_build_sc_nredund_1pass(), sc_safe_build_sc_nredund_2pass(), sc_vect_sort(), and top_down_abc_dimension().

+ Here is the caller graph for this function:

◆ sc_to_minimal_basis()

Pbase sc_to_minimal_basis ( Psysteme  ps)

creation d'une base contenant toutes les variables apparaissant avec des coefficients non-nuls dans les egalites ou les inegalites de ps

great optimization

Definition at line 76 of file sc_alloc.c.

77 {
79  Pbase b = BASE_NULLE;
80  Pcontrainte c;
81  Pvecteur v;
82 
83  /* great optimization */
84  if (!ps->egalites && !ps->inegalites)
85  return BASE_NULLE;
86 
88 
89  for (c = ps->egalites; c!=NULL; c=c->succ) {
90  for (v = c->vecteur; v!=VECTEUR_NUL; v=v->succ) {
91  Variable var = var_of(v);
92  if (var!=TCST && !linear_hashtable_isin(seen, var)) {
94  b = vect_chain(b, var, VALUE_ONE);
95  }
96  }
97  }
98 
99  for (c = ps->inegalites; c!=NULL; c=c->succ) {
100  for (v = c->vecteur; v!=VECTEUR_NUL; v=v->succ) {
101  Variable var = var_of(v);
102  if (var!=TCST && !linear_hashtable_isin(seen, var)) {
103  linear_hashtable_put_once(seen, var, var);
104  b = vect_chain(b, var, VALUE_ONE);
105  }
106  }
107  }
108 
110 
111  return b;
112 }
static hash_table seen
static function to store whether a module has been seen during the recursive generation of the daVinc...
Definition: graph.c:85
bool linear_hashtable_isin(linear_hashtable_pt h, void *k)
Definition: hashpointer.c:273
void linear_hashtable_put_once(linear_hashtable_pt h, void *k, void *v)
Definition: hashpointer.c:268
linear_hashtable_pt linear_hashtable_make(void)
constructor.
Definition: hashpointer.c:165
void linear_hashtable_free(linear_hashtable_pt h)
destructor
Definition: hashpointer.c:189
Pvecteur vect_chain(Pvecteur v_in, Variable var, Value coeff)
package vecteur routines internes au package
Definition: private.c:69
Pvecteur vecteur
struct Svecteur * succ
Definition: vecteur-local.h:92
hidden structure to store the hashtable.
Definition: hashpointer.c:66
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
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
#define var_of(varval)

References BASE_NULLE, Ssysteme::egalites, Ssysteme::inegalites, linear_hashtable_free(), linear_hashtable_isin(), linear_hashtable_make(), linear_hashtable_put_once(), seen, Scontrainte::succ, Svecteur::succ, TCST, VALUE_ONE, var_of, vect_chain(), Scontrainte::vecteur, and VECTEUR_NUL.

Referenced by gcd_and_constant_dependence_test(), parametric_transformer_empty_p(), partial_eval_reference(), sc_creer_base(), sc_projection_optim_along_vecteur_ofl(), simplify_float_constraint_system(), transformer_convex_hulls(), transformer_derivative_constraints(), transformer_derivative_fix_point(), transformer_list_generic_transitive_closure(), and transformer_projection_with_redundancy_elimination_and_check().

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