コード例 #1
0
ファイル: relation.c プロジェクト: periscop/clay
int clay_relation_nb_explicit_dim(osl_relation_p relation) {
  int result;
  osl_relation_p copy = osl_relation_clone(relation);
  result = clay_relation_nb_explicit_dim_intrusive(copy);
  osl_relation_free(copy);
  return result;
}
コード例 #2
0
ファイル: dependence.c プロジェクト: ArtemL/GCC
/**
 * osl_dependence_free function:
 * This function frees the allocated memory for a osl_dependence_p structure.
 * - 18/09/2003: first version.
 */
void osl_dependence_free(osl_dependence_p dependence) {
  osl_dependence_p next;
  while (dependence != NULL) {
    next = dependence->next;
    osl_relation_free(dependence->domain);
    free(dependence);
    dependence = next;
  }
}
コード例 #3
0
ファイル: scop.c プロジェクト: MaddTheSane/haiku-buildtools
/**
 * osl_scop_free function:
 * This function frees the allocated memory for a osl_scop_t structure.
 * \param scop The pointer to the scop we want to free.
 */
void osl_scop_free(osl_scop_p scop) {
  osl_scop_p tmp;
  
  while (scop != NULL) {
    if (scop->language != NULL)
      free(scop->language);
    osl_generic_free(scop->parameters);
    osl_relation_free(scop->context);
    osl_statement_free(scop->statement);
    osl_interface_free(scop->registry);
    osl_generic_free(scop->extension);

    tmp = scop->next;
    free(scop);
    scop = tmp;
  }
}
コード例 #4
0
ファイル: relation.c プロジェクト: periscop/clay
// Do a copy of relation before intrusive rank computation.
int clay_relation_rank(osl_relation_p relation) {
  osl_relation_p copy = osl_relation_clone(relation);
  int rank = clay_relation_rank_intrusive(copy);
  osl_relation_free(copy);
  return rank;
}
コード例 #5
0
ファイル: ddv.c プロジェクト: Ced/candl
/**
 * candl_ddv_constant_val: returns true iff all possible values of the
 * minimization of the first variable of the system is a scalar constant
 * (not parametric), and has the same value for all conditions of the QUAST.
 * The scalar constant is put in the 'val' argument.
 *
 */
static
int
candl_ddv_constant_val(osl_relation_p system, int* val, int nb_par) {
  PipOptions * options;
  PipQuast * solution;
  osl_relation_p context;
  int is_constant_val = 1;
  int cst;
  int cst_base = 42;
  int first = 1;
  int i, j;
  int precision = system->precision;

  // 1- Comute the lexmin of the system, to get a QUAST.
  options = pip_options_init();
  options->Simplify = 1;
  options->Urs_parms = -1;
  options->Urs_unknowns = -1;
  options->Nq = 0;
  
  context = osl_relation_pmalloc(precision, 0, nb_par + 2);
  solution = pip_solve_osl(system, context, -1, options);

  if ((solution != NULL) &&
      ((solution->list != NULL) || (solution->condition != NULL))) {
    // 2- Traverse all leaves, ensure they have the same value.
    int nb_leaves = count_quast_leaves(solution);
    PipList* leaveslist[nb_leaves + 1];
    for (i = 0; i < nb_leaves + 1; ++i)
      leaveslist[i] = NULL;
    get_quast_leaves(solution, leaveslist);

    for (i = 0; i < nb_leaves; ++i) {
      PipList* list = leaveslist[i];
      if (list && list->vector) {
        PipVector* vect = list->vector;
        
        // FIXME : check if precision is correct to use piplib
        
        for (j = 0; j < nb_par; ++j)
          if (!CANDL_zero_p(vect->the_vector[j])) {
            is_constant_val = 0;
            break;
          }
        if (is_constant_val) {
          cst = CANDL_get_si(vect->the_vector[vect->nb_elements-1]);
          if (first) {
            first = 0;
            cst_base = cst;
          }
          else if (! first && cst != cst_base) {
            is_constant_val = 0;
            break;
          }
        }
        else
          break;
      }
    }
  }

  pip_quast_free(solution);
  pip_options_free(options);
  osl_relation_free(context);

  if (is_constant_val)
    *val = cst_base;

  return is_constant_val;
}