1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- G E N _ I L . T Y P E S --
9 -- Copyright (C) 2020-2023, Free Software Foundation, Inc. --
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. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
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).
49 -- We use Flag for Boolean, so we don't conflict with
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
67 Small_Paren_Count_Type
,
71 Component_Alignment_Kind
,
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
,
81 N_Array_Type_Definition
,
89 N_Formal_Subprogram_Declaration
,
90 N_Generic_Declaration
,
91 N_Generic_Instantiation
,
92 N_Generic_Renaming_Declaration
,
100 N_Is_Exception_Choice
,
103 N_Multiplying_Operator
,
106 N_Numeric_Or_String_Literal
,
114 N_Push_Pop_xxx_Label
,
116 N_Renaming_Declaration
,
117 N_Representation_Clause
,
120 N_Statement_Other_Than_Procedure_Call
,
122 N_Subprogram_Instantiation
,
124 N_Subprogram_Specification
,
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
136 Access_Subprogram_Kind
,
137 Access_Protected_Kind
,
140 Anonymous_Access_Kind
,
146 Concurrent_Body_Kind
,
147 Constant_Or_Variable_Kind
,
148 Decimal_Fixed_Point_Kind
,
151 Discrete_Or_Fixed_Point_Kind
,
156 Exception_Or_Object_Kind
,
161 Generic_Subprogram_Kind
,
165 Incomplete_Or_Private_Kind
,
167 Modular_Integer_Kind
,
172 Ordinary_Fixed_Point_Kind
,
182 Subprogram_Type_Or_Kind
,
188 -- End of abstract entity types.
190 Between_Abstract_Entity_And_Concrete_Node_Types
,
192 -- Concrete node types:
197 N_Enumeration_Representation_Clause
,
199 N_Record_Representation_Clause
,
200 N_Attribute_Definition_Clause
,
202 N_Pragma_Argument_Association
,
204 N_Defining_Character_Literal
,
205 N_Defining_Identifier
,
206 N_Defining_Operator_Symbol
,
232 N_Op_Shift_Right_Arithmetic
,
237 N_Attribute_Reference
,
243 N_Procedure_Call_Statement
,
244 N_Raise_Constraint_Error
,
245 N_Raise_Program_Error
,
246 N_Raise_Storage_Error
,
250 N_Explicit_Dereference
,
251 N_Expression_With_Actions
,
254 N_Interpolated_String_Literal
,
256 N_Qualified_Expression
,
257 N_Quantified_Expression
,
262 N_Extension_Aggregate
,
266 N_Selected_Component
,
270 N_Unchecked_Expression
,
271 N_Unchecked_Type_Conversion
,
272 N_Subtype_Indication
,
273 N_Component_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
,
293 N_Protected_Body_Stub
,
294 N_Subprogram_Body_Stub
,
296 N_Function_Instantiation
,
297 N_Procedure_Instantiation
,
298 N_Package_Instantiation
,
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
,
321 N_Assignment_Statement
,
322 N_Asynchronous_Select
,
326 N_Compound_Statement
,
327 N_Conditional_Entry_Call
,
328 N_Delay_Relative_Statement
,
329 N_Delay_Until_Statement
,
330 N_Entry_Call_Statement
,
333 N_Goto_When_Statement
,
337 N_Raise_When_Statement
,
339 N_Simple_Return_Statement
,
340 N_Extended_Return_Statement
,
341 N_Return_When_Statement
,
346 N_Accept_Alternative
,
349 N_Entry_Body_Formal_Part
,
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
,
364 N_Abstract_Subprogram_Declaration
,
366 N_Access_To_Object_Definition
,
367 N_Aspect_Specification
,
369 N_Case_Expression_Alternative
,
370 N_Case_Statement_Alternative
,
372 N_Compilation_Unit_Aux
,
373 N_Component_Association
,
374 N_Component_Definition
,
377 N_Derived_Type_Definition
,
378 N_Decimal_Fixed_Point_Definition
,
379 N_Defining_Program_Unit_Name
,
383 N_Discriminant_Association
,
384 N_Discriminant_Specification
,
385 N_Enumeration_Type_Definition
,
387 N_Entry_Call_Alternative
,
388 N_Entry_Index_Specification
,
389 N_Exception_Declaration
,
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
,
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
,
411 N_Modular_Type_Definition
,
412 N_Number_Declaration
,
413 N_Ordinary_Fixed_Point_Definition
,
415 N_Package_Specification
,
416 N_Parameter_Association
,
417 N_Parameter_Specification
,
419 N_Protected_Definition
,
421 N_Real_Range_Specification
,
423 N_Signed_Integer_Type_Definition
,
424 N_Single_Protected_Declaration
,
427 N_Triggering_Alternative
,
429 N_Validate_Unchecked_Conversion
,
430 N_Variable_Reference_Marker
,
436 -- End of concrete node types.
438 Between_Concrete_Node_And_Concrete_Entity_Types
,
440 -- Concrete entity types:
451 E_Generic_In_Out_Parameter
,
452 E_Generic_In_Parameter
,
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
,
469 E_Access_Attribute_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
,
479 E_String_Literal_Subtype
,
481 E_Class_Wide_Subtype
,
484 E_Record_Type_With_Private
,
485 E_Record_Subtype_With_Private
,
488 E_Limited_Private_Type
,
489 E_Limited_Private_Subtype
,
491 E_Incomplete_Subtype
,
498 E_Enumeration_Literal
,
506 E_Entry_Index_Parameter
,
520 -- End of concrete entity types.
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
529 subtype Node_Or_Entity_Type
is
531 Type_Enum
'Succ (Between_Special_And_Abstract_Node_Types
) ..
534 subtype Abstract_Type
is
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
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
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
549 Type_Enum
'Succ (Between_Abstract_Entity_And_Concrete_Node_Types
) ..
551 subtype Concrete_Node
is
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
557 Type_Enum
'Succ (Between_Concrete_Node_And_Concrete_Entity_Types
) ..
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