https://gcc.gnu.org/g:64bb8c8b59f98ff0faa1b61f54ffbd18dd8304c5

commit r16-1216-g64bb8c8b59f98ff0faa1b61f54ffbd18dd8304c5
Author: Eric Botcazou <ebotca...@adacore.com>
Date:   Fri Feb 14 12:31:33 2025 +0100

    ada: Remove more unused fields from entities
    
    This removes 5 more unused fields from entities, as well as 1 flag.
    
    gcc/ada/ChangeLog:
    
            * einfo.ads (Default_Expr_Function): Delete.
            (Dependent_Instances): Likewise.
            (Handler_Records): Likewise.
            (Needs_Activation_Record): Likewise.
            (Original_Access_Type): Likewise.
            (Register_Exception_Call): Likewise.
            * sinfo.ads (Accept_Handler_Records): Likewise.
            * gen_il-fields.ads (Opt_Field_Enum): Remove Accept_Handler_Records,
            Default_Expr_Function, Dependent_Instances, Handler_Records,
            Needs_Activation_Record, Original_Access_Type and
            Register_Exception_Call.
            * gen_il-gen-gen_entities.adb: Adjust accordingly.
            * gen_il-gen-gen_nodes.adb: Likewise.
            * exp_ch9.adb (Expand_Access_Protected_Subprogram_Type): Remove call
            to Set_Original_Access_Type.
            (Expand_N_Selective_Accept): Remove call to Set_Handler_Records.
            * exp_ch11.adb (Expand_N_Exception_Declaration): Remove call to
            Set_Register_Exception_Call.
            * sem_ch3.adb (Access_Subprogram_Declaration): Remove call to
            Set_Needs_Activation_Record.
            * sem_ch12.adb (Instantiate_Package_Body): Remove call to
            Set_Handler_Records.

Diff:
---
 gcc/ada/einfo.ads                   | 47 -------------------------------------
 gcc/ada/exp_ch11.adb                |  2 --
 gcc/ada/exp_ch9.adb                 | 14 -----------
 gcc/ada/gen_il-fields.ads           |  7 ------
 gcc/ada/gen_il-gen-gen_entities.adb | 13 +---------
 gcc/ada/gen_il-gen-gen_nodes.adb    |  3 +--
 gcc/ada/sem_ch12.adb                |  4 ----
 gcc/ada/sem_ch3.adb                 |  8 -------
 gcc/ada/sinfo.ads                   |  9 -------
 9 files changed, 2 insertions(+), 105 deletions(-)

diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 7a7765d1272d..152a8b296a0f 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -832,12 +832,6 @@ package Einfo is
 --       Default_Value aspect specification for the type, or inherited
 --       on derivation.
 
---    Default_Expr_Function
---       Defined in parameters. It holds the entity of the parameterless
---       function that is built to evaluate the default expression if it is
---       more complex than a simple identifier or literal. For the latter
---       simple cases or if there is no default value, this field is Empty.
-
 --    Default_Expressions_Processed
 --       A flag in subprograms (functions, operators, procedures) and in
 --       entries and entry families used to indicate that default expressions
@@ -864,12 +858,6 @@ package Einfo is
 --       that holds value of delta for the type, as given in the declaration
 --       or as inherited by a subtype or derived type.
 
---    Dependent_Instances
---       Defined in packages that are instances. Holds list of instances
---       of inner generics. Used to place freeze nodes for those instances
---       after that of the current one, i.e. after the corresponding generic
---       bodies.
-
 --    Depends_On_Private
 --       Defined in all type entities. Set if the type is private or if it
 --       depends on a private type.
@@ -1462,11 +1450,6 @@ package Einfo is
 --       associates generic parameters with the corresponding instances, in
 --       those cases where the instance is an entity.
 
---    Handler_Records
---       Defined in subprogram and package entities. Points to a list of
---       identifiers referencing the handler record entities for the
---       corresponding unit.
-
 --    Has_Aliased_Components [implementation base type only]
 --       Defined in array type entities. Indicates that the component type
 --       of the array is aliased. Should this also be set for records to
