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