aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho/mcode/ortho_mcode.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2020-07-24 18:31:11 +0200
committerTristan Gingold <tgingold@free.fr>2020-07-25 11:28:49 +0200
commit04cd83fb46bee1e7a7b37be95bee73449af9c8b8 (patch)
tree3fe35d0bc6d4b1be8d81ad44df685057c221d2dc /src/ortho/mcode/ortho_mcode.adb
parent4033dd795927a4953879bdc92d395788893a5468 (diff)
downloadghdl-04cd83fb46bee1e7a7b37be95bee73449af9c8b8.tar.gz
ghdl-04cd83fb46bee1e7a7b37be95bee73449af9c8b8.tar.bz2
ghdl-04cd83fb46bee1e7a7b37be95bee73449af9c8b8.zip
ortho: add unbounded records, rework array subtypes.
Diffstat (limited to 'src/ortho/mcode/ortho_mcode.adb')
-rw-r--r--src/ortho/mcode/ortho_mcode.adb44
1 files changed, 39 insertions, 5 deletions
diff --git a/src/ortho/mcode/ortho_mcode.adb b/src/ortho/mcode/ortho_mcode.adb
index cd7131d73..235bb0e47 100644
--- a/src/ortho/mcode/ortho_mcode.adb
+++ b/src/ortho/mcode/ortho_mcode.adb
@@ -60,6 +60,31 @@ package body Ortho_Mcode is
Ortho_Code.O_Tnode (Res));
end Finish_Record_Type;
+ procedure Start_Record_Subtype
+ (Rtype : O_Tnode; Elements : out O_Element_Sublist) is
+ begin
+ Ortho_Code.Types.Start_Record_Subtype
+ (Ortho_Code.O_Tnode (Rtype),
+ Ortho_Code.Types.O_Element_List (Elements));
+ end Start_Record_Subtype;
+
+ procedure New_Subrecord_Field
+ (Elements : in out O_Element_Sublist; El : out O_Fnode; Etype : O_Tnode)
+ is
+ begin
+ Ortho_Code.Types.New_Subrecord_Field
+ (Ortho_Code.Types.O_Element_List (Elements),
+ Ortho_Code.O_Fnode (El), Ortho_Code.O_Tnode (Etype));
+ end New_Subrecord_Field;
+
+ procedure Finish_Record_Subtype
+ (Elements : in out O_Element_Sublist; Res : out O_Tnode) is
+ begin
+ Ortho_Code.Types.Finish_Record_Subtype
+ (Ortho_Code.Types.O_Element_List (Elements),
+ Ortho_Code.O_Tnode (Res));
+ end Finish_Record_Subtype;
+
procedure New_Uncomplete_Record_Type (Res : out O_Tnode) is
begin
Ortho_Code.Types.New_Uncomplete_Record_Type (Ortho_Code.O_Tnode (Res));
@@ -127,8 +152,8 @@ package body Ortho_Mcode is
Ortho_Code.O_Tnode (Index_Type)));
end New_Array_Type;
- function New_Constrained_Array_Type (Atype : O_Tnode; Length : O_Cnode)
- return O_Tnode
+ function New_Array_Subtype
+ (Atype : O_Tnode; El_Type : O_Tnode; Length : O_Cnode) return O_Tnode
is
Len : constant Ortho_Code.O_Cnode := Ortho_Code.O_Cnode (Length);
L_Type : Ortho_Code.O_Tnode;
@@ -137,9 +162,10 @@ package body Ortho_Mcode is
if Get_Type_Kind (L_Type) /= OT_Unsigned then
raise Syntax_Error;
end if;
- return O_Tnode (New_Constrained_Array_Type
- (Ortho_Code.O_Tnode (Atype), Get_Const_U32 (Len)));
- end New_Constrained_Array_Type;
+ return O_Tnode (New_Array_Subtype (Ortho_Code.O_Tnode (Atype),
+ Ortho_Code.O_Tnode (El_Type),
+ Get_Const_U32 (Len)));
+ end New_Array_Subtype;
function New_Unsigned_Type (Size : Natural) return O_Tnode is
begin
@@ -325,6 +351,14 @@ package body Ortho_Mcode is
Ortho_Code.O_Tnode (Rtype)));
end New_Sizeof;
+ function New_Record_Sizeof
+ (Atype : O_Tnode; Rtype : O_Tnode) return O_Cnode is
+ begin
+ return O_Cnode
+ (Ortho_Code.Consts.New_Record_Sizeof (Ortho_Code.O_Tnode (Atype),
+ Ortho_Code.O_Tnode (Rtype)));
+ end New_Record_Sizeof;
+
function New_Alignof (Atype : O_Tnode; Rtype : O_Tnode) return O_Cnode is
begin
return O_Cnode