diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-05-22 08:12:23 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-05-22 08:50:36 +0200 |
commit | adf0df4cc9f8ac8bdbbe81681e6f3dffcdb76d7f (patch) | |
tree | 196207195fed976bc2b02df40fee00cbed29aa26 /src/synth | |
parent | e4bff0d914b25645bed8c28921f00f4f4c4a3293 (diff) | |
download | ghdl-adf0df4cc9f8ac8bdbbe81681e6f3dffcdb76d7f.tar.gz ghdl-adf0df4cc9f8ac8bdbbe81681e6f3dffcdb76d7f.tar.bz2 ghdl-adf0df4cc9f8ac8bdbbe81681e6f3dffcdb76d7f.zip |
netlists: use dyn_maps package for attributes.
Diffstat (limited to 'src/synth')
-rw-r--r-- | src/synth/netlists.adb | 26 | ||||
-rw-r--r-- | src/synth/netlists.ads | 20 |
2 files changed, 19 insertions, 27 deletions
diff --git a/src/synth/netlists.adb b/src/synth/netlists.adb index 52c4d1277..807d53298 100644 --- a/src/synth/netlists.adb +++ b/src/synth/netlists.adb @@ -1180,17 +1180,17 @@ package body Netlists is return Hash_Value_Type (Params); end Attribute_Hash; - function Attribute_Build (Params : Instance) return Attribute_Map_Element is + function Attribute_Build (Params : Instance) return Instance is begin - return Attribute_Map_Element'(Inst => Params, - First => No_Attribute); + return Params; end Attribute_Build; - function Attribute_Equal (Obj : Attribute_Map_Element; Params : Instance) - return Boolean is + function Attribute_Build_Value (Obj : Instance) return Attribute + is + pragma Unreferenced (Obj); begin - return Obj.Inst = Params; - end Attribute_Equal; + return No_Attribute; + end Attribute_Build_Value; package Attributes_Table is new Tables (Table_Component_Type => Attribute_Record, @@ -1198,7 +1198,6 @@ package body Netlists is Table_Low_Bound => 0, Table_Initial => 64); - procedure Set_Attribute (Inst : Instance; Id : Name_Id; Ptype : Param_Type; Pv : Pval) is @@ -1207,9 +1206,8 @@ package body Netlists is Module_Rec : Module_Record renames Modules_Table.Table (M); Attr : Attribute; Idx : Attribute_Maps.Index_Type; - Prev : Attribute_Map_Element; + Prev : Attribute; begin - if Module_Rec.Attrs = null then Module_Rec.Attrs := new Attribute_Maps.Instance; Attribute_Maps.Init (Module_Rec.Attrs.all); @@ -1217,16 +1215,14 @@ package body Netlists is Attribute_Maps.Get_Index (Module_Rec.Attrs.all, Inst, Idx); - Prev := Attribute_Maps.Get_By_Index (Module_Rec.Attrs.all, Idx); + Prev := Attribute_Maps.Get_Value (Module_Rec.Attrs.all, Idx); Attributes_Table.Append ((Name => Id, Typ => Ptype, Val => Pv, - Chain => Prev.First)); + Chain => Prev)); Attr := Attributes_Table.Last; - Attribute_Maps.Modify (Module_Rec.Attrs.all, Idx, - Attribute_Map_Element'(Inst => Inst, - First => Attr)); + Attribute_Maps.Set_Value (Module_Rec.Attrs.all, Idx, Attr); end Set_Attribute; -- Statistics diff --git a/src/synth/netlists.ads b/src/synth/netlists.ads index 703275eef..a425575ab 100644 --- a/src/synth/netlists.ads +++ b/src/synth/netlists.ads @@ -20,7 +20,7 @@ with Types; use Types; with Hash; use Hash; -with Dyn_Interning; +with Dyn_Maps; package Netlists is -- Netlists. @@ -379,22 +379,18 @@ private Chain : Attribute; end record; - type Attribute_Map_Element is record - Inst : Instance; - First : Attribute; - end record; - function Attribute_Hash (Params : Instance) return Hash_Value_Type; - function Attribute_Build (Params : Instance) return Attribute_Map_Element; - function Attribute_Equal (Obj : Attribute_Map_Element; Params : Instance) - return Boolean; + function Attribute_Build (Params : Instance) return Instance; + function Attribute_Build_Value (Obj : Instance) return Attribute; - package Attribute_Maps is new Dyn_Interning + package Attribute_Maps is new Dyn_Maps (Params_Type => Instance, - Object_Type => Attribute_Map_Element, + Object_Type => Instance, + Value_Type => Attribute, Hash => Attribute_Hash, Build => Attribute_Build, - Equal => Attribute_Equal); + Build_Value => Attribute_Build_Value, + Equal => "="); type Attribute_Map_Acc is access Attribute_Maps.Instance; |