Mention KTR_IFQ and KTR_IF_START
[dragonfly.git] / contrib / gcc-3.4 / gcc / f / symbol.h
blob7ddafbd446dd650ef36486cdccc049d35b2b263c
1 /* Interface definitions for Fortran symbol manager
2 Copyright (C) 1995, 1996, 2003 Free Software Foundation, Inc.
3 Contributed by James Craig Burley.
5 This file is part of GNU Fortran.
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.
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.
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. */
22 #ifndef GCC_F_SYMBOL_H
23 #define GCC_F_SYMBOL_H
25 /* The main symbol type. */
27 typedef struct _ffesymbol_ *ffesymbol;
29 /* State of understanding about what the symbol represents. */
31 enum _ffesymbol_state_
33 /* See ffesymbol_state_is_exec() macro below when making changes. */
34 FFESYMBOL_stateNONE, /* Never before seen. */
35 FFESYMBOL_stateSEEN, /* Seen before exec transition and not yet
36 understood (info not filled in, etc). */
37 FFESYMBOL_stateUNCERTAIN, /* Almost understood (info partly filled in). */
38 FFESYMBOL_stateUNDERSTOOD, /* Fully understood (info filled in). */
39 FFESYMBOL_state
41 typedef enum _ffesymbol_state_ ffesymbolState;
42 #define ffesymbolState_f ""
44 /* Attributes. Symbols acquire attributes while their state is SEEN.
45 These attributes are basically ignored once the symbol becomes
46 UNDERSTOOD. */
48 typedef long int ffesymbolAttrs;/* Holds set of attributes. */
49 #define ffesymbolAttrs_f "l"
51 enum _ffesymbol_attr_
53 #define DEFATTR(ATTR,ATTRS,NAME) ATTR,
54 #include "symbol.def"
55 #undef DEFATTR
56 FFESYMBOL_attr
57 }; /* A given attribute. */
58 typedef enum _ffesymbol_attr_ ffesymbolAttr;
59 #define ffesymbolAttr_f ""
61 #define FFESYMBOL_attrsetNONE 0
62 #define FFESYMBOL_attrsetALL (((ffesymbolAttrs) 1 << FFESYMBOL_attr) - 1)
64 /* This is just for avoiding complaining about, e.g., "I = IABS(3)", that
65 IABS doesn't meet the requirements for a user-defined symbol name as
66 a result of, say, --symbol-case-lower, if IABS turns out to indeed be
67 a reference to the intrinsic IABS (in which case it's a Fortran keyword
68 like CALL) and not a user-defined name. */
70 enum _ffesymbol_checkstate_
72 FFESYMBOL_checkstateNONE_, /* Not checked/never necessary to check. */
73 FFESYMBOL_checkstateINHIBITED_, /* Bad name, but inhibited. */
74 FFESYMBOL_checkstatePENDING_, /* Bad name, might be intrinsic. */
75 FFESYMBOL_checkstateCHECKED_, /* Ok name, intrinsic, or bad name
76 reported. */
77 FFESYMBOL_checkstate_
79 typedef enum _ffesymbol_checkstate_ ffesymbolCheckState_;
80 #define ffesymbolCheckState_f_ ""
82 #include "bld.h"
83 #include "com.h"
84 #include "equiv.h"
85 #include "global.h"
86 #include "info.h"
87 #include "intrin.h"
88 #include "lex.h"
89 #include "malloc.h"
90 #include "name.h"
91 #include "storag.h"
92 #include "target.h"
93 #include "top.h"
94 #include "where.h"
96 struct _ffesymbol_
98 ffename name;
99 ffename other_space_name; /* For dual-space objects. */
100 ffeglobal global; /* In filewide name space. */
101 ffesymbolAttrs attrs; /* What kind of symbol am I? */
102 ffesymbolState state; /* What state am I in? */
103 ffeinfo info; /* Info filled in when _stateUNDERSTOOD. */
104 ffebld dims; /* Dimension list expression. */
105 ffebld extents; /* Extents list expression. */
106 ffebld dim_syms; /* List of SYMTERs of all symbols in dims. */
107 ffebld array_size; /* Size as an expression involving some of
108 dims. */
109 ffebld init; /* Initialization expression or expr list or
110 PARAMETER value. */
111 ffebld accretion; /* Initializations seen so far for
112 array/substr. */
113 ffetargetOffset accretes; /* # inits needed to fill entire array. */
114 ffebld dummy_args; /* For functions, subroutines, and entry
115 points. */
116 ffebld namelist; /* List of symbols in NML. */
117 ffebld common_list; /* List of entities in BCB/NCB. */
118 ffebld sfunc_expr; /* SFN's expression. */
119 ffebldListBottom list_bottom; /* For BCB, NCB, NML. */
120 ffesymbol common; /* Who is my containing COMMON area? */
121 ffeequiv equiv; /* Who have I been equivalenced with? */
122 ffestorag storage; /* Where am I in relation to my outside
123 world? */
124 ffecomSymbol hook; /* Whatever the compiler/backend wants! */
125 ffesymbol sfa_dummy_parent; /* "X" outside sfunc "CIRC(X) = 3.14 * X". */
126 ffesymbol func_result; /* FUN sym's corresponding RES sym, & vice
127 versa. */
128 ffetargetIntegerDefault value; /* IMMEDIATE (DATA impdo) value. */
129 ffesymbolCheckState_ check_state; /* Valid name? */
130 ffelexToken check_token; /* checkstatePENDING_ only. */
131 int max_entry_num; /* For detecting dummy arg listed twice/IMPDO
132 iterator nesting violation; also for id of
133 sfunc dummy arg. */
134 int num_entries; /* Number of entry points in which this
135 symbol appears as a dummy arg; helps
136 determine whether arg might not be passed,
137 for example. */
138 ffeintrinGen generic; /* Generic intrinsic id, if any. */
139 ffeintrinSpec specific; /* Specific intrinsic id, if any. */
140 ffeintrinImp implementation;/* Implementation id, if any. */
141 bool is_save; /* SAVE flag set for this symbol (see also
142 ffe_is_saveall()). */
143 bool is_init; /* INIT flag set for this symbol. */
144 bool do_iter; /* Is currently a DO-loop iter (can't be
145 changed in loop). */
146 bool reported; /* (Debug) TRUE if the latest version has
147 been reported. */
148 bool have_old; /* TRUE if old copy of this symbol saved
149 away. */
150 bool explicit_where; /* TRUE if INTRINSIC/EXTERNAL explicit. */
151 bool namelisted; /* TRUE if in NAMELIST (needs static alloc). */
152 bool assigned; /* TRUE if ever ASSIGNed to. */
155 #define ffesymbol_accretes(s) ((s)->accretes)
156 #define ffesymbol_accretion(s) ((s)->accretion)
157 #define ffesymbol_arraysize(s) ((s)->array_size)
158 #define ffesymbol_assigned(s) ((s)->assigned)
159 #define ffesymbol_attr(s,a) ((s)->attrs & ((ffesymbolAttrs) 1 << (a)))
160 #define ffesymbol_attrs(s) ((s)->attrs)
161 const char *ffesymbol_attrs_string (ffesymbolAttrs attrs);
162 #define ffesymbol_basictype(s) ffeinfo_basictype((s)->info)
163 void ffesymbol_check (ffesymbol s, ffelexToken t, bool maybe_intrin);
164 #define ffesymbol_common(s) ((s)->common)
165 #define ffesymbol_commonlist(s) ((s)->common_list)
166 ffesymbol ffesymbol_declare_blockdataunit (ffelexToken t, ffewhereLine wl,
167 ffewhereColumn wc);
168 ffesymbol ffesymbol_declare_cblock (ffelexToken t, ffewhereLine wl,
169 ffewhereColumn wc);
170 ffesymbol ffesymbol_declare_funcnotresunit (ffelexToken t);
171 ffesymbol ffesymbol_declare_funcresult (ffelexToken t);
172 ffesymbol ffesymbol_declare_funcunit (ffelexToken t);
173 ffesymbol ffesymbol_declare_local (ffelexToken t, bool maybe_intrin);
174 ffesymbol ffesymbol_declare_programunit (ffelexToken t, ffewhereLine wl,
175 ffewhereColumn wc);
176 ffesymbol ffesymbol_declare_sfdummy (ffelexToken t);
177 ffesymbol ffesymbol_declare_subrunit (ffelexToken t);
178 #define ffesymbol_dims(s) ((s)->dims)
179 #define ffesymbol_dim_syms(s) ((s)->dim_syms)
180 void ffesymbol_drive (ffesymbol (*fn) (ffesymbol));
181 void ffesymbol_drive_sfnames (ffesymbol (*fn) (ffesymbol));
182 #define ffesymbol_dummyargs(s) ((s)->dummy_args)
183 void ffesymbol_error (ffesymbol s, ffelexToken t);
184 #define ffesymbol_equiv(s) ((s)->equiv)
185 #define ffesymbol_explicitwhere(s) ((s)->explicit_where)
186 #define ffesymbol_extents(s) ((s)->extents)
187 #define ffesymbol_first_token(s) ((s)->name == NULL ? NULL \
188 : ffename_first_token((s)->name))
189 #define ffesymbol_funcresult(s) ((s)->func_result)
190 #define ffesymbol_generic(s) ((s)->generic)
191 #define ffesymbol_global(s) ((s)->global)
192 #define ffesymbol_hook(s) ((s)->hook)
193 #define ffesymbol_implementation(s) ((s)->implementation)
194 #define ffesymbol_info(s) ((s)->info)
195 #define ffesymbol_init(s) ((s)->init)
196 void ffesymbol_init_0 (void);
197 void ffesymbol_init_1 (void);
198 void ffesymbol_init_2 (void);
199 void ffesymbol_init_3 (void);
200 void ffesymbol_init_4 (void);
201 #define ffesymbol_is_doiter(s) ((s)->do_iter)
202 #define ffesymbol_is_dualspace(s) ((s)->other_space_name != NULL)
203 #define ffesymbol_is_f2c(s) (ffe_is_f2c())
204 #define ffesymbol_is_init(s) ((s)->is_init)
205 #define ffesymbol_is_reported(s) ((s)->reported)
206 #define ffesymbol_is_save(s) ((s)->is_save)
207 #define ffesymbol_is_specable(s) ffesymbol_state_is_specable(s->state)
208 #define ffesymbol_kindtype(s) ffeinfo_kindtype((s)->info)
209 #define ffesymbol_kind(s) ffeinfo_kind((s)->info)
210 ffesymbol ffesymbol_lookup_local (ffelexToken t);
211 #define ffesymbol_maxentrynum(s) ((s)->max_entry_num)
212 #define ffesymbol_name(s) ((s)->name)
213 #define ffesymbol_namelist(s) ((s)->namelist)
214 #define ffesymbol_namelisted(s) ((s)->namelisted)
215 #define ffesymbol_numentries(s) ((s)->num_entries)
216 #define ffesymbol_ptr_to_commonlist(s) (&(s)->common_list)
217 #define ffesymbol_ptr_to_listbottom(s) (&(s)->list_bottom)
218 #define ffesymbol_ptr_to_namelist(s) (&(s)->namelist)
219 #define ffesymbol_rank(s) ffeinfo_rank((s)->info)
220 void ffesymbol_reference (ffesymbol s, ffelexToken t, bool explicit);
221 void ffesymbol_resolve_intrin (ffesymbol s);
222 void ffesymbol_retract (bool retract);
223 bool ffesymbol_retractable (void);
224 #define ffesymbol_set_accretes(s,a) ((s)->accretes = (a))
225 #define ffesymbol_set_accretion(s,a) ((s)->accretion = (a))
226 #define ffesymbol_set_arraysize(s,a) ((s)->array_size = (a))
227 #define ffesymbol_set_assigned(s,a) ((s)->assigned = (a))
228 #define ffesymbol_set_attr(s,a) ((s)->attrs |= ((ffesymbolAttrs) 1 << (a)))
229 #define ffesymbol_set_attrs(s,a) ((s)->attrs = (a))
230 #define ffesymbol_set_common(s,c) ((s)->common = (c))
231 #define ffesymbol_set_commonlist(s,c) ((s)->common_list = (c))
232 #define ffesymbol_set_dims(s,d) ((s)->dims = (d))
233 #define ffesymbol_set_dim_syms(s,d) ((s)->dim_syms = (d))
234 #define ffesymbol_set_dummyargs(s,d) ((s)->dummy_args = (d))
235 #define ffesymbol_set_equiv(s,e) ((s)->equiv = (e))
236 #define ffesymbol_set_explicitwhere(s,e) ((s)->explicit_where = (e))
237 #define ffesymbol_set_extents(s,e) ((s)->extents = (e))
238 #define ffesymbol_set_funcresult(s,f) ((s)->func_result = (f))
239 #define ffesymbol_set_generic(s,g) ((s)->generic = (g))
240 #define ffesymbol_set_global(s,g) ((s)->global = (g))
241 #define ffesymbol_set_hook(s,h) ((s)->hook = (h))
242 #define ffesymbol_set_implementation(s,im) ((s)->implementation = (im))
243 #define ffesymbol_set_init(s,i) ((s)->init = (i))
244 #define ffesymbol_set_info(s,i) ((s)->info = (i))
245 #define ffesymbol_set_is_doiter(s,f) ((s)->do_iter = (f))
246 #define ffesymbol_set_is_init(s,in) ((s)->is_init = (in))
247 #define ffesymbol_set_is_save(s,sa) ((s)->is_save = (sa))
248 #define ffesymbol_set_maxentrynum(s,m) ((s)->max_entry_num = (m))
249 #define ffesymbol_set_namelist(s,n) ((s)->namelist = (n))
250 #define ffesymbol_set_namelisted(s,n) ((s)->namelisted = (n))
251 #define ffesymbol_set_numentries(s,n) ((s)->num_entries = (n))
252 void ffesymbol_set_retractable (mallocPool pool);
253 #define ffesymbol_set_sfexpr(s,e) ((s)->sfunc_expr = (e))
254 #define ffesymbol_set_specific(s,sp) ((s)->specific = (sp))
255 #define ffesymbol_set_state(s,st) ((s)->state = (st))
256 #define ffesymbol_set_storage(s,st) ((s)->storage = (st))
257 #define ffesymbol_set_value(s,v) ((s)->value = (v))
258 #define ffesymbol_sfdummyparent(s) ((s)->sfa_dummy_parent)
259 #define ffesymbol_sfexpr(s) ((s)->sfunc_expr)
260 void ffesymbol_signal_change (ffesymbol s);
261 #define ffesymbol_signal_unreported(s) ((s)->reported = FALSE)
262 #define ffesymbol_size(s) ffeinfo_size((s)->info)
263 #define ffesymbol_specific(s) ((s)->specific)
264 #define ffesymbol_state(s) ((s)->state)
265 #define ffesymbol_state_is_specable(s) ((s) <= FFESYMBOL_stateSEEN)
266 const char *ffesymbol_state_string (ffesymbolState state);
267 #define ffesymbol_storage(s) ((s)->storage)
268 void ffesymbol_terminate_0 (void);
269 void ffesymbol_terminate_1 (void);
270 void ffesymbol_terminate_2 (void);
271 void ffesymbol_terminate_3 (void);
272 void ffesymbol_terminate_4 (void);
273 #define ffesymbol_text(s) (((s)->name == NULL) ? "<->" : ffename_text((s)->name))
274 void ffesymbol_update_init (ffesymbol s);
275 void ffesymbol_update_save (ffesymbol s);
276 #define ffesymbol_value(s) ((s)->value)
277 #define ffesymbol_where(s) ffeinfo_where((s)->info)
278 #define ffesymbol_where_column(s) (((s)->name == NULL) \
279 ? ffewhere_column_unknown() : ffename_where_column((s)->name))
280 #define ffesymbol_where_filename(s) \
281 ffewhere_line_filename(ffesymbol_where_line(s))
282 #define ffesymbol_where_filelinenum(s) \
283 ffewhere_line_filelinenum(ffesymbol_where_line(s))
284 #define ffesymbol_where_line(s) (((s)->name == NULL) ? ffewhere_line_unknown() \
285 : ffename_where_line((s)->name))
287 #endif /* ! GCC_F_SYMBOL_H */