/*
- * Copyright (c) 1983 Regents of the University of California.
+ * Copyright (c) 1983, 2001 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
*/
#include "libiberty.h"
#include "gprof.h"
+#include "search_list.h"
+#include "source.h"
+#include "symtab.h"
#include "call_graph.h"
#include "cg_arcs.h"
#include "cg_dfn.h"
#include "utils.h"
#include "sym_ids.h"
+static int cmp_topo PARAMS ((const PTR, const PTR));
+static void propagate_time PARAMS ((Sym *));
+static void cycle_time PARAMS ((void));
+static void cycle_link PARAMS ((void));
+static void inherit_flags PARAMS ((Sym *));
+static void propagate_flags PARAMS ((Sym **));
+static int cmp_total PARAMS ((const PTR, const PTR));
+
Sym *cycle_header;
unsigned int num_cycles;
Arc **arcs;
* range covered by CHILD.
*/
Arc *
-DEFUN (arc_lookup, (parent, child), Sym * parent AND Sym * child)
+arc_lookup (parent, child)
+ Sym *parent;
+ Sym *child;
{
Arc *arc;
* Add (or just increment) an arc:
*/
void
-DEFUN (arc_add, (parent, child, count),
- Sym * parent AND Sym * child AND unsigned long count)
+arc_add (parent, child, count)
+ Sym *parent;
+ Sym *child;
+ unsigned long count;
{
static unsigned int maxarcs = 0;
Arc *arc, **newarcs;
if (maxarcs == 0)
maxarcs = 1;
maxarcs *= 2;
-
+
/* Allocate the new array. */
newarcs = (Arc **)xmalloc(sizeof (Arc *) * maxarcs);
static int
-DEFUN (cmp_topo, (lp, rp), const PTR lp AND const PTR rp)
+cmp_topo (lp, rp)
+ const PTR lp;
+ const PTR rp;
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
static void
-DEFUN (propagate_time, (parent), Sym * parent)
+propagate_time (parent)
+ Sym *parent;
{
Arc *arc;
Sym *child;
* its members.
*/
static void
-DEFUN_VOID (cycle_time)
+cycle_time ()
{
Sym *member, *cyc;
static void
-DEFUN_VOID (cycle_link)
+cycle_link ()
{
Sym *sym, *cyc, *member;
Arc *arc;
++num;
++cyc;
sym_init (cyc);
- cyc->cg.print_flag = TRUE; /* should this be printed? */
+ cyc->cg.print_flag = true; /* should this be printed? */
cyc->cg.top_order = DFN_NAN; /* graph call chain top-sort order */
cyc->cg.cyc.num = num; /* internal number of cycle on */
cyc->cg.cyc.head = cyc; /* pointer to head of cycle */
* fractions from parents.
*/
static void
-DEFUN (inherit_flags, (child), Sym * child)
+inherit_flags (child)
+ Sym *child;
{
Sym *head, *parent, *member;
Arc *arc;
if (child == head)
{
/* just a regular child, check its parents: */
- child->cg.print_flag = FALSE;
+ child->cg.print_flag = false;
child->cg.prop.fract = 0.0;
for (arc = child->cg.parents; arc; arc = arc->next_parent)
{
* Its a member of a cycle, look at all parents from outside
* the cycle.
*/
- head->cg.print_flag = FALSE;
+ head->cg.print_flag = false;
head->cg.prop.fract = 0.0;
for (member = head->cg.cyc.next; member; member = member->cg.cyc.next)
{
* and while we're here, sum time for functions.
*/
static void
-DEFUN (propagate_flags, (symbols), Sym ** symbols)
+propagate_flags (symbols)
+ Sym **symbols;
{
int index;
Sym *old_head, *child;
|| (syms[INCL_GRAPH].len == 0
&& !sym_lookup (&syms[EXCL_GRAPH], child->addr)))
{
- child->cg.print_flag = TRUE;
+ child->cg.print_flag = true;
}
}
else
if (!sym_lookup (&syms[INCL_GRAPH], child->addr)
&& sym_lookup (&syms[EXCL_GRAPH], child->addr))
{
- child->cg.print_flag = FALSE;
+ child->cg.print_flag = false;
}
}
if (child->cg.prop.fract == 0.0)
* first. All else being equal, compare by names.
*/
static int
-DEFUN (cmp_total, (lp, rp), const PTR lp AND const PTR rp)
+cmp_total (lp, rp)
+ const PTR lp;
+ const PTR rp;
{
const Sym *left = *(const Sym **) lp;
const Sym *right = *(const Sym **) rp;
* time bottom up and flags top down.
*/
Sym **
-DEFUN_VOID (cg_assemble)
+cg_assemble ()
{
Sym *parent, **time_sorted_syms, **top_sorted_syms;
unsigned int index;
parent->cg.prop.fract = 0.0;
parent->cg.prop.self = 0.0;
parent->cg.prop.child = 0.0;
- parent->cg.print_flag = FALSE;
+ parent->cg.print_flag = false;
parent->cg.top_order = DFN_NAN;
parent->cg.cyc.num = 0;
parent->cg.cyc.head = parent;