/*
- * Project: libFIRM
- * File name: ir/ana/callgraph.c
- * Purpose: Representation and computation of the callgraph.
- * Author: Goetz Lindenmaier
- * Modified by:
- * Created: 21.7.2004
- * CVS-ID: $Id$
- * Copyright: (c) 2004-2007 Universität Karlsruhe
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief Representation and computation of the callgraph.
+ * @author Goetz Lindenmaier
+ * @date 21.7.2004
+ * @version $Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
static void ana_Call(ir_node *n, void *env) {
int i, n_callees;
ir_graph *irg;
+ (void) env;
if (! is_Call(n)) return;
if (cg_irg_visited(irg)) return;
mark_cg_irg_visited(irg);
- pre(irg, env);
+ if (pre)
+ pre(irg, env);
n_callees = get_irg_n_callees(irg);
for (i = 0; i < n_callees; i++) {
do_walk(m, pre, post, env);
}
- post(irg, env);
+ if (post)
+ post(irg, env);
}
void callgraph_walk(callgraph_walk_func *pre, callgraph_walk_func *post, void *env) {
static INLINE int
cg_irg_visited(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
+ assert(info && "missing call to init_scc");
return (info->visited >= master_cg_visited);
}
static INLINE void
mark_cg_irg_visited(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
+ assert(info && "missing call to init_scc");
info->visited = master_cg_visited;
}
static INLINE void
set_cg_irg_visited(ir_graph *irg, int i) {
scc_info *info = get_irg_link(irg);
+ assert(info && "missing call to init_scc");
info->visited = i;
}
static INLINE int
get_cg_irg_visited(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
+ assert(info && "missing call to init_scc");
return info->visited;
}
static INLINE void
mark_irg_in_stack(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
- assert(info);
+ assert(info && "missing call to init_scc");
info->in_stack = 1;
}
static INLINE void
mark_irg_not_in_stack(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
- assert(info);
+ assert(info && "missing call to init_scc");
info->in_stack = 0;
}
static INLINE int
irg_is_in_stack(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
- assert(info);
+ assert(info && "missing call to init_scc");
return info->in_stack;
}
static INLINE void
set_irg_uplink(ir_graph *irg, int uplink) {
scc_info *info = get_irg_link(irg);
- assert(info);
+ assert(info && "missing call to init_scc");
info->uplink = uplink;
}
static INLINE int
get_irg_uplink(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
- assert(info);
+ assert(info && "missing call to init_scc");
return info->uplink;
}
static INLINE void
set_irg_dfn(ir_graph *irg, int dfn) {
scc_info *info = get_irg_link(irg);
- assert(info);
+ assert(info && "missing call to init_scc");
info->dfn = dfn;
}
static INLINE int
get_irg_dfn(ir_graph *irg) {
scc_info *info = get_irg_link(irg);
- assert(info);
+ assert(info && "missing call to init_scc");
return info->dfn;
}
some_outof_loop = 1;
} else {
if (get_irg_uplink(pred) < get_irg_uplink(root)) {
- DDMG(pred); DDMG(root);
assert(get_irg_uplink(pred) >= get_irg_uplink(root));
}
some_in_loop = 1;
some_outof_loop = 1;
} else {
if(get_irg_uplink(pred) < get_irg_uplink(root)) {
- DDMG(pred); DDMG(root);
assert(get_irg_uplink(pred) >= get_irg_uplink(root));
}
some_in_loop = 1;
double freq;
int found_edge;
int n_callees;
+ (void) env;
if (cg_irg_visited(irg)) return;