@@ -3663,11 +3646,6 @@ package Einfo is
 --       preelaborable initialization at freeze time (this has to be deferred
 --       to the freeze point because of the rule about overriding Initialize).
 
---    Needs_Activation_Record
---       Defined on generated subprogram types. Indicates that a call through
---       a named or anonymous access to subprogram requires an activation
---       record when compiling with unnesting for C or LLVM.
-
 --    Needs_Debug_Info
 --       Defined in all entities. Set if the entity requires normal debugging
 --       information to be generated. This is true of all entities that have
@@ -3905,12 +3883,6 @@ package Einfo is
 --       Optimize_Alignment (Off) mode applies to the type/object, then neither
 --       of the flags Optimize_Alignment_Space/Optimize_Alignment_Time is set.
 
---    Original_Access_Type
---       Defined in E_Access_Subprogram_Type entities. Set only if the access
---       type was generated by the expander as part of processing an access-
---       to-protected-subprogram type. Points to the access-to-protected-
---       subprogram type.
-
 --    Original_Array_Type
 --       Defined in modular types and array types and subtypes. Set only if
 --       the Is_Packed_Array_Impl_Type flag is set, indicating that the type
@@ -4181,14 +4153,6 @@ package Einfo is
 --       refine the state, in other words, all the hidden states that appear in
 --       the constituent_list of aspect/pragma Refined_State.
 
---    Register_Exception_Call
---       Defined in exception entities. When an exception is declared,
---       a call is expanded to Register_Exception. This field points to
---       the expanded N_Procedure_Call_Statement node for this call. It
---       is used for Import/Export_Exception processing to modify the
---       register call to make appropriate entries in the special tables
---       used for handling these pragmas at run time.
-
 --    Related_Array_Object
 --       Defined in array types and subtypes. Used only for the base type
 --       and subtype created for an anonymous array object. Set to point
@@ -5159,9 +5123,7 @@ package Einfo is
    --    Equivalent_Type                       (remote types only)
    --    Directly_Designated_Type
    --    Needs_No_Actuals
-   --    Original_Access_Type
    --    Can_Use_Internal_Rep
-   --    Needs_Activation_Record
    --    Associated_Storage_Pool $$$
    --    Interface_Name $$$
    --    (plus type attributes)
@@ -5200,7 +5162,6 @@ package Einfo is
    --    Directly_Designated_Type
    --    Storage_Size_Variable                 is this needed ???
    --    Can_Use_Internal_Rep
-   --    Needs_Activation_Record
    --    (plus type attributes)
 
    --  E_Anonymous_Access_Type
@@ -5471,7 +5432,6 @@ package Einfo is
    --    Esize
    --    Alignment
    --    Renamed_Entity
-   --    Register_Exception_Call
    --    Interface_Name
    --    Activation_Record_Component
    --    Discard_Names
@@ -5507,7 +5467,6 @@ package Einfo is
    --  E_Function
    --  E_Generic_Function
    --    Mechanism                            (Mechanism_Type)
-   --    Handler_Records                      (non-generic case only)
    --    Protected_Body_Subprogram
    --    Next_Inlined_Subprogram
    --    Elaboration_Entity                   (not implicit /=)
@@ -5661,7 +5620,6 @@ package Einfo is
    --    Renamed_Object
    --    Spec_Entity
    --    Default_Value
-   --    Default_Expr_Function
    --    Protected_Formal
    --    Extra_Constrained
    --    Minimum_Accessibility
@@ -5772,8 +5730,6 @@ package Einfo is
 
    --  E_Package
    --  E_Generic_Package
-   --    Dependent_Instances                  (for an instance)
-   --    Handler_Records                      (non-generic case only)
    --    Generic_Homonym                      (generic case only)
    --    Associated_Formal_Package
    --    Elaboration_Entity
@@ -5833,7 +5789,6 @@ package Einfo is
    --    Scope_Depth                          (synth)
 
    --  E_Package_Body
-   --    Handler_Records                      (non-generic case only)
    --    Related_Instance                     (non-generic case only)
    --    First_Entity
    --    Spec_Entity
@@ -5868,7 +5823,6 @@ package Einfo is
    --  E_Procedure
    --  E_Generic_Procedure
    --    Associated_Node_For_Itype $$$ E_Procedure
