aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gen_il-fields.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-02-25 10:38:55 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-15 06:19:16 -0400
commita7cadd18606c9c3ce2776b6f876ca98849b24b84 (patch)
tree73551a1fc7c4fa7738d96349db729d5d2e805f3f /gcc/ada/gen_il-fields.ads
parent81e68a1954366f6b1730d75c932814121d743aa3 (diff)
downloadgcc-a7cadd18606c9c3ce2776b6f876ca98849b24b84.zip
gcc-a7cadd18606c9c3ce2776b6f876ca98849b24b84.tar.gz
gcc-a7cadd18606c9c3ce2776b6f876ca98849b24b84.tar.bz2
[Ada] Variable-sized node types -- cleanup
gcc/ada/ * atree.ads, einfo-utils.ads, einfo-utils.adb, fe.h, gen_il.adb, gen_il.ads, gen_il-gen-gen_entities.adb, gen_il-gen-gen_nodes.adb, sem_ch12.adb, sem_ch3.adb, sem_util.adb, sinfo-utils.ads, treepr.adb, types.ads: Clean up ??? comments and other comments. * atree.adb: Clean up ??? comments and other comments. (Validate_Node): Fix bug: "Off_0 (N) < Off_L (N)" should be "Off_0 (N) <= Off_L (N)". * gen_il-gen.adb, gen_il-gen.ads: Clean up ??? comments and other comments. Add support for getter-specific and setter-specific preconditions. Detect the error of putting a field in the wrong subrange. Misc cleanup. (Node_Field vs. Entity_Field): Clean up Nmake. Improve comments. * gen_il-utils.ads: Misc cleanup. Move... * gen_il-internals.ads: ... here. * gen_il-utils.adb: Misc cleanup. Move... * gen_il-internals.adb: ... here. * gen_il-fields.ads: Move Was_Default_Init_Box_Association, which was in the wrong subrange. Add comments. Misc cleanup. * gen_il-types.ads: Add Named_Access_Kind. * sinfo-cn.adb: Clean up ??? comments and other comments. Remove redundant assertions. * einfo.ads, sinfo.ads: Clean up ??? comments and other comments. Remove all the comments indicating field offsets. These are obsolete now that Gen_IL computes the offsets automatically.
Diffstat (limited to 'gcc/ada/gen_il-fields.ads')
-rw-r--r--gcc/ada/gen_il-fields.ads35
1 files changed, 28 insertions, 7 deletions
diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads
index c26b25e..9c3bf34 100644
--- a/gcc/ada/gen_il-fields.ads
+++ b/gcc/ada/gen_il-fields.ads
@@ -23,11 +23,21 @@
-- --
------------------------------------------------------------------------------
+with Gen_IL.Types;
+
package Gen_IL.Fields is
-- The following is "optional field enumeration" -- i.e. it is Field_Enum
- -- (declared in Gen_IL.Utils) plus the special null value No_Field.
- -- See the spec of Gen_IL.Gen for how to modify this.
+ -- (declared below) plus the special null value No_Field. See the spec of
+ -- Gen_IL.Gen for how to modify this. (Of course, in Ada we have to define
+ -- this backwards from the above conceptual description.)
+
+ -- Note that there are various subranges of this type declared below,
+ -- which might need to be kept in sync when modifying this.
+
+ -- Be sure to put new fields in the appropriate subrange (Field_Enum,
+ -- Node_Header_Field, Node_Field, Entity_Field -- search for comments
+ -- below).
type Opt_Field_Enum is
(No_Field,
@@ -411,6 +421,7 @@ package Gen_IL.Fields is
Uninitialized_Variable,
Used_Operations,
Was_Attribute_Reference,
+ Was_Default_Init_Box_Association,
Was_Expression_Function,
Was_Originally_Stub,
@@ -430,7 +441,6 @@ package Gen_IL.Fields is
Activation_Record_Component,
Actual_Subtype,
Address_Taken,
--- ?? Alias,
Alignment,
Anonymous_Designated_Type,
Anonymous_Masters,
@@ -852,10 +862,8 @@ package Gen_IL.Fields is
Related_Instance,
Related_Type,
Relative_Deadline_Variable,
--- ??? Renamed_Entity,
Renamed_In_Spec,
--- ??? Renamed_Object,
- Renamed_Or_Alias, -- ???Replaces Alias, Renamed_Entity, Renamed_Object
+ Renamed_Or_Alias, -- Shared among Alias, Renamed_Entity, Renamed_Object
Renaming_Map,
Requires_Overriding,
Return_Applies_To,
@@ -913,11 +921,24 @@ package Gen_IL.Fields is
Warnings_Off_Used,
Warnings_Off_Used_Unmodified,
Warnings_Off_Used_Unreferenced,
- Was_Default_Init_Box_Association,
Was_Hidden,
Wrapped_Entity
-- End of entity fields.
); -- Opt_Field_Enum
+ subtype Field_Enum is Opt_Field_Enum
+ range Opt_Field_Enum'Succ (No_Field) .. Opt_Field_Enum'Last;
+ -- Enumeration of fields -- Opt_Field_Enum without the special null value
+ -- No_Field.
+
+ subtype Node_Header_Field is Field_Enum with Predicate =>
+ Node_Header_Field in Nkind .. Link | Ekind;
+
+ use Gen_IL.Types;
+
+ subtype Node_Header_Type is Type_Enum range
+ Node_Kind_Type .. Union_Id;
+ -- Types of node header fields
+
end Gen_IL.Fields;