OSDN Git Service

New Language: Ada
[pf3gnuchains/gcc-fork.git] / gcc / ada / ada-tree.h
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                             A D A - T R E E                              *
6  *                                                                          *
7  *                              C Header File                               *
8  *                                                                          *
9  *                            $Revision: 1.1 $
10  *                                                                          *
11  *          Copyright (C) 1992-2001 Free Software Foundation, Inc.          *
12  *                                                                          *
13  * GNAT is free software;  you can  redistribute it  and/or modify it under *
14  * terms of the  GNU General Public License as published  by the Free Soft- *
15  * ware  Foundation;  either version 2,  or (at your option) any later ver- *
16  * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
17  * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
18  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *
19  * for  more details.  You should have  received  a copy of the GNU General *
20  * Public License  distributed with GNAT;  see file COPYING.  If not, write *
21  * to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, *
22  * MA 02111-1307, USA.                                                      *
23  *                                                                          *
24  * GNAT was originally developed  by the GNAT team at  New York University. *
25  * It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). *
26  *                                                                          *
27  ****************************************************************************/
28
29 /* Ada language-specific GC tree codes.  */
30 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
31 enum gnat_tree_code {
32   __DUMMY = LAST_AND_UNUSED_TREE_CODE,
33 #include "ada-tree.def"
34   LAST_GNAT_TREE_CODE
35 };
36 #undef DEFTREECODE
37
38 /* Flags added to GCC type nodes.  */
39
40 /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this is a
41    record being used as a fat pointer (only true for RECORD_TYPE).  */
42 #define TYPE_IS_FAT_POINTER_P(NODE) TYPE_LANG_FLAG_0 (NODE)
43
44 #define TYPE_FAT_POINTER_P(NODE)  \
45   (TREE_CODE (NODE) == RECORD_TYPE && TYPE_IS_FAT_POINTER_P (NODE))
46
47 /* For integral types, nonzero if this is a packed array type.  Such
48    types should not be extended to a larger size.  */
49 #define TYPE_PACKED_ARRAY_TYPE_P(NODE) TYPE_LANG_FLAG_0 (NODE)
50
51 /* For INTEGER_TYPE, nonzero if this is a modular type with a modulus that
52    is not equal to two to the power of its mode's size.  */
53 #define TYPE_MODULAR_P(NODE) TYPE_LANG_FLAG_1 (INTEGER_TYPE_CHECK (NODE))
54
55 /* For ARRAY_TYPE, nonzero if this type corresponds to a dimension of
56    an Ada array other than the first.  */
57 #define TYPE_MULTI_ARRAY_P(NODE)  TYPE_LANG_FLAG_1 (ARRAY_TYPE_CHECK (NODE))
58
59 /* For FUNCTION_TYPE, nonzero if this denotes a function returning an
60    unconstrained array or record.  */
61 #define TYPE_RETURNS_UNCONSTRAINED_P(NODE) \
62   TYPE_LANG_FLAG_1 (FUNCTION_TYPE_CHECK (NODE))
63
64 /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this denotes
65    a left-justified modular type (will only be true for RECORD_TYPE).  */
66 #define TYPE_LEFT_JUSTIFIED_MODULAR_P(NODE) TYPE_LANG_FLAG_1 (NODE)
67
68 /* Nonzero in an arithmetic subtype if this is a subtype not known to the
69    front-end.  */
70 #define TYPE_EXTRA_SUBTYPE_P(NODE) TYPE_LANG_FLAG_2 (NODE)
71
72 /* Nonzero for composite types if this is a by-reference type.  */
73 #define TYPE_BY_REFERENCE_P(NODE) TYPE_LANG_FLAG_2 (NODE)
74
75 /* For RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE, nonzero if this is the
76    type for an object whose type includes its template in addition to
77    its value (only true for RECORD_TYPE).  */
78 #define TYPE_CONTAINS_TEMPLATE_P(NODE) TYPE_LANG_FLAG_3 (NODE)
79
80 /* For INTEGER_TYPE, nonzero if this really represents a VAX
81    floating-point type.  */
82 #define TYPE_VAX_FLOATING_POINT_P(NODE)  \
83   TYPE_LANG_FLAG_3 (INTEGER_TYPE_CHECK (NODE))
84
85 /* True if NODE is a thin pointer.  */
86 #define TYPE_THIN_POINTER_P(NODE)                       \
87   (POINTER_TYPE_P (NODE)                                \
88    && TREE_CODE (TREE_TYPE (NODE)) == RECORD_TYPE       \
89    && TYPE_CONTAINS_TEMPLATE_P (TREE_TYPE (NODE)))
90
91 /* True if TYPE is either a fat or thin pointer to an unconstrained
92    array.  */
93 #define TYPE_FAT_OR_THIN_POINTER_P(NODE) \
94   (TYPE_FAT_POINTER_P (NODE) || TYPE_THIN_POINTER_P (NODE))
95
96 /* For INTEGER_TYPEs, nonzero if the type has a biased representation.  */
97 #define TYPE_BIASED_REPRESENTATION_P(NODE) \
98   TYPE_LANG_FLAG_4 (INTEGER_TYPE_CHECK (NODE))
99
100 /* For ARRAY_TYPEs, nonzero if the array type has Convention_Fortran.  */
101 #define TYPE_CONVENTION_FORTRAN_P(NODE) \
102   TYPE_LANG_FLAG_4 (ARRAY_TYPE_CHECK (NODE))
103
104 /* For FUNCTION_TYPEs, nonzero if the function returns by reference.  */
105 #define TYPE_RETURNS_BY_REF_P(NODE) \
106   TYPE_LANG_FLAG_4 (FUNCTION_TYPE_CHECK (NODE))
107
108 /* For VOID_TYPE, ENUMERAL_TYPE, UNION_TYPE, and RECORD_TYPE, nonzero if this
109    is a dummy type, made to correspond to a private or incomplete type.  */
110 #define TYPE_DUMMY_P(NODE) TYPE_LANG_FLAG_4 (NODE)
111
112 /* True if TYPE is such a dummy type.  */
113 #define TYPE_IS_DUMMY_P(NODE) \
114   ((TREE_CODE (NODE) == VOID_TYPE || TREE_CODE (NODE) == RECORD_TYPE    \
115     || TREE_CODE (NODE) == UNION_TYPE || TREE_CODE (NODE) == ENUMERAL_TYPE) \
116    && TYPE_DUMMY_P (NODE))
117
118 /* Nonzero if this corresponds to a type where alignment is guaranteed
119    by other mechanisms (a tagged or packed type).  */
120 #define TYPE_ALIGN_OK_P(NODE) TYPE_LANG_FLAG_5 (NODE)
121
122 /* For an INTEGER_TYPE, nonzero if TYPE_ACTUAL_BOUNDS is present.  */
123 #define TYPE_HAS_ACTUAL_BOUNDS_P(NODE) \
124   TYPE_LANG_FLAG_6 (INTEGER_TYPE_CHECK (NODE))
125
126 /* For a RECORD_TYPE, nonzero if this was made just to supply needed
127    padding or alignment.  */
128 #define TYPE_IS_PADDING_P(NODE) TYPE_LANG_FLAG_6 (RECORD_TYPE_CHECK (NODE))
129
130 /* This field is only defined for FUNCTION_TYPE nodes. If the Ada
131    subprogram contains no parameters passed by copy in/copy out then this
132    field is 0. Otherwise it points to a list of nodes used to specify the
133    return values of the out (or in out) parameters that qualify to be passed
134    by copy in copy out.  It is a CONSTRUCTOR.  For a full description of the
135    cico parameter passing mechanism refer to the routine gnat_to_gnu_entity. */
136 #define TYPE_CI_CO_LIST(NODE)   \
137   (tree) TYPE_LANG_SPECIFIC (FUNCTION_TYPE_CHECK (NODE))
138
139 /* For an INTEGER_TYPE with TYPE_MODULAR_P, this is the value of the
140    modulus. */
141 #define TYPE_MODULUS(NODE)  \
142   (tree) TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))
143
144 /* For an INTEGER_TYPE that is the TYPE_DOMAIN of some ARRAY_TYPE, points to
145    the type corresponding to the Ada index type.  */
146 #define TYPE_INDEX_TYPE(NODE)   \
147   (tree) TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))
148
149 /* For an INTEGER_TYPE with TYPE_VAX_FLOATING_POINT_P, stores the
150    Digits_Value.  */
151 #define TYPE_DIGITS_VALUE(NODE)  \
152   (long) TYPE_LANG_SPECIFIC (INTEGER_TYPE_CHECK (NODE))
153
154 /* For INTEGER_TYPE, stores the RM_Size of the type.  */
155 #define TYPE_RM_SIZE_INT(NODE)  TYPE_VALUES (INTEGER_TYPE_CHECK (NODE))
156
157 /* Likewise for ENUMERAL_TYPE.  */
158 #define TYPE_RM_SIZE_ENUM(NODE) \
159   (tree) TYPE_LANG_SPECIFIC (ENUMERAL_TYPE_CHECK (NODE))
160
161 #define TYPE_RM_SIZE(NODE)                                      \
162   (TREE_CODE (NODE) == ENUMERAL_TYPE ? TYPE_RM_SIZE_ENUM (NODE) \
163    : TREE_CODE (NODE) == INTEGER_TYPE ? TYPE_RM_SIZE_INT (NODE) \
164    : 0)
165
166 /* For a RECORD_TYPE that is a fat pointer, point to the type for the
167    unconstrained object.  Likewise for a RECORD_TYPE that is pointed
168    to by a thin pointer.  */
169 #define TYPE_UNCONSTRAINED_ARRAY(NODE)  \
170   (tree) TYPE_LANG_SPECIFIC (RECORD_TYPE_CHECK (NODE))
171
172 /* For other RECORD_TYPEs and all UNION_TYPEs and QUAL_UNION_TYPEs, the Ada
173    size of the object.  This differs from the GCC size in that it does not
174    include any rounding up to the alignment of the type.  */
175 #define TYPE_ADA_SIZE(NODE)     (tree) TYPE_LANG_SPECIFIC (NODE)
176
177 /* For an INTEGER_TYPE with TYPE_HAS_ACTUAL_BOUNDS_P or an ARRAY_TYPE, this is
178    the index type that should be used when the actual bounds are required for
179    a template.  This is used in the case of packed arrays.  */
180 #define TYPE_ACTUAL_BOUNDS(NODE)   (tree) TYPE_LANG_SPECIFIC (NODE)
181
182 /* In an UNCONSTRAINED_ARRAY_TYPE, points to the record containing both
183    the template and object.  */
184 #define TYPE_OBJECT_RECORD_TYPE(NODE) TYPE_MIN_VALUE (NODE)
185
186 /* Nonzero in a FUNCTION_DECL that represents a stubbed function
187    discriminant.  */
188 #define DECL_STUBBED_P(NODE) DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
189
190 /* Nonzero if this decl is always used by reference; i.e., an INDIRECT_REF
191    is needed to access the object.  */
192 #define DECL_BY_REF_P(NODE) DECL_LANG_FLAG_1 (NODE)
193
194 /* Nonzero if this decl is a PARM_DECL for an Ada array being passed to a
195    foreign convention subprogram.  */
196 #define DECL_BY_COMPONENT_PTR_P(NODE) DECL_LANG_FLAG_2 (NODE)
197
198 /* Nonzero in a FIELD_DECL that is a dummy built for some internal reason.  */
199 #define DECL_INTERNAL_P(NODE) DECL_LANG_FLAG_3 (FIELD_DECL_CHECK (NODE))
200
201 /* Nonzero in a FUNCTION_DECL that corresponds to an elaboration procedure.  */
202 #define DECL_ELABORATION_PROC_P(NODE) \
203   DECL_LANG_FLAG_3 (FUNCTION_DECL_CHECK (NODE))
204
205 /* Nonzero if this is a decl for a pointer that points to something which
206    is readonly.  Used mostly for fat pointers.  */
207 #define DECL_POINTS_TO_READONLY_P(NODE) DECL_LANG_FLAG_4 (NODE)
208
209 /* Nonzero in a FIELD_DECL if there was a record rep clause.  */
210 #define DECL_HAS_REP_P(NODE) DECL_LANG_FLAG_5 (FIELD_DECL_CHECK (NODE))
211
212 /* Nonzero in a PARM_DECL if we are to pass by descriptor.  */
213 #define DECL_BY_DESCRIPTOR_P(NODE) DECL_LANG_FLAG_5 (PARM_DECL_CHECK (NODE))
214
215 /* In a CONST_DECL, points to a VAR_DECL that is allocatable to
216    memory.  Used when a scalar constant is aliased or has its
217    address taken.  */
218 #define DECL_CONST_CORRESPONDING_VAR(NODE) \
219   (tree) DECL_LANG_SPECIFIC (CONST_DECL_CHECK (NODE))
220
221 /* In a FIELD_DECL, points to the FIELD_DECL that was the ultimate
222    source of the decl.  */
223 #define DECL_ORIGINAL_FIELD(NODE) \
224   (tree) DECL_LANG_SPECIFIC (FIELD_DECL_CHECK (NODE))
225
226 /* In a FIELD_DECL corresponding to a discriminant, contains the
227    discriminant number.  */
228 #define DECL_DISCRIMINANT_NUMBER(NODE) DECL_INITIAL (FIELD_DECL_CHECK (NODE))
229
230 /* This is a horrible kludge to store the loop_id of a loop into a tree
231    node.  We need to find some other place to store it!  */
232 #define TREE_LOOP_ID(NODE) (TREE_CHECK (NODE, GNAT_LOOP_ID)->real_cst.rtl)