allow specification of names for in parameters in spec file
[libfirm] / ir / ana2 / ecg.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief   Extended Call Graph
23  * @author  Florian
24  * @version $Id$
25  */
26 #ifndef FIRM_ANA2_EGC_H
27 #define FIRM_ANA2_EGC_H
28
29 # include "irgraph.h"
30 # include "irnode.h"
31
32 /*
33   data
34 */
35
36 typedef struct ctx_info
37 {
38   ir_graph *graph;              /* The graph of the callR who created this ctx */
39   /* (which is redundant, since it's always == get_irn_graph (call)  */
40   ir_node *call;                /* The call through which this graph was called */
41   struct ctx_info *enc;         /* The ctx in which our callR was called */
42   int id;
43 } ctx_info_t;
44
45 typedef struct alloc_info
46 {
47   ir_graph *graph;
48   ir_node *alloc;
49   ir_type *tp;
50   struct alloc_info *prev;
51 } alloc_info_t;
52
53 typedef struct callEd_info
54 {
55   ir_graph *callEd;
56   struct callEd_info *prev;
57 } callEd_info_t;
58
59 typedef struct call_info
60 {
61   ir_node *call;
62   callEd_info_t *callEds;
63   struct call_info *prev;
64 } call_info_t;
65
66 typedef struct graph_info
67 {
68   ir_graph *graph;
69   call_info_t *calls;
70   alloc_info_t *allocs;
71   ctx_info_t **ctxs;
72   int n_ctxs;
73   int ecg_seen;
74   int allocs_seen;
75   struct graph_info *prev;
76 } graph_info_t;
77
78 typedef void graph_hnd_t  (graph_info_t*, void*);
79 typedef void alloc_hnd_t  (alloc_info_t*, void*);
80 typedef void call_hnd_t   (call_info_t*, void*);
81 typedef void callEd_hnd_t (callEd_info_t*, void*);
82
83 /* protos */
84 void ecg_print_ctx (ctx_info_t*, FILE *stream);
85
86 ctx_info_t *get_ctx (graph_info_t*, int);
87 ctx_info_t *get_main_ctx (void);
88
89 void ecg_iterate_graphs (graph_hnd_t*, void*);
90 void ecg_iterate_allocs (graph_info_t*, alloc_hnd_t*, void*);
91 void ecg_iterate_calls  (graph_info_t*, call_hnd_t*, void*);
92 void ecg_iterate_callEds  (call_info_t*, callEd_hnd_t*, void*);
93
94 graph_info_t *ecg_get_info (ir_graph*);
95 alloc_info_t *ecg_get_alloc_info (ir_graph*);
96 callEd_info_t *ecg_get_callEd_info (ir_node*);
97
98 void ecg_init (int);
99 void ecg_cleanup (void);
100 void ecg_report (void);
101 void ecg_ecg (void);
102
103 #endif /* defined _EGC_H_ */
104
105 \f
106 /*
107 $Log$
108 Revision 1.4  2006/01/13 22:00:15  beck
109 renamed all types 'type' to 'ir_type'
110
111 Revision 1.3  2004/11/20 21:20:29  liekweg
112 Added iterator functions
113
114 Revision 1.2  2004/11/18 16:36:37  liekweg
115 Added unique ids for debugging, added access functions
116
117 Revision 1.1  2004/10/20 14:59:42  liekweg
118 Added ana2, added ecg and pto
119
120 Revision 1.3  2004/10/14 11:31:29  liekweg
121 SHUTUP_GCC
122
123 Revision 1.2  2004/10/12 11:02:03  liekweg
124 wtf?
125
126 Revision 1.1  2004/09/29 12:03:39  liekweg
127 Added ecg mod
128  */