diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-11-08 06:16:36 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-11-08 06:16:36 +0100 |
commit | 4035edd1239f927ebd50fad88f01786db4d6a262 (patch) | |
tree | d9ca5a3210b18774b1646eb39b0a393dfb8cef1c | |
parent | 6a7904b43d7741778db890d5b59057059254b520 (diff) | |
download | ghdl-4035edd1239f927ebd50fad88f01786db4d6a262.tar.gz ghdl-4035edd1239f927ebd50fad88f01786db4d6a262.tar.bz2 ghdl-4035edd1239f927ebd50fad88f01786db4d6a262.zip |
Remove List_Others, cleanup lists.
-rw-r--r-- | src/ghdldrv/ghdlxml.adb | 36 | ||||
-rw-r--r-- | src/lists.adb | 35 | ||||
-rw-r--r-- | src/lists.ads | 14 | ||||
-rw-r--r-- | src/vhdl/disp_tree.adb | 59 | ||||
-rw-r--r-- | src/vhdl/iirs.ads | 5 | ||||
-rw-r--r-- | src/vhdl/nodes_gc.adb | 6 | ||||
-rw-r--r-- | src/vhdl/sem_inst.adb | 9 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap2.adb | 3 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap9.adb | 3 |
9 files changed, 53 insertions, 117 deletions
diff --git a/src/ghdldrv/ghdlxml.adb b/src/ghdldrv/ghdlxml.adb index cc7a5c9f4..6bad81aad 100644 --- a/src/ghdldrv/ghdlxml.adb +++ b/src/ghdldrv/ghdlxml.adb @@ -235,36 +235,32 @@ package body Ghdlxml is is El : Iir; begin - if L = Null_Iir_List then - return; - end if; - - Put_Stag (Id); case L is + when Null_Iir_List => + null; + when Iir_List_All => + Put_Stag (Id); Put_Attribute ("list-id", "all"); Put_Empty_Stag_End; - return; - when Iir_List_Others => - Put_Attribute ("list-id", "others"); - Put_Empty_Stag_End; - return; + when others => + Put_Stag (Id); Put_Attribute ("list-id", Strip (Iir_List'Image (L))); Put_Stag_End; - end case; - for I in Natural loop - El := Get_Nth_Element (L, I); - exit when El = Null_Iir; - if Ref then + for I in Natural loop + El := Get_Nth_Element (L, I); + exit when El = Null_Iir; + if Ref then Disp_Iir_Ref ("el", El); - else - Disp_Iir ("el", El); - end if; - end loop; + else + Disp_Iir ("el", El); + end if; + end loop; - Put_Etag (Id); + Put_Etag (Id); + end case; end Disp_Iir_List; procedure Disp_Iir_Flist (Id : String; L : Iir_Flist; Ref : Boolean) diff --git a/src/lists.adb b/src/lists.adb index 395409d93..211865dba 100644 --- a/src/lists.adb +++ b/src/lists.adb @@ -32,7 +32,7 @@ package body Lists is package Listt is new Tables (Table_Component_Type => List_Record, Table_Index_Type => List_Type, - Table_Low_Bound => 4, + Table_Low_Bound => 2, Table_Initial => 128); --function Get_Max_Nbr_Elements (List : List_Type) return Natural; @@ -127,17 +127,6 @@ package body Lists is end Append_Element; -- Return the last element of the list, or null. - function Get_Last_Element (List: List_Type) return Node_Type - is - L : List_Record renames Listt.Table (List); - begin - if L.Nbr = 0 then - return Null_Node; - else - return L.Els (L.Nbr - 1); - end if; - end Get_Last_Element; - -- Return the first element of the list, or null. function Get_First_Element (List: List_Type) return Node_Type is begin @@ -170,28 +159,6 @@ package body Lists is List_Set_Nbr_Elements (List, N); end Set_Nbr_Elements; - -- Return the position of the last element. - -- Return -1 if the list is empty. - function Get_Last_Element_Position (List: List_Type) return Integer is - begin - return Get_Nbr_Elements (List) - 1; - end Get_Last_Element_Position; - - function Get_Nbr_Elements_Safe (List: List_Type) return Natural is - begin - if List = Null_List then - return 0; - else - return Get_Nbr_Elements (List); - end if; - end Get_Nbr_Elements_Safe; - - -- Empty the list - procedure Empty_List (List: List_Type) is - begin - Set_Nbr_Elements (List, 0); - end Empty_List; - -- Chain of unused lists. Free_Chain : List_Type := Null_List; diff --git a/src/lists.ads b/src/lists.ads index 52b528398..c8ea274cf 100644 --- a/src/lists.ads +++ b/src/lists.ads @@ -23,9 +23,7 @@ package Lists is for List_Type'Size use 32; Null_List : constant List_Type := 0; - - List_Others : constant List_Type := 1; - List_All : constant List_Type := 2; + List_All : constant List_Type := 1; ----------- -- Lists -- @@ -81,8 +79,6 @@ package Lists is -- Return the element or null_iir, if beyond bounds. function Get_Nth_Element (List: List_Type; N: Natural) return Node_Type; - function Get_Last_Element (List: List_Type) return Node_Type; - function Get_First_Element (List: List_Type) return Node_Type; procedure Replace_Nth_Element (List: List_Type; N: Natural; El: Node_Type); @@ -94,18 +90,10 @@ package Lists is function Get_Nbr_Elements (List: List_Type) return Natural; pragma Inline (Get_Nbr_Elements); - -- Same as get_nbr_elements but returns 0 if LIST is NULL_IIR. - function Get_Nbr_Elements_Safe (List : List_Type) return Natural; - -- Set the number of elements in the list. -- Can be used only to shrink the list. procedure Set_Nbr_Elements (List: List_Type; N: Natural); - function Get_Last_Element_Position (List: List_Type) return Integer; - - -- Clear the list. - procedure Empty_List (List: List_Type); - -- Create a list. function Create_List return List_Type; diff --git a/src/vhdl/disp_tree.adb b/src/vhdl/disp_tree.adb index c01dd61cd..111e9dee4 100644 --- a/src/vhdl/disp_tree.adb +++ b/src/vhdl/disp_tree.adb @@ -69,21 +69,20 @@ package body Disp_Tree is is El: Iir; begin - if Tree_List = Null_Iir_List then - Put_Line ("null-list"); - elsif Tree_List = Iir_List_All then - Put_Line ("list-all"); - elsif Tree_List = Iir_List_Others then - Put_Line ("list-others"); - else - New_Line; - for I in Natural loop - El := Get_Nth_Element (Tree_List, I); - exit when El = Null_Iir; - Put_Indent (Tab); - Disp_Iir (El, Tab + 1, Depth); - end loop; - end if; + case Tree_List is + when Null_Iir_List => + Put_Line ("null-list"); + when Iir_List_All => + Put_Line ("list-all"); + when others => + New_Line; + for I in Natural loop + El := Get_Nth_Element (Tree_List, I); + exit when El = Null_Iir; + Put_Indent (Tab); + Disp_Iir (El, Tab + 1, Depth); + end loop; + end case; end Disp_Iir_List; procedure Disp_Iir_Flist @@ -136,22 +135,20 @@ package body Disp_Tree is is El: Iir; begin - if Tree_List = Null_Iir_List then - Put_Indent (Tab); - Put_Line (" null-list"); - elsif Tree_List = Iir_List_All then - Put_Indent (Tab); - Put_Line (" list-all"); - elsif Tree_List = Iir_List_Others then - Put_Indent (Tab); - Put_Line (" list-others"); - else - for I in Natural loop - El := Get_Nth_Element (Tree_List, I); - exit when El = Null_Iir; - Disp_Iir (El, Tab, 0); - end loop; - end if; + case Tree_List is + when Null_Iir_List => + Put_Indent (Tab); + Put_Line (" null-list"); + when Iir_List_All => + Put_Indent (Tab); + Put_Line (" list-all"); + when others => + for I in Natural loop + El := Get_Nth_Element (Tree_List, I); + exit when El = Null_Iir; + Disp_Iir (El, Tab, 0); + end loop; + end case; end Disp_Tree_List_Flat; function Image_Name_Id (Ident: Name_Id) return String diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads index 3ae0e30d6..f40b64eb8 100644 --- a/src/vhdl/iirs.ads +++ b/src/vhdl/iirs.ads @@ -5358,9 +5358,6 @@ package Iirs is subtype Iir_List is Lists.List_Type; Null_Iir_List : constant Iir_List := Lists.Null_List; Iir_List_All : constant Iir_List := Lists.List_All; - Iir_List_Others : constant Iir_List := Lists.List_Others; - subtype Iir_Lists_All_Others is Iir_List - range Iir_List_Others .. Iir_List_All; Null_Iir : constant Iir := Nodes.Null_Node; @@ -5397,8 +5394,6 @@ package Iirs is renames Lists.Set_Nbr_Elements; function Get_First_Element (L : Iir_List) return Iir renames Lists.Get_First_Element; - function Get_Last_Element (L : Iir_List) return Iir - renames Lists.Get_Last_Element; function "=" (L, R : Iir_List) return Boolean renames Lists."="; subtype Iir_Flist is Flists.Flist_Type; diff --git a/src/vhdl/nodes_gc.adb b/src/vhdl/nodes_gc.adb index e9886d13b..89da35c4e 100644 --- a/src/vhdl/nodes_gc.adb +++ b/src/vhdl/nodes_gc.adb @@ -66,8 +66,7 @@ package body Nodes_GC is begin case N is when Null_Iir_List - | Iir_List_All - | Iir_List_Others => + | Iir_List_All => null; when others => for I in Natural loop @@ -84,8 +83,7 @@ package body Nodes_GC is begin case N is when Null_Iir_List - | Iir_List_All - | Iir_List_Others => + | Iir_List_All => null; when others => for I in Natural loop diff --git a/src/vhdl/sem_inst.adb b/src/vhdl/sem_inst.adb index 10eac72dd..30785dbb3 100644 --- a/src/vhdl/sem_inst.adb +++ b/src/vhdl/sem_inst.adb @@ -172,8 +172,7 @@ package body Sem_Inst is begin case L is when Null_Iir_List - | Iir_List_All - | Iir_List_Others => + | Iir_List_All => return L; when others => Res := Create_Iir_List; @@ -756,8 +755,7 @@ package body Sem_Inst is begin case N is when Null_Iir_List - | Iir_List_All - | Iir_List_Others => + | Iir_List_All => pragma Assert (Inst = N); return; when others => @@ -1126,8 +1124,7 @@ package body Sem_Inst is begin case L is when Null_Iir_List - | Iir_List_All - | Iir_List_Others => + | Iir_List_All => return; when others => for I in Natural loop diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb index d975a2ac1..c3260008f 100644 --- a/src/vhdl/translate/trans-chap2.adb +++ b/src/vhdl/translate/trans-chap2.adb @@ -1122,8 +1122,7 @@ package body Trans.Chap2 is begin case L is when Null_Iir_List - | Iir_List_All - | Iir_List_Others => + | Iir_List_All => return; when others => for I in Natural loop diff --git a/src/vhdl/translate/trans-chap9.adb b/src/vhdl/translate/trans-chap9.adb index c6a900855..0b2d3dc2a 100644 --- a/src/vhdl/translate/trans-chap9.adb +++ b/src/vhdl/translate/trans-chap9.adb @@ -1115,8 +1115,7 @@ package body Trans.Chap9 is begin case L is when Null_Iir_List - | Iir_List_All - | Iir_List_Others => + | Iir_List_All => return; when others => for I in Natural loop |