4 #include <libfirm/firm_types.h>
12 extern struct obstack ast_obstack;
36 declaration_t *declarations;
40 expresion_type_t type;
42 source_position_t source_position;
46 expression_t expression;
49 long double float_value;
53 struct string_literal_t {
54 expression_t expression;
58 struct builtin_symbol_expression_t {
59 expression_t expression;
63 struct reference_expression_t {
64 expression_t expression;
66 declaration_t *declaration;
69 struct call_argument_t {
70 expression_t *expression;
71 call_argument_t *next;
74 struct call_expression_t {
75 expression_t expression;
76 expression_t *function;
77 call_argument_t *arguments;
84 UNEXPR_BITWISE_NEGATE,
88 UNEXPR_POSTFIX_INCREMENT,
89 UNEXPR_POSTFIX_DECREMENT,
90 UNEXPR_PREFIX_INCREMENT,
91 UNEXPR_PREFIX_DECREMENT,
93 } unary_expression_type_t;
95 struct unary_expression_t {
96 expression_t expression;
97 unary_expression_type_t type;
113 BINEXPR_GREATEREQUAL,
127 BINEXPR_SHIFTLEFT_ASSIGN,
128 BINEXPR_SHIFTRIGHT_ASSIGN,
129 BINEXPR_BITWISE_AND_ASSIGN,
130 BINEXPR_BITWISE_XOR_ASSIGN,
131 BINEXPR_BITWISE_OR_ASSIGN,
133 } binary_expression_type_t;
135 struct binary_expression_t {
136 expression_t expression;
137 binary_expression_type_t type;
142 struct select_expression_t {
143 expression_t expression;
144 expression_t *compound;
147 declaration_t *compound_entry;
150 struct array_access_expression_t {
151 expression_t expression;
152 expression_t *array_ref;
156 struct sizeof_expression_t {
157 expression_t expression;
159 expression_t *size_expression;
162 struct designator_t {
164 expression_t *array_access;
168 struct offsetof_expression_t {
169 expression_t expression;
171 designator_t *designator;
174 struct va_arg_expression_t {
175 expression_t expression;
180 struct conditional_expression_t {
181 expression_t expression;
182 expression_t *condition;
183 expression_t *true_expression;
184 expression_t *false_expression;
187 struct statement_expression_t {
188 expression_t expression;
189 statement_t *statement;
194 STORAGE_CLASS_TYPEDEF,
195 STORAGE_CLASS_EXTERN,
196 STORAGE_CLASS_STATIC,
198 STORAGE_CLASS_REGISTER,
199 STORAGE_CLASS_ENUM_ENTRY
213 } initializer_type_t;
215 struct initializer_t {
216 initializer_type_t type;
217 designator_t *designator;
225 struct declaration_t {
226 unsigned char namespace;
227 unsigned char storage_class;
228 unsigned int address_taken : 1;
229 unsigned int is_inline : 1;
232 source_position_t source_position;
235 statement_t *statement;
236 initializer_t *initializer;
239 context_t *parent_context;
241 /** next declaration in a context */
243 /** next declaration with same symbol */
244 declaration_t *symbol_next;
246 unsigned char declaration_type; /* used in ast2firm module */
248 unsigned int value_number; /* used in ast2firm module */
249 ir_entity *entity; /* used in ast2firm module */
250 ir_node *block; /* used in ast2firm module */
258 STATEMENT_DECLARATION,
261 STATEMENT_EXPRESSION,
266 STATEMENT_CASE_LABEL,
273 statement_type_t type;
275 source_position_t source_position;
278 struct return_statement_t {
279 statement_t statement;
280 expression_t *return_value;
283 struct compound_statement_t {
284 statement_t statement;
285 statement_t *statements;
289 struct declaration_statement_t {
290 statement_t statement;
291 declaration_t *declarations_begin;
292 declaration_t *declarations_end;
295 struct if_statement_t {
296 statement_t statement;
297 expression_t *condition;
298 statement_t *true_statement;
299 statement_t *false_statement;
302 struct switch_statement_t {
303 statement_t statement;
304 expression_t *expression;
308 struct goto_statement_t {
309 statement_t statement;
310 declaration_t *label;
313 struct case_label_statement_t {
314 statement_t statement;
315 expression_t *expression;
318 struct label_statement_t {
319 statement_t statement;
320 declaration_t *label;
321 statement_t *label_statement;
324 struct expression_statement_t {
325 statement_t statement;
326 expression_t *expression;
329 struct while_statement_t {
330 statement_t statement;
331 expression_t *condition;
335 struct do_while_statement_t {
336 statement_t statement;
337 expression_t *condition;
341 struct for_statement_t {
342 statement_t statement;
343 expression_t *initialisation;
344 expression_t *condition;
350 struct translation_unit_t {
355 void *_allocate_ast(size_t size)
357 return obstack_alloc(&ast_obstack, size);
360 #define allocate_ast(size) _allocate_ast(size)