aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-01-11 07:02:52 +0100
committerTristan Gingold <tgingold@free.fr>2017-01-13 18:57:24 +0100
commit47ee0199a4d141c71619734572ea011d3c413c50 (patch)
tree20cd574d88626d655d3b33f30e221f6c05d0675e /src/vhdl/translate
parent66eb164f49a3b8af99e5213b0a96863224987f7e (diff)
downloadghdl-47ee0199a4d141c71619734572ea011d3c413c50.tar.gz
ghdl-47ee0199a4d141c71619734572ea011d3c413c50.tar.bz2
ghdl-47ee0199a4d141c71619734572ea011d3c413c50.zip
WIP for unconstrained records.
Diffstat (limited to 'src/vhdl/translate')
-rw-r--r--src/vhdl/translate/trans-chap3.adb38
-rw-r--r--src/vhdl/translate/trans-rtis.adb2
-rw-r--r--src/vhdl/translate/trans.ads11
3 files changed, 36 insertions, 15 deletions
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb
index 142b93fc1..daf5a4870 100644
--- a/src/vhdl/translate/trans-chap3.adb
+++ b/src/vhdl/translate/trans-chap3.adb
@@ -554,11 +554,11 @@ package body Trans.Chap3 is
function Create_Static_Composite_Subtype_Bounds (Def : Iir) return O_Cnode
is
- Info : constant Type_Info_Acc := Get_Info (Def);
+ Binfo : constant Type_Info_Acc := Get_Info (Get_Base_Type (Def));
List : O_Record_Aggr_List;
Res : O_Cnode;
begin
- Start_Record_Aggr (List, Info.B.Bounds_Type);
+ Start_Record_Aggr (List, Binfo.B.Bounds_Type);
case Get_Kind (Def) is
when Iir_Kind_Array_Subtype_Definition =>
@@ -579,14 +579,18 @@ package body Trans.Chap3 is
declare
El_List : constant Iir_List :=
Get_Elements_Declaration_List (Def);
+ El_Blist : constant Iir_List :=
+ Get_Elements_Declaration_List (Get_Base_Type (Def));
El : Iir;
- El_Info : Field_Info_Acc;
+ Bel : Iir;
+ Bel_Info : Field_Info_Acc;
begin
for I in Natural loop
- El := Get_Nth_Element (El_List, I);
- exit when El = Null_Iir;
- El_Info := Get_Info (El);
- if El_Info.Field_Bound /= O_Fnode_Null then
+ Bel := Get_Nth_Element (El_Blist, I);
+ exit when Bel = Null_Iir;
+ Bel_Info := Get_Info (Bel);
+ if Bel_Info.Field_Bound /= O_Fnode_Null then
+ El := Get_Nth_Element (El_List, I);
New_Record_Aggr_El
(List,
Create_Static_Composite_Subtype_Bounds
@@ -2040,7 +2044,6 @@ package body Trans.Chap3 is
Translate_Enumeration_Type (Def);
Create_Scalar_Type_Range_Type (Def, True);
Create_Type_Range_Var (Def);
- --Create_Type_Desc_Var (Def);
when Iir_Kind_Integer_Type_Definition =>
Translate_Integer_Type (Def);
@@ -2110,8 +2113,23 @@ package body Trans.Chap3 is
Info.B := Ortho_Info_Basetype_Record_Init;
Translate_Record_Type (Def);
- when Iir_Kind_Record_Subtype_Definition
- | Iir_Kind_Access_Subtype_Definition =>
+ when Iir_Kind_Record_Subtype_Definition =>
+ Info.all := Base_Info.all;
+ Info.S := Ortho_Info_Subtype_Record_Init;
+ declare
+ Tm : constant Iir :=
+ Get_Type (Get_Named_Entity (Get_Subtype_Type_Mark (Def)));
+ begin
+ if With_Vars
+ and then Get_Constraint_State (Tm) /= Fully_Constrained
+ and then Get_Constraint_State (Def) = Fully_Constrained
+ then
+ Create_Composite_Subtype_Bounds_Var (Def, False);
+ end if;
+ end;
+
+ when Iir_Kind_Access_Subtype_Definition =>
+ -- Like the access type.
Free_Info (Def);
Set_Info (Def, Base_Info);
diff --git a/src/vhdl/translate/trans-rtis.adb b/src/vhdl/translate/trans-rtis.adb
index 44e28a62e..8b191f31b 100644
--- a/src/vhdl/translate/trans-rtis.adb
+++ b/src/vhdl/translate/trans-rtis.adb
@@ -1753,7 +1753,7 @@ package body Trans.Rtis is
when Iir_Kind_Record_Subtype_Definition
| Iir_Kind_Access_Subtype_Definition =>
-- FIXME: No separate infos (yet).
- null;
+ Info.Type_Rti := Get_Info (Get_Base_Type (Atype)).Type_Rti;
when Iir_Kind_Record_Type_Definition =>
Generate_Record_Type_Definition (Atype);
when Iir_Kind_Protected_Type_Declaration =>
diff --git a/src/vhdl/translate/trans.ads b/src/vhdl/translate/trans.ads
index 75f7f06f2..a9d02017a 100644
--- a/src/vhdl/translate/trans.ads
+++ b/src/vhdl/translate/trans.ads
@@ -769,16 +769,14 @@ package Trans is
-- Tree for the range record declaration.
Range_Var : Var_Type;
- when Kind_Type_Array =>
+ when Kind_Type_Array
+ | Kind_Type_Record =>
-- True if the bounds are static.
Static_Bounds : Boolean;
-- Variable containing the bounds for a constrained type.
Composite_Bounds : Var_Type;
- when Kind_Type_Record =>
- null;
-
when Kind_Type_File =>
null;
@@ -822,6 +820,11 @@ package Trans is
Base_Field => (O_Fnode_Null, O_Fnode_Null),
Bounds_Field => (O_Fnode_Null, O_Fnode_Null));
+ Ortho_Info_Subtype_Record_Init : constant Ortho_Info_Subtype_Type :=
+ (Kind => Kind_Type_Record,
+ Static_Bounds => False,
+ Composite_Bounds => Null_Var);
+
Ortho_Info_Basetype_File_Init : constant Ortho_Info_Basetype_Type :=
(Kind => Kind_Type_File,
Rti_Max_Depth => 0,