]>
Commit | Line | Data |
---|---|---|
a1ab4c31 AC |
1 | /**************************************************************************** |
2 | * * | |
3 | * GNAT COMPILER COMPONENTS * | |
4 | * * | |
5 | * A D A - T R E E * | |
6 | * * | |
7 | * C Header File * | |
8 | * * | |
65444786 | 9 | * Copyright (C) 1992-2011, Free Software Foundation, Inc. * |
a1ab4c31 AC |
10 | * * |
11 | * GNAT is free software; you can redistribute it and/or modify it under * | |
12 | * terms of the GNU General Public License as published by the Free Soft- * | |
13 | * ware Foundation; either version 3, or (at your option) any later ver- * | |
14 | * sion. GNAT is distributed in the hope that it will be useful, but WITH- * | |
15 | * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * | |
16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * | |
17 | * for more details. You should have received a copy of the GNU General * | |
18 | * Public License along with GCC; see the file COPYING3. If not see * | |
19 | * <http://www.gnu.org/licenses/>. * | |
20 | * * | |
21 | * GNAT was originally developed by the GNAT team at New York University. * | |
22 | * Extensive contributions were provided by Ada Core Technologies Inc. * | |
23 | * * | |
24 | ****************************************************************************/ | |
25 | ||
26383c64 | 26 | /* The resulting tree type. */ |
d1b38208 | 27 | union GTY((desc ("0"), |
81f653d6 | 28 | chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL"))) |
26383c64 | 29 | lang_tree_node |
a1ab4c31 | 30 | { |
26383c64 EB |
31 | union tree_node GTY((tag ("0"), |
32 | desc ("tree_node_structure (&%h)"))) generic; | |
a1ab4c31 | 33 | }; |
a1ab4c31 | 34 | |
a9429e29 | 35 | /* Ada uses the lang_decl and lang_type fields to hold a tree. |
7773063f | 36 | |
a9429e29 | 37 | FIXME: the variable_size annotation here is needed because these types are |
7773063f EB |
38 | variable-sized in some other front-ends. Due to gengtype deficiency, the |
39 | GTY options of such types have to agree across all front-ends. */ | |
a9429e29 LB |
40 | struct GTY((variable_size)) lang_type { tree t; }; |
41 | struct GTY((variable_size)) lang_decl { tree t; }; | |
26383c64 EB |
42 | |
43 | /* Macros to get and set the tree in TYPE_LANG_SPECIFIC. */ | |
a1ab4c31 AC |
44 | #define GET_TYPE_LANG_SPECIFIC(NODE) \ |
45 | (TYPE_LANG_SPECIFIC (NODE) ? TYPE_LANG_SPECIFIC (NODE)->t : NULL_TREE) | |
26383c64 | 46 | |
7773063f EB |
47 | #define SET_TYPE_LANG_SPECIFIC(NODE, X) \ |
48 | do { \ | |
49 | tree tmp = (X); \ | |
50 | if (!TYPE_LANG_SPECIFIC (NODE)) \ | |
51 | TYPE_LANG_SPECIFIC (NODE) \ | |
52 | = ggc_alloc_lang_type (sizeof (struct lang_type)); \ | |
53 | TYPE_LANG_SPECIFIC (NODE)->t = tmp; \ | |
9ce8e057 | 54 | } while (0) |
a1ab4c31 | 55 | |
26383c64 | 56 | /* Macros to get and set the tree in DECL_LANG_SPECIFIC. */ |
a1ab4c31 AC |
57 | #define GET_DECL_LANG_SPECIFIC(NODE) \ |
58 | (DECL_LANG_SPECIFIC (NODE) ? DECL_LANG_SPECIFIC (NODE)->t : NULL_TREE) | |
a1ab4c31 | 59 | |
7773063f EB |
60 | #define SET_DECL_LANG_SPECIFIC(NODE, X) \ |
61 | do { \ | |
62 | tree tmp = (X); \ | |
63 | if (!DECL_LANG_SPECIFIC (NODE)) \ | |
64 | DECL_LANG_SPECIFIC (NODE) \ | |
65 | = ggc_alloc_lang_decl (sizeof (struct lang_decl)); \ | |
66 | DECL_LANG_SPECIFIC (NODE)->t = tmp; \ | |
9ce8e057 | 67 | } while (0) |
26383c64 EB |
68 | |
69 | ||
70 | /* Flags added to type nodes. */ | |
a1ab4c31 AC |
71 | |
72 | /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this is a | |
73 | record being used as a fat pointer (only true for RECORD_TYPE). */ | |
315cff15 | 74 | #define TYPE_FAT_POINTER_P(NODE) \ |
a1ab4c31 AC |
75 | TYPE_LANG_FLAG_0 (RECORD_OR_UNION_CHECK (NODE)) |
76 | ||
315cff15 EB |
77 | #define TYPE_IS_FAT_POINTER_P(NODE) \ |
78 | (TREE_CODE (NODE) == RECORD_TYPE && TYPE_FAT_POINTER_P (NODE)) | |
a1ab4c31 AC |
79 | |
80 | /* For integral types and array types, nonzero if this is a packed array type | |
81 | used for bit-packed types. Such types should not be extended to a larger | |
82 | size or validated against a specified size. */ | |
83 | #define TYPE_PACKED_ARRAY_TYPE_P(NODE) TYPE_LANG_FLAG_0 (NODE) | |
84 | ||
85 | #define TYPE_IS_PACKED_ARRAY_TYPE_P(NODE) \ | |
86 | ((TREE_CODE (NODE) == INTEGER_TYPE || TREE_CODE (NODE) == ARRAY_TYPE) \ | |
87 | && TYPE_PACKED_ARRAY_TYPE_P (NODE)) | |
88 | ||
89 | /* For INTEGER_TYPE, nonzero if this is a modular type with a modulus that | |
90 | is not equal to two to the power of its mode's size. */ | |
91 | #define TYPE_MODULAR_P(NODE) TYPE_LANG_FLAG_1 (INTEGER_TYPE_CHECK (NODE)) | |
92 | ||
93 | /* For ARRAY_TYPE, nonzero if this type corresponds to a dimension of | |
94 | an Ada array other than the first. */ | |
feec4372 | 95 | #define TYPE_MULTI_ARRAY_P(NODE) TYPE_LANG_FLAG_1 (ARRAY_TYPE_CHECK (NODE)) |
a1ab4c31 AC |
96 | |
97 | /* For FUNCTION_TYPE, nonzero if this denotes a function returning an | |
98 | unconstrained array or record. */ | |
d47d0a8d | 99 | #define TYPE_RETURN_UNCONSTRAINED_P(NODE) \ |
a1ab4c31 AC |
100 | TYPE_LANG_FLAG_1 (FUNCTION_TYPE_CHECK (NODE)) |
101 | ||
102 | /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this denotes | |
103 | a justified modular type (will only be true for RECORD_TYPE). */ | |
104 | #define TYPE_JUSTIFIED_MODULAR_P(NODE) \ | |
105 | TYPE_LANG_FLAG_1 (RECORD_OR_UNION_CHECK (NODE)) | |
106 | ||
107 | /* Nonzero in an arithmetic subtype if this is a subtype not known to the | |
108 | front-end. */ | |
109 | #define TYPE_EXTRA_SUBTYPE_P(NODE) TYPE_LANG_FLAG_2 (NODE) | |
110 | ||
a1ab4c31 AC |
111 | /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this is the |
112 | type for an object whose type includes its template in addition to | |
113 | its value (only true for RECORD_TYPE). */ | |
114 | #define TYPE_CONTAINS_TEMPLATE_P(NODE) \ | |
115 | TYPE_LANG_FLAG_3 (RECORD_OR_UNION_CHECK (NODE)) | |
116 | ||
117 | /* For INTEGER_TYPE, nonzero if this really represents a VAX | |
118 | floating-point type. */ | |
feec4372 | 119 | #define TYPE_VAX_FLOATING_POINT_P(NODE) \ |
a1ab4c31 AC |
120 | TYPE_LANG_FLAG_3 (INTEGER_TYPE_CHECK (NODE)) |
121 | ||
122 | /* True if NODE is a thin pointer. */ | |
315cff15 | 123 | #define TYPE_IS_THIN_POINTER_P(NODE) \ |
a1ab4c31 AC |
124 | (POINTER_TYPE_P (NODE) \ |
125 | && TREE_CODE (TREE_TYPE (NODE)) == RECORD_TYPE \ | |
126 | && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (NODE))) | |
127 | ||
128 | /* True if TYPE is either a fat or thin pointer to an unconstrained | |
129 | array. */ | |
315cff15 EB |
130 | #define TYPE_IS_FAT_OR_THIN_POINTER_P(NODE) \ |
131 | (TYPE_IS_FAT_POINTER_P (NODE) || TYPE_IS_THIN_POINTER_P (NODE)) | |
a1ab4c31 AC |
132 | |
133 | /* For INTEGER_TYPEs, nonzero if the type has a biased representation. */ | |
134 | #define TYPE_BIASED_REPRESENTATION_P(NODE) \ | |
135 | TYPE_LANG_FLAG_4 (INTEGER_TYPE_CHECK (NODE)) | |
136 | ||
137 | /* For ARRAY_TYPEs, nonzero if the array type has Convention_Fortran. */ | |
138 | #define TYPE_CONVENTION_FORTRAN_P(NODE) \ | |
139 | TYPE_LANG_FLAG_4 (ARRAY_TYPE_CHECK (NODE)) | |
140 | ||
d47d0a8d EB |
141 | /* For FUNCTION_TYPEs, nonzero if the function returns by direct reference, |
142 | i.e. the callee returns a pointer to a memory location it has allocated | |
143 | and the caller only needs to dereference the pointer. */ | |
144 | #define TYPE_RETURN_BY_DIRECT_REF_P(NODE) \ | |
a1ab4c31 AC |
145 | TYPE_LANG_FLAG_4 (FUNCTION_TYPE_CHECK (NODE)) |
146 | ||
147 | /* For VOID_TYPE, ENUMERAL_TYPE, UNION_TYPE, and RECORD_TYPE, nonzero if this | |
148 | is a dummy type, made to correspond to a private or incomplete type. */ | |
149 | #define TYPE_DUMMY_P(NODE) TYPE_LANG_FLAG_4 (NODE) | |
150 | ||
a1ab4c31 AC |
151 | #define TYPE_IS_DUMMY_P(NODE) \ |
152 | ((TREE_CODE (NODE) == VOID_TYPE || TREE_CODE (NODE) == RECORD_TYPE \ | |
153 | || TREE_CODE (NODE) == UNION_TYPE || TREE_CODE (NODE) == ENUMERAL_TYPE) \ | |
154 | && TYPE_DUMMY_P (NODE)) | |
155 | ||
a1ab4c31 AC |
156 | /* For an INTEGER_TYPE, nonzero if TYPE_ACTUAL_BOUNDS is present. */ |
157 | #define TYPE_HAS_ACTUAL_BOUNDS_P(NODE) \ | |
158 | TYPE_LANG_FLAG_5 (INTEGER_TYPE_CHECK (NODE)) | |
159 | ||
160 | /* For a RECORD_TYPE, nonzero if this was made just to supply needed | |
161 | padding or alignment. */ | |
315cff15 EB |
162 | #define TYPE_PADDING_P(NODE) TYPE_LANG_FLAG_5 (RECORD_TYPE_CHECK (NODE)) |
163 | ||
164 | #define TYPE_IS_PADDING_P(NODE) \ | |
165 | (TREE_CODE (NODE) == RECORD_TYPE && TYPE_PADDING_P (NODE)) | |
a1ab4c31 AC |
166 | |
167 | /* True if TYPE can alias any other types. */ | |
168 | #define TYPE_UNIVERSAL_ALIASING_P(NODE) TYPE_LANG_FLAG_6 (NODE) | |
169 | ||
7635b357 EB |
170 | /* In an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the |
171 | template and the object. | |
172 | ||
173 | ??? We also put this on an ENUMERAL_TYPE that is dummy. Technically, | |
174 | this is a conflict on the minval field, but there doesn't seem to be | |
175 | simple fix, so we'll live with this kludge for now. */ | |
176 | #define TYPE_OBJECT_RECORD_TYPE(NODE) \ | |
177 | (TREE_CHECK2 ((NODE), UNCONSTRAINED_ARRAY_TYPE, ENUMERAL_TYPE)->type.minval) | |
a1ab4c31 | 178 | |
84fb43a1 EB |
179 | /* For numerical types, this is the GCC lower bound of the type. The GCC |
180 | type system is based on the invariant that an object X of a given type | |
181 | cannot hold at run time a value smaller than its lower bound; otherwise | |
182 | the behavior is undefined. The optimizer takes advantage of this and | |
183 | considers that the assertion X >= LB is always true. */ | |
184 | #define TYPE_GCC_MIN_VALUE(NODE) (NUMERICAL_TYPE_CHECK (NODE)->type.minval) | |
185 | ||
186 | /* For numerical types, this is the GCC upper bound of the type. The GCC | |
187 | type system is based on the invariant that an object X of a given type | |
188 | cannot hold at run time a value larger than its upper bound; otherwise | |
189 | the behavior is undefined. The optimizer takes advantage of this and | |
190 | considers that the assertion X <= UB is always true. */ | |
191 | #define TYPE_GCC_MAX_VALUE(NODE) (NUMERICAL_TYPE_CHECK (NODE)->type.maxval) | |
192 | ||
7635b357 EB |
193 | /* For a FUNCTION_TYPE, if the subprogram has parameters passed by copy in/ |
194 | copy out, this is the list of nodes used to specify the return values of | |
195 | the out (or in out) parameters that are passed by copy in/copy out. For | |
196 | a full description of the copy in/copy out parameter passing mechanism | |
197 | refer to the routine gnat_to_gnu_entity. */ | |
198 | #define TYPE_CI_CO_LIST(NODE) TYPE_LANG_SLOT_1 (FUNCTION_TYPE_CHECK (NODE)) | |
199 | ||
7948ae37 OH |
200 | /* For a VECTOR_TYPE, this is the representative array type. */ |
201 | #define TYPE_REPRESENTATIVE_ARRAY(NODE) \ | |
202 | TYPE_LANG_SLOT_1 (VECTOR_TYPE_CHECK (NODE)) | |
203 | ||
84fb43a1 EB |
204 | /* For numerical types, this holds various RM-defined values. */ |
205 | #define TYPE_RM_VALUES(NODE) TYPE_LANG_SLOT_1 (NUMERICAL_TYPE_CHECK (NODE)) | |
206 | ||
9ce8e057 EB |
207 | /* Macros to get and set the individual values in TYPE_RM_VALUES. */ |
208 | #define TYPE_RM_VALUE(NODE, N) \ | |
209 | (TYPE_RM_VALUES (NODE) \ | |
210 | ? TREE_VEC_ELT (TYPE_RM_VALUES (NODE), (N)) : NULL_TREE) | |
211 | ||
212 | #define SET_TYPE_RM_VALUE(NODE, N, X) \ | |
213 | do { \ | |
214 | tree tmp = (X); \ | |
215 | if (!TYPE_RM_VALUES (NODE)) \ | |
216 | TYPE_RM_VALUES (NODE) = make_tree_vec (3); \ | |
456976d8 EB |
217 | /* ??? The field is not visited by the generic \ |
218 | code so we need to mark it manually. */ \ | |
3f13dd77 | 219 | MARK_VISITED (tmp); \ |
9ce8e057 EB |
220 | TREE_VEC_ELT (TYPE_RM_VALUES (NODE), (N)) = tmp; \ |
221 | } while (0) | |
222 | ||
84fb43a1 EB |
223 | /* For numerical types, this is the RM size of the type, aka its precision. |
224 | There is a discrepancy between what is called precision here (and more | |
225 | generally throughout gigi) and what is called precision in the GCC type | |
226 | system: in the former case it's TYPE_RM_SIZE whereas it's TYPE_PRECISION | |
227 | in the latter case. They are not identical because of the need to support | |
228 | invalid values. | |
229 | ||
230 | These values can be outside the range of values allowed by the RM size | |
231 | but they must nevertheless be valid in the GCC type system, otherwise | |
232 | the optimizer can pretend that they simply don't exist. Therefore they | |
233 | must be within the range of values allowed by the precision in the GCC | |
234 | sense, hence TYPE_PRECISION be set to the Esize, not the RM size. */ | |
9ce8e057 EB |
235 | #define TYPE_RM_SIZE(NODE) TYPE_RM_VALUE ((NODE), 0) |
236 | #define SET_TYPE_RM_SIZE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 0, (X)) | |
84fb43a1 EB |
237 | |
238 | /* For numerical types, this is the RM lower bound of the type. There is | |
239 | again a discrepancy between this lower bound and the GCC lower bound, | |
240 | again because of the need to support invalid values. | |
241 | ||
242 | These values can be outside the range of values allowed by the RM lower | |
243 | bound but they must nevertheless be valid in the GCC type system, otherwise | |
244 | the optimizer can pretend that they simply don't exist. Therefore they | |
245 | must be within the range of values allowed by the lower bound in the GCC | |
246 | sense, hence the GCC lower bound be set to that of the base type. */ | |
9ce8e057 EB |
247 | #define TYPE_RM_MIN_VALUE(NODE) TYPE_RM_VALUE ((NODE), 1) |
248 | #define SET_TYPE_RM_MIN_VALUE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 1, (X)) | |
84fb43a1 EB |
249 | |
250 | /* For numerical types, this is the RM upper bound of the type. There is | |
251 | again a discrepancy between this upper bound and the GCC upper bound, | |
252 | again because of the need to support invalid values. | |
253 | ||
254 | These values can be outside the range of values allowed by the RM upper | |
255 | bound but they must nevertheless be valid in the GCC type system, otherwise | |
256 | the optimizer can pretend that they simply don't exist. Therefore they | |
257 | must be within the range of values allowed by the upper bound in the GCC | |
258 | sense, hence the GCC upper bound be set to that of the base type. */ | |
9ce8e057 EB |
259 | #define TYPE_RM_MAX_VALUE(NODE) TYPE_RM_VALUE ((NODE), 2) |
260 | #define SET_TYPE_RM_MAX_VALUE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 2, (X)) | |
84fb43a1 EB |
261 | |
262 | /* For numerical types, this is the lower bound of the type, i.e. the RM lower | |
263 | bound for language-defined types and the GCC lower bound for others. */ | |
264 | #undef TYPE_MIN_VALUE | |
265 | #define TYPE_MIN_VALUE(NODE) \ | |
266 | (TYPE_RM_MIN_VALUE (NODE) \ | |
267 | ? TYPE_RM_MIN_VALUE (NODE) : TYPE_GCC_MIN_VALUE (NODE)) | |
268 | ||
269 | /* For numerical types, this is the upper bound of the type, i.e. the RM upper | |
270 | bound for language-defined types and the GCC upper bound for others. */ | |
271 | #undef TYPE_MAX_VALUE | |
272 | #define TYPE_MAX_VALUE(NODE) \ | |
273 | (TYPE_RM_MAX_VALUE (NODE) \ | |
274 | ? TYPE_RM_MAX_VALUE (NODE) : TYPE_GCC_MAX_VALUE (NODE)) | |
b4680ca1 | 275 | |
a1ab4c31 AC |
276 | /* For an INTEGER_TYPE with TYPE_MODULAR_P, this is the value of the |
277 | modulus. */ | |
278 | #define TYPE_MODULUS(NODE) GET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) | |
feec4372 | 279 | #define SET_TYPE_MODULUS(NODE, X) \ |
a1ab4c31 AC |
280 | SET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE), X) |
281 | ||
26383c64 EB |
282 | /* For an INTEGER_TYPE with TYPE_VAX_FLOATING_POINT_P, this is the |
283 | Digits_Value. */ | |
284 | #define TYPE_DIGITS_VALUE(NODE) \ | |
285 | GET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) | |
286 | #define SET_TYPE_DIGITS_VALUE(NODE, X) \ | |
287 | SET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE), X) | |
288 | ||
289 | /* For an INTEGER_TYPE that is the TYPE_DOMAIN of some ARRAY_TYPE, this is | |
a1ab4c31 AC |
290 | the type corresponding to the Ada index type. */ |
291 | #define TYPE_INDEX_TYPE(NODE) \ | |
292 | GET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE)) | |
293 | #define SET_TYPE_INDEX_TYPE(NODE, X) \ | |
294 | SET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE), X) | |
295 | ||
26383c64 EB |
296 | /* For an INTEGER_TYPE with TYPE_HAS_ACTUAL_BOUNDS_P or an ARRAY_TYPE, this is |
297 | the index type that should be used when the actual bounds are required for | |
298 | a template. This is used in the case of packed arrays. */ | |
299 | #define TYPE_ACTUAL_BOUNDS(NODE) \ | |
300 | GET_TYPE_LANG_SPECIFIC (TREE_CHECK2 (NODE, INTEGER_TYPE, ARRAY_TYPE)) | |
301 | #define SET_TYPE_ACTUAL_BOUNDS(NODE, X) \ | |
302 | SET_TYPE_LANG_SPECIFIC (TREE_CHECK2 (NODE, INTEGER_TYPE, ARRAY_TYPE), X) | |
a1ab4c31 | 303 | |
7635b357 | 304 | /* For a RECORD_TYPE that is a fat pointer, this is the type for the |
a1ab4c31 AC |
305 | unconstrained object. Likewise for a RECORD_TYPE that is pointed |
306 | to by a thin pointer. */ | |
feec4372 | 307 | #define TYPE_UNCONSTRAINED_ARRAY(NODE) \ |
a1ab4c31 | 308 | GET_TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE)) |
feec4372 | 309 | #define SET_TYPE_UNCONSTRAINED_ARRAY(NODE, X) \ |
a1ab4c31 AC |
310 | SET_TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE), X) |
311 | ||
7635b357 EB |
312 | /* For other RECORD_TYPEs and all UNION_TYPEs and QUAL_UNION_TYPEs, this is |
313 | the Ada size of the object. This differs from the GCC size in that it | |
314 | does not include any rounding up to the alignment of the type. */ | |
feec4372 | 315 | #define TYPE_ADA_SIZE(NODE) \ |
a1ab4c31 AC |
316 | GET_TYPE_LANG_SPECIFIC (RECORD_OR_UNION_CHECK (NODE)) |
317 | #define SET_TYPE_ADA_SIZE(NODE, X) \ | |
318 | SET_TYPE_LANG_SPECIFIC (RECORD_OR_UNION_CHECK (NODE), X) | |
319 | ||
a1ab4c31 | 320 | |
26383c64 | 321 | /* Flags added to decl nodes. */ |
a1ab4c31 AC |
322 | |
323 | /* Nonzero in a FUNCTION_DECL that represents a stubbed function | |
324 | discriminant. */ | |
325 | #define DECL_STUBBED_P(NODE) DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE)) | |
326 | ||
327 | /* Nonzero in a VAR_DECL if it is guaranteed to be constant after having | |
328 | been elaborated and TREE_READONLY is not set on it. */ | |
329 | #define DECL_READONLY_ONCE_ELAB(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)) | |
330 | ||
cb3d597d EB |
331 | /* Nonzero in a CONST_DECL if its value is (essentially) the address of a |
332 | constant CONSTRUCTOR. */ | |
333 | #define DECL_CONST_ADDRESS_P(NODE) DECL_LANG_FLAG_0 (CONST_DECL_CHECK (NODE)) | |
334 | ||
0c700259 EB |
335 | /* Nonzero in a PARM_DECL if it is always used by double reference, i.e. a |
336 | pair of INDIRECT_REFs is needed to access the object. */ | |
337 | #define DECL_BY_DOUBLE_REF_P(NODE) DECL_LANG_FLAG_0 (PARM_DECL_CHECK (NODE)) | |
338 | ||
65444786 EB |
339 | /* Nonzero in a TYPE_DECL if this is the declaration of a Taft amendment type |
340 | in the main unit, i.e. the full declaration is available. */ | |
341 | #define DECL_TAFT_TYPE_P(NODE) DECL_LANG_FLAG_0 (TYPE_DECL_CHECK (NODE)) | |
342 | ||
0c700259 | 343 | /* Nonzero in a DECL if it is always used by reference, i.e. an INDIRECT_REF |
a1ab4c31 AC |
344 | is needed to access the object. */ |
345 | #define DECL_BY_REF_P(NODE) DECL_LANG_FLAG_1 (NODE) | |
346 | ||
347 | /* Nonzero in a FIELD_DECL that is a dummy built for some internal reason. */ | |
348 | #define DECL_INTERNAL_P(NODE) DECL_LANG_FLAG_3 (FIELD_DECL_CHECK (NODE)) | |
349 | ||
0c700259 | 350 | /* Nonzero in a PARM_DECL if it is made for an Ada array being passed to a |
a1ab4c31 AC |
351 | foreign convention subprogram. */ |
352 | #define DECL_BY_COMPONENT_PTR_P(NODE) DECL_LANG_FLAG_3 (PARM_DECL_CHECK (NODE)) | |
353 | ||
354 | /* Nonzero in a FUNCTION_DECL that corresponds to an elaboration procedure. */ | |
355 | #define DECL_ELABORATION_PROC_P(NODE) \ | |
356 | DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (NODE)) | |
357 | ||
0c700259 | 358 | /* Nonzero in a DECL if it is made for a pointer that points to something which |
a1ab4c31 AC |
359 | is readonly. Used mostly for fat pointers. */ |
360 | #define DECL_POINTS_TO_READONLY_P(NODE) DECL_LANG_FLAG_4 (NODE) | |
361 | ||
a1ab4c31 AC |
362 | /* Nonzero in a PARM_DECL if we are to pass by descriptor. */ |
363 | #define DECL_BY_DESCRIPTOR_P(NODE) DECL_LANG_FLAG_5 (PARM_DECL_CHECK (NODE)) | |
364 | ||
365 | /* Nonzero in a VAR_DECL if it is a pointer renaming a global object. */ | |
366 | #define DECL_RENAMING_GLOBAL_P(NODE) DECL_LANG_FLAG_5 (VAR_DECL_CHECK (NODE)) | |
367 | ||
26383c64 EB |
368 | /* In a FIELD_DECL corresponding to a discriminant, contains the |
369 | discriminant number. */ | |
370 | #define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE)) | |
371 | ||
a1ab4c31 AC |
372 | /* In a CONST_DECL, points to a VAR_DECL that is allocatable to |
373 | memory. Used when a scalar constant is aliased or has its | |
374 | address taken. */ | |
375 | #define DECL_CONST_CORRESPONDING_VAR(NODE) \ | |
376 | GET_DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE)) | |
377 | #define SET_DECL_CONST_CORRESPONDING_VAR(NODE, X) \ | |
378 | SET_DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE), X) | |
379 | ||
380 | /* In a FIELD_DECL, points to the FIELD_DECL that was the ultimate | |
381 | source of the decl. */ | |
382 | #define DECL_ORIGINAL_FIELD(NODE) \ | |
383 | GET_DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE)) | |
384 | #define SET_DECL_ORIGINAL_FIELD(NODE, X) \ | |
385 | SET_DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE), X) | |
386 | ||
cb3d597d EB |
387 | /* Set DECL_ORIGINAL_FIELD of FIELD1 to (that of) FIELD2. */ |
388 | #define SET_DECL_ORIGINAL_FIELD_TO_FIELD(FIELD1, FIELD2) \ | |
389 | SET_DECL_ORIGINAL_FIELD ((FIELD1), \ | |
390 | DECL_ORIGINAL_FIELD (FIELD2) \ | |
391 | ? DECL_ORIGINAL_FIELD (FIELD2) : (FIELD2)) | |
392 | ||
393 | /* Return true if FIELD1 and FIELD2 represent the same field. */ | |
394 | #define SAME_FIELD_P(FIELD1, FIELD2) \ | |
395 | ((FIELD1) == (FIELD2) \ | |
396 | || DECL_ORIGINAL_FIELD (FIELD1) == (FIELD2) \ | |
397 | || (FIELD1) == DECL_ORIGINAL_FIELD (FIELD2) \ | |
398 | || (DECL_ORIGINAL_FIELD (FIELD1) \ | |
399 | && (DECL_ORIGINAL_FIELD (FIELD1) == DECL_ORIGINAL_FIELD (FIELD2)))) | |
400 | ||
a1ab4c31 AC |
401 | /* In a VAR_DECL, points to the object being renamed if the VAR_DECL is a |
402 | renaming pointer, otherwise 0. Note that this object is guaranteed to | |
403 | be protected against multiple evaluations. */ | |
404 | #define DECL_RENAMED_OBJECT(NODE) \ | |
405 | GET_DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE)) | |
406 | #define SET_DECL_RENAMED_OBJECT(NODE, X) \ | |
407 | SET_DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE), X) | |
408 | ||
409 | /* In a TYPE_DECL, points to the parallel type if any, otherwise 0. */ | |
410 | #define DECL_PARALLEL_TYPE(NODE) \ | |
411 | GET_DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE)) | |
412 | #define SET_DECL_PARALLEL_TYPE(NODE, X) \ | |
413 | SET_DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE), X) | |
414 | ||
415 | /* In a FUNCTION_DECL, points to the stub associated with the function | |
416 | if any, otherwise 0. */ | |
417 | #define DECL_FUNCTION_STUB(NODE) \ | |
418 | GET_DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) | |
419 | #define SET_DECL_FUNCTION_STUB(NODE, X) \ | |
420 | SET_DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE), X) | |
421 | ||
a981c964 EB |
422 | /* In a PARM_DECL, points to the alternate TREE_TYPE. */ |
423 | #define DECL_PARM_ALT_TYPE(NODE) \ | |
6ca2b0a0 | 424 | GET_DECL_LANG_SPECIFIC (PARM_DECL_CHECK (NODE)) |
a981c964 | 425 | #define SET_DECL_PARM_ALT_TYPE(NODE, X) \ |
6ca2b0a0 DR |
426 | SET_DECL_LANG_SPECIFIC (PARM_DECL_CHECK (NODE), X) |
427 | ||
a1ab4c31 | 428 | |
26383c64 | 429 | /* Fields and macros for statements. */ |
feec4372 EB |
430 | #define IS_ADA_STMT(NODE) \ |
431 | (STATEMENT_CLASS_P (NODE) && TREE_CODE (NODE) >= STMT_STMT) | |
a1ab4c31 | 432 | |
feec4372 | 433 | #define STMT_STMT_STMT(NODE) TREE_OPERAND_CHECK_CODE (NODE, STMT_STMT, 0) |
d88bbbb9 EB |
434 | |
435 | #define LOOP_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 0) | |
436 | #define LOOP_STMT_UPDATE(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 1) | |
437 | #define LOOP_STMT_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 2) | |
438 | #define LOOP_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 3) | |
439 | ||
440 | /* A loop statement is conceptually made up of 6 sub-statements: | |
441 | ||
442 | loop: | |
443 | TOP_CONDITION | |
444 | TOP_UPDATE | |
445 | BODY | |
446 | BOTTOM_CONDITION | |
447 | BOTTOM_UPDATE | |
448 | GOTO loop | |
449 | ||
450 | However, only 4 of them can exist for a given loop, the pair of conditions | |
451 | and the pair of updates being mutually exclusive. The default setting is | |
452 | TOP_CONDITION and BOTTOM_UPDATE and the following couple of flags are used | |
453 | to toggle the individual settings. */ | |
454 | #define LOOP_STMT_BOTTOM_COND_P(NODE) TREE_LANG_FLAG_0 (LOOP_STMT_CHECK (NODE)) | |
455 | #define LOOP_STMT_TOP_UPDATE_P(NODE) TREE_LANG_FLAG_1 (LOOP_STMT_CHECK (NODE)) | |
456 | ||
feec4372 EB |
457 | #define EXIT_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 0) |
458 | #define EXIT_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 1) |