aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/translate/trans-chap3.adb14
-rw-r--r--src/vhdl/translate/trans-chap4.adb8
-rw-r--r--src/vhdl/translate/trans-chap7.adb23
-rw-r--r--src/vhdl/translate/trans-chap8.adb27
-rw-r--r--src/vhdl/translate/trans.adb35
-rw-r--r--src/vhdl/translate/trans.ads29
6 files changed, 80 insertions, 56 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb
index b6acc18c5..3b0ad822c 100644
--- a/src/vhdl/translate/trans-chap3.adb
+++ b/src/vhdl/translate/trans-chap3.adb
@@ -1813,9 +1813,10 @@ package body Trans.Chap3 is
if Info.C (Kind).Size_Var /= Null_Var then
case Info.Type_Mode is
when Type_Mode_Non_Composite
- | Type_Mode_Fat_Array
- | Type_Mode_Unknown
- | Type_Mode_Protected =>
+ | Type_Mode_Unbounded_Array
+ | Type_Mode_Unbounded_Record
+ | Type_Mode_Unknown
+ | Type_Mode_Protected =>
raise Internal_Error;
when Type_Mode_Record =>
Create_Record_Size_Var (Def, Kind);
@@ -2570,15 +2571,18 @@ package body Trans.Chap3 is
when Type_Mode_Scalar
| Type_Mode_Acc
| Type_Mode_Bounds_Acc
- | Type_Mode_File =>
+ | Type_Mode_File =>
-- Scalar or thin pointer.
New_Assign_Stmt (M2Lv (Dest), Src);
- when Type_Mode_Fat_Array =>
+ when Type_Mode_Unbounded_Array =>
-- a fat array.
D := Stabilize (Dest);
Gen_Memcpy (M2Addr (Get_Array_Base (D)),
M2Addr (Get_Array_Base (E2M (Src, Info, Kind))),
Get_Object_Size (D, Obj_Type));
+ when Type_Mode_Unbounded_Record =>
+ -- TODO
+ raise Internal_Error;
when Type_Mode_Array
| Type_Mode_Record =>
D := Stabilize (Dest);
diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb
index d8b2e9582..e2a9a50c5 100644
--- a/src/vhdl/translate/trans-chap4.adb
+++ b/src/vhdl/translate/trans-chap4.adb
@@ -353,7 +353,7 @@ package body Trans.Chap4 is
-- Iterate on all elements of the object.
Open_Temp;
- if Type_Info.Type_Mode = Type_Mode_Fat_Array then
+ if Type_Info.Type_Mode = Type_Mode_Unbounded_Array then
Sobj := Stabilize (Obj);
else
Sobj := Obj;
@@ -438,7 +438,7 @@ package body Trans.Chap4 is
New_Assign_Stmt (M2Lv (Obj), Get_Scalar_Initial_Value (Obj_Type));
when Type_Mode_Arrays =>
Init_Array_Object (Obj, Obj_Type);
- when Type_Mode_Record =>
+ when Type_Mode_Records =>
declare
Sobj : Mnode;
El : Iir_Element_Declaration;
@@ -682,7 +682,7 @@ package body Trans.Chap4 is
return New_Obj_Value (Len);
end;
- when Type_Mode_Record =>
+ when Type_Mode_Records =>
declare
List : constant Iir_List :=
Get_Elements_Declaration_List (Get_Base_Type (Sig_Type));
@@ -744,7 +744,7 @@ package body Trans.Chap4 is
(Chap3.Get_Array_Base (Res), Res_Type,
New_Lit (Ghdl_Index_0));
Res_Type := Get_Element_Subtype (Res_Type);
- when Type_Mode_Record =>
+ when Type_Mode_Records =>
declare
Element : Iir;
begin
diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb
index 4ab48bdca..1f4d71b3b 100644
--- a/src/vhdl/translate/trans-chap7.adb
+++ b/src/vhdl/translate/trans-chap7.adb
@@ -2611,7 +2611,7 @@ package body Trans.Chap7 is
| Type_Mode_Bounds_Acc
| Type_Mode_File =>
New_Assign_Stmt (M2Lv (Target), Val);
- when Type_Mode_Fat_Array =>
+ when Type_Mode_Unbounded_Array =>
declare
T : Mnode;
E : O_Dnode;
@@ -2631,6 +2631,9 @@ package body Trans.Chap7 is
Chap3.Translate_Object_Copy (Target, Val, Target_Type);
when Type_Mode_Record =>
Chap3.Translate_Object_Copy (Target, Val, Target_Type);
+ when Type_Mode_Unbounded_Record =>
+ -- TODO
+ raise Internal_Error;
when Type_Mode_Unknown
| Type_Mode_Protected =>
raise Internal_Error;
@@ -4530,9 +4533,10 @@ package body Trans.Chap7 is
end;
when Type_Mode_Unknown
- | Type_Mode_File
- | Type_Mode_Fat_Array
- | Type_Mode_Protected =>
+ | Type_Mode_File
+ | Type_Mode_Unbounded_Array
+ | Type_Mode_Unbounded_Record
+ | Type_Mode_Protected =>
raise Internal_Error;
end case;
end Translate_Equality;
@@ -5301,11 +5305,12 @@ package body Trans.Chap7 is
Close_Temp;
end;
when Type_Mode_Unknown
- | Type_Mode_File
- | Type_Mode_Acc
- | Type_Mode_Bounds_Acc
- | Type_Mode_Fat_Array
- | Type_Mode_Protected =>
+ | Type_Mode_File
+ | Type_Mode_Acc
+ | Type_Mode_Bounds_Acc
+ | Type_Mode_Unbounded_Array
+ | Type_Mode_Unbounded_Record
+ | Type_Mode_Protected =>
raise Internal_Error;
end case;
end Translate_Rw;
diff --git a/src/vhdl/translate/trans-chap8.adb b/src/vhdl/translate/trans-chap8.adb
index a6804a4cc..b92c6c68e 100644
--- a/src/vhdl/translate/trans-chap8.adb
+++ b/src/vhdl/translate/trans-chap8.adb
@@ -242,7 +242,8 @@ package body Trans.Chap8 is
Res := Chap7.Translate_Expression (Expr, Ret_Type);
Gen_Return_Value (Res);
end;
- when Type_Mode_Fat_Array =>
+ when Type_Mode_Unbounded_Array
+ | Type_Mode_Unbounded_Record =>
-- * if the return type is unconstrained: allocate an area from
-- the secondary stack, copy it to the area, and fill the fat
-- pointer.
@@ -1828,8 +1829,8 @@ package body Trans.Chap8 is
New_Procedure_Call (Assocs);
Close_Temp;
when Type_Mode_Array
- | Type_Mode_Record
- | Type_Mode_Fat_Array =>
+ | Type_Mode_Record
+ | Type_Mode_Unbounded_Array =>
Subprg_Info := Get_Info (Imp);
Start_Association (Assocs, Subprg_Info.Ortho_Func);
Subprgs.Add_Subprg_Instance_Assoc
@@ -1842,10 +1843,11 @@ package body Trans.Chap8 is
Formal_Type));
New_Procedure_Call (Assocs);
when Type_Mode_Unknown
- | Type_Mode_File
- | Type_Mode_Acc
- | Type_Mode_Bounds_Acc
- | Type_Mode_Protected =>
+ | Type_Mode_File
+ | Type_Mode_Acc
+ | Type_Mode_Bounds_Acc
+ | Type_Mode_Unbounded_Record
+ | Type_Mode_Protected =>
raise Internal_Error;
end case;
end Translate_Write_Procedure_Call;
@@ -1893,7 +1895,7 @@ package body Trans.Chap8 is
(Assocs,
Chap7.Translate_Expression (Get_Actual (Value_Assoc)));
New_Procedure_Call (Assocs);
- when Type_Mode_Fat_Array =>
+ when Type_Mode_Unbounded_Array =>
declare
Length_Assoc : Iir;
Length : Mnode;
@@ -1915,10 +1917,11 @@ package body Trans.Chap8 is
New_Assign_Stmt (M2Lv (Length), New_Function_Call (Assocs));
end;
when Type_Mode_Unknown
- | Type_Mode_File
- | Type_Mode_Acc
- | Type_Mode_Bounds_Acc
- | Type_Mode_Protected =>
+ | Type_Mode_File
+ | Type_Mode_Acc
+ | Type_Mode_Bounds_Acc
+ | Type_Mode_Unbounded_Record
+ | Type_Mode_Protected =>
raise Internal_Error;
end case;
end Translate_Read_Procedure_Call;
diff --git a/src/vhdl/translate/trans.adb b/src/vhdl/translate/trans.adb
index a87c4e7b1..8382e19d3 100644
--- a/src/vhdl/translate/trans.adb
+++ b/src/vhdl/translate/trans.adb
@@ -1095,10 +1095,11 @@ package body Trans is
end if;
case Vtype.Type_Mode is
when Type_Mode_Scalar
- | Type_Mode_Acc
- | Type_Mode_File
- | Type_Mode_Fat_Array
- | Type_Mode_Bounds_Acc =>
+ | Type_Mode_Acc
+ | Type_Mode_File
+ | Type_Mode_Unbounded_Array
+ | Type_Mode_Unbounded_Record
+ | Type_Mode_Bounds_Acc =>
if Stable then
return Dv2M (D, Vtype, Mode);
else
@@ -1734,14 +1735,15 @@ package body Trans is
begin
case Vtype.Type_Mode is
when Type_Mode_Scalar
- | Type_Mode_Acc
- | Type_Mode_File
- | Type_Mode_Fat_Array
- | Type_Mode_Bounds_Acc =>
+ | Type_Mode_Acc
+ | Type_Mode_File
+ | Type_Mode_Unbounded_Array
+ | Type_Mode_Unbounded_Record
+ | Type_Mode_Bounds_Acc =>
return Lv2M (L, Vtype, Mode);
when Type_Mode_Array
- | Type_Mode_Record
- | Type_Mode_Protected =>
+ | Type_Mode_Record
+ | Type_Mode_Protected =>
if Is_Complex_Type (Vtype) then
return Lp2M (L, Vtype, Mode);
else
@@ -1757,14 +1759,15 @@ package body Trans is
begin
case Vtype.Type_Mode is
when Type_Mode_Scalar
- | Type_Mode_Acc
- | Type_Mode_File
- | Type_Mode_Fat_Array
- | Type_Mode_Bounds_Acc =>
+ | Type_Mode_Acc
+ | Type_Mode_File
+ | Type_Mode_Unbounded_Array
+ | Type_Mode_Unbounded_Record
+ | Type_Mode_Bounds_Acc =>
return Dv2M (D, Vtype, Mode);
when Type_Mode_Array
- | Type_Mode_Record
- | Type_Mode_Protected =>
+ | Type_Mode_Record
+ | Type_Mode_Protected =>
if Is_Complex_Type (Vtype) then
return Dp2M (D, Vtype, Mode);
else
diff --git a/src/vhdl/translate/trans.ads b/src/vhdl/translate/trans.ads
index 5f9248af1..9ca2b9f02 100644
--- a/src/vhdl/translate/trans.ads
+++ b/src/vhdl/translate/trans.ads
@@ -847,12 +847,17 @@ package Trans is
-- Record.
Type_Mode_Record,
- -- Protected type
- Type_Mode_Protected,
+ -- Record with unbounded component(s).
+ Type_Mode_Unbounded_Record,
+ -- Unbounded array type (used for unconstrained array).
+ Type_Mode_Unbounded_Array,
-- Constrained array type (length is known at compile-time).
Type_Mode_Array,
- -- Fat array type (used for unconstrained array).
- Type_Mode_Fat_Array);
+ -- Protected type
+ Type_Mode_Protected);
+
+ -- For backward source compatibility, to be removed (TODO).
+ Type_Mode_Fat_Array : constant Type_Mode_Type := Type_Mode_Unbounded_Array;
subtype Type_Mode_Valid is Type_Mode_Type range
Type_Mode_B1 .. Type_Mode_Type'Last;
@@ -862,14 +867,18 @@ package Trans is
-- Composite types, with the vhdl meaning: record and arrays.
subtype Type_Mode_Composite is Type_Mode_Type range
- Type_Mode_Record .. Type_Mode_Fat_Array;
+ Type_Mode_Record .. Type_Mode_Protected;
subtype Type_Mode_Non_Composite is Type_Mode_Type range
Type_Mode_B1 .. Type_Mode_Bounds_Acc;
-- Array types.
subtype Type_Mode_Arrays is Type_Mode_Type range
- Type_Mode_Array .. Type_Mode_Fat_Array;
+ Type_Mode_Unbounded_Array .. Type_Mode_Array;
+
+ -- Record types.
+ subtype Type_Mode_Records is Type_Mode_Type range
+ Type_Mode_Record .. Type_Mode_Unbounded_Record;
-- Thin types, ie types whose length is a scalar.
subtype Type_Mode_Thin is Type_Mode_Type range
@@ -877,7 +886,7 @@ package Trans is
-- Fat types, ie types whose length is longer than a scalar.
subtype Type_Mode_Fat is Type_Mode_Type range
- Type_Mode_Record .. Type_Mode_Fat_Array;
+ Type_Mode_Record .. Type_Mode_Protected;
-- Subprogram call argument mechanism.
-- In VHDL, the evaluation is strict: actual parameters are evaluated
@@ -918,7 +927,7 @@ package Trans is
-- The parameters are passed by address, ie the argument of the
-- subprogram is an address to the object.
subtype Type_Mode_Pass_By_Address is Type_Mode_Type range
- Type_Mode_Record .. Type_Mode_Fat_Array;
+ Type_Mode_Record .. Type_Mode_Protected;
-- Call conventions.
subtype Type_Mode_Call_By_Value is Type_Mode_Non_Composite;
@@ -1123,10 +1132,10 @@ package Trans is
-- Ortho node which represents the type.
-- Type -> Ortho type
-- scalar -> scalar
- -- record (complex or not) -> record
+ -- bounded record (complex or not) -> record
-- constrained non-complex array -> constrained array
-- constrained complex array -> the element
- -- unconstrained array -> fat pointer
+ -- unboubded array or record -> fat pointer
-- access to unconstrained array -> fat pointer
-- access (others) -> access
-- file -> file_index_type