diff options
author | Brian Drummond | 2014-01-21 13:44:14 +0000 |
---|---|---|
committer | Brian Drummond | 2014-01-21 13:44:14 +0000 |
commit | 9be190a594a97727b7aad44d19b9d6c9c6928dff (patch) | |
tree | 82bfb30d6f8c87cd1336e5d6cf8f6fb4ef2bb50f /translate/grt/grt-signals.adb | |
parent | 0e8fb20ffd776a193ca24c273f5fdf2e26df514e (diff) | |
download | ghdl-9be190a594a97727b7aad44d19b9d6c9c6928dff.tar.gz ghdl-9be190a594a97727b7aad44d19b9d6c9c6928dff.tar.bz2 ghdl-9be190a594a97727b7aad44d19b9d6c9c6928dff.zip |
Remove new/free for a couple of arrays in grt-signals
Diffstat (limited to 'translate/grt/grt-signals.adb')
-rw-r--r-- | translate/grt/grt-signals.adb | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/translate/grt/grt-signals.adb b/translate/grt/grt-signals.adb index 494104f..13842d2 100644 --- a/translate/grt/grt-signals.adb +++ b/translate/grt/grt-signals.adb @@ -2360,10 +2360,7 @@ package body Grt.Signals is -- Reorder propagation table. declare type Off_Array is array (Signal_Net_Type range <>) of Signal_Net_Type; - type Off_Array_Acc is access Off_Array; - Offs : Off_Array_Acc; - procedure Free is new Ada.Unchecked_Deallocation - (Name => Off_Array_Acc, Object => Off_Array); + Offs : Off_Array (0 .. Last_Signal_Net) := (others => 0); Last_Off : Signal_Net_Type; Num : Signal_Net_Type; @@ -2385,10 +2382,6 @@ package body Grt.Signals is type Propag_Array is array (Signal_Net_Type range <>) of Propagation_Type; - type Propag_Array_Acc is access Propag_Array; - Propag : Propag_Array_Acc; - procedure Free is new Ada.Unchecked_Deallocation - (Name => Propag_Array_Acc, Object => Propag_Array); procedure Deallocate is new Ada.Unchecked_Deallocation (Object => Forward_Build_Type, Name => Forward_Build_Acc); @@ -2396,8 +2389,6 @@ package body Grt.Signals is Net : Signal_Net_Type; begin -- 1) Count number of propagation cell per net. - Offs := new Off_Array (0 .. Last_Signal_Net); - Offs.all := (others => 0); for I in Propagation.First .. Propagation.Last loop Net := Get_Propagation_Net (I); Offs (Net) := Offs (Net) + 1; @@ -2415,27 +2406,28 @@ package body Grt.Signals is end loop; Offs (0) := Last_Off + 1; - -- 3) Gather entries by net (copy) - Propag := new Propag_Array (1 .. Last_Off); - for I in Propagation.First .. Propagation.Last loop - Net := Get_Propagation_Net (I); - if Net /= No_Signal_Net then - Propag (Offs (Net)) := Propagation.Table (I); - Offs (Net) := Offs (Net) + 1; - end if; - end loop; - Propagation.Set_Last (Last_Off); - Propagation.Release; - for I in Propagation.First .. Propagation.Last loop - if Propag (I).Kind = Imp_Forward_Build then - Propagation.Table (I) := (Kind => Imp_Forward, + declare + Propag : Propag_Array (1 .. Last_Off); -- := (others => 0); + begin + for I in Propagation.First .. Propagation.Last loop + Net := Get_Propagation_Net (I); + if Net /= No_Signal_Net then + Propag (Offs (Net)) := Propagation.Table (I); + Offs (Net) := Offs (Net) + 1; + end if; + end loop; + Propagation.Set_Last (Last_Off); + Propagation.Release; + for I in Propagation.First .. Propagation.Last loop + if Propag (I).Kind = Imp_Forward_Build then + Propagation.Table (I) := (Kind => Imp_Forward, Sig => Propag (I).Forward.Targ); - Deallocate (Propag (I).Forward); - else - Propagation.Table (I) := Propag (I); - end if; - end loop; - Free (Propag); + Deallocate (Propag (I).Forward); + else + Propagation.Table (I) := Propag (I); + end if; + end loop; + end; for I in 1 .. Last_Signal_Net loop -- Ignore holes. if Offs (I) /= 0 then @@ -2475,7 +2467,6 @@ package body Grt.Signals is end if; Sig.Link := null; end loop; - Free (Offs); end; end Create_Nets; |