callgraph analyses
[libfirm] / ir / ana / callgraph.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ana/callgraph.h
4  * Purpose:     Representation and computation of the callgraph.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:     21.7.2004
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2004 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 #ifndef _CALLGRAPH_H_
14 #define _CALLGRAPH_H_
15
16 /**
17 * @file callgraph.h
18 *
19 *  This file contains defines the representation of the callgraph.
20 *  The nodes of the call graph are ir_graphs.  The edges between
21 *  The nodes are calling relation.  I.e., if method a calls method
22 *  b at some point, there is an edge between a and b.
23 *
24 *  Further this file contains an algorithm to construct the call
25 *  graph.  The construction of the callgraph uses the callee
26 *  information in Call nodes to determine which methods are called.
27 *
28 *  Finally this file contains an algorithm that computes backedges
29 *  in the callgraph, i.e., the algorithm finds possibly recursive calls.
30 *  The algorithm computes an upper bound of all recursive calls.
31 *
32 */
33
34 #include "irgraph.h"
35
36 /** The functions that call irg. */
37 int       get_irg_n_callers(ir_graph *irg);
38 ir_graph *get_irg_caller(ir_graph *irg, int pos);
39 /* int       is_irg_caller_backedge(ir_graph *irg, int pos);  not implemented */
40
41 /** The functions called by irg. */
42 int       get_irg_n_callees(ir_graph *irg);
43 ir_graph *get_irg_callee(ir_graph *irg, int pos);
44 int       is_irg_callee_backedge(ir_graph *irg, int pos);
45
46
47 /** Construct and destruct the callgraph. */
48 void compute_callgraph(void);
49 void free_callgraph(void);
50
51 /** Compute the backedges that represent recursions. */
52 void find_callgraph_recursions(void);
53
54
55 #endif /* _CALLGRAPH_H_ */