Ejemplo n.º 1
0
static bool
graphite_legal_transform_dr (poly_bb_p pbb1, poly_bb_p pbb2,
			     poly_dr_p pdr1, poly_dr_p pdr2)
{
  ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1);
  ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2);
  ppl_Polyhedron_t so1 = PBB_ORIGINAL_SCATTERING (pbb1);
  ppl_Polyhedron_t so2 = PBB_ORIGINAL_SCATTERING (pbb2);
  ppl_Pointset_Powerset_C_Polyhedron_t po;

  graphite_dim_t sdim1 = pdr_nb_subscripts (pdr1) + 1;
  graphite_dim_t sdim2 = pdr_nb_subscripts (pdr2) + 1;

  if (sdim1 != sdim2)
    return true;

  po = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, so1, so2,
			      true, true);

  if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (po))
    return true;
  else
    {
      ppl_Polyhedron_t st1 = PBB_TRANSFORMED_SCATTERING (pbb1);
      ppl_Polyhedron_t st2 = PBB_TRANSFORMED_SCATTERING (pbb2);
      ppl_Pointset_Powerset_C_Polyhedron_t pt;
      graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb1);
      graphite_dim_t otdim1 = pbb_nb_scattering_orig (pbb1);
      graphite_dim_t otdim2 = pbb_nb_scattering_orig (pbb2);
      graphite_dim_t ttdim1 = pbb_nb_scattering_transform (pbb1);
      graphite_dim_t ttdim2 = pbb_nb_scattering_transform (pbb2);

      if (dump_file && (dump_flags & TDF_DETAILS))
	fprintf (dump_file, "\nloop carries dependency.\n");
      pt = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, st1, st2,
				  false, false);

      /* Extend PO and PT to have the same dimensions.  */
      ppl_insert_dimensions_pointset (po, otdim1, ttdim1);
      ppl_insert_dimensions_pointset (po, otdim1 + ttdim1 + ddim1 + otdim2,
				      ttdim2);
      ppl_insert_dimensions_pointset (pt, 0, otdim1);
      ppl_insert_dimensions_pointset (pt, otdim1 + ttdim1 + ddim1, otdim2);

      ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (po, pt);
      return ppl_Pointset_Powerset_C_Polyhedron_is_empty (po);
    }
}
void
print_scattering_function (FILE *file, poly_bb_p pbb, int verbosity)
{
  if (!PBB_TRANSFORMED (pbb))
    return;

  if (PBB_TRANSFORMED_SCATTERING (pbb)
      || PBB_ORIGINAL_SCATTERING (pbb))
    {
      if (verbosity > 0)
	fprintf (file, "# Scattering function is provided\n");

      fprintf (file, "1\n");
    }
  else
    {
      if (verbosity > 0)
	fprintf (file, "# Scattering function is not provided\n");

      fprintf (file, "0\n");
      return;
    }

  print_scattering_function_1 (file, pbb, verbosity);
}
static void
print_scattering_function_1 (FILE *file, poly_bb_p pbb, int verbosity)
{
  graphite_dim_t i;

  if (verbosity > 0)
    {
      fprintf (file, "# scattering bb_%d (\n", pbb_index (pbb));
      fprintf (file, "#  eq");

      for (i = 0; i < pbb_nb_scattering_transform (pbb); i++)
	fprintf (file, "     s%d", (int) i);

      for (i = 0; i < pbb_nb_local_vars (pbb); i++)
	fprintf (file, "    lv%d", (int) i);

      for (i = 0; i < pbb_dim_iter_domain (pbb); i++)
	fprintf (file, "     i%d", (int) i);

      for (i = 0; i < pbb_nb_params (pbb); i++)
	fprintf (file, "     p%d", (int) i);

      fprintf (file, "    cst\n");
    }

  /* Number of disjunct components.  Remove this when
     PBB_TRANSFORMED_SCATTERING will be a pointset_powerset.  */
  fprintf (file, "1\n");
  ppl_print_polyhedron_matrix (file, PBB_TRANSFORMED_SCATTERING (pbb)
			       ? PBB_TRANSFORMED_SCATTERING (pbb)
			       : PBB_ORIGINAL_SCATTERING (pbb));

  if (verbosity > 0)
    fprintf (file, "#)\n");
}