2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 /* $Id: l_state.str,v 1.3 1994/06/27 08:01:10 ceriel Exp $ */
8 /* These datastructures are used to implement a stack on which the
9 * state of automatic variables (including register variables) is
11 * In this way it is possible to account for the flow of
12 * control of the program.
15 #define TEST_VAR 0 /* not a constant */
16 #define TEST_TRUE 1 /* always true */
17 #define TEST_FALSE 2 /* always false */
19 struct loop_state { /* used in lint_end_state only */
20 int lps_test; /* is the test a constant? */
21 struct state *lps_body;
22 struct state *lps_loop;
25 struct switch_state { /* used in lint_end_state only */
26 struct state *sws_case;
27 struct state *sws_break;
31 /* This union describes the (possibly incomplete) state at the end of the
34 union lint_end_state { /* used in lint_stack_entry only */
36 struct loop_state ule_loop;
37 struct switch_state ule_switch;
40 struct lint_stack_entry {
41 struct lint_stack_entry *next;
42 struct lint_stack_entry *ls_previous;
44 struct state *ls_current; /* used by all classes */
45 short ls_class; /* IF, WHILE, DO, FOR, SWITCH, CASE */
46 union lint_end_state ls_end;
49 /* ALLOCDEF "lint_stack_entry" 10 */
51 /* macros to access the union */
52 #define LS_IF ls_end.ule_if
53 #define LS_TEST ls_end.ule_loop.lps_test
54 #define LS_BODY ls_end.ule_loop.lps_body
55 #define LS_LOOP ls_end.ule_loop.lps_loop
56 #define LS_CASE ls_end.ule_switch.sws_case
57 #define LS_BREAK ls_end.ule_switch.sws_break
58 #define LS_DEFAULT_MET ls_end.ule_switch.sws_default_met
60 /* describes a branch in the program, with its local idfs */
62 struct state *next; /* only used by memory allocator */
63 struct auto_def *st_auto_list;
64 int st_notreached; /* set if not reached */
65 int st_warned; /* set if warning issued */
68 /* ALLOCDEF "state" 15 */
70 /* describes the state of a local idf in a given branch of the program */
72 struct auto_def *next;
80 /* ALLOCDEF "auto_def" 20 */
82 /* describes the state of an idf during expression evaluation */
83 struct expr_state { /*actually concerns idfs only */
84 struct expr_state *next;
85 struct idf *es_idf; /* the idf with its offset */
87 int es_used; /* value has been used */
88 int es_referred; /* address has been taken */
89 int es_set; /* has been assigned to */
92 /* ALLOCDEF "expr_state" 20 */