Make the "entrypoint" be a special OP_ENTRY instruction instead of
[smatch.git] / parse.h
blob6fe25f5c34cae6a23ec3710fbb82a6c57242d510
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_EXPRESSION,
17 STMT_COMPOUND,
18 STMT_IF,
19 STMT_RETURN,
20 STMT_CASE,
21 STMT_SWITCH,
22 STMT_ITERATOR,
23 STMT_LABEL,
24 STMT_GOTO,
25 STMT_ASM,
26 STMT_INTERNAL,
29 struct statement {
30 enum statement_type type;
31 struct position pos;
32 union {
33 struct /* label_arg */ {
34 struct symbol *label;
35 struct statement *label_statement;
37 struct expression *expression;
38 struct /* return_statement */ {
39 struct expression *ret_value;
40 struct symbol *ret_target;
42 struct /* if_statement */ {
43 struct expression *if_conditional;
44 struct statement *if_true;
45 struct statement *if_false;
47 struct /* compound_struct */ {
48 struct symbol_list *syms;
49 struct statement_list *stmts;
50 struct symbol *ret;
52 struct /* labeled_struct */ {
53 struct symbol *label_identifier;
54 struct statement *label_statement;
56 struct /* case_struct */ {
57 struct expression *case_expression;
58 struct expression *case_to;
59 struct statement *case_statement;
60 struct symbol *case_label;
62 struct /* switch_struct */ {
63 struct expression *switch_expression;
64 struct statement *switch_statement;
65 struct symbol *switch_break, *switch_case;
67 struct /* iterator_struct */ {
68 struct symbol *iterator_break;
69 struct symbol *iterator_continue;
70 struct symbol_list *iterator_syms;
71 struct statement *iterator_pre_statement;
72 struct expression *iterator_pre_condition;
74 struct statement *iterator_statement;
76 struct statement *iterator_post_statement;
77 struct expression *iterator_post_condition;
79 struct /* goto_struct */ {
80 struct symbol *goto_label;
82 /* computed gotos have these: */
83 struct expression *goto_expression;
84 struct symbol_list *target_list;
86 struct /* goto_bb */ {
87 struct expression *bb_conditional;
88 struct symbol *bb_target;
90 struct /* multijmp */ {
91 struct expression *multi_from;
92 struct expression *multi_to;
93 struct symbol *multi_target;
98 extern struct symbol_list *function_computed_target_list;
99 extern struct statement_list *function_computed_goto_list;
101 extern struct token *parse_expression(struct token *, struct expression **);
102 extern struct symbol *label_symbol(struct token *token);
104 extern int show_statement(struct statement *);
105 extern void show_statement_list(struct statement_list *, const char *);
106 extern int show_expression(struct expression *);
107 extern struct symbol_list *translation_unit(struct token *);
109 extern struct symbol *ctype_integer(unsigned long spec);
110 extern struct symbol *ctype_fp(unsigned long spec);
112 extern void copy_statement(struct statement *src, struct statement *dst);
113 extern int inline_function(struct expression *expr, struct symbol *sym);
114 extern void uninline(struct symbol *sym);
116 #endif /* PARSE_H */