OSDN Git Service

Make print_scop output the scoplib format.
[pf3gnuchains/gcc-fork.git] / gcc / graphite-poly.c
index f9b93e4..e8ab321 100644 (file)
@@ -145,7 +145,16 @@ print_scattering_function (FILE *file, poly_bb_p pbb)
   if (!PBB_TRANSFORMED (pbb))
     return;
 
-  fprintf (file, "scattering bb_%d (\n", GBB_BB (PBB_BLACK_BOX (pbb))->index);
+  if (PBB_TRANSFORMED_SCATTERING (pbb)
+      || PBB_ORIGINAL_SCATTERING (pbb))
+    fprintf (file, "# Scattering function is provided\n1\n");
+  else
+    {
+      fprintf (file, "# Scattering function is not provided\n0\n");
+      return;
+    }
+
+  fprintf (file, "# scattering bb_%d (\n", pbb_index (pbb));
   fprintf (file, "#  eq");
 
   for (i = 0; i < pbb_nb_scattering_transform (pbb); i++)
@@ -162,9 +171,14 @@ print_scattering_function (FILE *file, poly_bb_p pbb)
 
   fprintf (file, "    cst\n");
 
-  ppl_print_polyhedron_matrix (file, PBB_TRANSFORMED_SCATTERING (pbb));
+  /* 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));
 
-  fprintf (file, ")\n");
+  fprintf (file, "#)\n");
 }
 
 /* Prints to FILE the iteration domain of PBB.  */
@@ -238,8 +252,6 @@ apply_poly_transforms (scop_p scop)
 {
   bool transform_done = false;
 
-  gcc_assert (graphite_legal_transform (scop));
-
   /* Generate code even if we did not apply any real transformation.
      This also allows to check the performance for the identity
      transformation: GIMPLE -> GRAPHITE -> GIMPLE
@@ -252,28 +264,78 @@ apply_poly_transforms (scop_p scop)
     transform_done = true;
 
   if (flag_loop_block)
-    gcc_unreachable (); /* Not yet supported.  */
-
-  if (flag_loop_strip_mine)
-    transform_done |= scop_do_strip_mine (scop);
+    transform_done |= scop_do_block (scop);
+  else
+    {
+      if (flag_loop_strip_mine)
+       transform_done |= scop_do_strip_mine (scop);
 
-  if (flag_loop_interchange)
-    transform_done |= scop_do_interchange (scop);
+      if (flag_loop_interchange)
+       transform_done |= scop_do_interchange (scop);
+    }
 
   return transform_done;
 }
 
+/* Returns true when it PDR1 is a duplicate of PDR2: same PBB, and
+   their ACCESSES, TYPE, and NB_SUBSCRIPTS are the same.  */
+
+static inline bool
+can_collapse_pdrs (poly_dr_p pdr1, poly_dr_p pdr2)
+{
+  bool res;
+  ppl_Pointset_Powerset_C_Polyhedron_t af1, af2, diff;
+
+  if (PDR_PBB (pdr1) != PDR_PBB (pdr2)
+      || PDR_NB_SUBSCRIPTS (pdr1) != PDR_NB_SUBSCRIPTS (pdr2)
+      || PDR_TYPE (pdr1) != PDR_TYPE (pdr2))
+    return false;
+
+  af1 = PDR_ACCESSES (pdr1);
+  af2 = PDR_ACCESSES (pdr2);
+  ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+    (&diff, af1);
+  ppl_Pointset_Powerset_C_Polyhedron_difference_assign (diff, af2);
+
+  res = ppl_Pointset_Powerset_C_Polyhedron_is_empty (diff);
+  ppl_delete_Pointset_Powerset_C_Polyhedron (diff);
+  return res;
+}
+
+/* Removes duplicated data references in PBB.  */
+
+void
+pbb_remove_duplicate_pdrs (poly_bb_p pbb)
+{
+  int i, j;
+  poly_dr_p pdr1, pdr2;
+  unsigned n = VEC_length (poly_dr_p, PBB_DRS (pbb));
+  VEC (poly_dr_p, heap) *collapsed = VEC_alloc (poly_dr_p, heap, n);
+
+  for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr1); i++)
+    for (j = 0; VEC_iterate (poly_dr_p, collapsed, j, pdr2); j++)
+      if (!can_collapse_pdrs (pdr1, pdr2))
+       VEC_quick_push (poly_dr_p, collapsed, pdr1);
+
+  VEC_free (poly_dr_p, heap, collapsed);
+  PBB_PDR_DUPLICATES_REMOVED (pbb) = true;
+}
+
 /* Create a new polyhedral data reference and add it to PBB.  It is
    defined by its ACCESSES, its TYPE, and the number of subscripts
    NB_SUBSCRIPTS.  */
 
 void
