Exemplo n.º 1
0
void ClintStmtOccurrence::resetOccurrence(osl_statement_p stmt, const std::vector<int> &betaVector) {
  bool differentBeta = (m_betaVector == betaVector);
  bool differentPoints = false;
  m_betaVector = betaVector;
  m_oslStatement = stmt;

  if (stmt == nullptr) {
    if (m_oslScattering != nullptr)
      emit pointsChanged();
    if (differentBeta)
      emit betaChanged();
    return;
  }

  osl_relation_p oslScattering = nullptr;
  oslListForeach(stmt->scattering, [&oslScattering,&betaVector](osl_relation_p scattering) {
    if (betaExtract(scattering) == betaVector) {
      CLINT_ASSERT(oslScattering == nullptr,
                   "Duplicate beta-vector found");
      oslScattering = scattering;
    }
  });
  CLINT_ASSERT(oslScattering != nullptr,
               "Trying to create an occurrence for the inexistent beta-vector");

  differentPoints = !osl_relation_equal(oslScattering, m_oslScattering);
  m_oslScattering = oslScattering;

  if (differentPoints) {
    emit pointsChanged();
  }
  if (differentBeta) {
    emit betaChanged();
  }
}
Exemplo n.º 2
0
/**
 * osl_scop_equal function:
 * this function returns true if the two scops are the same, false
 * otherwise (the usr field is not tested).
 * \param s1 The first scop.
 * \param s2 The second scop.
 * \return 1 if s1 and s2 are the same (content-wise), 0 otherwise.
 */
int osl_scop_equal(osl_scop_p s1, osl_scop_p s2) {

  while ((s1 != NULL) && (s2 != NULL)) {
    if (s1 == s2)
      return 1;

    if (s1->version != s2->version) {
      OSL_info("versions are not the same"); 
      return 0;
    }

    if (strcmp(s1->language, s2->language) != 0) {
      OSL_info("languages are not the same"); 
      return 0;
    }

    if (!osl_relation_equal(s1->context, s2->context)) {
      OSL_info("contexts are not the same"); 
      return 0;
    }

    if (!osl_generic_equal(s1->parameters, s2->parameters)) {
      OSL_info("parameters are not the same"); 
      return 0;
    }

    if (!osl_statement_equal(s1->statement, s2->statement)) {
      OSL_info("statements are not the same"); 
      return 0;
    }

    if (!osl_interface_equal(s1->registry, s2->registry)) {
      OSL_info("registries are not the same"); 
      return 0;
    }

    if (!osl_generic_equal(s1->extension, s2->extension)) {
      OSL_info("extensions are not the same"); 
      return 0;
    }

    s1 = s1->next;
    s2 = s2->next;
  }
  
  if (((s1 == NULL) && (s2 != NULL)) || ((s1 != NULL) && (s2 == NULL)))
    return 0;

  return 1;
}
Exemplo n.º 3
0
/**
 * osl_dependence_equal function:
 * this function returns true if the two dependences provided as parameters
 * are the same, false otherwise (the usr field is not tested).
 * NOTE: the different pointer to statements or relations are nto compared
 * \param[in] d1 The first dependence.
 * \param[in] d2 The second dependence.
 * \return 1 if d1 and d2 are the same (content-wise), 0 otherwise.
 */
int osl_dependence_equal(osl_dependence_p d1, osl_dependence_p d2) {

  if (d1 == d2)
    return 1;
  
  if ((d1->next != NULL && d2->next == NULL) ||
      (d1->next == NULL && d2->next != NULL))
    return 0;

  if (d1->next != NULL && d2->next != NULL)
    if (!osl_dependence_equal(d1->next, d2->next))
      return 0;
    
  if (!osl_relation_equal(d1->domain, d2->domain))
    return 0;

  if (d1->label_source != d2->label_source ||
      d1->label_target != d2->label_target ||
      d1->ref_source   != d2->ref_source   ||
      d1->ref_target   != d2->ref_target   ||
      d1->depth        != d2->depth        ||
      d1->type         != d2->type         ||
      
      d1->source_nb_output_dims_domain != 
      d2->source_nb_output_dims_domain     ||
      
      d1->source_nb_output_dims_access != 
      d2->source_nb_output_dims_access     ||
      
      d1->target_nb_output_dims_domain != 
      d2->target_nb_output_dims_domain     || 
      
      d1->target_nb_output_dims_access !=
      d2->target_nb_output_dims_access     ||
      
      d1->source_nb_local_dims_domain !=
      d2->source_nb_local_dims_domain      ||
      
      d1->source_nb_local_dims_access !=
      d2->source_nb_local_dims_access      ||
      
      d1->target_nb_local_dims_domain !=
      d2->target_nb_local_dims_domain      ||
  
      d1->target_nb_local_dims_access != 
      d2->target_nb_local_dims_access)
    return 0;

  return 1;
}
Exemplo n.º 4
0
/* Check if two scop can be compared (same number of statements and
 * same access array/domain in the same order)
 *
 * \param[in] s1  first scop to compare
 * \param[in] s2  second scop to compare
 * \return        1 if two scops equal, 0 otherwise
 */
int candl_util_check_scop(osl_scop_p s1, osl_scop_p s2) {
  
  osl_statement_p it1 = s1->statement, it2 = s2->statement;
  for (; it1 != NULL && it2 != NULL ; it1 = it1->next, it2 = it2->next) {
    if (!osl_relation_list_equal(it1->access, it2->access))
      return 0;
    if (!osl_relation_equal(it1->domain, it2->domain))
      return 0;
  }
  
  /* Different number of statements */
  if ((it1 == NULL || it2 == NULL) && it1 != it2)
    return 0;
  
  return 1;
}
Exemplo n.º 5
0
/**
 * @brief Fusion 2 osl_relation_list : if some osl_relation of the list
 * are found in rl2 and rl1, only one is added to the result list.
 *
 * @param[in] rl1 The first osl_relation_list.
 * @param[in] rl2 The second osl_relation_list.
 *
 * @return An osl_relation_list, fusion of rl1 and rl2, without any
 * osl_relation duplicate.
 */
struct osl_relation_list * substrate_osl_relation_list_fusion(
        struct osl_relation_list * rl1,
        struct osl_relation_list * rl2)
{
    struct osl_relation_list *res = NULL, *cursor = NULL, *last_rel = NULL;

    if(rl1 == NULL)
    {
        res = osl_relation_list_clone(rl2);
    }
    else
    {
        res = osl_relation_list_clone(rl1);

        //find the last elt of the list
        last_rel=res;
        while(last_rel->next != NULL) last_rel = last_rel->next;

        while(rl2 != NULL)
        {
            cursor=res;
            while( (cursor != NULL) && !osl_relation_equal(rl2->elt, cursor->elt) )
            {
                cursor = cursor->next;
            }
            //If cursor is NULL, no relation in "res" was found equal, so we add it
            //to the end of "res".
            if(cursor == NULL)
            {
                last_rel->next=osl_relation_list_node(rl2->elt);
                last_rel = last_rel->next;
            }

            rl2=rl2->next;
        }
    }

    return res;
}