From a9d8907c2025d9f9d29b96f236166389998a5a99 Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Tue, 15 Mar 2005 16:54:14 +0100 Subject: atree.ads, atree.adb: Add support for Elist24 field 2005-03-08 Javier Miranda Robert Dewar Thomas Quinot Richard Kenner * atree.ads, atree.adb: Add support for Elist24 field * atree.h: Fix wrong definition of Field27 Add support for Elist16 field Add support for Elist24 field * einfo.ads, einfo.adb (Abstract_Interfaces, Set_Abstract_Interfaces): New subprograms. (Abstract_Interface_Alias, Set_Abstract_Interface_Alias): New subprograms. (Access_Disp_Table, Set_Access_Disp_Table): Modified to handle a list of entities rather than a single node. (Is_Interface, Set_Is_Interface): New subprogram (First_Tag_Component): New syntesized attribute (Next_Tag_Component): New synthesized attribute (Write_Entity_Flags): Upgraded to write Is_Interface (Write_Field24_Name): Upgraded to write Abstract_Interfaces (Write_Field25_Name): Upgraded to write Abstract_Interface_Alias (Task_Body_Procedure): New subprogram to read this attribute. (Set_Task_Body_Procedure): New subprogram to set this attribute. (Has_Controlled_Component): Now applies to all entities. This is only a documentation change, since it always worked to apply this to other than composite types (yielding false), but now this is official. Update documentation on Must_Be_Byte_Aligned for new spec * tbuild.adb, exp_dist.adb, exp_disp.adb, exp_ch3.ads, exp_ch3.adb, exp_attr.adb, exp_aggr.adb, exp_ch4.adb, exp_ch5.adb: Upgrade all the uses of the Access_Disp_Table attribute to reference the first dispatch table associated with a tagged type. As part of the implementation of abstract interface types, Access_Disp_Table has been redefined to contain a list of dispatch tables (rather than a single dispatch table). Similarly, upgrade all the references to Tag_Component by the new attribute First_Tag_Component. (Find_Inherited_TSS): Moved to exp_tss. Clean up test in Expand_N_Object_Declaration for cases where we need to do a separate assignment of the initial value. (Expand_N_Object_Declaration): If the expression in the declaration of a tagged type is an aggregate, no need to generate an additional tag assignment. (Freeze_Type): Now a function that returns True if the N_Freeze_Entity is to be deleted. Bit packed array ops are only called if operands are known to be aligned. (Component_Equality): When returning an N_Raise_Program_Error statement, ensure that its Etype is set to Empty to avoid confusing GIGI (which expects that only expressions have a bona fide type). (Make_Tag_Ctrl_Assignment): Use Build_Actual_Subtype to correctly determine the amount of data to be copied. * par.adb (P_Interface_Type_Definition): New subprogram that parses the new syntax rule of Ada 2005 interfaces (for AI-251 and AI-345): INTERFACE_TYPE_DEFINITION ::= [limited | task | protected | synchronized] interface [AND interface_list] * par-ch3.adb (P_Type_Declaration): Modified to give support to interfaces. (P_Derived_Type_Def_Or_Private_Ext_Decl): Modified to give support to interfaces. (P_Interface_Type_Definition): New subprogram that parses the new syntax rule of Ada 2005 interfaces (P_Identifier_Declarations): fix two occurrences of 'RENAMES' in error messages by the correct RENAMES (quotes removed). * sem_prag.adb: Upgrade all the references to Tag_Component by the new attribute First_Tag_Component. * sinfo.ads, sinfo.adb: Remove OK_For_Stream flag, not used, not needed (Interface_List, Set_Interface_List): New subprograms. (Interface_Present, Set_Interface_Present): New subprograms. (Limited_Present, Set_Limited_Present): Available also in derived type definition nodes. (Protected_Present, Set_Protected_Present): Available also in record type definition and derived type definition nodes. (Synchronized_Present, Set_Synchronized_Present): New subprograms. (Task_Present, Set_Task_Present): New subprogram. (Task_Body_Procedure): Removed. (Set_Task_Body_Procedure): Removed. These subprogram have been removed because the attribute Task_Body_Procedure has been moved to the corresponding task type or task subtype entity to leave a field free to store the list of interfaces implemented by a task (for AI-345) Add Expression field to N_Raise_Statement node for Ada 2005 AI-361 (Null_Exclusion_Present): Change to Flag11, to avoid conflict with expression flag Do_Range_Check (Exception_Junk): Change to Flag7 to accomodate above change (Box_Present, Default_Name, Specification, Set_Box_Present, Set_Default_Name, Set_Specification): Expand the expression "X in N_Formal_Subprogram_Declaration" into the corresponding two comparisons. Required to use the csinfo tool. * exp_ch11.adb (Expand_N_Raise_Statement): Deal with case where "with string" given. * sem_ch11.adb (Analyze_Raise_Statement): Handle case where string expression given. * par-ch11.adb (P_Raise_Statement): Recognize with string expression in 2005 mode * exp_ch9.adb (Build_Task_Proc_Specification): Modified to use entity attribute Task_Body_Procedure rather than the old semantic field that was available in the task_type_declaration node. * par-ch12.adb (P_Formal_Type_Definition): Modified to handle formal interface type definitions. (P_Formal_Derived_Type_Definition): Modified to handle the list of interfaces. * par-ch9.adb (P_Task): Modified to handle the list of interfaces in a task type declaration. (P_Protected): Modified to handle the list of interfaces in a protected type declaration. From-SVN: r96489 --- gcc/ada/atree.ads | 152 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 68 deletions(-) (limited to 'gcc/ada/atree.ads') diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads index 8b08b52..3093104 100644 --- a/gcc/ada/atree.ads +++ b/gcc/ada/atree.ads @@ -75,62 +75,73 @@ package Atree is -- a node contains a number of fields, much as though the nodes were -- defined as a record type. The fields in a node are as follows: - -- Nkind Indicates the kind of the node. This field is present - -- in all nodes. The type is Node_Kind, which is declared - -- in the package Sinfo. + -- Nkind Indicates the kind of the node. This field is present + -- in all nodes. The type is Node_Kind, which is declared + -- in the package Sinfo. - -- Sloc Location (Source_Ptr) of the corresponding token - -- in the Source buffer. The individual node definitions - -- show which token is referenced by this pointer. + -- Sloc Location (Source_Ptr) of the corresponding token + -- in the Source buffer. The individual node definitions + -- show which token is referenced by this pointer. - -- In_List A flag used to indicate if the node is a member + -- In_List A flag used to indicate if the node is a member -- of a node list. - -- Rewrite_Sub A flag set if the node has been rewritten using - -- the Rewrite procedure. The original value of the - -- node is retrievable with Original_Node. + -- Rewrite_Sub A flag set if the node has been rewritten using + -- the Rewrite procedure. The original value of the + -- node is retrievable with Original_Node. - -- Rewrite_Ins A flag set if a node is marked as a rewrite inserted - -- node as a result of a call to Mark_Rewrite_Insertion. + -- Rewrite_Ins A flag set if a node is marked as a rewrite inserted + -- node as a result of a call to Mark_Rewrite_Insertion. - -- Paren_Count A 2-bit count used on expression nodes to indicate - -- the level of parentheses. Up to 3 levels can be - -- accomodated. Anything more than 3 levels is treated - -- as 3 levels (conformance tests that complain about - -- this are hereby deemed pathological!) Set to zero - -- for non-subexpression nodes. + -- Paren_Count A 2-bit count used on expression nodes to indicate + -- the level of parentheses. Up to 3 levels can be + -- accomodated. Anything more than 3 levels is treated + -- as 3 levels (conformance tests that complain about + -- this are hereby deemed pathological!) Set to zero + -- for non-subexpression nodes. -- Comes_From_Source - -- This flag is present in all nodes. It is set if the - -- node is built by the scanner or parser, and clear if - -- the node is built by the analyzer or expander. It - -- indicates that the node corresponds to a construct - -- that appears in the original source program. - - -- Analyzed This flag is present in all nodes. It is set when - -- a node is analyzed, and is used to avoid analyzing - -- the same node twice. Analysis includes expansion if - -- expansion is active, so in this case if the flag is - -- set it means the node has been analyzed and expanded. - - -- Error_Posted This flag is present in all nodes. It is set when - -- an error message is posted which is associated with - -- the flagged node. This is used to avoid posting more - -- than one message on the same node. + -- This flag is present in all nodes. It is set if the + -- node is built by the scanner or parser, and clear if + -- the node is built by the analyzer or expander. It + -- indicates that the node corresponds to a construct + -- that appears in the original source program. + + -- Analyzed This flag is present in all nodes. It is set when + -- a node is analyzed, and is used to avoid analyzing + -- the same node twice. Analysis includes expansion if + -- expansion is active, so in this case if the flag is + -- set it means the node has been analyzed and expanded. + + -- Error_Posted This flag is present in all nodes. It is set when + -- an error message is posted which is associated with + -- the flagged node. This is used to avoid posting more + -- than one message on the same node. -- Field1 -- Field2 -- Field3 -- Field4 - -- Field5 Five fields holding Union_Id values - - -- ElistN Synonym for FieldN typed as Elist_Id - -- ListN Synonym for FieldN typed as List_Id - -- NameN Synonym for FieldN typed as Name_Id - -- NodeN Synonym for FieldN typed as Node_Id - -- StrN Synonym for FieldN typed as String_Id - -- UintN Synonym for FieldN typed as Uint (Empty = Uint_0) - -- UrealN Synonym for FieldN typed as Ureal + -- Field5 Five fields holding Union_Id values + + -- ElistN Synonym for FieldN typed as Elist_Id (Empty = No_Elist) + -- ListN Synonym for FieldN typed as List_Id + -- NameN Synonym for FieldN typed as Name_Id + -- NodeN Synonym for FieldN typed as Node_Id + -- StrN Synonym for FieldN typed as String_Id + -- UintN Synonym for FieldN typed as Uint (Empty = Uint_0) + -- UrealN Synonym for FieldN typed as Ureal + + -- Note: in the case of ElistN and UintN fields, it is common that we + -- end up with a value of Union_Id'(0) as the default value. This value + -- is meaningless as a Uint or Elist_Id value. We have two choices here. + -- We could require that all Uint and Elist fields be initialized to an + -- appropriate value, but that's error prone, since it would be easy to + -- miss an initialization. So instead we have the retrieval functions + -- generate an appropriate default value (Uint_0 or No_Elist). Probably + -- it would be cleaner to generate No_Uint in the Uint case but we got + -- stuck with representing an "unset" size value as zero early on, and + -- it will take a bit of fiddling to change that ??? -- Note: the actual usage of FieldN (i.e. whether it contains a Elist_Id, -- List_Id, Name_Id, Node_Id, String_Id, Uint or Ureal), depends on the @@ -146,46 +157,46 @@ package Atree is -- it is useful to be able to do untyped traversals, and an internal -- package in Atree allows for direct untyped accesses in such cases. - -- Flag4 Fifteen Boolean flags (use depends on Nkind and - -- Flag5 Ekind, as described for FieldN). Again the access - -- Flag6 is usually via subprograms in Sinfo and Einfo which - -- Flag7 provide high-level synonyms for these flags, and - -- Flag8 contain debugging code that checks that the values - -- Flag9 in Nkind and Ekind are appropriate for the access. + -- Flag4 Fifteen Boolean flags (use depends on Nkind and + -- Flag5 Ekind, as described for FieldN). Again the access + -- Flag6 is usually via subprograms in Sinfo and Einfo which + -- Flag7 provide high-level synonyms for these flags, and + -- Flag8 contain debugging code that checks that the values + -- Flag9 in Nkind and Ekind are appropriate for the access. -- Flag10 - -- Flag11 Note that Flag1-3 are missing from this list. The - -- Flag12 first three flag positions are reserved for the - -- Flag13 standard flags (Comes_From_Source, Error_Posted, - -- Flag14 and Analyzed) + -- Flag11 Note that Flag1-3 are missing from this list. The + -- Flag12 first three flag positions are reserved for the + -- Flag13 standard flags (Comes_From_Source, Error_Posted, + -- Flag14 and Analyzed) -- Flag15 -- Flag16 -- Flag17 -- Flag18 - -- Link For a node, points to the Parent. For a list, points - -- to the list header. Note that in the latter case, a - -- client cannot modify the link field. This field is - -- private to the Atree package (but is also modified - -- by the Nlists package). + -- Link For a node, points to the Parent. For a list, points + -- to the list header. Note that in the latter case, a + -- client cannot modify the link field. This field is + -- private to the Atree package (but is also modified + -- by the Nlists package). -- The following additional fields are present in extended nodes used -- for entities (Nkind in N_Entity). - -- Ekind Entity type. This field indicates the type of the - -- entity, it is of type Entity_Kind which is defined - -- in package Einfo. + -- Ekind Entity type. This field indicates the type of the + -- entity, it is of type Entity_Kind which is defined + -- in package Einfo. - -- Flag19 197 additional flags + -- Flag19 197 additional flags -- ... -- Flag215 - -- Convention Entity convention (Convention_Id value) + -- Convention Entity convention (Convention_Id value) - -- Field6 Additional Union_Id value stored in tree + -- Field6 Additional Union_Id value stored in tree - -- Node6 Synonym for Field6 typed as Node_Id - -- Elist6 Synonym for Field6 typed as Elist_Id - -- Uint6 Synonym for Field6 typed as Uint (Empty = Uint_0) + -- Node6 Synonym for Field6 typed as Node_Id + -- Elist6 Synonym for Field6 typed as Elist_Id (Empty = No_Elist) + -- Uint6 Synonym for Field6 typed as Uint (Empty = Uint_0) -- Similar definitions for Field7 to Field27 (and Node7-Node27, -- Elist7-Elist27, Uint7-Uint27, Ureal7-Ureal27). Note that not all @@ -981,6 +992,9 @@ package Atree is function Elist23 (N : Node_Id) return Elist_Id; pragma Inline (Elist23); + function Elist24 (N : Node_Id) return Elist_Id; + pragma Inline (Elist24); + function Name1 (N : Node_Id) return Name_Id; pragma Inline (Name1); @@ -1903,6 +1917,9 @@ package Atree is procedure Set_Elist23 (N : Node_Id; Val : Elist_Id); pragma Inline (Set_Elist23); + procedure Set_Elist24 (N : Node_Id; Val : Elist_Id); + pragma Inline (Set_Elist24); + procedure Set_Name1 (N : Node_Id; Val : Name_Id); pragma Inline (Set_Name1); @@ -2602,7 +2619,6 @@ package Atree is procedure Set_Flag215 (N : Node_Id; Val : Boolean); pragma Inline (Set_Flag215); - -- The following versions of Set_Noden also set the parent -- pointer of the referenced node if it is non_Empty -- cgit v1.1