-new_poly_dr (poly_bb_p pbb,
+new_poly_dr (poly_bb_p pbb, int dr_base_object_set,
             ppl_Pointset_Powerset_C_Polyhedron_t accesses,
-            enum POLY_DR_TYPE type, void *cdr, int nb_subscripts)
+            enum poly_dr_type type, void *cdr, graphite_dim_t nb_subscripts)
 {
+  static int id = 0;
   poly_dr_p pdr = XNEW (struct poly_dr);
 
+  PDR_ID (pdr) = id++;
+  PDR_BASE_OBJECT_SET (pdr) = dr_base_object_set;
+  PDR_NB_REFS (pdr) = 1;
   PDR_PBB (pdr) = pbb;
   PDR_ACCESSES (pdr) = accesses;
   PDR_TYPE (pdr) = type;
@@ -294,7 +356,7 @@ free_poly_dr (poly_dr_p pdr)
 /* Create a new polyhedral black box.  */
 
 void
-new_poly_bb (scop_p scop, void *black_box)
+new_poly_bb (scop_p scop, void *black_box, bool reduction)
 {
   poly_bb_p pbb = XNEW (struct poly_bb);
 
@@ -305,6 +367,8 @@ new_poly_bb (scop_p scop, void *black_box)
   PBB_SAVED (pbb) = NULL;
   PBB_ORIGINAL (pbb) = NULL;
   PBB_DRS (pbb) = VEC_alloc (poly_dr_p, heap, 3);
+  PBB_IS_REDUCTION (pbb) = reduction;
+  PBB_PDR_DUPLICATES_REMOVED (pbb) = false;
   VEC_safe_push (poly_bb_p, heap, SCOP_BBS (scop), pbb);
 }
 
@@ -361,7 +425,7 @@ print_pdr_access_layout (FILE *file, poly_dr_p pdr)
 void
 print_pdr (FILE *file, poly_dr_p pdr)
 {
-  fprintf (file, "pdr (");
+  fprintf (file, "# pdr_%d (", PDR_ID (pdr));
 
   switch (PDR_TYPE (pdr))
     {
@@ -383,12 +447,12 @@ print_pdr (FILE *file, poly_dr_p pdr)
 
   dump_data_reference (file, (data_reference_p) PDR_CDR (pdr));
 
-  fprintf (file, "data accesses (\n");
+  fprintf (file, "data accesses (\n");
   print_pdr_access_layout (file, pdr);
   ppl_print_powerset_matrix (file, PDR_ACCESSES (pdr));
-  fprintf (file, ")\n");
+  fprintf (file, "#)\n");
 
-  fprintf (file, ")\n");
+  fprintf (file, "#)\n");
 }
 
 /* Prints to STDERR the polyhedral data reference PDR.  */
@@ -406,12 +470,16 @@ new_scop (void *region)
 {
   scop_p scop = XNEW (struct scop);
 
-  SCOP_DEP_GRAPH (scop) = NULL;
   SCOP_CONTEXT (scop) = NULL;
   scop_set_region (scop, region);
   SCOP_BBS (scop) = VEC_alloc (poly_bb_p, heap, 3);
-  SCOP_ORIGINAL_PDR_PAIRS (scop) = htab_create (10, hash_poly_dr_pair_p,
-                                                eq_poly_dr_pair_p, free);
+  SCOP_ORIGINAL_PDDRS (scop) = htab_create (10, hash_poly_ddr_p,
+                                           eq_poly_ddr_p, free_poly_ddr);
+  SCOP_ORIGINAL_SCHEDULE (scop) = NULL;
+  SCOP_TRANSFORMED_SCHEDULE (scop) = NULL;
+  SCOP_SAVED_SCHEDULE (scop) = NULL;
+  POLY_SCOP_P (scop) = false;
+
   return scop;
 }
 
@@ -431,7 +499,10 @@ free_scop (scop_p scop)
   if (SCOP_CONTEXT (scop))
     ppl_delete_Pointset_Powerset_C_Polyhedron (SCOP_CONTEXT (scop));
 
-  htab_delete (SCOP_ORIGINAL_PDR_PAIRS (scop));
+  htab_delete (SCOP_ORIGINAL_PDDRS (scop));
+  free_lst (SCOP_ORIGINAL_SCHEDULE (scop));
+  free_lst (SCOP_TRANSFORMED_SCHEDULE (scop));
+  free_lst (SCOP_SAVED_SCHEDULE (scop));
   XDELETE (scop);
 }
 
@@ -446,7 +517,7 @@ print_pbb_domain (FILE *file, poly_bb_p pbb)
   if (!PBB_DOMAIN (pbb))
     return;
 
-  fprintf (file, "domains bb_%d (\n", GBB_BB (gbb)->index);
+  fprintf (file, "# Iteration domain of bb_%d (\n", GBB_BB (gbb)->index);
   fprintf (file, "#  eq");
 
   for (i = 0; i < pbb_dim_iter_domain (pbb); i++)
@@ -459,8 +530,10 @@ print_pbb_domain (FILE *file, poly_bb_p pbb)
 
   if (PBB_DOMAIN (pbb))
     ppl_print_powerset_matrix (file, PBB_DOMAIN (pbb));
+  else
+    fprintf (file, "0\n");
 
-  fprintf (file, ")\n");
+  fprintf (file, "#)\n");
 }
 
 /* Dump the cases of a graphite basic block GBB on FILE.  */
