merge from gcc
[deliverable/binutils-gdb.git] / gprof / cg_print.c
index 24613809931427c6337bc9b6aab250fefe8daddb..ce8cbc417f6cfc87251e2f2c30625fa3f0704a22 100644 (file)
@@ -1,12 +1,12 @@
 /* cg_print.c -  Print routines for displaying call graphs.
 
-   Copyright (C) 2000  Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 \f
 #include "libiberty.h"
+#include "gprof.h"
+#include "search_list.h"
+#include "source.h"
+#include "symtab.h"
 #include "cg_arcs.h"
 #include "cg_print.h"
 #include "hist.h"
 #include "utils.h"
+#include "corefile.h"
 
 /* Return value of comparison functions used to sort tables.  */
 #define        LESSTHAN        -1
 #define        EQUALTO         0
 #define        GREATERTHAN     1
 
-static void order_and_dump_functions_by_arcs PARAMS ((Arc **, unsigned long,
-                                                     int, Arc **,
-                                                     unsigned long *));
+static void print_header (void);
+static void print_cycle (Sym *);
+static int cmp_member (Sym *, Sym *);
+static void sort_members (Sym *);
+static void print_members (Sym *);
+static int cmp_arc (Arc *, Arc *);
+static void sort_parents (Sym *);
+static void print_parents (Sym *);
+static void sort_children (Sym *);
+static void print_children (Sym *);
+static void print_line (Sym *);
+static int cmp_name (const PTR, const PTR);
+static int cmp_arc_count (const PTR, const PTR);
+static int cmp_fun_nuses (const PTR, const PTR);
+static void order_and_dump_functions_by_arcs
+  (Arc **, unsigned long, int, Arc **, unsigned long *);
+
 /* Declarations of automatically generated functions to output blurbs.  */
-extern void bsd_callg_blurb PARAMS ((FILE * fp));
-extern void fsf_callg_blurb PARAMS ((FILE * fp));
+extern void bsd_callg_blurb (FILE * fp);
+extern void fsf_callg_blurb (FILE * fp);
 
 double print_time = 0.0;
 
 
 static void
