xref: /openbsd/gnu/usr.bin/gcc/gcc/f/stw.h (revision c87b03e5)
1 /* stw.h -- Private #include File (module.h template V1.0)
2    Copyright (C) 1995 Free Software Foundation, Inc.
3    Contributed by James Craig Burley.
4 
5 This file is part of GNU Fortran.
6 
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11 
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 
22    Owning Modules:
23       stw.c
24 
25    Modifications:
26 */
27 
28 /* Allow multiple inclusion to work. */
29 
30 #ifndef GCC_F_STW_H
31 #define GCC_F_STW_H
32 
33 /* Simple definitions and enumerations. */
34 
35 
36 /* Typedefs. */
37 
38 typedef struct _ffestw_ *ffestw;
39 typedef struct _ffestw_case_ *ffestwCase;
40 typedef struct _ffestw_select_ *ffestwSelect;
41 typedef void (*ffestwShriek) (bool ok);
42 
43 /* Include files needed by this one. */
44 
45 #include "bld.h"
46 #include "com.h"
47 #include "info.h"
48 #include "lab.h"
49 #include "lex.h"
50 #include "malloc.h"
51 #include "stv.h"
52 #include "symbol.h"
53 #include "where.h"
54 
55 /* Structure definitions. */
56 
57 struct _ffestw_
58   {
59     ffestw next_;		/* Next (unused) block, or NULL. */
60     ffestw previous_;		/* Previous block, NULL if this is NIL state. */
61     ffestw top_do_;		/* Previous or current DO state, or NULL. */
62     unsigned long blocknum_;	/* Block # w/in procedure/program. */
63     ffestwShriek shriek_;	/* Call me to pop block in a hurry. */
64     ffesymbol sym_;		/* Related symbol (if there is one). */
65     ffelexToken name_;		/* Construct name (IFTHEN, SELECT, DO only). */
66     ffestwSelect select_;	/* Info for SELECT CASE blocks. */
67     ffelab label_;		/* For DO blocks w/labels, the target label. */
68     ffesymbol do_iter_var_;	/* For iter DO blocks, the iter var or NULL. */
69     ffelexToken do_iter_var_t_;	/* The token for do_iter_var. */
70     ffewhereLine line_;		/* Where first token of statement triggering
71 				   state */
72     ffewhereColumn col_;	/* was seen in source file. */
73     int uses_;			/* # uses (new+use-kill calls). */
74     ffestvState state_;
75     int substate_;		/* Used on a per-block-state basis. */
76     struct nesting *do_hook_;	/* backend id for given loop (EXIT/CYCLE). */
77     tree do_tvar_;		/* tree form of do_iter_var. */
78     tree do_incr_saved_;	/* tree SAVED_EXPR of incr expr. */
79     tree do_count_var_;		/* tree of countdown variable. */
80     tree select_texpr_;		/* tree for end case. */
81     bool select_break_;		/* TRUE when CASE should start with gen
82 				   "break;". */
83     int ifthen_fake_else_;	/* Number of fake `else' introductions.  */
84   };
85 
86 struct _ffestw_case_
87   {
88     ffestwCase next_rel;	/* Next case range in relational order. */
89     ffestwCase previous_rel;	/* Previous case range in relational order. */
90     ffestwCase next_stmt;	/* Next range in stmt or first in next stmt. */
91     ffestwCase previous_stmt;	/* Previous range. */
92     ffebldConstant low;		/* Low value in range. */
93     ffebldConstant high;	/* High value in range. */
94     unsigned long casenum;	/* CASE stmt index for this range/value. */
95     ffelexToken t;		/* Token for this range/value; ffestc only. */
96   };
97 
98 struct _ffestw_select_
99   {
100     ffestwCase first_rel;	/* First CASE range (after low) in order. */
101     ffestwCase last_rel;	/* Last CASE range (before high) in order. */
102     ffestwCase first_stmt;	/* First range in first CASE stmt. */
103     ffestwCase last_stmt;	/* Last range in last CASE stmt. */
104     mallocPool pool;		/* Pool in which this and all cases are
105 				   allocated. */
106     unsigned long cases;	/* Number of CASE stmts seen so far. */
107     ffelexToken t;		/* First token of selected expression; ffestc
108 				   only. */
109     ffeinfoBasictype type;	/* Basic type (integer, character, or
110 				   logical). */
111     ffeinfoKindtype kindtype;	/* Kind type. */
112   };
113 
114 /* Global objects accessed by users of this module. */
115 
116 extern ffestw ffestw_stack_top_;
117 
118 /* Declare functions with prototypes. */
119 
120 void ffestw_display_state (void);
121 void ffestw_kill (ffestw block);
122 void ffestw_init_0 (void);
123 ffestw ffestw_new (void);
124 ffestw ffestw_pop (void);
125 ffestw ffestw_push (ffestw block);
126 ffestw ffestw_update (ffestw block);
127 ffestw ffestw_use (ffestw block);
128 
129 /* Define macros. */
130 
131 #define ffestw_blocknum(b) ((b)->blocknum_)
132 #define ffestw_col(b) ((b)->col_)
133 #define ffestw_do_count_var(b) ((b)->do_count_var_)
134 #define ffestw_do_hook(b) ((b)->do_hook_)
135 #define ffestw_do_incr_saved(b) ((b)->do_incr_saved_)
136 #define ffestw_do_iter_var(b) ((b)->do_iter_var_)
137 #define ffestw_do_iter_var_t(b) ((b)->do_iter_var_t_)
138 #define ffestw_do_tvar(b) ((b)->do_tvar_)
139 #define ffestw_ifthen_fake_else(b) ((b)->ifthen_fake_else_)
140 #define ffestw_init_1()
141 #define ffestw_init_2()
142 #define ffestw_init_3()
143 #define ffestw_init_4()
144 #define ffestw_label(b) ((b)->label_)
145 #define ffestw_line(b) ((b)->line_)
146 #define ffestw_name(b) ((b)->name_)
147 #define ffestw_previous(b) ((b)->previous_)
148 #define ffestw_select(b) ((b)->select_)
149 #define ffestw_select_break(b) ((b)->select_break_)
150 #define ffestw_select_texpr(b) ((b)->select_texpr_)
151 #define ffestw_set_blocknum(b,bl) ((b)->blocknum_ = (bl))
152 #define ffestw_set_col(b,c) ((b)->col_ = (c))
153 #define ffestw_set_do_count_var(b,d) ((b)->do_count_var_ = (d))
154 #define ffestw_set_do_hook(b,d) ((b)->do_hook_ = (d))
155 #define ffestw_set_do_incr_saved(b,d) ((b)->do_incr_saved_ = (d))
156 #define ffestw_set_do_iter_var(b,v) ((b)->do_iter_var_ = (v))
157 #define ffestw_set_do_iter_var_t(b,t) ((b)->do_iter_var_t_ = (t))
158 #define ffestw_set_do_tvar(b,d) ((b)->do_tvar_ = (d))
159 #define ffestw_set_ifthen_fake_else(b,e) ((b)->ifthen_fake_else_ = (e))
160 #define ffestw_set_label(b,l) ((b)->label_ = (l))
161 #define ffestw_set_line(b,l) ((b)->line_ = (l))
162 #define ffestw_set_name(b,n) ((b)->name_ = (n))
163 #define ffestw_set_select(b,s) ((b)->select_ = (s))
164 #define ffestw_set_select_break(b,br) ((b)->select_break_ = (br))
165 #define ffestw_set_select_texpr(b,t) ((b)->select_texpr_ = (t))
166 #define ffestw_set_shriek(b,s) ((b)->shriek_ = (s))
167 #define ffestw_set_state(b,s) ((b)->state_ = (s))
168 #define ffestw_set_substate(b,s) ((b)->substate_ = (s))
169 #define ffestw_set_sym(b,s) ((b)->sym_= (s))
170 #define ffestw_set_top_do(b,t) ((b)->top_do_ = (t))
171 #define ffestw_shriek(b) ((b)->shriek_)
172 #define ffestw_stack_top() ffestw_stack_top_
173 #define ffestw_state(b) ((b)->state_)
174 #define ffestw_substate(b) ((b)->substate_)
175 #define ffestw_sym(b) ((b)->sym_)
176 #define ffestw_terminate_0()
177 #define ffestw_terminate_1()
178 #define ffestw_terminate_2()
179 #define ffestw_terminate_3()
180 #define ffestw_terminate_4()
181 #define ffestw_top_do(b) ((b)->top_do_)
182 
183 /* End of #include file. */
184 
185 #endif /* ! GCC_F_STW_H */
186