@@ -479,12 +552,15 @@ dump_gbb_cases (FILE *file, gimple_bb_p gbb)
   if (VEC_empty (gimple, cases))
     return;
 
-  fprintf (file, "cases bb_%d (", GBB_BB (gbb)->index);
+  fprintf (file, "# cases bb_%d (\n", GBB_BB (gbb)->index);
 
   for (i = 0; VEC_iterate (gimple, cases, i, stmt); i++)
-    print_gimple_stmt (file, stmt, 0, 0);
+    {
+      fprintf (file, "# ");
+      print_gimple_stmt (file, stmt, 0, 0);
+    }
 
-  fprintf (file, ")\n");
+  fprintf (file, "#)\n");
 }
 
 /* Dump conditions of a graphite basic block GBB on FILE.  */
@@ -503,12 +579,15 @@ dump_gbb_conditions (FILE *file, gimple_bb_p gbb)
   if (VEC_empty (gimple, conditions))
     return;
 
-  fprintf (file, "conditions bb_%d (", GBB_BB (gbb)->index);
+  fprintf (file, "# conditions bb_%d (\n", GBB_BB (gbb)->index);
 
   for (i = 0; VEC_iterate (gimple, conditions, i, stmt); i++)
-    print_gimple_stmt (file, stmt, 0, 0);
+    {
+      fprintf (file, "# ");
+      print_gimple_stmt (file, stmt, 0, 0);
+    }
 
-  fprintf (file, ")\n");
+  fprintf (file, "#)\n");
 }
 
 /* Print to FILE all the data references of PBB.  */
@@ -518,9 +597,38 @@ print_pdrs (FILE *file, poly_bb_p pbb)
 {
   int i;
   poly_dr_p pdr;
+  int nb_reads = 0;
+  int nb_writes = 0;
+
+  if (VEC_length (poly_dr_p, PBB_DRS (pbb)) == 0)
+    {
+      fprintf (file, "# Access informations are not provided\n0\n");
+      return;
+    }
+
+  fprintf (file, "# Data references (\n");
+  fprintf (file, "# Access informations are provided\n1\n");
 
   for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
-    print_pdr (file, pdr);
+    if (PDR_TYPE (pdr) == PDR_READ)
+      nb_reads++;
+    else
+      nb_writes++;
+
+  fprintf (file, "# Read data references (\n");
+  fprintf (file, "# Read access informations\n%d\n", nb_reads);
+  for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+    if (PDR_TYPE (pdr) == PDR_READ)
+      print_pdr (file, pdr);
+  fprintf (file, "#)\n");
+
+  fprintf (file, "# Write data references (\n");
+  fprintf (file, "# Write access informations\n%d\n", nb_writes);
+  for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+    if (PDR_TYPE (pdr) != PDR_READ)
+      print_pdr (file, pdr);
+  fprintf (file, "#)\n");
+  fprintf (file, "#)\n");
 }
 
 /* Print to STDERR all the data references of PBB.  */
