1 /*
2  * Copyright (c) 1997-2019, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef UPPER_H_
19 #define UPPER_H_
20 
21 /** \file
22  * \brief Header file for upper - import the lowered F90/HPF code
23  */
24 /*
25  * Compatibility History:
26  * before 6.2  -- 1.9
27  * 6.2         -- 1.10
28  *                Includes all of 1.9 + PASSBYVAL & PASSBYREF
29  * 7.0         -- 1.11
30  *                Includes all of 1.10 + CFUNC for variables
31  * 7.1         -- 1.12
32  *                Includes all of 1.11 + DECORATE
33  * 7.2         -- 1.13
34  *                Includes all of 1.12 + CREF & NOMIXEDSTRLEN
35  * 8.0         -- 1.14
36  *                Includes all of 1.13 + FILE INDEX ENTRIES
37  * 8.1         -- 1.15
38  *                Includes all of 1.14 + new types + cuda flags
39  * 9.0-3       -- 1.16
40  *                Includes all of 1.15 + cudaemu value
41  * 10.6        -- 1.17
42  *                Includes all of 1.16 + sptr for Constant ID data init + denorm
43  * 10.9        -- 1.18
44  *                Includes all of 1.17 + reflected/mirrored/devcopy flags and
45  * devcopy field
46  * 11.0        -- 1.19
47  *                Includes all of 1.18 + mscall & cref for vars & members
48  * 11.4        -- 1.20
49  *                Includes all of 1.19 + libm & libc for functions
50  * 12.7        -- 1.21
51  *                Includes all of 1.20 + TASK for variables
52  * 12.7        -- 1.22
53  *                Includes all of 1.21 + cuda texture flag
54  * 12.7        -- 1.23
55  *                Includes all of 1.21 + INTENTIN flag
56  * 13.0        -- 1.24
57  *                Includes all of 1.23 + DATACNST flag
58  * 13.5        -- 1.25
59  *                Includes all of 1.24 + MODCMN flag
60  * 13.8        -- 1.26
61  *                Includes all of 1.25 + DOBEGNZ & DOENDNZ
62  * 13.9        -- 1.27
63  *                Includes all of 1.26 + symbol ACCCREATE and ACCRESIDENT
64  * 14.0        -- 1.28
65  *                Includes all of 1.27 + ACCROUT
66  * 14.4        -- 1.29
67  *                Includes all of 1.28 + CUDAMODULE
68  * 14.4        -- 1.30
69  *                Includes all of 1.29 + MANAGED + additionsl ILM operand
70  *                    for the call ILMs via a procedure ptr, e.g., CALLA,
71  *                    CDFUNCA, etc.
72  * 14.7        -- 1.31
73  *                All of 1.30 + ACCCREATE + ACCRESIDENT for common blocks,
74  *                    +ACCLINK +ACCCOPYIN symbol flags
75  * 15.0        -- 1.32
76  *                All of 1.31 + new FARGF ILM
77  * 15.3        -- 1.33
78  *                All of 1.32 + FWDREF flag + INTERNREF flag + AGOTO field
79  * 15.4        -- 1.34
80  *                All of 1.33 + ST_MEMBER IFACE field
81  * 15.7        -- 1.35
82  *                All of 1.34 + ST_ENTRY/ST_PROC ARET field
83  * 15.9        -- 1.36
84  *                All of 1.35 + PARREF, PARSYMS, & PARSYMSCT
85  * 15.10       -- 1.37
86  *                All of 1.36 + IM_BMPSCOPE/IM_EMPSCOPE
87  * 16.1        -- 1.38
88  *                All of 1.37 + IM_MPLOOP/IM_MPSCHED and
89  *                    IM_MPBORDERED/IM_MPEORDERED + TPALLOC + IM_FLUSH flag
90  * 16.4        -- 1.39
91  *                All of 1.38 + IM_ETASK and IM_TASKFIRSPRIV
92  * 16.5        -- 1.40
93  *                All of 1.39 + ISOTYPE flag + update MP_SCHED and MPLOOP ilm
94  * 16.6        -- 1.41
95  *                All of 1.40 + IM_LSECTION
96  * 16.6        -- 1.42
97  *                All of 1.41 + VARARG
98  * 16.8        -- 1.43
99  *                All of 1.42 + ALLOCATTR + F90POINTER
100  * 16.10       -- 1.44
101  *                All of 1.43 +
102  * IM_TASKGROUP/ETASKGROUP/TARGET/TARGETDATA/TARGETUPDATE/
103  *                TARGETEXITDATA/TARGETENTERDATA/DISTRIBUTE/TEAMS and their
104  * combinations
105  *                constructs including TARGET/TEAMS/DISTRIBUTE/PARALLEL
106  * DO/CANCEL/
107  *                CANCELLATIONPOINT.
108  * 17.0        -- 1.45
109  *                All of 1.44 + INVOBJINC + PARREF for ST_PROC
110  * 17.2        -- 1.46
111  *                All of 1.45 + etls + tls, irrspective of target
112  * 17.7        -- 1.47
113  *                All of 1.46 + BPARA + PROC_BIND + MP_ATOMIC..
114  * 17.10        -- 1.48
115  *                All of 1.47 + ETASKFIRSTPRIV, MP_[E]TASKLOOP,
116  *                MP_[E]TASKLOOPREG
117  * 18.1         -- 1.49
118  *                All of 1.48 , MP_TASKLOOPVARS, [B/E]TASKDUP
119  *
120  * 18.4
121  *              --1.50
122  *                All of 1.49 +
123  *                Internal procedures passed as arguments and pointer targets
124  * 18.7         -- 1.51
125  *                All of 1.50 +
126  *                remove parsyms field and add parent for ST_BLOCK,
127  *                receive "no_opts" (no optional arguments) flag for ST_ENTRY
128  *                and ST_PROC symbols.
129  * 18.10        -- 1.52
130  *                All of 1.51 +
131  *                add IS_INTERFACE flag for ST_PROC, and for ST_MODULE when
132  *                emitting as ST_PROC
133  * 19.3         -- 1.53
134  *                All of 1.52 +
135  *                Add has_alias bit, and length and name of the alias for Fortran
136  *                module variable when it is on the ONLY list of a USE statement.
137  *                This is for Fortran LLVM compiler only.
138  */
139 
140 #include "gbldefs.h"
141 #include "semant.h"
142 
143 #define VersionMajor 1
144 #define VersionMinor 53
145 
146 /**
147    \brief ...
148  */
149 char *getexnamestring(char *string, int sptr, int stype, int scg,
150                       int extraunderscore);
151 
152 /**
153    \brief ...
154  */
155 int F90_nme_conflict(int nme1, int nme2);
156 
157 /**
158    \brief Detect Fortran 90 structure member name conflicts.
159  * Return 0 if they point to different addresses;
160  * Return 1 otherwise.
161  */
162 int F90_struct_mbr_nme_conflict(int nme1, int nme2);
163 
164 /**
165    \brief ...
166  */
167 int getswel(int sz);
168 
169 /**
170    \brief ...
171  */
172 int IPA_allcall_safe(int sptr);
173 
174 /**
175    \brief ...
176  */
177 int IPA_call_safe(int funcsptr, int sptr);
178 
179 /**
180    \brief ...
181  */
182 int IPA_func_almostpure(int sptr);
183 
184 /**
185    \brief ...
186  */
187 int IPA_func_pure(int sptr);
188 
189 /**
190    \brief ...
191  */
192 int IPA_nme_conflict(int nme1, int nme2);
193 
194 /**
195    \brief ...
196  */
197 int IPA_noaddr(int sptr);
198 
199 /**
200    \brief ...
201  */
202 int IPA_NoFree(void);
203 
204 /**
205    \brief ...
206  */
207 int IPA_pointer_safe(int nme);
208 
209 /**
210    \brief ...
211  */
212 int IPA_range(int sptr, int *plo, int *phi);
213 
214 /**
215    \brief ...
216  */
217 int IPA_safe(int sptr);
218 
219 /**
220    \brief ...
221  */
222 SPTR llvm_get_uplevel_newsptr(int oldsptr);
223 
224 /**
225    \brief ...
226  */
227 long IPA_pstride(int sptr);
228 
229 /**
230    \brief ...
231  */
232 long IPA_sstride(int sptr);
233 
234 /**
235    \brief ...
236  */
237 void cuda_emu_end(void);
238 
239 /**
240    \brief ...
241  */
242 void cuda_emu_start(void);
243 
244 /**
245    \brief ...
246  */
247 void dmp_const(CONST *acl, int indent);
248 
249 /**
250    \brief ...
251  */
252 void stb_upper_init(void);
253 
254 /**
255    \brief ...
256  */
257 void upper_assign_addresses(void);
258 
259 /**
260    \brief ...
261  */
262 void upper_init(void);
263 
264 /**
265    \brief ...
266  */
267 void upper(int stb_processing);
268 
269 /**
270    \brief ...
271  */
272 void upper_save_syminfo(void);
273 
274 /**
275    \brief Search for Module variable alias name saved by upper()
276    \param sptr   The sptr of a Module variable
277  */
278 const char *lookup_modvar_alias(SPTR sptr);
279 
280 #endif // UPPER_H_
281