aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Drummond <brian@shapes.demon.co.uk>2014-01-21 13:44:14 +0000
committerBrian Drummond <brian@shapes.demon.co.uk>2014-01-21 13:44:14 +0000
commit9be190a594a97727b7aad44d19b9d6c9c6928dff (patch)
tree82bfb30d6f8c87cd1336e5d6cf8f6fb4ef2bb50f
parent0e8fb20ffd776a193ca24c273f5fdf2e26df514e (diff)
downloadghdl-9be190a594a97727b7aad44d19b9d6c9c6928dff.tar.gz
ghdl-9be190a594a97727b7aad44d19b9d6c9c6928dff.tar.bz2
ghdl-9be190a594a97727b7aad44d19b9d6c9c6928dff.zip
Remove new/free for a couple of arrays in grt-signals
-rw-r--r--translate/grt/grt-signals.adb53
1 files changed, 22 insertions, 31 deletions
diff --git a/translate/grt/grt-signals.adb b/translate/grt/grt-signals.adb
index 494104ff7..13842d26c 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;