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;
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
212 } initializer_type_t;
214 struct initializer_t {
215 initializer_type_t type;
216 designator_t *designator;
224 struct declaration_t {
225 unsigned short namespace;
226 unsigned short storage_class;
229 source_position_t source_position;
232 statement_t *statement;
233 initializer_t *initializer;
236 context_t *parent_context;
238 /** next declaration in a context */
239 declaration_t *context_next;
240 /** next declaration with same symbol */
250 STATEMENT_DECLARATION,
253 STATEMENT_EXPRESSION,
258 STATEMENT_CASE_LABEL,
265 statement_type_t type;
267 source_position_t source_position;
270 struct return_statement_t {
271 statement_t statement;
272 expression_t *return_value;
275 struct compound_statement_t {
276 statement_t statement;
277 statement_t *statements;
281 struct declaration_statement_t {
282 statement_t statement;
283 declaration_t *declarations_begin;
284 declaration_t *declarations_end;
286 int value_number; /**< filled in by semantic phase */
290 struct if_statement_t {
291 statement_t statement;
292 expression_t *condition;
293 statement_t *true_statement;
294 statement_t *false_statement;
297 struct switch_statement_t {
298 statement_t statement;
299 expression_t *expression;
303 struct goto_statement_t {
304 statement_t statement;
305 symbol_t *label_symbol;
306 label_statement_t *label;
309 struct case_label_statement_t {
310 statement_t statement;
311 expression_t *expression;
314 struct label_statement_t {
315 statement_t statement;
319 struct expression_statement_t {
320 statement_t statement;
321 expression_t *expression;
324 struct while_statement_t {
325 statement_t statement;
326 expression_t *condition;
330 struct do_while_statement_t {
331 statement_t statement;
332 expression_t *condition;
336 struct for_statement_t {
337 statement_t statement;
338 expression_t *initialisation;
339 expression_t *condition;
345 struct translation_unit_t {
350 void *_allocate_ast(size_t size)
352 return obstack_alloc(&ast_obstack, size);
355 #define allocate_ast(size) _allocate_ast(size)