added reg pressure statistic hook
[libfirm] / ir / external / read_t.h
1 /* -*- c -*- */
2 /*
3  * Project:     libFIRM
4  * File name:   ir/external/read.h
5  * Purpose:     Read descriptions of external effects
6  * Author:      Florian
7  * Modified by: Boris Boesler
8  * Created:     11.10.2004
9  * CVS-ID:      $Id$
10  * Copyright:   (c) 1999-2004 Universität Karlsruhe
11  * Licence:     This file is protected by GPL -  GNU GENERAL PUBLIC LICENSE.
12  */
13
14 #ifndef _READ_T_H_
15 #define _READ_T_H_
16
17 #include "type.h"
18 #include "entity.h"
19 #include "ident.h"
20
21 /* first, the xml structures */
22
23 typedef struct type_str
24 {
25   const ident *type_ident;
26   const ident *id;              /* id for references */
27   type *f_tp;                   /* firm type */
28   struct type_str *prev;
29 } type_t;
30
31 typedef struct entity_str
32 {
33   const ident *ent_ident;        /* name of entity */
34   const ident *tp_ident;         /* name of type/class */
35   const ident *id;               /* id for references */
36   const ident *owner;            /* id of owner */
37   entity *f_ent;                 /* firm entity */
38   struct entity_str *prev;
39 } entity_t;
40
41 /* now the xml nodes */
42 typedef enum eff_node_kind {
43   eff_arg,      // done
44   eff_valref,   // eliminated
45   eff_select,   // eliminated
46   eff_load,     // done
47   eff_store,    // done
48   eff_alloc,    // done
49   eff_call,     // done
50   eff_unknown,  // done
51   eff_join,     // TODO
52   eff_raise,    // TODO
53   eff_ret       // done
54 } eff_node_kind_t;
55
56
57 typedef struct arg_str
58 {
59   const ident *type_ident;
60   int num;
61 } arg_t;
62
63 typedef struct valref_str
64 {
65   int dummy;
66 } valref_t;
67
68 typedef struct select_str
69 {
70   entity_t *ent;
71 } select_t;
72
73 typedef struct load_str
74 {
75   const ident *ptrrefid;     /* id of valref node enclosed in select, or -1 */
76   entity_t *ent;
77 } load_t;
78
79 typedef struct store_str
80 {
81   const ident *ptrrefid;     /* id of ptr valref node enclosed in select, or -1 */
82   const ident *valrefid;     /* id of val valref node enclosed in select, or -1 */
83   entity_t *ent;
84 } store_t;
85
86 typedef struct alloc_str
87 {
88   const ident *tp_id;
89 } alloc_t;
90
91 typedef struct call_str
92 {
93   const ident *valrefid;     /* id of enclosed valref node, or -1 */
94   entity_t *ent;             /* called entity */
95   int n_args;
96   const ident **args;
97 } call_t;
98
99 typedef struct unknown_str
100 {
101   int dummy;
102 } unknown_t;
103
104 typedef struct join_str
105 {
106   int n_ins;
107   const ident **ins;
108 } join_t;
109
110 typedef struct ret_str
111 {
112   const ident *ret_id;
113 } ret_t;                     /* returned value, or NO_ID */
114
115 typedef struct raise_str
116 {
117   const ident *valref;       /* what was that one for? */
118   const ident *tp_id;
119 } raise_t;
120
121 /* dummy type for all other effects */
122 typedef struct eff_str
123 {
124   eff_node_kind_t kind;
125   const ident *id;           /* identifier to access this node */
126   union {
127     arg_t arg;
128     valref_t valref;
129     select_t select;
130     load_t load;
131     store_t store;
132     alloc_t alloc;
133     call_t call;
134     unknown_t unknown;
135     join_t join;
136     ret_t ret;
137     raise_t raise;
138   } effect;
139   ir_node *firmnode;
140   struct eff_str *next; /* effects with values are stored in proc.values */
141 } eff_t;
142
143 typedef struct proc_str
144 {
145   const ident *proc_ident;   /* name of procedure */
146   const ident *ownerid;
147   int n_effs;
148   eff_t **effs;
149   struct proc_str *next;
150   eff_t *values;             /* @@@ TODO hash set */
151 } proc_t;
152
153
154 typedef struct mod_str
155 {
156   const ident *id;
157   type_t *types;             /* types in module *//* @@@ TODO hash set */
158   entity_t *entities;        /* entities in module *//* @@@ TODO hash set */
159   proc_t *procs;             /* methods with effects */
160   struct mod_str *next;      /* unused - only one module possible */
161 } module_t;
162
163
164 #endif /* defined _READ_T_H_ */
165
166 /*
167   $Log$
168   Revision 1.2  2004/12/10 15:14:16  beck
169   Removed unused header files
170   move xml macros to read.c, freeing the header from libxml depency
171
172   Revision 1.1  2004/10/25 13:52:24  boesler
173   seperated read.h (public interface) and read_t.h (types)
174
175   Revision 1.6  2004/10/22 13:13:27  boesler
176   replaced char* by idents, minor fix in Firm codegen for call
177
178   Revision 1.5  2004/10/21 15:31:55  boesler
179   added lots of stuff:
180   - build abstract syntax trees
181   - build Firm graphs for many effects, still todos
182
183   Revision 1.1  2004/10/11 09:31:06  liekweg
184   First Import of XML reading procs --flo
185
186 */