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