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