@@ -531,18 +639,34 @@ debug_pdrs (poly_bb_p pbb)
   print_pdrs (stderr, pbb);
 }
 
+/* Print to FILE the body of PBB.  */
+
+static void
+print_pbb_body (FILE *file, poly_bb_p pbb)
+{
+  fprintf (file, "# Body (\n");
+  fprintf (file, "# Statement body is provided\n1\n");
+  fprintf (file, "# Original iterator names\n# Iterator names are not provided yet.\n");
+  fprintf (file, "# Statement body\n");
+  fprintf (file, "{\n");
+  dump_bb (pbb_bb (pbb), file, 0);
+  fprintf (file, "}\n");
+  fprintf (file, "#)\n");
+}
+
 /* Print to FILE the domain and scattering function of PBB.  */
 
 void
 print_pbb (FILE *file, poly_bb_p pbb)
 {
-  fprintf (file, "pbb (\n");
+  fprintf (file, "# pbb_%d (\n", pbb_index (pbb));
   dump_gbb_conditions (file, PBB_BLACK_BOX (pbb));
   dump_gbb_cases (file, PBB_BLACK_BOX (pbb));
-  print_pdrs (file, pbb);
   print_pbb_domain (file, pbb);
   print_scattering_function (file, pbb);
-  fprintf (file, ")\n");
+  print_pdrs (file, pbb);
+  print_pbb_body (file, pbb);
+  fprintf (file, "#)\n");
 }
 
 /* Print to FILE the parameters of SCOP.  */
@@ -553,14 +677,19 @@ print_scop_params (FILE *file, scop_p scop)
   int i;
   tree t;
 
-  fprintf (file, "parameters (\n");
+  fprintf (file, "# parameters (\n");
+
+  if (VEC_length (tree, SESE_PARAMS (SCOP_REGION (scop))))
+    fprintf (file, "# Parameter names are provided\n1\n# Parameter names \n");
+  else
+    fprintf (file, "# Parameter names are not provided\n0\n");
+
   for (i = 0; VEC_iterate (tree, SESE_PARAMS (SCOP_REGION (scop)), i, t); i++)
     {
-      fprintf (file, "p_%d -> ", i);
       print_generic_expr (file, t, 0);
-      fprintf (file, "\n");
+      fprintf (file, " # p_%d \n", i);
     }
-  fprintf (file, ")\n");
+  fprintf (file, "#)\n");
 }
 
 /* Print to FILE the context of SCoP.  */
@@ -569,7 +698,7 @@ print_scop_context (FILE *file, scop_p scop)
 {
   graphite_dim_t i;
 
-  fprintf (file, "context (\n");
+  fprintf (file, "# Context (\n");
   fprintf (file, "#  eq");
 
   for (i = 0; i < scop_nb_params (scop); i++)
@@ -579,8 +708,10 @@ print_scop_context (FILE *file, scop_p scop)
 
   if (SCOP_CONTEXT (scop))
     ppl_print_powerset_matrix (file, SCOP_CONTEXT (scop));
+  else
+    fprintf (file, "0 %d\n", (int) scop_nb_params (scop) + 2);
 
-  fprintf (file, ")\n");
+  fprintf (file, ")\n");
 }
 
 /* Print to FILE the SCOP.  */
@@ -591,14 +722,25 @@ print_scop (FILE *file, scop_p scop)
   int i;
   poly_bb_p pbb;
 
-  fprintf (file, "scop (\n");
-  print_scop_params (file, scop);
+  fprintf (file, "SCoP #(\n");
+  fprintf (file, "# Language\nGimple\n");
   print_scop_context (file, scop);
+  print_scop_params (file, scop);
+  fprintf (file, "# Number of statements\n%d\n",
+          VEC_length (poly_bb_p, SCOP_BBS (scop)));
 
   for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
     print_pbb (file, pbb);
 
