]>
Commit | Line | Data |
---|---|---|
6de9cd9a | 1 | /* gfortran header file |
99dee823 | 2 | Copyright (C) 2000-2021 Free Software Foundation, Inc. |
6de9cd9a DN |
3 | Contributed by Andy Vaught |
4 | ||
9fc4d79b | 5 | This file is part of GCC. |
6de9cd9a | 6 | |
9fc4d79b TS |
7 | GCC is free software; you can redistribute it and/or modify it under |
8 | the terms of the GNU General Public License as published by the Free | |
d234d788 | 9 | Software Foundation; either version 3, or (at your option) any later |
9fc4d79b | 10 | version. |
6de9cd9a | 11 | |
9fc4d79b TS |
12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | for more details. | |
6de9cd9a DN |
16 | |
17 | You should have received a copy of the GNU General Public License | |
d234d788 NC |
18 | along with GCC; see the file COPYING3. If not see |
19 | <http://www.gnu.org/licenses/>. */ | |
6de9cd9a DN |
20 | |
21 | #ifndef GCC_GFORTRAN_H | |
22 | #define GCC_GFORTRAN_H | |
23 | ||
24 | /* It's probably insane to have this large of a header file, but it | |
25 | seemed like everything had to be recompiled anyway when a change | |
26 | was made to a header file, and there were ordering issues with | |
27 | multiple header files. Besides, Microsoft's winnt.h was 250k last | |
28 | time I looked, so by comparison this is perfectly reasonable. */ | |
29 | ||
953bee7c SB |
30 | #ifndef GCC_CORETYPES_H |
31 | #error "gfortran.h must be included after coretypes.h" | |
32 | #endif | |
33 | ||
8e54f6d3 MLI |
34 | /* In order for the format checking to accept the Fortran front end |
35 | diagnostic framework extensions, you must include this file before | |
36 | diagnostic-core.h, not after. We override the definition of GCC_DIAG_STYLE | |
37 | in c-common.h. */ | |
38 | #undef GCC_DIAG_STYLE | |
39 | #define GCC_DIAG_STYLE __gcc_gfc__ | |
40 | #if defined(GCC_DIAGNOSTIC_CORE_H) | |
41 | #error \ | |
42 | In order for the format checking to accept the Fortran front end diagnostic \ | |
43 | framework extensions, you must include this file before diagnostic-core.h, \ | |
44 | not after. | |
45 | #endif | |
46 | ||
d74b97cc FXC |
47 | /* Declarations common to the front-end and library are put in |
48 | libgfortran/libgfortran_frontend.h */ | |
49 | #include "libgfortran.h" | |
50 | ||
51 | ||
31043f6c | 52 | #include "intl.h" |
5868cbf9 | 53 | #include "splay-tree.h" |
6de9cd9a | 54 | |
6de9cd9a DN |
55 | /* Major control parameters. */ |
56 | ||
1dde8683 | 57 | #define GFC_MAX_SYMBOL_LEN 63 /* Must be at least 63 for F2003. */ |
6de9cd9a | 58 | #define GFC_LETTERS 26 /* Number of letters in the alphabet. */ |
6de9cd9a | 59 | |
07b3bbf2 TK |
60 | #define MAX_SUBRECORD_LENGTH 2147483639 /* 2**31-9 */ |
61 | ||
62 | ||
ef144767 | 63 | #define gfc_is_whitespace(c) ((c==' ') || (c=='\t') || (c=='\f')) |
6de9cd9a | 64 | |
f6288c24 FR |
65 | /* Macros to check for groups of structure-like types and flavors since |
66 | derived types, structures, maps, unions are often treated similarly. */ | |
67 | #define gfc_bt_struct(t) \ | |
68 | ((t) == BT_DERIVED || (t) == BT_UNION) | |
69 | #define gfc_fl_struct(f) \ | |
70 | ((f) == FL_DERIVED || (f) == FL_UNION || (f) == FL_STRUCT) | |
71 | #define case_bt_struct case BT_DERIVED: case BT_UNION | |
72 | #define case_fl_struct case FL_DERIVED: case FL_UNION: case FL_STRUCT | |
73 | ||
6de9cd9a DN |
74 | /* Stringization. */ |
75 | #define stringize(x) expand_macro(x) | |
76 | #define expand_macro(x) # x | |
77 | ||
df2fba9e | 78 | /* For the runtime library, a standard prefix is a requirement to |
6de9cd9a DN |
79 | avoid cluttering the namespace with things nobody asked for. It's |
80 | ugly to look at and a pain to type when you add the prefix by hand, | |
81 | so we hide it behind a macro. */ | |
82 | #define PREFIX(x) "_gfortran_" x | |
5b200ac2 | 83 | #define PREFIX_LEN 10 |
6de9cd9a | 84 | |
36085529 TB |
85 | /* A prefix for internal variables, which are not user-visible. */ |
86 | #if !defined (NO_DOT_IN_LABEL) | |
87 | # define GFC_PREFIX(x) "_F." x | |
88 | #elif !defined (NO_DOLLAR_IN_LABEL) | |
89 | # define GFC_PREFIX(x) "_F$" x | |
90 | #else | |
91 | # define GFC_PREFIX(x) "_F_" x | |
92 | #endif | |
93 | ||
30aabb86 PT |
94 | #define BLANK_COMMON_NAME "__BLNK__" |
95 | ||
6de9cd9a DN |
96 | /* Macro to initialize an mstring structure. */ |
97 | #define minit(s, t) { s, NULL, t } | |
98 | ||
99 | /* Structure for storing strings to be matched by gfc_match_string. */ | |
100 | typedef struct | |
101 | { | |
102 | const char *string; | |
103 | const char *mp; | |
104 | int tag; | |
105 | } | |
106 | mstring; | |
107 | ||
108 | ||
944b8b35 | 109 | |
6de9cd9a DN |
110 | /*************************** Enums *****************************/ |
111 | ||
ad7ee6f8 JD |
112 | /* Used when matching and resolving data I/O transfer statements. */ |
113 | ||
a79683d5 TS |
114 | enum io_kind |
115 | { M_READ, M_WRITE, M_PRINT, M_INQUIRE }; | |
ad7ee6f8 | 116 | |
6de9cd9a | 117 | |
696abb30 JD |
118 | /* These are flags for identifying whether we are reading a character literal |
119 | between quotes or normal source code. */ | |
4d382327 | 120 | |
a79683d5 TS |
121 | enum gfc_instring |
122 | { NONSTRING = 0, INSTRING_WARN, INSTRING_NOWARN }; | |
696abb30 | 123 | |
8f0d39a8 FXC |
124 | /* This is returned by gfc_notification_std to know if, given the flags |
125 | that were given (-std=, -pedantic) we should issue an error, a warning | |
126 | or nothing. */ | |
127 | ||
a79683d5 TS |
128 | enum notification |
129 | { SILENT, WARNING, ERROR }; | |
8f0d39a8 | 130 | |
6de9cd9a DN |
131 | /* Matchers return one of these three values. The difference between |
132 | MATCH_NO and MATCH_ERROR is that MATCH_ERROR means that a match was | |
133 | successful, but that something non-syntactic is wrong and an error | |
134 | has already been issued. */ | |
135 | ||
a79683d5 TS |
136 | enum match |
137 | { MATCH_NO = 1, MATCH_YES, MATCH_ERROR }; | |
6de9cd9a | 138 | |
696abb30 | 139 | /* Used for different Fortran source forms in places like scanner.c. */ |
a79683d5 TS |
140 | enum gfc_source_form |
141 | { FORM_FREE, FORM_FIXED, FORM_UNKNOWN }; | |
6de9cd9a | 142 | |
6de9cd9a | 143 | /* Expression node types. */ |
a79683d5 | 144 | enum expr_t |
7e703f01 | 145 | { EXPR_UNKNOWN = 0, EXPR_OP = 1, EXPR_FUNCTION, EXPR_CONSTANT, EXPR_VARIABLE, |
713485cc | 146 | EXPR_SUBSTRING, EXPR_STRUCTURE, EXPR_ARRAY, EXPR_NULL, EXPR_COMPCALL, EXPR_PPC |
a79683d5 | 147 | }; |
6de9cd9a DN |
148 | |
149 | /* Array types. */ | |
a79683d5 | 150 | enum array_type |
6de9cd9a | 151 | { AS_EXPLICIT = 1, AS_ASSUMED_SHAPE, AS_DEFERRED, |
c62c6622 TB |
152 | AS_ASSUMED_SIZE, AS_IMPLIED_SHAPE, AS_ASSUMED_RANK, |
153 | AS_UNKNOWN | |
a79683d5 | 154 | }; |
6de9cd9a | 155 | |
a79683d5 TS |
156 | enum ar_type |
157 | { AR_FULL = 1, AR_ELEMENT, AR_SECTION, AR_UNKNOWN }; | |
6de9cd9a | 158 | |
f3e7b9d6 TB |
159 | /* Statement label types. ST_LABEL_DO_TARGET is used for obsolescent warnings |
160 | related to shared DO terminations and DO targets which are neither END DO | |
161 | nor CONTINUE; otherwise it is identical to ST_LABEL_TARGET. */ | |
a79683d5 | 162 | enum gfc_sl_type |
f3e7b9d6 | 163 | { ST_LABEL_UNKNOWN = 1, ST_LABEL_TARGET, ST_LABEL_DO_TARGET, |
6de9cd9a | 164 | ST_LABEL_BAD_TARGET, ST_LABEL_FORMAT |
a79683d5 | 165 | }; |
6de9cd9a DN |
166 | |
167 | /* Intrinsic operators. */ | |
a79683d5 | 168 | enum gfc_intrinsic_op |
6de9cd9a DN |
169 | { GFC_INTRINSIC_BEGIN = 0, |
170 | INTRINSIC_NONE = -1, INTRINSIC_UPLUS = GFC_INTRINSIC_BEGIN, | |
171 | INTRINSIC_UMINUS, INTRINSIC_PLUS, INTRINSIC_MINUS, INTRINSIC_TIMES, | |
172 | INTRINSIC_DIVIDE, INTRINSIC_POWER, INTRINSIC_CONCAT, | |
173 | INTRINSIC_AND, INTRINSIC_OR, INTRINSIC_EQV, INTRINSIC_NEQV, | |
3bed9dd0 | 174 | /* ==, /=, >, >=, <, <= */ |
6de9cd9a | 175 | INTRINSIC_EQ, INTRINSIC_NE, INTRINSIC_GT, INTRINSIC_GE, |
4d382327 | 176 | INTRINSIC_LT, INTRINSIC_LE, |
3bed9dd0 DF |
177 | /* .EQ., .NE., .GT., .GE., .LT., .LE. (OS = Old-Style) */ |
178 | INTRINSIC_EQ_OS, INTRINSIC_NE_OS, INTRINSIC_GT_OS, INTRINSIC_GE_OS, | |
4d382327 | 179 | INTRINSIC_LT_OS, INTRINSIC_LE_OS, |
e73d3ca6 | 180 | INTRINSIC_NOT, INTRINSIC_USER, INTRINSIC_ASSIGN, INTRINSIC_PARENTHESES, |
195d1431 PT |
181 | GFC_INTRINSIC_END, /* Sentinel */ |
182 | /* User defined derived type pseudo operators. These are set beyond the | |
183 | sentinel so that they are excluded from module_read and module_write. */ | |
184 | INTRINSIC_FORMATTED, INTRINSIC_UNFORMATTED | |
a79683d5 | 185 | }; |
6de9cd9a | 186 | |
6de9cd9a DN |
187 | /* This macro is the number of intrinsic operators that exist. |
188 | Assumptions are made about the numbering of the interface_op enums. */ | |
189 | #define GFC_INTRINSIC_OPS GFC_INTRINSIC_END | |
190 | ||
191 | /* Arithmetic results. */ | |
a79683d5 | 192 | enum arith |
f8e566e5 | 193 | { ARITH_OK = 1, ARITH_OVERFLOW, ARITH_UNDERFLOW, ARITH_NAN, |
7318fdca TK |
194 | ARITH_DIV0, ARITH_INCOMMENSURATE, ARITH_ASYMMETRIC, ARITH_PROHIBIT, |
195 | ARITH_WRONGCONCAT | |
a79683d5 | 196 | }; |
6de9cd9a DN |
197 | |
198 | /* Statements. */ | |
a79683d5 | 199 | enum gfc_statement |
6de9cd9a | 200 | { |
03af1e4c DK |
201 | ST_ARITHMETIC_IF, ST_ALLOCATE, ST_ATTR_DECL, ST_ASSOCIATE, |
202 | ST_BACKSPACE, ST_BLOCK, ST_BLOCK_DATA, | |
6de9cd9a DN |
203 | ST_CALL, ST_CASE, ST_CLOSE, ST_COMMON, ST_CONTINUE, ST_CONTAINS, ST_CYCLE, |
204 | ST_DATA, ST_DATA_DECL, ST_DEALLOCATE, ST_DO, ST_ELSE, ST_ELSEIF, | |
03af1e4c | 205 | ST_ELSEWHERE, ST_END_ASSOCIATE, ST_END_BLOCK, ST_END_BLOCK_DATA, |
4668d6f9 PT |
206 | ST_ENDDO, ST_IMPLIED_ENDDO, ST_END_FILE, ST_FINAL, ST_FLUSH, ST_END_FORALL, |
207 | ST_END_FUNCTION, ST_ENDIF, ST_END_INTERFACE, ST_END_MODULE, ST_END_SUBMODULE, | |
208 | ST_END_PROGRAM, ST_END_SELECT, ST_END_SUBROUTINE, ST_END_WHERE, ST_END_TYPE, | |
209 | ST_ENTRY, ST_EQUIVALENCE, ST_ERROR_STOP, ST_EXIT, ST_FORALL, ST_FORALL_BLOCK, | |
210 | ST_FORMAT, ST_FUNCTION, ST_GOTO, ST_IF_BLOCK, ST_IMPLICIT, ST_IMPLICIT_NONE, | |
211 | ST_IMPORT, ST_INQUIRE, ST_INTERFACE, ST_SYNC_ALL, ST_SYNC_MEMORY, | |
212 | ST_SYNC_IMAGES, ST_PARAMETER, ST_MODULE, ST_SUBMODULE, ST_MODULE_PROC, | |
213 | ST_NAMELIST, ST_NULLIFY, ST_OPEN, ST_PAUSE, ST_PRIVATE, ST_PROGRAM, ST_PUBLIC, | |
214 | ST_READ, ST_RETURN, ST_REWIND, ST_STOP, ST_SUBROUTINE, ST_TYPE, ST_USE, | |
215 | ST_WHERE_BLOCK, ST_WHERE, ST_WAIT, ST_WRITE, ST_ASSIGNMENT, | |
216 | ST_POINTER_ASSIGNMENT, ST_SELECT_CASE, ST_SEQUENCE, ST_SIMPLE_IF, | |
217 | ST_STATEMENT_FUNCTION, ST_DERIVED_DECL, ST_LABEL_ASSIGNMENT, ST_ENUM, | |
218 | ST_ENUMERATOR, ST_END_ENUM, ST_SELECT_TYPE, ST_TYPE_IS, ST_CLASS_IS, | |
70570ec1 | 219 | ST_SELECT_RANK, ST_RANK, ST_STRUCTURE_DECL, ST_END_STRUCTURE, |
f6288c24 | 220 | ST_UNION, ST_END_UNION, ST_MAP, ST_END_MAP, |
41dbbb37 TS |
221 | ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, |
222 | ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, | |
223 | ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, | |
224 | ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, | |
225 | ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, | |
62aee289 MR |
226 | ST_OACC_SERIAL_LOOP, ST_OACC_END_SERIAL_LOOP, ST_OACC_SERIAL, |
227 | ST_OACC_END_SERIAL, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE, | |
4bf9e5a8 | 228 | ST_OACC_ATOMIC, ST_OACC_END_ATOMIC, |
20906c66 JJ |
229 | ST_OMP_ATOMIC, ST_OMP_BARRIER, ST_OMP_CRITICAL, ST_OMP_END_ATOMIC, |
230 | ST_OMP_END_CRITICAL, ST_OMP_END_DO, ST_OMP_END_MASTER, ST_OMP_END_ORDERED, | |
231 | ST_OMP_END_PARALLEL, ST_OMP_END_PARALLEL_DO, ST_OMP_END_PARALLEL_SECTIONS, | |
6c7a4dfd JJ |
232 | ST_OMP_END_PARALLEL_WORKSHARE, ST_OMP_END_SECTIONS, ST_OMP_END_SINGLE, |
233 | ST_OMP_END_WORKSHARE, ST_OMP_DO, ST_OMP_FLUSH, ST_OMP_MASTER, ST_OMP_ORDERED, | |
234 | ST_OMP_PARALLEL, ST_OMP_PARALLEL_DO, ST_OMP_PARALLEL_SECTIONS, | |
235 | ST_OMP_PARALLEL_WORKSHARE, ST_OMP_SECTIONS, ST_OMP_SECTION, ST_OMP_SINGLE, | |
a68ab351 | 236 | ST_OMP_THREADPRIVATE, ST_OMP_WORKSHARE, ST_OMP_TASK, ST_OMP_END_TASK, |
dd2fc525 JJ |
237 | ST_OMP_TASKWAIT, ST_OMP_TASKYIELD, ST_OMP_CANCEL, ST_OMP_CANCELLATION_POINT, |
238 | ST_OMP_TASKGROUP, ST_OMP_END_TASKGROUP, ST_OMP_SIMD, ST_OMP_END_SIMD, | |
239 | ST_OMP_DO_SIMD, ST_OMP_END_DO_SIMD, ST_OMP_PARALLEL_DO_SIMD, | |
5f23671d | 240 | ST_OMP_END_PARALLEL_DO_SIMD, ST_OMP_DECLARE_SIMD, ST_OMP_DECLARE_REDUCTION, |
f014c653 JJ |
241 | ST_OMP_TARGET, ST_OMP_END_TARGET, ST_OMP_TARGET_DATA, ST_OMP_END_TARGET_DATA, |
242 | ST_OMP_TARGET_UPDATE, ST_OMP_DECLARE_TARGET, | |
243 | ST_OMP_TEAMS, ST_OMP_END_TEAMS, ST_OMP_DISTRIBUTE, ST_OMP_END_DISTRIBUTE, | |
244 | ST_OMP_DISTRIBUTE_SIMD, ST_OMP_END_DISTRIBUTE_SIMD, | |
245 | ST_OMP_DISTRIBUTE_PARALLEL_DO, ST_OMP_END_DISTRIBUTE_PARALLEL_DO, | |
246 | ST_OMP_DISTRIBUTE_PARALLEL_DO_SIMD, ST_OMP_END_DISTRIBUTE_PARALLEL_DO_SIMD, | |
247 | ST_OMP_TARGET_TEAMS, ST_OMP_END_TARGET_TEAMS, ST_OMP_TEAMS_DISTRIBUTE, | |
248 | ST_OMP_END_TEAMS_DISTRIBUTE, ST_OMP_TEAMS_DISTRIBUTE_SIMD, | |
249 | ST_OMP_END_TEAMS_DISTRIBUTE_SIMD, ST_OMP_TARGET_TEAMS_DISTRIBUTE, | |
250 | ST_OMP_END_TARGET_TEAMS_DISTRIBUTE, ST_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD, | |
251 | ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_SIMD, ST_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO, | |
252 | ST_OMP_END_TEAMS_DISTRIBUTE_PARALLEL_DO, | |
253 | ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO, | |
254 | ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO, | |
255 | ST_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, | |
256 | ST_OMP_END_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, | |
257 | ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, | |
258 | ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, | |
b4c3a85b JJ |
259 | ST_OMP_TARGET_PARALLEL, ST_OMP_END_TARGET_PARALLEL, |
260 | ST_OMP_TARGET_PARALLEL_DO, ST_OMP_END_TARGET_PARALLEL_DO, | |
261 | ST_OMP_TARGET_PARALLEL_DO_SIMD, ST_OMP_END_TARGET_PARALLEL_DO_SIMD, | |
262 | ST_OMP_TARGET_ENTER_DATA, ST_OMP_TARGET_EXIT_DATA, | |
263 | ST_OMP_TARGET_SIMD, ST_OMP_END_TARGET_SIMD, | |
a61c4964 | 264 | ST_OMP_TASKLOOP, ST_OMP_END_TASKLOOP, ST_OMP_SCAN, ST_OMP_DEPOBJ, |
b4c3a85b | 265 | ST_OMP_TASKLOOP_SIMD, ST_OMP_END_TASKLOOP_SIMD, ST_OMP_ORDERED_DEPEND, |
269322ec | 266 | ST_OMP_REQUIRES, ST_PROCEDURE, ST_GENERIC, ST_CRITICAL, ST_END_CRITICAL, |
5df445a2 | 267 | ST_GET_FCN_CHARACTERISTICS, ST_LOCK, ST_UNLOCK, ST_EVENT_POST, |
f8862a1b | 268 | ST_EVENT_WAIT, ST_FAIL_IMAGE, ST_FORM_TEAM, ST_CHANGE_TEAM, |
0e3702f8 | 269 | ST_END_TEAM, ST_SYNC_TEAM, ST_OMP_PARALLEL_MASTER, |
f6bf436d TB |
270 | ST_OMP_END_PARALLEL_MASTER, ST_OMP_PARALLEL_MASTER_TASKLOOP, |
271 | ST_OMP_END_PARALLEL_MASTER_TASKLOOP, ST_OMP_PARALLEL_MASTER_TASKLOOP_SIMD, | |
272 | ST_OMP_END_PARALLEL_MASTER_TASKLOOP_SIMD, ST_OMP_MASTER_TASKLOOP, | |
273 | ST_OMP_END_MASTER_TASKLOOP, ST_OMP_MASTER_TASKLOOP_SIMD, | |
178191e1 TB |
274 | ST_OMP_END_MASTER_TASKLOOP_SIMD, ST_OMP_LOOP, ST_OMP_END_LOOP, |
275 | ST_OMP_PARALLEL_LOOP, ST_OMP_END_PARALLEL_LOOP, ST_OMP_TEAMS_LOOP, | |
276 | ST_OMP_END_TEAMS_LOOP, ST_OMP_TARGET_PARALLEL_LOOP, | |
277 | ST_OMP_END_TARGET_PARALLEL_LOOP, ST_OMP_TARGET_TEAMS_LOOP, | |
278 | ST_OMP_END_TARGET_TEAMS_LOOP, ST_NONE | |
a79683d5 | 279 | }; |
6de9cd9a | 280 | |
6de9cd9a DN |
281 | /* Types of interfaces that we can have. Assignment interfaces are |
282 | considered to be intrinsic operators. */ | |
a79683d5 | 283 | enum interface_type |
6de9cd9a DN |
284 | { |
285 | INTERFACE_NAMELESS = 1, INTERFACE_GENERIC, | |
e73d3ca6 PT |
286 | INTERFACE_INTRINSIC_OP, INTERFACE_USER_OP, INTERFACE_ABSTRACT, |
287 | INTERFACE_DTIO | |
a79683d5 | 288 | }; |
6de9cd9a DN |
289 | |
290 | /* Symbol flavors: these are all mutually exclusive. | |
f6288c24 | 291 | 12 elements = 4 bits. */ |
a79683d5 | 292 | enum sym_flavor |
6de9cd9a DN |
293 | { |
294 | FL_UNKNOWN = 0, FL_PROGRAM, FL_BLOCK_DATA, FL_MODULE, FL_VARIABLE, | |
a8b3b0b6 | 295 | FL_PARAMETER, FL_LABEL, FL_PROCEDURE, FL_DERIVED, FL_NAMELIST, |
f6288c24 | 296 | FL_UNION, FL_STRUCT, FL_VOID |
a79683d5 | 297 | }; |
6de9cd9a DN |
298 | |
299 | /* Procedure types. 7 elements = 3 bits. */ | |
a79683d5 | 300 | enum procedure_type |
6de9cd9a DN |
301 | { PROC_UNKNOWN, PROC_MODULE, PROC_INTERNAL, PROC_DUMMY, |
302 | PROC_INTRINSIC, PROC_ST_FUNCTION, PROC_EXTERNAL | |
a79683d5 | 303 | }; |
6de9cd9a | 304 | |
ea20e8be JW |
305 | /* Intent types. Note that these values are also used in another enum in |
306 | decl.c (match_attr_spec). */ | |
a79683d5 | 307 | enum sym_intent |
6de9cd9a | 308 | { INTENT_UNKNOWN = 0, INTENT_IN, INTENT_OUT, INTENT_INOUT |
a79683d5 | 309 | }; |
6de9cd9a DN |
310 | |
311 | /* Access types. */ | |
a79683d5 | 312 | enum gfc_access |
5f42ddb0 | 313 | { ACCESS_UNKNOWN = 0, ACCESS_PUBLIC, ACCESS_PRIVATE |
a79683d5 | 314 | }; |
6de9cd9a DN |
315 | |
316 | /* Flags to keep track of where an interface came from. | |
c73b6478 | 317 | 3 elements = 2 bits. */ |
a79683d5 | 318 | enum ifsrc |
c73b6478 JW |
319 | { IFSRC_UNKNOWN = 0, /* Interface unknown, only return type may be known. */ |
320 | IFSRC_DECL, /* FUNCTION or SUBROUTINE declaration. */ | |
321 | IFSRC_IFBODY /* INTERFACE statement or PROCEDURE statement | |
322 | with explicit interface. */ | |
a79683d5 | 323 | }; |
6de9cd9a | 324 | |
86bf520d | 325 | /* Whether a SAVE attribute was set explicitly or implicitly. */ |
a79683d5 | 326 | enum save_state |
5349080d | 327 | { SAVE_NONE = 0, SAVE_EXPLICIT, SAVE_IMPLICIT |
a79683d5 | 328 | }; |
5349080d | 329 | |
68034b1b TS |
330 | /* OpenACC 'routine' directive's level of parallelism. */ |
331 | enum oacc_routine_lop | |
332 | { OACC_ROUTINE_LOP_NONE = 0, | |
333 | OACC_ROUTINE_LOP_GANG, | |
334 | OACC_ROUTINE_LOP_WORKER, | |
335 | OACC_ROUTINE_LOP_VECTOR, | |
e5fd6684 TS |
336 | OACC_ROUTINE_LOP_SEQ, |
337 | OACC_ROUTINE_LOP_ERROR | |
68034b1b TS |
338 | }; |
339 | ||
6de9cd9a DN |
340 | /* Strings for all symbol attributes. We use these for dumping the |
341 | parse tree, in error messages, and also when reading and writing | |
342 | modules. In symbol.c. */ | |
343 | extern const mstring flavors[]; | |
344 | extern const mstring procedures[]; | |
345 | extern const mstring intents[]; | |
346 | extern const mstring access_types[]; | |
347 | extern const mstring ifsrc_types[]; | |
ef7236d2 | 348 | extern const mstring save_status[]; |
6de9cd9a | 349 | |
e73d3ca6 PT |
350 | /* Strings for DTIO procedure names. In symbol.c. */ |
351 | extern const mstring dtio_procs[]; | |
352 | ||
353 | enum dtio_codes | |
354 | { DTIO_RF = 0, DTIO_WF, DTIO_RUF, DTIO_WUF }; | |
355 | ||
6de9cd9a DN |
356 | /* Enumeration of all the generic intrinsic functions. Used by the |
357 | backend for identification of a function. */ | |
358 | ||
cd5ecab6 | 359 | enum gfc_isym_id |
6de9cd9a DN |
360 | { |
361 | /* GFC_ISYM_NONE is used for intrinsics which will never be seen by | |
df2fba9e | 362 | the backend (e.g. KIND). */ |
6de9cd9a | 363 | GFC_ISYM_NONE = 0, |
cd5ecab6 | 364 | GFC_ISYM_ABORT, |
6de9cd9a | 365 | GFC_ISYM_ABS, |
a119fc1c | 366 | GFC_ISYM_ACCESS, |
6de9cd9a DN |
367 | GFC_ISYM_ACHAR, |
368 | GFC_ISYM_ACOS, | |
57391dda | 369 | GFC_ISYM_ACOSD, |
1e399e23 | 370 | GFC_ISYM_ACOSH, |
6de9cd9a DN |
371 | GFC_ISYM_ADJUSTL, |
372 | GFC_ISYM_ADJUSTR, | |
373 | GFC_ISYM_AIMAG, | |
374 | GFC_ISYM_AINT, | |
cd5ecab6 | 375 | GFC_ISYM_ALARM, |
6de9cd9a DN |
376 | GFC_ISYM_ALL, |
377 | GFC_ISYM_ALLOCATED, | |
5d723e54 | 378 | GFC_ISYM_AND, |
cd5ecab6 | 379 | GFC_ISYM_ANINT, |
6de9cd9a DN |
380 | GFC_ISYM_ANY, |
381 | GFC_ISYM_ASIN, | |
57391dda | 382 | GFC_ISYM_ASIND, |
1e399e23 | 383 | GFC_ISYM_ASINH, |
6de9cd9a DN |
384 | GFC_ISYM_ASSOCIATED, |
385 | GFC_ISYM_ATAN, | |
386 | GFC_ISYM_ATAN2, | |
57391dda FR |
387 | GFC_ISYM_ATAN2D, |
388 | GFC_ISYM_ATAND, | |
cd5ecab6 | 389 | GFC_ISYM_ATANH, |
7f4aaf91 TB |
390 | GFC_ISYM_ATOMIC_ADD, |
391 | GFC_ISYM_ATOMIC_AND, | |
392 | GFC_ISYM_ATOMIC_CAS, | |
da661a58 | 393 | GFC_ISYM_ATOMIC_DEF, |
7f4aaf91 TB |
394 | GFC_ISYM_ATOMIC_FETCH_ADD, |
395 | GFC_ISYM_ATOMIC_FETCH_AND, | |
396 | GFC_ISYM_ATOMIC_FETCH_OR, | |
397 | GFC_ISYM_ATOMIC_FETCH_XOR, | |
398 | GFC_ISYM_ATOMIC_OR, | |
da661a58 | 399 | GFC_ISYM_ATOMIC_REF, |
7f4aaf91 | 400 | GFC_ISYM_ATOMIC_XOR, |
88a95a11 FXC |
401 | GFC_ISYM_BGE, |
402 | GFC_ISYM_BGT, | |
cd5ecab6 | 403 | GFC_ISYM_BIT_SIZE, |
88a95a11 FXC |
404 | GFC_ISYM_BLE, |
405 | GFC_ISYM_BLT, | |
6de9cd9a | 406 | GFC_ISYM_BTEST, |
8a8d1a16 TB |
407 | GFC_ISYM_CAF_GET, |
408 | GFC_ISYM_CAF_SEND, | |
6de9cd9a DN |
409 | GFC_ISYM_CEILING, |
410 | GFC_ISYM_CHAR, | |
f77b6ca3 | 411 | GFC_ISYM_CHDIR, |
a119fc1c | 412 | GFC_ISYM_CHMOD, |
6de9cd9a | 413 | GFC_ISYM_CMPLX, |
a16ee379 | 414 | GFC_ISYM_CO_BROADCAST, |
d62cf3df TB |
415 | GFC_ISYM_CO_MAX, |
416 | GFC_ISYM_CO_MIN, | |
a16ee379 | 417 | GFC_ISYM_CO_REDUCE, |
d62cf3df | 418 | GFC_ISYM_CO_SUM, |
b41b2534 | 419 | GFC_ISYM_COMMAND_ARGUMENT_COUNT, |
d000aa67 TB |
420 | GFC_ISYM_COMPILER_OPTIONS, |
421 | GFC_ISYM_COMPILER_VERSION, | |
5d723e54 | 422 | GFC_ISYM_COMPLEX, |
6de9cd9a | 423 | GFC_ISYM_CONJG, |
cd5ecab6 | 424 | GFC_ISYM_CONVERSION, |
6de9cd9a | 425 | GFC_ISYM_COS, |
57391dda | 426 | GFC_ISYM_COSD, |
6de9cd9a | 427 | GFC_ISYM_COSH, |
8e8c2744 | 428 | GFC_ISYM_COTAN, |
57391dda | 429 | GFC_ISYM_COTAND, |
6de9cd9a | 430 | GFC_ISYM_COUNT, |
cd5ecab6 | 431 | GFC_ISYM_CPU_TIME, |
6de9cd9a | 432 | GFC_ISYM_CSHIFT, |
35059811 | 433 | GFC_ISYM_CTIME, |
cadddfdd TB |
434 | GFC_ISYM_C_ASSOCIATED, |
435 | GFC_ISYM_C_F_POINTER, | |
436 | GFC_ISYM_C_F_PROCPOINTER, | |
437 | GFC_ISYM_C_FUNLOC, | |
438 | GFC_ISYM_C_LOC, | |
048510c8 | 439 | GFC_ISYM_C_SIZEOF, |
cd5ecab6 | 440 | GFC_ISYM_DATE_AND_TIME, |
6de9cd9a | 441 | GFC_ISYM_DBLE, |
878f88b7 | 442 | GFC_ISYM_DFLOAT, |
cd5ecab6 | 443 | GFC_ISYM_DIGITS, |
6de9cd9a DN |
444 | GFC_ISYM_DIM, |
445 | GFC_ISYM_DOT_PRODUCT, | |
446 | GFC_ISYM_DPROD, | |
88a95a11 FXC |
447 | GFC_ISYM_DSHIFTL, |
448 | GFC_ISYM_DSHIFTR, | |
cd5ecab6 | 449 | GFC_ISYM_DTIME, |
6de9cd9a | 450 | GFC_ISYM_EOSHIFT, |
cd5ecab6 | 451 | GFC_ISYM_EPSILON, |
e8525382 SK |
452 | GFC_ISYM_ERF, |
453 | GFC_ISYM_ERFC, | |
f489fba1 | 454 | GFC_ISYM_ERFC_SCALED, |
2bd74949 | 455 | GFC_ISYM_ETIME, |
5df445a2 | 456 | GFC_ISYM_EVENT_QUERY, |
c14c8155 | 457 | GFC_ISYM_EXECUTE_COMMAND_LINE, |
cd5ecab6 | 458 | GFC_ISYM_EXIT, |
6de9cd9a DN |
459 | GFC_ISYM_EXP, |
460 | GFC_ISYM_EXPONENT, | |
cf2b3c22 | 461 | GFC_ISYM_EXTENDS_TYPE_OF, |
ef78bc3c | 462 | GFC_ISYM_FAILED_IMAGES, |
35059811 | 463 | GFC_ISYM_FDATE, |
f1abbf69 | 464 | GFC_ISYM_FE_RUNTIME_ERROR, |
5d723e54 FXC |
465 | GFC_ISYM_FGET, |
466 | GFC_ISYM_FGETC, | |
01ce9e31 | 467 | GFC_ISYM_FINDLOC, |
878f88b7 | 468 | GFC_ISYM_FLOAT, |
6de9cd9a | 469 | GFC_ISYM_FLOOR, |
cd5ecab6 | 470 | GFC_ISYM_FLUSH, |
df65f093 | 471 | GFC_ISYM_FNUM, |
5d723e54 FXC |
472 | GFC_ISYM_FPUT, |
473 | GFC_ISYM_FPUTC, | |
6de9cd9a | 474 | GFC_ISYM_FRACTION, |
cd5ecab6 DF |
475 | GFC_ISYM_FREE, |
476 | GFC_ISYM_FSEEK, | |
df65f093 | 477 | GFC_ISYM_FSTAT, |
5d723e54 | 478 | GFC_ISYM_FTELL, |
7bc19392 | 479 | GFC_ISYM_TGAMMA, |
cd5ecab6 DF |
480 | GFC_ISYM_GERROR, |
481 | GFC_ISYM_GETARG, | |
482 | GFC_ISYM_GET_COMMAND, | |
483 | GFC_ISYM_GET_COMMAND_ARGUMENT, | |
a8c60d7f | 484 | GFC_ISYM_GETCWD, |
cd5ecab6 DF |
485 | GFC_ISYM_GETENV, |
486 | GFC_ISYM_GET_ENVIRONMENT_VARIABLE, | |
4c0c6b9f | 487 | GFC_ISYM_GETGID, |
cd5ecab6 | 488 | GFC_ISYM_GETLOG, |
4c0c6b9f | 489 | GFC_ISYM_GETPID, |
f8862a1b | 490 | GFC_ISYM_GET_TEAM, |
4c0c6b9f | 491 | GFC_ISYM_GETUID, |
cd5ecab6 | 492 | GFC_ISYM_GMTIME, |
f77b6ca3 | 493 | GFC_ISYM_HOSTNM, |
cd5ecab6 | 494 | GFC_ISYM_HUGE, |
f489fba1 | 495 | GFC_ISYM_HYPOT, |
6de9cd9a | 496 | GFC_ISYM_IACHAR, |
195a95c4 | 497 | GFC_ISYM_IALL, |
6de9cd9a | 498 | GFC_ISYM_IAND, |
195a95c4 | 499 | GFC_ISYM_IANY, |
b41b2534 | 500 | GFC_ISYM_IARGC, |
6de9cd9a DN |
501 | GFC_ISYM_IBCLR, |
502 | GFC_ISYM_IBITS, | |
503 | GFC_ISYM_IBSET, | |
504 | GFC_ISYM_ICHAR, | |
cd5ecab6 | 505 | GFC_ISYM_IDATE, |
6de9cd9a | 506 | GFC_ISYM_IEOR, |
f77b6ca3 | 507 | GFC_ISYM_IERRNO, |
64f002ed | 508 | GFC_ISYM_IMAGE_INDEX, |
ef78bc3c | 509 | GFC_ISYM_IMAGE_STATUS, |
6de9cd9a DN |
510 | GFC_ISYM_INDEX, |
511 | GFC_ISYM_INT, | |
bf3fb7e4 FXC |
512 | GFC_ISYM_INT2, |
513 | GFC_ISYM_INT8, | |
6de9cd9a | 514 | GFC_ISYM_IOR, |
195a95c4 | 515 | GFC_ISYM_IPARITY, |
2bd74949 | 516 | GFC_ISYM_IRAND, |
ae8b8789 | 517 | GFC_ISYM_ISATTY, |
419af57c | 518 | GFC_ISYM_IS_CONTIGUOUS, |
bae89173 FXC |
519 | GFC_ISYM_IS_IOSTAT_END, |
520 | GFC_ISYM_IS_IOSTAT_EOR, | |
3d97b1af | 521 | GFC_ISYM_ISNAN, |
6de9cd9a DN |
522 | GFC_ISYM_ISHFT, |
523 | GFC_ISYM_ISHFTC, | |
cd5ecab6 DF |
524 | GFC_ISYM_ITIME, |
525 | GFC_ISYM_J0, | |
526 | GFC_ISYM_J1, | |
527 | GFC_ISYM_JN, | |
29698e0f | 528 | GFC_ISYM_JN2, |
f77b6ca3 | 529 | GFC_ISYM_KILL, |
cd5ecab6 | 530 | GFC_ISYM_KIND, |
6de9cd9a | 531 | GFC_ISYM_LBOUND, |
64f002ed | 532 | GFC_ISYM_LCOBOUND, |
414f00e9 | 533 | GFC_ISYM_LEADZ, |
6de9cd9a DN |
534 | GFC_ISYM_LEN, |
535 | GFC_ISYM_LEN_TRIM, | |
88607a9a | 536 | GFC_ISYM_LGAMMA, |
6de9cd9a DN |
537 | GFC_ISYM_LGE, |
538 | GFC_ISYM_LGT, | |
cd5ecab6 | 539 | GFC_ISYM_LINK, |
6de9cd9a DN |
540 | GFC_ISYM_LLE, |
541 | GFC_ISYM_LLT, | |
83d890b9 | 542 | GFC_ISYM_LOC, |
bf3fb7e4 | 543 | GFC_ISYM_LOG, |
6de9cd9a DN |
544 | GFC_ISYM_LOG10, |
545 | GFC_ISYM_LOGICAL, | |
bf3fb7e4 | 546 | GFC_ISYM_LONG, |
a119fc1c | 547 | GFC_ISYM_LSHIFT, |
bf3fb7e4 | 548 | GFC_ISYM_LSTAT, |
cd5ecab6 | 549 | GFC_ISYM_LTIME, |
0d519038 | 550 | GFC_ISYM_MALLOC, |
88a95a11 FXC |
551 | GFC_ISYM_MASKL, |
552 | GFC_ISYM_MASKR, | |
6de9cd9a DN |
553 | GFC_ISYM_MATMUL, |
554 | GFC_ISYM_MAX, | |
cd5ecab6 | 555 | GFC_ISYM_MAXEXPONENT, |
6de9cd9a DN |
556 | GFC_ISYM_MAXLOC, |
557 | GFC_ISYM_MAXVAL, | |
bf3fb7e4 FXC |
558 | GFC_ISYM_MCLOCK, |
559 | GFC_ISYM_MCLOCK8, | |
6de9cd9a | 560 | GFC_ISYM_MERGE, |
88a95a11 | 561 | GFC_ISYM_MERGE_BITS, |
6de9cd9a | 562 | GFC_ISYM_MIN, |
cd5ecab6 | 563 | GFC_ISYM_MINEXPONENT, |
6de9cd9a DN |
564 | GFC_ISYM_MINLOC, |
565 | GFC_ISYM_MINVAL, | |
566 | GFC_ISYM_MOD, | |
567 | GFC_ISYM_MODULO, | |
cd5ecab6 DF |
568 | GFC_ISYM_MOVE_ALLOC, |
569 | GFC_ISYM_MVBITS, | |
6de9cd9a | 570 | GFC_ISYM_NEAREST, |
cd5ecab6 | 571 | GFC_ISYM_NEW_LINE, |
6de9cd9a | 572 | GFC_ISYM_NINT, |
0cd0559e | 573 | GFC_ISYM_NORM2, |
6de9cd9a | 574 | GFC_ISYM_NOT, |
cd5ecab6 | 575 | GFC_ISYM_NULL, |
60386f50 | 576 | GFC_ISYM_NUM_IMAGES, |
5d723e54 | 577 | GFC_ISYM_OR, |
6de9cd9a | 578 | GFC_ISYM_PACK, |
0cd0559e | 579 | GFC_ISYM_PARITY, |
cd5ecab6 | 580 | GFC_ISYM_PERROR, |
ad5f4de2 FXC |
581 | GFC_ISYM_POPCNT, |
582 | GFC_ISYM_POPPAR, | |
cd5ecab6 | 583 | GFC_ISYM_PRECISION, |
6de9cd9a DN |
584 | GFC_ISYM_PRESENT, |
585 | GFC_ISYM_PRODUCT, | |
cd5ecab6 | 586 | GFC_ISYM_RADIX, |
2bd74949 | 587 | GFC_ISYM_RAND, |
ddd3e26e | 588 | GFC_ISYM_RANDOM_INIT, |
cd5ecab6 DF |
589 | GFC_ISYM_RANDOM_NUMBER, |
590 | GFC_ISYM_RANDOM_SEED, | |
591 | GFC_ISYM_RANGE, | |
2514987f | 592 | GFC_ISYM_RANK, |
6de9cd9a | 593 | GFC_ISYM_REAL, |
878f88b7 | 594 | GFC_ISYM_REALPART, |
f77b6ca3 | 595 | GFC_ISYM_RENAME, |
6de9cd9a DN |
596 | GFC_ISYM_REPEAT, |
597 | GFC_ISYM_RESHAPE, | |
598 | GFC_ISYM_RRSPACING, | |
cd5ecab6 | 599 | GFC_ISYM_RSHIFT, |
cf2b3c22 | 600 | GFC_ISYM_SAME_TYPE_AS, |
a39fafac | 601 | GFC_ISYM_SC_KIND, |
6de9cd9a DN |
602 | GFC_ISYM_SCALE, |
603 | GFC_ISYM_SCAN, | |
53096259 | 604 | GFC_ISYM_SECNDS, |
cd5ecab6 | 605 | GFC_ISYM_SECOND, |
6de9cd9a DN |
606 | GFC_ISYM_SET_EXPONENT, |
607 | GFC_ISYM_SHAPE, | |
88a95a11 FXC |
608 | GFC_ISYM_SHIFTA, |
609 | GFC_ISYM_SHIFTL, | |
610 | GFC_ISYM_SHIFTR, | |
f0f67c96 | 611 | GFC_ISYM_BACKTRACE, |
6de9cd9a | 612 | GFC_ISYM_SIGN, |
185d7d97 | 613 | GFC_ISYM_SIGNAL, |
cd5ecab6 | 614 | GFC_ISYM_SI_KIND, |
6de9cd9a | 615 | GFC_ISYM_SIN, |
57391dda | 616 | GFC_ISYM_SIND, |
6de9cd9a DN |
617 | GFC_ISYM_SINH, |
618 | GFC_ISYM_SIZE, | |
cd5ecab6 | 619 | GFC_ISYM_SLEEP, |
fd2157ce | 620 | GFC_ISYM_SIZEOF, |
878f88b7 | 621 | GFC_ISYM_SNGL, |
6de9cd9a DN |
622 | GFC_ISYM_SPACING, |
623 | GFC_ISYM_SPREAD, | |
624 | GFC_ISYM_SQRT, | |
cd5ecab6 | 625 | GFC_ISYM_SRAND, |
6de9cd9a | 626 | GFC_ISYM_SR_KIND, |
df65f093 | 627 | GFC_ISYM_STAT, |
ef78bc3c | 628 | GFC_ISYM_STOPPED_IMAGES, |
048510c8 | 629 | GFC_ISYM_STORAGE_SIZE, |
0881224e | 630 | GFC_ISYM_STRIDE, |
6de9cd9a | 631 | GFC_ISYM_SUM, |
cd5ecab6 | 632 | GFC_ISYM_SYMLINK, |
f77b6ca3 | 633 | GFC_ISYM_SYMLNK, |
5b1374e9 | 634 | GFC_ISYM_SYSTEM, |
cd5ecab6 | 635 | GFC_ISYM_SYSTEM_CLOCK, |
6de9cd9a | 636 | GFC_ISYM_TAN, |
57391dda | 637 | GFC_ISYM_TAND, |
6de9cd9a | 638 | GFC_ISYM_TANH, |
f8862a1b | 639 | GFC_ISYM_TEAM_NUMBER, |
64f002ed | 640 | GFC_ISYM_THIS_IMAGE, |
f77b6ca3 FXC |
641 | GFC_ISYM_TIME, |
642 | GFC_ISYM_TIME8, | |
cd5ecab6 | 643 | GFC_ISYM_TINY, |
414f00e9 | 644 | GFC_ISYM_TRAILZ, |
6de9cd9a DN |
645 | GFC_ISYM_TRANSFER, |
646 | GFC_ISYM_TRANSPOSE, | |
647 | GFC_ISYM_TRIM, | |
25fc05eb | 648 | GFC_ISYM_TTYNAM, |
6de9cd9a | 649 | GFC_ISYM_UBOUND, |
64f002ed | 650 | GFC_ISYM_UCOBOUND, |
d8fe26b2 SK |
651 | GFC_ISYM_UMASK, |
652 | GFC_ISYM_UNLINK, | |
6de9cd9a DN |
653 | GFC_ISYM_UNPACK, |
654 | GFC_ISYM_VERIFY, | |
5d723e54 | 655 | GFC_ISYM_XOR, |
cd5ecab6 DF |
656 | GFC_ISYM_Y0, |
657 | GFC_ISYM_Y1, | |
29698e0f TB |
658 | GFC_ISYM_YN, |
659 | GFC_ISYM_YN2 | |
6de9cd9a | 660 | }; |
6de9cd9a | 661 | |
a79683d5 | 662 | enum init_local_logical |
51b09ce3 AL |
663 | { |
664 | GFC_INIT_LOGICAL_OFF = 0, | |
665 | GFC_INIT_LOGICAL_FALSE, | |
666 | GFC_INIT_LOGICAL_TRUE | |
a79683d5 | 667 | }; |
51b09ce3 | 668 | |
a79683d5 | 669 | enum init_local_character |
51b09ce3 AL |
670 | { |
671 | GFC_INIT_CHARACTER_OFF = 0, | |
672 | GFC_INIT_CHARACTER_ON | |
a79683d5 | 673 | }; |
51b09ce3 | 674 | |
a79683d5 | 675 | enum init_local_integer |
51b09ce3 AL |
676 | { |
677 | GFC_INIT_INTEGER_OFF = 0, | |
678 | GFC_INIT_INTEGER_ON | |
a79683d5 | 679 | }; |
51b09ce3 | 680 | |
a79683d5 | 681 | enum gfc_reverse |
3d03ead0 | 682 | { |
aed5574e PT |
683 | GFC_ENABLE_REVERSE, |
684 | GFC_FORWARD_SET, | |
3d03ead0 | 685 | GFC_REVERSE_SET, |
aed5574e | 686 | GFC_INHIBIT_REVERSE |
a79683d5 | 687 | }; |
3d03ead0 | 688 | |
5bab4c96 PT |
689 | enum gfc_param_spec_type |
690 | { | |
691 | SPEC_EXPLICIT, | |
692 | SPEC_ASSUMED, | |
693 | SPEC_DEFERRED | |
694 | }; | |
695 | ||
6de9cd9a DN |
696 | /************************* Structures *****************************/ |
697 | ||
5cf54585 TS |
698 | /* Used for keeping things in balanced binary trees. */ |
699 | #define BBT_HEADER(self) int priority; struct self *left, *right | |
700 | ||
7306b628 | 701 | #define NAMED_INTCST(a,b,c,d) a, |
be1f1ed9 | 702 | #define NAMED_KINDARRAY(a,b,c,d) a, |
d000aa67 | 703 | #define NAMED_FUNCTION(a,b,c,d) a, |
cadddfdd | 704 | #define NAMED_SUBROUTINE(a,b,c,d) a, |
fea54935 | 705 | #define NAMED_DERIVED_TYPE(a,b,c,d) a, |
a79683d5 | 706 | enum iso_fortran_env_symbol |
a8b3b0b6 CR |
707 | { |
708 | ISOFORTRANENV_INVALID = -1, | |
709 | #include "iso-fortran-env.def" | |
710 | ISOFORTRANENV_LAST, ISOFORTRANENV_NUMBER = ISOFORTRANENV_LAST | |
a79683d5 | 711 | }; |
d000aa67 | 712 | #undef NAMED_INTCST |
be1f1ed9 | 713 | #undef NAMED_KINDARRAY |
d000aa67 | 714 | #undef NAMED_FUNCTION |
cadddfdd | 715 | #undef NAMED_SUBROUTINE |
fea54935 | 716 | #undef NAMED_DERIVED_TYPE |
a8b3b0b6 | 717 | |
7306b628 | 718 | #define NAMED_INTCST(a,b,c,d) a, |
28d0b595 TB |
719 | #define NAMED_REALCST(a,b,c,d) a, |
720 | #define NAMED_CMPXCST(a,b,c,d) a, | |
a8b3b0b6 CR |
721 | #define NAMED_LOGCST(a,b,c) a, |
722 | #define NAMED_CHARKNDCST(a,b,c) a, | |
723 | #define NAMED_CHARCST(a,b,c) a, | |
724 | #define DERIVED_TYPE(a,b,c) a, | |
d000aa67 | 725 | #define NAMED_FUNCTION(a,b,c,d) a, |
cadddfdd | 726 | #define NAMED_SUBROUTINE(a,b,c,d) a, |
a79683d5 | 727 | enum iso_c_binding_symbol |
a8b3b0b6 | 728 | { |
4d382327 | 729 | ISOCBINDING_INVALID = -1, |
a8b3b0b6 CR |
730 | #include "iso-c-binding.def" |
731 | ISOCBINDING_LAST, | |
732 | ISOCBINDING_NUMBER = ISOCBINDING_LAST | |
a79683d5 | 733 | }; |
a8b3b0b6 CR |
734 | #undef NAMED_INTCST |
735 | #undef NAMED_REALCST | |
736 | #undef NAMED_CMPXCST | |
737 | #undef NAMED_LOGCST | |
738 | #undef NAMED_CHARKNDCST | |
739 | #undef NAMED_CHARCST | |
740 | #undef DERIVED_TYPE | |
d000aa67 | 741 | #undef NAMED_FUNCTION |
cadddfdd | 742 | #undef NAMED_SUBROUTINE |
a8b3b0b6 | 743 | |
a79683d5 | 744 | enum intmod_id |
a8b3b0b6 | 745 | { |
8b198102 FXC |
746 | INTMOD_NONE = 0, INTMOD_ISO_FORTRAN_ENV, INTMOD_ISO_C_BINDING, |
747 | INTMOD_IEEE_FEATURES, INTMOD_IEEE_EXCEPTIONS, INTMOD_IEEE_ARITHMETIC | |
a79683d5 | 748 | }; |
a8b3b0b6 CR |
749 | |
750 | typedef struct | |
751 | { | |
752 | char name[GFC_MAX_SYMBOL_LEN + 1]; | |
753 | int value; /* Used for both integer and character values. */ | |
754 | bt f90_type; | |
755 | } | |
756 | CInteropKind_t; | |
757 | ||
758 | /* Array of structs, where the structs represent the C interop kinds. | |
759 | The list will be implemented based on a hash of the kind name since | |
760 | these could be accessed multiple times. | |
761 | Declared in trans-types.c as a global, since it's in that file | |
762 | that the list is initialized. */ | |
763 | extern CInteropKind_t c_interop_kinds_table[]; | |
764 | ||
d58e7173 TB |
765 | enum gfc_omp_device_type |
766 | { | |
767 | OMP_DEVICE_TYPE_UNSET, | |
768 | OMP_DEVICE_TYPE_HOST, | |
769 | OMP_DEVICE_TYPE_NOHOST, | |
770 | OMP_DEVICE_TYPE_ANY | |
771 | }; | |
08a6b8e0 TB |
772 | |
773 | /* Structure and list of supported extension attributes. */ | |
2b374f55 | 774 | typedef enum |
08a6b8e0 TB |
775 | { |
776 | EXT_ATTR_DLLIMPORT = 0, | |
777 | EXT_ATTR_DLLEXPORT, | |
778 | EXT_ATTR_STDCALL, | |
779 | EXT_ATTR_CDECL, | |
780 | EXT_ATTR_FASTCALL, | |
e7ac6a7c | 781 | EXT_ATTR_NO_ARG_CHECK, |
0caf400a | 782 | EXT_ATTR_DEPRECATED, |
08a6b8e0 | 783 | EXT_ATTR_LAST, EXT_ATTR_NUM = EXT_ATTR_LAST |
2b374f55 TB |
784 | } |
785 | ext_attr_id_t; | |
08a6b8e0 TB |
786 | |
787 | typedef struct | |
788 | { | |
789 | const char *name; | |
790 | unsigned id; | |
791 | const char *middle_end_name; | |
792 | } | |
793 | ext_attr_t; | |
794 | ||
795 | extern const ext_attr_t ext_attr_list[]; | |
796 | ||
6de9cd9a DN |
797 | /* Symbol attribute structure. */ |
798 | typedef struct | |
799 | { | |
800 | /* Variable attributes. */ | |
be59db2d | 801 | unsigned allocatable:1, dimension:1, codimension:1, external:1, intrinsic:1, |
59e36b72 | 802 | optional:1, pointer:1, target:1, value:1, volatile_:1, temporary:1, |
e9bd9f7d | 803 | dummy:1, result:1, assign:1, threadprivate:1, not_always_present:1, |
fe4e525c | 804 | implied_index:1, subref_array_pointer:1, proc_pointer:1, asynchronous:1, |
34d567d1 | 805 | contiguous:1, fe_temp: 1, automatic: 1; |
6de9cd9a | 806 | |
41a394bb DK |
807 | /* For CLASS containers, the pointer attribute is sometimes set internally |
808 | even though it was not directly specified. In this case, keep the | |
809 | "real" (original) value here. */ | |
810 | unsigned class_pointer:1; | |
811 | ||
5349080d TB |
812 | ENUM_BITFIELD (save_state) save:2; |
813 | ||
6de9cd9a | 814 | unsigned data:1, /* Symbol is named in a DATA statement. */ |
8b11b59f | 815 | is_protected:1, /* Symbol has been marked as protected. */ |
993ef28f | 816 | use_assoc:1, /* Symbol has been use-associated. */ |
4668d6f9 PT |
817 | used_in_submodule:1, /* Symbol has been use-associated in a |
818 | submodule. Needed since these entities must | |
819 | be set host associated to be compliant. */ | |
5a8af0b4 | 820 | use_only:1, /* Symbol has been use-associated, with ONLY. */ |
0e5a218b | 821 | use_rename:1, /* Symbol has been use-associated and renamed. */ |
022e30c0 | 822 | imported:1, /* Symbol has been associated by IMPORT. */ |
4d382327 | 823 | host_assoc:1; /* Symbol has been host associated. */ |
6de9cd9a | 824 | |
30aabb86 | 825 | unsigned in_namelist:1, in_common:1, in_equivalence:1; |
69773742 JW |
826 | unsigned function:1, subroutine:1, procedure:1; |
827 | unsigned generic:1, generic_copy:1; | |
d1303acd | 828 | unsigned implicit_type:1; /* Type defined via implicit rules. */ |
ebb479cd | 829 | unsigned untyped:1; /* No implicit type could be found. */ |
6de9cd9a | 830 | |
ebb479cd | 831 | unsigned is_bind_c:1; /* say if is bound to C. */ |
7c1dab0d | 832 | unsigned extension:8; /* extension level of a derived type. */ |
cf2b3c22 | 833 | unsigned is_class:1; /* is a CLASS container. */ |
2e23972e | 834 | unsigned class_ok:1; /* is a CLASS object with correct attributes. */ |
eece1eb9 PT |
835 | unsigned vtab:1; /* is a derived type vtab, pointed to by CLASS objects. */ |
836 | unsigned vtype:1; /* is a derived type of a vtab. */ | |
a8b3b0b6 CR |
837 | |
838 | /* These flags are both in the typespec and attribute. The attribute | |
839 | list is what gets read from/written to a module file. The typespec | |
840 | is created from a decl being processed. */ | |
841 | unsigned is_c_interop:1; /* It's c interoperable. */ | |
842 | unsigned is_iso_c:1; /* Symbol is from iso_c_binding. */ | |
843 | ||
6de9cd9a DN |
844 | /* Function/subroutine attributes */ |
845 | unsigned sequence:1, elemental:1, pure:1, recursive:1; | |
9e1d712c | 846 | unsigned unmaskable:1, masked:1, contained:1, mod_proc:1, abstract:1; |
6de9cd9a | 847 | |
4668d6f9 PT |
848 | /* Set if this is a module function or subroutine. Note that it is an |
849 | attribute because it appears as a prefix in the declaration like | |
850 | PURE, etc.. */ | |
851 | unsigned module_procedure:1; | |
852 | ||
cdd244b8 TB |
853 | /* Set if a (public) symbol [e.g. generic name] exposes this symbol, |
854 | which is relevant for private module procedures. */ | |
855 | unsigned public_used:1; | |
856 | ||
f1f39033 PT |
857 | /* This is set if a contained procedure could be declared pure. This is |
858 | used for certain optimizations that require the result or arguments | |
859 | cannot alias. Note that this is zero for PURE procedures. */ | |
860 | unsigned implicit_pure:1; | |
861 | ||
30c931de | 862 | /* This is set for a procedure that contains expressions referencing |
e73d3ca6 | 863 | arrays coming from outside its namespace. |
30c931de PT |
864 | This is used to force the creation of a temporary when the LHS of |
865 | an array assignment may be used by an elemental procedure appearing | |
866 | on the RHS. */ | |
867 | unsigned array_outer_dependency:1; | |
868 | ||
fe58e076 TK |
869 | /* This is set if the subroutine doesn't return. Currently, this |
870 | is only possible for intrinsic subroutines. */ | |
871 | unsigned noreturn:1; | |
872 | ||
3d79abbd PB |
873 | /* Set if this procedure is an alternate entry point. These procedures |
874 | don't have any code associated, and the backend will turn them into | |
875 | thunks to the master function. */ | |
876 | unsigned entry:1; | |
8b67b708 | 877 | |
3d79abbd PB |
878 | /* Set if this is the master function for a procedure with multiple |
879 | entry points. */ | |
880 | unsigned entry_master:1; | |
8b67b708 | 881 | |
d198b59a JJ |
882 | /* Set if this is the master function for a function with multiple |
883 | entry points where characteristics of the entry points differ. */ | |
884 | unsigned mixed_entry_master:1; | |
3d79abbd | 885 | |
6de9cd9a DN |
886 | /* Set if a function must always be referenced by an explicit interface. */ |
887 | unsigned always_explicit:1; | |
888 | ||
8e54f139 TB |
889 | /* Set if the symbol is generated and, hence, standard violations |
890 | shouldn't be flaged. */ | |
891 | unsigned artificial:1; | |
892 | ||
6de9cd9a DN |
893 | /* Set if the symbol has been referenced in an expression. No further |
894 | modification of type or type parameters is permitted. */ | |
895 | unsigned referenced:1; | |
896 | ||
ecf24057 | 897 | /* Set if this is the symbol for the main program. */ |
8b67b708 FXC |
898 | unsigned is_main_program:1; |
899 | ||
6de9cd9a | 900 | /* Mutually exclusive multibit attributes. */ |
5f42ddb0 KG |
901 | ENUM_BITFIELD (gfc_access) access:2; |
902 | ENUM_BITFIELD (sym_intent) intent:2; | |
903 | ENUM_BITFIELD (sym_flavor) flavor:4; | |
904 | ENUM_BITFIELD (ifsrc) if_source:2; | |
6de9cd9a | 905 | |
5f42ddb0 | 906 | ENUM_BITFIELD (procedure_type) proc:3; |
949446f5 | 907 | |
83d890b9 | 908 | /* Special attributes for Cray pointers, pointees. */ |
949446f5 | 909 | unsigned cray_pointer:1, cray_pointee:1; |
6de9cd9a | 910 | |
4d382327 | 911 | /* The symbol is a derived type with allocatable components, pointer |
713485cc JW |
912 | components or private components, procedure pointer components, |
913 | possibly nested. zero_comp is true if the derived type has no | |
4d382327 | 914 | component at all. defined_assign_comp is true if the derived |
8b704316 PT |
915 | type or a (sub-)component has a typebound defined assignment. |
916 | unlimited_polymorphic flags the type of the container for these | |
917 | entities. */ | |
713485cc | 918 | unsigned alloc_comp:1, pointer_comp:1, proc_pointer_comp:1, |
4d382327 | 919 | private_comp:1, zero_comp:1, coarray_comp:1, lock_comp:1, |
e73d3ca6 | 920 | event_comp:1, defined_assign_comp:1, unlimited_polymorphic:1, |
f549bfb3 | 921 | has_dtio_procs:1, caf_token:1; |
77bb16aa | 922 | |
70570ec1 PT |
923 | /* This is a temporary selector for SELECT TYPE/RANK or an associate |
924 | variable for SELECT TYPE/RANK or ASSOCIATE. */ | |
925 | unsigned select_type_temporary:1, select_rank_temporary:1, associate_var:1; | |
8c91ab34 | 926 | |
5bab4c96 PT |
927 | /* These are the attributes required for parameterized derived |
928 | types. */ | |
929 | unsigned pdt_kind:1, pdt_len:1, pdt_type:1, pdt_template:1, | |
930 | pdt_array:1, pdt_string:1; | |
931 | ||
5f23671d JJ |
932 | /* This is omp_{out,in,priv,orig} artificial variable in |
933 | !$OMP DECLARE REDUCTION. */ | |
934 | unsigned omp_udr_artificial_var:1; | |
935 | ||
f014c653 JJ |
936 | /* Mentioned in OMP DECLARE TARGET. */ |
937 | unsigned omp_declare_target:1; | |
b4c3a85b | 938 | unsigned omp_declare_target_link:1; |
d58e7173 | 939 | ENUM_BITFIELD (gfc_omp_device_type) omp_device_type:2; |
f014c653 | 940 | |
dc7a8b4b JN |
941 | /* Mentioned in OACC DECLARE. */ |
942 | unsigned oacc_declare_create:1; | |
943 | unsigned oacc_declare_copyin:1; | |
944 | unsigned oacc_declare_deviceptr:1; | |
945 | unsigned oacc_declare_device_resident:1; | |
946 | unsigned oacc_declare_link:1; | |
947 | ||
68034b1b TS |
948 | /* OpenACC 'routine' directive's level of parallelism. */ |
949 | ENUM_BITFIELD (oacc_routine_lop) oacc_routine_lop:3; | |
a61f6afb | 950 | unsigned oacc_routine_nohost:1; |
db941d7e | 951 | |
08a6b8e0 TB |
952 | /* Attributes set by compiler extensions (!GCC$ ATTRIBUTES). */ |
953 | unsigned ext_attr:EXT_ATTR_NUM; | |
954 | ||
1eee5628 TB |
955 | /* The namespace where the attribute has been set. */ |
956 | struct gfc_namespace *volatile_ns, *asynchronous_ns; | |
6de9cd9a DN |
957 | } |
958 | symbol_attribute; | |
959 | ||
960 | ||
8fc541d3 FXC |
961 | /* We need to store source lines as sequences of multibyte source |
962 | characters. We define here a type wide enough to hold any multibyte | |
963 | source character, just like libcpp does. A 32-bit type is enough. */ | |
964 | ||
965 | #if HOST_BITS_PER_INT >= 32 | |
966 | typedef unsigned int gfc_char_t; | |
967 | #elif HOST_BITS_PER_LONG >= 32 | |
968 | typedef unsigned long gfc_char_t; | |
969 | #elif defined(HAVE_LONG_LONG) && (HOST_BITS_PER_LONGLONG >= 32) | |
970 | typedef unsigned long long gfc_char_t; | |
971 | #else | |
972 | # error "Cannot find an integer type with at least 32 bits" | |
973 | #endif | |
974 | ||
975 | ||
d4fa05b9 | 976 | /* The following three structures are used to identify a location in |
949446f5 BF |
977 | the sources. |
978 | ||
d4fa05b9 TS |
979 | gfc_file is used to maintain a tree of the source files and how |
980 | they include each other | |
6de9cd9a | 981 | |
d4fa05b9 TS |
982 | gfc_linebuf holds a single line of source code and information |
983 | which file it resides in | |
6de9cd9a | 984 | |
d4fa05b9 | 985 | locus point to the sourceline and the character in the source |
949446f5 | 986 | line. |
d4fa05b9 | 987 | */ |
6de9cd9a | 988 | |
949446f5 | 989 | typedef struct gfc_file |
6de9cd9a | 990 | { |
1b271c9b | 991 | struct gfc_file *next, *up; |
d4fa05b9 TS |
992 | int inclusion_line, line; |
993 | char *filename; | |
994 | } gfc_file; | |
995 | ||
949446f5 | 996 | typedef struct gfc_linebuf |
d4fa05b9 | 997 | { |
620e594b | 998 | location_t location; |
d4fa05b9 TS |
999 | struct gfc_file *file; |
1000 | struct gfc_linebuf *next; | |
1001 | ||
ba1defa5 | 1002 | int truncated; |
9e8a6720 | 1003 | bool dbg_emitted; |
ba1defa5 | 1004 | |
8fc541d3 | 1005 | gfc_char_t line[1]; |
d4fa05b9 | 1006 | } gfc_linebuf; |
4cdf7223 PB |
1007 | |
1008 | #define gfc_linebuf_header_size (offsetof (gfc_linebuf, line)) | |
1009 | ||
5ffeb913 | 1010 | #define gfc_linebuf_linenum(LBUF) (LOCATION_LINE ((LBUF)->location)) |
5ffeb913 | 1011 | |
949446f5 | 1012 | typedef struct |
d4fa05b9 | 1013 | { |
8fc541d3 | 1014 | gfc_char_t *nextc; |
d4fa05b9 TS |
1015 | gfc_linebuf *lb; |
1016 | } locus; | |
6de9cd9a | 1017 | |
0ce0154c KG |
1018 | /* In order for the "gfc" format checking to work correctly, you must |
1019 | have declared a typedef locus first. */ | |
1020 | #if GCC_VERSION >= 4001 | |
1021 | #define ATTRIBUTE_GCC_GFC(m, n) __attribute__ ((__format__ (__gcc_gfc__, m, n))) ATTRIBUTE_NONNULL(m) | |
1022 | #else | |
1023 | #define ATTRIBUTE_GCC_GFC(m, n) ATTRIBUTE_NONNULL(m) | |
1024 | #endif | |
1025 | ||
6de9cd9a | 1026 | |
a3d3c0f5 DK |
1027 | /* Suppress error messages or re-enable them. */ |
1028 | ||
1029 | void gfc_push_suppress_errors (void); | |
1030 | void gfc_pop_suppress_errors (void); | |
6de9cd9a DN |
1031 | |
1032 | ||
1033 | /* Character length structures hold the expression that gives the | |
1034 | length of a character variable. We avoid putting these into | |
1035 | gfc_typespec because doing so prevents us from doing structure | |
1036 | copies and forces us to deallocate any typespecs we create, as well | |
1037 | as structures that contain typespecs. They also can have multiple | |
1038 | character typespecs pointing to them. | |
1039 | ||
1040 | These structures form a singly linked list within the current | |
1041 | namespace and are deallocated with the namespace. It is possible to | |
1042 | end up with gfc_charlen structures that have nothing pointing to them. */ | |
1043 | ||
1044 | typedef struct gfc_charlen | |
1045 | { | |
1046 | struct gfc_expr *length; | |
1047 | struct gfc_charlen *next; | |
c03fc95d | 1048 | bool length_from_typespec; /* Length from explicit array ctor typespec? */ |
6de9cd9a | 1049 | tree backend_decl; |
e69afb29 | 1050 | tree passed_length; /* Length argument explicitly passed. */ |
110eec24 TS |
1051 | |
1052 | int resolved; | |
6de9cd9a DN |
1053 | } |
1054 | gfc_charlen; | |
1055 | ||
ece3f663 | 1056 | #define gfc_get_charlen() XCNEW (gfc_charlen) |
6de9cd9a | 1057 | |
bc21d315 | 1058 | /* Type specification structure. */ |
6de9cd9a DN |
1059 | typedef struct |
1060 | { | |
1061 | bt type; | |
1062 | int kind; | |
bc21d315 JW |
1063 | |
1064 | union | |
1065 | { | |
1066 | struct gfc_symbol *derived; /* For derived types only. */ | |
1067 | gfc_charlen *cl; /* For character types only. */ | |
401fcd3b | 1068 | int pad; /* For hollerith types only. */ |
bc21d315 JW |
1069 | } |
1070 | u; | |
1071 | ||
32d99e68 | 1072 | struct gfc_symbol *interface; /* For PROCEDURE declarations. */ |
a8b3b0b6 CR |
1073 | int is_c_interop; |
1074 | int is_iso_c; | |
e69afb29 SK |
1075 | bt f90_type; |
1076 | bool deferred; | |
e655a6cc | 1077 | gfc_symbol *interop_kind; |
6de9cd9a DN |
1078 | } |
1079 | gfc_typespec; | |
1080 | ||
1081 | /* Array specification. */ | |
1082 | typedef struct | |
1083 | { | |
c62c6622 | 1084 | int rank; /* A scalar has a rank of 0, an assumed-rank array has -1. */ |
be59db2d | 1085 | int corank; |
178f9aa1 | 1086 | array_type type, cotype; |
6de9cd9a | 1087 | struct gfc_expr *lower[GFC_MAX_DIMENSIONS], *upper[GFC_MAX_DIMENSIONS]; |
83d890b9 AL |
1088 | |
1089 | /* These two fields are used with the Cray Pointer extension. */ | |
1090 | bool cray_pointee; /* True iff this spec belongs to a cray pointee. */ | |
1091 | bool cp_was_assumed; /* AS_ASSUMED_SIZE cp arrays are converted to | |
1092 | AS_EXPLICIT, but we want to remember that we | |
1093 | did this. */ | |
9b7df66f TK |
1094 | |
1095 | bool resolved; | |
6de9cd9a DN |
1096 | } |
1097 | gfc_array_spec; | |
1098 | ||
ece3f663 | 1099 | #define gfc_get_array_spec() XCNEW (gfc_array_spec) |
6de9cd9a DN |
1100 | |
1101 | ||
1102 | /* Components of derived types. */ | |
1103 | typedef struct gfc_component | |
1104 | { | |
cb9e4f55 | 1105 | const char *name; |
6de9cd9a DN |
1106 | gfc_typespec ts; |
1107 | ||
d4b7d0f0 | 1108 | symbol_attribute attr; |
6de9cd9a DN |
1109 | gfc_array_spec *as; |
1110 | ||
1111 | tree backend_decl; | |
b3c1b8a1 MM |
1112 | /* Used to cache a FIELD_DECL matching this same component |
1113 | but applied to a different backend containing type that was | |
1114 | generated by gfc_nonrestricted_type. */ | |
1115 | tree norestrict_decl; | |
6de9cd9a DN |
1116 | locus loc; |
1117 | struct gfc_expr *initializer; | |
5bab4c96 PT |
1118 | /* Used in parameterized derived type declarations to store parameterized |
1119 | kind expressions. */ | |
1120 | struct gfc_expr *kind_expr; | |
1121 | struct gfc_actual_arglist *param_list; | |
1122 | ||
6de9cd9a | 1123 | struct gfc_component *next; |
713485cc | 1124 | |
90661f26 | 1125 | /* Needed for procedure pointer components. */ |
90661f26 | 1126 | struct gfc_typebound_proc *tb; |
3c9f5092 AV |
1127 | /* When allocatable/pointer and in a coarray the associated token. */ |
1128 | tree caf_token; | |
6de9cd9a DN |
1129 | } |
1130 | gfc_component; | |
1131 | ||
ece3f663 | 1132 | #define gfc_get_component() XCNEW (gfc_component) |
6de9cd9a DN |
1133 | |
1134 | /* Formal argument lists are lists of symbols. */ | |
1135 | typedef struct gfc_formal_arglist | |
1136 | { | |
4f613946 | 1137 | /* Symbol representing the argument at this position in the arglist. */ |
6de9cd9a | 1138 | struct gfc_symbol *sym; |
4f613946 | 1139 | /* Points to the next formal argument. */ |
6de9cd9a DN |
1140 | struct gfc_formal_arglist *next; |
1141 | } | |
1142 | gfc_formal_arglist; | |
1143 | ||
ece3f663 | 1144 | #define gfc_get_formal_arglist() XCNEW (gfc_formal_arglist) |
6de9cd9a DN |
1145 | |
1146 | ||
5bab4c96 PT |
1147 | /* The gfc_actual_arglist structure is for actual arguments and |
1148 | for type parameter specification lists. */ | |
6de9cd9a DN |
1149 | typedef struct gfc_actual_arglist |
1150 | { | |
cb9e4f55 | 1151 | const char *name; |
6de9cd9a DN |
1152 | /* Alternate return label when the expr member is null. */ |
1153 | struct gfc_st_label *label; | |
1154 | ||
1600fe22 TS |
1155 | /* This is set to the type of an eventual omitted optional |
1156 | argument. This is used to determine if a hidden string length | |
1157 | argument has to be added to a function call. */ | |
1158 | bt missing_arg_type; | |
1159 | ||
5bab4c96 PT |
1160 | gfc_param_spec_type spec_type; |
1161 | ||
6de9cd9a DN |
1162 | struct gfc_expr *expr; |
1163 | struct gfc_actual_arglist *next; | |
1164 | } | |
1165 | gfc_actual_arglist; | |
1166 | ||
ece3f663 | 1167 | #define gfc_get_actual_arglist() XCNEW (gfc_actual_arglist) |
6de9cd9a DN |
1168 | |
1169 | ||
1170 | /* Because a symbol can belong to multiple namelists, they must be | |
1171 | linked externally to the symbol itself. */ | |
1172 | typedef struct gfc_namelist | |
1173 | { | |
1174 | struct gfc_symbol *sym; | |
1175 | struct gfc_namelist *next; | |
1176 | } | |
1177 | gfc_namelist; | |
1178 | ||
ece3f663 | 1179 | #define gfc_get_namelist() XCNEW (gfc_namelist) |
6de9cd9a | 1180 | |
41dbbb37 TS |
1181 | /* Likewise to gfc_namelist, but contains expressions. */ |
1182 | typedef struct gfc_expr_list | |
1183 | { | |
1184 | struct gfc_expr *expr; | |
1185 | struct gfc_expr_list *next; | |
1186 | } | |
1187 | gfc_expr_list; | |
1188 | ||
1189 | #define gfc_get_expr_list() XCNEW (gfc_expr_list) | |
1190 | ||
a79683d5 | 1191 | enum gfc_omp_reduction_op |
5f23671d JJ |
1192 | { |
1193 | OMP_REDUCTION_NONE = -1, | |
1194 | OMP_REDUCTION_PLUS = INTRINSIC_PLUS, | |
1195 | OMP_REDUCTION_MINUS = INTRINSIC_MINUS, | |
1196 | OMP_REDUCTION_TIMES = INTRINSIC_TIMES, | |
1197 | OMP_REDUCTION_AND = INTRINSIC_AND, | |
1198 | OMP_REDUCTION_OR = INTRINSIC_OR, | |
1199 | OMP_REDUCTION_EQV = INTRINSIC_EQV, | |
1200 | OMP_REDUCTION_NEQV = INTRINSIC_NEQV, | |
1201 | OMP_REDUCTION_MAX = GFC_INTRINSIC_END, | |
1202 | OMP_REDUCTION_MIN, | |
1203 | OMP_REDUCTION_IAND, | |
1204 | OMP_REDUCTION_IOR, | |
1205 | OMP_REDUCTION_IEOR, | |
1206 | OMP_REDUCTION_USER | |
a79683d5 | 1207 | }; |
5f23671d | 1208 | |
a79683d5 | 1209 | enum gfc_omp_depend_op |
f014c653 | 1210 | { |
a61c4964 | 1211 | OMP_DEPEND_UNSET, |
f014c653 JJ |
1212 | OMP_DEPEND_IN, |
1213 | OMP_DEPEND_OUT, | |
b4c3a85b | 1214 | OMP_DEPEND_INOUT, |
a61c4964 TB |
1215 | OMP_DEPEND_MUTEXINOUTSET, |
1216 | OMP_DEPEND_DEPOBJ, | |
b4c3a85b JJ |
1217 | OMP_DEPEND_SINK_FIRST, |
1218 | OMP_DEPEND_SINK | |
a79683d5 | 1219 | }; |
f014c653 | 1220 | |
a79683d5 | 1221 | enum gfc_omp_map_op |
f014c653 JJ |
1222 | { |
1223 | OMP_MAP_ALLOC, | |
a6163563 | 1224 | OMP_MAP_IF_PRESENT, |
549188ea | 1225 | OMP_MAP_ATTACH, |
f014c653 JJ |
1226 | OMP_MAP_TO, |
1227 | OMP_MAP_FROM, | |
41dbbb37 | 1228 | OMP_MAP_TOFROM, |
91106e84 | 1229 | OMP_MAP_DELETE, |
549188ea | 1230 | OMP_MAP_DETACH, |
41dbbb37 | 1231 | OMP_MAP_FORCE_ALLOC, |
41dbbb37 TS |
1232 | OMP_MAP_FORCE_TO, |
1233 | OMP_MAP_FORCE_FROM, | |
1234 | OMP_MAP_FORCE_TOFROM, | |
1235 | OMP_MAP_FORCE_PRESENT, | |
dc7a8b4b JN |
1236 | OMP_MAP_FORCE_DEVICEPTR, |
1237 | OMP_MAP_DEVICE_RESIDENT, | |
b4c3a85b JJ |
1238 | OMP_MAP_LINK, |
1239 | OMP_MAP_RELEASE, | |
1240 | OMP_MAP_ALWAYS_TO, | |
1241 | OMP_MAP_ALWAYS_FROM, | |
1242 | OMP_MAP_ALWAYS_TOFROM | |
1243 | }; | |
1244 | ||
1de31913 TB |
1245 | enum gfc_omp_defaultmap |
1246 | { | |
1247 | OMP_DEFAULTMAP_UNSET, | |
1248 | OMP_DEFAULTMAP_ALLOC, | |
1249 | OMP_DEFAULTMAP_TO, | |
1250 | OMP_DEFAULTMAP_FROM, | |
1251 | OMP_DEFAULTMAP_TOFROM, | |
1252 | OMP_DEFAULTMAP_FIRSTPRIVATE, | |
1253 | OMP_DEFAULTMAP_NONE, | |
1254 | OMP_DEFAULTMAP_DEFAULT, | |
1255 | OMP_DEFAULTMAP_PRESENT | |
1256 | }; | |
1257 | ||
1258 | enum gfc_omp_defaultmap_category | |
1259 | { | |
1260 | OMP_DEFAULTMAP_CAT_UNCATEGORIZED, | |
1261 | OMP_DEFAULTMAP_CAT_SCALAR, | |
1262 | OMP_DEFAULTMAP_CAT_AGGREGATE, | |
1263 | OMP_DEFAULTMAP_CAT_ALLOCATABLE, | |
1264 | OMP_DEFAULTMAP_CAT_POINTER, | |
1265 | OMP_DEFAULTMAP_CAT_NUM | |
1266 | }; | |
1267 | ||
b4c3a85b JJ |
1268 | enum gfc_omp_linear_op |
1269 | { | |
1270 | OMP_LINEAR_DEFAULT, | |
1271 | OMP_LINEAR_REF, | |
1272 | OMP_LINEAR_VAL, | |
1273 | OMP_LINEAR_UVAL | |
a79683d5 | 1274 | }; |
f014c653 | 1275 | |
dd2fc525 JJ |
1276 | /* For use in OpenMP clauses in case we need extra information |
1277 | (aligned clause alignment, linear clause step, etc.). */ | |
1278 | ||
1279 | typedef struct gfc_omp_namelist | |
1280 | { | |
1281 | struct gfc_symbol *sym; | |
1282 | struct gfc_expr *expr; | |
f014c653 JJ |
1283 | union |
1284 | { | |
1285 | gfc_omp_reduction_op reduction_op; | |
1286 | gfc_omp_depend_op depend_op; | |
1287 | gfc_omp_map_op map_op; | |
b4c3a85b JJ |
1288 | gfc_omp_linear_op linear_op; |
1289 | struct gfc_common_head *common; | |
084dc63a | 1290 | bool lastprivate_conditional; |
f014c653 | 1291 | } u; |
9a5de4d5 TB |
1292 | union |
1293 | { | |
1294 | struct gfc_omp_namelist_udr *udr; | |
1295 | gfc_namespace *ns; | |
1296 | } u2; | |
dd2fc525 | 1297 | struct gfc_omp_namelist *next; |
2ac33bca | 1298 | locus where; |
dd2fc525 JJ |
1299 | } |
1300 | gfc_omp_namelist; | |
1301 | ||
1302 | #define gfc_get_omp_namelist() XCNEW (gfc_omp_namelist) | |
1303 | ||
6c7a4dfd JJ |
1304 | enum |
1305 | { | |
41dbbb37 TS |
1306 | OMP_LIST_FIRST, |
1307 | OMP_LIST_PRIVATE = OMP_LIST_FIRST, | |
6c7a4dfd JJ |
1308 | OMP_LIST_FIRSTPRIVATE, |
1309 | OMP_LIST_LASTPRIVATE, | |
1310 | OMP_LIST_COPYPRIVATE, | |
1311 | OMP_LIST_SHARED, | |
1312 | OMP_LIST_COPYIN, | |
dd2fc525 | 1313 | OMP_LIST_UNIFORM, |
9a5de4d5 | 1314 | OMP_LIST_AFFINITY, |
dd2fc525 JJ |
1315 | OMP_LIST_ALIGNED, |
1316 | OMP_LIST_LINEAR, | |
f014c653 JJ |
1317 | OMP_LIST_DEPEND, |
1318 | OMP_LIST_MAP, | |
1319 | OMP_LIST_TO, | |
1320 | OMP_LIST_FROM, | |
005cff4e TB |
1321 | OMP_LIST_SCAN_IN, |
1322 | OMP_LIST_SCAN_EX, | |
5f23671d | 1323 | OMP_LIST_REDUCTION, |
e929ef53 TB |
1324 | OMP_LIST_REDUCTION_INSCAN, |
1325 | OMP_LIST_REDUCTION_TASK, | |
1326 | OMP_LIST_IN_REDUCTION, | |
1327 | OMP_LIST_TASK_REDUCTION, | |
41dbbb37 | 1328 | OMP_LIST_DEVICE_RESIDENT, |
dc7a8b4b | 1329 | OMP_LIST_LINK, |
41dbbb37 TS |
1330 | OMP_LIST_USE_DEVICE, |
1331 | OMP_LIST_CACHE, | |
b4c3a85b JJ |
1332 | OMP_LIST_IS_DEVICE_PTR, |
1333 | OMP_LIST_USE_DEVICE_PTR, | |
ef4add8e | 1334 | OMP_LIST_USE_DEVICE_ADDR, |
21cfe724 | 1335 | OMP_LIST_NONTEMPORAL, |
6c7a4dfd JJ |
1336 | OMP_LIST_NUM |
1337 | }; | |
1338 | ||
1339 | /* Because a symbol can belong to multiple namelists, they must be | |
1340 | linked externally to the symbol itself. */ | |
24b97832 ILT |
1341 | |
1342 | enum gfc_omp_sched_kind | |
1343 | { | |
1344 | OMP_SCHED_NONE, | |
1345 | OMP_SCHED_STATIC, | |
1346 | OMP_SCHED_DYNAMIC, | |
1347 | OMP_SCHED_GUIDED, | |
1348 | OMP_SCHED_RUNTIME, | |
1349 | OMP_SCHED_AUTO | |
1350 | }; | |
1351 | ||
1352 | enum gfc_omp_default_sharing | |
1353 | { | |
1354 | OMP_DEFAULT_UNKNOWN, | |
1355 | OMP_DEFAULT_NONE, | |
1356 | OMP_DEFAULT_PRIVATE, | |
1357 | OMP_DEFAULT_SHARED, | |
7fd549d2 TS |
1358 | OMP_DEFAULT_FIRSTPRIVATE, |
1359 | OMP_DEFAULT_PRESENT | |
24b97832 ILT |
1360 | }; |
1361 | ||
dd2fc525 JJ |
1362 | enum gfc_omp_proc_bind_kind |
1363 | { | |
1364 | OMP_PROC_BIND_UNKNOWN, | |
432de084 | 1365 | OMP_PROC_BIND_PRIMARY, |
dd2fc525 JJ |
1366 | OMP_PROC_BIND_MASTER, |
1367 | OMP_PROC_BIND_SPREAD, | |
1368 | OMP_PROC_BIND_CLOSE | |
1369 | }; | |
1370 | ||
1371 | enum gfc_omp_cancel_kind | |
1372 | { | |
1373 | OMP_CANCEL_UNKNOWN, | |
1374 | OMP_CANCEL_PARALLEL, | |
1375 | OMP_CANCEL_SECTIONS, | |
1376 | OMP_CANCEL_DO, | |
1377 | OMP_CANCEL_TASKGROUP | |
1378 | }; | |
1379 | ||
b4c3a85b JJ |
1380 | enum gfc_omp_if_kind |
1381 | { | |
e55ba804 | 1382 | OMP_IF_CANCEL, |
b4c3a85b | 1383 | OMP_IF_PARALLEL, |
e55ba804 | 1384 | OMP_IF_SIMD, |
b4c3a85b JJ |
1385 | OMP_IF_TASK, |
1386 | OMP_IF_TASKLOOP, | |
1387 | OMP_IF_TARGET, | |
1388 | OMP_IF_TARGET_DATA, | |
1389 | OMP_IF_TARGET_UPDATE, | |
1390 | OMP_IF_TARGET_ENTER_DATA, | |
1391 | OMP_IF_TARGET_EXIT_DATA, | |
1392 | OMP_IF_LAST | |
1393 | }; | |
1394 | ||
1fc5e7ef TB |
1395 | enum gfc_omp_atomic_op |
1396 | { | |
1397 | GFC_OMP_ATOMIC_UNSET = 0, | |
1398 | GFC_OMP_ATOMIC_UPDATE = 1, | |
1399 | GFC_OMP_ATOMIC_READ = 2, | |
1400 | GFC_OMP_ATOMIC_WRITE = 3, | |
1401 | GFC_OMP_ATOMIC_MASK = 3, | |
1402 | GFC_OMP_ATOMIC_SWAP = 16 | |
1403 | }; | |
1404 | ||
269322ec TB |
1405 | enum gfc_omp_requires_kind |
1406 | { | |
1407 | /* Keep in sync with gfc_namespace, esp. with omp_req_mem_order. */ | |
1408 | OMP_REQ_ATOMIC_MEM_ORDER_SEQ_CST = 1, /* 01 */ | |
1409 | OMP_REQ_ATOMIC_MEM_ORDER_ACQ_REL = 2, /* 10 */ | |
1410 | OMP_REQ_ATOMIC_MEM_ORDER_RELAXED = 3, /* 11 */ | |
1411 | OMP_REQ_REVERSE_OFFLOAD = (1 << 2), | |
1412 | OMP_REQ_UNIFIED_ADDRESS = (1 << 3), | |
1413 | OMP_REQ_UNIFIED_SHARED_MEMORY = (1 << 4), | |
1414 | OMP_REQ_DYNAMIC_ALLOCATORS = (1 << 5), | |
1415 | OMP_REQ_TARGET_MASK = (OMP_REQ_REVERSE_OFFLOAD | |
1416 | | OMP_REQ_UNIFIED_ADDRESS | |
1417 | | OMP_REQ_UNIFIED_SHARED_MEMORY), | |
1418 | OMP_REQ_ATOMIC_MEM_ORDER_MASK = (OMP_REQ_ATOMIC_MEM_ORDER_SEQ_CST | |
1419 | | OMP_REQ_ATOMIC_MEM_ORDER_ACQ_REL | |
1420 | | OMP_REQ_ATOMIC_MEM_ORDER_RELAXED) | |
1421 | }; | |
1422 | ||
c26d7df1 TB |
1423 | enum gfc_omp_memorder |
1424 | { | |
1fc5e7ef TB |
1425 | OMP_MEMORDER_UNSET, |
1426 | OMP_MEMORDER_SEQ_CST, | |
c26d7df1 TB |
1427 | OMP_MEMORDER_ACQ_REL, |
1428 | OMP_MEMORDER_RELEASE, | |
1429 | OMP_MEMORDER_ACQUIRE, | |
1fc5e7ef | 1430 | OMP_MEMORDER_RELAXED |
c26d7df1 TB |
1431 | }; |
1432 | ||
178191e1 TB |
1433 | enum gfc_omp_bind_type |
1434 | { | |
1435 | OMP_BIND_UNSET, | |
1436 | OMP_BIND_TEAMS, | |
1437 | OMP_BIND_PARALLEL, | |
1438 | OMP_BIND_THREAD | |
1439 | }; | |
1440 | ||
6c7a4dfd JJ |
1441 | typedef struct gfc_omp_clauses |
1442 | { | |
1443 | struct gfc_expr *if_expr; | |
20906c66 | 1444 | struct gfc_expr *final_expr; |
6c7a4dfd | 1445 | struct gfc_expr *num_threads; |
dd2fc525 | 1446 | gfc_omp_namelist *lists[OMP_LIST_NUM]; |
24b97832 | 1447 | enum gfc_omp_sched_kind sched_kind; |
d58e7173 | 1448 | enum gfc_omp_device_type device_type; |
6c7a4dfd | 1449 | struct gfc_expr *chunk_size; |
24b97832 | 1450 | enum gfc_omp_default_sharing default_sharing; |
1de31913 | 1451 | enum gfc_omp_defaultmap defaultmap[OMP_DEFAULTMAP_CAT_NUM]; |
b4c3a85b | 1452 | int collapse, orderedc; |
20906c66 | 1453 | bool nowait, ordered, untied, mergeable; |
1de31913 | 1454 | bool inbranch, notinbranch, nogroup; |
b4c3a85b | 1455 | bool sched_simd, sched_monotonic, sched_nonmonotonic; |
a61c4964 | 1456 | bool simd, threads, depend_source, destroy, order_concurrent, capture; |
1fc5e7ef | 1457 | enum gfc_omp_atomic_op atomic_op; |
c26d7df1 | 1458 | enum gfc_omp_memorder memorder; |
dd2fc525 JJ |
1459 | enum gfc_omp_cancel_kind cancel; |
1460 | enum gfc_omp_proc_bind_kind proc_bind; | |
a61c4964 | 1461 | enum gfc_omp_depend_op depobj_update; |
178191e1 | 1462 | enum gfc_omp_bind_type bind; |
dd2fc525 JJ |
1463 | struct gfc_expr *safelen_expr; |
1464 | struct gfc_expr *simdlen_expr; | |
f014c653 JJ |
1465 | struct gfc_expr *num_teams; |
1466 | struct gfc_expr *device; | |
1467 | struct gfc_expr *thread_limit; | |
b4c3a85b JJ |
1468 | struct gfc_expr *grainsize; |
1469 | struct gfc_expr *hint; | |
1470 | struct gfc_expr *num_tasks; | |
1471 | struct gfc_expr *priority; | |
a6d22fb2 | 1472 | struct gfc_expr *detach; |
a61c4964 | 1473 | struct gfc_expr *depobj; |
b4c3a85b | 1474 | struct gfc_expr *if_exprs[OMP_IF_LAST]; |
f014c653 JJ |
1475 | enum gfc_omp_sched_kind dist_sched_kind; |
1476 | struct gfc_expr *dist_chunk_size; | |
b4c3a85b | 1477 | const char *critical_name; |
41dbbb37 TS |
1478 | |
1479 | /* OpenACC. */ | |
1480 | struct gfc_expr *async_expr; | |
2a70708e CP |
1481 | struct gfc_expr *gang_static_expr; |
1482 | struct gfc_expr *gang_num_expr; | |
41dbbb37 TS |
1483 | struct gfc_expr *worker_expr; |
1484 | struct gfc_expr *vector_expr; | |
1485 | struct gfc_expr *num_gangs_expr; | |
1486 | struct gfc_expr *num_workers_expr; | |
1487 | struct gfc_expr *vector_length_expr; | |
1488 | gfc_expr_list *wait_list; | |
1489 | gfc_expr_list *tile_list; | |
1490 | unsigned async:1, gang:1, worker:1, vector:1, seq:1, independent:1; | |
fc2a1f2f | 1491 | unsigned par_auto:1, gang_static:1; |
829c6349 | 1492 | unsigned if_present:1, finalize:1; |
a61f6afb | 1493 | unsigned nohost:1; |
41dbbb37 | 1494 | locus loc; |
6c7a4dfd JJ |
1495 | } |
1496 | gfc_omp_clauses; | |
1497 | ||
ece3f663 | 1498 | #define gfc_get_omp_clauses() XCNEW (gfc_omp_clauses) |
6c7a4dfd | 1499 | |
6de9cd9a | 1500 | |
dc7a8b4b JN |
1501 | /* Node in the linked list used for storing !$oacc declare constructs. */ |
1502 | ||
1503 | typedef struct gfc_oacc_declare | |
1504 | { | |
1505 | struct gfc_oacc_declare *next; | |
1506 | bool module_var; | |
1507 | gfc_omp_clauses *clauses; | |
1508 | locus loc; | |
1509 | } | |
1510 | gfc_oacc_declare; | |
1511 | ||
1512 | #define gfc_get_oacc_declare() XCNEW (gfc_oacc_declare) | |
1513 | ||
1514 | ||
dd2fc525 JJ |
1515 | /* Node in the linked list used for storing !$omp declare simd constructs. */ |
1516 | ||
1517 | typedef struct gfc_omp_declare_simd | |
1518 | { | |
1519 | struct gfc_omp_declare_simd *next; | |
1520 | locus where; /* Where the !$omp declare simd construct occurred. */ | |
1521 | ||
1522 | gfc_symbol *proc_name; | |
1523 | ||
1524 | gfc_omp_clauses *clauses; | |
1525 | } | |
1526 | gfc_omp_declare_simd; | |
1527 | #define gfc_get_omp_declare_simd() XCNEW (gfc_omp_declare_simd) | |
1528 | ||
5f23671d JJ |
1529 | typedef struct gfc_omp_udr |
1530 | { | |
1531 | struct gfc_omp_udr *next; | |
1532 | locus where; /* Where the !$omp declare reduction construct occurred. */ | |
1533 | ||
1534 | const char *name; | |
1535 | gfc_typespec ts; | |
1536 | gfc_omp_reduction_op rop; | |
1537 | ||
1538 | struct gfc_symbol *omp_out; | |
1539 | struct gfc_symbol *omp_in; | |
1540 | struct gfc_namespace *combiner_ns; | |
1541 | ||
1542 | struct gfc_symbol *omp_priv; | |
1543 | struct gfc_symbol *omp_orig; | |
1544 | struct gfc_namespace *initializer_ns; | |
1545 | } | |
1546 | gfc_omp_udr; | |
1547 | #define gfc_get_omp_udr() XCNEW (gfc_omp_udr) | |
dd2fc525 | 1548 | |
b46ebd6c JJ |
1549 | typedef struct gfc_omp_namelist_udr |
1550 | { | |
1551 | struct gfc_omp_udr *udr; | |
1552 | struct gfc_code *combiner; | |
1553 | struct gfc_code *initializer; | |
1554 | } | |
1555 | gfc_omp_namelist_udr; | |
1556 | #define gfc_get_omp_namelist_udr() XCNEW (gfc_omp_namelist_udr) | |
1557 | ||
d80c695f TS |
1558 | /* The gfc_st_label structure is a BBT attached to a namespace that |
1559 | records the usage of statement labels within that space. */ | |
1560 | ||
6de9cd9a DN |
1561 | typedef struct gfc_st_label |
1562 | { | |
5cf54585 TS |
1563 | BBT_HEADER(gfc_st_label); |
1564 | ||
6de9cd9a DN |
1565 | int value; |
1566 | ||
1567 | gfc_sl_type defined, referenced; | |
1568 | ||
1569 | struct gfc_expr *format; | |
1570 | ||
1571 | tree backend_decl; | |
1572 | ||
1573 | locus where; | |
388902da LK |
1574 | |
1575 | gfc_namespace *ns; | |
6de9cd9a DN |
1576 | } |
1577 | gfc_st_label; | |
1578 | ||
1579 | ||
1580 | /* gfc_interface()-- Interfaces are lists of symbols strung together. */ | |
1581 | typedef struct gfc_interface | |
1582 | { | |
1583 | struct gfc_symbol *sym; | |
1584 | locus where; | |
1585 | struct gfc_interface *next; | |
1586 | } | |
1587 | gfc_interface; | |
1588 | ||
ece3f663 | 1589 | #define gfc_get_interface() XCNEW (gfc_interface) |
6de9cd9a | 1590 | |
6de9cd9a DN |
1591 | /* User operator nodes. These are like stripped down symbols. */ |
1592 | typedef struct | |
1593 | { | |
cb9e4f55 | 1594 | const char *name; |
6de9cd9a | 1595 | |
8b11b59f | 1596 | gfc_interface *op; |
6de9cd9a DN |
1597 | struct gfc_namespace *ns; |
1598 | gfc_access access; | |
1599 | } | |
1600 | gfc_user_op; | |
1601 | ||
30b608eb | 1602 | |
e157f736 DK |
1603 | /* A list of specific bindings that are associated with a generic spec. */ |
1604 | typedef struct gfc_tbp_generic | |
1605 | { | |
1606 | /* The parser sets specific_st, upon resolution we look for the corresponding | |
1607 | gfc_typebound_proc and set specific for further use. */ | |
1608 | struct gfc_symtree* specific_st; | |
1609 | struct gfc_typebound_proc* specific; | |
1610 | ||
1611 | struct gfc_tbp_generic* next; | |
218e1228 | 1612 | bool is_operator; |
e157f736 DK |
1613 | } |
1614 | gfc_tbp_generic; | |
1615 | ||
1616 | #define gfc_get_tbp_generic() XCNEW (gfc_tbp_generic) | |
1617 | ||
1618 | ||
30b608eb | 1619 | /* Data needed for type-bound procedures. */ |
e157f736 | 1620 | typedef struct gfc_typebound_proc |
30b608eb | 1621 | { |
e157f736 DK |
1622 | locus where; /* Where the PROCEDURE/GENERIC definition was. */ |
1623 | ||
1624 | union | |
1625 | { | |
b0e5fa94 | 1626 | struct gfc_symtree* specific; /* The interface if DEFERRED. */ |
e157f736 DK |
1627 | gfc_tbp_generic* generic; |
1628 | } | |
1629 | u; | |
30b608eb DK |
1630 | |
1631 | gfc_access access; | |
90661f26 | 1632 | const char* pass_arg; /* Argument-name for PASS. NULL if not specified. */ |
30b608eb | 1633 | |
e157f736 DK |
1634 | /* The overridden type-bound proc (or GENERIC with this name in the |
1635 | parent-type) or NULL if non. */ | |
1636 | struct gfc_typebound_proc* overridden; | |
1637 | ||
30b608eb DK |
1638 | /* Once resolved, we use the position of pass_arg in the formal arglist of |
1639 | the binding-target procedure to identify it. The first argument has | |
8e1f752a | 1640 | number 1 here, the second 2, and so on. */ |
30b608eb DK |
1641 | unsigned pass_arg_num; |
1642 | ||
1643 | unsigned nopass:1; /* Whether we have NOPASS (PASS otherwise). */ | |
1644 | unsigned non_overridable:1; | |
b0e5fa94 | 1645 | unsigned deferred:1; |
e157f736 DK |
1646 | unsigned is_generic:1; |
1647 | unsigned function:1, subroutine:1; | |
b82657f4 | 1648 | unsigned error:1; /* Ignore it, when an error occurred during resolution. */ |
90661f26 | 1649 | unsigned ppc:1; |
30b608eb DK |
1650 | } |
1651 | gfc_typebound_proc; | |
1652 | ||
1653 | ||
6de9cd9a DN |
1654 | /* Symbol nodes. These are important things. They are what the |
1655 | standard refers to as "entities". The possibly multiple names that | |
1656 | refer to the same entity are accomplished by a binary tree of | |
1657 | symtree structures that is balanced by the red-black method-- more | |
1658 | than one symtree node can point to any given symbol. */ | |
1659 | ||
1660 | typedef struct gfc_symbol | |
1661 | { | |
cb9e4f55 TS |
1662 | const char *name; /* Primary name, before renaming */ |
1663 | const char *module; /* Module this symbol came from */ | |
6de9cd9a DN |
1664 | locus declared_at; |
1665 | ||
1666 | gfc_typespec ts; | |
1667 | symbol_attribute attr; | |
1668 | ||
32d99e68 | 1669 | /* The formal member points to the formal argument list if the |
6de9cd9a DN |
1670 | symbol is a function or subroutine name. If the symbol is a |
1671 | generic name, the generic member points to the list of | |
1672 | interfaces. */ | |
1673 | ||
1674 | gfc_interface *generic; | |
1675 | gfc_access component_access; | |
1676 | ||
1677 | gfc_formal_arglist *formal; | |
1678 | struct gfc_namespace *formal_ns; | |
34523524 DK |
1679 | struct gfc_namespace *f2k_derived; |
1680 | ||
5bab4c96 PT |
1681 | /* List of PDT parameter expressions */ |
1682 | struct gfc_actual_arglist *param_list; | |
1683 | ||
6de9cd9a DN |
1684 | struct gfc_expr *value; /* Parameter/Initializer value */ |
1685 | gfc_array_spec *as; | |
1686 | struct gfc_symbol *result; /* function result symbol */ | |
1687 | gfc_component *components; /* Derived type components */ | |
1688 | ||
83d890b9 AL |
1689 | /* Defined only for Cray pointees; points to their pointer. */ |
1690 | struct gfc_symbol *cp_pointer; | |
1691 | ||
cf2b3c22 TB |
1692 | int entry_id; /* Used in resolve.c for entries. */ |
1693 | ||
7c1dab0d JW |
1694 | /* CLASS hashed name for declared and dynamic types in the class. */ |
1695 | int hash_value; | |
cf2b3c22 | 1696 | |
9056bd70 | 1697 | struct gfc_symbol *common_next; /* Links for COMMON syms */ |
30aabb86 | 1698 | |
a70ba41f MM |
1699 | /* This is only used for pointer comparisons to check if symbols |
1700 | are in the same common block. | |
1701 | In opposition to common_block, the common_head pointer takes into account | |
1702 | equivalences: if A is in a common block C and A and B are in equivalence, | |
1703 | then both A and B have common_head pointing to C, while A's common_block | |
1704 | points to C and B's is NULL. */ | |
30aabb86 PT |
1705 | struct gfc_common_head* common_head; |
1706 | ||
6de9cd9a DN |
1707 | /* Make sure setup code for dummy arguments is generated in the correct |
1708 | order. */ | |
1709 | int dummy_order; | |
1710 | ||
1711 | gfc_namelist *namelist, *namelist_tail; | |
1712 | ||
1713 | /* Change management fields. Symbols that might be modified by the | |
c064374d | 1714 | current statement have the mark member nonzero. Of these symbols, |
6de9cd9a DN |
1715 | symbols with old_symbol equal to NULL are symbols created within |
1716 | the current statement. Otherwise, old_symbol points to a copy of | |
278c3214 JB |
1717 | the old symbol. gfc_new is used in symbol.c to flag new symbols. |
1718 | comp_mark is used to indicate variables which have component accesses | |
1719 | in OpenMP/OpenACC directive clauses. */ | |
c064374d | 1720 | struct gfc_symbol *old_symbol; |
278c3214 | 1721 | unsigned mark:1, comp_mark:1, gfc_new:1; |
c064374d PT |
1722 | |
1723 | /* The tlink field is used in the front end to carry the module | |
1724 | declaration of separate module procedures so that the characteristics | |
1725 | can be compared with the corresponding declaration in a submodule. In | |
1726 | translation this field carries a linked list of symbols that require | |
1727 | deferred initialization. */ | |
1728 | struct gfc_symbol *tlink; | |
1729 | ||
5291e69a PB |
1730 | /* Nonzero if all equivalences associated with this symbol have been |
1731 | processed. */ | |
1732 | unsigned equiv_built:1; | |
31708dc6 RS |
1733 | /* Set if this variable is used as an index name in a FORALL. */ |
1734 | unsigned forall_index:1; | |
345bd7eb PT |
1735 | /* Set if the symbol is used in a function result specification . */ |
1736 | unsigned fn_result_spec:1; | |
4af8d042 | 1737 | /* Used to avoid multiple resolutions of a single symbol. */ |
dbeaa7ab ME |
1738 | /* = 2 if this has already been resolved as an intrinsic, |
1739 | in gfc_resolve_intrinsic, | |
1740 | = 1 if it has been resolved in resolve_symbol. */ | |
1741 | unsigned resolve_symbol_called:2; | |
4668d6f9 PT |
1742 | /* Set if this is a module function or subroutine with the |
1743 | abreviated declaration in a submodule. */ | |
1744 | unsigned abr_modproc_decl:1; | |
e0b9e5f9 TK |
1745 | /* Set if a previous error or warning has occurred and no other |
1746 | should be reported. */ | |
1747 | unsigned error:1; | |
4a4fc7fe TK |
1748 | /* Set if the dummy argument of a procedure could be an array despite |
1749 | being called with a scalar actual argument. */ | |
1750 | unsigned maybe_array:1; | |
47d13acb TK |
1751 | /* Set if this should be passed by value, but is not a VALUE argument |
1752 | according to the Fortran standard. */ | |
1753 | unsigned pass_as_value:1; | |
4af8d042 | 1754 | |
6de9cd9a DN |
1755 | int refs; |
1756 | struct gfc_namespace *ns; /* namespace containing this symbol */ | |
1757 | ||
1758 | tree backend_decl; | |
4d382327 | 1759 | |
a8b3b0b6 CR |
1760 | /* Identity of the intrinsic module the symbol comes from, or |
1761 | INTMOD_NONE if it's not imported from a intrinsic module. */ | |
1762 | intmod_id from_intmod; | |
1763 | /* Identity of the symbol from intrinsic modules, from enums maintained | |
1764 | separately by each intrinsic module. Used together with from_intmod, | |
1765 | it uniquely identifies a symbol from an intrinsic module. */ | |
1766 | int intmod_sym_id; | |
1767 | ||
1768 | /* This may be repetitive, since the typespec now has a binding | |
1769 | label field. */ | |
9975a30b | 1770 | const char* binding_label; |
a8b3b0b6 CR |
1771 | /* Store a reference to the common_block, if this symbol is in one. */ |
1772 | struct gfc_common_head *common_block; | |
03af1e4c DK |
1773 | |
1774 | /* Link to corresponding association-list if this is an associate name. */ | |
1775 | struct gfc_association_list *assoc; | |
20e8ceae AB |
1776 | |
1777 | /* Link to next entry in derived type list */ | |
1778 | struct gfc_symbol *dt_next; | |
6de9cd9a DN |
1779 | } |
1780 | gfc_symbol; | |
1781 | ||
dd355a42 MM |
1782 | |
1783 | struct gfc_undo_change_set | |
1784 | { | |
1785 | vec<gfc_symbol *> syms; | |
1786 | vec<gfc_typebound_proc *> tbps; | |
ab68a73e | 1787 | gfc_undo_change_set *previous; |
dd355a42 MM |
1788 | }; |
1789 | ||
1790 | ||
9056bd70 | 1791 | /* This structure is used to keep track of symbols in common blocks. */ |
30aabb86 | 1792 | typedef struct gfc_common_head |
9056bd70 TS |
1793 | { |
1794 | locus where; | |
b4c3a85b JJ |
1795 | char use_assoc, saved, threadprivate; |
1796 | unsigned char omp_declare_target : 1; | |
1797 | unsigned char omp_declare_target_link : 1; | |
d58e7173 | 1798 | ENUM_BITFIELD (gfc_omp_device_type) omp_device_type:2; |
3345e742 HA |
1799 | /* Provide sufficient space to hold "symbol.symbol.eq.1234567890". */ |
1800 | char name[2*GFC_MAX_SYMBOL_LEN + 1 + 14 + 1]; | |
30aabb86 | 1801 | struct gfc_symbol *head; |
9975a30b | 1802 | const char* binding_label; |
a8b3b0b6 | 1803 | int is_bind_c; |
6f79f4d1 | 1804 | int refs; |
949446f5 | 1805 | } |
9056bd70 TS |
1806 | gfc_common_head; |
1807 | ||
ece3f663 | 1808 | #define gfc_get_common_head() XCNEW (gfc_common_head) |
9056bd70 TS |
1809 | |
1810 | ||
3d79abbd PB |
1811 | /* A list of all the alternate entry points for a procedure. */ |
1812 | ||
1813 | typedef struct gfc_entry_list | |
1814 | { | |
1815 | /* The symbol for this entry point. */ | |
1816 | gfc_symbol *sym; | |
1817 | /* The zero-based id of this entry point. */ | |
1818 | int id; | |
1819 | /* The LABEL_EXPR marking this entry point. */ | |
1820 | tree label; | |
1933ba0f | 1821 | /* The next item in the list. */ |
3d79abbd PB |
1822 | struct gfc_entry_list *next; |
1823 | } | |
1824 | gfc_entry_list; | |
1825 | ||
93acb62c | 1826 | #define gfc_get_entry_list() XCNEW (gfc_entry_list) |
9056bd70 | 1827 | |
a64f5186 JJ |
1828 | /* Lists of rename info for the USE statement. */ |
1829 | ||
1830 | typedef struct gfc_use_rename | |
1831 | { | |
1832 | char local_name[GFC_MAX_SYMBOL_LEN + 1], use_name[GFC_MAX_SYMBOL_LEN + 1]; | |
1833 | struct gfc_use_rename *next; | |
1834 | int found; | |
1835 | gfc_intrinsic_op op; | |
1836 | locus where; | |
1837 | } | |
1838 | gfc_use_rename; | |
1839 | ||
1840 | #define gfc_get_use_rename() XCNEW (gfc_use_rename); | |
1841 | ||
1842 | /* A list of all USE statements in a namespace. */ | |
1843 | ||
1844 | typedef struct gfc_use_list | |
1845 | { | |
1846 | const char *module_name; | |
3d5dc929 | 1847 | const char *submodule_name; |
e9078ebb TB |
1848 | bool intrinsic; |
1849 | bool non_intrinsic; | |
1850 | bool only_flag; | |
a64f5186 | 1851 | struct gfc_use_rename *rename; |
9268ba9a | 1852 | locus where; |
a64f5186 JJ |
1853 | /* Next USE statement. */ |
1854 | struct gfc_use_list *next; | |
1855 | } | |
1856 | gfc_use_list; | |
1857 | ||
93acb62c | 1858 | #define gfc_get_use_list() XCNEW (gfc_use_list) |
a64f5186 | 1859 | |
6de9cd9a DN |
1860 | /* Within a namespace, symbols are pointed to by symtree nodes that |
1861 | are linked together in a balanced binary tree. There can be | |
1862 | several symtrees pointing to the same symbol node via USE | |
1863 | statements. */ | |
1864 | ||
6de9cd9a DN |
1865 | typedef struct gfc_symtree |
1866 | { | |
1867 | BBT_HEADER (gfc_symtree); | |
cb9e4f55 | 1868 | const char *name; |
6de9cd9a DN |
1869 | int ambiguous; |
1870 | union | |
1871 | { | |
1872 | gfc_symbol *sym; /* Symbol associated with this node */ | |
1873 | gfc_user_op *uop; | |
9056bd70 | 1874 | gfc_common_head *common; |
e34ccb4c | 1875 | gfc_typebound_proc *tb; |
5f23671d | 1876 | gfc_omp_udr *omp_udr; |
6de9cd9a DN |
1877 | } |
1878 | n; | |
6de9cd9a DN |
1879 | } |
1880 | gfc_symtree; | |
1881 | ||
20e8ceae AB |
1882 | /* A list of all derived types. */ |
1883 | extern gfc_symbol *gfc_derived_types; | |
6b887797 | 1884 | |
db941d7e CP |
1885 | typedef struct gfc_oacc_routine_name |
1886 | { | |
1887 | struct gfc_symbol *sym; | |
1888 | struct gfc_omp_clauses *clauses; | |
1889 | struct gfc_oacc_routine_name *next; | |
f6bf4bc1 | 1890 | locus loc; |
db941d7e CP |
1891 | } |
1892 | gfc_oacc_routine_name; | |
1893 | ||
1894 | #define gfc_get_oacc_routine_name() XCNEW (gfc_oacc_routine_name) | |
1895 | ||
1af22e45 TK |
1896 | /* Node in linked list to see what has already been finalized |
1897 | earlier. */ | |
1898 | ||
1899 | typedef struct gfc_was_finalized { | |
1900 | gfc_expr *e; | |
1901 | gfc_component *c; | |
1902 | struct gfc_was_finalized *next; | |
1903 | } | |
1904 | gfc_was_finalized; | |
1905 | ||
9abe5e56 DK |
1906 | /* A namespace describes the contents of procedure, module, interface block |
1907 | or BLOCK construct. */ | |
3d79abbd PB |
1908 | /* ??? Anything else use these? */ |
1909 | ||
6de9cd9a DN |
1910 | typedef struct gfc_namespace |
1911 | { | |
4f613946 TS |
1912 | /* Tree containing all the symbols in this namespace. */ |
1913 | gfc_symtree *sym_root; | |
1914 | /* Tree containing all the user-defined operators in the namespace. */ | |
1915 | gfc_symtree *uop_root; | |
1916 | /* Tree containing all the common blocks. */ | |
949446f5 | 1917 | gfc_symtree *common_root; |
5f23671d JJ |
1918 | /* Tree containing all the OpenMP user defined reductions. */ |
1919 | gfc_symtree *omp_udr_root; | |
e34ccb4c DK |
1920 | |
1921 | /* Tree containing type-bound procedures. */ | |
1922 | gfc_symtree *tb_sym_root; | |
94747289 DK |
1923 | /* Type-bound user operators. */ |
1924 | gfc_symtree *tb_uop_root; | |
1925 | /* For derived-types, store type-bound intrinsic operators here. */ | |
1926 | gfc_typebound_proc *tb_op[GFC_INTRINSIC_OPS]; | |
34523524 DK |
1927 | /* Linked list of finalizer procedures. */ |
1928 | struct gfc_finalizer *finalizers; | |
6de9cd9a | 1929 | |
4f613946 | 1930 | /* If set_flag[letter] is set, an implicit type has been set for letter. */ |
6de9cd9a | 1931 | int set_flag[GFC_LETTERS]; |
4f613946 TS |
1932 | /* Keeps track of the implicit types associated with the letters. */ |
1933 | gfc_typespec default_type[GFC_LETTERS]; | |
52f49934 DK |
1934 | /* Store the positions of IMPLICIT statements. */ |
1935 | locus implicit_loc[GFC_LETTERS]; | |
6de9cd9a | 1936 | |
4f613946 | 1937 | /* If this is a namespace of a procedure, this points to the procedure. */ |
6de9cd9a | 1938 | struct gfc_symbol *proc_name; |
4f613946 TS |
1939 | /* If this is the namespace of a unit which contains executable |
1940 | code, this points to it. */ | |
6de9cd9a | 1941 | struct gfc_code *code; |
4f613946 TS |
1942 | |
1943 | /* Points to the equivalences set up in this namespace. */ | |
31fee91e | 1944 | struct gfc_equiv *equiv, *old_equiv; |
61321991 PT |
1945 | |
1946 | /* Points to the equivalence groups produced by trans_common. */ | |
1947 | struct gfc_equiv_list *equiv_lists; | |
1948 | ||
a1ee985f | 1949 | gfc_interface *op[GFC_INTRINSIC_OPS]; |
4f613946 TS |
1950 | |
1951 | /* Points to the parent namespace, i.e. the namespace of a module or | |
1952 | procedure in which the procedure belonging to this namespace is | |
1953 | contained. The parent namespace points to this namespace either | |
1954 | directly via CONTAINED, or indirectly via the chain built by | |
1955 | SIBLING. */ | |
1956 | struct gfc_namespace *parent; | |
1957 | /* CONTAINED points to the first contained namespace. Sibling | |
1958 | namespaces are chained via SIBLING. */ | |
1959 | struct gfc_namespace *contained, *sibling; | |
1960 | ||
1961 | gfc_common_head blank_common; | |
6de9cd9a DN |
1962 | gfc_access default_access, operator_access[GFC_INTRINSIC_OPS]; |
1963 | ||
1964 | gfc_st_label *st_labels; | |
294fbfc8 TS |
1965 | /* This list holds information about all the data initializers in |
1966 | this namespace. */ | |
d5e2274d | 1967 | struct gfc_data *data, *old_data; |
6de9cd9a | 1968 | |
dc7a8b4b JN |
1969 | /* !$ACC DECLARE. */ |
1970 | gfc_oacc_declare *oacc_declare; | |
41dbbb37 | 1971 | |
db941d7e CP |
1972 | /* !$ACC ROUTINE clauses. */ |
1973 | gfc_omp_clauses *oacc_routine_clauses; | |
1974 | ||
1975 | /* !$ACC ROUTINE names. */ | |
1976 | gfc_oacc_routine_name *oacc_routine_names; | |
1977 | ||
d0803c0c | 1978 | gfc_charlen *cl_list; |
6de9cd9a | 1979 | |
20e8ceae | 1980 | gfc_symbol *derived_types; |
3af8d8cb | 1981 | |
4c1f4f52 | 1982 | int save_all, seen_save, seen_implicit_none; |
3d79abbd PB |
1983 | |
1984 | /* Normally we don't need to refcount namespaces. However when we read | |
1985 | a module containing a function with multiple entry points, this | |
1986 | will appear as several functions with the same formal namespace. */ | |
1987 | int refs; | |
1988 | ||
1989 | /* A list of all alternate entry points to this procedure (or NULL). */ | |
1990 | gfc_entry_list *entries; | |
0de4325e | 1991 | |
a64f5186 JJ |
1992 | /* A list of USE statements in this namespace. */ |
1993 | gfc_use_list *use_stmts; | |
1994 | ||
dd2fc525 JJ |
1995 | /* Linked list of !$omp declare simd constructs. */ |
1996 | struct gfc_omp_declare_simd *omp_declare_simd; | |
1997 | ||
1af22e45 TK |
1998 | /* A hash set for the the gfc expressions that have already |
1999 | been finalized in this namespace. */ | |
2000 | ||
2001 | gfc_was_finalized *was_finalized; | |
2002 | ||
0de4325e | 2003 | /* Set to 1 if namespace is a BLOCK DATA program unit. */ |
9abe5e56 | 2004 | unsigned is_block_data:1; |
8998be20 TB |
2005 | |
2006 | /* Set to 1 if namespace is an interface body with "IMPORT" used. */ | |
9abe5e56 | 2007 | unsigned has_import_set:1; |
71a7778c | 2008 | |
8b7a967e TB |
2009 | /* Set to 1 if the namespace uses "IMPLICT NONE (export)". */ |
2010 | unsigned has_implicit_none_export:1; | |
2011 | ||
204803dc JR |
2012 | /* Set to 1 if resolved has been called for this namespace. |
2013 | Holds -1 during resolution. */ | |
2014 | signed resolved:2; | |
3af8d8cb | 2015 | |
2b91aea8 MM |
2016 | /* Set when resolve_types has been called for this namespace. */ |
2017 | unsigned types_resolved:1; | |
2018 | ||
3af8d8cb | 2019 | /* Set to 1 if code has been generated for this namespace. */ |
9abe5e56 DK |
2020 | unsigned translated:1; |
2021 | ||
2022 | /* Set to 1 if symbols in this namespace should be 'construct entities', | |
2023 | i.e. for BLOCK local variables. */ | |
2024 | unsigned construct_entities:1; | |
5f23671d JJ |
2025 | |
2026 | /* Set to 1 for !$OMP DECLARE REDUCTION namespaces. */ | |
2027 | unsigned omp_udr_ns:1; | |
db941d7e CP |
2028 | |
2029 | /* Set to 1 for !$ACC ROUTINE namespaces. */ | |
2030 | unsigned oacc_routine:1; | |
ffeebc4f JJ |
2031 | |
2032 | /* Set to 1 if there are any calls to procedures with implicit interface. */ | |
2033 | unsigned implicit_interface_calls:1; | |
269322ec TB |
2034 | |
2035 | /* OpenMP requires. */ | |
2036 | unsigned omp_requires:6; | |
2037 | unsigned omp_target_seen:1; | |
6de9cd9a DN |
2038 | } |
2039 | gfc_namespace; | |
2040 | ||
2041 | extern gfc_namespace *gfc_current_ns; | |
71a7778c | 2042 | extern gfc_namespace *gfc_global_ns_list; |
6de9cd9a | 2043 | |
c9543002 TS |
2044 | /* Global symbols are symbols of global scope. Currently we only use |
2045 | this to detect collisions already when parsing. | |
2046 | TODO: Extend to verify procedure calls. */ | |
2047 | ||
32e8bb8e ILT |
2048 | enum gfc_symbol_type |
2049 | { | |
2050 | GSYM_UNKNOWN=1, GSYM_PROGRAM, GSYM_FUNCTION, GSYM_SUBROUTINE, | |
2051 | GSYM_MODULE, GSYM_COMMON, GSYM_BLOCK_DATA | |
2052 | }; | |
2053 | ||
c9543002 TS |
2054 | typedef struct gfc_gsymbol |
2055 | { | |
2056 | BBT_HEADER(gfc_gsymbol); | |
2057 | ||
973a384d | 2058 | const char *name; |
a8b3b0b6 CR |
2059 | const char *sym_name; |
2060 | const char *mod_name; | |
2061 | const char *binding_label; | |
32e8bb8e | 2062 | enum gfc_symbol_type type; |
c9543002 TS |
2063 | |
2064 | int defined, used; | |
55b9c612 | 2065 | bool bind_c; |
c9543002 | 2066 | locus where; |
71a7778c | 2067 | gfc_namespace *ns; |
c9543002 TS |
2068 | } |
2069 | gfc_gsymbol; | |
2070 | ||
2071 | extern gfc_gsymbol *gfc_gsym_root; | |
6de9cd9a DN |
2072 | |
2073 | /* Information on interfaces being built. */ | |
2074 | typedef struct | |
2075 | { | |
2076 | interface_type type; | |
2077 | gfc_symbol *sym; | |
2078 | gfc_namespace *ns; | |
2079 | gfc_user_op *uop; | |
2080 | gfc_intrinsic_op op; | |
2081 | } | |
2082 | gfc_interface_info; | |
2083 | ||
2084 | extern gfc_interface_info current_interface; | |
2085 | ||
2086 | ||
2087 | /* Array reference. */ | |
32e8bb8e ILT |
2088 | |
2089 | enum gfc_array_ref_dimen_type | |
2090 | { | |
a3935ffc | 2091 | DIMEN_ELEMENT = 1, DIMEN_RANGE, DIMEN_VECTOR, DIMEN_STAR, DIMEN_THIS_IMAGE, DIMEN_UNKNOWN |
32e8bb8e ILT |
2092 | }; |
2093 | ||
6de9cd9a DN |
2094 | typedef struct gfc_array_ref |
2095 | { | |
2096 | ar_type type; | |
2097 | int dimen; /* # of components in the reference */ | |
d3a9eea2 TB |
2098 | int codimen; |
2099 | bool in_allocate; /* For coarray checks. */ | |
f8862a1b | 2100 | gfc_expr *team; |
20d0bfce | 2101 | gfc_expr *stat; |
6de9cd9a DN |
2102 | locus where; |
2103 | gfc_array_spec *as; | |
2104 | ||
2105 | locus c_where[GFC_MAX_DIMENSIONS]; /* All expressions can be NULL */ | |
2106 | struct gfc_expr *start[GFC_MAX_DIMENSIONS], *end[GFC_MAX_DIMENSIONS], | |
2107 | *stride[GFC_MAX_DIMENSIONS]; | |
2108 | ||
32e8bb8e | 2109 | enum gfc_array_ref_dimen_type dimen_type[GFC_MAX_DIMENSIONS]; |
6de9cd9a DN |
2110 | } |
2111 | gfc_array_ref; | |
2112 | ||
ece3f663 | 2113 | #define gfc_get_array_ref() XCNEW (gfc_array_ref) |
6de9cd9a DN |
2114 | |
2115 | ||
2116 | /* Component reference nodes. A variable is stored as an expression | |
2117 | node that points to the base symbol. After that, a singly linked | |
2118 | list of component reference nodes gives the variable's complete | |
2119 | resolution. The array_ref component may be present and comes | |
2120 | before the component component. */ | |
2121 | ||
a79683d5 | 2122 | enum ref_type |
a5fbc2f3 PT |
2123 | { REF_ARRAY, REF_COMPONENT, REF_SUBSTRING, REF_INQUIRY }; |
2124 | ||
2125 | enum inquiry_type | |
2126 | { INQUIRY_RE, INQUIRY_IM, INQUIRY_KIND, INQUIRY_LEN }; | |
6de9cd9a DN |
2127 | |
2128 | typedef struct gfc_ref | |
2129 | { | |
2130 | ref_type type; | |
2131 | ||
2132 | union | |
2133 | { | |
2134 | struct gfc_array_ref ar; | |
2135 | ||
2136 | struct | |
2137 | { | |
2138 | gfc_component *component; | |
2139 | gfc_symbol *sym; | |
2140 | } | |
2141 | c; | |
2142 | ||
2143 | struct | |
2144 | { | |
2145 | struct gfc_expr *start, *end; /* Substring */ | |
2146 | gfc_charlen *length; | |
2147 | } | |
2148 | ss; | |
2149 | ||
a5fbc2f3 PT |
2150 | inquiry_type i; |
2151 | ||
6de9cd9a DN |
2152 | } |
2153 | u; | |
2154 | ||
2155 | struct gfc_ref *next; | |
2156 | } | |
2157 | gfc_ref; | |
2158 | ||
ece3f663 | 2159 | #define gfc_get_ref() XCNEW (gfc_ref) |
6de9cd9a DN |
2160 | |
2161 | ||
2162 | /* Structures representing intrinsic symbols and their arguments lists. */ | |
2163 | typedef struct gfc_intrinsic_arg | |
2164 | { | |
2165 | char name[GFC_MAX_SYMBOL_LEN + 1]; | |
2166 | ||
2167 | gfc_typespec ts; | |
47b99694 | 2168 | unsigned optional:1, value:1; |
23e38561 | 2169 | ENUM_BITFIELD (sym_intent) intent:2; |
6de9cd9a DN |
2170 | gfc_actual_arglist *actual; |
2171 | ||
2172 | struct gfc_intrinsic_arg *next; | |
2173 | ||
2174 | } | |
2175 | gfc_intrinsic_arg; | |
2176 | ||
2177 | ||
4f613946 TS |
2178 | /* Specifies the various kinds of check functions used to verify the |
2179 | argument lists of intrinsic functions. fX with X an integer refer | |
2180 | to check functions of intrinsics with X arguments. f1m is used for | |
2181 | the MAX and MIN intrinsics which can have an arbitrary number of | |
9a3d38f6 | 2182 | arguments, f4ml is used for the MINLOC and MAXLOC intrinsics as |
4f613946 TS |
2183 | these have special semantics. */ |
2184 | ||
6de9cd9a DN |
2185 | typedef union |
2186 | { | |
524af0d6 JB |
2187 | bool (*f0)(void); |
2188 | bool (*f1)(struct gfc_expr *); | |
2189 | bool (*f1m)(gfc_actual_arglist *); | |
2190 | bool (*f2)(struct gfc_expr *, struct gfc_expr *); | |
2191 | bool (*f3)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *); | |
64b1806b | 2192 | bool (*f5ml)(gfc_actual_arglist *); |
01ce9e31 | 2193 | bool (*f6fl)(gfc_actual_arglist *); |
524af0d6 JB |
2194 | bool (*f3red)(gfc_actual_arglist *); |
2195 | bool (*f4)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *, | |
6de9cd9a | 2196 | struct gfc_expr *); |
524af0d6 | 2197 | bool (*f5)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *, |
6de9cd9a DN |
2198 | struct gfc_expr *, struct gfc_expr *); |
2199 | } | |
2200 | gfc_check_f; | |
2201 | ||
4f613946 TS |
2202 | /* Like gfc_check_f, these specify the type of the simplification |
2203 | function associated with an intrinsic. The fX are just like in | |
2204 | gfc_check_f. cc is used for type conversion functions. */ | |
6de9cd9a DN |
2205 | |
2206 | typedef union | |
2207 | { | |
4c0c6b9f | 2208 | struct gfc_expr *(*f0)(void); |
6de9cd9a DN |
2209 | struct gfc_expr *(*f1)(struct gfc_expr *); |
2210 | struct gfc_expr *(*f2)(struct gfc_expr *, struct gfc_expr *); | |
2211 | struct gfc_expr *(*f3)(struct gfc_expr *, struct gfc_expr *, | |
2212 | struct gfc_expr *); | |
2213 | struct gfc_expr *(*f4)(struct gfc_expr *, struct gfc_expr *, | |
2214 | struct gfc_expr *, struct gfc_expr *); | |
2215 | struct gfc_expr *(*f5)(struct gfc_expr *, struct gfc_expr *, | |
2216 | struct gfc_expr *, struct gfc_expr *, | |
2217 | struct gfc_expr *); | |
01ce9e31 TK |
2218 | struct gfc_expr *(*f6)(struct gfc_expr *, struct gfc_expr *, |
2219 | struct gfc_expr *, struct gfc_expr *, | |
2220 | struct gfc_expr *, struct gfc_expr *); | |
6de9cd9a DN |
2221 | struct gfc_expr *(*cc)(struct gfc_expr *, bt, int); |
2222 | } | |
2223 | gfc_simplify_f; | |
2224 | ||
4f613946 | 2225 | /* Again like gfc_check_f, these specify the type of the resolution |
13795658 | 2226 | function associated with an intrinsic. The fX are just like in |
66e4ab31 | 2227 | gfc_check_f. f1m is used for MIN and MAX, s1 is used for abort(). */ |
6de9cd9a DN |
2228 | |
2229 | typedef union | |
2230 | { | |
2231 | void (*f0)(struct gfc_expr *); | |
2232 | void (*f1)(struct gfc_expr *, struct gfc_expr *); | |
2233 | void (*f1m)(struct gfc_expr *, struct gfc_actual_arglist *); | |
2234 | void (*f2)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *); | |
2235 | void (*f3)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *, | |
2236 | struct gfc_expr *); | |
2237 | void (*f4)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *, | |
2238 | struct gfc_expr *, struct gfc_expr *); | |
2239 | void (*f5)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *, | |
2240 | struct gfc_expr *, struct gfc_expr *, struct gfc_expr *); | |
01ce9e31 TK |
2241 | void (*f6)(struct gfc_expr *, struct gfc_expr *, struct gfc_expr *, |
2242 | struct gfc_expr *, struct gfc_expr *, struct gfc_expr *, | |
2243 | struct gfc_expr *); | |
6de9cd9a DN |
2244 | void (*s1)(struct gfc_code *); |
2245 | } | |
2246 | gfc_resolve_f; | |
2247 | ||
2248 | ||
2249 | typedef struct gfc_intrinsic_sym | |
2250 | { | |
cb9e4f55 | 2251 | const char *name, *lib_name; |
6de9cd9a DN |
2252 | gfc_intrinsic_arg *formal; |
2253 | gfc_typespec ts; | |
4d382327 | 2254 | unsigned elemental:1, inquiry:1, transformational:1, pure:1, |
d000aa67 | 2255 | generic:1, specific:1, actual_ok:1, noreturn:1, conversion:1, |
f1abbf69 | 2256 | from_module:1, vararg:1; |
e1633d82 DF |
2257 | |
2258 | int standard; | |
6de9cd9a DN |
2259 | |
2260 | gfc_simplify_f simplify; | |
2261 | gfc_check_f check; | |
2262 | gfc_resolve_f resolve; | |
2263 | struct gfc_intrinsic_sym *specific_head, *next; | |
cd5ecab6 | 2264 | gfc_isym_id id; |
6de9cd9a DN |
2265 | |
2266 | } | |
2267 | gfc_intrinsic_sym; | |
2268 | ||
2269 | ||
2270 | /* Expression nodes. The expression node types deserve explanations, | |
2271 | since the last couple can be easily misconstrued: | |
2272 | ||
2273 | EXPR_OP Operator node pointing to one or two other nodes | |
2274 | EXPR_FUNCTION Function call, symbol points to function's name | |
2275 | EXPR_CONSTANT A scalar constant: Logical, String, Real, Int or Complex | |
2276 | EXPR_VARIABLE An Lvalue with a root symbol and possible reference list | |
8e1f752a | 2277 | which expresses structure, array and substring refs. |
6de9cd9a DN |
2278 | EXPR_NULL The NULL pointer value (which also has a basic type). |
2279 | EXPR_SUBSTRING A substring of a constant string | |
2280 | EXPR_STRUCTURE A structure constructor | |
8e1f752a DK |
2281 | EXPR_ARRAY An array constructor. |
2282 | EXPR_COMPCALL Function (or subroutine) call of a procedure pointer | |
2283 | component or type-bound procedure. */ | |
6de9cd9a | 2284 | |
f8e566e5 | 2285 | #include <mpfr.h> |
eb6f9a86 | 2286 | #include <mpc.h> |
c9d4cc5d | 2287 | #define GFC_RND_MODE MPFR_RNDN |
f6b855df | 2288 | #define GFC_MPC_RND_MODE MPC_RNDNN |
6de9cd9a | 2289 | |
b7e75771 JD |
2290 | typedef splay_tree gfc_constructor_base; |
2291 | ||
f622221a JB |
2292 | |
2293 | /* This should be an unsigned variable of type size_t. But to handle | |
2294 | compiling to a 64-bit target from a 32-bit host, we need to use a | |
2295 | HOST_WIDE_INT. Also, occasionally the string length field is used | |
2296 | as a flag with values -1 and -2, see e.g. gfc_add_assign_aux_vars. | |
2297 | So it needs to be signed. */ | |
2298 | typedef HOST_WIDE_INT gfc_charlen_t; | |
2299 | ||
6de9cd9a DN |
2300 | typedef struct gfc_expr |
2301 | { | |
2302 | expr_t expr_type; | |
2303 | ||
2304 | gfc_typespec ts; /* These two refer to the overall expression */ | |
2305 | ||
c62c6622 | 2306 | int rank; /* 0 indicates a scalar, -1 an assumed-rank array. */ |
6de9cd9a DN |
2307 | mpz_t *shape; /* Can be NULL if shape is unknown at compile time */ |
2308 | ||
4a44a72d DK |
2309 | /* Nonnull for functions and structure constructors, may also used to hold the |
2310 | base-object for component calls. */ | |
6de9cd9a DN |
2311 | gfc_symtree *symtree; |
2312 | ||
6de9cd9a DN |
2313 | gfc_ref *ref; |
2314 | ||
6de9cd9a DN |
2315 | locus where; |
2316 | ||
94fae14b PT |
2317 | /* Used to store the base expression in component calls, when the expression |
2318 | is not a variable. */ | |
32a9b8e0 | 2319 | struct gfc_expr *base_expr; |
94fae14b | 2320 | |
8dc63166 SK |
2321 | /* is_snan denotes a signalling not-a-number. */ |
2322 | unsigned int is_snan : 1; | |
20585ad6 | 2323 | |
ebb479cd PT |
2324 | /* Sometimes, when an error has been emitted, it is necessary to prevent |
2325 | it from recurring. */ | |
2326 | unsigned int error : 1; | |
4d382327 | 2327 | |
94bff632 | 2328 | /* Mark an expression where a user operator has been substituted by |
a1ab6660 PT |
2329 | a function call in interface.c(gfc_extend_expr). */ |
2330 | unsigned int user_operator : 1; | |
ebb479cd | 2331 | |
94bff632 JW |
2332 | /* Mark an expression as being a MOLD argument of ALLOCATE. */ |
2333 | unsigned int mold : 1; | |
4d382327 | 2334 | |
43a68a9d PT |
2335 | /* Will require finalization after use. */ |
2336 | unsigned int must_finalize : 1; | |
2337 | ||
980fa45e TK |
2338 | /* Set this if no range check should be performed on this expression. */ |
2339 | ||
2340 | unsigned int no_bounds_check : 1; | |
2341 | ||
998511a6 TK |
2342 | /* Set this if a matmul expression has already been evaluated for conversion |
2343 | to a BLAS call. */ | |
2344 | ||
2345 | unsigned int external_blas : 1; | |
2346 | ||
01ce9e31 TK |
2347 | /* Set this if resolution has already happened. It could be harmful |
2348 | if done again. */ | |
2349 | ||
2350 | unsigned int do_not_resolve_again : 1; | |
2351 | ||
5197d799 TK |
2352 | /* Set this if no warning should be given somewhere in a lower level. */ |
2353 | ||
2354 | unsigned int do_not_warn : 1; | |
4a4fc7fe TK |
2355 | |
2356 | /* Set this if the expression came from expanding an array constructor. */ | |
2357 | unsigned int from_constructor : 1; | |
2358 | ||
20585ad6 BM |
2359 | /* If an expression comes from a Hollerith constant or compile-time |
2360 | evaluation of a transfer statement, it may have a prescribed target- | |
2361 | memory representation, and these cannot always be backformed from | |
2362 | the value. */ | |
2363 | struct | |
2364 | { | |
f622221a | 2365 | gfc_charlen_t length; |
20585ad6 BM |
2366 | char *string; |
2367 | } | |
2368 | representation; | |
2369 | ||
8dc63166 SK |
2370 | struct |
2371 | { | |
2372 | int len; /* Length of BOZ string without terminating NULL. */ | |
2373 | int rdx; /* Radix of BOZ. */ | |
2374 | char *str; /* BOZ string with NULL terminating character. */ | |
2375 | } | |
2376 | boz; | |
2377 | ||
6de9cd9a DN |
2378 | union |
2379 | { | |
6de9cd9a | 2380 | int logical; |
20585ad6 | 2381 | |
ad7ee6f8 JD |
2382 | io_kind iokind; |
2383 | ||
f8e566e5 SK |
2384 | mpz_t integer; |
2385 | ||
2386 | mpfr_t real; | |
6de9cd9a | 2387 | |
d0d92baf | 2388 | mpc_t complex; |
6de9cd9a | 2389 | |
58b03ab2 TS |
2390 | struct |
2391 | { | |
a1ee985f | 2392 | gfc_intrinsic_op op; |
58b03ab2 TS |
2393 | gfc_user_op *uop; |
2394 | struct gfc_expr *op1, *op2; | |
2395 | } | |
2396 | op; | |
2397 | ||
6de9cd9a DN |
2398 | struct |
2399 | { | |
2400 | gfc_actual_arglist *actual; | |
6b25a558 | 2401 | const char *name; /* Points to the ultimate name of the function */ |
6de9cd9a DN |
2402 | gfc_intrinsic_sym *isym; |
2403 | gfc_symbol *esym; | |
2404 | } | |
2405 | function; | |
2406 | ||
8e1f752a DK |
2407 | struct |
2408 | { | |
2409 | gfc_actual_arglist* actual; | |
e157f736 | 2410 | const char* name; |
4a44a72d DK |
2411 | /* Base-object, whose component was called. NULL means that it should |
2412 | be taken from symtree/ref. */ | |
2413 | struct gfc_expr* base_object; | |
2414 | gfc_typebound_proc* tbp; /* Should overlap with esym. */ | |
2415 | ||
2416 | /* For type-bound operators, we want to call PASS procedures but already | |
2417 | have the full arglist; mark this, so that it is not extended by the | |
2418 | PASS argument. */ | |
2419 | unsigned ignore_pass:1; | |
2420 | ||
2421 | /* Do assign-calls rather than calls, that is appropriate dependency | |
2422 | checking. */ | |
2423 | unsigned assign:1; | |
8e1f752a DK |
2424 | } |
2425 | compcall; | |
2426 | ||
6de9cd9a DN |
2427 | struct |
2428 | { | |
f622221a | 2429 | gfc_charlen_t length; |
00660189 | 2430 | gfc_char_t *string; |
6de9cd9a DN |
2431 | } |
2432 | character; | |
2433 | ||
b7e75771 | 2434 | gfc_constructor_base constructor; |
6de9cd9a DN |
2435 | } |
2436 | value; | |
2437 | ||
5bab4c96 PT |
2438 | /* Used to store PDT expression lists associated with expressions. */ |
2439 | gfc_actual_arglist *param_list; | |
2440 | ||
6de9cd9a DN |
2441 | } |
2442 | gfc_expr; | |
2443 | ||
2444 | ||
93acb62c | 2445 | #define gfc_get_shape(rank) (XCNEWVEC (mpz_t, (rank))) |
6de9cd9a DN |
2446 | |
2447 | /* Structures for information associated with different kinds of | |
2448 | numbers. The first set of integer parameters define all there is | |
2449 | to know about a particular kind. The rest of the elements are | |
2450 | computed from the first elements. */ | |
2451 | ||
2452 | typedef struct | |
2453 | { | |
e2cad04b | 2454 | /* Values really representable by the target. */ |
7bee49dc | 2455 | mpz_t huge, pedantic_min_int, min_int; |
e2cad04b RH |
2456 | |
2457 | int kind, radix, digits, bit_size, range; | |
2458 | ||
2459 | /* True if the C type of the given name maps to this precision. | |
2460 | Note that more than one bit can be set. */ | |
2461 | unsigned int c_char : 1; | |
2462 | unsigned int c_short : 1; | |
2463 | unsigned int c_int : 1; | |
2464 | unsigned int c_long : 1; | |
2465 | unsigned int c_long_long : 1; | |
6de9cd9a DN |
2466 | } |
2467 | gfc_integer_info; | |
2468 | ||
2469 | extern gfc_integer_info gfc_integer_kinds[]; | |
2470 | ||
2471 | ||
2472 | typedef struct | |
2473 | { | |
2474 | int kind, bit_size; | |
2475 | ||
e2cad04b RH |
2476 | /* True if the C++ type bool, C99 type _Bool, maps to this precision. */ |
2477 | unsigned int c_bool : 1; | |
6de9cd9a DN |
2478 | } |
2479 | gfc_logical_info; | |
2480 | ||
2481 | extern gfc_logical_info gfc_logical_kinds[]; | |
2482 | ||
2483 | ||
2484 | typedef struct | |
2485 | { | |
2d0aa65f | 2486 | mpfr_t epsilon, huge, tiny, subnormal; |
6de9cd9a | 2487 | int kind, radix, digits, min_exponent, max_exponent; |
6de9cd9a | 2488 | int range, precision; |
e2cad04b RH |
2489 | |
2490 | /* The precision of the type as reported by GET_MODE_PRECISION. */ | |
2491 | int mode_precision; | |
2492 | ||
2493 | /* True if the C type of the given name maps to this precision. | |
2494 | Note that more than one bit can be set. */ | |
2495 | unsigned int c_float : 1; | |
2496 | unsigned int c_double : 1; | |
2497 | unsigned int c_long_double : 1; | |
a3c85b74 | 2498 | unsigned int c_float128 : 1; |
6de9cd9a DN |
2499 | } |
2500 | gfc_real_info; | |
2501 | ||
2502 | extern gfc_real_info gfc_real_kinds[]; | |
2503 | ||
374929b2 FXC |
2504 | typedef struct |
2505 | { | |
2506 | int kind, bit_size; | |
2507 | const char *name; | |
2508 | } | |
2509 | gfc_character_info; | |
2510 | ||
2511 | extern gfc_character_info gfc_character_kinds[]; | |
2512 | ||
6de9cd9a DN |
2513 | |
2514 | /* Equivalence structures. Equivalent lvalues are linked along the | |
2515 | *eq pointer, equivalence sets are strung along the *next node. */ | |
2516 | typedef struct gfc_equiv | |
2517 | { | |
2518 | struct gfc_equiv *next, *eq; | |
2519 | gfc_expr *expr; | |
30aabb86 | 2520 | const char *module; |
6de9cd9a DN |
2521 | int used; |
2522 | } | |
2523 | gfc_equiv; | |
2524 | ||
ece3f663 | 2525 | #define gfc_get_equiv() XCNEW (gfc_equiv) |
6de9cd9a | 2526 | |
61321991 PT |
2527 | /* Holds a single equivalence member after processing. */ |
2528 | typedef struct gfc_equiv_info | |
2529 | { | |
2530 | gfc_symbol *sym; | |
2531 | HOST_WIDE_INT offset; | |
37311e71 | 2532 | HOST_WIDE_INT length; |
61321991 PT |
2533 | struct gfc_equiv_info *next; |
2534 | } gfc_equiv_info; | |
2535 | ||
2536 | /* Holds equivalence groups, after they have been processed. */ | |
2537 | typedef struct gfc_equiv_list | |
2538 | { | |
2539 | gfc_equiv_info *equiv; | |
2540 | struct gfc_equiv_list *next; | |
2541 | } gfc_equiv_list; | |
6de9cd9a DN |
2542 | |
2543 | /* gfc_case stores the selector list of a case statement. The *low | |
2544 | and *high pointers can point to the same expression in the case of | |
2545 | a single value. If *high is NULL, the selection is from *low | |
2546 | upwards, if *low is NULL the selection is *high downwards. | |
2547 | ||
410d1a45 SK |
2548 | This structure has separate fields to allow single and double linked |
2549 | lists of CASEs at the same time. The singe linked list along the NEXT | |
6de9cd9a DN |
2550 | field is a list of cases for a single CASE label. The double linked |
2551 | list along the LEFT/RIGHT fields is used to detect overlap and to | |
2552 | build a table of the cases for SELECT constructs with a CHARACTER | |
2553 | case expression. */ | |
2554 | ||
2555 | typedef struct gfc_case | |
2556 | { | |
2557 | /* Where we saw this case. */ | |
2558 | locus where; | |
2559 | int n; | |
2560 | ||
2561 | /* Case range values. If (low == high), it's a single value. If one of | |
2562 | the labels is NULL, it's an unbounded case. If both are NULL, this | |
2563 | represents the default case. */ | |
2564 | gfc_expr *low, *high; | |
2565 | ||
cf2b3c22 TB |
2566 | /* Only used for SELECT TYPE. */ |
2567 | gfc_typespec ts; | |
2568 | ||
6de9cd9a DN |
2569 | /* Next case label in the list of cases for a single CASE label. */ |
2570 | struct gfc_case *next; | |
2571 | ||
2572 | /* Used for detecting overlap, and for code generation. */ | |
2573 | struct gfc_case *left, *right; | |
2574 | ||
2575 | /* True if this case label can never be matched. */ | |
2576 | int unreachable; | |
2577 | } | |
2578 | gfc_case; | |
2579 | ||
ece3f663 | 2580 | #define gfc_get_case() XCNEW (gfc_case) |
6de9cd9a DN |
2581 | |
2582 | ||
2583 | typedef struct | |
2584 | { | |
2585 | gfc_expr *var, *start, *end, *step; | |
170a8bd6 | 2586 | unsigned short unroll; |
2bd86b95 HA |
2587 | bool ivdep; |
2588 | bool vector; | |
2589 | bool novector; | |
6de9cd9a DN |
2590 | } |
2591 | gfc_iterator; | |
2592 | ||
ece3f663 | 2593 | #define gfc_get_iterator() XCNEW (gfc_iterator) |
6de9cd9a DN |
2594 | |
2595 | ||
f7b529fa | 2596 | /* Allocation structure for ALLOCATE, DEALLOCATE and NULLIFY statements. */ |
6de9cd9a DN |
2597 | |
2598 | typedef struct gfc_alloc | |
2599 | { | |
2600 | gfc_expr *expr; | |
2601 | struct gfc_alloc *next; | |
2602 | } | |
2603 | gfc_alloc; | |
2604 | ||
ece3f663 | 2605 | #define gfc_get_alloc() XCNEW (gfc_alloc) |
6de9cd9a DN |
2606 | |
2607 | ||
2608 | typedef struct | |
2609 | { | |
2610 | gfc_expr *unit, *file, *status, *access, *form, *recl, | |
6f0f0b2e | 2611 | *blank, *position, *action, *delim, *pad, *iostat, *iomsg, *convert, |
0ef33d44 FR |
2612 | *decimal, *encoding, *round, *sign, *asynchronous, *id, *newunit, |
2613 | *share, *cc; | |
2614 | char readonly; | |
6de9cd9a DN |
2615 | gfc_st_label *err; |
2616 | } | |
2617 | gfc_open; | |
2618 | ||
2619 | ||
2620 | typedef struct | |
2621 | { | |
7aba8abe | 2622 | gfc_expr *unit, *status, *iostat, *iomsg; |
6de9cd9a DN |
2623 | gfc_st_label *err; |
2624 | } | |
2625 | gfc_close; | |
2626 | ||
2627 | ||
2628 | typedef struct | |
2629 | { | |
7aba8abe | 2630 | gfc_expr *unit, *iostat, *iomsg; |
6de9cd9a DN |
2631 | gfc_st_label *err; |
2632 | } | |
2633 | gfc_filepos; | |
2634 | ||
2635 | ||
2636 | typedef struct | |
2637 | { | |
2638 | gfc_expr *unit, *file, *iostat, *exist, *opened, *number, *named, | |
2639 | *name, *access, *sequential, *direct, *form, *formatted, | |
2640 | *unformatted, *recl, *nextrec, *blank, *position, *action, *read, | |
6f0f0b2e | 2641 | *write, *readwrite, *delim, *pad, *iolength, *iomsg, *convert, *strm_pos, |
93e8af19 | 2642 | *asynchronous, *decimal, *encoding, *pending, *round, *sign, *size, *id, |
0ef33d44 | 2643 | *iqstream, *share, *cc; |
6de9cd9a DN |
2644 | |
2645 | gfc_st_label *err; | |
2646 | ||
2647 | } | |
2648 | gfc_inquire; | |
2649 | ||
2650 | ||
2651 | typedef struct | |
2652 | { | |
6f0f0b2e JD |
2653 | gfc_expr *unit, *iostat, *iomsg, *id; |
2654 | gfc_st_label *err, *end, *eor; | |
2655 | } | |
2656 | gfc_wait; | |
2657 | ||
2658 | ||
2659 | typedef struct | |
2660 | { | |
2661 | gfc_expr *io_unit, *format_expr, *rec, *advance, *iostat, *size, *iomsg, | |
2662 | *id, *pos, *asynchronous, *blank, *decimal, *delim, *pad, *round, | |
4a8d4422 | 2663 | *sign, *extra_comma, *dt_io_kind, *udtio; |
7ee4f6f3 | 2664 | char dec_ext; |
6de9cd9a DN |
2665 | |
2666 | gfc_symbol *namelist; | |
2667 | /* A format_label of `format_asterisk' indicates the "*" format */ | |
2668 | gfc_st_label *format_label; | |
2669 | gfc_st_label *err, *end, *eor; | |
2670 | ||
e0e85e06 | 2671 | locus eor_where, end_where, err_where; |
6de9cd9a DN |
2672 | } |
2673 | gfc_dt; | |
2674 | ||
2675 | ||
2676 | typedef struct gfc_forall_iterator | |
2677 | { | |
2678 | gfc_expr *var, *start, *end, *stride; | |
2679 | struct gfc_forall_iterator *next; | |
2680 | } | |
2681 | gfc_forall_iterator; | |
2682 | ||
2683 | ||
03af1e4c DK |
2684 | /* Linked list to store associations in an ASSOCIATE statement. */ |
2685 | ||
2686 | typedef struct gfc_association_list | |
2687 | { | |
4d382327 | 2688 | struct gfc_association_list *next; |
03af1e4c DK |
2689 | |
2690 | /* Whether this is association to a variable that can be changed; otherwise, | |
2691 | it's association to an expression and the name may not be used as | |
2692 | lvalue. */ | |
2693 | unsigned variable:1; | |
2694 | ||
3e78238a DK |
2695 | /* True if this struct is currently only linked to from a gfc_symbol rather |
2696 | than as part of a real list in gfc_code->ext.block.assoc. This may | |
2697 | happen for SELECT TYPE temporaries and must be considered | |
2698 | for memory handling. */ | |
2699 | unsigned dangling:1; | |
2700 | ||
76fe932b AV |
2701 | /* True when the rank of the target expression is guessed during parsing. */ |
2702 | unsigned rankguessed:1; | |
2703 | ||
03af1e4c DK |
2704 | char name[GFC_MAX_SYMBOL_LEN + 1]; |
2705 | gfc_symtree *st; /* Symtree corresponding to name. */ | |
571d54de DK |
2706 | locus where; |
2707 | ||
03af1e4c DK |
2708 | gfc_expr *target; |
2709 | } | |
2710 | gfc_association_list; | |
2711 | #define gfc_get_association_list() XCNEW (gfc_association_list) | |
2712 | ||
2713 | ||
6de9cd9a | 2714 | /* Executable statements that fill gfc_code structures. */ |
a79683d5 | 2715 | enum gfc_exec_op |
6de9cd9a | 2716 | { |
df1a69f6 MM |
2717 | EXEC_NOP = 1, EXEC_END_NESTED_BLOCK, EXEC_END_BLOCK, EXEC_ASSIGN, |
2718 | EXEC_LABEL_ASSIGN, EXEC_POINTER_ASSIGN, EXEC_CRITICAL, EXEC_ERROR_STOP, | |
8e1f752a DK |
2719 | EXEC_GOTO, EXEC_CALL, EXEC_COMPCALL, EXEC_ASSIGN_CALL, EXEC_RETURN, |
2720 | EXEC_ENTRY, EXEC_PAUSE, EXEC_STOP, EXEC_CONTINUE, EXEC_INIT_ASSIGN, | |
8c6a85e3 TB |
2721 | EXEC_IF, EXEC_ARITHMETIC_IF, EXEC_DO, EXEC_DO_CONCURRENT, EXEC_DO_WHILE, |
2722 | EXEC_SELECT, EXEC_BLOCK, EXEC_FORALL, EXEC_WHERE, EXEC_CYCLE, EXEC_EXIT, | |
2723 | EXEC_CALL_PPC, EXEC_ALLOCATE, EXEC_DEALLOCATE, EXEC_END_PROCEDURE, | |
70570ec1 PT |
2724 | EXEC_SELECT_TYPE, EXEC_SELECT_RANK, EXEC_SYNC_ALL, EXEC_SYNC_MEMORY, |
2725 | EXEC_SYNC_IMAGES, EXEC_OPEN, EXEC_CLOSE, EXEC_WAIT, | |
6de9cd9a | 2726 | EXEC_READ, EXEC_WRITE, EXEC_IOLENGTH, EXEC_TRANSFER, EXEC_DT_END, |
6c7a4dfd | 2727 | EXEC_BACKSPACE, EXEC_ENDFILE, EXEC_INQUIRE, EXEC_REWIND, EXEC_FLUSH, |
f8862a1b | 2728 | EXEC_FORM_TEAM, EXEC_CHANGE_TEAM, EXEC_END_TEAM, EXEC_SYNC_TEAM, |
ef78bc3c | 2729 | EXEC_LOCK, EXEC_UNLOCK, EXEC_EVENT_POST, EXEC_EVENT_WAIT, EXEC_FAIL_IMAGE, |
62aee289 MR |
2730 | EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_SERIAL_LOOP, |
2731 | EXEC_OACC_ROUTINE, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_SERIAL, | |
2732 | EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, | |
2733 | EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA, | |
2734 | EXEC_OACC_ATOMIC, EXEC_OACC_DECLARE, | |
6c7a4dfd JJ |
2735 | EXEC_OMP_CRITICAL, EXEC_OMP_DO, EXEC_OMP_FLUSH, EXEC_OMP_MASTER, |
2736 | EXEC_OMP_ORDERED, EXEC_OMP_PARALLEL, EXEC_OMP_PARALLEL_DO, | |
2737 | EXEC_OMP_PARALLEL_SECTIONS, EXEC_OMP_PARALLEL_WORKSHARE, | |
2738 | EXEC_OMP_SECTIONS, EXEC_OMP_SINGLE, EXEC_OMP_WORKSHARE, | |
2739 | EXEC_OMP_ATOMIC, EXEC_OMP_BARRIER, EXEC_OMP_END_NOWAIT, | |
20906c66 | 2740 | EXEC_OMP_END_SINGLE, EXEC_OMP_TASK, EXEC_OMP_TASKWAIT, |
dd2fc525 JJ |
2741 | EXEC_OMP_TASKYIELD, EXEC_OMP_CANCEL, EXEC_OMP_CANCELLATION_POINT, |
2742 | EXEC_OMP_TASKGROUP, EXEC_OMP_SIMD, EXEC_OMP_DO_SIMD, | |
f014c653 JJ |
2743 | EXEC_OMP_PARALLEL_DO_SIMD, EXEC_OMP_TARGET, EXEC_OMP_TARGET_DATA, |
2744 | EXEC_OMP_TEAMS, EXEC_OMP_DISTRIBUTE, EXEC_OMP_DISTRIBUTE_SIMD, | |
2745 | EXEC_OMP_DISTRIBUTE_PARALLEL_DO, EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD, | |
2746 | EXEC_OMP_TARGET_TEAMS, EXEC_OMP_TEAMS_DISTRIBUTE, | |
2747 | EXEC_OMP_TEAMS_DISTRIBUTE_SIMD, EXEC_OMP_TARGET_TEAMS_DISTRIBUTE, | |
2748 | EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD, | |
2749 | EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO, | |
2750 | EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO, | |
2751 | EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, | |
2752 | EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD, | |
b4c3a85b JJ |
2753 | EXEC_OMP_TARGET_UPDATE, EXEC_OMP_END_CRITICAL, |
2754 | EXEC_OMP_TARGET_ENTER_DATA, EXEC_OMP_TARGET_EXIT_DATA, | |
2755 | EXEC_OMP_TARGET_PARALLEL, EXEC_OMP_TARGET_PARALLEL_DO, | |
2756 | EXEC_OMP_TARGET_PARALLEL_DO_SIMD, EXEC_OMP_TARGET_SIMD, | |
0e3702f8 | 2757 | EXEC_OMP_TASKLOOP, EXEC_OMP_TASKLOOP_SIMD, EXEC_OMP_SCAN, EXEC_OMP_DEPOBJ, |
f6bf436d TB |
2758 | EXEC_OMP_PARALLEL_MASTER, EXEC_OMP_PARALLEL_MASTER_TASKLOOP, |
2759 | EXEC_OMP_PARALLEL_MASTER_TASKLOOP_SIMD, EXEC_OMP_MASTER_TASKLOOP, | |
178191e1 TB |
2760 | EXEC_OMP_MASTER_TASKLOOP_SIMD, EXEC_OMP_LOOP, EXEC_OMP_PARALLEL_LOOP, |
2761 | EXEC_OMP_TEAMS_LOOP, EXEC_OMP_TARGET_PARALLEL_LOOP, EXEC_OMP_TARGET_TEAMS_LOOP | |
a79683d5 | 2762 | }; |
6de9cd9a DN |
2763 | |
2764 | typedef struct gfc_code | |
2765 | { | |
2766 | gfc_exec_op op; | |
2767 | ||
2768 | struct gfc_code *block, *next; | |
2769 | locus loc; | |
2770 | ||
79bd1948 | 2771 | gfc_st_label *here, *label1, *label2, *label3; |
6de9cd9a | 2772 | gfc_symtree *symtree; |
5493aa17 | 2773 | gfc_expr *expr1, *expr2, *expr3, *expr4; |
6de9cd9a DN |
2774 | /* A name isn't sufficient to identify a subroutine, we need the actual |
2775 | symbol for the interface definition. | |
2776 | const char *sub_name; */ | |
2777 | gfc_symbol *resolved_sym; | |
12f681a0 | 2778 | gfc_intrinsic_sym *resolved_isym; |
6de9cd9a DN |
2779 | |
2780 | union | |
2781 | { | |
2782 | gfc_actual_arglist *actual; | |
6de9cd9a | 2783 | gfc_iterator *iterator; |
cf2b3c22 TB |
2784 | |
2785 | struct | |
2786 | { | |
2787 | gfc_typespec ts; | |
2788 | gfc_alloc *list; | |
1792349b AV |
2789 | /* Take the array specification from expr3 to allocate arrays |
2790 | without an explicit array specification. */ | |
2791 | unsigned arr_spec_from_expr3:1; | |
cf2b3c22 TB |
2792 | } |
2793 | alloc; | |
2794 | ||
03af1e4c DK |
2795 | struct |
2796 | { | |
2797 | gfc_namespace *ns; | |
2798 | gfc_association_list *assoc; | |
29a63d67 | 2799 | gfc_case *case_list; |
03af1e4c DK |
2800 | } |
2801 | block; | |
2802 | ||
6de9cd9a DN |
2803 | gfc_open *open; |
2804 | gfc_close *close; | |
2805 | gfc_filepos *filepos; | |
2806 | gfc_inquire *inquire; | |
6f0f0b2e | 2807 | gfc_wait *wait; |
6de9cd9a DN |
2808 | gfc_dt *dt; |
2809 | gfc_forall_iterator *forall_iterator; | |
e5ca9693 | 2810 | struct gfc_code *which_construct; |
6de9cd9a | 2811 | int stop_code; |
3d79abbd | 2812 | gfc_entry_list *entry; |
dc7a8b4b | 2813 | gfc_oacc_declare *oacc_declare; |
6c7a4dfd JJ |
2814 | gfc_omp_clauses *omp_clauses; |
2815 | const char *omp_name; | |
dd2fc525 | 2816 | gfc_omp_namelist *omp_namelist; |
6c7a4dfd | 2817 | bool omp_bool; |
6de9cd9a DN |
2818 | } |
2819 | ext; /* Points to additional structures required by statement */ | |
2820 | ||
e5ca9693 | 2821 | /* Cycle and break labels in constructs. */ |
e7041633 NF |
2822 | tree cycle_label; |
2823 | tree exit_label; | |
6de9cd9a DN |
2824 | } |
2825 | gfc_code; | |
2826 | ||
2827 | ||
2828 | /* Storage for DATA statements. */ | |
2829 | typedef struct gfc_data_variable | |
2830 | { | |
2831 | gfc_expr *expr; | |
2832 | gfc_iterator iter; | |
2833 | struct gfc_data_variable *list, *next; | |
2834 | } | |
2835 | gfc_data_variable; | |
2836 | ||
2837 | ||
2838 | typedef struct gfc_data_value | |
2839 | { | |
f2112868 | 2840 | mpz_t repeat; |
6de9cd9a | 2841 | gfc_expr *expr; |
6de9cd9a DN |
2842 | struct gfc_data_value *next; |
2843 | } | |
2844 | gfc_data_value; | |
2845 | ||
2846 | ||
2847 | typedef struct gfc_data | |
2848 | { | |
2849 | gfc_data_variable *var; | |
2850 | gfc_data_value *value; | |
2851 | locus where; | |
2852 | ||
2853 | struct gfc_data *next; | |
2854 | } | |
2855 | gfc_data; | |
2856 | ||
6de9cd9a DN |
2857 | |
2858 | /* Structure for holding compile options */ | |
2859 | typedef struct | |
2860 | { | |
6de9cd9a DN |
2861 | char *module_dir; |
2862 | gfc_source_form source_form; | |
5a06474c JD |
2863 | int max_continue_fixed; |
2864 | int max_continue_free; | |
6de9cd9a | 2865 | int max_identifier_length; |
6de9cd9a | 2866 | |
3f139fcf | 2867 | int max_errors; |
6de9cd9a | 2868 | |
2d7c7df6 | 2869 | int flag_preprocessed; |
e0bcf78c | 2870 | int flag_d_lines; |
51b09ce3 | 2871 | int flag_init_integer; |
66086032 | 2872 | long flag_init_integer_value; |
51b09ce3 AL |
2873 | int flag_init_logical; |
2874 | int flag_init_character; | |
2875 | char flag_init_character_value; | |
6de9cd9a | 2876 | |
944b8b35 | 2877 | int fpe; |
fa86f4f9 | 2878 | int fpe_summary; |
d3d3011f | 2879 | int rtcheck; |
944b8b35 | 2880 | |
6de9cd9a DN |
2881 | int warn_std; |
2882 | int allow_std; | |
2883 | } | |
2884 | gfc_option_t; | |
2885 | ||
2886 | extern gfc_option_t gfc_option; | |
2887 | ||
6de9cd9a DN |
2888 | /* Constructor nodes for array and structure constructors. */ |
2889 | typedef struct gfc_constructor | |
2890 | { | |
b7e75771 JD |
2891 | gfc_constructor_base base; |
2892 | mpz_t offset; /* Offset within a constructor, used as | |
2893 | key within base. */ | |
2894 | ||
6de9cd9a DN |
2895 | gfc_expr *expr; |
2896 | gfc_iterator *iterator; | |
2897 | locus where; | |
b7e75771 JD |
2898 | |
2899 | union | |
6de9cd9a | 2900 | { |
b7e75771 | 2901 | gfc_component *component; /* Record the component being initialized. */ |
6de9cd9a DN |
2902 | } |
2903 | n; | |
21ea4922 JJ |
2904 | mpz_t repeat; /* Record the repeat number of initial values in data |
2905 | statement like "data a/5*10/". */ | |
6de9cd9a DN |
2906 | } |
2907 | gfc_constructor; | |
2908 | ||
2909 | ||
2910 | typedef struct iterator_stack | |
2911 | { | |
2912 | gfc_symtree *variable; | |
2913 | mpz_t value; | |
2914 | struct iterator_stack *prev; | |
2915 | } | |
2916 | iterator_stack; | |
2917 | extern iterator_stack *iter_stack; | |
2918 | ||
34523524 | 2919 | |
7431bf06 JW |
2920 | /* Used for (possibly nested) SELECT TYPE statements. */ |
2921 | typedef struct gfc_select_type_stack | |
2922 | { | |
2923 | gfc_symbol *selector; /* Current selector variable. */ | |
2924 | gfc_symtree *tmp; /* Current temporary variable. */ | |
2925 | struct gfc_select_type_stack *prev; /* Previous element on stack. */ | |
2926 | } | |
2927 | gfc_select_type_stack; | |
2928 | extern gfc_select_type_stack *select_type_stack; | |
2929 | #define gfc_get_select_type_stack() XCNEW (gfc_select_type_stack) | |
2930 | ||
2931 | ||
34523524 DK |
2932 | /* Node in the linked list used for storing finalizer procedures. */ |
2933 | ||
2934 | typedef struct gfc_finalizer | |
2935 | { | |
2936 | struct gfc_finalizer* next; | |
df2fba9e | 2937 | locus where; /* Where the FINAL declaration occurred. */ |
f6fad28e DK |
2938 | |
2939 | /* Up to resolution, we want the gfc_symbol, there we lookup the corresponding | |
2940 | symtree and later need only that. This way, we can access and call the | |
2941 | finalizers from every context as they should be "always accessible". I | |
2942 | don't make this a union because we need the information whether proc_sym is | |
2943 | still referenced or not for dereferencing it on deleting a gfc_finalizer | |
2944 | structure. */ | |
2945 | gfc_symbol* proc_sym; | |
4d382327 | 2946 | gfc_symtree* proc_tree; |
34523524 DK |
2947 | } |
2948 | gfc_finalizer; | |
f6fad28e DK |
2949 | #define gfc_get_finalizer() XCNEW (gfc_finalizer) |
2950 | ||
34523524 | 2951 | |
6de9cd9a DN |
2952 | /************************ Function prototypes *************************/ |
2953 | ||
2220652d PT |
2954 | /* decl.c */ |
2955 | bool gfc_in_match_data (void); | |
8234e5e0 | 2956 | match gfc_match_char_spec (gfc_typespec *); |
170a8bd6 | 2957 | extern int directive_unroll; |
2bd86b95 HA |
2958 | extern bool directive_ivdep; |
2959 | extern bool directive_vector; | |
2960 | extern bool directive_novector; | |
2220652d | 2961 | |
facf0354 ML |
2962 | /* SIMD clause enum. */ |
2963 | enum gfc_simd_clause | |
2964 | { | |
2965 | SIMD_NONE = (1 << 0), | |
2966 | SIMD_INBRANCH = (1 << 1), | |
2967 | SIMD_NOTINBRANCH = (1 << 2) | |
2968 | }; | |
2969 | ||
2970 | /* Tuple for parsing of vectorized built-ins. */ | |
2971 | struct gfc_vect_builtin_tuple | |
2972 | { | |
2973 | gfc_vect_builtin_tuple (const char *n, gfc_simd_clause t) | |
2974 | : name (n), simd_type (t) {} | |
2975 | ||
2976 | const char *name; | |
2977 | gfc_simd_clause simd_type; | |
2978 | }; | |
2979 | ||
2980 | /* Map of middle-end built-ins that should be vectorized. */ | |
2981 | extern hash_map<nofree_string_hash, int> *gfc_vectorized_builtins; | |
2982 | ||
5bab4c96 PT |
2983 | /* Handling Parameterized Derived Types */ |
2984 | bool gfc_insert_kind_parameter_exprs (gfc_expr *); | |
2985 | bool gfc_insert_parameter_exprs (gfc_expr *, gfc_actual_arglist *); | |
2986 | match gfc_get_pdt_instance (gfc_actual_arglist *, gfc_symbol **, | |
2987 | gfc_actual_arglist **); | |
2988 | ||
7848054c AB |
2989 | |
2990 | /* Given a symbol, test whether it is a module procedure in a submodule */ | |
2991 | #define gfc_submodule_procedure(attr) \ | |
2992 | (gfc_state_stack->previous && gfc_state_stack->previous->previous \ | |
2993 | && gfc_state_stack->previous->previous->state == COMP_SUBMODULE \ | |
2994 | && attr->module_procedure) | |
2995 | ||
6de9cd9a DN |
2996 | /* scanner.c */ |
2997 | void gfc_scanner_done_1 (void); | |
2998 | void gfc_scanner_init_1 (void); | |
2999 | ||
308f961b | 3000 | void gfc_add_include_path (const char *, bool, bool, bool); |
31198773 | 3001 | void gfc_add_intrinsic_modules_path (const char *); |
6de9cd9a | 3002 | void gfc_release_include_path (void); |
31198773 | 3003 | FILE *gfc_open_included_file (const char *, bool, bool); |
6de9cd9a | 3004 | |
6de9cd9a DN |
3005 | int gfc_at_end (void); |
3006 | int gfc_at_eof (void); | |
3007 | int gfc_at_bol (void); | |
3008 | int gfc_at_eol (void); | |
3009 | void gfc_advance_line (void); | |
3010 | int gfc_check_include (void); | |
9e8a6720 | 3011 | int gfc_define_undef_line (void); |
6de9cd9a | 3012 | |
8fc541d3 FXC |
3013 | int gfc_wide_is_printable (gfc_char_t); |
3014 | int gfc_wide_is_digit (gfc_char_t); | |
3015 | int gfc_wide_fits_in_byte (gfc_char_t); | |
3016 | gfc_char_t gfc_wide_tolower (gfc_char_t); | |
00660189 | 3017 | gfc_char_t gfc_wide_toupper (gfc_char_t); |
8fc541d3 | 3018 | size_t gfc_wide_strlen (const gfc_char_t *); |
00660189 FXC |
3019 | int gfc_wide_strncasecmp (const gfc_char_t *, const char *, size_t); |
3020 | gfc_char_t *gfc_wide_memset (gfc_char_t *, gfc_char_t, size_t); | |
3021 | char *gfc_widechar_to_char (const gfc_char_t *, int); | |
3022 | gfc_char_t *gfc_char_to_widechar (const char *); | |
3023 | ||
ece3f663 | 3024 | #define gfc_get_wide_string(n) XCNEWVEC (gfc_char_t, n) |
8fc541d3 | 3025 | |
6de9cd9a | 3026 | void gfc_skip_comments (void); |
696abb30 | 3027 | gfc_char_t gfc_next_char_literal (gfc_instring); |
8fc541d3 FXC |
3028 | gfc_char_t gfc_next_char (void); |
3029 | char gfc_next_ascii_char (void); | |
3030 | gfc_char_t gfc_peek_char (void); | |
3031 | char gfc_peek_ascii_char (void); | |
6de9cd9a DN |
3032 | void gfc_error_recovery (void); |
3033 | void gfc_gobble_whitespace (void); | |
524af0d6 | 3034 | bool gfc_new_file (void); |
2d7c7df6 | 3035 | const char * gfc_read_orig_filename (const char *, const char **); |
6de9cd9a | 3036 | |
d4fa05b9 | 3037 | extern gfc_source_form gfc_current_form; |
e0bcf78c | 3038 | extern const char *gfc_source_file; |
63645982 | 3039 | extern locus gfc_current_locus; |
6de9cd9a | 3040 | |
60332588 JJ |
3041 | void gfc_start_source_files (void); |
3042 | void gfc_end_source_files (void); | |
3043 | ||
6de9cd9a | 3044 | /* misc.c */ |
6de9cd9a DN |
3045 | void gfc_clear_ts (gfc_typespec *); |
3046 | FILE *gfc_open_file (const char *); | |
6de9cd9a | 3047 | const char *gfc_basic_typename (bt); |
f61e54e5 | 3048 | const char *gfc_dummy_typename (gfc_typespec *); |
5958b926 | 3049 | const char *gfc_typename (gfc_typespec *, bool for_hash = false); |
f61e54e5 | 3050 | const char *gfc_typename (gfc_expr *); |
ba3ba492 | 3051 | const char *gfc_op2string (gfc_intrinsic_op); |
6de9cd9a DN |
3052 | const char *gfc_code2string (const mstring *, int); |
3053 | int gfc_string2code (const mstring *, const char *); | |
3054 | const char *gfc_intent_string (sym_intent); | |
3055 | ||
3056 | void gfc_init_1 (void); | |
3057 | void gfc_init_2 (void); | |
3058 | void gfc_done_1 (void); | |
3059 | void gfc_done_2 (void); | |
3060 | ||
a8b3b0b6 CR |
3061 | int get_c_kind (const char *, CInteropKind_t *); |
3062 | ||
bcc478b9 BRF |
3063 | const char *gfc_closest_fuzzy_match (const char *, char **); |
3064 | static inline void | |
3065 | vec_push (char **&optr, size_t &osz, const char *elt) | |
3066 | { | |
3067 | /* {auto,}vec.safe_push () replacement. Don't ask.. */ | |
3068 | // if (strlen (elt) < 4) return; premature optimization: eliminated by cutoff | |
3069 | optr = XRESIZEVEC (char *, optr, osz + 2); | |
3070 | optr[osz] = CONST_CAST (char *, elt); | |
3071 | optr[++osz] = NULL; | |
3072 | } | |
3073 | ||
f622221a JB |
3074 | HOST_WIDE_INT gfc_mpz_get_hwi (mpz_t); |
3075 | void gfc_mpz_set_hwi (mpz_t, const HOST_WIDE_INT); | |
3076 | ||
6de9cd9a | 3077 | /* options.c */ |
7a9bf9a4 | 3078 | unsigned int gfc_option_lang_mask (void); |
a75bfaa6 | 3079 | void gfc_init_options_struct (struct gcc_options *); |
7a9bf9a4 JM |
3080 | void gfc_init_options (unsigned int, |
3081 | struct cl_decoded_option *); | |
00abf86c | 3082 | bool gfc_handle_option (size_t, const char *, HOST_WIDE_INT, int, location_t, |
5f20c657 | 3083 | const struct cl_option_handlers *); |
6de9cd9a | 3084 | bool gfc_post_options (const char **); |
41804a5b | 3085 | char *gfc_get_option_string (void); |
6de9cd9a | 3086 | |
602b8523 TB |
3087 | /* f95-lang.c */ |
3088 | void gfc_maybe_initialize_eh (void); | |
3089 | ||
6de9cd9a | 3090 | /* iresolve.c */ |
6b25a558 | 3091 | const char * gfc_get_string (const char *, ...) ATTRIBUTE_PRINTF_1; |
a68ab351 | 3092 | bool gfc_find_sym_in_expr (gfc_symbol *, gfc_expr *); |
6de9cd9a DN |
3093 | |
3094 | /* error.c */ | |
6de9cd9a | 3095 | void gfc_error_init_1 (void); |
3aa34c1d MLI |
3096 | void gfc_diagnostics_init (void); |
3097 | void gfc_diagnostics_finish (void); | |
0f447a6e | 3098 | void gfc_buffer_error (bool); |
6de9cd9a | 3099 | |
00660189 FXC |
3100 | const char *gfc_print_wide_char (gfc_char_t); |
3101 | ||
48749dbc | 3102 | bool gfc_warning (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3); |
4daa149b | 3103 | bool gfc_warning_now (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3); |
be841e11 | 3104 | bool gfc_warning_internal (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3); |
2a2703a2 MLI |
3105 | bool gfc_warning_now_at (location_t loc, int opt, const char *gmsgid, ...) |
3106 | ATTRIBUTE_GCC_GFC(3,4); | |
8e54f6d3 | 3107 | |
6de9cd9a DN |
3108 | void gfc_clear_warning (void); |
3109 | void gfc_warning_check (void); | |
3110 | ||
2700d0e3 | 3111 | void gfc_error_opt (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3); |
0ce0154c KG |
3112 | void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); |
3113 | void gfc_error_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); | |
3114 | void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); | |
3115 | void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); | |
6de9cd9a | 3116 | void gfc_clear_error (void); |
b5a9fd3e | 3117 | bool gfc_error_check (void); |
0f447a6e | 3118 | bool gfc_error_flag_test (void); |
6de9cd9a | 3119 | |
8f0d39a8 | 3120 | notification gfc_notification_std (int); |
524af0d6 | 3121 | bool gfc_notify_std (int, const char *, ...) ATTRIBUTE_GCC_GFC(2,3); |
6de9cd9a DN |
3122 | |
3123 | /* A general purpose syntax error. */ | |
3124 | #define gfc_syntax_error(ST) \ | |
3125 | gfc_error ("Syntax error in %s statement at %C", gfc_ascii_statement (ST)); | |
3126 | ||
fea70c99 MLI |
3127 | #include "pretty-print.h" /* For output_buffer. */ |
3128 | struct gfc_error_buffer | |
3129 | { | |
3130 | bool flag; | |
3131 | output_buffer buffer; | |
3132 | gfc_error_buffer(void) : flag(false), buffer() {} | |
3133 | }; | |
3134 | ||
3135 | void gfc_push_error (gfc_error_buffer *); | |
3136 | void gfc_pop_error (gfc_error_buffer *); | |
3137 | void gfc_free_error (gfc_error_buffer *); | |
6de9cd9a | 3138 | |
6de9cd9a | 3139 | void gfc_get_errors (int *, int *); |
f4031599 | 3140 | void gfc_errors_to_warnings (bool); |
6de9cd9a DN |
3141 | |
3142 | /* arith.c */ | |
3143 | void gfc_arith_init_1 (void); | |
3144 | void gfc_arith_done_1 (void); | |
25d8f0a2 | 3145 | arith gfc_check_integer_range (mpz_t p, int kind); |
d393bbd7 | 3146 | bool gfc_check_character_range (gfc_char_t, int); |
6de9cd9a | 3147 | |
67251118 TK |
3148 | extern bool gfc_seen_div0; |
3149 | ||
5e8e542f | 3150 | /* trans-types.c */ |
524af0d6 | 3151 | bool gfc_check_any_c_kind (gfc_typespec *); |
e7a2d5fb | 3152 | int gfc_validate_kind (bt, int, bool); |
e0a6661b FXC |
3153 | int gfc_get_int_kind_from_width_isofortranenv (int size); |
3154 | int gfc_get_real_kind_from_width_isofortranenv (int size); | |
f6288c24 | 3155 | tree gfc_get_union_type (gfc_symbol *); |
de91486c | 3156 | tree gfc_get_derived_type (gfc_symbol * derived, int codimen = 0); |
6de9cd9a | 3157 | extern int gfc_index_integer_kind; |
9d64df18 | 3158 | extern int gfc_default_integer_kind; |
f4e7375a | 3159 | extern int gfc_max_integer_kind; |
9d64df18 TS |
3160 | extern int gfc_default_real_kind; |
3161 | extern int gfc_default_double_kind; | |
3162 | extern int gfc_default_character_kind; | |
3163 | extern int gfc_default_logical_kind; | |
3164 | extern int gfc_default_complex_kind; | |
e8525382 | 3165 | extern int gfc_c_int_kind; |
a6d22fb2 | 3166 | extern int gfc_c_intptr_kind; |
da661a58 TB |
3167 | extern int gfc_atomic_int_kind; |
3168 | extern int gfc_atomic_logical_kind; | |
014ec6ee | 3169 | extern int gfc_intio_kind; |
f1412ca5 | 3170 | extern int gfc_charlen_int_kind; |
f622221a | 3171 | extern int gfc_size_kind; |
39f87c03 FXC |
3172 | extern int gfc_numeric_storage_size; |
3173 | extern int gfc_character_storage_size; | |
6de9cd9a | 3174 | |
64b1806b | 3175 | #define gfc_logical_4_kind 4 |
6ef1366a | 3176 | #define gfc_integer_4_kind 4 |
13b1afe4 | 3177 | #define gfc_real_4_kind 4 |
64b1806b | 3178 | |
6de9cd9a DN |
3179 | /* symbol.c */ |
3180 | void gfc_clear_new_implicit (void); | |
524af0d6 JB |
3181 | bool gfc_add_new_implicit_range (int, int); |
3182 | bool gfc_merge_new_implicit (gfc_typespec *); | |
a6c63173 | 3183 | void gfc_set_implicit_none (bool, bool, locus *); |
e9bd9f7d | 3184 | void gfc_check_function_type (gfc_namespace *); |
e9c06563 | 3185 | bool gfc_is_intrinsic_typename (const char *); |
b323be61 | 3186 | bool gfc_check_conflict (symbol_attribute *, const char *, locus *); |
6de9cd9a | 3187 | |
713485cc | 3188 | gfc_typespec *gfc_get_default_type (const char *, gfc_namespace *); |
524af0d6 | 3189 | bool gfc_set_default_type (gfc_symbol *, int, gfc_namespace *); |
6de9cd9a | 3190 | |
66e4ab31 | 3191 | void gfc_set_sym_referenced (gfc_symbol *); |
6de9cd9a | 3192 | |
524af0d6 JB |
3193 | bool gfc_add_attribute (symbol_attribute *, locus *); |
3194 | bool gfc_add_ext_attribute (symbol_attribute *, ext_attr_id_t, locus *); | |
3195 | bool gfc_add_allocatable (symbol_attribute *, locus *); | |
3196 | bool gfc_add_codimension (symbol_attribute *, const char *, locus *); | |
3197 | bool gfc_add_contiguous (symbol_attribute *, const char *, locus *); | |
3198 | bool gfc_add_dimension (symbol_attribute *, const char *, locus *); | |
3199 | bool gfc_add_external (symbol_attribute *, locus *); | |
3200 | bool gfc_add_intrinsic (symbol_attribute *, locus *); | |
3201 | bool gfc_add_optional (symbol_attribute *, locus *); | |
5bab4c96 PT |
3202 | bool gfc_add_kind (symbol_attribute *, locus *); |
3203 | bool gfc_add_len (symbol_attribute *, locus *); | |
524af0d6 JB |
3204 | bool gfc_add_pointer (symbol_attribute *, locus *); |
3205 | bool gfc_add_cray_pointer (symbol_attribute *, locus *); | |
3206 | bool gfc_add_cray_pointee (symbol_attribute *, locus *); | |
32e8bb8e | 3207 | match gfc_mod_pointee_as (gfc_array_spec *); |
524af0d6 JB |
3208 | bool gfc_add_protected (symbol_attribute *, const char *, locus *); |
3209 | bool gfc_add_result (symbol_attribute *, const char *, locus *); | |
34d567d1 | 3210 | bool gfc_add_automatic (symbol_attribute *, const char *, locus *); |
524af0d6 JB |
3211 | bool gfc_add_save (symbol_attribute *, save_state, const char *, locus *); |
3212 | bool gfc_add_threadprivate (symbol_attribute *, const char *, locus *); | |
f014c653 | 3213 | bool gfc_add_omp_declare_target (symbol_attribute *, const char *, locus *); |
b4c3a85b JJ |
3214 | bool gfc_add_omp_declare_target_link (symbol_attribute *, const char *, |
3215 | locus *); | |
524af0d6 JB |
3216 | bool gfc_add_saved_common (symbol_attribute *, locus *); |
3217 | bool gfc_add_target (symbol_attribute *, locus *); | |
3218 | bool gfc_add_dummy (symbol_attribute *, const char *, locus *); | |
3219 | bool gfc_add_generic (symbol_attribute *, const char *, locus *); | |
3220 | bool gfc_add_common (symbol_attribute *, locus *); | |
3221 | bool gfc_add_in_common (symbol_attribute *, const char *, locus *); | |
3222 | bool gfc_add_in_equivalence (symbol_attribute *, const char *, locus *); | |
3223 | bool gfc_add_data (symbol_attribute *, const char *, locus *); | |
3224 | bool gfc_add_in_namelist (symbol_attribute *, const char *, locus *); | |
3225 | bool gfc_add_sequence (symbol_attribute *, const char *, locus *); | |
3226 | bool gfc_add_elemental (symbol_attribute *, locus *); | |
3227 | bool gfc_add_pure (symbol_attribute *, locus *); | |
3228 | bool gfc_add_recursive (symbol_attribute *, locus *); | |
3229 | bool gfc_add_function (symbol_attribute *, const char *, locus *); | |
3230 | bool gfc_add_subroutine (symbol_attribute *, const char *, locus *); | |
3231 | bool gfc_add_volatile (symbol_attribute *, const char *, locus *); | |
3232 | bool gfc_add_asynchronous (symbol_attribute *, const char *, locus *); | |
3233 | bool gfc_add_proc (symbol_attribute *attr, const char *name, locus *where); | |
3234 | bool gfc_add_abstract (symbol_attribute* attr, locus* where); | |
3235 | ||
3236 | bool gfc_add_access (symbol_attribute *, gfc_access, const char *, locus *); | |
3237 | bool gfc_add_is_bind_c (symbol_attribute *, const char *, locus *, int); | |
3238 | bool gfc_add_extension (symbol_attribute *, locus *); | |
3239 | bool gfc_add_value (symbol_attribute *, const char *, locus *); | |
3240 | bool gfc_add_flavor (symbol_attribute *, sym_flavor, const char *, locus *); | |
3241 | bool gfc_add_entry (symbol_attribute *, const char *, locus *); | |
3242 | bool gfc_add_procedure (symbol_attribute *, procedure_type, | |
231b2fcc | 3243 | const char *, locus *); |
524af0d6 JB |
3244 | bool gfc_add_intent (symbol_attribute *, sym_intent, locus *); |
3245 | bool gfc_add_explicit_interface (gfc_symbol *, ifsrc, | |
6de9cd9a | 3246 | gfc_formal_arglist *, locus *); |
524af0d6 | 3247 | bool gfc_add_type (gfc_symbol *, gfc_typespec *, locus *); |
6de9cd9a DN |
3248 | |
3249 | void gfc_clear_attr (symbol_attribute *); | |
524af0d6 JB |
3250 | bool gfc_missing_attr (symbol_attribute *, locus *); |
3251 | bool gfc_copy_attr (symbol_attribute *, symbol_attribute *, locus *); | |
4668d6f9 | 3252 | int gfc_copy_dummy_sym (gfc_symbol **, gfc_symbol *, int); |
524af0d6 | 3253 | bool gfc_add_component (gfc_symbol *, const char *, gfc_component **); |
6de9cd9a DN |
3254 | gfc_symbol *gfc_use_derived (gfc_symbol *); |
3255 | gfc_symtree *gfc_use_derived_tree (gfc_symtree *); | |
f6288c24 FR |
3256 | gfc_component *gfc_find_component (gfc_symbol *, const char *, bool, bool, |
3257 | gfc_ref **); | |
6de9cd9a DN |
3258 | |
3259 | gfc_st_label *gfc_get_st_label (int); | |
3260 | void gfc_free_st_label (gfc_st_label *); | |
3261 | void gfc_define_st_label (gfc_st_label *, gfc_sl_type, locus *); | |
524af0d6 | 3262 | bool gfc_reference_st_label (gfc_st_label *, gfc_sl_type); |
6de9cd9a | 3263 | |
0366dfe9 | 3264 | gfc_namespace *gfc_get_namespace (gfc_namespace *, int); |
6de9cd9a DN |
3265 | gfc_symtree *gfc_new_symtree (gfc_symtree **, const char *); |
3266 | gfc_symtree *gfc_find_symtree (gfc_symtree *, const char *); | |
a99d95a2 | 3267 | void gfc_delete_symtree (gfc_symtree **, const char *); |
aa84a9a5 | 3268 | gfc_symtree *gfc_get_unique_symtree (gfc_namespace *); |
6de9cd9a DN |
3269 | gfc_user_op *gfc_get_uop (const char *); |
3270 | gfc_user_op *gfc_find_uop (const char *, gfc_namespace *); | |
3271 | void gfc_free_symbol (gfc_symbol *); | |
3cb595ac | 3272 | void gfc_release_symbol (gfc_symbol *); |
6de9cd9a | 3273 | gfc_symbol *gfc_new_symbol (const char *, gfc_namespace *); |
61b644c2 | 3274 | gfc_symtree* gfc_find_symtree_in_proc (const char *, gfc_namespace *); |
6de9cd9a DN |
3275 | int gfc_find_symbol (const char *, gfc_namespace *, int, gfc_symbol **); |
3276 | int gfc_find_sym_tree (const char *, gfc_namespace *, int, gfc_symtree **); | |
3277 | int gfc_get_symbol (const char *, gfc_namespace *, gfc_symbol **); | |
524af0d6 JB |
3278 | bool gfc_verify_c_interop (gfc_typespec *); |
3279 | bool gfc_verify_c_interop_param (gfc_symbol *); | |
3280 | bool verify_bind_c_sym (gfc_symbol *, gfc_typespec *, int, gfc_common_head *); | |
3281 | bool verify_bind_c_derived_type (gfc_symbol *); | |
3282 | bool verify_com_block_vars_c_interop (gfc_common_head *); | |
cadddfdd TB |
3283 | gfc_symtree *generate_isocbinding_symbol (const char *, iso_c_binding_symbol, |
3284 | const char *, gfc_symtree *, bool); | |
44c57c2f | 3285 | void gfc_save_symbol_data (gfc_symbol *); |
08a6b8e0 | 3286 | int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **, bool); |
6de9cd9a DN |
3287 | int gfc_get_ha_symbol (const char *, gfc_symbol **); |
3288 | int gfc_get_ha_sym_tree (const char *, gfc_symtree **); | |
3289 | ||
ab68a73e MM |
3290 | void gfc_drop_last_undo_checkpoint (void); |
3291 | void gfc_restore_last_undo_checkpoint (void); | |
6de9cd9a DN |
3292 | void gfc_undo_symbols (void); |
3293 | void gfc_commit_symbols (void); | |
66e4ab31 | 3294 | void gfc_commit_symbol (gfc_symbol *); |
b76e28c6 | 3295 | gfc_charlen *gfc_new_charlen (gfc_namespace *, gfc_charlen *); |
27f31e39 | 3296 | void gfc_free_charlen (gfc_charlen *, gfc_charlen *); |
6de9cd9a DN |
3297 | void gfc_free_namespace (gfc_namespace *); |
3298 | ||
3299 | void gfc_symbol_init_2 (void); | |
3300 | void gfc_symbol_done_2 (void); | |
3301 | ||
9056bd70 | 3302 | void gfc_traverse_symtree (gfc_symtree *, void (*)(gfc_symtree *)); |
6de9cd9a DN |
3303 | void gfc_traverse_ns (gfc_namespace *, void (*)(gfc_symbol *)); |
3304 | void gfc_traverse_user_op (gfc_namespace *, void (*)(gfc_user_op *)); | |
3305 | void gfc_save_all (gfc_namespace *); | |
3306 | ||
4bc20f3a | 3307 | void gfc_enforce_clean_symbol_state (void); |
6de9cd9a | 3308 | |
55b9c612 | 3309 | gfc_gsymbol *gfc_get_gsymbol (const char *, bool bind_c); |
cb9e4f55 | 3310 | gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *); |
98452460 | 3311 | gfc_gsymbol *gfc_find_case_gsymbol (gfc_gsymbol *, const char *); |
5c6aa9a8 | 3312 | void gfc_traverse_gsymbol (gfc_gsymbol *, void (*)(gfc_gsymbol *, void *), void *); |
c9543002 | 3313 | |
3e15518b | 3314 | gfc_typebound_proc* gfc_get_typebound_proc (gfc_typebound_proc*); |
30b608eb | 3315 | gfc_symbol* gfc_get_derived_super_type (gfc_symbol*); |
cf2b3c22 TB |
3316 | gfc_symbol* gfc_get_ultimate_derived_super_type (gfc_symbol*); |
3317 | bool gfc_type_is_extension_of (gfc_symbol *, gfc_symbol *); | |
e74f1cc8 | 3318 | bool gfc_type_compatible (gfc_typespec *, gfc_typespec *); |
30b608eb | 3319 | |
8fdcb6a9 | 3320 | void gfc_copy_formal_args_intr (gfc_symbol *, gfc_intrinsic_sym *, |
47d13acb | 3321 | gfc_actual_arglist *, bool copy_type = false); |
69773742 | 3322 | |
34523524 DK |
3323 | void gfc_free_finalizer (gfc_finalizer *el); /* Needed in resolve.c, too */ |
3324 | ||
524af0d6 | 3325 | bool gfc_check_symbol_typed (gfc_symbol*, gfc_namespace*, bool, locus); |
52bf62f9 | 3326 | gfc_namespace* gfc_find_proc_namespace (gfc_namespace*); |
f37e928c | 3327 | |
571d54de | 3328 | bool gfc_is_associate_pointer (gfc_symbol*); |
c3f34952 | 3329 | gfc_symbol * gfc_find_dt_in_generic (gfc_symbol *); |
4cbc9039 | 3330 | gfc_formal_arglist *gfc_sym_get_dummy_args (gfc_symbol *); |
571d54de | 3331 | |
f2cbd86c DF |
3332 | /* intrinsic.c -- true if working in an init-expr, false otherwise. */ |
3333 | extern bool gfc_init_expr_flag; | |
6de9cd9a DN |
3334 | |
3335 | /* Given a symbol that we have decided is intrinsic, mark it as such | |
3336 | by placing it into a special module that is otherwise impossible to | |
3337 | read or write. */ | |
3338 | ||
cb9e4f55 | 3339 | #define gfc_intrinsic_symbol(SYM) SYM->module = gfc_get_string ("(intrinsic)") |
6de9cd9a DN |
3340 | |
3341 | void gfc_intrinsic_init_1 (void); | |
3342 | void gfc_intrinsic_done_1 (void); | |
3343 | ||
01ce9e31 | 3344 | char gfc_type_letter (bt, bool logical_equals_int = false); |
6de9cd9a | 3345 | gfc_symbol * gfc_get_intrinsic_sub_symbol (const char *); |
47d13acb TK |
3346 | gfc_symbol *gfc_get_intrinsic_function_symbol (gfc_expr *); |
3347 | gfc_symbol *gfc_find_intrinsic_symbol (gfc_expr *); | |
524af0d6 | 3348 | bool gfc_convert_type (gfc_expr *, gfc_typespec *, int); |
8405874a ME |
3349 | bool gfc_convert_type_warn (gfc_expr *, gfc_typespec *, int, int, |
3350 | bool array = false); | |
524af0d6 | 3351 | bool gfc_convert_chartype (gfc_expr *, gfc_typespec *); |
6de9cd9a DN |
3352 | int gfc_generic_intrinsic (const char *); |
3353 | int gfc_specific_intrinsic (const char *); | |
c3005b0f | 3354 | bool gfc_is_intrinsic (gfc_symbol*, int, locus); |
0e7e7e6e | 3355 | int gfc_intrinsic_actual_ok (const char *, const bool); |
6de9cd9a | 3356 | gfc_intrinsic_sym *gfc_find_function (const char *); |
cd5ecab6 | 3357 | gfc_intrinsic_sym *gfc_find_subroutine (const char *); |
d000aa67 | 3358 | gfc_intrinsic_sym *gfc_intrinsic_function_by_id (gfc_isym_id); |
cadddfdd TB |
3359 | gfc_intrinsic_sym *gfc_intrinsic_subroutine_by_id (gfc_isym_id); |
3360 | gfc_isym_id gfc_isym_id_by_intmod (intmod_id, int); | |
3361 | gfc_isym_id gfc_isym_id_by_intmod_sym (gfc_symbol *); | |
3362 | ||
6de9cd9a DN |
3363 | |
3364 | match gfc_intrinsic_func_interface (gfc_expr *, int); | |
3365 | match gfc_intrinsic_sub_interface (gfc_code *, int); | |
3366 | ||
c3005b0f | 3367 | void gfc_warn_intrinsic_shadow (const gfc_symbol*, bool, bool); |
524af0d6 | 3368 | bool gfc_check_intrinsic_standard (const gfc_intrinsic_sym*, const char**, |
17b1d2a0 | 3369 | bool, locus); |
c3005b0f | 3370 | |
6de9cd9a DN |
3371 | /* match.c -- FIXME */ |
3372 | void gfc_free_iterator (gfc_iterator *, int); | |
3373 | void gfc_free_forall_iterator (gfc_forall_iterator *); | |
3374 | void gfc_free_alloc_list (gfc_alloc *); | |
3375 | void gfc_free_namelist (gfc_namelist *); | |
9a5de4d5 | 3376 | void gfc_free_omp_namelist (gfc_omp_namelist *, bool); |
6de9cd9a | 3377 | void gfc_free_equiv (gfc_equiv *); |
31fee91e | 3378 | void gfc_free_equiv_until (gfc_equiv *, gfc_equiv *); |
6de9cd9a | 3379 | void gfc_free_data (gfc_data *); |
d5e2274d | 3380 | void gfc_reject_data (gfc_namespace *); |
6de9cd9a DN |
3381 | void gfc_free_case_list (gfc_case *); |
3382 | ||
b6398823 PT |
3383 | /* matchexp.c -- FIXME too? */ |
3384 | gfc_expr *gfc_get_parentheses (gfc_expr *); | |
3385 | ||
6c7a4dfd | 3386 | /* openmp.c */ |
c7d3bb76 | 3387 | struct gfc_omp_saved_state { void *ptrs[2]; int ints[1]; }; |
269322ec TB |
3388 | bool gfc_omp_requires_add_clause (gfc_omp_requires_kind, const char *, |
3389 | locus *, const char *); | |
3390 | void gfc_check_omp_requires (gfc_namespace *, int); | |
6c7a4dfd | 3391 | void gfc_free_omp_clauses (gfc_omp_clauses *); |
dc7a8b4b | 3392 | void gfc_free_oacc_declare_clauses (struct gfc_oacc_declare *); |
dd2fc525 JJ |
3393 | void gfc_free_omp_declare_simd (gfc_omp_declare_simd *); |
3394 | void gfc_free_omp_declare_simd_list (gfc_omp_declare_simd *); | |
5f23671d JJ |
3395 | void gfc_free_omp_udr (gfc_omp_udr *); |
3396 | gfc_omp_udr *gfc_omp_udr_find (gfc_symtree *, gfc_typespec *); | |
6c7a4dfd | 3397 | void gfc_resolve_omp_directive (gfc_code *, gfc_namespace *); |
cd30a0b8 JJ |
3398 | void gfc_resolve_do_iterator (gfc_code *, gfc_symbol *, bool); |
3399 | void gfc_resolve_omp_local_vars (gfc_namespace *); | |
6c7a4dfd JJ |
3400 | void gfc_resolve_omp_parallel_blocks (gfc_code *, gfc_namespace *); |
3401 | void gfc_resolve_omp_do_blocks (gfc_code *, gfc_namespace *); | |
dd2fc525 | 3402 | void gfc_resolve_omp_declare_simd (gfc_namespace *); |
5f23671d | 3403 | void gfc_resolve_omp_udrs (gfc_symtree *); |
c7d3bb76 JJ |
3404 | void gfc_omp_save_and_clear_state (struct gfc_omp_saved_state *); |
3405 | void gfc_omp_restore_state (struct gfc_omp_saved_state *); | |
41dbbb37 TS |
3406 | void gfc_free_expr_list (gfc_expr_list *); |
3407 | void gfc_resolve_oacc_directive (gfc_code *, gfc_namespace *); | |
3408 | void gfc_resolve_oacc_declare (gfc_namespace *); | |
3409 | void gfc_resolve_oacc_parallel_loop_blocks (gfc_code *, gfc_namespace *); | |
3410 | void gfc_resolve_oacc_blocks (gfc_code *, gfc_namespace *); | |
f6bf4bc1 | 3411 | void gfc_resolve_oacc_routines (gfc_namespace *); |
6c7a4dfd | 3412 | |
6de9cd9a DN |
3413 | /* expr.c */ |
3414 | void gfc_free_actual_arglist (gfc_actual_arglist *); | |
3415 | gfc_actual_arglist *gfc_copy_actual_arglist (gfc_actual_arglist *); | |
f622221a | 3416 | |
51f03c6b | 3417 | bool gfc_extract_int (gfc_expr *, int *, int = 0); |
f622221a JB |
3418 | bool gfc_extract_hwi (gfc_expr *, HOST_WIDE_INT *, int = 0); |
3419 | ||
0d78e4aa | 3420 | bool is_CFI_desc (gfc_symbol *, gfc_expr *); |
1d6b7f39 | 3421 | bool is_subref_array (gfc_expr *); |
460263d0 | 3422 | bool gfc_is_simply_contiguous (gfc_expr *, bool, bool); |
419af57c | 3423 | bool gfc_is_not_contiguous (gfc_expr *); |
524af0d6 | 3424 | bool gfc_check_init_expr (gfc_expr *); |
6de9cd9a DN |
3425 | |
3426 | gfc_expr *gfc_build_conversion (gfc_expr *); | |
3427 | void gfc_free_ref_list (gfc_ref *); | |
dcea1b2f | 3428 | void gfc_type_convert_binary (gfc_expr *, int); |
7a28353e | 3429 | bool gfc_is_constant_expr (gfc_expr *); |
524af0d6 | 3430 | bool gfc_simplify_expr (gfc_expr *, int); |
4075a94e | 3431 | int gfc_has_vector_index (gfc_expr *); |
6de9cd9a DN |
3432 | |
3433 | gfc_expr *gfc_get_expr (void); | |
b7e75771 JD |
3434 | gfc_expr *gfc_get_array_expr (bt type, int kind, locus *); |
3435 | gfc_expr *gfc_get_null_expr (locus *); | |
3436 | gfc_expr *gfc_get_operator_expr (locus *, gfc_intrinsic_op,gfc_expr *, gfc_expr *); | |
3437 | gfc_expr *gfc_get_structure_constructor_expr (bt, int, locus *); | |
3438 | gfc_expr *gfc_get_constant_expr (bt, int, locus *); | |
f622221a JB |
3439 | gfc_expr *gfc_get_character_expr (int, locus *, const char *, gfc_charlen_t len); |
3440 | gfc_expr *gfc_get_int_expr (int, locus *, HOST_WIDE_INT); | |
b7e75771 JD |
3441 | gfc_expr *gfc_get_logical_expr (int, locus *, bool); |
3442 | gfc_expr *gfc_get_iokind_expr (locus *, io_kind); | |
3443 | ||
7d7212ec MM |
3444 | void gfc_clear_shape (mpz_t *shape, int rank); |
3445 | void gfc_free_shape (mpz_t **shape, int rank); | |
6de9cd9a DN |
3446 | void gfc_free_expr (gfc_expr *); |
3447 | void gfc_replace_expr (gfc_expr *, gfc_expr *); | |
6de9cd9a | 3448 | mpz_t *gfc_copy_shape (mpz_t *, int); |
94538bd1 | 3449 | mpz_t *gfc_copy_shape_excluding (mpz_t *, int, gfc_expr *); |
6de9cd9a | 3450 | gfc_expr *gfc_copy_expr (gfc_expr *); |
8e1f752a | 3451 | gfc_ref* gfc_copy_ref (gfc_ref*); |
6de9cd9a | 3452 | |
524af0d6 | 3453 | bool gfc_specification_expr (gfc_expr *); |
6de9cd9a DN |
3454 | |
3455 | int gfc_numeric_ts (gfc_typespec *); | |
3456 | int gfc_kind_max (gfc_expr *, gfc_expr *); | |
3457 | ||
524af0d6 | 3458 | bool gfc_check_conformance (gfc_expr *, gfc_expr *, const char *, ...) ATTRIBUTE_PRINTF_3; |
3c9f5092 | 3459 | bool gfc_check_assign (gfc_expr *, gfc_expr *, int, bool c = true); |
83fad929 | 3460 | bool gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue, |
cedf8d2e TK |
3461 | bool suppres_type_test = false, |
3462 | bool is_init_expr = false); | |
524af0d6 | 3463 | bool gfc_check_assign_symbol (gfc_symbol *, gfc_component *, gfc_expr *); |
6de9cd9a | 3464 | |
7fc61626 | 3465 | gfc_expr *gfc_build_default_init_expr (gfc_typespec *, locus *); |
13051352 | 3466 | gfc_expr *gfc_build_init_expr (gfc_typespec *, locus *, bool); |
7fc61626 | 3467 | void gfc_apply_init (gfc_typespec *, symbol_attribute *, gfc_expr *); |
16e520b6 | 3468 | bool gfc_has_default_initializer (gfc_symbol *); |
54b4ba60 | 3469 | gfc_expr *gfc_default_initializer (gfc_typespec *); |
7fc61626 | 3470 | gfc_expr *gfc_generate_initializer (gfc_typespec *, bool); |
294fbfc8 | 3471 | gfc_expr *gfc_get_variable_expr (gfc_symtree *); |
4d382327 | 3472 | void gfc_add_full_array_ref (gfc_expr *, gfc_array_spec *); |
0d87fa8c | 3473 | gfc_expr * gfc_lval_expr_from_sym (gfc_symbol *); |
294fbfc8 | 3474 | |
b7d1d8b4 PT |
3475 | gfc_array_spec *gfc_get_full_arrayspec_from_expr (gfc_expr *expr); |
3476 | ||
640670c7 PT |
3477 | bool gfc_traverse_expr (gfc_expr *, gfc_symbol *, |
3478 | bool (*)(gfc_expr *, gfc_symbol *, int*), | |
3479 | int); | |
66e4ab31 | 3480 | void gfc_expr_set_symbols_referenced (gfc_expr *); |
524af0d6 | 3481 | bool gfc_expr_check_typed (gfc_expr*, gfc_namespace*, bool); |
5bab4c96 PT |
3482 | bool gfc_derived_parameter_expr (gfc_expr *); |
3483 | gfc_param_spec_type gfc_spec_list_type (gfc_actual_arglist *, gfc_symbol *); | |
2a573572 MM |
3484 | gfc_component * gfc_get_proc_ptr_comp (gfc_expr *); |
3485 | bool gfc_is_proc_ptr_comp (gfc_expr *); | |
43a68a9d | 3486 | bool gfc_is_alloc_class_scalar_function (gfc_expr *); |
a6b22eea | 3487 | bool gfc_is_class_array_function (gfc_expr *); |
713485cc | 3488 | |
badd9e69 | 3489 | bool gfc_ref_this_image (gfc_ref *ref); |
d3a9eea2 | 3490 | bool gfc_is_coindexed (gfc_expr *); |
394d3a2e | 3491 | bool gfc_is_coarray (gfc_expr *); |
4dc694b2 | 3492 | int gfc_get_corank (gfc_expr *); |
d3a9eea2 TB |
3493 | bool gfc_has_ultimate_allocatable (gfc_expr *); |
3494 | bool gfc_has_ultimate_pointer (gfc_expr *); | |
f8862a1b | 3495 | gfc_expr* gfc_find_team_co (gfc_expr *); |
20d0bfce | 3496 | gfc_expr* gfc_find_stat_co (gfc_expr *); |
6838c137 TB |
3497 | gfc_expr* gfc_build_intrinsic_call (gfc_namespace *, gfc_isym_id, const char*, |
3498 | locus, unsigned, ...); | |
524af0d6 | 3499 | bool gfc_check_vardef_context (gfc_expr*, bool, bool, bool, const char*); |
69dcd06a | 3500 | |
d3a9eea2 | 3501 | |
6de9cd9a DN |
3502 | /* st.c */ |
3503 | extern gfc_code new_st; | |
3504 | ||
3505 | void gfc_clear_new_st (void); | |
11e5274a | 3506 | gfc_code *gfc_get_code (gfc_exec_op); |
6de9cd9a DN |
3507 | gfc_code *gfc_append_code (gfc_code *, gfc_code *); |
3508 | void gfc_free_statement (gfc_code *); | |
3509 | void gfc_free_statements (gfc_code *); | |
03af1e4c | 3510 | void gfc_free_association_list (gfc_association_list *); |
6de9cd9a DN |
3511 | |
3512 | /* resolve.c */ | |
de89b574 TB |
3513 | void gfc_expression_rank (gfc_expr *); |
3514 | bool gfc_resolve_ref (gfc_expr *); | |
524af0d6 | 3515 | bool gfc_resolve_expr (gfc_expr *); |
6de9cd9a | 3516 | void gfc_resolve (gfc_namespace *); |
b46ebd6c | 3517 | void gfc_resolve_code (gfc_code *, gfc_namespace *); |
6c7a4dfd | 3518 | void gfc_resolve_blocks (gfc_code *, gfc_namespace *); |
3ab216a4 | 3519 | void gfc_resolve_formal_arglist (gfc_symbol *); |
6de9cd9a DN |
3520 | int gfc_impure_variable (gfc_symbol *); |
3521 | int gfc_pure (gfc_symbol *); | |
f1f39033 | 3522 | int gfc_implicit_pure (gfc_symbol *); |
ccd7751b | 3523 | void gfc_unset_implicit_pure (gfc_symbol *); |
6de9cd9a | 3524 | int gfc_elemental (gfc_symbol *); |
524af0d6 JB |
3525 | bool gfc_resolve_iterator (gfc_iterator *, bool, bool); |
3526 | bool find_forall_index (gfc_expr *, gfc_symbol *, int); | |
3527 | bool gfc_resolve_index (gfc_expr *, int); | |
3528 | bool gfc_resolve_dim_arg (gfc_expr *); | |
7a28353e | 3529 | bool gfc_is_formal_arg (void); |
bdd1b1f5 | 3530 | bool gfc_resolve_substring (gfc_ref *, bool *); |
07368af0 | 3531 | void gfc_resolve_substring_charlen (gfc_expr *); |
a8b3b0b6 | 3532 | match gfc_iso_c_sub_interface(gfc_code *, gfc_symbol *); |
cf2b3c22 | 3533 | gfc_expr *gfc_expr_to_initialize (gfc_expr *); |
2dda89a8 | 3534 | bool gfc_type_is_extensible (gfc_symbol *); |
524af0d6 | 3535 | bool gfc_resolve_intrinsic (gfc_symbol *, locus *); |
96486998 | 3536 | bool gfc_explicit_interface_required (gfc_symbol *, char *, int); |
ce96d372 | 3537 | extern int gfc_do_concurrent_flag; |
bcc478b9 | 3538 | const char* gfc_lookup_function_fuzzy (const char *, gfc_symtree *); |
6457b1f0 JW |
3539 | int gfc_pure_function (gfc_expr *e, const char **name); |
3540 | int gfc_implicit_pure_function (gfc_expr *e); | |
a8b3b0b6 | 3541 | |
6de9cd9a DN |
3542 | |
3543 | /* array.c */ | |
b7e75771 JD |
3544 | gfc_iterator *gfc_copy_iterator (gfc_iterator *); |
3545 | ||
6de9cd9a DN |
3546 | void gfc_free_array_spec (gfc_array_spec *); |
3547 | gfc_array_ref *gfc_copy_array_ref (gfc_array_ref *); | |
3548 | ||
524af0d6 | 3549 | bool gfc_set_array_spec (gfc_symbol *, gfc_array_spec *, locus *); |
6de9cd9a | 3550 | gfc_array_spec *gfc_copy_array_spec (gfc_array_spec *); |
524af0d6 | 3551 | bool gfc_resolve_array_spec (gfc_array_spec *, int); |
6de9cd9a DN |
3552 | |
3553 | int gfc_compare_array_spec (gfc_array_spec *, gfc_array_spec *); | |
3554 | ||
6de9cd9a | 3555 | void gfc_simplify_iterator_var (gfc_expr *); |
524af0d6 | 3556 | bool gfc_expand_constructor (gfc_expr *, bool); |
6de9cd9a DN |
3557 | int gfc_constant_ac (gfc_expr *); |
3558 | int gfc_expanded_ac (gfc_expr *); | |
524af0d6 JB |
3559 | bool gfc_resolve_character_array_constructor (gfc_expr *); |
3560 | bool gfc_resolve_array_constructor (gfc_expr *); | |
3561 | bool gfc_check_constructor_type (gfc_expr *); | |
3562 | bool gfc_check_iter_variable (gfc_expr *); | |
3563 | bool gfc_check_constructor (gfc_expr *, bool (*)(gfc_expr *)); | |
3564 | bool gfc_array_size (gfc_expr *, mpz_t *); | |
3565 | bool gfc_array_dimen_size (gfc_expr *, int, mpz_t *); | |
3566 | bool gfc_array_ref_shape (gfc_array_ref *, mpz_t *); | |
eb401400 | 3567 | gfc_array_ref *gfc_find_array_ref (gfc_expr *, bool a = false); |
66e4ab31 | 3568 | tree gfc_conv_array_initializer (tree type, gfc_expr *); |
524af0d6 JB |
3569 | bool spec_size (gfc_array_spec *, mpz_t *); |
3570 | bool spec_dimen_size (gfc_array_spec *, int, mpz_t *); | |
7a28353e | 3571 | bool gfc_is_compile_time_shape (gfc_array_spec *); |
6de9cd9a | 3572 | |
524af0d6 | 3573 | bool gfc_ref_dimen_size (gfc_array_ref *, int dimen, mpz_t *, mpz_t *); |
543af7ab | 3574 | |
6de9cd9a DN |
3575 | /* interface.c -- FIXME: some of these should be in symbol.c */ |
3576 | void gfc_free_interface (gfc_interface *); | |
f3e1097b JW |
3577 | bool gfc_compare_derived_types (gfc_symbol *, gfc_symbol *); |
3578 | bool gfc_compare_types (gfc_typespec *, gfc_typespec *); | |
4668d6f9 PT |
3579 | bool gfc_check_dummy_characteristics (gfc_symbol *, gfc_symbol *, |
3580 | bool, char *, int); | |
3581 | bool gfc_check_result_characteristics (gfc_symbol *, gfc_symbol *, | |
3582 | char *, int); | |
f3e1097b | 3583 | bool gfc_compare_interfaces (gfc_symbol*, gfc_symbol*, const char *, int, int, |
2298af08 TK |
3584 | char *, int, const char *, const char *, |
3585 | bool *bad_result_characteristics = NULL); | |
6de9cd9a | 3586 | void gfc_check_interfaces (gfc_namespace *); |
524af0d6 | 3587 | bool gfc_procedure_use (gfc_symbol *, gfc_actual_arglist **, locus *); |
7e196f89 | 3588 | void gfc_ppc_use (gfc_component *, gfc_actual_arglist **, locus *); |
6de9cd9a DN |
3589 | gfc_symbol *gfc_search_interface (gfc_interface *, int, |
3590 | gfc_actual_arglist **); | |
eaee02a5 | 3591 | match gfc_extend_expr (gfc_expr *); |
6de9cd9a | 3592 | void gfc_free_formal_arglist (gfc_formal_arglist *); |
524af0d6 JB |
3593 | bool gfc_extend_assign (gfc_code *, gfc_namespace *); |
3594 | bool gfc_check_new_interface (gfc_interface *, gfc_symbol *, locus); | |
3595 | bool gfc_add_interface (gfc_symbol *); | |
2b77e908 FXC |
3596 | gfc_interface *gfc_current_interface_head (void); |
3597 | void gfc_set_current_interface_head (gfc_interface *); | |
f6fad28e | 3598 | gfc_symtree* gfc_find_sym_in_symtree (gfc_symbol*); |
f0ac18b7 | 3599 | bool gfc_arglist_matches_symbol (gfc_actual_arglist**, gfc_symbol*); |
94747289 | 3600 | bool gfc_check_operator_interface (gfc_symbol*, gfc_intrinsic_op, locus); |
f3e1097b | 3601 | bool gfc_has_vector_subscript (gfc_expr*); |
fb03a37e | 3602 | gfc_intrinsic_op gfc_equivalent_op (gfc_intrinsic_op); |
524af0d6 | 3603 | bool gfc_check_typebound_override (gfc_symtree*, gfc_symtree*); |
e73d3ca6 | 3604 | void gfc_check_dtio_interfaces (gfc_symbol*); |
e4e659b9 | 3605 | gfc_symtree* gfc_find_typebound_dtio_proc (gfc_symbol *, bool, bool); |
e73d3ca6 | 3606 | gfc_symbol* gfc_find_specific_dtio_proc (gfc_symbol*, bool, bool); |
e68a35ae TK |
3607 | void gfc_get_formal_from_actual_arglist (gfc_symbol *, gfc_actual_arglist *); |
3608 | bool gfc_compare_actual_formal (gfc_actual_arglist **, gfc_formal_arglist *, | |
3609 | int, int, bool, locus *); | |
e73d3ca6 | 3610 | |
6de9cd9a DN |
3611 | |
3612 | /* io.c */ | |
3613 | extern gfc_st_label format_asterisk; | |
3614 | ||
3615 | void gfc_free_open (gfc_open *); | |
44facdb7 | 3616 | bool gfc_resolve_open (gfc_open *, locus *); |
6de9cd9a | 3617 | void gfc_free_close (gfc_close *); |
44facdb7 | 3618 | bool gfc_resolve_close (gfc_close *, locus *); |
6de9cd9a | 3619 | void gfc_free_filepos (gfc_filepos *); |
3d07fb21 | 3620 | bool gfc_resolve_filepos (gfc_filepos *, locus *); |
6de9cd9a | 3621 | void gfc_free_inquire (gfc_inquire *); |
524af0d6 | 3622 | bool gfc_resolve_inquire (gfc_inquire *); |
6de9cd9a | 3623 | void gfc_free_dt (gfc_dt *); |
44facdb7 | 3624 | bool gfc_resolve_dt (gfc_code *, gfc_dt *, locus *); |
6f0f0b2e | 3625 | void gfc_free_wait (gfc_wait *); |
524af0d6 | 3626 | bool gfc_resolve_wait (gfc_wait *); |
6de9cd9a DN |
3627 | |
3628 | /* module.c */ | |
3629 | void gfc_module_init_2 (void); | |
3630 | void gfc_module_done_2 (void); | |
3631 | void gfc_dump_module (const char *, int); | |
6e2062b0 | 3632 | bool gfc_check_symbol_access (gfc_symbol *); |
a64f5186 | 3633 | void gfc_free_use_stmts (gfc_use_list *); |
f6288c24 FR |
3634 | const char *gfc_dt_lower_string (const char *); |
3635 | const char *gfc_dt_upper_string (const char *); | |
6de9cd9a DN |
3636 | |
3637 | /* primary.c */ | |
3638 | symbol_attribute gfc_variable_attr (gfc_expr *, gfc_typespec *); | |
3639 | symbol_attribute gfc_expr_attr (gfc_expr *); | |
ba85c8c3 | 3640 | symbol_attribute gfc_caf_attr (gfc_expr *, bool i = false, bool *r = NULL); |
eb77cddf | 3641 | match gfc_match_rvalue (gfc_expr **); |
713485cc | 3642 | match gfc_match_varspec (gfc_expr*, int, bool, bool); |
8fc541d3 | 3643 | int gfc_check_digit (char, int); |
2d71b918 | 3644 | bool gfc_is_function_return_value (gfc_symbol *, gfc_namespace *); |
524af0d6 | 3645 | bool gfc_convert_to_structure_constructor (gfc_expr *, gfc_symbol *, |
c3f34952 TB |
3646 | gfc_expr **, |
3647 | gfc_actual_arglist **, bool); | |
6de9cd9a DN |
3648 | |
3649 | /* trans.c */ | |
3650 | void gfc_generate_code (gfc_namespace *); | |
3651 | void gfc_generate_module_code (gfc_namespace *); | |
3652 | ||
9645e798 MM |
3653 | /* trans-intrinsic.c */ |
3654 | bool gfc_inline_intrinsic_function_p (gfc_expr *); | |
3655 | ||
6de9cd9a DN |
3656 | /* bbt.c */ |
3657 | typedef int (*compare_fn) (void *, void *); | |
3658 | void gfc_insert_bbt (void *, void *, compare_fn); | |
3659 | void gfc_delete_bbt (void *, void *, compare_fn); | |
3660 | ||
3661 | /* dump-parse-tree.c */ | |
6c1abb5c | 3662 | void gfc_dump_parse_tree (gfc_namespace *, FILE *); |
e655a6cc | 3663 | void gfc_dump_c_prototypes (gfc_namespace *, FILE *); |
6328ce1f | 3664 | void gfc_dump_external_c_prototypes (FILE *); |
5c6aa9a8 | 3665 | void gfc_dump_global_symbols (FILE *); |
fb078366 TK |
3666 | void debug (gfc_symbol *); |
3667 | void debug (gfc_expr *); | |
6de9cd9a DN |
3668 | |
3669 | /* parse.c */ | |
524af0d6 | 3670 | bool gfc_parse_file (void); |
ca39e6f2 | 3671 | void gfc_global_used (gfc_gsymbol *, locus *); |
3e78238a | 3672 | gfc_namespace* gfc_build_block_ns (gfc_namespace *); |
6de9cd9a | 3673 | |
2990f854 | 3674 | /* dependency.c */ |
2757d5ec | 3675 | int gfc_dep_compare_functions (gfc_expr *, gfc_expr *, bool); |
2990f854 | 3676 | int gfc_dep_compare_expr (gfc_expr *, gfc_expr *); |
eab19a1a | 3677 | bool gfc_dep_difference (gfc_expr *, gfc_expr *, mpz_t *); |
2990f854 | 3678 | |
fb5bc08b | 3679 | /* check.c */ |
524af0d6 JB |
3680 | bool gfc_check_same_strlen (const gfc_expr*, const gfc_expr*, const char*); |
3681 | bool gfc_calculate_transfer_sizes (gfc_expr*, gfc_expr*, gfc_expr*, | |
86dbed7d | 3682 | size_t*, size_t*, size_t*); |
8dc63166 SK |
3683 | bool gfc_boz2int (gfc_expr *, int); |
3684 | bool gfc_boz2real (gfc_expr *, int); | |
3685 | bool gfc_invalid_boz (const char *, locus *); | |
7fd614ee | 3686 | bool gfc_invalid_null_arg (gfc_expr *); |
8dc63166 | 3687 | |
fb5bc08b | 3688 | |
d15bac21 | 3689 | /* class.c */ |
37da591f | 3690 | void gfc_fix_class_refs (gfc_expr *e); |
d15bac21 | 3691 | void gfc_add_component_ref (gfc_expr *, const char *); |
c49ea23d | 3692 | void gfc_add_class_array_ref (gfc_expr *); |
b04533af JW |
3693 | #define gfc_add_data_component(e) gfc_add_component_ref(e,"_data") |
3694 | #define gfc_add_vptr_component(e) gfc_add_component_ref(e,"_vptr") | |
34d9d749 | 3695 | #define gfc_add_len_component(e) gfc_add_component_ref(e,"_len") |
b04533af JW |
3696 | #define gfc_add_hash_component(e) gfc_add_component_ref(e,"_hash") |
3697 | #define gfc_add_size_component(e) gfc_add_component_ref(e,"_size") | |
3698 | #define gfc_add_def_init_component(e) gfc_add_component_ref(e,"_def_init") | |
86035eec | 3699 | #define gfc_add_final_component(e) gfc_add_component_ref(e,"_final") |
c49ea23d PT |
3700 | bool gfc_is_class_array_ref (gfc_expr *, bool *); |
3701 | bool gfc_is_class_scalar_expr (gfc_expr *); | |
5bf5fa56 | 3702 | bool gfc_is_class_container_ref (gfc_expr *e); |
2cc6320d | 3703 | gfc_expr *gfc_class_initializer (gfc_typespec *, gfc_expr *); |
4fa02692 | 3704 | unsigned int gfc_hash_value (gfc_symbol *); |
9e6644c6 | 3705 | gfc_expr *gfc_get_len_component (gfc_expr *e, int); |
524af0d6 | 3706 | bool gfc_build_class_symbol (gfc_typespec *, symbol_attribute *, |
9b6da3c7 | 3707 | gfc_array_spec **); |
88ce8031 | 3708 | gfc_symbol *gfc_find_derived_vtab (gfc_symbol *); |
7289d1c9 | 3709 | gfc_symbol *gfc_find_vtab (gfc_typespec *); |
524af0d6 | 3710 | gfc_symtree* gfc_find_typebound_proc (gfc_symbol*, bool*, |
d15bac21 | 3711 | const char*, bool, locus*); |
524af0d6 | 3712 | gfc_symtree* gfc_find_typebound_user_op (gfc_symbol*, bool*, |
d15bac21 | 3713 | const char*, bool, locus*); |
524af0d6 | 3714 | gfc_typebound_proc* gfc_find_typebound_intrinsic_op (gfc_symbol*, bool*, |
d15bac21 JW |
3715 | gfc_intrinsic_op, bool, |
3716 | locus*); | |
3717 | gfc_symtree* gfc_get_tbp_symtree (gfc_symtree**, const char*); | |
86035eec | 3718 | bool gfc_is_finalizable (gfc_symbol *, gfc_expr **); |
d15bac21 | 3719 | |
7a08eda1 | 3720 | #define CLASS_DATA(sym) sym->ts.u.derived->components |
8b704316 PT |
3721 | #define UNLIMITED_POLY(sym) \ |
3722 | (sym != NULL && sym->ts.type == BT_CLASS \ | |
3723 | && CLASS_DATA (sym) \ | |
3724 | && CLASS_DATA (sym)->ts.u.derived \ | |
3725 | && CLASS_DATA (sym)->ts.u.derived->attr.unlimited_polymorphic) | |
f3b0bb7a AV |
3726 | #define IS_CLASS_ARRAY(sym) \ |
3727 | (sym->ts.type == BT_CLASS \ | |
3728 | && CLASS_DATA (sym) \ | |
3729 | && CLASS_DATA (sym)->attr.dimension \ | |
3730 | && !CLASS_DATA (sym)->attr.class_pointer) | |
7a08eda1 | 3731 | |
601d98be TK |
3732 | /* frontend-passes.c */ |
3733 | ||
3734 | void gfc_run_passes (gfc_namespace *); | |
3735 | ||
4d42b5cd JJ |
3736 | typedef int (*walk_code_fn_t) (gfc_code **, int *, void *); |
3737 | typedef int (*walk_expr_fn_t) (gfc_expr **, int *, void *); | |
3738 | ||
5f23671d | 3739 | int gfc_dummy_code_callback (gfc_code **, int *, void *); |
4d42b5cd JJ |
3740 | int gfc_expr_walker (gfc_expr **, walk_expr_fn_t, void *); |
3741 | int gfc_code_walker (gfc_code **, walk_code_fn_t, walk_expr_fn_t, void *); | |
1585b483 | 3742 | bool gfc_has_dimen_vector_ref (gfc_expr *e); |
fb078366 | 3743 | void gfc_check_externals (gfc_namespace *); |
3055d879 | 3744 | bool gfc_fix_implicit_pure (gfc_namespace *); |
4d42b5cd | 3745 | |
d01b2c21 TK |
3746 | /* simplify.c */ |
3747 | ||
3748 | void gfc_convert_mpz_to_signed (mpz_t, int); | |
0e360db9 | 3749 | gfc_expr *gfc_simplify_ieee_functions (gfc_expr *); |
5867bb9a | 3750 | bool gfc_is_size_zero_array (gfc_expr *); |
d01b2c21 | 3751 | |
f1abbf69 TK |
3752 | /* trans-array.c */ |
3753 | ||
3754 | bool gfc_is_reallocatable_lhs (gfc_expr *); | |
3755 | ||
dc7a8b4b JN |
3756 | /* trans-decl.c */ |
3757 | ||
3758 | void finish_oacc_declare (gfc_namespace *, gfc_symbol *, bool); | |
facf0354 | 3759 | void gfc_adjust_builtins (void); |
dc7a8b4b | 3760 | |
53814b8f | 3761 | #endif /* GCC_GFORTRAN_H */ |