testsuite: 32 bit AIX 2 byte wchar
[official-gcc.git] / gcc / ada / gen_il-types.ads
blobbe389ebc35a8d592021bc888ba4b23e4f01ea5fd
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- G E N _ I L . T Y P E S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2020-2023, 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 distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
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 ------------------------------------------------------------------------------
26 package Gen_IL.Types is
28 -- Enumeration of all the types that are "of interest". We have an
29 -- enumeration literal here for every node kind, every entity kind,
30 -- and every type that can be the type of a field.
32 -- The following is "optional type enumeration" -- i.e. it is Type_Enum
33 -- (declared below) plus the special null value No_Type. See the spec of
34 -- Gen_IL.Gen for how to modify this. (Of course, in Ada we have to define
35 -- this backwards from the above conceptual description.)
37 -- Note that there are various subranges of this type declared below,
38 -- which might need to be kept in sync when modifying this.
40 -- The "Between_..." literals below are simply for making the subranges.
41 -- When adding literals to this enumeration type, be sure to put them in
42 -- the right place so they end up in the appropriate subranges
43 -- (Abstract_Node, Abstract_Entity, Concrete_Node, Concrete_Entity).
45 type Opt_Type_Enum is
46 (No_Type,
48 Flag,
49 -- We use Flag for Boolean, so we don't conflict with
50 -- Standard.Boolean.
52 Node_Id,
53 List_Id,
54 Elist_Id,
55 Name_Id,
56 String_Id,
57 Uint,
58 Valid_Uint,
59 Unat,
60 Upos,
61 Nonzero_Uint,
62 Ureal,
64 Node_Kind_Type, -- Type of result of Nkind function, i.e. Node_Kind
65 Entity_Kind_Type, -- Type of result of Ekind function, i.e. Entity_Kind
66 Source_Ptr,
67 Small_Paren_Count_Type,
68 Union_Id,
69 Convention_Id,
71 Component_Alignment_Kind,
72 Mechanism_Type,
74 Between_Special_And_Abstract_Node_Types,
76 -- Abstract node types:
78 Node_Kind, -- root of node type hierarchy
79 N_Access_To_Subprogram_Definition,
80 N_Alternative,
81 N_Array_Type_Definition,
82 N_Binary_Op,
83 N_Body_Stub,
84 N_Declaration,
85 N_Delay_Statement,
86 N_Direct_Name,
87 N_Entity,
88 N_Entity_Name,
89 N_Formal_Subprogram_Declaration,
90 N_Generic_Declaration,
91 N_Generic_Instantiation,
92 N_Generic_Renaming_Declaration,
93 N_Has_Bounds,
94 N_Has_Chars,
95 N_Has_Condition,
96 N_Has_Entity,
97 N_Has_Etype,
98 N_Is_Case_Choice,
99 N_Is_Decl,
100 N_Is_Exception_Choice,
101 N_Is_Index,
102 N_Is_Range,
103 N_Multiplying_Operator,
104 N_Later_Decl_Item,
105 N_Membership_Test,
106 N_Numeric_Or_String_Literal,
107 N_Op,
108 N_Op_Boolean,
109 N_Op_Compare,
110 N_Op_Shift,
111 N_Proper_Body,
112 N_Push_xxx_Label,
113 N_Pop_xxx_Label,
114 N_Push_Pop_xxx_Label,
115 N_Raise_xxx_Error,
116 N_Renaming_Declaration,
117 N_Representation_Clause,
118 N_Short_Circuit,
119 N_SCIL_Node,
120 N_Statement_Other_Than_Procedure_Call,
121 N_Subprogram_Call,
122 N_Subprogram_Instantiation,
123 N_Subexpr,
124 N_Subprogram_Specification,
125 N_Unary_Op,
126 N_Unit_Body,
128 -- End of abstract node types.
130 Between_Abstract_Node_And_Abstract_Entity_Types,
132 -- Abstract entity types:
134 Entity_Kind, -- root of entity type hierarchy
135 Access_Kind,
136 Access_Subprogram_Kind,
137 Access_Protected_Kind,
138 Aggregate_Kind,
139 Allocatable_Kind,
140 Anonymous_Access_Kind,
141 Array_Kind,
142 Assignable_Kind,
143 Class_Wide_Kind,
144 Composite_Kind,
145 Concurrent_Kind,
146 Concurrent_Body_Kind,
147 Constant_Or_Variable_Kind,
148 Decimal_Fixed_Point_Kind,
149 Digits_Kind,
150 Discrete_Kind,
151 Discrete_Or_Fixed_Point_Kind,
152 Elementary_Kind,
153 Enumeration_Kind,
154 Entry_Kind,
155 Evaluable_Kind,
156 Exception_Or_Object_Kind,
157 Fixed_Point_Kind,
158 Float_Kind,
159 Formal_Kind,
160 Formal_Object_Kind,
161 Generic_Subprogram_Kind,
162 Generic_Unit_Kind,
163 Global_Name_Kind,
164 Incomplete_Kind,
165 Incomplete_Or_Private_Kind,
166 Integer_Kind,
167 Modular_Integer_Kind,
168 Named_Access_Kind,
169 Named_Kind,
170 Numeric_Kind,
171 Object_Kind,
172 Ordinary_Fixed_Point_Kind,
173 Overloadable_Kind,
174 Private_Kind,
175 Protected_Kind,
176 Real_Kind,
177 Record_Kind,
178 Record_Field_Kind,
179 Scalar_Kind,
180 Scope_Kind,
181 Signed_Integer_Kind,
182 Subprogram_Type_Or_Kind,
183 Subprogram_Kind,
184 Task_Kind,
185 Type_Kind,
186 Void_Or_Type_Kind,
188 -- End of abstract entity types.
190 Between_Abstract_Entity_And_Concrete_Node_Types,
192 -- Concrete node types:
194 N_Unused_At_Start,
195 N_At_Clause,
196 N_Component_Clause,
197 N_Enumeration_Representation_Clause,
198 N_Mod_Clause,
199 N_Record_Representation_Clause,
200 N_Attribute_Definition_Clause,
201 N_Empty,
202 N_Pragma_Argument_Association,
203 N_Error,
204 N_Defining_Character_Literal,
205 N_Defining_Identifier,
206 N_Defining_Operator_Symbol,
207 N_Expanded_Name,
208 N_Identifier,
209 N_Operator_Symbol,
210 N_Character_Literal,
211 N_Op_Add,
212 N_Op_Concat,
213 N_Op_Expon,
214 N_Op_Subtract,
215 N_Op_Divide,
216 N_Op_Mod,
217 N_Op_Multiply,
218 N_Op_Rem,
219 N_Op_And,
220 N_Op_Eq,
221 N_Op_Ge,
222 N_Op_Gt,
223 N_Op_Le,
224 N_Op_Lt,
225 N_Op_Ne,
226 N_Op_Or,
227 N_Op_Xor,
228 N_Op_Rotate_Left,
229 N_Op_Rotate_Right,
230 N_Op_Shift_Left,
231 N_Op_Shift_Right,
232 N_Op_Shift_Right_Arithmetic,
233 N_Op_Abs,
234 N_Op_Minus,
235 N_Op_Not,
236 N_Op_Plus,
237 N_Attribute_Reference,
238 N_In,
239 N_Not_In,
240 N_And_Then,
241 N_Or_Else,
242 N_Function_Call,
243 N_Procedure_Call_Statement,
244 N_Raise_Constraint_Error,
245 N_Raise_Program_Error,
246 N_Raise_Storage_Error,
247 N_Integer_Literal,
248 N_Real_Literal,
249 N_String_Literal,
250 N_Explicit_Dereference,
251 N_Expression_With_Actions,
252 N_If_Expression,
253 N_Indexed_Component,
254 N_Interpolated_String_Literal,
255 N_Null,
256 N_Qualified_Expression,
257 N_Quantified_Expression,
258 N_Aggregate,
259 N_Allocator,
260 N_Case_Expression,
261 N_Delta_Aggregate,
262 N_Extension_Aggregate,
263 N_Raise_Expression,
264 N_Range,
265 N_Reference,
266 N_Selected_Component,
267 N_Slice,
268 N_Target_Name,
269 N_Type_Conversion,
270 N_Unchecked_Expression,
271 N_Unchecked_Type_Conversion,
272 N_Subtype_Indication,
273 N_Component_Declaration,
274 N_Entry_Declaration,
275 N_Expression_Function,
276 N_Formal_Object_Declaration,
277 N_Formal_Type_Declaration,
278 N_Full_Type_Declaration,
279 N_Incomplete_Type_Declaration,
280 N_Iterator_Specification,
281 N_Loop_Parameter_Specification,
282 N_Object_Declaration,
283 N_Protected_Type_Declaration,
284 N_Private_Extension_Declaration,
285 N_Private_Type_Declaration,
286 N_Subtype_Declaration,
287 N_Function_Specification,
288 N_Procedure_Specification,
289 N_Access_Function_Definition,
290 N_Access_Procedure_Definition,
291 N_Task_Type_Declaration,
292 N_Package_Body_Stub,
293 N_Protected_Body_Stub,
294 N_Subprogram_Body_Stub,
295 N_Task_Body_Stub,
296 N_Function_Instantiation,
297 N_Procedure_Instantiation,
298 N_Package_Instantiation,
299 N_Package_Body,
300 N_Subprogram_Body,
301 N_Protected_Body,
302 N_Task_Body,
303 N_Implicit_Label_Declaration,
304 N_Package_Declaration,
305 N_Single_Task_Declaration,
306 N_Subprogram_Declaration,
307 N_Use_Package_Clause,
308 N_Generic_Package_Declaration,
309 N_Generic_Subprogram_Declaration,
310 N_Constrained_Array_Definition,
311 N_Unconstrained_Array_Definition,
312 N_Exception_Renaming_Declaration,
313 N_Object_Renaming_Declaration,
314 N_Package_Renaming_Declaration,
315 N_Subprogram_Renaming_Declaration,
316 N_Generic_Function_Renaming_Declaration,
317 N_Generic_Package_Renaming_Declaration,
318 N_Generic_Procedure_Renaming_Declaration,
319 N_Abort_Statement,
320 N_Accept_Statement,
321 N_Assignment_Statement,
322 N_Asynchronous_Select,
323 N_Block_Statement,
324 N_Case_Statement,
325 N_Code_Statement,
326 N_Compound_Statement,
327 N_Conditional_Entry_Call,
328 N_Delay_Relative_Statement,
329 N_Delay_Until_Statement,
330 N_Entry_Call_Statement,
331 N_Free_Statement,
332 N_Goto_Statement,
333 N_Goto_When_Statement,
334 N_Loop_Statement,
335 N_Null_Statement,
336 N_Raise_Statement,
337 N_Raise_When_Statement,
338 N_Requeue_Statement,
339 N_Simple_Return_Statement,
340 N_Extended_Return_Statement,
341 N_Return_When_Statement,
342 N_Selective_Accept,
343 N_Timed_Entry_Call,
344 N_Exit_Statement,
345 N_If_Statement,
346 N_Accept_Alternative,
347 N_Delay_Alternative,
348 N_Elsif_Part,
349 N_Entry_Body_Formal_Part,
350 N_Iteration_Scheme,
351 N_Terminate_Alternative,
352 N_Formal_Abstract_Subprogram_Declaration,
353 N_Formal_Concrete_Subprogram_Declaration,
354 N_Push_Constraint_Error_Label,
355 N_Push_Program_Error_Label,
356 N_Push_Storage_Error_Label,
357 N_Pop_Constraint_Error_Label,
358 N_Pop_Program_Error_Label,
359 N_Pop_Storage_Error_Label,
360 N_SCIL_Dispatch_Table_Tag_Init,
361 N_SCIL_Dispatching_Call,
362 N_SCIL_Membership_Test,
363 N_Abortable_Part,
364 N_Abstract_Subprogram_Declaration,
365 N_Access_Definition,
366 N_Access_To_Object_Definition,
367 N_Aspect_Specification,
368 N_Call_Marker,
369 N_Case_Expression_Alternative,
370 N_Case_Statement_Alternative,
371 N_Compilation_Unit,
372 N_Compilation_Unit_Aux,
373 N_Component_Association,
374 N_Component_Definition,
375 N_Component_List,
376 N_Contract,
377 N_Derived_Type_Definition,
378 N_Decimal_Fixed_Point_Definition,
379 N_Defining_Program_Unit_Name,
380 N_Delta_Constraint,
381 N_Designator,
382 N_Digits_Constraint,
383 N_Discriminant_Association,
384 N_Discriminant_Specification,
385 N_Enumeration_Type_Definition,
386 N_Entry_Body,
387 N_Entry_Call_Alternative,
388 N_Entry_Index_Specification,
389 N_Exception_Declaration,
390 N_Exception_Handler,
391 N_Floating_Point_Definition,
392 N_Formal_Decimal_Fixed_Point_Definition,
393 N_Formal_Derived_Type_Definition,
394 N_Formal_Discrete_Type_Definition,
395 N_Formal_Floating_Point_Definition,
396 N_Formal_Modular_Type_Definition,
397 N_Formal_Ordinary_Fixed_Point_Definition,
398 N_Formal_Package_Declaration,
399 N_Formal_Private_Type_Definition,
400 N_Formal_Incomplete_Type_Definition,
401 N_Formal_Signed_Integer_Type_Definition,
402 N_Freeze_Entity,
403 N_Freeze_Generic_Entity,
404 N_Generic_Association,
405 N_Handled_Sequence_Of_Statements,
406 N_Index_Or_Discriminant_Constraint,
407 N_Iterated_Component_Association,
408 N_Iterated_Element_Association,
409 N_Itype_Reference,
410 N_Label,
411 N_Modular_Type_Definition,
412 N_Number_Declaration,
413 N_Ordinary_Fixed_Point_Definition,
414 N_Others_Choice,
415 N_Package_Specification,
416 N_Parameter_Association,
417 N_Parameter_Specification,
418 N_Pragma,
419 N_Protected_Definition,
420 N_Range_Constraint,
421 N_Real_Range_Specification,
422 N_Record_Definition,
423 N_Signed_Integer_Type_Definition,
424 N_Single_Protected_Declaration,
425 N_Subunit,
426 N_Task_Definition,
427 N_Triggering_Alternative,
428 N_Use_Type_Clause,
429 N_Validate_Unchecked_Conversion,
430 N_Variable_Reference_Marker,
431 N_Variant,
432 N_Variant_Part,
433 N_With_Clause,
434 N_Unused_At_End,
436 -- End of concrete node types.
438 Between_Concrete_Node_And_Concrete_Entity_Types,
440 -- Concrete entity types:
442 E_Void,
443 E_Component,
444 E_Constant,
445 E_Discriminant,
446 E_Loop_Parameter,
447 E_Variable,
448 E_Out_Parameter,
449 E_In_Out_Parameter,
450 E_In_Parameter,
451 E_Generic_In_Out_Parameter,
452 E_Generic_In_Parameter,
453 E_Named_Integer,
454 E_Named_Real,
455 E_Enumeration_Type,
456 E_Enumeration_Subtype,
457 E_Signed_Integer_Type,
458 E_Signed_Integer_Subtype,
459 E_Modular_Integer_Type,
460 E_Modular_Integer_Subtype,
461 E_Ordinary_Fixed_Point_Type,
462 E_Ordinary_Fixed_Point_Subtype,
463 E_Decimal_Fixed_Point_Type,
464 E_Decimal_Fixed_Point_Subtype,
465 E_Floating_Point_Type,
466 E_Floating_Point_Subtype,
467 E_Access_Type,
468 E_Access_Subtype,
469 E_Access_Attribute_Type,
470 E_Allocator_Type,
471 E_General_Access_Type,
472 E_Access_Subprogram_Type,
473 E_Access_Protected_Subprogram_Type,
474 E_Anonymous_Access_Protected_Subprogram_Type,
475 E_Anonymous_Access_Subprogram_Type,
476 E_Anonymous_Access_Type,
477 E_Array_Type,
478 E_Array_Subtype,
479 E_String_Literal_Subtype,
480 E_Class_Wide_Type,
481 E_Class_Wide_Subtype,
482 E_Record_Type,
483 E_Record_Subtype,
484 E_Record_Type_With_Private,
485 E_Record_Subtype_With_Private,
486 E_Private_Type,
487 E_Private_Subtype,
488 E_Limited_Private_Type,
489 E_Limited_Private_Subtype,
490 E_Incomplete_Type,
491 E_Incomplete_Subtype,
492 E_Task_Type,
493 E_Task_Subtype,
494 E_Protected_Type,
495 E_Protected_Subtype,
496 E_Exception_Type,
497 E_Subprogram_Type,
498 E_Enumeration_Literal,
499 E_Function,
500 E_Operator,
501 E_Procedure,
502 E_Abstract_State,
503 E_Entry,
504 E_Entry_Family,
505 E_Block,
506 E_Entry_Index_Parameter,
507 E_Exception,
508 E_Generic_Function,
509 E_Generic_Procedure,
510 E_Generic_Package,
511 E_Label,
512 E_Loop,
513 E_Return_Statement,
514 E_Package,
515 E_Package_Body,
516 E_Protected_Body,
517 E_Task_Body,
518 E_Subprogram_Body
520 -- End of concrete entity types.
522 ); -- Type_Enum
524 subtype Type_Enum is Opt_Type_Enum
525 range Opt_Type_Enum'Succ (No_Type) .. Opt_Type_Enum'Last;
526 -- Enumeration of types -- Opt_Type_Enum without the special null value
527 -- No_Type.
529 subtype Node_Or_Entity_Type is
530 Type_Enum range
531 Type_Enum'Succ (Between_Special_And_Abstract_Node_Types) ..
532 Type_Enum'Last;
534 subtype Abstract_Type is
535 Type_Enum range
536 Type_Enum'Succ (Between_Special_And_Abstract_Node_Types) ..
537 Type_Enum'Pred (Between_Abstract_Entity_And_Concrete_Node_Types);
538 subtype Abstract_Node is
539 Abstract_Type range
540 Type_Enum'Succ (Between_Special_And_Abstract_Node_Types) ..
541 Type_Enum'Pred (Between_Abstract_Node_And_Abstract_Entity_Types);
542 subtype Abstract_Entity is
543 Abstract_Type range
544 Type_Enum'Succ (Between_Abstract_Node_And_Abstract_Entity_Types) ..
545 Type_Enum'Pred (Between_Abstract_Entity_And_Concrete_Node_Types);
547 subtype Concrete_Type is
548 Type_Enum range
549 Type_Enum'Succ (Between_Abstract_Entity_And_Concrete_Node_Types) ..
550 Type_Enum'Last;
551 subtype Concrete_Node is
552 Concrete_Type range
553 Type_Enum'Succ (Between_Abstract_Entity_And_Concrete_Node_Types) ..
554 Type_Enum'Pred (Between_Concrete_Node_And_Concrete_Entity_Types);
555 subtype Concrete_Entity is
556 Concrete_Type range
557 Type_Enum'Succ (Between_Concrete_Node_And_Concrete_Entity_Types) ..
558 Type_Enum'Last;
560 subtype Root_Type is Abstract_Type with
561 Predicate => Root_Type in Node_Kind | Entity_Kind;
563 subtype Node_Type is Node_Or_Entity_Type with
564 Predicate => Node_Type in Abstract_Node | Concrete_Node;
565 subtype Entity_Type is Node_Or_Entity_Type with
566 Predicate => Entity_Type in Abstract_Entity | Concrete_Entity;
568 subtype Special_Type is Type_Enum range
569 Flag .. Type_Enum'Pred (Between_Special_And_Abstract_Node_Types);
571 subtype Traversed_Field_Type is Type_Enum with Predicate =>
572 Traversed_Field_Type in Node_Id | List_Id | Node_Type;
573 -- These are the types of fields traversed by Traverse_Func
575 subtype Entity_Node is Node_Type with
576 Predicate => Entity_Node in
577 N_Defining_Character_Literal
578 | N_Defining_Identifier
579 | N_Defining_Operator_Symbol;
581 subtype Opt_Abstract_Type is Opt_Type_Enum with
582 Predicate => Opt_Abstract_Type in No_Type | Abstract_Type;
584 subtype Type_Boundaries is Type_Enum with
585 Predicate => Type_Boundaries in
586 Between_Abstract_Node_And_Abstract_Entity_Types |
587 Between_Abstract_Entity_And_Concrete_Node_Types |
588 Between_Concrete_Node_And_Concrete_Entity_Types;
589 -- These are not used, other than to separate the various subranges.
591 subtype Uint_Subtype is Type_Enum with
592 Predicate => Uint_Subtype in Valid_Uint | Unat | Upos | Nonzero_Uint;
593 -- These are the subtypes of Uint that have predicates restricting their
594 -- values.
596 end Gen_IL.Types;