-   --    Handler_Records                      (non-generic case only)
    --    Protected_Body_Subprogram
    --    Next_Inlined_Subprogram
    --    Elaboration_Entity
@@ -6267,7 +6221,6 @@ package Einfo is
    --    Entry_Formal $$$
    --    Esize $$$
    --    First_Entity $$$
-   --    Handler_Records $$$
    --    Interface_Name $$$
    --    Last_Entity $$$
    --    Renamed_Entity $$$
diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb
index a0dbcad83306..b00e75edb2f1 100644
--- a/gcc/ada/exp_ch11.adb
+++ b/gcc/ada/exp_ch11.adb
@@ -1194,8 +1194,6 @@ package body Exp_Ch11 is
                    Prefix         => New_Occurrence_Of (Id, Loc),
                    Attribute_Name => Name_Unrestricted_Access)))));
 
-         Set_Register_Exception_Call (Id, First (L));
-
          if not Is_Library_Level_Entity (Id) then
             Flag_Id :=
               Make_Defining_Identifier (Loc,
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index dd59af970f56..39ad2b10846b 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -5746,12 +5746,6 @@ package body Exp_Ch9 is
 
       Insert_Before_And_Analyze (N, Decl1);
 
-      --  Associate the access to subprogram with its original access to
-      --  protected subprogram type. Needed by the backend to know that this
-      --  type corresponds with an access to protected subprogram type.
-
-      Set_Original_Access_Type (D_T2, T);
-
       --  Create Equivalent_Type, a record with two components for an access to
       --  object and an access to subprogram.
 
@@ -10595,14 +10589,6 @@ package body Exp_Ch9 is
                   Build_Accept_Body (Accept_Statement (Alt)));
 
             Reset_Scopes_To (Proc_Body, PB_Ent);
-
-            --  During the analysis of the body of the accept statement, any
-            --  zero cost exception handler records were collected in the
-            --  Accept_Handler_Records field of the N_Accept_Alternative node.
-            --  This is where we move them to where they belong, namely the
-            --  newly created procedure.
-
-            Set_Handler_Records (PB_Ent, Accept_Handler_Records (Alt));
             Append (Proc_Body, Body_List);
 
          else
diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads
index f957f7f64327..0092a5728c66 100644
--- a/gcc/ada/gen_il-fields.ads
+++ b/gcc/ada/gen_il-fields.ads
@@ -56,7 +56,6 @@ package Gen_IL.Fields is
       Abort_Present,
       Abortable_Part,
       Abstract_Present,
-      Accept_Handler_Records,
       Accept_Statement,
       Access_Definition,
       Access_To_Subprogram_Definition,
@@ -487,12 +486,10 @@ package Gen_IL.Fields is
       Debug_Renaming_Link,
       Default_Aspect_Component_Value,
       Default_Aspect_Value,
-      Default_Expr_Function,
       Default_Expressions_Processed,
       Default_Value,
       Delay_Cleanups,
       Delta_Value,
-      Dependent_Instances,
       Depends_On_Private,
       Derived_Type_Link,
       Digits_Value,
@@ -553,7 +550,6 @@ package Gen_IL.Fields is
       Full_View,
       Generic_Homonym,
       Generic_Renamings,
-      Handler_Records,
       Has_Aliased_Components,
       Has_Alignment_Clause,
       Has_All_Calls_Remote,
@@ -823,7 +819,6 @@ package Gen_IL.Fields is
       Modulus,
       Must_Be_On_Byte_Boundary,
       Must_Have_Preelab_Init,
-      Needs_Activation_Record,
       Needs_Debug_Info,
       Needs_No_Actuals,
       Never_Set_In_Source,
@@ -844,7 +839,6 @@ package Gen_IL.Fields is
       OK_To_Rename,
       Optimize_Alignment_Space,
       Optimize_Alignment_Time,
-      Original_Access_Type,
       Original_Array_Type,
       Original_Protected_Subprogram,
       Original_Record_Component,
@@ -871,7 +865,6 @@ package Gen_IL.Fields is
       Referenced_As_LHS,
       Referenced_As_Out_Parameter,
       Refinement_Constituents,