-  fprintf (file, ")\n");
+  fprintf (file, "# original_lst (\n");
+  print_lst (file, SCOP_ORIGINAL_SCHEDULE (scop), 0);
+  fprintf (file, "\n#)\n");
+
+  fprintf (file, "# transformed_lst (\n");
+  print_lst (file, SCOP_TRANSFORMED_SCHEDULE (scop), 0);
+  fprintf (file, "\n#)\n");
+
+  fprintf (file, "#)\n");
 }
 
 /* Print to STDERR the domain of PBB.  */
@@ -718,9 +860,236 @@ pbb_number_of_iterations (poly_bb_p pbb,
   ppl_new_Linear_Expression_with_dimension (&le, dim);
   ppl_set_coef (le, pbb_iterator_dim (pbb, loop_depth), 1);
   value_set_si (niter, -1);
-  ppl_max_for_le (PBB_DOMAIN (pbb), le, niter);
+  ppl_max_for_le_pointset (PBB_DOMAIN (pbb), le, niter);
   ppl_delete_Linear_Expression (le);
 }
 
+/* Returns the number of iterations NITER of the loop around PBB at
+   time(scattering) dimension TIME_DEPTH.  */
+
+void
+pbb_number_of_iterations_at_time (poly_bb_p pbb,
+                                 graphite_dim_t time_depth,
+                                 Value niter)
+{
+  ppl_Pointset_Powerset_C_Polyhedron_t ext_domain, sctr;
+  ppl_Linear_Expression_t le;
+  ppl_dimension_type dim;
+
+  /* Takes together domain and scattering polyhedrons, and composes
+     them into the bigger polyhedron that has the following format:
+
+     t0..t_{n-1} | l0..l_{nlcl-1} | i0..i_{niter-1} | g0..g_{nparm-1}
+
+     where
+     | t0..t_{n-1} are time dimensions (scattering dimensions)
+     | l0..l_{nclc-1} are local variables in scattering function
+     | i0..i_{niter-1} are original iteration variables
+     | g0..g_{nparam-1} are global parameters.  */
+
+  ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sctr,
+      PBB_TRANSFORMED_SCATTERING (pbb));
+
+  /* Extend the iteration domain with the scattering dimensions:
+     0..0 | 0..0 | i0..i_{niter-1} | g0..g_{nparm-1}.   */
+  ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+    (&ext_domain, PBB_DOMAIN (pbb));
+  ppl_insert_dimensions_pointset (ext_domain, 0,
+                                  pbb_nb_scattering_transform (pbb)
+                                  + pbb_nb_local_vars (pbb));
+
+  /* Add to sctr the extended domain.  */
+  ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (sctr, ext_domain);
+
+  /* Extract the number of iterations.  */
+  ppl_Pointset_Powerset_C_Polyhedron_space_dimension (sctr, &dim);
+  ppl_new_Linear_Expression_with_dimension (&le, dim);
+  ppl_set_coef (le, time_depth, 1);
+  value_set_si (niter, -1);
+  ppl_max_for_le_pointset (sctr, le, niter);
+
+  ppl_delete_Linear_Expression (le);
+  ppl_delete_Pointset_Powerset_C_Polyhedron (sctr);
+  ppl_delete_Pointset_Powerset_C_Polyhedron (ext_domain);
+}
+
+/* Translates LOOP to LST.  */
+
+static lst_p
+loop_to_lst (loop_p loop, VEC (poly_bb_p, heap) *bbs, int *i)
+{
+  poly_bb_p pbb;
+  VEC (lst_p, heap) *seq = VEC_alloc (lst_p, heap, 5);
+
+  for (; VEC_iterate (poly_bb_p, bbs, *i, pbb); (*i)++)
+    {
+      lst_p stmt;
+      basic_block bb = GBB_BB (PBB_BLACK_BOX (pbb));
+
+      if (bb->loop_father == loop)
+       stmt = new_lst_stmt (pbb);
+      else if (flow_bb_inside_loop_p (loop, bb))
+       {
+         loop_p next = loop->inner;
+
+         while (next && !flow_bb_inside_loop_p (next, bb))
+           next = next->next;
+
+         stmt = loop_to_lst (next, bbs, i);
+       }
+      else
+       {
+         (*i)--;
+         return new_lst_loop (seq);
+       }
+
+      VEC_safe_push (lst_p, heap, seq, stmt);
+    }
+
+  return new_lst_loop (seq);
+}
+
+/* Reads the original scattering of the SCOP and returns an LST
+   representing it.  */
+
+void
+scop_to_lst (scop_p scop)
+{
+  lst_p res;
+  int i, n = VEC_length (poly_bb_p, SCOP_BBS (scop));
+  VEC (lst_p, heap) *seq = VEC_alloc (lst_p, heap, 5);
+  sese region = SCOP_REGION (scop);
+
+  for (i = 0; i < n; i++)
+    {
+      poly_bb_p pbb = VEC_index (poly_bb_p, SCOP_BBS (scop), i);
+      loop_p loop = outermost_loop_in_sese (region, GBB_BB (PBB_BLACK_BOX (pbb)));
+
+      if (loop_in_sese_p (loop, region))
+       res = loop_to_lst (loop, SCOP_BBS (scop), &i);
+      else
+       res = new_lst_stmt (pbb);
+
+      VEC_safe_push (lst_p, heap, seq, res);
+    }
+
+  res = new_lst_loop (seq);
+  SCOP_ORIGINAL_SCHEDULE (scop) = res;
+  SCOP_TRANSFORMED_SCHEDULE (scop) = copy_lst (res);
+}
+
+/* Print to FILE on a new line COLUMN white spaces.  */
+
+static void
+lst_indent_to (FILE *file, int column)
+{
+  int i;
+
+  if (column > 0)
+    fprintf (file, "\n#");
+
+  for (i = 0; i < column; i++)
+    fprintf (file, " ");
+}
+
+/* Print LST to FILE with INDENT spaces of indentation.  */
+
+void
+print_lst (FILE *file, lst_p lst, int indent)
+{
+  if (!lst)
+    return;
+
+  lst_indent_to (file, indent);
+
+  if (LST_LOOP_P (lst))
+    {
+      int i;
+      lst_p l;
+
+      if (LST_LOOP_FATHER (lst))
+       fprintf (file, "%d (loop", lst_dewey_number (lst));
+      else
+       fprintf (file, "#(root");
+
+      for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+       print_lst (file, l, indent + 2);
+
+      fprintf (file, ")");
+    }
+  else
+    fprintf (file, "%d stmt_%d", lst_dewey_number (lst), pbb_index (LST_PBB (lst)));
+}
+
+/* Print LST to STDERR.  */
+
+void
+debug_lst (lst_p lst)
+{
+  print_lst (stderr, lst, 0);
+}
+
+/* Pretty print to FILE the loop statement tree LST in DOT format.  */
+
+static void
+dot_lst_1 (FILE *file, lst_p lst)
+{
+  if (!lst)
+    return;
+
+  if (LST_LOOP_P (lst))
+    {
+      int i;
+      lst_p l;
+
+      if (!LST_LOOP_FATHER (lst))
+       fprintf (file, "L -> L_%d_%d\n",
+                lst_depth (lst),
+                lst_dewey_number (lst));
+      else
+       fprintf (file, "L_%d_%d -> L_%d_%d\n",
+                lst_depth (LST_LOOP_FATHER (lst)),
+                lst_dewey_number (LST_LOOP_FATHER (lst)),
+                lst_depth (lst),
+                lst_dewey_number (lst));
+
+      for (i = 0; VEC_iterate (lst_p, LST_SEQ (lst), i, l); i++)
+       dot_lst_1 (file, l);
+    }
+
+  else
+    fprintf (file, "L_%d_%d -> S_%d\n",
+            lst_depth (LST_LOOP_FATHER (lst)),
+            lst_dewey_number (LST_LOOP_FATHER (lst)),
+            pbb_index (LST_PBB (lst)));
+
+}
+
+/* Display the LST using dotty.  */
+
+void
+dot_lst (lst_p lst)
+{
+  /* When debugging, enable the following code.  This cannot be used
+     in production compilers because it calls "system".  */
+#if 0
+  int x;
+  FILE *stream = fopen ("/tmp/lst.dot", "w");
+  gcc_assert (stream);
+
+  fputs ("digraph all {\n", stream);
+  dot_lst_1 (stream, lst);
+  fputs ("}\n\n", stream);
+  fclose (stream);
+
+  x = system ("dotty /tmp/lst.dot");
+#else
+  fputs ("digraph all {\n", stderr);
+  dot_lst_1 (stderr, lst);
+  fputs ("}\n\n", stderr);
+
+#endif
+}
+
 #endif