From c414582a22b001b7ca9893a1c2e017fb0523003d Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 2 Jan 2019 21:43:13 +0100 Subject: Remove unused is_ref for choices. Adjust. --- src/ghdldrv/ghdlxml.adb | 6 - src/vhdl/disp_tree.adb | 6 - src/vhdl/iirs.adb | 16 +- src/vhdl/iirs.ads | 19 +- src/vhdl/nodes_gc.adb | 6 - src/vhdl/nodes_meta.adb | 534 ++++++++++++++++++------------------- src/vhdl/nodes_meta.ads | 5 +- src/vhdl/parse.adb | 33 +-- src/vhdl/sem_assocs.adb | 6 +- src/vhdl/sem_expr.adb | 112 +------- src/vhdl/sem_expr.ads | 5 +- src/vhdl/sem_inst.adb | 14 - src/vhdl/translate/trans-chap2.adb | 4 - src/vhdl/translate/trans-chap9.adb | 4 - 14 files changed, 298 insertions(+), 472 deletions(-) diff --git a/src/ghdldrv/ghdlxml.adb b/src/ghdldrv/ghdlxml.adb index 1abe3465c..aaf5fb58b 100644 --- a/src/ghdldrv/ghdlxml.adb +++ b/src/ghdldrv/ghdlxml.adb @@ -440,12 +440,6 @@ package body Ghdlxml is end if; when Attr_Chain => Disp_Iir_Chain (Img, V); - when Attr_Maybe_Ref_Chain => - if Get_Is_Ref (N) then - Disp_Iir_Ref (Img, V); - else - Disp_Iir_Chain (Img, V); - end if; when Attr_Chain_Next => null; when Attr_Of_Ref | Attr_Of_Maybe_Ref => diff --git a/src/vhdl/disp_tree.adb b/src/vhdl/disp_tree.adb index eabbaeae7..e39c267f9 100644 --- a/src/vhdl/disp_tree.adb +++ b/src/vhdl/disp_tree.adb @@ -462,12 +462,6 @@ package body Disp_Tree is Ndepth := Depth - 1; end if; Disp_Iir (Get_Iir (N, F), Sub_Indent, Ndepth); - when Attr_Maybe_Ref_Chain => - if Get_Is_Ref (N) then - Disp_Iir (Get_Iir (N, F), Sub_Indent, 0); - else - Disp_Chain (Get_Iir (N, F), Sub_Indent, Depth - 1); - end if; when Attr_Chain => Disp_Chain (Get_Iir (N, F), Sub_Indent, Depth - 1); when Attr_Chain_Next => diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb index dfbcf9d8c..1ad810da6 100644 --- a/src/vhdl/iirs.adb +++ b/src/vhdl/iirs.adb @@ -1505,21 +1505,21 @@ package body Iirs is Set_Field3 (We, An_Iir); end Set_Time; - function Get_Choice_Position (Choice : Iir) return Int32 is + function Get_Choice_Order (Choice : Iir) return Int32 is begin pragma Assert (Choice /= Null_Iir); - pragma Assert (Has_Choice_Position (Get_Kind (Choice)), - "no field Choice_Position"); + pragma Assert (Has_Choice_Order (Get_Kind (Choice)), + "no field Choice_Order"); return Int32'Val (Get_Field1 (Choice)); - end Get_Choice_Position; + end Get_Choice_Order; - procedure Set_Choice_Position (Choice : Iir; Pos : Int32) is + procedure Set_Choice_Order (Choice : Iir; Pos : Int32) is begin pragma Assert (Choice /= Null_Iir); - pragma Assert (Has_Choice_Position (Get_Kind (Choice)), - "no field Choice_Position"); + pragma Assert (Has_Choice_Order (Get_Kind (Choice)), + "no field Choice_Order"); Set_Field1 (Choice, Int32'Pos (Pos)); - end Set_Choice_Position; + end Set_Choice_Order; function Get_Associated_Expr (Target : Iir) return Iir is begin diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads index 30aadc38b..69917d637 100644 --- a/src/vhdl/iirs.ads +++ b/src/vhdl/iirs.ads @@ -535,9 +535,8 @@ package Iirs is -- associations have the same_alternative_flag set. -- Get/Set_Chain (Field2) -- - -- Lexical order of appareance. Choices are sorted during analysis. This - -- field can be used to display the choices in the original order. - -- Get/Set_Choice_Position (Field1) + -- Ordered position of the choice from 1 to N. 0 is reserved for others. + -- Get/Set_Choice_Order (Field1) -- -- Should be a simple_name. -- Only for Iir_Kind_Choice_By_Name: @@ -576,8 +575,6 @@ package Iirs is -- Only for Iir_Kind_Choice_By_Range: -- Only for Iir_Kind_Choice_By_Expression: -- Get/Set_Choice_Staticness (State1) - -- - -- Get/Set_Is_Ref (Flag12) -- Iir_Kind_Entity_Aspect_Entity (Short) -- @@ -6161,23 +6158,21 @@ package Iirs is procedure Set_Time (We : Iir_Waveform_Element; An_Iir : Iir); -- Field: Field1 (pos) - function Get_Choice_Position (Choice : Iir) return Int32; - procedure Set_Choice_Position (Choice : Iir; Pos : Int32); + function Get_Choice_Order (Choice : Iir) return Int32; + procedure Set_Choice_Order (Choice : Iir; Pos : Int32); -- Node associated with a choice. - -- Field: Field3 Maybe_Ref + -- Field: Field3 function Get_Associated_Expr (Target : Iir) return Iir; procedure Set_Associated_Expr (Target : Iir; Associated : Iir); -- Node associated with a choice. - -- Field: Field3 Maybe_Ref + -- Field: Field3 function Get_Associated_Block (Target : Iir) return Iir; procedure Set_Associated_Block (Target : Iir; Associated : Iir); -- Chain associated with a choice. - -- A Maybe_Ref_Chain is a reference to a chain if Get_Is_Ref is True, - -- otherwise this is a normal chain. - -- Field: Field4 Maybe_Ref_Chain + -- Field: Field4 Chain function Get_Associated_Chain (Target : Iir) return Iir; procedure Set_Associated_Chain (Target : Iir; Associated : Iir); diff --git a/src/vhdl/nodes_gc.adb b/src/vhdl/nodes_gc.adb index 55b39e324..6cf12647f 100644 --- a/src/vhdl/nodes_gc.adb +++ b/src/vhdl/nodes_gc.adb @@ -249,12 +249,6 @@ package body Nodes_GC is end if; when Attr_Chain => Mark_Chain (Get_Iir (N, F)); - when Attr_Maybe_Ref_Chain => - if Get_Is_Ref (N) then - Mark_Iir_Ref_Field (N, F); - else - Mark_Chain (Get_Iir (N, F)); - end if; when Attr_Of_Ref | Attr_Of_Maybe_Ref => raise Internal_Error; end case; diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb index d16bc5887..f09b6c711 100644 --- a/src/vhdl/nodes_meta.adb +++ b/src/vhdl/nodes_meta.adb @@ -76,7 +76,7 @@ package body Nodes_Meta is Field_After_Drivers_Flag => Type_Boolean, Field_We_Value => Type_Iir, Field_Time => Type_Iir, - Field_Choice_Position => Type_Int32, + Field_Choice_Order => Type_Int32, Field_Associated_Expr => Type_Iir, Field_Associated_Block => Type_Iir, Field_Associated_Chain => Type_Iir, @@ -469,8 +469,8 @@ package body Nodes_Meta is return "we_value"; when Field_Time => return "time"; - when Field_Choice_Position => - return "choice_position"; + when Field_Choice_Order => + return "choice_order"; when Field_Associated_Expr => return "associated_expr"; when Field_Associated_Block => @@ -1671,14 +1671,14 @@ package body Nodes_Meta is return Attr_None; when Field_Time => return Attr_None; - when Field_Choice_Position => + when Field_Choice_Order => return Attr_None; when Field_Associated_Expr => - return Attr_Maybe_Ref; + return Attr_None; when Field_Associated_Block => - return Attr_Maybe_Ref; + return Attr_None; when Field_Associated_Chain => - return Attr_Maybe_Ref_Chain; + return Attr_Chain; when Field_Choice_Name => return Attr_None; when Field_Choice_Expression => @@ -2383,9 +2383,8 @@ package body Nodes_Meta is Field_Chain, Field_Actual, -- Iir_Kind_Choice_By_Range - Field_Choice_Position, + Field_Choice_Order, Field_Same_Alternative_Flag, - Field_Is_Ref, Field_Element_Type_Flag, Field_Choice_Staticness, Field_Parent, @@ -2394,9 +2393,8 @@ package body Nodes_Meta is Field_Associated_Expr, Field_Associated_Chain, -- Iir_Kind_Choice_By_Expression - Field_Choice_Position, + Field_Choice_Order, Field_Same_Alternative_Flag, - Field_Is_Ref, Field_Element_Type_Flag, Field_Choice_Staticness, Field_Parent, @@ -2405,27 +2403,24 @@ package body Nodes_Meta is Field_Associated_Expr, Field_Associated_Chain, -- Iir_Kind_Choice_By_Others - Field_Choice_Position, + Field_Choice_Order, Field_Same_Alternative_Flag, - Field_Is_Ref, Field_Element_Type_Flag, Field_Parent, Field_Chain, Field_Associated_Expr, Field_Associated_Chain, -- Iir_Kind_Choice_By_None - Field_Choice_Position, + Field_Choice_Order, Field_Same_Alternative_Flag, - Field_Is_Ref, Field_Element_Type_Flag, Field_Parent, Field_Chain, Field_Associated_Expr, Field_Associated_Chain, -- Iir_Kind_Choice_By_Name - Field_Choice_Position, + Field_Choice_Order, Field_Same_Alternative_Flag, - Field_Is_Ref, Field_Element_Type_Flag, Field_Parent, Field_Chain, @@ -4447,250 +4442,250 @@ package body Nodes_Meta is Iir_Kind_Association_Element_Package => 128, Iir_Kind_Association_Element_Type => 136, Iir_Kind_Association_Element_Subprogram => 142, - Iir_Kind_Choice_By_Range => 152, - Iir_Kind_Choice_By_Expression => 162, - Iir_Kind_Choice_By_Others => 170, - Iir_Kind_Choice_By_None => 178, - Iir_Kind_Choice_By_Name => 187, - Iir_Kind_Entity_Aspect_Entity => 189, - Iir_Kind_Entity_Aspect_Configuration => 190, - Iir_Kind_Entity_Aspect_Open => 190, - Iir_Kind_Block_Configuration => 196, - Iir_Kind_Block_Header => 200, - Iir_Kind_Component_Configuration => 207, - Iir_Kind_Binding_Indication => 211, - Iir_Kind_Entity_Class => 213, - Iir_Kind_Attribute_Value => 221, - Iir_Kind_Signature => 224, - Iir_Kind_Aggregate_Info => 231, - Iir_Kind_Procedure_Call => 235, - Iir_Kind_Record_Element_Constraint => 241, - Iir_Kind_Array_Element_Resolution => 243, - Iir_Kind_Record_Resolution => 244, - Iir_Kind_Record_Element_Resolution => 247, - Iir_Kind_Attribute_Specification => 255, - Iir_Kind_Disconnection_Specification => 261, - Iir_Kind_Configuration_Specification => 267, - Iir_Kind_Access_Type_Definition => 275, - Iir_Kind_Incomplete_Type_Definition => 283, - Iir_Kind_Interface_Type_Definition => 290, - Iir_Kind_File_Type_Definition => 297, - Iir_Kind_Protected_Type_Declaration => 306, - Iir_Kind_Record_Type_Definition => 317, - Iir_Kind_Array_Type_Definition => 329, - Iir_Kind_Array_Subtype_Definition => 344, - Iir_Kind_Record_Subtype_Definition => 357, - Iir_Kind_Access_Subtype_Definition => 365, - Iir_Kind_Physical_Subtype_Definition => 375, - Iir_Kind_Floating_Subtype_Definition => 386, - Iir_Kind_Integer_Subtype_Definition => 396, - Iir_Kind_Enumeration_Subtype_Definition => 406, - Iir_Kind_Enumeration_Type_Definition => 417, - Iir_Kind_Integer_Type_Definition => 425, - Iir_Kind_Floating_Type_Definition => 433, - Iir_Kind_Physical_Type_Definition => 444, - Iir_Kind_Range_Expression => 452, - Iir_Kind_Protected_Type_Body => 459, - Iir_Kind_Wildcard_Type_Definition => 464, - Iir_Kind_Subtype_Definition => 469, - Iir_Kind_Scalar_Nature_Definition => 473, - Iir_Kind_Overload_List => 474, - Iir_Kind_Type_Declaration => 481, - Iir_Kind_Anonymous_Type_Declaration => 487, - Iir_Kind_Subtype_Declaration => 494, - Iir_Kind_Nature_Declaration => 500, - Iir_Kind_Subnature_Declaration => 506, - Iir_Kind_Entity_Declaration => 518, - Iir_Kind_Configuration_Declaration => 527, - Iir_Kind_Context_Declaration => 533, - Iir_Kind_Package_Declaration => 548, - Iir_Kind_Package_Instantiation_Declaration => 562, - Iir_Kind_Package_Body => 570, - Iir_Kind_Architecture_Body => 582, - Iir_Kind_Package_Header => 584, - Iir_Kind_Unit_Declaration => 593, - Iir_Kind_Library_Declaration => 600, - Iir_Kind_Component_Declaration => 610, - Iir_Kind_Attribute_Declaration => 617, - Iir_Kind_Group_Template_Declaration => 623, - Iir_Kind_Group_Declaration => 630, - Iir_Kind_Element_Declaration => 637, - Iir_Kind_Non_Object_Alias_Declaration => 645, - Iir_Kind_Psl_Declaration => 653, - Iir_Kind_Psl_Endpoint_Declaration => 667, - Iir_Kind_Terminal_Declaration => 674, - Iir_Kind_Free_Quantity_Declaration => 683, - Iir_Kind_Across_Quantity_Declaration => 695, - Iir_Kind_Through_Quantity_Declaration => 707, - Iir_Kind_Enumeration_Literal => 718, - Iir_Kind_Function_Declaration => 743, - Iir_Kind_Procedure_Declaration => 767, - Iir_Kind_Function_Body => 777, - Iir_Kind_Procedure_Body => 788, - Iir_Kind_Object_Alias_Declaration => 799, - Iir_Kind_File_Declaration => 813, - Iir_Kind_Guard_Signal_Declaration => 826, - Iir_Kind_Signal_Declaration => 843, - Iir_Kind_Variable_Declaration => 856, - Iir_Kind_Constant_Declaration => 870, - Iir_Kind_Iterator_Declaration => 881, - Iir_Kind_Interface_Constant_Declaration => 897, - Iir_Kind_Interface_Variable_Declaration => 913, - Iir_Kind_Interface_Signal_Declaration => 934, - Iir_Kind_Interface_File_Declaration => 950, - Iir_Kind_Interface_Type_Declaration => 960, - Iir_Kind_Interface_Package_Declaration => 972, - Iir_Kind_Interface_Function_Declaration => 989, - Iir_Kind_Interface_Procedure_Declaration => 1002, - Iir_Kind_Signal_Attribute_Declaration => 1005, - Iir_Kind_Identity_Operator => 1009, - Iir_Kind_Negation_Operator => 1013, - Iir_Kind_Absolute_Operator => 1017, - Iir_Kind_Not_Operator => 1021, - Iir_Kind_Implicit_Condition_Operator => 1025, - Iir_Kind_Condition_Operator => 1029, - Iir_Kind_Reduction_And_Operator => 1033, - Iir_Kind_Reduction_Or_Operator => 1037, - Iir_Kind_Reduction_Nand_Operator => 1041, - Iir_Kind_Reduction_Nor_Operator => 1045, - Iir_Kind_Reduction_Xor_Operator => 1049, - Iir_Kind_Reduction_Xnor_Operator => 1053, - Iir_Kind_And_Operator => 1058, - Iir_Kind_Or_Operator => 1063, - Iir_Kind_Nand_Operator => 1068, - Iir_Kind_Nor_Operator => 1073, - Iir_Kind_Xor_Operator => 1078, - Iir_Kind_Xnor_Operator => 1083, - Iir_Kind_Equality_Operator => 1088, - Iir_Kind_Inequality_Operator => 1093, - Iir_Kind_Less_Than_Operator => 1098, - Iir_Kind_Less_Than_Or_Equal_Operator => 1103, - Iir_Kind_Greater_Than_Operator => 1108, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1113, - Iir_Kind_Match_Equality_Operator => 1118, - Iir_Kind_Match_Inequality_Operator => 1123, - Iir_Kind_Match_Less_Than_Operator => 1128, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1133, - Iir_Kind_Match_Greater_Than_Operator => 1138, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1143, - Iir_Kind_Sll_Operator => 1148, - Iir_Kind_Sla_Operator => 1153, - Iir_Kind_Srl_Operator => 1158, - Iir_Kind_Sra_Operator => 1163, - Iir_Kind_Rol_Operator => 1168, - Iir_Kind_Ror_Operator => 1173, - Iir_Kind_Addition_Operator => 1178, - Iir_Kind_Substraction_Operator => 1183, - Iir_Kind_Concatenation_Operator => 1188, - Iir_Kind_Multiplication_Operator => 1193, - Iir_Kind_Division_Operator => 1198, - Iir_Kind_Modulus_Operator => 1203, - Iir_Kind_Remainder_Operator => 1208, - Iir_Kind_Exponentiation_Operator => 1213, - Iir_Kind_Function_Call => 1221, - Iir_Kind_Aggregate => 1228, - Iir_Kind_Parenthesis_Expression => 1231, - Iir_Kind_Qualified_Expression => 1235, - Iir_Kind_Type_Conversion => 1240, - Iir_Kind_Allocator_By_Expression => 1244, - Iir_Kind_Allocator_By_Subtype => 1249, - Iir_Kind_Selected_Element => 1257, - Iir_Kind_Dereference => 1262, - Iir_Kind_Implicit_Dereference => 1267, - Iir_Kind_Slice_Name => 1274, - Iir_Kind_Indexed_Name => 1280, - Iir_Kind_Psl_Expression => 1282, - Iir_Kind_Sensitized_Process_Statement => 1303, - Iir_Kind_Process_Statement => 1323, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1335, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1347, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1360, - Iir_Kind_Concurrent_Assertion_Statement => 1368, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1375, - Iir_Kind_Psl_Assert_Statement => 1388, - Iir_Kind_Psl_Cover_Statement => 1401, - Iir_Kind_Block_Statement => 1414, - Iir_Kind_If_Generate_Statement => 1425, - Iir_Kind_Case_Generate_Statement => 1434, - Iir_Kind_For_Generate_Statement => 1443, - Iir_Kind_Component_Instantiation_Statement => 1454, - Iir_Kind_Psl_Default_Clock => 1458, - Iir_Kind_Simple_Simultaneous_Statement => 1465, - Iir_Kind_Generate_Statement_Body => 1476, - Iir_Kind_If_Generate_Else_Clause => 1482, - Iir_Kind_Simple_Signal_Assignment_Statement => 1492, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1502, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1513, - Iir_Kind_Null_Statement => 1517, - Iir_Kind_Assertion_Statement => 1524, - Iir_Kind_Report_Statement => 1530, - Iir_Kind_Wait_Statement => 1538, - Iir_Kind_Variable_Assignment_Statement => 1545, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1552, - Iir_Kind_Return_Statement => 1558, - Iir_Kind_For_Loop_Statement => 1567, - Iir_Kind_While_Loop_Statement => 1576, - Iir_Kind_Next_Statement => 1583, - Iir_Kind_Exit_Statement => 1590, - Iir_Kind_Case_Statement => 1598, - Iir_Kind_Procedure_Call_Statement => 1604, - Iir_Kind_If_Statement => 1614, - Iir_Kind_Elsif => 1620, - Iir_Kind_Character_Literal => 1628, - Iir_Kind_Simple_Name => 1636, - Iir_Kind_Selected_Name => 1645, - Iir_Kind_Operator_Symbol => 1651, - Iir_Kind_Reference_Name => 1654, - Iir_Kind_External_Constant_Name => 1663, - Iir_Kind_External_Signal_Name => 1672, - Iir_Kind_External_Variable_Name => 1681, - Iir_Kind_Selected_By_All_Name => 1687, - Iir_Kind_Parenthesis_Name => 1692, - Iir_Kind_Package_Pathname => 1696, - Iir_Kind_Absolute_Pathname => 1697, - Iir_Kind_Relative_Pathname => 1698, - Iir_Kind_Pathname_Element => 1703, - Iir_Kind_Base_Attribute => 1705, - Iir_Kind_Subtype_Attribute => 1710, - Iir_Kind_Element_Attribute => 1715, - Iir_Kind_Left_Type_Attribute => 1720, - Iir_Kind_Right_Type_Attribute => 1725, - Iir_Kind_High_Type_Attribute => 1730, - Iir_Kind_Low_Type_Attribute => 1735, - Iir_Kind_Ascending_Type_Attribute => 1740, - Iir_Kind_Image_Attribute => 1746, - Iir_Kind_Value_Attribute => 1752, - Iir_Kind_Pos_Attribute => 1758, - Iir_Kind_Val_Attribute => 1764, - Iir_Kind_Succ_Attribute => 1770, - Iir_Kind_Pred_Attribute => 1776, - Iir_Kind_Leftof_Attribute => 1782, - Iir_Kind_Rightof_Attribute => 1788, - Iir_Kind_Delayed_Attribute => 1797, - Iir_Kind_Stable_Attribute => 1806, - Iir_Kind_Quiet_Attribute => 1815, - Iir_Kind_Transaction_Attribute => 1824, - Iir_Kind_Event_Attribute => 1828, - Iir_Kind_Active_Attribute => 1832, - Iir_Kind_Last_Event_Attribute => 1836, - Iir_Kind_Last_Active_Attribute => 1840, - Iir_Kind_Last_Value_Attribute => 1844, - Iir_Kind_Driving_Attribute => 1848, - Iir_Kind_Driving_Value_Attribute => 1852, - Iir_Kind_Behavior_Attribute => 1852, - Iir_Kind_Structure_Attribute => 1852, - Iir_Kind_Simple_Name_Attribute => 1859, - Iir_Kind_Instance_Name_Attribute => 1864, - Iir_Kind_Path_Name_Attribute => 1869, - Iir_Kind_Left_Array_Attribute => 1876, - Iir_Kind_Right_Array_Attribute => 1883, - Iir_Kind_High_Array_Attribute => 1890, - Iir_Kind_Low_Array_Attribute => 1897, - Iir_Kind_Length_Array_Attribute => 1904, - Iir_Kind_Ascending_Array_Attribute => 1911, - Iir_Kind_Range_Array_Attribute => 1918, - Iir_Kind_Reverse_Range_Array_Attribute => 1925, - Iir_Kind_Attribute_Name => 1934 + Iir_Kind_Choice_By_Range => 151, + Iir_Kind_Choice_By_Expression => 160, + Iir_Kind_Choice_By_Others => 167, + Iir_Kind_Choice_By_None => 174, + Iir_Kind_Choice_By_Name => 182, + Iir_Kind_Entity_Aspect_Entity => 184, + Iir_Kind_Entity_Aspect_Configuration => 185, + Iir_Kind_Entity_Aspect_Open => 185, + Iir_Kind_Block_Configuration => 191, + Iir_Kind_Block_Header => 195, + Iir_Kind_Component_Configuration => 202, + Iir_Kind_Binding_Indication => 206, + Iir_Kind_Entity_Class => 208, + Iir_Kind_Attribute_Value => 216, + Iir_Kind_Signature => 219, + Iir_Kind_Aggregate_Info => 226, + Iir_Kind_Procedure_Call => 230, + Iir_Kind_Record_Element_Constraint => 236, + Iir_Kind_Array_Element_Resolution => 238, + Iir_Kind_Record_Resolution => 239, + Iir_Kind_Record_Element_Resolution => 242, + Iir_Kind_Attribute_Specification => 250, + Iir_Kind_Disconnection_Specification => 256, + Iir_Kind_Configuration_Specification => 262, + Iir_Kind_Access_Type_Definition => 270, + Iir_Kind_Incomplete_Type_Definition => 278, + Iir_Kind_Interface_Type_Definition => 285, + Iir_Kind_File_Type_Definition => 292, + Iir_Kind_Protected_Type_Declaration => 301, + Iir_Kind_Record_Type_Definition => 312, + Iir_Kind_Array_Type_Definition => 324, + Iir_Kind_Array_Subtype_Definition => 339, + Iir_Kind_Record_Subtype_Definition => 352, + Iir_Kind_Access_Subtype_Definition => 360, + Iir_Kind_Physical_Subtype_Definition => 370, + Iir_Kind_Floating_Subtype_Definition => 381, + Iir_Kind_Integer_Subtype_Definition => 391, + Iir_Kind_Enumeration_Subtype_Definition => 401, + Iir_Kind_Enumeration_Type_Definition => 412, + Iir_Kind_Integer_Type_Definition => 420, + Iir_Kind_Floating_Type_Definition => 428, + Iir_Kind_Physical_Type_Definition => 439, + Iir_Kind_Range_Expression => 447, + Iir_Kind_Protected_Type_Body => 454, + Iir_Kind_Wildcard_Type_Definition => 459, + Iir_Kind_Subtype_Definition => 464, + Iir_Kind_Scalar_Nature_Definition => 468, + Iir_Kind_Overload_List => 469, + Iir_Kind_Type_Declaration => 476, + Iir_Kind_Anonymous_Type_Declaration => 482, + Iir_Kind_Subtype_Declaration => 489, + Iir_Kind_Nature_Declaration => 495, + Iir_Kind_Subnature_Declaration => 501, + Iir_Kind_Entity_Declaration => 513, + Iir_Kind_Configuration_Declaration => 522, + Iir_Kind_Context_Declaration => 528, + Iir_Kind_Package_Declaration => 543, + Iir_Kind_Package_Instantiation_Declaration => 557, + Iir_Kind_Package_Body => 565, + Iir_Kind_Architecture_Body => 577, + Iir_Kind_Package_Header => 579, + Iir_Kind_Unit_Declaration => 588, + Iir_Kind_Library_Declaration => 595, + Iir_Kind_Component_Declaration => 605, + Iir_Kind_Attribute_Declaration => 612, + Iir_Kind_Group_Template_Declaration => 618, + Iir_Kind_Group_Declaration => 625, + Iir_Kind_Element_Declaration => 632, + Iir_Kind_Non_Object_Alias_Declaration => 640, + Iir_Kind_Psl_Declaration => 648, + Iir_Kind_Psl_Endpoint_Declaration => 662, + Iir_Kind_Terminal_Declaration => 669, + Iir_Kind_Free_Quantity_Declaration => 678, + Iir_Kind_Across_Quantity_Declaration => 690, + Iir_Kind_Through_Quantity_Declaration => 702, + Iir_Kind_Enumeration_Literal => 713, + Iir_Kind_Function_Declaration => 738, + Iir_Kind_Procedure_Declaration => 762, + Iir_Kind_Function_Body => 772, + Iir_Kind_Procedure_Body => 783, + Iir_Kind_Object_Alias_Declaration => 794, + Iir_Kind_File_Declaration => 808, + Iir_Kind_Guard_Signal_Declaration => 821, + Iir_Kind_Signal_Declaration => 838, + Iir_Kind_Variable_Declaration => 851, + Iir_Kind_Constant_Declaration => 865, + Iir_Kind_Iterator_Declaration => 876, + Iir_Kind_Interface_Constant_Declaration => 892, + Iir_Kind_Interface_Variable_Declaration => 908, + Iir_Kind_Interface_Signal_Declaration => 929, + Iir_Kind_Interface_File_Declaration => 945, + Iir_Kind_Interface_Type_Declaration => 955, + Iir_Kind_Interface_Package_Declaration => 967, + Iir_Kind_Interface_Function_Declaration => 984, + Iir_Kind_Interface_Procedure_Declaration => 997, + Iir_Kind_Signal_Attribute_Declaration => 1000, + Iir_Kind_Identity_Operator => 1004, + Iir_Kind_Negation_Operator => 1008, + Iir_Kind_Absolute_Operator => 1012, + Iir_Kind_Not_Operator => 1016, + Iir_Kind_Implicit_Condition_Operator => 1020, + Iir_Kind_Condition_Operator => 1024, + Iir_Kind_Reduction_And_Operator => 1028, + Iir_Kind_Reduction_Or_Operator => 1032, + Iir_Kind_Reduction_Nand_Operator => 1036, + Iir_Kind_Reduction_Nor_Operator => 1040, + Iir_Kind_Reduction_Xor_Operator => 1044, + Iir_Kind_Reduction_Xnor_Operator => 1048, + Iir_Kind_And_Operator => 1053, + Iir_Kind_Or_Operator => 1058, + Iir_Kind_Nand_Operator => 1063, + Iir_Kind_Nor_Operator => 1068, + Iir_Kind_Xor_Operator => 1073, + Iir_Kind_Xnor_Operator => 1078, + Iir_Kind_Equality_Operator => 1083, + Iir_Kind_Inequality_Operator => 1088, + Iir_Kind_Less_Than_Operator => 1093, + Iir_Kind_Less_Than_Or_Equal_Operator => 1098, + Iir_Kind_Greater_Than_Operator => 1103, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1108, + Iir_Kind_Match_Equality_Operator => 1113, + Iir_Kind_Match_Inequality_Operator => 1118, + Iir_Kind_Match_Less_Than_Operator => 1123, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1128, + Iir_Kind_Match_Greater_Than_Operator => 1133, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1138, + Iir_Kind_Sll_Operator => 1143, + Iir_Kind_Sla_Operator => 1148, + Iir_Kind_Srl_Operator => 1153, + Iir_Kind_Sra_Operator => 1158, + Iir_Kind_Rol_Operator => 1163, + Iir_Kind_Ror_Operator => 1168, + Iir_Kind_Addition_Operator => 1173, + Iir_Kind_Substraction_Operator => 1178, + Iir_Kind_Concatenation_Operator => 1183, + Iir_Kind_Multiplication_Operator => 1188, + Iir_Kind_Division_Operator => 1193, + Iir_Kind_Modulus_Operator => 1198, + Iir_Kind_Remainder_Operator => 1203, + Iir_Kind_Exponentiation_Operator => 1208, + Iir_Kind_Function_Call => 1216, + Iir_Kind_Aggregate => 1223, + Iir_Kind_Parenthesis_Expression => 1226, + Iir_Kind_Qualified_Expression => 1230, + Iir_Kind_Type_Conversion => 1235, + Iir_Kind_Allocator_By_Expression => 1239, + Iir_Kind_Allocator_By_Subtype => 1244, + Iir_Kind_Selected_Element => 1252, + Iir_Kind_Dereference => 1257, + Iir_Kind_Implicit_Dereference => 1262, + Iir_Kind_Slice_Name => 1269, + Iir_Kind_Indexed_Name => 1275, + Iir_Kind_Psl_Expression => 1277, + Iir_Kind_Sensitized_Process_Statement => 1298, + Iir_Kind_Process_Statement => 1318, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1330, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1342, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1355, + Iir_Kind_Concurrent_Assertion_Statement => 1363, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1370, + Iir_Kind_Psl_Assert_Statement => 1383, + Iir_Kind_Psl_Cover_Statement => 1396, + Iir_Kind_Block_Statement => 1409, + Iir_Kind_If_Generate_Statement => 1420, + Iir_Kind_Case_Generate_Statement => 1429, + Iir_Kind_For_Generate_Statement => 1438, + Iir_Kind_Component_Instantiation_Statement => 1449, + Iir_Kind_Psl_Default_Clock => 1453, + Iir_Kind_Simple_Simultaneous_Statement => 1460, + Iir_Kind_Generate_Statement_Body => 1471, + Iir_Kind_If_Generate_Else_Clause => 1477, + Iir_Kind_Simple_Signal_Assignment_Statement => 1487, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1497, + Iir_Kind_Selected_Waveform_Assignment_Statement => 1508, + Iir_Kind_Null_Statement => 1512, + Iir_Kind_Assertion_Statement => 1519, + Iir_Kind_Report_Statement => 1525, + Iir_Kind_Wait_Statement => 1533, + Iir_Kind_Variable_Assignment_Statement => 1540, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1547, + Iir_Kind_Return_Statement => 1553, + Iir_Kind_For_Loop_Statement => 1562, + Iir_Kind_While_Loop_Statement => 1571, + Iir_Kind_Next_Statement => 1578, + Iir_Kind_Exit_Statement => 1585, + Iir_Kind_Case_Statement => 1593, + Iir_Kind_Procedure_Call_Statement => 1599, + Iir_Kind_If_Statement => 1609, + Iir_Kind_Elsif => 1615, + Iir_Kind_Character_Literal => 1623, + Iir_Kind_Simple_Name => 1631, + Iir_Kind_Selected_Name => 1640, + Iir_Kind_Operator_Symbol => 1646, + Iir_Kind_Reference_Name => 1649, + Iir_Kind_External_Constant_Name => 1658, + Iir_Kind_External_Signal_Name => 1667, + Iir_Kind_External_Variable_Name => 1676, + Iir_Kind_Selected_By_All_Name => 1682, + Iir_Kind_Parenthesis_Name => 1687, + Iir_Kind_Package_Pathname => 1691, + Iir_Kind_Absolute_Pathname => 1692, + Iir_Kind_Relative_Pathname => 1693, + Iir_Kind_Pathname_Element => 1698, + Iir_Kind_Base_Attribute => 1700, + Iir_Kind_Subtype_Attribute => 1705, + Iir_Kind_Element_Attribute => 1710, + Iir_Kind_Left_Type_Attribute => 1715, + Iir_Kind_Right_Type_Attribute => 1720, + Iir_Kind_High_Type_Attribute => 1725, + Iir_Kind_Low_Type_Attribute => 1730, + Iir_Kind_Ascending_Type_Attribute => 1735, + Iir_Kind_Image_Attribute => 1741, + Iir_Kind_Value_Attribute => 1747, + Iir_Kind_Pos_Attribute => 1753, + Iir_Kind_Val_Attribute => 1759, + Iir_Kind_Succ_Attribute => 1765, + Iir_Kind_Pred_Attribute => 1771, + Iir_Kind_Leftof_Attribute => 1777, + Iir_Kind_Rightof_Attribute => 1783, + Iir_Kind_Delayed_Attribute => 1792, + Iir_Kind_Stable_Attribute => 1801, + Iir_Kind_Quiet_Attribute => 1810, + Iir_Kind_Transaction_Attribute => 1819, + Iir_Kind_Event_Attribute => 1823, + Iir_Kind_Active_Attribute => 1827, + Iir_Kind_Last_Event_Attribute => 1831, + Iir_Kind_Last_Active_Attribute => 1835, + Iir_Kind_Last_Value_Attribute => 1839, + Iir_Kind_Driving_Attribute => 1843, + Iir_Kind_Driving_Value_Attribute => 1847, + Iir_Kind_Behavior_Attribute => 1847, + Iir_Kind_Structure_Attribute => 1847, + Iir_Kind_Simple_Name_Attribute => 1854, + Iir_Kind_Instance_Name_Attribute => 1859, + Iir_Kind_Path_Name_Attribute => 1864, + Iir_Kind_Left_Array_Attribute => 1871, + Iir_Kind_Right_Array_Attribute => 1878, + Iir_Kind_High_Array_Attribute => 1885, + Iir_Kind_Low_Array_Attribute => 1892, + Iir_Kind_Length_Array_Attribute => 1899, + Iir_Kind_Ascending_Array_Attribute => 1906, + Iir_Kind_Range_Array_Attribute => 1913, + Iir_Kind_Reverse_Range_Array_Attribute => 1920, + Iir_Kind_Attribute_Name => 1929 ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -6323,8 +6318,8 @@ package body Nodes_Meta is return Get_Design_Unit_Source_Col (N); when Field_String_Length => return Get_String_Length (N); - when Field_Choice_Position => - return Get_Choice_Position (N); + when Field_Choice_Order => + return Get_Choice_Order (N); when Field_PSL_Nbr_States => return Get_PSL_Nbr_States (N); when others => @@ -6343,8 +6338,8 @@ package body Nodes_Meta is Set_Design_Unit_Source_Col (N, V); when Field_String_Length => Set_String_Length (N, V); - when Field_Choice_Position => - Set_Choice_Position (N, V); + when Field_Choice_Order => + Set_Choice_Order (N, V); when Field_PSL_Nbr_States => Set_PSL_Nbr_States (N, V); when others => @@ -7038,7 +7033,7 @@ package body Nodes_Meta is return K = Iir_Kind_Waveform_Element; end Has_Time; - function Has_Choice_Position (K : Iir_Kind) return Boolean is + function Has_Choice_Order (K : Iir_Kind) return Boolean is begin case K is when Iir_Kind_Choice_By_Range @@ -7050,7 +7045,7 @@ package body Nodes_Meta is when others => return False; end case; - end Has_Choice_Position; + end Has_Choice_Order; function Has_Associated_Expr (K : Iir_Kind) return Boolean is begin @@ -10622,11 +10617,6 @@ package body Nodes_Meta is case K is when Iir_Kind_Conditional_Waveform | Iir_Kind_Conditional_Expression - | Iir_Kind_Choice_By_Range - | Iir_Kind_Choice_By_Expression - | Iir_Kind_Choice_By_Others - | Iir_Kind_Choice_By_None - | Iir_Kind_Choice_By_Name | Iir_Kind_Component_Configuration | Iir_Kind_Disconnection_Specification | Iir_Kind_Configuration_Specification diff --git a/src/vhdl/nodes_meta.ads b/src/vhdl/nodes_meta.ads index 16b1a14e6..c7b8c9924 100644 --- a/src/vhdl/nodes_meta.ads +++ b/src/vhdl/nodes_meta.ads @@ -117,7 +117,7 @@ package Nodes_Meta is Field_After_Drivers_Flag, Field_We_Value, Field_Time, - Field_Choice_Position, + Field_Choice_Order, Field_Associated_Expr, Field_Associated_Block, Field_Associated_Chain, @@ -407,7 +407,6 @@ package Nodes_Meta is Attr_Forward_Ref, Attr_Maybe_Forward_Ref, Attr_Maybe_Ref, - Attr_Maybe_Ref_Chain, Attr_Of_Maybe_Ref, Attr_Of_Ref, Attr_Ref @@ -646,7 +645,7 @@ package Nodes_Meta is function Has_After_Drivers_Flag (K : Iir_Kind) return Boolean; function Has_We_Value (K : Iir_Kind) return Boolean; function Has_Time (K : Iir_Kind) return Boolean; - function Has_Choice_Position (K : Iir_Kind) return Boolean; + function Has_Choice_Order (K : Iir_Kind) return Boolean; function Has_Associated_Expr (K : Iir_Kind) return Boolean; function Has_Associated_Block (K : Iir_Kind) return Boolean; function Has_Associated_Chain (K : Iir_Kind) return Boolean; diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index e0f42eb0e..cacaff1df 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -5096,7 +5096,6 @@ package body Parse is -- Leave tok_double_arrow as current token. procedure Parse_Choices (Expr: Iir; First_Loc : Location_Type; - Pos : in out Int32; Chain : out Iir) is First, Last : Iir; @@ -5109,9 +5108,6 @@ package body Parse is Loc := First_Loc; loop A_Choice := Parse_A_Choice (Expr1, Loc); - Set_Choice_Position (A_Choice, Pos); - Pos := Pos + 1; - if First /= Null_Iir then Set_Same_Alternative_Flag (A_Choice, True); if Get_Kind (A_Choice) = Iir_Kind_Choice_By_Others then @@ -5152,7 +5148,6 @@ package body Parse is Last : Iir; Assoc: Iir; Loc, Right_Loc : Location_Type; - Pos : Int32; begin Loc := Get_Token_Location; @@ -5216,12 +5211,9 @@ package body Parse is Res := Create_Iir (Iir_Kind_Aggregate); Set_Location (Res, Loc); Build_Init (Last); - Pos := 0; loop if Current_Token = Tok_Others then Assoc := Parse_A_Choice (Null_Iir, Loc); - Set_Choice_Position (Assoc, Pos); - Pos := Pos + 1; Expect (Tok_Double_Arrow); -- Eat '=>' @@ -5242,10 +5234,8 @@ package body Parse is | Tok_Right_Paren => Assoc := Create_Iir (Iir_Kind_Choice_By_None); Set_Location (Assoc, Loc); - Set_Choice_Position (Assoc, Pos); - Pos := Pos + 1; when others => - Parse_Choices (Expr, Loc, Pos, Assoc); + Parse_Choices (Expr, Loc, Assoc); Expect (Tok_Double_Arrow); -- Eat '=>'. @@ -6187,7 +6177,6 @@ package body Parse is Target : Iir; Last : Iir; When_Loc : Location_Type; - Pos : Int32; begin -- Skip 'with'. Scan; @@ -6209,7 +6198,6 @@ package body Parse is Parse_Options (Res); Build_Init (Last); - Pos := 0; loop Wf_Chain := Parse_Waveform; Expect (Tok_When, "'when' expected after waveform"); @@ -6218,7 +6206,7 @@ package body Parse is -- Eat 'when'. Scan; - Parse_Choices (Null_Iir, When_Loc, Pos, Assoc); + Parse_Choices (Null_Iir, When_Loc, Assoc); Set_Associated_Chain (Assoc, Wf_Chain); Append_Subchain (Last, Res, Assoc); exit when Current_Token /= Tok_Comma; @@ -6774,7 +6762,6 @@ package body Parse is Assoc: Iir; Last_Assoc : Iir; When_Loc : Location_Type; - Pos : Int32; begin Stmt := Create_Iir (Iir_Kind_Case_Statement); Set_Label (Stmt, Label); @@ -6794,14 +6781,13 @@ package body Parse is end if; Build_Init (Last_Assoc); - Pos := 0; while Current_Token = Tok_When loop When_Loc := Get_Token_Location; -- Skip 'when'. Scan; - Parse_Choices (Null_Iir, When_Loc, Pos, Assoc); + Parse_Choices (Null_Iir, When_Loc, Assoc); -- Skip '=>'. Expect_Scan (Tok_Double_Arrow); @@ -8268,8 +8254,7 @@ package body Parse is -- case_generate_alternative ::= -- WHEN [ /alternative/_label : ] choices => -- generate_statement_body - procedure Parse_Case_Generate_Alternative - (Parent : Iir; Assoc : out Iir; Pos : in out Int32) + procedure Parse_Case_Generate_Alternative (Parent : Iir; Assoc : out Iir) is Loc : Location_Type; Alt_Label : Name_Id; @@ -8288,11 +8273,9 @@ package body Parse is Error_Msg_Parse ("missing expression in alternative"); Assoc := Create_Iir (Iir_Kind_Choice_By_Expression); Set_Location (Assoc); - Set_Choice_Position (Assoc, Pos); - Pos := Pos + 1; elsif Current_Token = Tok_Others then -- 'others' is not an expression! - Parse_Choices (Null_Iir, Loc, Pos, Assoc); + Parse_Choices (Null_Iir, Loc, Assoc); else Expr := Parse_Expression; @@ -8313,7 +8296,7 @@ package body Parse is Scan; end if; - Parse_Choices (Expr, Loc, Pos, Assoc); + Parse_Choices (Expr, Loc, Assoc); end if; -- Set location of label (if any, for xref) or location of 'when'. @@ -8346,7 +8329,6 @@ package body Parse is Res : Iir; Alt : Iir; Last_Alt : Iir; - Pos : Int32; begin if Label = Null_Identifier then Error_Msg_Parse ("a generate statement must have a label"); @@ -8368,9 +8350,8 @@ package body Parse is end if; Last_Alt := Null_Iir; - Pos := 0; while Current_Token = Tok_When loop - Parse_Case_Generate_Alternative (Res, Alt, Pos); + Parse_Case_Generate_Alternative (Res, Alt); if Last_Alt = Null_Iir then Set_Case_Statement_Alternative_Chain (Res, Alt); else diff --git a/src/vhdl/sem_assocs.adb b/src/vhdl/sem_assocs.adb index 251563c3f..04b8c8807 100644 --- a/src/vhdl/sem_assocs.adb +++ b/src/vhdl/sem_assocs.adb @@ -871,14 +871,12 @@ package body Sem_Assocs is Index_Tlist : constant Iir_Flist := Get_Index_Subtype_List (Atype); Nbr_Dims : constant Natural := Get_Nbr_Elements (Index_Tlist); Index_Type : constant Iir := Get_Nth_Element (Index_Tlist, Dim - 1); + Chain : constant Iir := Get_Individual_Association_Chain (Assoc); Low, High : Iir; - Chain : Iir; El : Iir; begin - Chain := Get_Individual_Association_Chain (Assoc); Sem_Check_Continuous_Choices - (Chain, Index_Type, Low, High, Get_Location (Assoc), False, False); - Set_Individual_Association_Chain (Assoc, Chain); + (Chain, Index_Type, Low, High, Get_Location (Assoc), False); if Dim < Nbr_Dims then El := Chain; while El /= Null_Iir loop diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index ff9cb177f..91bec3d53 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -2438,13 +2438,12 @@ package body Sem_Expr is Disc_Heap_Sort (Info.Nbr_Choices); end Sort_Discrete_Choices; - procedure Sem_Check_Continuous_Choices (Choice_Chain : in out Iir; + procedure Sem_Check_Continuous_Choices (Choice_Chain : Iir; Choice_Type : Iir; Low : out Iir; High : out Iir; Loc : Location_Type; - Is_Sub_Range : Boolean; - Reorder_Choices : Boolean) + Is_Sub_Range : Boolean) is -- Nodes that can appear. Info : Choice_Info_Type; @@ -2513,6 +2512,10 @@ package body Sem_Expr is Fill_Choices_Array (Info, Choice_Chain); Sort_Discrete_Choices (Info); + for I in Info.Arr'Range loop + Set_Choice_Order (Info.Arr (I), Int32 (I)); + end loop; + -- Set low and high bounds. if Info.Nbr_Choices > 0 then Low := Get_Assoc_Low (Info.Arr (Info.Arr'First)); @@ -2634,98 +2637,6 @@ package body Sem_Expr is "'others' choice allowed only if the index constraint is static"); end if; - if Reorder_Choices then - declare - Ngroups : Int32; - begin - - -- First, set Associated_Expr and Associated_Chain for nodes with - -- the same alternative. - declare - Assoc_Expr : Iir; - Assoc_Chain : Iir; - Assoc : Iir; - begin - Assoc := Choice_Chain; - Assoc_Expr := Null_Iir; - Assoc_Chain := Null_Iir; - Ngroups := 0; - while Assoc /= Null_Iir loop - if Get_Same_Alternative_Flag (Assoc) then - Set_Is_Ref (Assoc, True); - Set_Associated_Expr (Assoc, Assoc_Expr); - Set_Associated_Chain (Assoc, Assoc_Chain); - Set_Same_Alternative_Flag (Assoc, False); - else - Set_Is_Ref (Assoc, False); - Assoc_Expr := Get_Associated_Expr (Assoc); - Assoc_Chain := Get_Associated_Chain (Assoc); - Ngroups := Ngroups + 1; - end if; - - -- The choice position is now a group id. - Set_Choice_Position (Assoc, Ngroups); - Assoc := Get_Chain (Assoc); - end loop; - end; - - -- Then set Is_Ref on the first alternative. - declare - type Group_Array is array (1 .. Ngroups) of Boolean; - type Group_Acc is access Group_Array; - procedure Free is new Ada.Unchecked_Deallocation - (Group_Array, Group_Acc); - Groups : Group_Acc; - Gid : Int32; - Pos : Int32; - Assoc : Iir; - begin - Groups := new Group_Array'(others => False); - for I in Info.Arr'Range loop - Gid := Get_Choice_Position (Info.Arr (I)); - if Groups (Gid) then - -- Already handled. - Set_Is_Ref (Info.Arr (I), True); - else - Groups (Gid) := True; - Set_Is_Ref (Info.Arr (I), False); - end if; - end loop; - - Free (Groups); - - -- Restore Choice_Position. - Assoc := Choice_Chain; - Pos := 0; - while Assoc /= Null_Iir loop - Set_Choice_Position (Assoc, Pos); - Pos := Pos + 1; - Assoc := Get_Chain (Assoc); - end loop; - end; - - -- Then reorder. - declare - Assoc : Iir; - Assoc1 : Iir; - begin - Choice_Chain := Info.Arr (Info.Arr'First); - Assoc := Choice_Chain; - for I in Info.Arr'First + 1 .. Info.Arr'Last loop - Assoc1 := Info.Arr (I); - Set_Chain (Assoc, Assoc1); - Assoc := Assoc1; - end loop; - Assoc1 := Info.Others_Choice; - if Assoc1 /= Null_Iir then - Set_Chain (Assoc, Assoc1); - Assoc := Assoc1; - end if; - Set_Chain (Assoc, Null_Iir); - end; - end; - end if; - Free (Info.Arr); end Sem_Check_Continuous_Choices; @@ -2961,8 +2872,8 @@ package body Sem_Expr is return; end if; - Sem_Check_Continuous_Choices (Choice_Chain, Choice_Type, Low, High, Loc, - Is_Sub_Range, False); -- not Is_Case_Stmt); + Sem_Check_Continuous_Choices + (Choice_Chain, Choice_Type, Low, High, Loc, Is_Sub_Range); end Sem_Choices_Range; -- Perform semantisation on a (sub)aggregate AGGR, which is of type @@ -3037,7 +2948,6 @@ package body Sem_Expr is Set_Associated_Chain (N_El, Get_Associated_Chain (Ass)); Set_Chain (N_El, Get_Chain (Ass)); Set_Same_Alternative_Flag (N_El, Get_Same_Alternative_Flag (Ass)); - Set_Choice_Position (N_El, Get_Choice_Position (Ass)); Free_Iir (Ass); Add_Match (N_El, Aggr_El); @@ -3149,12 +3059,6 @@ package body Sem_Expr is pragma Assert (not Ok); null; end if; - else - -- Always set associated expression. - pragma Assert (Expr = Null_Iir); - pragma Assert (Prev_El /= Null_Iir); - Set_Associated_Expr (El, Get_Associated_Expr (Prev_El)); - Set_Is_Ref (El, True); end if; Prev_El := El; diff --git a/src/vhdl/sem_expr.ads b/src/vhdl/sem_expr.ads index 696217c7b..1e6ada5ba 100644 --- a/src/vhdl/sem_expr.ads +++ b/src/vhdl/sem_expr.ads @@ -206,13 +206,12 @@ package Sem_Expr is -- IS_SUB_RANGE True, they must be within SUB_TYPE. -- The choices must be locally static. -- If REORDER_CHOICES is true, CHOICE_CHAIN is ordered. - procedure Sem_Check_Continuous_Choices (Choice_Chain : in out Iir; + procedure Sem_Check_Continuous_Choices (Choice_Chain : Iir; Choice_Type : Iir; Low : out Iir; High : out Iir; Loc : Location_Type; - Is_Sub_Range : Boolean; - Reorder_Choices : Boolean); + Is_Sub_Range : Boolean); -- Analyze CHOICE_LIST when the choice expression SEL is of a -- one-dimensional character array type. diff --git a/src/vhdl/sem_inst.adb b/src/vhdl/sem_inst.adb index 8884ae7c5..fb67f61d2 100644 --- a/src/vhdl/sem_inst.adb +++ b/src/vhdl/sem_inst.adb @@ -275,12 +275,6 @@ package body Sem_Inst is end if; when Attr_Chain => R := Instantiate_Iir_Chain (S); - when Attr_Maybe_Ref_Chain => - if Get_Is_Ref (N) then - R := Instantiate_Iir (S, True); - else - R := Instantiate_Iir_Chain (S); - end if; when Attr_Chain_Next => R := Null_Iir; when Attr_Of_Ref | Attr_Of_Maybe_Ref => @@ -743,10 +737,6 @@ package body Sem_Inst is end if; when Attr_Chain => Set_Instance_On_Chain (S, S_Inst); - when Attr_Maybe_Ref_Chain => - if not Get_Is_Ref (N) then - Set_Instance_On_Chain (S, S_Inst); - end if; when Attr_Chain_Next => null; when Attr_Of_Ref | Attr_Of_Maybe_Ref => @@ -1134,10 +1124,6 @@ package body Sem_Inst is end if; when Attr_Chain => Substitute_On_Chain (S, E, Rep); - when Attr_Maybe_Ref_Chain => - if not Get_Is_Ref (N) then - Substitute_On_Chain (S, E, Rep); - end if; when Attr_Chain_Next => null; when Attr_Of_Ref | Attr_Of_Maybe_Ref => diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb index 91ea199aa..e1770ad90 100644 --- a/src/vhdl/translate/trans-chap2.adb +++ b/src/vhdl/translate/trans-chap2.adb @@ -1405,10 +1405,6 @@ package body Trans.Chap2 is end if; when Attr_Chain => Instantiate_Iir_Chain_Info (Get_Iir (N, F)); - when Attr_Maybe_Ref_Chain => - if not Get_Is_Ref (N) then - Instantiate_Iir_Chain_Info (Get_Iir (N, F)); - end if; when Attr_Chain_Next => null; when Attr_Of_Ref | Attr_Of_Maybe_Ref => diff --git a/src/vhdl/translate/trans-chap9.adb b/src/vhdl/translate/trans-chap9.adb index 45068c733..1029275ce 100644 --- a/src/vhdl/translate/trans-chap9.adb +++ b/src/vhdl/translate/trans-chap9.adb @@ -1302,10 +1302,6 @@ package body Trans.Chap9 is end if; when Attr_Chain => Destroy_Types_In_Chain (Get_Iir (N, F)); - when Attr_Maybe_Ref_Chain => - if not Get_Is_Ref (N) then - Destroy_Types_In_Chain (Get_Iir (N, F)); - end if; when Attr_Chain_Next => null; when Attr_Of_Ref | Attr_Of_Maybe_Ref => -- cgit v1.2.3