* alpha.c (alpha_find_call): Warning fixes.
[deliverable/binutils-gdb.git] / gprof / cg_dfn.c
index c9e37ab29e526adfc0b87f13e4fcd108b7e3fbfe..463f22e5d25b8ca386485f46ec8d8768c19c7d47 100644 (file)
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
-#include <stdio.h>
+#include "libiberty.h"
 #include "gprof.h"
+#include "search_list.h"
+#include "source.h"
+#include "symtab.h"
 #include "cg_arcs.h"
 #include "cg_dfn.h"
-#include "symtab.h"
 #include "utils.h"
 
-#define        DFN_DEPTH       100
+#define        DFN_INCR_DEPTH (128)
 
 typedef struct
   {
@@ -32,7 +34,14 @@ typedef struct
   }
 DFN_Stack;
 
-DFN_Stack dfn_stack[DFN_DEPTH];
+static boolean is_numbered PARAMS ((Sym *));
+static boolean is_busy PARAMS ((Sym *));
+static void find_cycle PARAMS ((Sym *));
+static void pre_visit PARAMS ((Sym *));
+static void post_visit PARAMS ((Sym *));
+
+DFN_Stack *dfn_stack = NULL;
+int dfn_maxdepth = 0;
 int dfn_depth = 0;
 int dfn_counter = DFN_NAN;
 
@@ -40,8 +49,9 @@ int dfn_counter = DFN_NAN;
 /*
  * Is CHILD already numbered?
  */
-static bool
-DEFUN (is_numbered, (child), Sym * child)
+static boolean
+is_numbered (child)
+     Sym *child;
 {
   return child->cg.top_order != DFN_NAN && child->cg.top_order != DFN_BUSY;
 }
@@ -50,14 +60,15 @@ DEFUN (is_numbered, (child), Sym * child)
 /*
  * Is CHILD already busy?
  */
-static bool
-DEFUN (is_busy, (child), Sym * child)
+static boolean
+is_busy (child)
+     Sym *child;
 {
   if (child->cg.top_order == DFN_NAN)
     {
-      return FALSE;
+      return false;
     }
-  return TRUE;
+  return true;
 }
 
 
@@ -68,7 +79,8 @@ DEFUN (is_busy, (child), Sym * child)
  * depth-first number).
  */
 static void
-DEFUN (find_cycle, (child), Sym * child)
+find_cycle (child)
+     Sym *child;
 {
   Sym *head = 0;
   Sym *tail;
@@ -191,14 +203,17 @@ DEFUN (find_cycle, (child), Sym * child)
  * the stack and mark it busy.
  */
 static void
-DEFUN (pre_visit, (parent), Sym * parent)
+pre_visit (parent)
+     Sym *parent;
 {
   ++dfn_depth;
-  if (dfn_depth >= DFN_DEPTH)
+
+  if (dfn_depth >= dfn_maxdepth)
     {
-      fprintf (stderr, "[pre_visit] dfn_stack overflow\n");
-      done (1);
+      dfn_maxdepth += DFN_INCR_DEPTH;
+      dfn_stack = xrealloc (dfn_stack, dfn_maxdepth * sizeof *dfn_stack);
     }
+
   dfn_stack[dfn_depth].sym = parent;
   dfn_stack[dfn_depth].cycle_top = dfn_depth;
   parent->cg.top_order = DFN_BUSY;
@@ -213,7 +228,8 @@ DEFUN (pre_visit, (parent), Sym * parent)
  * and number functions if PARENT is head of a cycle.
  */
 static void
-DEFUN (post_visit, (parent), Sym * parent)
+post_visit (parent)
+     Sym *parent;
 {
   Sym *member;
 
@@ -247,7 +263,8 @@ DEFUN (post_visit, (parent), Sym * parent)
  * Given this PARENT, depth first number its children.
  */
 void
-DEFUN (cg_dfn, (parent), Sym * parent)
+cg_dfn (parent)
+     Sym *parent;
 {
   Arc *arc;
 
This page took 0.026274 seconds and 4 git commands to generate.