-DEFUN_VOID (print_header)
+print_header ()
 {
   if (first_output)
     first_output = FALSE;
   else
     printf ("\f\n");
-  
+
   if (!bsd_style_output)
     {
       if (print_descriptions)
@@ -55,27 +74,27 @@ DEFUN_VOID (print_header)
       else
        printf (_("\t\t\tCall graph\n\n"));
     }
-  
+
   printf (_("\ngranularity: each sample hit covers %ld byte(s)"),
          (long) hist_scale * sizeof (UNIT));
-  
+
   if (print_time > 0.0)
     printf (_(" for %.2f%% of %.2f seconds\n\n"),
            100.0 / print_time, print_time / hz);
   else
     {
       printf (_(" no time propagated\n\n"));
-      
+
       /* This doesn't hurt, since all the numerators will be 0.0.  */
       print_time = 1.0;
     }
-  
+
   if (bsd_style_output)
     {
       printf ("%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s     %-8.8s\n",
              "", "", "", "", _("called"), _("total"), _("parents"));
       printf ("%-6.6s %5.5s %7.7s %11.11s %7.7s+%-7.7s %-8.8s\t%5.5s\n",
-             _("index"), _("%time"), _("self"), _("descendents"),
+             _("index"), _("%time"), _("self"), _("descendants"),
              _("called"), _("self"), _("name"), _("index"));
       printf ("%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s     %-8.8s\n",
              "", "", "", "", _("called"), _("total"), _("children"));
@@ -90,7 +109,7 @@ DEFUN_VOID (print_header)
 /* Print a cycle header.  */
 
 static void
-DEFUN (print_cycle, (cyc), Sym * cyc)
+print_cycle (Sym *cyc)
 {
   char buf[BUFSIZ];
 
@@ -100,7 +119,7 @@ DEFUN (print_cycle, (cyc), Sym * cyc)
          : "%-6.6s %5.1f %7.2f %7.2f %7lu", buf,
          100 * (cyc->cg.prop.self + cyc->cg.prop.child) / print_time,
          cyc->cg.prop.self / hz, cyc->cg.prop.child / hz, cyc->ncalls);
-  
+
   if (cyc->cg.self_calls != 0)
     printf ("+%-7lu", cyc->cg.self_calls);
   else
@@ -113,7 +132,7 @@ DEFUN (print_cycle, (cyc), Sym * cyc)
    CG.PROP.SELF+CG.PROP.CHILD, secondary key is NCALLS+CG.SELF_CALLS.  */
 
 static int
-DEFUN (cmp_member, (left, right), Sym * left AND Sym * right)
+cmp_member (Sym *left, Sym *right)
 {
   double left_time = left->cg.prop.self + left->cg.prop.child;
   double right_time = right->cg.prop.self + right->cg.prop.child;
@@ -138,25 +157,25 @@ DEFUN (cmp_member, (left, right), Sym * left AND Sym * right)
 /* Sort members of a cycle.  */
 
 static void
-DEFUN (sort_members, (cyc), Sym * cyc)
+sort_members (Sym *cyc)
 {
   Sym *todo, *doing, *prev;
-  
+
   /* Detach cycle members from cyclehead,
      and insertion sort them back on.  */
   todo = cyc->cg.cyc.next;
   cyc->cg.cyc.next = 0;
-  
+
   for (doing = todo; doing && doing->cg.cyc.next; doing = todo)
     {
       todo = doing->cg.cyc.next;
-      
+
       for (prev = cyc; prev->cg.cyc.next; prev = prev->cg.cyc.next)
        {
          if (cmp_member (doing, prev->cg.cyc.next) == GREATERTHAN)
            break;
        }
-      
+
       doing->cg.cyc.next = prev->cg.cyc.next;
       prev->cg.cyc.next = doing;
     }
@@ -165,12 +184,12 @@ DEFUN (sort_members, (cyc), Sym * cyc)
 /* Print the members of a cycle.  */
 
 static void
-DEFUN (print_members, (cyc), Sym * cyc)
+print_members (Sym *cyc)
 {
   Sym *member;
 
   sort_members (cyc);
-  
+
   for (member = cyc->cg.cyc.next; member; member = member->cg.cyc.next)
     {
       printf (bsd_style_output
@@ -178,7 +197,7 @@ DEFUN (print_members, (cyc), Sym * cyc)
              : "%6.6s %5.5s %7.2f %7.2f %7lu",
              "", "", member->cg.prop.self / hz, member->cg.prop.child / hz,
              member->ncalls);
-      
+
       if (member->cg.self_calls != 0)
        printf ("+%-7lu", member->cg.self_calls);
       else
@@ -191,15 +210,15 @@ DEFUN (print_members, (cyc), Sym * cyc)
 }
 
 /* Compare two arcs to/from the same child/parent.
-        - if one arc is a self arc, it's least.
-        - if one arc is within a cycle, it's less than.
-        - if both arcs are within a cycle, compare arc counts.
-        - if neither arc is within a cycle, compare with
-                time + child_time as major key
-                arc count as minor key.  */
+       - if one arc is a self arc, it's least.
+       - if one arc is within a cycle, it's less than.
+       - if both arcs are within a cycle, compare arc counts.
+       - if neither arc is within a cycle, compare with
+               time + child_time as major key
+               arc count as minor key.  */
 
 static int
-DEFUN (cmp_arc, (left, right), Arc * left AND Arc * right)
+cmp_arc (Arc *left, Arc *right)
 {
   Sym *left_parent = left->parent;
   Sym *left_child = left->child;
@@ -222,7 +241,7 @@ DEFUN (cmp_arc, (left, right), Arc * left AND Arc * right)
               right->count, right_child->ncalls);
        printf ("\n");
     );
-  
+
   if (left_parent == left_child)
     return LESSTHAN;           /* Left is a self call.  */
 
@@ -265,7 +284,7 @@ DEFUN (cmp_arc, (left, right), Arc * left AND Arc * right)
          /* Neither is a call within a cycle.  */
          left_time = left->time + left->child_time;
          right_time = right->time + right->child_time;
-         
+
          if (left_time < right_time)
            return LESSTHAN;
 
@@ -285,18 +304,18 @@ DEFUN (cmp_arc, (left, right), Arc * left AND Arc * right)
 
 
 static void
-DEFUN (sort_parents, (child), Sym * child)
+sort_parents (Sym * child)
 {
   Arc *arc, *detached, sorted, *prev;
 
   /* Unlink parents from child, then insertion sort back on to
      sorted's parents.
-          *arc        the arc you have detached and are inserting.
-          *detached   the rest of the arcs to be sorted.
-          sorted      arc list onto which you insertion sort.
-          *prev       arc before the arc you are comparing.  */
+         *arc        the arc you have detached and are inserting.
+         *detached   the rest of the arcs to be sorted.
+         sorted      arc list onto which you insertion sort.
+         *prev       arc before the arc you are comparing.  */
   sorted.next_parent = 0;
-  
+
   for (arc = child->cg.parents; arc; arc = detached)
     {
       detached = arc->next_parent;
@@ -307,7 +326,7 @@ DEFUN (sort_parents, (child), Sym * child)
          if (cmp_arc (arc, prev->next_parent) != GREATERTHAN)
            break;
        }
-      
+
       arc->next_parent = prev->next_parent;
       prev->next_parent = arc;
     }
@@ -318,7 +337,7 @@ DEFUN (sort_parents, (child), Sym * child)
 
 
 static void
-DEFUN (print_parents, (child), Sym * child)
+print_parents (Sym *child)
 {
   Sym *parent;
   Arc *arc;
@@ -328,7 +347,7 @@ DEFUN (print_parents, (child), Sym * child)
     cycle_head = child->cg.cyc.head;
   else
     cycle_head = child;
-  
+
   if (!child->cg.parents)
     {
       printf (bsd_style_output
@@ -337,9 +356,9 @@ DEFUN (print_parents, (child), Sym * child)
              "", "", "", "", "", "");
       return;
     }
-  
+
   sort_parents (child);
-  
+
   for (arc = child->cg.parents; arc; arc = arc->next_parent)
     {
       parent = arc->parent;
@@ -372,18 +391,18 @@ DEFUN (print_parents, (child), Sym * child)
 
 
 static void
-DEFUN (sort_children, (parent), Sym * parent)
+sort_children (Sym *parent)
 {
   Arc *arc, *detached, sorted, *prev;
-  
+
   /* Unlink children from parent, then insertion sort back on to
      sorted's children.
-          *arc        the arc you have detached and are inserting.
-          *detached   the rest of the arcs to be sorted.
-          sorted      arc list onto which you insertion sort.
-          *prev       arc before the arc you are comparing.  */
+         *arc        the arc you have detached and are inserting.
+         *detached   the rest of the arcs to be sorted.
+         sorted      arc list onto which you insertion sort.
+         *prev       arc before the arc you are comparing.  */
   sorted.next_child = 0;
-  
+
   for (arc = parent->cg.children; arc; arc = detached)
     {
       detached = arc->next_child;
@@ -394,7 +413,7 @@ DEFUN (sort_children, (parent), Sym * parent)
          if (cmp_arc (arc, prev->next_child) != LESSTHAN)
            break;
        }
-      
+
       arc->next_child = prev->next_child;
       prev->next_child = arc;
     }
@@ -405,14 +424,14 @@ DEFUN (sort_children, (parent), Sym * parent)
 
 
 static void
-DEFUN (print_children, (parent), Sym * parent)
+print_children (Sym *parent)
 {
   Sym *child;
   Arc *arc;
 
   sort_children (parent);
   arc = parent->cg.children;
-  
+
   for (arc = parent->cg.children; arc; arc = arc->next_child)
     {
       child = arc->child;
@@ -444,7 +463,7 @@ DEFUN (print_children, (parent), Sym * parent)
 
 
 static void
-DEFUN (print_line, (np), Sym * np)
+print_line (Sym *np)
 {
   char buf[BUFSIZ];
 
@@ -454,11 +473,11 @@ DEFUN (print_line, (np), Sym * np)
          : "%-6.6s %5.1f %7.2f %7.2f", buf,
          100 * (np->cg.prop.self + np->cg.prop.child) / print_time,
          np->cg.prop.self / hz, np->cg.prop.child / hz);
-  
+
   if ((np->ncalls + np->cg.self_calls) != 0)
     {
       printf (" %7lu", np->ncalls);
-      
+
       if (np->cg.self_calls != 0)
          printf ("+%-7lu ", np->cg.self_calls);
       else
@@ -468,7 +487,7 @@ DEFUN (print_line, (np), Sym * np)
     {
       printf (" %7.7s %7.7s ", "", "");
     }
-  
+
   print_name (np);
   printf ("\n");
 }
@@ -477,7 +496,7 @@ DEFUN (print_line, (np), Sym * np)
 /* Print dynamic call graph.  */
 
 void
-DEFUN (cg_print, (timesortsym), Sym ** timesortsym)
+cg_print (Sym ** timesortsym)
 {
   unsigned int index;
   Sym *parent;
@@ -490,14 +509,14 @@ DEFUN (cg_print, (timesortsym), Sym ** timesortsym)
   for (index = 0; index < symtab.len + num_cycles; ++index)
     {
       parent = timesortsym[index];
-      
+
       if ((ignore_zeros && parent->ncalls == 0
           && parent->cg.self_calls == 0 && parent->cg.prop.self == 0
           && parent->cg.prop.child == 0)
          || !parent->cg.print_flag
          || (line_granularity && ! parent->is_func))
        continue;
-      
+
       if (!parent->name && parent->cg.cyc.num != 0)
        {
          /* Cycle header.  */
@@ -510,25 +529,25 @@ DEFUN (cg_print, (timesortsym), Sym ** timesortsym)
          print_line (parent);
          print_children (parent);
        }
-      
+
       if (bsd_style_output)
        printf ("\n");
-      
+
       printf ("-----------------------------------------------\n");
-      
+
       if (bsd_style_output)
        printf ("\n");
     }
-  
+
   free (timesortsym);
-  
+
   if (print_descriptions && !bsd_style_output)
     fsf_callg_blurb (stdout);
 }
 
 
 static int
-DEFUN (cmp_name, (left, right), const PTR left AND const PTR right)
+cmp_name (const PTR left, const PTR right)
 {
   const Sym **npp1 = (const Sym **) left;
   const Sym **npp2 = (const Sym **) right;
@@ -538,7 +557,7 @@ DEFUN (cmp_name, (left, right), const PTR left AND const PTR right)
 
 
 void
-DEFUN_VOID (cg_print_index)
+cg_print_index ()
 {
   unsigned int index;
   unsigned int nnames, todo, i, j;
@@ -547,11 +566,11 @@ DEFUN_VOID (cg_print_index)
   const char *filename;
   char buf[20];
   int column_width = (output_width - 1) / 3;   /* Don't write in last col!  */
-  
+
   /* Now, sort regular function name
      alphabetically to create an index.  */
   name_sorted_syms = (Sym **) xmalloc ((symtab.len + num_cycles) * sizeof (Sym *));
-  
+
   for (index = 0, nnames = 0; index < symtab.len; index++)
     {
       if (ignore_zeros && symtab.base[index].ncalls == 0
@@ -560,25 +579,25 @@ DEFUN_VOID (cg_print_index)
 
       name_sorted_syms[nnames++] = &symtab.base[index];
     }
-  
+
   qsort (name_sorted_syms, nnames, sizeof (Sym *), cmp_name);
-  
+
   for (index = 1, todo = nnames; index <= num_cycles; index++)
     name_sorted_syms[todo++] = &cycle_header[index];
 
   printf ("\f\n");
   printf (_("Index by function name\n\n"));
   index = (todo + 2) / 3;
-  
+
   for (i = 0; i < index; i++)
     {
       col = 0;
       starting_col = 0;
-      
+
       for (j = i; j < todo; j += index)
        {
          sym = name_sorted_syms[j];
-         
+
          if (sym->cg.print_flag)
            sprintf (buf, "[%d]", sym->cg.index);
          else
@@ -593,27 +612,27 @@ DEFUN_VOID (cg_print_index)
              else
                {
                  col += strlen (buf);
-                 
+
                  for (; col < starting_col + 5; ++col)
                    putchar (' ');
 
                  printf (" %s ", buf);
                  col += print_name_only (sym);
-                 
+
                  if (!line_granularity && sym->is_static && sym->file)
                    {
                      filename = sym->file->name;
-                     
+
                      if (!print_path)
                        {
                          filename = strrchr (filename, '/');
-                         
+
                          if (filename)
                            ++filename;
                          else
                            filename = sym->file->name;
                        }
-                     
+
                      printf (" (%s)", filename);
                      col += strlen (filename) + 3;
                    }
@@ -638,13 +657,13 @@ DEFUN_VOID (cg_print_index)
                  col += strlen (buf);
                }
            }
-         
+
          starting_col += column_width;
        }
-      
+
       printf ("\n");
     }
-  
+
   free (name_sorted_syms);
 }
 
@@ -652,7 +671,7 @@ DEFUN_VOID (cg_print_index)
    We want to sort in descending order.  */
 
 static int
-DEFUN (cmp_arc_count, (left, right), const PTR left AND const PTR right)
+cmp_arc_count (const PTR left, const PTR right)
 {
   const Arc **npp1 = (const Arc **) left;
   const Arc **npp2 = (const Arc **) right;
@@ -669,7 +688,7 @@ DEFUN (cmp_arc_count, (left, right), const PTR left AND const PTR right)
    We want to sort in descending order.  */
 
 static int
-DEFUN (cmp_fun_nuses, (left, right), const PTR left AND const PTR right)
+cmp_fun_nuses (const PTR left, const PTR right)
 {
   const Sym **npp1 = (const Sym **) left;
   const Sym **npp2 = (const Sym **) right;
@@ -714,7 +733,7 @@ DEFUN (cmp_fun_nuses, (left, right), const PTR left AND const PTR right)
    Of course, profiling errors, machine limitations (PA long calls), and
    poor cutoff values for the placement algorithm may limit the usefullness
    of the resulting function order.  Improvements would be greatly appreciated.
-   
+
    Suggestions:
 
        * Place the functions with many callers near the middle of the
@@ -749,9 +768,9 @@ DEFUN (cmp_fun_nuses, (left, right), const PTR left AND const PTR right)
        ordering which shares the same arc placement algorithm with
        the function ordering code (in fact it is a degenerate case
        of function ordering).  */
-       
+
 void
-DEFUN_VOID (cg_print_function_ordering)
+cg_print_function_ordering ()
 {
   unsigned long index, used, unused, scratch_index;
   unsigned long  unplaced_arc_count, high_arc_count, scratch_arc_count;
@@ -856,13 +875,13 @@ DEFUN_VOID (cg_print_function_ordering)
         Unfortunately, we don't know all these functions
         until we're done.  So we keep track of all the arcs
         to the functions we care about, then prune out those
-        which are uninteresting. 
+        which are uninteresting.
 
         An interesting variation would be to quit when we found
         multi-call site functions which account for some percentage
         of the arcs.  */
       arc = sym->cg.children;
-      
+
       while (arc)
        {
          if (arc->parent != arc->child)
@@ -872,7 +891,7 @@ DEFUN_VOID (cg_print_function_ordering)
        }
 
       arc = sym->cg.parents;
-      
+
       while (arc)
        {
          if (arc->parent != arc->child)
@@ -956,18 +975,18 @@ DEFUN_VOID (cg_print_function_ordering)
   free (unplaced_arcs);
 }
 
-/* Place functions based on the arcs in ARCS with NUMARCS entries;
+/* Place functions based on the arcs in THE_ARCS with ARC_COUNT entries;
    place unused arcs into UNPLACED_ARCS/UNPLACED_ARC_COUNT.
 
-   If ALL is nonzero, then place all functions referenced by ARCS,
-   else only place those referenced in the top 99% of the arcs in ARCS.  */
+   If ALL is nonzero, then place all functions referenced by THE_ARCS,
+   else only place those referenced in the top 99% of the arcs in THE_ARCS.  */
 
 #define MOST 0.99
 static void
-order_and_dump_functions_by_arcs (arcs, numarcs, all,
+order_and_dump_functions_by_arcs (the_arcs, arc_count, all,
                                  unplaced_arcs, unplaced_arc_count)
-     Arc **arcs;
-     unsigned long numarcs;
+     Arc **the_arcs;
+     unsigned long arc_count;
      int all;
      Arc **unplaced_arcs;
      unsigned long *unplaced_arc_count;
@@ -985,27 +1004,27 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
   if (! all)
     {
       total_arcs = 0;
-      for (index = 0; index < numarcs; index++)
-       total_arcs += arcs[index]->count;
+      for (index = 0; index < arc_count; index++)
+       total_arcs += the_arcs[index]->count;
     }
   else
     total_arcs = 0;
 
   tmp_arcs = 0;
-  
-  for (index = 0; index < numarcs; index++)
+
+  for (index = 0; index < arc_count; index++)
     {
       Sym *sym1, *sym2;
       Sym *child, *parent;
 
-      tmp_arcs += arcs[index]->count;
+      tmp_arcs += the_arcs[index]->count;
 
       /* Ignore this arc if it's already been placed.  */
-      if (arcs[index]->has_been_placed)
+      if (the_arcs[index]->has_been_placed)
        continue;
 
-      child = arcs[index]->child;
-      parent = arcs[index]->parent;
+      child = the_arcs[index]->child;
+      parent = the_arcs[index]->parent;
 
       /* If we're not using all arcs, and this is a rarely used
         arc, then put it on the unplaced_arc list.  Similarly
@@ -1013,7 +1032,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
       if ((! all && (double)tmp_arcs / (double)total_arcs > MOST)
          || child->has_been_placed || parent->has_been_placed)
        {
-         unplaced_arcs[(*unplaced_arc_count)++] = arcs[index];
+         unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
          continue;
        }
 
@@ -1023,7 +1042,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
         algorithm can use it to place function chains.  */
       if (parent->next && parent->prev && child->next && child->prev)
        {
-         unplaced_arcs[(*unplaced_arc_count)++] = arcs[index];
+         unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
          continue;
        }
 
@@ -1049,7 +1068,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
              prev = prev->prev;
              prev_count++;
            }
-         
+
          /* Choose the closest.  */
          child = next_count < prev_count ? next : prev;
        }
@@ -1078,7 +1097,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
        {
          /* Couldn't find anywhere to attach the functions,
             put the arc on the unplaced arc list.  */
-         unplaced_arcs[(*unplaced_arc_count)++] = arcs[index];
+         unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
          continue;
        }
 
@@ -1103,7 +1122,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
          && sym2 == parent)
        {
          /* This would tie two ends together.  */
-         unplaced_arcs[(*unplaced_arc_count)++] = arcs[index];
+         unplaced_arcs[(*unplaced_arc_count)++] = the_arcs[index];
          continue;
        }
 
@@ -1115,7 +1134,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
              /* parent-prev and child-next */
              parent->prev = child;
              child->next = parent;
-             arcs[index]->has_been_placed = 1;
+             the_arcs[index]->has_been_placed = 1;
            }
        }
       else if (parent->prev)
@@ -1126,7 +1145,7 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
              /* parent-next and child-prev */
              parent->next = child;
              child->prev = parent;
-             arcs[index]->has_been_placed = 1;
+             the_arcs[index]->has_been_placed = 1;
            }
        }
       else
@@ -1138,27 +1157,27 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
              /* parent-prev and child-next.  */
              parent->prev = child;
              child->next = parent;
-             arcs[index]->has_been_placed = 1;
+             the_arcs[index]->has_been_placed = 1;
            }
          else
            {
              /* parent-next and child-prev.  */
              parent->next = child;
              child->prev = parent;
-             arcs[index]->has_been_placed = 1;
+             the_arcs[index]->has_been_placed = 1;
            }
        }
     }
 
   /* Dump the chains of functions we've made.  */
-  for (index = 0; index < numarcs; index++)
+  for (index = 0; index < arc_count; index++)
     {
       Sym *sym;
-      if (arcs[index]->parent->has_been_placed
-         || arcs[index]->child->has_been_placed)
+      if (the_arcs[index]->parent->has_been_placed
+         || the_arcs[index]->child->has_been_placed)
        continue;
 
-      sym = arcs[index]->parent;
+      sym = the_arcs[index]->parent;
 
       /* If this symbol isn't attached to any other
         symbols, then we've got a rarely used arc.
@@ -1184,14 +1203,14 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
   /* If we want to place all the arcs, then output
      those which weren't placed by the main algorithm.  */
   if (all)
-    for (index = 0; index < numarcs; index++)
+    for (index = 0; index < arc_count; index++)
       {
        Sym *sym;
-       if (arcs[index]->parent->has_been_placed
-           || arcs[index]->child->has_been_placed)
+       if (the_arcs[index]->parent->has_been_placed
+           || the_arcs[index]->child->has_been_placed)
          continue;
 
-       sym = arcs[index]->parent;
+       sym = the_arcs[index]->parent;
 
        sym->has_been_placed = 1;
        printf ("%s\n", sym->name);
@@ -1202,19 +1221,11 @@ order_and_dump_functions_by_arcs (arcs, numarcs, all,
    on profiling information.  This uses the function placement
    code for the bulk of its work.  */
 
-struct function_map
-{
-  char *function_name;
-  char *file_name;
-};
-
 void
-DEFUN_VOID (cg_print_file_ordering)
+cg_print_file_ordering ()
 {
   unsigned long scratch_arc_count, index;
   Arc **scratch_arcs;
-  extern struct function_map *symbol_map;
-  extern unsigned int symbol_map_count;
   char *last;
 
   scratch_arc_count = 0;
@@ -1263,5 +1274,5 @@ DEFUN_VOID (cg_print_file_ordering)
       if (index2 == symtab.len)
        printf ("%s\n", symbol_map[index].file_name);
       last = symbol_map[index].file_name;
-    } 
+    }
 }
This page took 0.034879 seconds and 4 git commands to generate.