-      Register_Exception_Call,
       Related_Array_Object,
       Related_Expression,
       Related_Instance,
diff --git a/gcc/ada/gen_il-gen-gen_entities.adb 
b/gcc/ada/gen_il-gen-gen_entities.adb
index 85ab62a0af73..86e3f39f6d38 100644
--- a/gcc/ada/gen_il-gen-gen_entities.adb
+++ b/gcc/ada/gen_il-gen-gen_entities.adb
@@ -212,7 +212,6 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (Low_Bound_Tested, Flag),
         Sm (Materialize_Entity, Flag),
         Sm (May_Inherit_Delayed_Rep_Aspects, Flag),
-        Sm (Needs_Activation_Record, Flag),
         Sm (Needs_Debug_Info, Flag),
         Sm (Never_Set_In_Source, Flag),
         Sm (Overlays_Constant, Flag),
@@ -288,7 +287,6 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (Extra_Formal, Node_Id),
         Sm (Generic_Homonym, Node_Id),
         Sm (Generic_Renamings, Elist_Id),
-        Sm (Handler_Records, List_Id),
         Sm (Has_Static_Discriminants, Flag),
         Sm (Inner_Instances, Elist_Id),
         Sm (Interface_Name, Node_Id),
@@ -398,7 +396,6 @@ begin -- Gen_IL.Gen.Gen_Entities
        (Sm (Activation_Record_Component, Node_Id),
         Sm (Actual_Subtype, Node_Id),
         Sm (Alignment, Unat),
-        Sm (Default_Expr_Function, Node_Id),
         Sm (Default_Value, Node_Id),
         Sm (Entry_Component, Node_Id),
         Sm (Extra_Accessibility, Node_Id),
@@ -680,8 +677,7 @@ begin -- Gen_IL.Gen.Gen_Entities
    Cc (E_Access_Subprogram_Type, Access_Subprogram_Kind,
        --  An access-to-subprogram type, created by an access-to-subprogram
        --  declaration.
-       (Sm (Equivalent_Type, Node_Id),
-        Sm (Original_Access_Type, Node_Id)));
+       (Sm (Equivalent_Type, Node_Id)));
 
    Ab (Access_Protected_Kind, Access_Subprogram_Kind,
        (Sm (Equivalent_Type, Node_Id)));
@@ -1004,7 +1000,6 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (DTC_Entity, Node_Id),
         Sm (Extra_Accessibility_Of_Result, Node_Id),
         Sm (Generic_Renamings, Elist_Id),
-        Sm (Handler_Records, List_Id),
         Sm (Has_Missing_Return, Flag),
         Sm (Inner_Instances, Elist_Id),
         Sm (Is_Called, Flag),
@@ -1048,7 +1043,6 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (DTC_Entity, Node_Id),
         Sm (Entry_Parameters_Type, Node_Id),
         Sm (Generic_Renamings, Elist_Id),
-        Sm (Handler_Records, List_Id),
         Sm (Inner_Instances, Elist_Id),
         Sm (Is_Asynchronous, Flag),
         Sm (Is_Called, Flag),
