added a bunch of gcc builtins
[smatch.git] / parse.h
blobf43d4311b1ba3c4bbff0baddfe48222c1f795e0c
1 #ifndef PARSE_H
2 #define PARSE_H
3 /*
4 * Basic parsing data structures. Statements and symbols.
6 * Copyright (C) 2003 Transmeta Corp.
7 * 2003 Linus Torvalds
9 * Licensed under the Open Software License version 1.1
12 #include "symbol.h"
14 enum statement_type {
15 STMT_NONE,
16 STMT_DECLARATION,
17 STMT_EXPRESSION,
18 STMT_COMPOUND,
19 STMT_IF,
20 STMT_RETURN,
21 STMT_CASE,
22 STMT_SWITCH,
23 STMT_ITERATOR,
24 STMT_LABEL,
25 STMT_GOTO,
26 STMT_ASM,
27 STMT_CONTEXT,
28 STMT_RANGE,
31 struct statement {
32 enum statement_type type;
33 struct position pos;
34 union {
35 struct /* declaration */ {
36 struct symbol_list *declaration;
38 struct /* label_arg */ {
39 struct symbol *label;
40 struct statement *label_statement;
42 struct {
43 struct expression *expression;
44 struct expression *context;
46 struct /* return_statement */ {
47 struct expression *ret_value;
48 struct symbol *ret_target;
50 struct /* if_statement */ {
51 struct expression *if_conditional;
52 struct statement *if_true;
53 struct statement *if_false;
55 struct /* compound_struct */ {
56 struct statement_list *stmts;
57 struct symbol *ret;
59 struct /* labeled_struct */ {
60 struct symbol *label_identifier;
61 struct statement *label_statement;
63 struct /* case_struct */ {
64 struct expression *case_expression;
65 struct expression *case_to;
66 struct statement *case_statement;
67 struct symbol *case_label;
69 struct /* switch_struct */ {
70 struct expression *switch_expression;
71 struct statement *switch_statement;
72 struct symbol *switch_break, *switch_case;
74 struct /* iterator_struct */ {
75 struct symbol *iterator_break;
76 struct symbol *iterator_continue;
77 struct symbol_list *iterator_syms;
78 struct statement *iterator_pre_statement;
79 struct expression *iterator_pre_condition;
81 struct statement *iterator_statement;
83 struct statement *iterator_post_statement;
84 struct expression *iterator_post_condition;
86 struct /* goto_struct */ {
87 struct symbol *goto_label;
89 /* computed gotos have these: */
90 struct expression *goto_expression;
91 struct symbol_list *target_list;
93 struct /* goto_bb */ {
94 struct expression *bb_conditional;
95 struct symbol *bb_target;
97 struct /* multijmp */ {
98 struct expression *multi_from;
99 struct expression *multi_to;
100 struct symbol *multi_target;
102 struct /* asm */ {
103 struct expression *asm_string;
104 struct expression_list *asm_outputs;
105 struct expression_list *asm_inputs;
106 struct expression_list *asm_clobbers;
108 struct /* range */ {
109 struct expression *range_expression;
110 struct expression *range_low;
111 struct expression *range_high;
116 extern struct symbol_list *function_computed_target_list;
117 extern struct statement_list *function_computed_goto_list;
119 extern struct token *parse_expression(struct token *, struct expression **);
120 extern struct symbol *label_symbol(struct token *token);
122 extern int show_statement(struct statement *);
123 extern void show_statement_list(struct statement_list *, const char *);
124 extern int show_expression(struct expression *);
126 extern struct token *external_declaration(struct token *token, struct symbol_list **list);
128 extern struct symbol *ctype_integer(unsigned long spec);
129 extern struct symbol *ctype_fp(unsigned long spec);
131 extern void copy_statement(struct statement *src, struct statement *dst);
132 extern int inline_function(struct expression *expr, struct symbol *sym);
133 extern void uninline(struct symbol *sym);
135 #endif /* PARSE_H */