198846a95c99ee910e70cf666aa3f8ec879b1dbf
[libfirm] / ir / ana2 / ecg.h
1 /* -*- c -*- */
2
3 #ifndef _EGC_H_
4 #define _EGC_H_
5
6 # include "irgraph.h"
7 # include "irnode.h"
8
9 /*
10   data
11 */
12
13 typedef struct ctx_info
14 {
15   ir_graph *graph;              /* The graph of the callR who created this ctx */
16   /* (which is redundant, since it's always == get_irn_graph (call)  */
17   ir_node *call;                /* The call through which this graph was called */
18   struct ctx_info *enc;         /* The ctx in which our callR was called */
19   int id;
20 } ctx_info_t;
21
22 typedef struct alloc_info
23 {
24   ir_graph *graph;
25   ir_node *alloc;
26   type *tp;
27   struct alloc_info *prev;
28 } alloc_info_t;
29
30 typedef struct callEd_info
31 {
32   ir_graph *callEd;
33   struct callEd_info *prev;
34 } callEd_info_t;
35
36 typedef struct call_info
37 {
38   ir_node *call;
39   callEd_info_t *callEds;
40   struct call_info *prev;
41 } call_info_t;
42
43 typedef struct graph_info
44 {
45   ir_graph *graph;
46   call_info_t *calls;
47   alloc_info_t *allocs;
48   ctx_info_t **ctxs;
49   int n_ctxs;
50   int ecg_seen;
51   int allocs_seen;
52   struct graph_info *prev;
53 } graph_info_t;
54
55 typedef void graph_hnd_t  (graph_info_t*, void*);
56 typedef void alloc_hnd_t  (alloc_info_t*, void*);
57 typedef void call_hnd_t   (call_info_t*, void*);
58 typedef void callEd_hnd_t (callEd_info_t*, void*);
59
60 /* protos */
61 void ecg_print_ctx (ctx_info_t*, FILE *stream);
62
63 ctx_info_t *get_ctx (graph_info_t*, int);
64 ctx_info_t *get_main_ctx (void);
65
66 void ecg_iterate_graphs (graph_hnd_t*, void*);
67 void ecg_iterate_allocs (graph_info_t*, alloc_hnd_t*, void*);
68 void ecg_iterate_calls  (graph_info_t*, call_hnd_t*, void*);
69 void ecg_iterate_callEds  (call_info_t*, callEd_hnd_t*, void*);
70
71 graph_info_t *ecg_get_info (ir_graph*);
72 alloc_info_t *ecg_get_alloc_info (ir_graph*);
73 callEd_info_t *ecg_get_callEd_info (ir_node*);
74
75 void ecg_init (int);
76 void ecg_cleanup (void);
77 void ecg_report (void);
78 void ecg_ecg (void);
79
80 #endif /* defined _EGC_H_ */
81
82 \f
83 /*
84 $Log$
85 Revision 1.3  2004/11/20 21:20:29  liekweg
86 Added iterator functions
87
88 Revision 1.2  2004/11/18 16:36:37  liekweg
89 Added unique ids for debugging, added access functions
90
91 Revision 1.1  2004/10/20 14:59:42  liekweg
92 Added ana2, added ecg and pto
93
94 Revision 1.3  2004/10/14 11:31:29  liekweg
95 SHUTUP_GCC
96
97 Revision 1.2  2004/10/12 11:02:03  liekweg
98 wtf?
99
100 Revision 1.1  2004/09/29 12:03:39  liekweg
101 Added ecg mod
102  */