@@ -1167,7 +1161,6 @@ begin -- Gen_IL.Gen.Gen_Entities
        (Sm (Alignment, Unat),
         Sm (Interface_Name, Node_Id),
         Sm (Is_Raised, Flag),
-        Sm (Register_Exception_Call, Node_Id),
         Sm (Renamed_Or_Alias, Node_Id)));
 
    Ab (Generic_Unit_Kind, Entity_Kind,
@@ -1256,8 +1249,6 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (Body_Needed_For_SAL, Flag),
         Sm (Contract, Node_Id),
         Sm (Current_Use_Clause, Node_Id),
-        Sm (Dependent_Instances, Elist_Id,
-            Pre => "Is_Generic_Instance (N)"),
         Sm (Elaborate_Body_Desirable, Flag),
         Sm (Elaboration_Entity, Node_Id),
         Sm (Elaboration_Entity_Required, Flag),
@@ -1265,7 +1256,6 @@ begin -- Gen_IL.Gen.Gen_Entities
         Sm (First_Entity, Node_Id),
         Sm (First_Private_Entity, Node_Id),
         Sm (Generic_Renamings, Elist_Id),
-        Sm (Handler_Records, List_Id),
         Sm (Has_RACW, Flag),
         Sm (Hidden_In_Formal_Instance, Elist_Id),
         Sm (Ignore_SPARK_Mode_Pragmas, Flag),
@@ -1297,7 +1287,6 @@ begin -- Gen_IL.Gen.Gen_Entities
        (Sm (Contract, Node_Id),
         Sm (Finalizer, Node_Id),
         Sm (First_Entity, Node_Id),
-        Sm (Handler_Records, List_Id),
         Sm (Ignore_SPARK_Mode_Pragmas, Flag),
         Sm (Last_Entity, Node_Id),
         Sm (Related_Instance, Node_Id),
diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb
index eb035361b570..5fe91a366e58 100644
--- a/gcc/ada/gen_il-gen-gen_nodes.adb
+++ b/gcc/ada/gen_il-gen-gen_nodes.adb
@@ -1030,8 +1030,7 @@ begin -- Gen_IL.Gen.Gen_Nodes
        (Sy (Accept_Statement, Node_Id),
         Sy (Condition, Node_Id, Default_Empty),
         Sy (Statements, List_Id, Default_Empty_List),
-        Sy (Pragmas_Before, List_Id, Default_No_List),
-        Sm (Accept_Handler_Records, List_Id)));
+        Sy (Pragmas_Before, List_Id, Default_No_List)));
 
    Cc (N_Delay_Alternative, Node_Kind,
        (Sy (Delay_Statement, Node_Id),
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index d961f0306c26..6252b20309d8 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -13034,10 +13034,6 @@ package body Sem_Ch12 is
            Make_Defining_Identifier (Sloc (Act_Decl_Id), Chars (Act_Decl_Id));
          Preserve_Comes_From_Source (Act_Body_Id, Act_Decl_Id);
 
-         --  Some attributes of spec entity are not inherited by body entity
-
-         Set_Handler_Records (Act_Body_Id, No_List);
-
          if Nkind (Defining_Unit_Name (Act_Spec)) =
                                            N_Defining_Program_Unit_Name
          then
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 80359e5b68ee..d47e3711e591 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -1308,14 +1308,6 @@ package body Sem_Ch3 is
       Reinit_Size_Align            (T_Name);
       Set_Directly_Designated_Type (T_Name, Desig_Type);
 
-      --  If the access_to_subprogram is not declared at the library level,
-      --  it can only point to subprograms that are at the same or deeper
-      --  accessibility level. The corresponding subprogram type might
-      --  require an activation record when compiling for C.
-
-      Set_Needs_Activation_Record  (Desig_Type,
-                                      not Is_Library_Level_Entity (T_Name));
-
       Generate_Reference_To_Formals (T_Name);
 
       --  Ada 2005 (AI-231): Propagate the null-excluding attribute
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index d22f1030d427..d7b3c0fde88e 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -737,14 +737,6 @@ package Sinfo is
    --  section describes the usage of the semantic fields, which are used to
    --  contain additional information determined during semantic analysis.
 
-   --  Accept_Handler_Records
-   --    This field is present only in an N_Accept_Alternative node. It is used
-   --    to temporarily hold the exception handler records from an accept
-   --    statement in a selective accept. These exception handlers will
-   --    eventually be placed in the Handler_Records list of the procedure
-   --    built for this accept (see Expand_N_Selective_Accept procedure in
-   --    Exp_Ch9 for further details).
-
    --  Access_Types_To_Process
    --    Present in N_Freeze_Entity nodes for Incomplete or private types.
    --    Contains the list of access types which may require specific treatment
@@ -6381,7 +6373,6 @@ package Sinfo is
       --  Condition from the guard (set to Empty if no guard present)
       --  Statements (set to Empty_List if no statements)
       --  Pragmas_Before pragmas before alt (set to No_List if none)
-      --  Accept_Handler_Records
 
       ------------------------------
       -- 9.7.1  Delay Alternative --

Reply via email to