From 7a6df736e18e551e04aa85ba9e6ed6ea93a71374 Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Thu, 9 Oct 2025 10:12:24 -0400 Subject: [PATCH] ada: Get rid of unused node/entity fields (neither set nor get) The following fields are not used in GNAT nor in any of its clients. Neither the setters nor the getters are called. Node fields: Do_Storage_Check Enclosing_Variant Handler_List_Entry Is_Subprogram_Descriptor Renaming_Exception Default_Expression Entity fields: Is_Unimplemented This patch removes all of them. gcc/ada/ChangeLog: * einfo.ads: Remove unused fields. * gen_il-fields.ads: Likewise. * gen_il-gen-gen_entities.adb: Likewise. * gen_il-gen-gen_nodes.adb: Likewise. * sinfo.ads: Likewise. * gen_il-gen.adb (Compile): Remove obsolete comment. --- gcc/ada/einfo.ads | 5 --- gcc/ada/gen_il-fields.ads | 7 ---- gcc/ada/gen_il-gen-gen_entities.adb | 1 - gcc/ada/gen_il-gen-gen_nodes.adb | 9 +----- gcc/ada/gen_il-gen.adb | 3 +- gcc/ada/sinfo.ads | 50 ----------------------------- 6 files changed, 2 insertions(+), 73 deletions(-) diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index da6a0286d9e..ab7552fb994 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -3467,10 +3467,6 @@ package Einfo is -- as its corresponding record type, but whose parent is the full view -- of the parent in the original type extension. --- Is_Unimplemented --- Defined in all entities. Set for any entity to which a valid pragma --- or aspect Unimplemented applies. - -- Is_Unsigned_Type -- Defined in all types, but can be set only for discrete and fixed-point -- type and subtype entities. This flag is only valid if the entity is @@ -5023,7 +5019,6 @@ package Einfo is -- Is_Thunk -- Is_Trivial_Subprogram -- Is_Unchecked_Union - -- Is_Unimplemented -- Is_Visible_Formal -- Kill_Elaboration_Checks -- Low_Bound_Tested diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads index d6681010ccb..a5ea239f1a1 100644 --- a/gcc/ada/gen_il-fields.ads +++ b/gcc/ada/gen_il-fields.ads @@ -131,7 +131,6 @@ package Gen_IL.Fields is Corresponding_Stub, Dcheck_Function, Declarations, - Default_Expression, Default_Storage_Pool, Default_Name, Default_Subtype_Mark, @@ -153,7 +152,6 @@ package Gen_IL.Fields is Do_Length_Check, Do_Overflow_Check, Do_Range_Check, - Do_Storage_Check, Elaborate_All_Desirable, Elaborate_All_Present, Elaborate_Desirable, @@ -161,7 +159,6 @@ package Gen_IL.Fields is Else_Actions, Else_Statements, Elsif_Parts, - Enclosing_Variant, End_Label, End_Span, Entity_Or_Associated_Node, @@ -204,7 +201,6 @@ package Gen_IL.Fields is Generic_Parent, Generic_Parent_Type, Handled_Statement_Sequence, - Handler_List_Entry, Has_Created_Identifier, Has_Dereference_Action, Has_Dynamic_Length_Check, @@ -283,7 +279,6 @@ package Gen_IL.Fields is Is_Static_Coextension, Is_Static_Expression, Is_Structural, - Is_Subprogram_Descriptor, Is_Task_Allocation_Block, Is_Task_Body_Procedure, Is_Task_Master, @@ -376,7 +371,6 @@ package Gen_IL.Fields is Reason, Record_Extension_Part, Redundant_Use, - Renaming_Exception, Result_Definition, Return_Object_Declarations, Return_Statement_Entity, @@ -807,7 +801,6 @@ package Gen_IL.Fields is Is_Unchecked_Union, Is_Underlying_Full_View, Is_Underlying_Record_View, - Is_Unimplemented, Is_Unsigned_Type, Is_Uplevel_Referenced_Entity, Is_Valued_Procedure, diff --git a/gcc/ada/gen_il-gen-gen_entities.adb b/gcc/ada/gen_il-gen-gen_entities.adb index f13488bee3c..3d55a69f262 100644 --- a/gcc/ada/gen_il-gen-gen_entities.adb +++ b/gcc/ada/gen_il-gen-gen_entities.adb @@ -203,7 +203,6 @@ begin -- Gen_IL.Gen.Gen_Entities Sm (Is_Unchecked_Union, Flag, Impl_Base_Type_Only), Sm (Is_Underlying_Full_View, Flag), Sm (Is_Underlying_Record_View, Flag, Base_Type_Only), - Sm (Is_Unimplemented, Flag), Sm (Is_Uplevel_Referenced_Entity, Flag), Sm (Is_Visible_Formal, Flag), Sm (Is_Visible_Lib_Unit, Flag), diff --git a/gcc/ada/gen_il-gen-gen_nodes.adb b/gcc/ada/gen_il-gen-gen_nodes.adb index 59fe2d85250..844faf3873b 100644 --- a/gcc/ada/gen_il-gen-gen_nodes.adb +++ b/gcc/ada/gen_il-gen-gen_nodes.adb @@ -414,7 +414,6 @@ begin -- Gen_IL.Gen.Gen_Nodes Sy (Null_Exclusion_Present, Flag, Default_False), Sy (Expression, Node_Id, Default_Empty), Sm (For_Special_Return_Object, Flag), - Sm (Do_Storage_Check, Flag), Sm (Is_Dynamic_Coextension, Flag), Sm (Is_Static_Coextension, Flag), Sm (No_Initialization, Flag), @@ -579,8 +578,6 @@ begin -- Gen_IL.Gen.Gen_Nodes Sm (Assignment_OK, Flag), Sm (Corresponding_Generic_Association, Node_Id), Sm (Exception_Junk, Flag), - Sm (Handler_List_Entry, Node_Id), - Sm (Is_Subprogram_Descriptor, Flag), Sm (More_Ids, Flag), Sm (No_Initialization, Flag), Sm (Prev_Ids, Flag), @@ -741,7 +738,6 @@ begin -- Gen_IL.Gen.Gen_Nodes Sm (Activation_Chain_Entity, Node_Id), Sm (Acts_As_Spec, Flag), Sm (Corresponding_Entry_Body, Node_Id), - Sm (Do_Storage_Check, Flag), Sm (Has_Relative_Deadline_Pragma, Flag), Sm (Is_Entry_Barrier_Function, Flag), Sm (Is_Protected_Subprogram_Body, Flag), @@ -1296,8 +1292,7 @@ begin -- Gen_IL.Gen.Gen_Nodes Sy (Aspect_Specifications, List_Id, Default_No_List), Sm (Expression, Node_Id), Sm (More_Ids, Flag), - Sm (Prev_Ids, Flag), - Sm (Renaming_Exception, Node_Id))); + Sm (Prev_Ids, Flag))); Cc (N_Exception_Handler, Node_Kind, (Sy (Choice_Parameter, Node_Id, Default_Empty), @@ -1437,7 +1432,6 @@ begin -- Gen_IL.Gen.Gen_Nodes Sy (Parameter_Type, Node_Id), Sy (Expression, Node_Id, Default_Empty), Sy (Aspect_Specifications, List_Id, Default_No_List), - Sm (Default_Expression, Node_Id), Sm (More_Ids, Flag), Sm (Prev_Ids, Flag))); @@ -1542,7 +1536,6 @@ begin -- Gen_IL.Gen.Gen_Nodes (Sy (Discrete_Choices, List_Id), Sy (Component_List, Node_Id), Sm (Dcheck_Function, Node_Id), - Sm (Enclosing_Variant, Node_Id), Sm (Has_SP_Choice, Flag), Sm (Present_Expr, Uint))); diff --git a/gcc/ada/gen_il-gen.adb b/gcc/ada/gen_il-gen.adb index 28622ff43d8..9a441f228e3 100644 --- a/gcc/ada/gen_il-gen.adb +++ b/gcc/ada/gen_il-gen.adb @@ -514,8 +514,7 @@ package body Gen_IL.Gen is -- Set of fields where the setter should set the Parent. True for -- syntactic fields of type Node_Id and List_Id, but with some -- exceptions. Expression is syntactic AND semantic, and the Parent - -- is needed. Default_Expression is also both, but the Parent is not - -- needed. Then_Actions and Else_Actions are not syntactic, but the + -- is needed. Then_Actions and Else_Actions are not syntactic, but the -- Parent is needed. -- -- Computed in Check_For_Syntactic_Field_Mismatch. diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index d5677095468..54a3d9b3416 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -690,7 +690,6 @@ package Sinfo is -- Do_Discriminant_Check -- Do_Length_Check - -- Do_Storage_Check -- These flags are used in some specific cases by the front end, either -- during semantic analysis or during expansion, and cannot be expected @@ -1058,13 +1057,6 @@ package Sinfo is -- This field is present in an N_Variant node, It references the entity -- for the discriminant checking function for the variant. - -- Default_Expression - -- This field is Empty if there is no default expression. If there is a - -- simple default expression (one with no side effects), then this field - -- simply contains a copy of the Expression field (both point to the tree - -- for the default expression). Default_Expression is used for - -- conformance checking. - -- Default_Storage_Pool -- This field is present in N_Compilation_Unit_Aux nodes. It is set to a -- copy of Opt.Default_Pool at the end of the compilation unit. See @@ -1152,14 +1144,6 @@ package Sinfo is -- listed above (e.g. in a return statement), an additional type -- conversion node is introduced to represent the required check. - -- Do_Storage_Check - -- This flag is set in an N_Allocator node to indicate that a storage - -- check is required for the allocation, or in an N_Subprogram_Body node - -- to indicate that a stack check is required in the subprogram prologue. - -- The N_Allocator case is handled by the routine that expands the call - -- to the runtime routine. The N_Subprogram_Body case is handled by the - -- backend, and all the semantics does is set the flag. - -- Elaborate_Present -- This flag is set in the N_With_Clause node to indicate that pragma -- Elaborate pragma appears for the with'ed units. @@ -1189,12 +1173,6 @@ package Sinfo is -- need for this field, so in the tree passed to Gigi, this field is -- always set to No_List. - -- Enclosing_Variant - -- This field is present in the N_Variant node and identifies the Node_Id - -- corresponding to the immediately enclosing variant when the variant is - -- nested, and N_Empty otherwise. Set during semantic processing of the - -- variant part of a record type. - -- Entity -- Appears in all direct names (identifiers, character literals, and -- operator symbols), as well as expanded names, and attributes that @@ -1395,14 +1373,6 @@ package Sinfo is -- Generic_Parent_Type is also used in an instance to determine whether a -- private operation overrides an inherited one. - -- Handler_List_Entry - -- This field is present in N_Object_Declaration nodes. It is set only - -- for the Handler_Record entry generated for an exception in zero cost - -- exception handling mode. It references the corresponding item in the - -- handler list, and is used to delete this entry if the corresponding - -- handler is deleted during optimization. For further details on why - -- this is required, see Exp_Ch11.Remove_Handler_Entries. - -- Has_Dereference_Action -- This flag is present in N_Explicit_Dereference nodes. It is set to -- indicate that the expansion has aready produced a call to primitive @@ -1885,11 +1855,6 @@ package Sinfo is -- the generic unit on the actual parameters done in the outermost scope -- where it would be legal to declare an identical named instantiation. - -- Is_Subprogram_Descriptor - -- Present in N_Object_Declaration, and set only for the object - -- declaration generated for a subprogram descriptor in fast exception - -- mode. See Exp_Ch11 for details of use. - -- Is_Task_Allocation_Block -- A flag set in a Block_Statement node to indicate that it is the -- expansion of a task allocator, or the allocator of an object @@ -2238,14 +2203,6 @@ package Sinfo is -- to indicate that a use is redundant (and therefore need not be undone -- on scope exit). - -- Renaming_Exception - -- Present in N_Exception_Declaration node. Used to point back to the - -- exception renaming for an exception declared within a subprogram. - -- What happens is that an exception declared in a subprogram is moved - -- to the library level with a unique name, and the original exception - -- becomes a renaming. This link from the library level exception to the - -- renaming declaration allows registering of the proper exception name. - -- Return_Statement_Entity -- Present in N_Simple_Return_Statement and N_Extended_Return_Statement. -- Points to an E_Return_Statement representing the return statement. @@ -3021,14 +2978,12 @@ package Sinfo is -- Null_Exclusion_Present -- Object_Definition subtype indic./array type def./access def. -- Expression (set to Empty if not present) - -- Handler_List_Entry -- Corresponding_Generic_Association -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) -- No_Initialization -- Assignment_OK -- Exception_Junk - -- Is_Subprogram_Descriptor -- Has_Init_Expression -- Suppress_Assignment_Checks @@ -3633,7 +3588,6 @@ package Sinfo is -- Sloc points to WHEN -- Discrete_Choices -- Component_List - -- Enclosing_Variant -- Present_Expr -- Dcheck_Function -- Has_SP_Choice @@ -4854,7 +4808,6 @@ package Sinfo is -- Null_Exclusion_Present -- No_Initialization -- Is_Static_Coextension - -- Do_Storage_Check -- Is_Dynamic_Coextension -- plus fields for expression @@ -5509,7 +5462,6 @@ package Sinfo is -- Expression (set to Empty if no default expression) -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) - -- Default_Expression --------------- -- 6.1 Mode -- @@ -5542,7 +5494,6 @@ package Sinfo is -- At_End_Proc (set to Empty if no clean up procedure) -- Acts_As_Spec -- Bad_Is_Detected used only by parser - -- Do_Storage_Check -- Has_Relative_Deadline_Pragma -- Is_Entry_Barrier_Function -- Is_Protected_Subprogram_Body @@ -6889,7 +6840,6 @@ package Sinfo is -- Sloc points to EXCEPTION -- Defining_Identifier -- Expression - -- Renaming_Exception -- More_Ids (set to False if no more identifiers in list) -- Prev_Ids (set to False if no previous identifiers in list) -- 2.47.3