diff options
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/canon.adb | 52 | ||||
-rw-r--r-- | src/vhdl/configuration.adb | 7 | ||||
-rw-r--r-- | src/vhdl/disp_vhdl.adb | 11 | ||||
-rw-r--r-- | src/vhdl/flists.adb | 4 | ||||
-rw-r--r-- | src/vhdl/flists.ads | 2 | ||||
-rw-r--r-- | src/vhdl/iirs.adb | 16 | ||||
-rw-r--r-- | src/vhdl/iirs.ads | 11 | ||||
-rw-r--r-- | src/vhdl/iirs_utils.adb | 14 | ||||
-rw-r--r-- | src/vhdl/iirs_utils.ads | 3 | ||||
-rw-r--r-- | src/vhdl/nodes_meta.adb | 20 | ||||
-rw-r--r-- | src/vhdl/parse.adb | 58 | ||||
-rw-r--r-- | src/vhdl/sem_specs.adb | 18 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap1.adb | 5 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap5.adb | 5 |
14 files changed, 133 insertions, 93 deletions
diff --git a/src/vhdl/canon.adb b/src/vhdl/canon.adb index ed920f89a..f4050f92e 100644 --- a/src/vhdl/canon.adb +++ b/src/vhdl/canon.adb @@ -2216,7 +2216,7 @@ package body Canon is Bind : Iir; Comp : Iir; - Instances : Iir_List; + Instances : Iir_Flist; Entity_Aspect : Iir; Block : Iir_Block_Configuration; Map_Chain : Iir; @@ -2229,9 +2229,9 @@ package body Canon is Instances := Get_Instantiation_List (Cfg); -- Designator_all and designator_others must have been replaced -- by a list during canon. - pragma Assert (Instances not in Iir_Lists_All_Others); + pragma Assert (Instances not in Iir_Flists_All_Others); Bind := Get_Default_Binding_Indication - (Get_Named_Entity (Get_First_Element (Instances))); + (Get_Named_Entity (Get_Nth_Element (Instances, 0))); if Bind = Null_Iir then -- Component is not bound. return; @@ -2429,7 +2429,7 @@ package body Canon is Res_Binding : Iir_Binding_Indication; Entity : Iir; Instance_List : Iir_List; - Conf_Instance_List : Iir_List; + Conf_Instance_List : Iir_Flist; Instance : Iir; Instance_Name : Iir; N_Nbr : Natural; @@ -2479,10 +2479,9 @@ package body Canon is -- replace component_configuration of them -- remove them in the instance list of COMP_CONF Instance_List := Create_Iir_List; - Set_Instantiation_List (Res, Instance_List); Conf_Instance_List := Get_Instantiation_List (Comp_Conf); N_Nbr := 0; - for I in 0 .. Get_Nbr_Elements (Conf_Instance_List) - 1 loop + for I in Flist_First .. Flist_Last (Conf_Instance_List) loop Instance_Name := Get_Nth_Element (Conf_Instance_List, I); Instance := Get_Named_Entity (Instance_Name); if Get_Component_Configuration (Instance) = Conf_Spec then @@ -2490,11 +2489,13 @@ package body Canon is Set_Component_Configuration (Instance, Res); Append_Element (Instance_List, Instance_Name); else - Replace_Nth_Element (Conf_Instance_List, N_Nbr, Instance_Name); + Set_Nth_Element (Conf_Instance_List, N_Nbr, Instance_Name); N_Nbr := N_Nbr + 1; end if; end loop; - Set_Nbr_Elements (Conf_Instance_List, N_Nbr); + Set_Instantiation_List (Comp_Conf, + Truncate_Flist (Conf_Instance_List, N_Nbr)); + Set_Instantiation_List (Res, List_To_Flist (Instance_List)); -- Insert RES. Set_Chain (Res, Get_Chain (Comp_Conf)); @@ -2502,7 +2503,7 @@ package body Canon is end Canon_Incremental_Binding; procedure Canon_Component_Specification_All_Others - (Conf : Iir; Parent : Iir; Spec : Iir_List; List : Iir_List; Comp : Iir) + (Conf : Iir; Parent : Iir; Spec : Iir_Flist; List : Iir_List; Comp : Iir) is El : Iir; Comp_Conf : Iir; @@ -2526,14 +2527,14 @@ package body Canon is -- The component is already configured. -- Handle incremental configuration. if Get_Kind (Comp_Conf) = Iir_Kind_Configuration_Specification - and then Spec = Iir_List_All + and then Spec = Iir_Flist_All then -- FIXME: handle incremental configuration. raise Internal_Error; end if; -- Several component configuration for an instance. -- Must have been caught by sem. - pragma Assert (Spec = Iir_List_Others); + pragma Assert (Spec = Iir_Flist_Others); end if; end if; El := Get_Chain (El); @@ -2541,15 +2542,14 @@ package body Canon is end Canon_Component_Specification_All_Others; procedure Canon_Component_Specification_List - (Conf : Iir; Parent : Iir; Spec : Iir_List) + (Conf : Iir; Parent : Iir; Spec : Iir_Flist) is El : Iir; Comp_Conf : Iir; begin -- Already has a designator list. - for I in Natural loop + for I in Flist_First .. Flist_Last (Spec) loop El := Get_Nth_Element (Spec, I); - exit when El = Null_Iir; El := Get_Named_Entity (El); Comp_Conf := Get_Component_Configuration (El); if Comp_Conf /= Null_Iir and then Comp_Conf /= Conf then @@ -2567,15 +2567,15 @@ package body Canon is -- PARENT is the parent for the chain of concurrent statements. procedure Canon_Component_Specification (Conf : Iir; Parent : Iir) is - Spec : constant Iir_List := Get_Instantiation_List (Conf); + Spec : constant Iir_Flist := Get_Instantiation_List (Conf); List : Iir_Designator_List; begin - if Spec in Iir_Lists_All_Others then + if Spec in Iir_Flists_All_Others then List := Create_Iir_List; Canon_Component_Specification_All_Others (Conf, Parent, Spec, List, Get_Named_Entity (Get_Component_Name (Conf))); - Set_Instantiation_List (Conf, List); + Set_Instantiation_List (Conf, List_To_Flist (List)); else -- Has Already a designator list. Canon_Component_Specification_List (Conf, Parent, Spec); @@ -2586,7 +2586,7 @@ package body Canon is procedure Canon_Disconnection_Specification (Dis : Iir_Disconnection_Specification; Decl_Parent : Iir) is - Signal_List : Iir_List; + Signal_List : Iir_Flist; Force : Boolean; El : Iir; N_List : Iir_Designator_List; @@ -2598,9 +2598,9 @@ package body Canon is if Canon_Flag_Specification_Lists then Signal_List := Get_Signal_List (Dis); - if Signal_List = Iir_List_All then + if Signal_List = Iir_Flist_All then Force := True; - elsif Signal_List = Iir_List_Others then + elsif Signal_List = Iir_Flist_Others then Force := False; else -- User list: nothing to do. @@ -2609,7 +2609,6 @@ package body Canon is Dis_Type := Get_Type (Get_Type_Mark (Dis)); N_List := Create_Iir_List; - Set_Signal_List (Dis, N_List); Set_Is_Ref (Dis, True); El := Get_Declaration_Chain (Decl_Parent); while El /= Null_Iir loop @@ -2628,6 +2627,7 @@ package body Canon is end if; El := Get_Chain (El); end loop; + Set_Signal_List (Dis, List_To_Flist (N_List)); end if; end Canon_Disconnection_Specification; @@ -2941,7 +2941,7 @@ package body Canon is Comp_Conf : Iir; Res : Iir_Component_Configuration; Designator_List : Iir_List; - Inst_List : Iir_List; + Inst_List : Iir_Flist; Inst : Iir; Inst_Name : Iir; begin @@ -2960,7 +2960,8 @@ package body Canon is Designator_List := Create_Iir_List; Append_Element (Designator_List, Build_Simple_Name (El, El)); - Set_Instantiation_List (Res, Designator_List); + Set_Instantiation_List + (Res, List_To_Flist (Designator_List)); Append (Last_Item, Conf, Res); end if; elsif Get_Kind (Comp_Conf) @@ -2978,7 +2979,7 @@ package body Canon is -- statements parts (vhdl-87 generate issue). Inst_List := Get_Instantiation_List (Comp_Conf); Designator_List := Create_Iir_List; - for I in 0 .. Get_Nbr_Elements (Inst_List) - 1 loop + for I in Flist_First .. Flist_Last (Inst_List) loop Inst_Name := Get_Nth_Element (Inst_List, I); Inst := Get_Named_Entity (Inst_Name); if Get_Component_Configuration (Inst) = Comp_Conf @@ -2989,7 +2990,8 @@ package body Canon is Build_Reference_Name (Inst_Name)); end if; end loop; - Set_Instantiation_List (Res, Designator_List); + Set_Instantiation_List + (Res, List_To_Flist (Designator_List)); Set_Binding_Indication (Res, Get_Binding_Indication (Comp_Conf)); Set_Is_Ref (Res, True); diff --git a/src/vhdl/configuration.adb b/src/vhdl/configuration.adb index 9e425731f..f02c17d25 100644 --- a/src/vhdl/configuration.adb +++ b/src/vhdl/configuration.adb @@ -425,7 +425,7 @@ package body Configuration is Inst_Inter_Chain : Iir; Err : Boolean; Inst : Iir; - Inst_List : Iir_List; + Inst_List : Iir_Flist; Formal : Iir; Assoc_1 : Iir; Inter_1 : Iir; @@ -460,9 +460,8 @@ package body Configuration is -- Second pass: check for port connected to open in instantiation. Inst_List := Get_Instantiation_List (Conf); - for I in Natural loop + for I in Flist_First .. Flist_Last (Inst_List) loop Inst := Get_Nth_Element (Inst_List, I); - exit when Inst = Null_Iir; Inst := Get_Named_Entity (Inst); Err := False; @@ -543,7 +542,7 @@ package body Configuration is begin if Bind = Null_Iir then if Is_Warning_Enabled (Warnid_Binding) then - Inst := Get_First_Element (Get_Instantiation_List (Conf)); + Inst := Get_Nth_Element (Get_Instantiation_List (Conf), 0); Inst := Strip_Denoting_Name (Inst); Warning_Msg_Elab (Warnid_Binding, Conf, diff --git a/src/vhdl/disp_vhdl.adb b/src/vhdl/disp_vhdl.adb index 6ff630e04..e36e1e1fd 100644 --- a/src/vhdl/disp_vhdl.adb +++ b/src/vhdl/disp_vhdl.adb @@ -1525,18 +1525,17 @@ package body Disp_Vhdl is end if; end Disp_Subprogram_Body; - procedure Disp_Instantiation_List (Insts: Iir_List) is + procedure Disp_Instantiation_List (Insts: Iir_Flist) is El : Iir; begin - if Insts = Iir_List_All then + if Insts = Iir_Flist_All then Put ("all"); - elsif Insts = Iir_List_Others then + elsif Insts = Iir_Flist_Others then Put ("others"); else - for I in Natural loop + for I in Flist_First .. Flist_Last (Insts) loop El := Get_Nth_Element (Insts, I); - exit when El = Null_Iir; - if I /= Natural'First then + if I /= Flist_First then Put (", "); end if; Disp_Name (El); diff --git a/src/vhdl/flists.adb b/src/vhdl/flists.adb index 4aca3d6ad..4c8067542 100644 --- a/src/vhdl/flists.adb +++ b/src/vhdl/flists.adb @@ -133,9 +133,9 @@ package body Flists is Flist := Null_Flist; end Destroy_Flist; - function Flast (Flist : Flist_Type) return Natural is + function Flast (Flist : Flist_Type) return Integer is begin - return Natural (Flistt.Table (Flist).Len - 1); + return Integer (Flistt.Table (Flist).Len - 1); end Flast; function Length (Flist : Flist_Type) return Natural is diff --git a/src/vhdl/flists.ads b/src/vhdl/flists.ads index 43f5ceca0..6c05d7695 100644 --- a/src/vhdl/flists.ads +++ b/src/vhdl/flists.ads @@ -38,7 +38,7 @@ package Flists is -- First and last index of FLIST. Could be used to iterate. Ffirst : constant Natural := 0; - function Flast (Flist : Flist_Type) return Natural; + function Flast (Flist : Flist_Type) return Integer; -- Return the length of FLIST. function Length (Flist : Flist_Type) return Natural; diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb index 2fb4f5d34..d3210dfaa 100644 --- a/src/vhdl/iirs.adb +++ b/src/vhdl/iirs.adb @@ -1275,20 +1275,20 @@ package body Iirs is Set_Field4 (Val, Attr); end Set_Attribute_Specification; - function Get_Signal_List (Target : Iir) return Iir_List is + function Get_Signal_List (Target : Iir) return Iir_Flist is begin pragma Assert (Target /= Null_Iir); pragma Assert (Has_Signal_List (Get_Kind (Target)), "no field Signal_List"); - return Iir_To_Iir_List (Get_Field3 (Target)); + return Iir_To_Iir_Flist (Get_Field3 (Target)); end Get_Signal_List; - procedure Set_Signal_List (Target : Iir; List : Iir_List) is + procedure Set_Signal_List (Target : Iir; List : Iir_Flist) is begin pragma Assert (Target /= Null_Iir); pragma Assert (Has_Signal_List (Get_Kind (Target)), "no field Signal_List"); - Set_Field3 (Target, Iir_List_To_Iir (List)); + Set_Field3 (Target, Iir_Flist_To_Iir (List)); end Set_Signal_List; function Get_Designated_Entity (Val : Iir_Attribute_Value) return Iir is @@ -4283,20 +4283,20 @@ package body Iirs is Set_Field4 (Target, Name); end Set_Component_Name; - function Get_Instantiation_List (Target : Iir) return Iir_List is + function Get_Instantiation_List (Target : Iir) return Iir_Flist is begin pragma Assert (Target /= Null_Iir); pragma Assert (Has_Instantiation_List (Get_Kind (Target)), "no field Instantiation_List"); - return Iir_To_Iir_List (Get_Field1 (Target)); + return Iir_To_Iir_Flist (Get_Field1 (Target)); end Get_Instantiation_List; - procedure Set_Instantiation_List (Target : Iir; List : Iir_List) is + procedure Set_Instantiation_List (Target : Iir; List : Iir_Flist) is begin pragma Assert (Target /= Null_Iir); pragma Assert (Has_Instantiation_List (Get_Kind (Target)), "no field Instantiation_List"); - Set_Field1 (Target, Iir_List_To_Iir (List)); + Set_Field1 (Target, Iir_Flist_To_Iir (List)); end Set_Instantiation_List; function Get_Entity_Aspect (Target : Iir_Binding_Indication) return Iir is diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads index 3ec70eaa8..de5348584 100644 --- a/src/vhdl/iirs.ads +++ b/src/vhdl/iirs.ads @@ -5406,6 +5406,9 @@ package Iirs is Iir_Flist_Others : constant Iir_Flist := Flists.Flist_Others; Iir_Flist_All : constant Iir_Flist := Flists.Flist_All; + subtype Iir_Flists_All_Others is Iir_Flist + range Iir_Flist_Others .. Iir_Flist_All; + Flist_First : constant Natural := Flists.Ffirst; function Flist_Last (Flist : Iir_Flist) return Natural renames Flists.Flast; @@ -6001,8 +6004,8 @@ package Iirs is procedure Set_Attribute_Specification (Val : Iir; Attr : Iir); -- Field: Field3 Of_Maybe_Ref (uc) - function Get_Signal_List (Target : Iir) return Iir_List; - procedure Set_Signal_List (Target : Iir; List : Iir_List); + function Get_Signal_List (Target : Iir) return Iir_Flist; + procedure Set_Signal_List (Target : Iir; List : Iir_Flist); -- Field: Field3 Forward_Ref function Get_Designated_Entity (Val : Iir_Attribute_Value) return Iir; @@ -6952,8 +6955,8 @@ package Iirs is procedure Set_Component_Name (Target : Iir; Name : Iir); -- Field: Field1 (uc) - function Get_Instantiation_List (Target : Iir) return Iir_List; - procedure Set_Instantiation_List (Target : Iir; List : Iir_List); + function Get_Instantiation_List (Target : Iir) return Iir_Flist; + procedure Set_Instantiation_List (Target : Iir; List : Iir_Flist); -- Field: Field3 function Get_Entity_Aspect (Target : Iir_Binding_Indication) return Iir; diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb index d60bd12c0..d96be7600 100644 --- a/src/vhdl/iirs_utils.adb +++ b/src/vhdl/iirs_utils.adb @@ -74,6 +74,20 @@ package body Iirs_Utils is return Res; end List_To_Flist; + function Truncate_Flist (L : Iir_Flist; Len : Natural) return Iir_Flist + is + Res : Iir_Flist; + Temp_L : Iir_Flist; + begin + Res := Create_Iir_Flist (Len); + for I in 0 .. Len - 1 loop + Set_Nth_Element (Res, I, Get_Nth_Element (L, I)); + end loop; + Temp_L := L; + Destroy_Iir_Flist (Temp_L); + return Res; + end Truncate_Flist; + function Get_Operator_Name (Op : Iir) return Name_Id is begin case Get_Kind (Op) is diff --git a/src/vhdl/iirs_utils.ads b/src/vhdl/iirs_utils.ads index 25fb936fa..f741b4066 100644 --- a/src/vhdl/iirs_utils.ads +++ b/src/vhdl/iirs_utils.ads @@ -46,6 +46,9 @@ package Iirs_Utils is -- Convert a list L to an Flist, and free L. function List_To_Flist (L : Iir_List) return Iir_Flist; + -- Return a copy of the LEN first elements of L. L is destroyed. + function Truncate_Flist (L : Iir_Flist; Len : Natural) return Iir_Flist; + -- Convert an operator node to a name. function Get_Operator_Name (Op : Iir) return Name_Id; diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb index 12e08c5e0..995d7bb88 100644 --- a/src/vhdl/nodes_meta.adb +++ b/src/vhdl/nodes_meta.adb @@ -62,7 +62,7 @@ package body Nodes_Meta is Field_Attribute_Designator => Type_Iir, Field_Attribute_Specification_Chain => Type_Iir, Field_Attribute_Specification => Type_Iir, - Field_Signal_List => Type_Iir_List, + Field_Signal_List => Type_Iir_Flist, Field_Designated_Entity => Type_Iir, Field_Formal => Type_Iir, Field_Actual => Type_Iir, @@ -248,7 +248,7 @@ package body Nodes_Meta is Field_Parent => Type_Iir, Field_Loop_Label => Type_Iir, Field_Component_Name => Type_Iir, - Field_Instantiation_List => Type_Iir_List, + Field_Instantiation_List => Type_Iir_Flist, Field_Entity_Aspect => Type_Iir, Field_Default_Entity_Aspect => Type_Iir, Field_Binding_Indication => Type_Iir, @@ -5911,6 +5911,8 @@ package body Nodes_Meta is case F is when Field_Simple_Aggregate_List => return Get_Simple_Aggregate_List (N); + when Field_Signal_List => + return Get_Signal_List (N); when Field_Enumeration_Literal_List => return Get_Enumeration_Literal_List (N); when Field_Group_Constituent_List => @@ -5925,6 +5927,8 @@ package body Nodes_Meta is return Get_Elements_Declaration_List (N); when Field_Index_List => return Get_Index_List (N); + when Field_Instantiation_List => + return Get_Instantiation_List (N); when Field_Type_Marks_List => return Get_Type_Marks_List (N); when others => @@ -5939,6 +5943,8 @@ package body Nodes_Meta is case F is when Field_Simple_Aggregate_List => Set_Simple_Aggregate_List (N, V); + when Field_Signal_List => + Set_Signal_List (N, V); when Field_Enumeration_Literal_List => Set_Enumeration_Literal_List (N, V); when Field_Group_Constituent_List => @@ -5953,6 +5959,8 @@ package body Nodes_Meta is Set_Elements_Declaration_List (N, V); when Field_Index_List => Set_Index_List (N, V); + when Field_Instantiation_List => + Set_Instantiation_List (N, V); when Field_Type_Marks_List => Set_Type_Marks_List (N, V); when others => @@ -6089,16 +6097,12 @@ package body Nodes_Meta is return Get_Analysis_Checks_List (N); when Field_Entity_Name_List => return Get_Entity_Name_List (N); - when Field_Signal_List => - return Get_Signal_List (N); when Field_Sensitivity_List => return Get_Sensitivity_List (N); when Field_Callees_List => return Get_Callees_List (N); when Field_Guard_Sensitivity_List => return Get_Guard_Sensitivity_List (N); - when Field_Instantiation_List => - return Get_Instantiation_List (N); when Field_Overload_List => return Get_Overload_List (N); when Field_PSL_Clock_Sensitivity => @@ -6121,16 +6125,12 @@ package body Nodes_Meta is Set_Analysis_Checks_List (N, V); when Field_Entity_Name_List => Set_Entity_Name_List (N, V); - when Field_Signal_List => - Set_Signal_List (N, V); when Field_Sensitivity_List => Set_Sensitivity_List (N, V); when Field_Callees_List => Set_Callees_List (N, V); when Field_Guard_Sensitivity_List => Set_Guard_Sensitivity_List (N, V); - when Field_Instantiation_List => - Set_Instantiation_List (N, V); when Field_Overload_List => Set_Overload_List (N, V); when Field_PSL_Clock_Sensitivity => diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index 7653083c3..58be80bea 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -3914,26 +3914,35 @@ package body Parse is -- signal_list ::= signal_name { , signal_name } -- | OTHERS -- | ALL - function Parse_Signal_List return Iir_List + function Parse_Signal_List return Iir_Flist is Res : Iir_List; begin case Current_Token is when Tok_Others => + -- Skip 'others'. Scan; - return Iir_List_Others; + + return Iir_Flist_Others; + when Tok_All => + -- Skip 'all'. Scan; - return Iir_List_All; + + return Iir_Flist_All; + when others => Res := Create_Iir_List; loop Append_Element (Res, Parse_Name); exit when Current_Token = Tok_Colon; + + -- Skip ',' Expect (Tok_Comma); Scan; end loop; - return Res; + + return List_To_Flist (Res); end case; end Parse_Signal_List; @@ -8435,30 +8444,43 @@ package body Parse is -- instantiation_list ::= INSTANTIATION_label { , INSTANTIATION_label } -- | OTHERS -- | ALL - function Parse_Instantiation_List return Iir_List + -- + -- FIXME: merge with parse_signal_list ? + function Parse_Instantiation_List return Iir_Flist is Res : Iir_List; begin case Current_Token is when Tok_All => + -- Skip 'all'. Scan; - return Iir_List_All; + + return Iir_Flist_All; + when Tok_Others => + -- Skip 'others'. Scan; - return Iir_List_Others; + + return Iir_Flist_Others; + when Tok_Identifier => Res := Create_Iir_List; loop Append_Element (Res, Current_Text); + -- Skip identifier. Scan; + exit when Current_Token /= Tok_Comma; + + -- Skip ','. Expect (Tok_Comma); Scan; end loop; - return Res; + return List_To_Flist (Res); + when others => Error_Msg_Parse ("instantiation list expected"); - return Null_Iir_List; + return Null_Iir_Flist; end case; end Parse_Instantiation_List; @@ -8469,7 +8491,7 @@ package body Parse is -- component_specification ::= instantiation_list : COMPONENT_name procedure Parse_Component_Specification (Res : Iir) is - List : Iir_List; + List : Iir_Flist; begin List := Parse_Instantiation_List; Set_Instantiation_List (Res, List); @@ -8564,7 +8586,7 @@ package body Parse is -- [ block_configuration ] -- END FOR ; function Parse_Component_Configuration (Loc : Location_Type; - Inst_List : Iir_List) + Inst_List : Iir_Flist) return Iir_Component_Configuration is Res : Iir_Component_Configuration; @@ -8679,6 +8701,7 @@ package body Parse is is Loc : Location_Type; List : Iir_List; + Flist : Iir_Flist; El : Iir; begin Loc := Get_Token_Location; @@ -8690,19 +8713,19 @@ package body Parse is case Current_Token is when Tok_All => Scan; - return Parse_Component_Configuration (Loc, Iir_List_All); + return Parse_Component_Configuration (Loc, Iir_Flist_All); when Tok_Others => Scan; - return Parse_Component_Configuration (Loc, Iir_List_Others); + return Parse_Component_Configuration (Loc, Iir_Flist_Others); when Tok_Identifier => El := Current_Text; Scan; case Current_Token is when Tok_Colon => -- The identifier was a label from an instantiation list. - List := Create_Iir_List; - Append_Element (List, El); - return Parse_Component_Configuration (Loc, List); + Flist := Create_Iir_Flist (1); + Set_Nth_Element (Flist, 0, El); + return Parse_Component_Configuration (Loc, Flist); when Tok_Comma => -- The identifier was a label from an instantiation list. List := Create_Iir_List; @@ -8713,7 +8736,8 @@ package body Parse is Scan; exit when Current_Token /= Tok_Comma; end loop; - return Parse_Component_Configuration (Loc, List); + Flist := List_To_Flist (List); + return Parse_Component_Configuration (Loc, Flist); when Tok_Left_Paren => El := Parse_Name_Suffix (El); return Parse_Block_Configuration_Suffix (Loc, El); diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb index 0909315e1..a8a921c7b 100644 --- a/src/vhdl/sem_specs.adb +++ b/src/vhdl/sem_specs.adb @@ -959,7 +959,7 @@ package body Sem_Specs is Type_Mark : Iir; Atype : Iir; Time_Expr : Iir; - List : Iir_List; + List : Iir_Flist; El : Iir; Sig : Iir; Prefix : Iir; @@ -984,17 +984,16 @@ package body Sem_Specs is end if; List := Get_Signal_List (Dis); - if List = Iir_List_All or List = Iir_List_Others then + if List in Iir_Flists_All_Others then -- FIXME: checks todo null; else - for I in Natural loop + for I in Flist_First .. Flist_Last (List) loop El := Get_Nth_Element (List, I); - exit when El = Null_Iir; Sem_Name (El); El := Finish_Sem_Name (El); - Replace_Nth_Element (List, I, El); + Set_Nth_Element (List, I, El); Sig := Get_Named_Entity (El); Sig := Name_To_Object (Sig); @@ -1321,7 +1320,7 @@ package body Sem_Specs is return Res; end Apply_Component_Specification; - List : Iir_List; + List : Iir_Flist; El : Iir; Inter : Sem_Scopes.Name_Interpretation_Type; Comp : Iir; @@ -1339,7 +1338,7 @@ package body Sem_Specs is end if; List := Get_Instantiation_List (Spec); - if List = Iir_List_All then + if List = Iir_Flist_All then -- LRM93 5.2 -- * If the reserved word ALL is supplied, then the configuration -- specification applies to all instances of the specified @@ -1354,7 +1353,7 @@ package body Sem_Specs is Warning_Msg_Sem (Warnid_Specs, +Spec, "component specification applies to no instance"); end if; - elsif List = Iir_List_Others then + elsif List = Iir_Flist_Others then -- LRM93 5.2 -- * If the reserved word OTHERS is supplied, then the -- configuration specification applies to instances of the @@ -1386,9 +1385,8 @@ package body Sem_Specs is -- instantiation statement whose corresponding instantiated unit -- does not name a component. -- FIXME: error message are *really* cryptic. - for I in Natural loop + for I in Flist_First .. Flist_Last (List) loop El := Get_Nth_Element (List, I); - exit when El = Null_Iir; Inter := Sem_Scopes.Get_Interpretation (Get_Identifier (El)); if not Valid_Interpretation (Inter) then Error_Msg_Sem diff --git a/src/vhdl/translate/trans-chap1.adb b/src/vhdl/translate/trans-chap1.adb index 08b22098c..a8b61c4d4 100644 --- a/src/vhdl/translate/trans-chap1.adb +++ b/src/vhdl/translate/trans-chap1.adb @@ -568,13 +568,12 @@ package body Trans.Chap1 is -- Call the subprogram for the instantiation list. declare - List : Iir_List; + List : Iir_Flist; El : Iir; begin List := Get_Instantiation_List (Cfg); - for I in Natural loop + for I in Flist_First .. Flist_Last (List) loop El := Get_Nth_Element (List, I); - exit when El = Null_Iir; El := Get_Named_Entity (El); case Get_Kind (El) is when Iir_Kind_Component_Instantiation_Statement => diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index ac054f394..e989b8075 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -160,15 +160,14 @@ package body Trans.Chap5 is (Spec : Iir_Disconnection_Specification) is Val : O_Dnode; - List : constant Iir_List := Get_Signal_List (Spec); + List : constant Iir_Flist := Get_Signal_List (Spec); El : Iir; begin Val := Create_Temp_Init (Std_Time_Otype, Chap7.Translate_Expression (Get_Expression (Spec))); - for I in Natural loop + for I in Flist_First .. Flist_Last (List) loop El := Get_Nth_Element (List, I); - exit when El = Null_Iir; Gen_Elab_Disconnect (Chap6.Translate_Name (El, Mode_Signal), Get_Type (El), Val); end loop; |