/*
- * 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"
#endif
+#ifdef INTERPROCEDURAL_VIEW
+
#ifdef HAVE_STRING_H
# include <string.h>
#endif
return NULL;
}
+#ifdef INTERPROCEDURAL_VIEW
/* Returns non-zero if the caller at position pos is "a backedge", i.e. a recursion. */
int is_irg_caller_backedge(ir_graph *irg, int pos) {
assert (pos >= 0 && pos < get_irg_n_callers(irg));
}
return 0;
}
+#endif
/**
* Find the reversion position of a caller.
return 0;
}
+#ifdef INTERPROCEDURAL_VIEW
/**
* Mark the callee at position pos as a backedge.
*/
irg->callee_isbe = xcalloc(n, sizeof(irg->callee_isbe[0]));
irg->callee_isbe[pos] = 1;
}
+#endif
/* Returns the maximal loop depth of call nodes that call along this edge. */
int get_irg_callee_loop_depth(ir_graph *irg, int pos) {
static void ana_Call(ir_node *n, void *env) {
int i, n_callees;
ir_graph *irg;
+ (void) env;
if (! is_Call(n)) return;
static int loop_node_cnt = 0; /**< Counts the number of allocated cfloop nodes.
Each cfloop node gets a unique number.
What for? ev. remove. @@@ */
+#ifdef INTERPROCEDURAL_VIEW
static int current_dfn = 1; /**< Counter to generate depth first numbering
of visited nodes. */
+#endif
/*-----------------*/
} while(m != irg);
}
+#ifdef INTERPROCEDURAL_VIEW
/* GL ??? my last son is my grandson??? Removes cfloops with no
ir_nodes in them. Such loops have only another loop as son. (Why
can't they have two loops as sons? Does it never get that far? ) */
current_loop = l;
}
+#endif
/**
* Removes and unmarks all nodes up to n from the stack.
/* The loop data structure. **/
/**********************************************************************/
+#ifdef INTERPROCEDURAL_VIEW
/**
* Allocates a new loop as son of current_loop. Sets current_loop
* to the new loop and returns the father.
son->children = NEW_ARR_F (loop_element, 0);
son->n_nodes = 0;
son->n_sons = 0;
+ son->link = NULL;
if (father) {
son->outer_loop = father;
add_loop_son(father, son);
#ifdef DEBUG_libfirm
son->loop_nr = get_irp_new_node_nr();
- son->link = NULL;
#endif
current_loop = son;
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;
return !some_outof_loop & some_in_loop;
}
-
/**
* Check whether there is a parallel edge in the ip control flow.
* Only
}
#endif
-
/*-----------------------------------------------------------*
* The core algorithm. *
*-----------------------------------------------------------*/
irg->callee_isbe = NULL;
}
}
+#endif
/* nodes to evaluate a callgraph edge. */
/* ----------------------------------------------------------------------------------- */
+#ifdef INTERPROCEDURAL_VIEW
/* Returns the method execution frequency of a graph. */
double get_irg_method_execution_frequency (ir_graph *irg) {
return irg->method_execution_frequency;
double freq;
int found_edge;
int n_callees;
+ (void) env;
if (cg_irg_visited(irg)) return;
}
}
}
+#endif
/* Returns the maximal loop depth of all paths from an external visible method to
this irg. */
if (irp->lnd_state == loop_nesting_depth_consistent)
irp->lnd_state = loop_nesting_depth_inconsistent;
}
+
+#endif