1 |
706 |
jeremybenn |
/****************************************************************************
|
2 |
|
|
* *
|
3 |
|
|
* GNAT COMPILER COMPONENTS *
|
4 |
|
|
* *
|
5 |
|
|
* A D A - T R E E *
|
6 |
|
|
* *
|
7 |
|
|
* C Header File *
|
8 |
|
|
* *
|
9 |
|
|
* Copyright (C) 1992-2012, Free Software Foundation, Inc. *
|
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 |
|
|
|
26 |
|
|
/* The resulting tree type. */
|
27 |
|
|
union GTY((desc ("0"),
|
28 |
|
|
chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
|
29 |
|
|
lang_tree_node
|
30 |
|
|
{
|
31 |
|
|
union tree_node GTY((tag ("0"),
|
32 |
|
|
desc ("tree_node_structure (&%h)"))) generic;
|
33 |
|
|
};
|
34 |
|
|
|
35 |
|
|
/* Ada uses the lang_decl and lang_type fields to hold a tree.
|
36 |
|
|
|
37 |
|
|
FIXME: the variable_size annotation here is needed because these types are
|
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. */
|
40 |
|
|
struct GTY((variable_size)) lang_type { tree t; };
|
41 |
|
|
struct GTY((variable_size)) lang_decl { tree t; };
|
42 |
|
|
|
43 |
|
|
/* Macros to get and set the tree in TYPE_LANG_SPECIFIC. */
|
44 |
|
|
#define GET_TYPE_LANG_SPECIFIC(NODE) \
|
45 |
|
|
(TYPE_LANG_SPECIFIC (NODE) ? TYPE_LANG_SPECIFIC (NODE)->t : NULL_TREE)
|
46 |
|
|
|
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; \
|
54 |
|
|
} while (0)
|
55 |
|
|
|
56 |
|
|
/* Macros to get and set the tree in DECL_LANG_SPECIFIC. */
|
57 |
|
|
#define GET_DECL_LANG_SPECIFIC(NODE) \
|
58 |
|
|
(DECL_LANG_SPECIFIC (NODE) ? DECL_LANG_SPECIFIC (NODE)->t : NULL_TREE)
|
59 |
|
|
|
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; \
|
67 |
|
|
} while (0)
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
/* Flags added to type nodes. */
|
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). */
|
74 |
|
|
#define TYPE_FAT_POINTER_P(NODE) \
|
75 |
|
|
TYPE_LANG_FLAG_0 (RECORD_OR_UNION_CHECK (NODE))
|
76 |
|
|
|
77 |
|
|
#define TYPE_IS_FAT_POINTER_P(NODE) \
|
78 |
|
|
(TREE_CODE (NODE) == RECORD_TYPE && TYPE_FAT_POINTER_P (NODE))
|
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) \
|
84 |
|
|
TYPE_LANG_FLAG_0 (TREE_CHECK2 (NODE, INTEGER_TYPE, ARRAY_TYPE))
|
85 |
|
|
|
86 |
|
|
#define TYPE_IS_PACKED_ARRAY_TYPE_P(NODE) \
|
87 |
|
|
((TREE_CODE (NODE) == INTEGER_TYPE || TREE_CODE (NODE) == ARRAY_TYPE) \
|
88 |
|
|
&& TYPE_PACKED_ARRAY_TYPE_P (NODE))
|
89 |
|
|
|
90 |
|
|
/* For INTEGER_TYPE, nonzero if this is a modular type with a modulus that
|
91 |
|
|
is not equal to two to the power of its mode's size. */
|
92 |
|
|
#define TYPE_MODULAR_P(NODE) TYPE_LANG_FLAG_1 (INTEGER_TYPE_CHECK (NODE))
|
93 |
|
|
|
94 |
|
|
/* For ARRAY_TYPE, nonzero if this type corresponds to a dimension of
|
95 |
|
|
an Ada array other than the first. */
|
96 |
|
|
#define TYPE_MULTI_ARRAY_P(NODE) TYPE_LANG_FLAG_1 (ARRAY_TYPE_CHECK (NODE))
|
97 |
|
|
|
98 |
|
|
/* For FUNCTION_TYPE, nonzero if this denotes a function returning an
|
99 |
|
|
unconstrained array or record. */
|
100 |
|
|
#define TYPE_RETURN_UNCONSTRAINED_P(NODE) \
|
101 |
|
|
TYPE_LANG_FLAG_1 (FUNCTION_TYPE_CHECK (NODE))
|
102 |
|
|
|
103 |
|
|
/* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this denotes
|
104 |
|
|
a justified modular type (will only be true for RECORD_TYPE). */
|
105 |
|
|
#define TYPE_JUSTIFIED_MODULAR_P(NODE) \
|
106 |
|
|
TYPE_LANG_FLAG_1 (RECORD_OR_UNION_CHECK (NODE))
|
107 |
|
|
|
108 |
|
|
/* Nonzero in an arithmetic subtype if this is a subtype not known to the
|
109 |
|
|
front-end. */
|
110 |
|
|
#define TYPE_EXTRA_SUBTYPE_P(NODE) TYPE_LANG_FLAG_2 (INTEGER_TYPE_CHECK (NODE))
|
111 |
|
|
|
112 |
|
|
/* Nonzero for an aggregate type if this is a by-reference type. We also
|
113 |
|
|
set this on an ENUMERAL_TYPE that is dummy. */
|
114 |
|
|
#define TYPE_BY_REFERENCE_P(NODE) \
|
115 |
|
|
TYPE_LANG_FLAG_2 (TREE_CHECK5 (NODE, RECORD_TYPE, UNION_TYPE, \
|
116 |
|
|
ARRAY_TYPE, UNCONSTRAINED_ARRAY_TYPE, \
|
117 |
|
|
ENUMERAL_TYPE))
|
118 |
|
|
|
119 |
|
|
#define TYPE_IS_BY_REFERENCE_P(NODE) \
|
120 |
|
|
((TREE_CODE (NODE) == RECORD_TYPE \
|
121 |
|
|
|| TREE_CODE (NODE) == UNION_TYPE \
|
122 |
|
|
|| TREE_CODE (NODE) == ARRAY_TYPE \
|
123 |
|
|
|| TREE_CODE (NODE) == UNCONSTRAINED_ARRAY_TYPE \
|
124 |
|
|
|| TREE_CODE (NODE) == ENUMERAL_TYPE) \
|
125 |
|
|
&& TYPE_BY_REFERENCE_P (NODE))
|
126 |
|
|
|
127 |
|
|
/* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this is the
|
128 |
|
|
type for an object whose type includes its template in addition to
|
129 |
|
|
its value (only true for RECORD_TYPE). */
|
130 |
|
|
#define TYPE_CONTAINS_TEMPLATE_P(NODE) \
|
131 |
|
|
TYPE_LANG_FLAG_3 (RECORD_OR_UNION_CHECK (NODE))
|
132 |
|
|
|
133 |
|
|
/* For INTEGER_TYPE, nonzero if this really represents a VAX
|
134 |
|
|
floating-point type. */
|
135 |
|
|
#define TYPE_VAX_FLOATING_POINT_P(NODE) \
|
136 |
|
|
TYPE_LANG_FLAG_3 (INTEGER_TYPE_CHECK (NODE))
|
137 |
|
|
|
138 |
|
|
/* True if NODE is a thin pointer. */
|
139 |
|
|
#define TYPE_IS_THIN_POINTER_P(NODE) \
|
140 |
|
|
(POINTER_TYPE_P (NODE) \
|
141 |
|
|
&& TREE_CODE (TREE_TYPE (NODE)) == RECORD_TYPE \
|
142 |
|
|
&& TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (NODE)))
|
143 |
|
|
|
144 |
|
|
/* True if TYPE is either a fat or thin pointer to an unconstrained
|
145 |
|
|
array. */
|
146 |
|
|
#define TYPE_IS_FAT_OR_THIN_POINTER_P(NODE) \
|
147 |
|
|
(TYPE_IS_FAT_POINTER_P (NODE) || TYPE_IS_THIN_POINTER_P (NODE))
|
148 |
|
|
|
149 |
|
|
/* For INTEGER_TYPEs, nonzero if the type has a biased representation. */
|
150 |
|
|
#define TYPE_BIASED_REPRESENTATION_P(NODE) \
|
151 |
|
|
TYPE_LANG_FLAG_4 (INTEGER_TYPE_CHECK (NODE))
|
152 |
|
|
|
153 |
|
|
/* For ARRAY_TYPEs, nonzero if the array type has Convention_Fortran. */
|
154 |
|
|
#define TYPE_CONVENTION_FORTRAN_P(NODE) \
|
155 |
|
|
TYPE_LANG_FLAG_4 (ARRAY_TYPE_CHECK (NODE))
|
156 |
|
|
|
157 |
|
|
/* For FUNCTION_TYPEs, nonzero if the function returns by direct reference,
|
158 |
|
|
i.e. the callee returns a pointer to a memory location it has allocated
|
159 |
|
|
and the caller only needs to dereference the pointer. */
|
160 |
|
|
#define TYPE_RETURN_BY_DIRECT_REF_P(NODE) \
|
161 |
|
|
TYPE_LANG_FLAG_4 (FUNCTION_TYPE_CHECK (NODE))
|
162 |
|
|
|
163 |
|
|
/* For RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE, nonzero if this is a dummy
|
164 |
|
|
type, made to correspond to a private or incomplete type. */
|
165 |
|
|
#define TYPE_DUMMY_P(NODE) \
|
166 |
|
|
TYPE_LANG_FLAG_4 (TREE_CHECK3 (NODE, RECORD_TYPE, UNION_TYPE, ENUMERAL_TYPE))
|
167 |
|
|
|
168 |
|
|
#define TYPE_IS_DUMMY_P(NODE) \
|
169 |
|
|
((TREE_CODE (NODE) == RECORD_TYPE \
|
170 |
|
|
|| TREE_CODE (NODE) == UNION_TYPE \
|
171 |
|
|
|| TREE_CODE (NODE) == ENUMERAL_TYPE) \
|
172 |
|
|
&& TYPE_DUMMY_P (NODE))
|
173 |
|
|
|
174 |
|
|
/* For an INTEGER_TYPE, nonzero if TYPE_ACTUAL_BOUNDS is present. */
|
175 |
|
|
#define TYPE_HAS_ACTUAL_BOUNDS_P(NODE) \
|
176 |
|
|
TYPE_LANG_FLAG_5 (INTEGER_TYPE_CHECK (NODE))
|
177 |
|
|
|
178 |
|
|
/* For a RECORD_TYPE, nonzero if this was made just to supply needed
|
179 |
|
|
padding or alignment. */
|
180 |
|
|
#define TYPE_PADDING_P(NODE) TYPE_LANG_FLAG_5 (RECORD_TYPE_CHECK (NODE))
|
181 |
|
|
|
182 |
|
|
#define TYPE_IS_PADDING_P(NODE) \
|
183 |
|
|
(TREE_CODE (NODE) == RECORD_TYPE && TYPE_PADDING_P (NODE))
|
184 |
|
|
|
185 |
|
|
/* True if TYPE can alias any other types. */
|
186 |
|
|
#define TYPE_UNIVERSAL_ALIASING_P(NODE) TYPE_LANG_FLAG_6 (NODE)
|
187 |
|
|
|
188 |
|
|
/* For an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the
|
189 |
|
|
template and the object.
|
190 |
|
|
|
191 |
|
|
??? We also put this on an ENUMERAL_TYPE that is dummy. Technically,
|
192 |
|
|
this is a conflict on the minval field, but there doesn't seem to be
|
193 |
|
|
simple fix, so we'll live with this kludge for now. */
|
194 |
|
|
#define TYPE_OBJECT_RECORD_TYPE(NODE) \
|
195 |
|
|
(TYPE_MINVAL (TREE_CHECK2 ((NODE), UNCONSTRAINED_ARRAY_TYPE, ENUMERAL_TYPE)))
|
196 |
|
|
|
197 |
|
|
/* For numerical types, this is the GCC lower bound of the type. The GCC
|
198 |
|
|
type system is based on the invariant that an object X of a given type
|
199 |
|
|
cannot hold at run time a value smaller than its lower bound; otherwise
|
200 |
|
|
the behavior is undefined. The optimizer takes advantage of this and
|
201 |
|
|
considers that the assertion X >= LB is always true. */
|
202 |
|
|
#define TYPE_GCC_MIN_VALUE(NODE) (TYPE_MINVAL (NUMERICAL_TYPE_CHECK (NODE)))
|
203 |
|
|
|
204 |
|
|
/* For numerical types, this is the GCC upper bound of the type. The GCC
|
205 |
|
|
type system is based on the invariant that an object X of a given type
|
206 |
|
|
cannot hold at run time a value larger than its upper bound; otherwise
|
207 |
|
|
the behavior is undefined. The optimizer takes advantage of this and
|
208 |
|
|
considers that the assertion X <= UB is always true. */
|
209 |
|
|
#define TYPE_GCC_MAX_VALUE(NODE) (TYPE_MAXVAL (NUMERICAL_TYPE_CHECK (NODE)))
|
210 |
|
|
|
211 |
|
|
/* For a FUNCTION_TYPE, if the subprogram has parameters passed by copy in/
|
212 |
|
|
copy out, this is the list of nodes used to specify the return values of
|
213 |
|
|
the out (or in out) parameters that are passed by copy in/copy out. For
|
214 |
|
|
a full description of the copy in/copy out parameter passing mechanism
|
215 |
|
|
refer to the routine gnat_to_gnu_entity. */
|
216 |
|
|
#define TYPE_CI_CO_LIST(NODE) TYPE_LANG_SLOT_1 (FUNCTION_TYPE_CHECK (NODE))
|
217 |
|
|
|
218 |
|
|
/* For a VECTOR_TYPE, this is the representative array type. */
|
219 |
|
|
#define TYPE_REPRESENTATIVE_ARRAY(NODE) \
|
220 |
|
|
TYPE_LANG_SLOT_1 (VECTOR_TYPE_CHECK (NODE))
|
221 |
|
|
|
222 |
|
|
/* For numerical types, this holds various RM-defined values. */
|
223 |
|
|
#define TYPE_RM_VALUES(NODE) TYPE_LANG_SLOT_1 (NUMERICAL_TYPE_CHECK (NODE))
|
224 |
|
|
|
225 |
|
|
/* Macros to get and set the individual values in TYPE_RM_VALUES. */
|
226 |
|
|
#define TYPE_RM_VALUE(NODE, N) \
|
227 |
|
|
(TYPE_RM_VALUES (NODE) \
|
228 |
|
|
? TREE_VEC_ELT (TYPE_RM_VALUES (NODE), (N)) : NULL_TREE)
|
229 |
|
|
|
230 |
|
|
#define SET_TYPE_RM_VALUE(NODE, N, X) \
|
231 |
|
|
do { \
|
232 |
|
|
tree tmp = (X); \
|
233 |
|
|
if (!TYPE_RM_VALUES (NODE)) \
|
234 |
|
|
TYPE_RM_VALUES (NODE) = make_tree_vec (3); \
|
235 |
|
|
/* ??? The field is not visited by the generic \
|
236 |
|
|
code so we need to mark it manually. */ \
|
237 |
|
|
MARK_VISITED (tmp); \
|
238 |
|
|
TREE_VEC_ELT (TYPE_RM_VALUES (NODE), (N)) = tmp; \
|
239 |
|
|
} while (0)
|
240 |
|
|
|
241 |
|
|
/* For numerical types, this is the RM size of the type, aka its precision.
|
242 |
|
|
There is a discrepancy between what is called precision here (and more
|
243 |
|
|
generally throughout gigi) and what is called precision in the GCC type
|
244 |
|
|
system: in the former case it's TYPE_RM_SIZE whereas it's TYPE_PRECISION
|
245 |
|
|
in the latter case. They are not identical because of the need to support
|
246 |
|
|
invalid values.
|
247 |
|
|
|
248 |
|
|
These values can be outside the range of values allowed by the RM size
|
249 |
|
|
but they must nevertheless be valid in the GCC type system, otherwise
|
250 |
|
|
the optimizer can pretend that they simply don't exist. Therefore they
|
251 |
|
|
must be within the range of values allowed by the precision in the GCC
|
252 |
|
|
sense, hence TYPE_PRECISION be set to the Esize, not the RM size. */
|
253 |
|
|
#define TYPE_RM_SIZE(NODE) TYPE_RM_VALUE ((NODE), 0)
|
254 |
|
|
#define SET_TYPE_RM_SIZE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 0, (X))
|
255 |
|
|
|
256 |
|
|
/* For numerical types, this is the RM lower bound of the type. There is
|
257 |
|
|
again a discrepancy between this lower bound and the GCC lower bound,
|
258 |
|
|
again because of the need to support invalid values.
|
259 |
|
|
|
260 |
|
|
These values can be outside the range of values allowed by the RM lower
|
261 |
|
|
bound but they must nevertheless be valid in the GCC type system, otherwise
|
262 |
|
|
the optimizer can pretend that they simply don't exist. Therefore they
|
263 |
|
|
must be within the range of values allowed by the lower bound in the GCC
|
264 |
|
|
sense, hence the GCC lower bound be set to that of the base type. */
|
265 |
|
|
#define TYPE_RM_MIN_VALUE(NODE) TYPE_RM_VALUE ((NODE), 1)
|
266 |
|
|
#define SET_TYPE_RM_MIN_VALUE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 1, (X))
|
267 |
|
|
|
268 |
|
|
/* For numerical types, this is the RM upper bound of the type. There is
|
269 |
|
|
again a discrepancy between this upper bound and the GCC upper bound,
|
270 |
|
|
again because of the need to support invalid values.
|
271 |
|
|
|
272 |
|
|
These values can be outside the range of values allowed by the RM upper
|
273 |
|
|
bound but they must nevertheless be valid in the GCC type system, otherwise
|
274 |
|
|
the optimizer can pretend that they simply don't exist. Therefore they
|
275 |
|
|
must be within the range of values allowed by the upper bound in the GCC
|
276 |
|
|
sense, hence the GCC upper bound be set to that of the base type. */
|
277 |
|
|
#define TYPE_RM_MAX_VALUE(NODE) TYPE_RM_VALUE ((NODE), 2)
|
278 |
|
|
#define SET_TYPE_RM_MAX_VALUE(NODE, X) SET_TYPE_RM_VALUE ((NODE), 2, (X))
|
279 |
|
|
|
280 |
|
|
/* For numerical types, this is the lower bound of the type, i.e. the RM lower
|
281 |
|
|
bound for language-defined types and the GCC lower bound for others. */
|
282 |
|
|
#undef TYPE_MIN_VALUE
|
283 |
|
|
#define TYPE_MIN_VALUE(NODE) \
|
284 |
|
|
(TYPE_RM_MIN_VALUE (NODE) \
|
285 |
|
|
? TYPE_RM_MIN_VALUE (NODE) : TYPE_GCC_MIN_VALUE (NODE))
|
286 |
|
|
|
287 |
|
|
/* For numerical types, this is the upper bound of the type, i.e. the RM upper
|
288 |
|
|
bound for language-defined types and the GCC upper bound for others. */
|
289 |
|
|
#undef TYPE_MAX_VALUE
|
290 |
|
|
#define TYPE_MAX_VALUE(NODE) \
|
291 |
|
|
(TYPE_RM_MAX_VALUE (NODE) \
|
292 |
|
|
? TYPE_RM_MAX_VALUE (NODE) : TYPE_GCC_MAX_VALUE (NODE))
|
293 |
|
|
|
294 |
|
|
/* For an INTEGER_TYPE with TYPE_MODULAR_P, this is the value of the
|
295 |
|
|
modulus. */
|
296 |
|
|
#define TYPE_MODULUS(NODE) \
|
297 |
|
|
GET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))
|
298 |
|
|
#define SET_TYPE_MODULUS(NODE, X) \
|
299 |
|
|
SET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE), X)
|
300 |
|
|
|
301 |
|
|
/* For an INTEGER_TYPE with TYPE_VAX_FLOATING_POINT_P, this is the
|
302 |
|
|
Digits_Value. */
|
303 |
|
|
#define TYPE_DIGITS_VALUE(NODE) \
|
304 |
|
|
GET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))
|
305 |
|
|
#define SET_TYPE_DIGITS_VALUE(NODE, X) \
|
306 |
|
|
SET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE), X)
|
307 |
|
|
|
308 |
|
|
/* For an INTEGER_TYPE that is the TYPE_DOMAIN of some ARRAY_TYPE, this is
|
309 |
|
|
the type corresponding to the Ada index type. */
|
310 |
|
|
#define TYPE_INDEX_TYPE(NODE) \
|
311 |
|
|
GET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))
|
312 |
|
|
#define SET_TYPE_INDEX_TYPE(NODE, X) \
|
313 |
|
|
SET_TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE), X)
|
314 |
|
|
|
315 |
|
|
/* For an INTEGER_TYPE with TYPE_HAS_ACTUAL_BOUNDS_P or an ARRAY_TYPE, this is
|
316 |
|
|
the index type that should be used when the actual bounds are required for
|
317 |
|
|
a template. This is used in the case of packed arrays. */
|
318 |
|
|
#define TYPE_ACTUAL_BOUNDS(NODE) \
|
319 |
|
|
GET_TYPE_LANG_SPECIFIC (TREE_CHECK2 (NODE, INTEGER_TYPE, ARRAY_TYPE))
|
320 |
|
|
#define SET_TYPE_ACTUAL_BOUNDS(NODE, X) \
|
321 |
|
|
SET_TYPE_LANG_SPECIFIC (TREE_CHECK2 (NODE, INTEGER_TYPE, ARRAY_TYPE), X)
|
322 |
|
|
|
323 |
|
|
/* For a POINTER_TYPE that points to the template type of an unconstrained
|
324 |
|
|
array type, this is the address to be used in a null fat pointer. */
|
325 |
|
|
#define TYPE_NULL_BOUNDS(NODE) \
|
326 |
|
|
GET_TYPE_LANG_SPECIFIC (POINTER_TYPE_CHECK (NODE))
|
327 |
|
|
#define SET_TYPE_NULL_BOUNDS(NODE, X) \
|
328 |
|
|
SET_TYPE_LANG_SPECIFIC (POINTER_TYPE_CHECK (NODE), X)
|
329 |
|
|
|
330 |
|
|
/* For a RECORD_TYPE that is a fat pointer, this is the type for the
|
331 |
|
|
unconstrained object. Likewise for a RECORD_TYPE that is pointed
|
332 |
|
|
to by a thin pointer. */
|
333 |
|
|
#define TYPE_UNCONSTRAINED_ARRAY(NODE) \
|
334 |
|
|
GET_TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE))
|
335 |
|
|
#define SET_TYPE_UNCONSTRAINED_ARRAY(NODE, X) \
|
336 |
|
|
SET_TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE), X)
|
337 |
|
|
|
338 |
|
|
/* For other RECORD_TYPEs and all UNION_TYPEs and QUAL_UNION_TYPEs, this is
|
339 |
|
|
the Ada size of the object. This differs from the GCC size in that it
|
340 |
|
|
does not include any rounding up to the alignment of the type. */
|
341 |
|
|
#define TYPE_ADA_SIZE(NODE) \
|
342 |
|
|
GET_TYPE_LANG_SPECIFIC (RECORD_OR_UNION_CHECK (NODE))
|
343 |
|
|
#define SET_TYPE_ADA_SIZE(NODE, X) \
|
344 |
|
|
SET_TYPE_LANG_SPECIFIC (RECORD_OR_UNION_CHECK (NODE), X)
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
/* Flags added to decl nodes. */
|
348 |
|
|
|
349 |
|
|
/* Nonzero in a FUNCTION_DECL that represents a stubbed function
|
350 |
|
|
discriminant. */
|
351 |
|
|
#define DECL_STUBBED_P(NODE) DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
|
352 |
|
|
|
353 |
|
|
/* Nonzero in a VAR_DECL if it is guaranteed to be constant after having
|
354 |
|
|
been elaborated and TREE_READONLY is not set on it. */
|
355 |
|
|
#define DECL_READONLY_ONCE_ELAB(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
|
356 |
|
|
|
357 |
|
|
/* Nonzero in a CONST_DECL if its value is (essentially) the address of a
|
358 |
|
|
constant CONSTRUCTOR. */
|
359 |
|
|
#define DECL_CONST_ADDRESS_P(NODE) DECL_LANG_FLAG_0 (CONST_DECL_CHECK (NODE))
|
360 |
|
|
|
361 |
|
|
/* Nonzero in a PARM_DECL if it is always used by double reference, i.e. a
|
362 |
|
|
pair of INDIRECT_REFs is needed to access the object. */
|
363 |
|
|
#define DECL_BY_DOUBLE_REF_P(NODE) DECL_LANG_FLAG_0 (PARM_DECL_CHECK (NODE))
|
364 |
|
|
|
365 |
|
|
/* Nonzero in a FIELD_DECL if it is declared as aliased. */
|
366 |
|
|
#define DECL_ALIASED_P(NODE) DECL_LANG_FLAG_0 (FIELD_DECL_CHECK (NODE))
|
367 |
|
|
|
368 |
|
|
/* Nonzero in a TYPE_DECL if this is the declaration of a Taft amendment type
|
369 |
|
|
in the main unit, i.e. the full declaration is available. */
|
370 |
|
|
#define DECL_TAFT_TYPE_P(NODE) DECL_LANG_FLAG_0 (TYPE_DECL_CHECK (NODE))
|
371 |
|
|
|
372 |
|
|
/* Nonzero in a DECL if it is always used by reference, i.e. an INDIRECT_REF
|
373 |
|
|
is needed to access the object. */
|
374 |
|
|
#define DECL_BY_REF_P(NODE) DECL_LANG_FLAG_1 (NODE)
|
375 |
|
|
|
376 |
|
|
/* Nonzero in a DECL if it is made for a pointer that can never be null. */
|
377 |
|
|
#define DECL_CAN_NEVER_BE_NULL_P(NODE) DECL_LANG_FLAG_2 (NODE)
|
378 |
|
|
|
379 |
|
|
/* Nonzero in a VAR_DECL if it is made for a loop parameter. */
|
380 |
|
|
#define DECL_LOOP_PARM_P(NODE) DECL_LANG_FLAG_3 (VAR_DECL_CHECK (NODE))
|
381 |
|
|
|
382 |
|
|
/* Nonzero in a FIELD_DECL that is a dummy built for some internal reason. */
|
383 |
|
|
#define DECL_INTERNAL_P(NODE) DECL_LANG_FLAG_3 (FIELD_DECL_CHECK (NODE))
|
384 |
|
|
|
385 |
|
|
/* Nonzero in a PARM_DECL if it is made for an Ada array being passed to a
|
386 |
|
|
foreign convention subprogram. */
|
387 |
|
|
#define DECL_BY_COMPONENT_PTR_P(NODE) DECL_LANG_FLAG_3 (PARM_DECL_CHECK (NODE))
|
388 |
|
|
|
389 |
|
|
/* Nonzero in a FUNCTION_DECL that corresponds to an elaboration procedure. */
|
390 |
|
|
#define DECL_ELABORATION_PROC_P(NODE) \
|
391 |
|
|
DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (NODE))
|
392 |
|
|
|
393 |
|
|
/* Nonzero in a DECL if it is made for a pointer that points to something which
|
394 |
|
|
is readonly. */
|
395 |
|
|
#define DECL_POINTS_TO_READONLY_P(NODE) DECL_LANG_FLAG_4 (NODE)
|
396 |
|
|
|
397 |
|
|
/* Nonzero in a PARM_DECL if we are to pass by descriptor. */
|
398 |
|
|
#define DECL_BY_DESCRIPTOR_P(NODE) DECL_LANG_FLAG_5 (PARM_DECL_CHECK (NODE))
|
399 |
|
|
|
400 |
|
|
/* Nonzero in a VAR_DECL if it is a pointer renaming a global object. */
|
401 |
|
|
#define DECL_RENAMING_GLOBAL_P(NODE) DECL_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
|
402 |
|
|
|
403 |
|
|
/* In a FIELD_DECL corresponding to a discriminant, contains the
|
404 |
|
|
discriminant number. */
|
405 |
|
|
#define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE))
|
406 |
|
|
|
407 |
|
|
/* In a CONST_DECL, points to a VAR_DECL that is allocatable to
|
408 |
|
|
memory. Used when a scalar constant is aliased or has its
|
409 |
|
|
address taken. */
|
410 |
|
|
#define DECL_CONST_CORRESPONDING_VAR(NODE) \
|
411 |
|
|
GET_DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE))
|
412 |
|
|
#define SET_DECL_CONST_CORRESPONDING_VAR(NODE, X) \
|
413 |
|
|
SET_DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE), X)
|
414 |
|
|
|
415 |
|
|
/* In a FIELD_DECL, points to the FIELD_DECL that was the ultimate
|
416 |
|
|
source of the decl. */
|
417 |
|
|
#define DECL_ORIGINAL_FIELD(NODE) \
|
418 |
|
|
GET_DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))
|
419 |
|
|
#define SET_DECL_ORIGINAL_FIELD(NODE, X) \
|
420 |
|
|
SET_DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE), X)
|
421 |
|
|
|
422 |
|
|
/* Set DECL_ORIGINAL_FIELD of FIELD1 to (that of) FIELD2. */
|
423 |
|
|
#define SET_DECL_ORIGINAL_FIELD_TO_FIELD(FIELD1, FIELD2) \
|
424 |
|
|
SET_DECL_ORIGINAL_FIELD ((FIELD1), \
|
425 |
|
|
DECL_ORIGINAL_FIELD (FIELD2) \
|
426 |
|
|
? DECL_ORIGINAL_FIELD (FIELD2) : (FIELD2))
|
427 |
|
|
|
428 |
|
|
/* Return true if FIELD1 and FIELD2 represent the same field. */
|
429 |
|
|
#define SAME_FIELD_P(FIELD1, FIELD2) \
|
430 |
|
|
((FIELD1) == (FIELD2) \
|
431 |
|
|
|| DECL_ORIGINAL_FIELD (FIELD1) == (FIELD2) \
|
432 |
|
|
|| (FIELD1) == DECL_ORIGINAL_FIELD (FIELD2) \
|
433 |
|
|
|| (DECL_ORIGINAL_FIELD (FIELD1) \
|
434 |
|
|
&& (DECL_ORIGINAL_FIELD (FIELD1) == DECL_ORIGINAL_FIELD (FIELD2))))
|
435 |
|
|
|
436 |
|
|
/* In a VAR_DECL with the DECL_LOOP_PARM_P flag set, points to the special
|
437 |
|
|
induction variable that is built under certain circumstances, if any. */
|
438 |
|
|
#define DECL_INDUCTION_VAR(NODE) \
|
439 |
|
|
GET_DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))
|
440 |
|
|
#define SET_DECL_INDUCTION_VAR(NODE, X) \
|
441 |
|
|
SET_DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE), X)
|
442 |
|
|
|
443 |
|
|
/* In a VAR_DECL without the DECL_LOOP_PARM_P flag set and that is a renaming
|
444 |
|
|
pointer, points to the object being renamed, if any. Note that this object
|
445 |
|
|
is guaranteed to be protected against multiple evaluations. */
|
446 |
|
|
#define DECL_RENAMED_OBJECT(NODE) \
|
447 |
|
|
GET_DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE))
|
448 |
|
|
#define SET_DECL_RENAMED_OBJECT(NODE, X) \
|
449 |
|
|
SET_DECL_LANG_SPECIFIC (VAR_DECL_CHECK (NODE), X)
|
450 |
|
|
|
451 |
|
|
/* In a TYPE_DECL, points to the parallel type if any, otherwise 0. */
|
452 |
|
|
#define DECL_PARALLEL_TYPE(NODE) \
|
453 |
|
|
GET_DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))
|
454 |
|
|
#define SET_DECL_PARALLEL_TYPE(NODE, X) \
|
455 |
|
|
SET_DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE), X)
|
456 |
|
|
|
457 |
|
|
/* In a FUNCTION_DECL, points to the stub associated with the function
|
458 |
|
|
if any, otherwise 0. */
|
459 |
|
|
#define DECL_FUNCTION_STUB(NODE) \
|
460 |
|
|
GET_DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE))
|
461 |
|
|
#define SET_DECL_FUNCTION_STUB(NODE, X) \
|
462 |
|
|
SET_DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE), X)
|
463 |
|
|
|
464 |
|
|
/* In a PARM_DECL, points to the alternate TREE_TYPE. */
|
465 |
|
|
#define DECL_PARM_ALT_TYPE(NODE) \
|
466 |
|
|
GET_DECL_LANG_SPECIFIC (PARM_DECL_CHECK (NODE))
|
467 |
|
|
#define SET_DECL_PARM_ALT_TYPE(NODE, X) \
|
468 |
|
|
SET_DECL_LANG_SPECIFIC (PARM_DECL_CHECK (NODE), X)
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
/* Flags added to ref nodes. */
|
472 |
|
|
|
473 |
|
|
/* Nonzero means this node will not trap. */
|
474 |
|
|
#undef TREE_THIS_NOTRAP
|
475 |
|
|
#define TREE_THIS_NOTRAP(NODE) \
|
476 |
|
|
(TREE_CHECK4 (NODE, INDIRECT_REF, ARRAY_REF, UNCONSTRAINED_ARRAY_REF, \
|
477 |
|
|
ARRAY_RANGE_REF)->base.nothrow_flag)
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
/* Fields and macros for statements. */
|
481 |
|
|
#define IS_ADA_STMT(NODE) \
|
482 |
|
|
(STATEMENT_CLASS_P (NODE) && TREE_CODE (NODE) >= STMT_STMT)
|
483 |
|
|
|
484 |
|
|
#define STMT_STMT_STMT(NODE) TREE_OPERAND_CHECK_CODE (NODE, STMT_STMT, 0)
|
485 |
|
|
|
486 |
|
|
#define LOOP_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 0)
|
487 |
|
|
#define LOOP_STMT_UPDATE(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 1)
|
488 |
|
|
#define LOOP_STMT_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 2)
|
489 |
|
|
#define LOOP_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_STMT, 3)
|
490 |
|
|
|
491 |
|
|
/* A loop statement is conceptually made up of 6 sub-statements:
|
492 |
|
|
|
493 |
|
|
loop:
|
494 |
|
|
TOP_CONDITION
|
495 |
|
|
TOP_UPDATE
|
496 |
|
|
BODY
|
497 |
|
|
BOTTOM_CONDITION
|
498 |
|
|
BOTTOM_UPDATE
|
499 |
|
|
GOTO loop
|
500 |
|
|
|
501 |
|
|
However, only 4 of them can exist for a given loop, the pair of conditions
|
502 |
|
|
and the pair of updates being mutually exclusive. The default setting is
|
503 |
|
|
TOP_CONDITION and BOTTOM_UPDATE and the following couple of flags are used
|
504 |
|
|
to toggle the individual settings. */
|
505 |
|
|
#define LOOP_STMT_BOTTOM_COND_P(NODE) TREE_LANG_FLAG_0 (LOOP_STMT_CHECK (NODE))
|
506 |
|
|
#define LOOP_STMT_TOP_UPDATE_P(NODE) TREE_LANG_FLAG_1 (LOOP_STMT_CHECK (NODE))
|
507 |
|
|
|
508 |
|
|
#define EXIT_STMT_COND(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 0)
|
509 |
|
|
#define EXIT_STMT_LABEL(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_STMT, 1)
|