diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-08-28 12:27:45 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-09-02 02:31:06 +0200 |
commit | 8a8f3d867598a1f9e3125c9d0648ae20a7144253 (patch) | |
tree | 9802e5c0c5e68e92acbc5c41caf3025fbe1efe02 /src/synth/synth-vhdl_expr.adb | |
parent | 91303467eac522662572d9106e2a3cb724b24a0d (diff) | |
download | ghdl-8a8f3d867598a1f9e3125c9d0648ae20a7144253.tar.gz ghdl-8a8f3d867598a1f9e3125c9d0648ae20a7144253.tar.bz2 ghdl-8a8f3d867598a1f9e3125c9d0648ae20a7144253.zip |
synth: use areapools
Diffstat (limited to 'src/synth/synth-vhdl_expr.adb')
-rw-r--r-- | src/synth/synth-vhdl_expr.adb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/synth/synth-vhdl_expr.adb b/src/synth/synth-vhdl_expr.adb index 6f33ff209..58599b109 100644 --- a/src/synth/synth-vhdl_expr.adb +++ b/src/synth/synth-vhdl_expr.adb @@ -503,7 +503,8 @@ package body Synth.Vhdl_Expr is return Create_Value_Net (Get_Value_Net (Val.Val), Ntype); when Value_Alias => return Create_Value_Alias - ((Val.Val.A_Typ, Val.Val.A_Obj), Val.Val.A_Off, Ntype); + ((Val.Val.A_Typ, Val.Val.A_Obj), Val.Val.A_Off, Ntype, + Current_Pool); when Value_Const => return Reshape_Value ((Val.Typ, Val.Val.C_Val), Ntype); when Value_Memory => @@ -684,7 +685,7 @@ package body Synth.Vhdl_Expr is Get_Subtype_Object (Syn_Inst, Get_Type (Name)); Res : Valtyp; begin - Res := Create_Value_Memory (Typ); + Res := Create_Value_Memory (Typ, Current_Pool); Write_Discrete (Res, Int64 (Get_Enum_Pos (Name))); return Res; end; @@ -700,9 +701,11 @@ package body Synth.Vhdl_Expr is | Iir_Kind_Dereference => declare Val : Valtyp; + Obj : Memtyp; begin Val := Synth_Expression (Syn_Inst, Get_Prefix (Name)); - return Elab.Vhdl_Heap.Synth_Dereference (Read_Access (Val)); + Obj := Elab.Vhdl_Heap.Synth_Dereference (Read_Access (Val)); + return Create_Value_Memory (Obj); end; when others => Error_Kind ("synth_name", Name); @@ -2014,7 +2017,8 @@ package body Synth.Vhdl_Expr is -- returns 0. return Create_Value_Memtyp (Create_Memory_Zero (Res_Typ)); elsif Is_Static (Val.Val) then - Res := Create_Value_Memory (Res_Typ); + -- TODO: why a copy ? + Res := Create_Value_Memory (Res_Typ, Current_Pool); Copy_Memory (Res.Val.Mem, Val.Val.Mem + Val.Typ.Rec.E (Idx + 1).Offs.Mem_Off, @@ -2035,7 +2039,7 @@ package body Synth.Vhdl_Expr is declare Res : Valtyp; begin - Res := Create_Value_Memory (Expr_Type); + Res := Create_Value_Memory (Expr_Type, Current_Pool); Write_Discrete (Res, Get_Value (Expr)); return Res; end; @@ -2185,22 +2189,26 @@ package body Synth.Vhdl_Expr is return Create_Value_Access (Null_Heap_Index, Expr_Type); when Iir_Kind_Allocator_By_Subtype => declare + Acc_Typ : constant Type_Acc := + Get_Subtype_Object (Syn_Inst, Get_Type (Expr)); T : Type_Acc; Acc : Heap_Index; begin T := Synth_Subtype_Indication (Syn_Inst, Get_Subtype_Indication (Expr)); - Acc := Allocate_By_Type (T); + Acc := Allocate_By_Type (Acc_Typ, T); return Create_Value_Access (Acc, Expr_Type); end; when Iir_Kind_Allocator_By_Expression => declare + Acc_Typ : constant Type_Acc := + Get_Subtype_Object (Syn_Inst, Get_Type (Expr)); V : Valtyp; Acc : Heap_Index; begin V := Synth_Expression_With_Type (Syn_Inst, Get_Expression (Expr), Expr_Type.Acc_Acc); - Acc := Allocate_By_Value (V); + Acc := Allocate_By_Value (Acc_Typ, V); return Create_Value_Access (Acc, Expr_Type); end; when Iir_Kind_Stable_Attribute => |