1 /*
2 * Copyright (c) 2017-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 FORTRAN_SYMFUN_H_
19 #define FORTRAN_SYMFUN_H_
20
21 #include "gbldefs.h"
22 #include "symtab.h"
23 #ifdef FE90
24 #undef HAVE_ILI
25 #else
26 #include "ili.h"
27 #define HAVE_ILI
28 #endif
29
30 #ifdef __cplusplus
31 /* clang-format off */
32 #ifdef CHECK_PORT
Precond(bool P)33 inline void Precond(bool P) {
34 assert(P, "precondition failed", 0, ERR_Fatal);
35 }
36 #else // !CHECK_PORT
37 #define Precond(P)
38 #endif // CHECK_PORT
39
40 // ===========
41 // DTY getters
42
43 /// Check if \p dtype is in legal range
DTyValidRange(DTYPE dtype)44 inline bool DTyValidRange(DTYPE dtype) {
45 return (dtype != DT_NONE) &&
46 (static_cast<unsigned>(dtype) < stb.dt.stg_avail);
47 }
48
49 /// Warning: do not use. Use DTY() instead.
unsafeDTY(int index)50 inline ISZ_T unsafeDTY(int index) {
51 return stb.dt.stg_base[index];
52 }
53
54 #undef DTY
DTY(DTYPE dtype)55 inline TY_KIND DTY(DTYPE dtype) {
56 Precond(DTyValidRange(dtype));
57 return static_cast<TY_KIND>(unsafeDTY(static_cast<int>(dtype)));
58 }
59
DTyCharLength(DTYPE dtype)60 inline ISZ_T DTyCharLength(DTYPE dtype) {
61 Precond(DTyValidRange(dtype));
62 Precond(DTY(dtype) == TY_CHAR || DTY(dtype) == TY_NCHAR);
63 return unsafeDTY(static_cast<int>(dtype) + 1);
64 }
65
66 /// A valid sequence type is one of vector of T, pointer to T, or array of T
DTySeqTyValid(DTYPE dtype)67 inline bool DTySeqTyValid(DTYPE dtype) {
68 #ifdef TY_VECT
69 if (DTY(dtype) == TY_VECT)
70 return true;
71 #endif
72 return (DTY(dtype) == TY_PTR) || (DTY(dtype) == TY_ARRAY);
73 }
74
75 /// Get element type of a sequence type from the DTYPE table
DTySeqTyElement(DTYPE dtype)76 inline DTYPE DTySeqTyElement(DTYPE dtype) {
77 Precond(DTyValidRange(dtype));
78 Precond(DTySeqTyValid(dtype));
79 return static_cast<DTYPE>(unsafeDTY(static_cast<int>(dtype) + 1));
80 }
81
DTyArrayDesc(DTYPE dtype)82 inline ISZ_T DTyArrayDesc(DTYPE dtype) {
83 Precond(DTyValidRange(dtype));
84 Precond(DTY(dtype) == TY_ARRAY);
85 return unsafeDTY(static_cast<int>(dtype) + 2);
86 }
87
DTySetArrayDesc(DTYPE dtype,ISZ_T desc)88 inline void DTySetArrayDesc(DTYPE dtype, ISZ_T desc) {
89 Precond(DTyValidRange(dtype));
90 Precond(DTY(dtype) == TY_ARRAY);
91 stb.dt.stg_base[static_cast<int>(dtype) + 2] = desc;
92 }
93
unsafeDTyEnumTag(DTYPE dtype)94 inline SPTR unsafeDTyEnumTag(DTYPE dtype) {
95 Precond(DTyValidRange(dtype));
96 return static_cast<SPTR>(unsafeDTY(static_cast<int>(dtype) + 2));
97 }
98
99 /* Return the name of enum type */
DTyEnumTyTag(DTYPE dtype)100 inline SPTR DTyEnumTyTag(DTYPE dtype) {
101 Precond(DTY(dtype) == TY_ENUM);
102 return unsafeDTyEnumTag(dtype);
103 }
104
105 /* Get the SPTR of a member of an algebraic type from the DTYPE table */
DTyAlgTyMember(DTYPE dtype)106 inline SPTR DTyAlgTyMember(DTYPE dtype) {
107 Precond(DTyValidRange(dtype));
108 Precond(DTY(dtype) == TY_STRUCT || DTY(dtype) == TY_UNION);
109 return static_cast<SPTR>(unsafeDTY(static_cast<int>(dtype) + 1));
110 }
111
DTyAlgTySize(DTYPE dtype)112 inline ISZ_T DTyAlgTySize(DTYPE dtype) {
113 Precond(DTyValidRange(dtype));
114 Precond(DTY(dtype) == TY_STRUCT || DTY(dtype) == TY_UNION);
115 return unsafeDTY(static_cast<int>(dtype) + 2);
116 }
117
unsafeDTyAlgTyTag(DTYPE dtype)118 inline SPTR unsafeDTyAlgTyTag(DTYPE dtype) {
119 Precond(DTyValidRange(dtype));
120 return static_cast<SPTR>(unsafeDTY(static_cast<int>(dtype) + 3));
121 }
122
123 /* Return a SPTR which is the name of struct/union type */
DTyAlgTyTag(DTYPE dtype)124 inline SPTR DTyAlgTyTag(DTYPE dtype) {
125 Precond(DTY(dtype) == TY_STRUCT || DTY(dtype) == TY_UNION);
126 return unsafeDTyAlgTyTag(dtype);
127 }
128
DTyAlgTyTagNeg(DTYPE dtype)129 inline SPTR DTyAlgTyTagNeg(DTYPE dtype) {
130 Precond(DTY(dtype) == -TY_STRUCT || DTY(dtype) == -TY_UNION);
131 return unsafeDTyAlgTyTag(dtype);
132 }
133
DTyAlgTyAlign(DTYPE dtype)134 inline ISZ_T DTyAlgTyAlign(DTYPE dtype) {
135 Precond(DTyValidRange(dtype));
136 Precond(DTY(dtype) == TY_STRUCT || DTY(dtype) == TY_UNION);
137 return unsafeDTY(static_cast<int>(dtype) + 4);
138 }
139
DTyAlgTyInitCon(DTYPE dtype)140 inline int DTyAlgTyInitCon(DTYPE dtype) {
141 Precond(DTyValidRange(dtype));
142 Precond(DTY(dtype) == TY_STRUCT || DTY(dtype) == TY_UNION);
143 return static_cast<int>(unsafeDTY(static_cast<int>(dtype) + 5));
144 }
145
146 /// Get the return type of a procedure/function
DTyReturnType(DTYPE dtype)147 inline DTYPE DTyReturnType(DTYPE dtype) {
148 Precond(DTyValidRange(dtype));
149 Precond(DTY(dtype) == TY_PROC || DTY(dtype) == TY_PFUNC);
150 return static_cast<DTYPE>(unsafeDTY(static_cast<int>(dtype) + 1));
151 }
152
DTyInterface(DTYPE dtype)153 inline SPTR DTyInterface(DTYPE dtype) {
154 Precond(DTyValidRange(dtype));
155 Precond(DTY(dtype) == TY_PROC);
156 return static_cast<SPTR>(unsafeDTY(static_cast<int>(dtype) + 2));
157 }
158
DTyParamCount(DTYPE dtype)159 inline int DTyParamCount(DTYPE dtype) {
160 Precond(DTyValidRange(dtype));
161 Precond(DTY(dtype) == TY_PROC);
162 return static_cast<int>(unsafeDTY(static_cast<int>(dtype) + 3));
163 }
164
DTyParamDesc(DTYPE dtype)165 inline int DTyParamDesc(DTYPE dtype) {
166 Precond(DTyValidRange(dtype));
167 Precond(DTY(dtype) == TY_PROC);
168 return static_cast<int>(unsafeDTY(static_cast<int>(dtype) + 4));
169 }
170
DTyFuncVal(DTYPE dtype)171 inline SPTR DTyFuncVal(DTYPE dtype) {
172 Precond(DTyValidRange(dtype));
173 Precond(DTY(dtype) == TY_PROC);
174 return static_cast<SPTR>(unsafeDTY(static_cast<int>(dtype) + 5));
175 }
176
DTyParamList(DTYPE dtype)177 inline DTYPE DTyParamList(DTYPE dtype) {
178 Precond(DTyValidRange(dtype));
179 Precond(DTY(dtype) == TY_PFUNC);
180 return static_cast<DTYPE>(unsafeDTY(static_cast<int>(dtype) + 2));
181 }
182
DTyArgType(DTYPE dtype)183 inline DTYPE DTyArgType(DTYPE dtype) {
184 Precond(DTyValidRange(dtype));
185 Precond(DTY(dtype) == TY_PARAM);
186 return static_cast<DTYPE>(unsafeDTY(static_cast<int>(dtype) + 1));
187 }
188
DTyArgSym(DTYPE dtype)189 inline SPTR DTyArgSym(DTYPE dtype) {
190 Precond(DTyValidRange(dtype));
191 Precond(DTY(dtype) == TY_PARAM);
192 return static_cast<SPTR>(unsafeDTY(static_cast<int>(dtype) + 2));
193 }
194
DTyArgNext(DTYPE dtype)195 inline DTYPE DTyArgNext(DTYPE dtype) {
196 Precond(DTyValidRange(dtype));
197 Precond(DTY(dtype) == TY_PARAM);
198 return static_cast<DTYPE>(unsafeDTY(static_cast<int>(dtype) + 3));
199 }
200
201 #ifdef TY_VECT
DTyVecLength(DTYPE dtype)202 inline ISZ_T DTyVecLength(DTYPE dtype) {
203 Precond(DTyValidRange(dtype));
204 Precond(DTY(dtype) == TY_VECT);
205 return unsafeDTY(static_cast<int>(dtype) + 2);
206 }
207
DTySetVecLength(DTYPE dtype,ISZ_T length)208 inline void DTySetVecLength(DTYPE dtype, ISZ_T length) {
209 Precond(DTyValidRange(dtype));
210 Precond(DTY(dtype) == TY_VECT);
211 stb.dt.stg_base[static_cast<int>(dtype) + 2] = length;
212 }
213 #endif
214
215 #undef DDTG
DDTG(DTYPE dtype)216 inline DTYPE DDTG(DTYPE dtype) {
217 Precond(DTyValidRange(dtype));
218 return (DTY(dtype) == TY_ARRAY) ? DTySeqTyElement(dtype) : dtype;
219 }
220
221 #undef DTYG
DTYG(DTYPE dtype)222 inline TY_KIND DTYG(DTYPE dtype) {
223 Precond(DTyValidRange(dtype));
224 return DTY((DTY(dtype) == TY_ARRAY) ? DTySeqTyElement(dtype) : dtype);
225 }
226
227 #undef AD_DPTR
AD_DPTR(DTYPE dtype)228 inline ADSC *AD_DPTR(DTYPE dtype) {
229 return reinterpret_cast<ADSC*>(&aux.arrdsc_base[DTyArrayDesc(dtype)]);
230 }
231
SptrValidRange(SPTR sptr)232 inline bool SptrValidRange(SPTR sptr) {
233 return (sptr > NOSYM) && (sptr < static_cast<SPTR>(stb.stg_avail));
234 }
235
236 #undef AD_PTR
AD_PTR(SPTR sptr)237 inline ADSC *AD_PTR(SPTR sptr) {
238 Precond(SptrValidRange(sptr));
239 return AD_DPTR(DTYPEG(sptr));
240 }
241
242 /// \brief Unchecked setting of element at dtype+0 in the dtype table
DTySet(DTYPE dtype,ISZ_T val)243 inline void DTySet(DTYPE dtype, ISZ_T val) {
244 stb.dt.stg_base[static_cast<int>(dtype)] = val;
245 }
246
247 /// \brief Unchecked setting of element at dtype+1 in the dtype table
DTySetFst(DTYPE dtype,ISZ_T val)248 inline void DTySetFst(DTYPE dtype, ISZ_T val) {
249 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 1), val);
250 }
251
DTySetAlgTySize(DTYPE dtype,ISZ_T val)252 inline void DTySetAlgTySize(DTYPE dtype, ISZ_T val) {
253 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 2), val);
254 }
255
DTySetAlgTyTag(DTYPE dtype,SPTR tag)256 inline void DTySetAlgTyTag(DTYPE dtype, SPTR tag) {
257 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 3), tag);
258 }
259
DTySetAlgTyAlign(DTYPE dtype,ISZ_T val)260 inline void DTySetAlgTyAlign(DTYPE dtype, ISZ_T val) {
261 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 4), val);
262 }
263
DTySetAlgTyICT(DTYPE dtype,ISZ_T val)264 inline void DTySetAlgTyICT(DTYPE dtype, ISZ_T val) {
265 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 5), val);
266 }
267
268 /// \brief Warning: do not use! Use DTySetAlgTy() instead.
unsafeSetAlgTy(DTYPE dtype,SPTR member,ISZ_T size,SPTR tag,ISZ_T align)269 inline void unsafeSetAlgTy(DTYPE dtype, SPTR member, ISZ_T size, SPTR tag,
270 ISZ_T align) {
271 DTySetFst(dtype, member);
272 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 2), size);
273 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 3), tag);
274 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 4), align);
275 }
276
277 /// \brief Initialize an algebraic type
DTySetAlgTy(DTYPE dtype,SPTR member,ISZ_T size,SPTR tag,ISZ_T align,ISZ_T ict)278 inline void DTySetAlgTy(DTYPE dtype, SPTR member, ISZ_T size, SPTR tag,
279 ISZ_T align, ISZ_T ict) {
280 Precond(DTY(dtype) == TY_STRUCT || DTY(dtype) == TY_UNION);
281 unsafeSetAlgTy(dtype, member, size, tag, align);
282 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 5), ict);
283 }
284
DTySetProcTy(DTYPE dtype,DTYPE subty,SPTR iface,ISZ_T numParams,ISZ_T dpdsc,SPTR fval)285 inline void DTySetProcTy(DTYPE dtype, DTYPE subty, SPTR iface, ISZ_T numParams,
286 ISZ_T dpdsc, SPTR fval) {
287 Precond(DTY(dtype) == TY_PROC);
288 DTySetFst(dtype, subty);
289 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 2), iface);
290 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 3), numParams);
291 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 4), dpdsc);
292 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 5), fval);
293 }
294
DTySetInterface(DTYPE dtype,SPTR iface)295 inline void DTySetInterface(DTYPE dtype, SPTR iface) {
296 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 2), iface);
297 }
298
DTySetParamDesc(DTYPE dtype,ISZ_T dpdsc)299 inline void DTySetParamDesc(DTYPE dtype, ISZ_T dpdsc) {
300 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 4), dpdsc);
301 }
302
DTySetFuncVal(DTYPE dtype,SPTR fval)303 inline void DTySetFuncVal(DTYPE dtype, SPTR fval) {
304 DTySet(static_cast<DTYPE>(static_cast<int>(dtype) + 5), fval);
305 }
306
DTySetParamList(DTYPE dtype,DTYPE param)307 inline void DTySetParamList(DTYPE dtype, DTYPE param) {
308 Precond(DTyValidRange(dtype));
309 Precond(DTY(dtype) == TY_PFUNC);
310 stb.dt.stg_base[static_cast<int>(dtype) + 2] = param;
311 }
312
313 // ===========
314 // ILI getters
315
316 #ifdef HAVE_ILI
317
ILIIsValid(int ilix)318 inline bool ILIIsValid(int ilix) {
319 return true; // FIXME
320 }
321
ILIOpcode(int ilix)322 inline ILI_OP ILIOpcode(int ilix) {
323 Precond(ILIIsValid(ilix));
324 return ILI_OPC(ilix);
325 }
326
ILIIsConstant(int ilix)327 inline bool ILIIsConstant(int ilix) {
328 Precond(ILIIsValid(ilix));
329 return IL_TYPE(ILIOpcode(ilix)) == ILTY_CONS;
330 }
331
ILIConstantSymbol(int ilix)332 inline SPTR ILIConstantSymbol(int ilix) {
333 Precond(ILIIsConstant(ilix));
334 return static_cast<SPTR>(ILI_OPND(ilix, 1));
335 }
336
337 #endif // HAVE_ILI
338
339 // ===========
340 // STB getters
341
342 #define ST_GetterInstance(OrigMacro, ReturnType, Suffix) \
343 inline ReturnType STGet ## Suffix (int index) { \
344 return static_cast<ReturnType>(OrigMacro(index)); \
345 }
346
347 ST_GetterInstance(ALTNAMEG, SPTR, AlternateName)
348 #undef ALTNAMEG
349 #define ALTNAMEG(X) STGetAlternateName(X)
350
351 ST_GetterInstance(ARGTYPG, DTYPE, ArgumentType)
352 #undef ARGTYPG
353 #define ARGTYPG(X) STGetArgumentType(X)
354
355 ST_GetterInstance(BASESYMG, SPTR, BaseSymbol)
356 #undef BASESYMG
357 #define BASESYMG(X) STGetBaseSymbol(X)
358
359 ST_GetterInstance(BEGINSCOPELABG, SPTR, BeginScopeLabel)
360 #undef BEGINSCOPELABG
361 #define BEGINSCOPELABG(X) STGetBeginScopeLabel(X)
362
363 ST_GetterInstance(CLENG, SPTR, CLength)
364 #undef CLENG
365 #define CLENG(X) STGetCLength(X)
366
367 ST_GetterInstance(CMEMFG, SPTR, CMemF)
368 #undef CMEMFG
369 #define CMEMFG(X) STGetCMemF(X)
370
371 ST_GetterInstance(CMEMLG, SPTR, CMemL)
372 #undef CMEMLG
373 #define CMEMLG(X) STGetCMemL(X)
374
375 ST_GetterInstance(CONVAL1G, SPTR, Pointee)
376
377 ST_GetterInstance(DEFLABG, SPTR, DefLab)
378 #undef DEFLABG
379 #define DEFLABG(X) STGetDefLab(X)
380
381 ST_GetterInstance(DEVCOPYG, SPTR, DeviceCopy)
382 #undef DEVCOPYG
383 #define DEVCOPYG(X) STGetDeviceCopy(X)
384
385 ST_GetterInstance(ENCLFUNCG, SPTR, EnclosingFunction)
386 #undef ENCLFUNCG
387 #define ENCLFUNCG(X) STGetEnclosingFunction(X)
388
389 ST_GetterInstance(ENDLABG, SPTR, EndLabel)
390 #undef ENDLABG
391 #define ENDLABG(X) STGetEndLabel(X)
392
393 ST_GetterInstance(ENDSCOPELABG, SPTR, EndScopeLabel)
394 #undef ENDSCOPELABG
395 #define ENDSCOPELABG(X) STGetEndScopeLabel(X)
396
397 ST_GetterInstance(FMTPTG, SPTR, Fmtpt)
398 #undef FMTPTG
399 #define FMTPTG(X) STGetFmtpt(X)
400
401 ST_GetterInstance(FVALG, SPTR, FValue)
402 #undef FVALG
403 #define FVALG(X) STGetFValue(X)
404
405 ST_GetterInstance(GCMPLXG, SPTR, GComplex)
406 #undef GCMPLXG
407 #define GCMPLXG(X) STGetGComplex(X)
408
409 ST_GetterInstance(GDBLEG, SPTR, GDouble)
410 #undef GDBLEG
411 #define GDBLEG(X) STGetGDouble(X)
412
413 ST_GetterInstance(GDCMPLXG, SPTR, GDoubleComplex)
414 #undef GDCMPLXG
415 #define GDCMPLXG(X) STGetGDoubleComplex(X)
416
417 ST_GetterInstance(GINTG, SPTR, GInteger)
418 #undef GINTG
419 #define GINTG(X) STGetGInteger(X)
420
421 ST_GetterInstance(GINT8G, SPTR, GIntegerEight)
422 #undef GINT8G
423 #define GINT8G(X) STGetGIntegerEight(X)
424
425 ST_GetterInstance(GREALG, SPTR, GReal)
426 #undef GREALG
427 #define GREALG(X) STGetGReal(X)
428
429 ST_GetterInstance(GSAMEG, SPTR, GSame)
430 #undef GSAMEG
431 #define GSAMEG(X) STGetGSame(X)
432
433 ST_GetterInstance(GSINTG, SPTR, GSInt)
434 #undef GSINTG
435 #define GSINTG(X) STGetGSInt(X)
436
437 ST_GetterInstance(INMODULEG, SPTR, InModule)
438 #undef INMODULEG
439 #define INMODULEG(X) STGetInModule(X)
440
441 ST_GetterInstance(INTTYPG, DTYPE, IntType)
442 #undef INTTYPG
443 #define INTTYPG(X) STGetIntType(X)
444
445 ST_GetterInstance(MIDNUMG, SPTR, MidNum)
446 #undef MIDNUMG
447 #define MIDNUMG(X) STGetMidNum(X)
448
449 ST_GetterInstance(ORIGDUMMYG, SPTR, OrigDummy)
450 #undef ORIGDUMMYG
451 #define ORIGDUMMYG(X) STGetOrigDummy(X)
452
453 ST_GetterInstance(PSMEMG, SPTR, PsMem)
454 #undef PSMEMG
455 #define PSMEMG(X) STGetPsMem(X)
456
457 ST_GetterInstance(SCOPEG, SPTR, Scope)
458 #undef SCOPEG
459 #define SCOPEG(X) STGetScope(X)
460
461 ST_GetterInstance(SDSCG, SPTR, SDSC)
462 #undef SDSCG
463 #define SDSCG(X) STGetSDSC(X)
464
465 ST_GetterInstance(STARTLABG, SPTR, StartLabel)
466 #undef STARTLABG
467 #define STARTLABG(X) STGetStartLabel(X)
468
469 ST_GetterInstance(TASKDUPG, SPTR, TaskDup)
470 #undef TASKDUPG
471 #define TASKDUPG(X) STGetTaskDup(X)
472
473 ST_GetterInstance(TDLNKG, SPTR, TdLink)
474 #undef TDLNKG
475 #define TDLNKG(X) STGetTdLink(X)
476
477 ST_GetterInstance(TPLNKG, SPTR, TpLink)
478 #undef TPLNKG
479 #define TPLNKG(X) STGetTpLink(X)
480
481 ST_GetterInstance(THPRVTOPTG, SPTR, ThreadPrivate)
482 #undef THPRVTOPTG
483 #define THPRVTOPTG(X) STGetThreadPrivate(X)
484
485 ST_GetterInstance(TYPDEF_INITG, SPTR, TypedefInit)
486 #undef TYPDEF_INITG
487 #define TYPDEF_INITG(X) STGetTypedefInit(X)
488
489 ST_GetterInstance(VARIANTG, SPTR, Variant)
490 #undef VARIANTG
491 #define VARIANTG(X) STGetVariant(X)
492
493 ST_GetterInstance(VTABLEG, SPTR, VTable)
494 #undef VTABLEG
495 #define VTABLEG(X) STGetVTable(X)
496
497 ST_GetterInstance(XREFLKG, ISZ_T, DsrtInit)
498 ST_GetterInstance(XREFLKG, SPTR, CrossRefLink)
499 #undef XREFLKG
500 #define XREFLKG(X) STGetCrossRefLink(X)
501
502 #else // !__cplusplus
503
504 #define DTyValidRange(D) (((D) > DT_NONE) && ((unsigned)(D) < stb.dt.stg_avail))
505 #define DTyCharLength(D) DTY((D) + 1)
506 #define DTySeqTyElement(D) DTY((D) + 1)
507 #define DTyArrayDesc(D) DTY((D) + 2)
508 #define DTySetArrayDesc(D,E) (DTY((D) + 2) = (E))
509 #define DTyVecLength(D) DTY((D) + 2)
510 #define DTySetVecLength(D,E) (DTY((D) + 2) = (E))
511 #define DTyEnumTyTag(D) DTY((D) + 2)
512 #define DTyAlgTyMember(D) DTY((D) + 1)
513 #define DTyAlgTySize(D) DTY((D) + 2)
514 #define DTyAlgTyTag(D) DTY((D) + 3)
515 #define DTyAlgTyAlign(D) DTY((D) + 4)
516 #define DTyAlgTyInitCon(D) DTY((D) + 5)
517 #define DTyAlgTyTagNeg(D) DTyAlgTyTag(D)
518 #define DTyArgType(D) DTY((D) + 1)
519 #define DTyArgSym(D) DTY((D) + 2)
520 #define DTyArgNext(D) DTY((D) + 3)
521 #define DTyReturnType(D) DTY((D) + 1)
522 #define DTyInterface(D) DTY((D) + 2)
523 #define DTyParamCount(D) DTY((D) + 3)
524 #define DTyParamDesc(D) DTY((D) + 4)
525 #define DTyFuncVal(D) DTY((D) + 5)
526 #define DTyParamList(D) DTY((D) + 2)
527 #define DTySetParamList(D,E) (DTY((D) + 2) = (E))
528
529 #define DTySet(D,E) (DTY(D) = (E))
530 #define DTySetFst(D,E) (DTY((D) + 1) = (E))
531 #define DTySetAlgTySize(D,E) (DTY((D) + 2) = (E))
532 #define DTySetAlgTyTag(D,E) (DTY((D) + 3) = (E))
533 #define DTySetAlgTyAlign(D,E) (DTY((D) + 4) = (E))
534 #define DTySetAlgTyICT(D,E) (DTY((D) + 5) = (E))
535 #define DTySetInterface(D,E) (DTY((D) + 2) = (E))
536 #define DTySetParamDesc(D,E) (DTY((D) + 4) = (E))
537 #define DTySetFuncVal(D,E) (DTY((D) + 5) = (E))
538
539 #define DTySetAlgTy(D,M,S,T,A,F) \
540 { DTY((D) + 1) = (M); \
541 DTY((D) + 2) = (S); \
542 DTY((D) + 3) = (T); \
543 DTY((D) + 4) = (A); \
544 DTY((D) + 5) = (F); }
545
546 #define DTySetProcTy(D,S,I,C,E,F) \
547 { DTY((D) + 1) = (S); \
548 DTY((D) + 2) = (I); \
549 DTY((D) + 3) = (C); \
550 DTY((D) + 4) = (E); \
551 DTY((D) + 5) = (F); }
552
553 #define SptrValidRange(S) (((S) > NOSYM) && ((unsigned)(S) < stb.stg_avail))
554
555 #ifdef HAVE_ILI
556
557 #define ILIOpcode(I) ILI_OPC(I)
558 #define ILIConstantSymbol(I) ILI_OPND(I, 1)
559
560 #endif // HAVE_ILI
561
562 #define STGetPointee(S) CONVAL1G(S)
563
564 #endif // __cplusplus
565
566 #define IM_null ((ILM_OP)0)
567
568 #endif // FORTRAN_SYMFUN_H_
569