[be] In assignments, don't perform a mem->mem copy (two mov's) when
[smatch.git] / parse.h
blobcfc6a08f9854aa63970919e7eab275deee7fbef2
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,
28 struct statement {
29 enum statement_type type;
30 struct position pos;
31 union {
32 struct /* label_arg */ {
33 struct symbol *label;
34 struct statement *label_statement;
36 struct expression *expression;
37 struct /* return_statement */ {
38 struct expression *ret_value;
39 struct symbol *ret_target;
41 struct /* if_statement */ {
42 struct expression *if_conditional;
43 struct statement *if_true;
44 struct statement *if_false;
46 struct /* compound_struct */ {
47 struct symbol_list *syms;
48 struct statement_list *stmts;
49 struct symbol *ret;
51 struct /* labeled_struct */ {
52 struct symbol *label_identifier;
53 struct statement *label_statement;
55 struct /* case_struct */ {
56 struct expression *case_expression;
57 struct expression *case_to;
58 struct statement *case_statement;
59 struct symbol *case_label;
61 struct /* switch_struct */ {
62 struct expression *switch_expression;
63 struct statement *switch_statement;
64 struct symbol *switch_break, *switch_case;
66 struct /* iterator_struct */ {
67 struct symbol *iterator_break;
68 struct symbol *iterator_continue;
69 struct symbol_list *iterator_syms;
70 struct statement *iterator_pre_statement;
71 struct expression *iterator_pre_condition;
73 struct statement *iterator_statement;
75 struct statement *iterator_post_statement;
76 struct expression *iterator_post_condition;
78 struct /* goto_struct */ {
79 struct symbol *goto_label;
80 struct expression *goto_expression;
85 extern struct token *parse_expression(struct token *, struct expression **);
86 extern struct token *statement_list(struct token *, struct statement_list **);
87 extern struct symbol *label_symbol(struct token *token);
89 extern int show_statement(struct statement *);
90 extern void show_statement_list(struct statement_list *, const char *);
91 extern int show_expression(struct expression *);
92 extern void translation_unit(struct token *, struct symbol_list **);
94 extern struct symbol *ctype_integer(unsigned int spec);
95 extern struct symbol *ctype_fp(unsigned int spec);
97 extern int match_string_ident(struct ident *, const char *);
98 extern void copy_statement(struct statement *src, struct statement *dst);
99 extern int inline_function(struct expression *expr, struct symbol *sym);
101 #endif /* PARSE_H */