4 #include <libfirm/firm_types.h>
13 extern struct obstack ast_obstack;
39 declaration_t *declarations;
43 expresion_type_t type;
45 source_position_t source_position;
49 expression_t expression;
52 long double float_value;
56 struct string_literal_t {
57 expression_t expression;
61 struct builtin_symbol_expression_t {
62 expression_t expression;
66 struct reference_expression_t {
67 expression_t expression;
69 declaration_t *declaration;
72 struct call_argument_t {
73 expression_t *expression;
74 call_argument_t *next;
77 struct call_expression_t {
78 expression_t expression;
79 expression_t *function;
80 call_argument_t *arguments;
87 UNEXPR_BITWISE_NEGATE,
91 UNEXPR_POSTFIX_INCREMENT,
92 UNEXPR_POSTFIX_DECREMENT,
93 UNEXPR_PREFIX_INCREMENT,
94 UNEXPR_PREFIX_DECREMENT,
96 } unary_expression_type_t;
98 struct unary_expression_t {
99 expression_t expression;
100 unary_expression_type_t type;
116 BINEXPR_GREATEREQUAL,
130 BINEXPR_SHIFTLEFT_ASSIGN,
131 BINEXPR_SHIFTRIGHT_ASSIGN,
132 BINEXPR_BITWISE_AND_ASSIGN,
133 BINEXPR_BITWISE_XOR_ASSIGN,
134 BINEXPR_BITWISE_OR_ASSIGN,
136 } binary_expression_type_t;
138 struct binary_expression_t {
139 expression_t expression;
140 binary_expression_type_t type;
145 struct select_expression_t {
146 expression_t expression;
147 expression_t *compound;
150 declaration_t *compound_entry;
153 struct array_access_expression_t {
154 expression_t expression;
155 expression_t *array_ref;
159 struct sizeof_expression_t {
160 expression_t expression;
162 expression_t *size_expression;
165 struct designator_t {
167 expression_t *array_access;
171 struct offsetof_expression_t {
172 expression_t expression;
174 designator_t *designator;
177 struct va_arg_expression_t {
178 expression_t expression;
183 struct conditional_expression_t {
184 expression_t expression;
185 expression_t *condition;
186 expression_t *true_expression;
187 expression_t *false_expression;
190 struct statement_expression_t {
191 expression_t expression;
192 statement_t *statement;
195 struct classify_type_expression_t {
196 expression_t expression;
197 expression_t *type_expression;
202 STORAGE_CLASS_TYPEDEF,
203 STORAGE_CLASS_EXTERN,
204 STORAGE_CLASS_STATIC,
206 STORAGE_CLASS_REGISTER,
207 STORAGE_CLASS_ENUM_ENTRY
223 } initializer_type_t;
225 struct initializer_base_t {
226 initializer_type_t type;
229 struct initializer_value_t {
230 initializer_base_t initializer;
234 struct initializer_list_t {
235 initializer_base_t initializer;
237 initializer_t *initializers[];
240 struct initializer_string_t {
241 initializer_base_t initializer;
245 union initializer_t {
246 initializer_type_t type;
247 initializer_base_t base;
248 initializer_value_t value;
249 initializer_list_t list;
250 initializer_string_t string;
253 struct declaration_t {
254 unsigned char namespc;
255 unsigned char storage_class;
256 unsigned int address_taken : 1;
257 unsigned int is_inline : 1;
260 source_position_t source_position;
263 statement_t *statement;
264 initializer_t *initializer;
265 expression_t *enum_value;
268 context_t *parent_context;
270 /** next declaration in a context */
272 /** next declaration with same symbol */
273 declaration_t *symbol_next;
275 unsigned char declaration_type; /* used in ast2firm module */
277 unsigned int value_number; /* used in ast2firm module */
278 ir_entity *entity; /* used in ast2firm module */
279 ir_node *block; /* used in ast2firm module */
280 tarval *enum_val; /* used in ast2firm module */
288 STATEMENT_DECLARATION,
291 STATEMENT_EXPRESSION,
296 STATEMENT_CASE_LABEL,
303 statement_type_t type;
305 source_position_t source_position;
308 struct return_statement_t {
309 statement_t statement;
310 expression_t *return_value;
313 struct compound_statement_t {
314 statement_t statement;
315 statement_t *statements;
319 struct declaration_statement_t {
320 statement_t statement;
321 declaration_t *declarations_begin;
322 declaration_t *declarations_end;
325 struct if_statement_t {
326 statement_t statement;
327 expression_t *condition;
328 statement_t *true_statement;
329 statement_t *false_statement;
332 struct switch_statement_t {
333 statement_t statement;
334 expression_t *expression;
338 struct goto_statement_t {
339 statement_t statement;
340 declaration_t *label;
343 struct case_label_statement_t {
344 statement_t statement;
345 expression_t *expression;
346 statement_t *label_statement;
349 struct label_statement_t {
350 statement_t statement;
351 declaration_t *label;
352 statement_t *label_statement;
355 struct expression_statement_t {
356 statement_t statement;
357 expression_t *expression;
360 struct while_statement_t {
361 statement_t statement;
362 expression_t *condition;
366 struct do_while_statement_t {
367 statement_t statement;
368 expression_t *condition;
372 struct for_statement_t {
373 statement_t statement;
374 expression_t *initialisation;
375 expression_t *condition;
381 struct translation_unit_t {
386 void *_allocate_ast(size_t size)
388 return obstack_alloc(&ast_obstack, size);
391 #define allocate_ast(size) _allocate_ast(size)