diff options
Diffstat (limited to 'src/vhdl/translate/trans-chap3.ads')
-rw-r--r-- | src/vhdl/translate/trans-chap3.ads | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/vhdl/translate/trans-chap3.ads b/src/vhdl/translate/trans-chap3.ads index 9900f48a9..2b9f37e6b 100644 --- a/src/vhdl/translate/trans-chap3.ads +++ b/src/vhdl/translate/trans-chap3.ads @@ -43,7 +43,7 @@ package Trans.Chap3 is procedure Translate_Type_Subprograms (Decl : Iir; Kind : Subprg_Translate_Kind); - function Create_Static_Composite_Subtype_Bounds (Def : Iir) return O_Cnode; + function Create_Static_Composite_Subtype_Layout (Def : Iir) return O_Cnode; -- Same as Translate_type_definition only for std.standard.boolean and -- std.standard.bit. @@ -116,9 +116,6 @@ package Trans.Chap3 is -- For a second or third order complex type, INFO.C.BUILDER_NEED_FUNC -- is set to TRUE. - -- Call builder for variable pointed VAR of type VAR_TYPE. - procedure Gen_Call_Type_Builder (Var : Mnode; Var_Type : Iir); - -- Functions for fat array. -- Fat array are array whose size is not known at compilation time. -- This corresponds to an unconstrained array or a non locally static @@ -166,11 +163,17 @@ package Trans.Chap3 is -- Get the number of elements in array ATYPE. function Get_Array_Type_Length (Atype : Iir) return O_Enode; - -- Get the base of array or record ARR. - function Get_Composite_Base (Arr : Mnode) return Mnode; + -- Get the base of array or record OBJ. If OBJ is already constrained, + -- return it. + function Get_Composite_Base (Obj : Mnode) return Mnode; + + -- Get the base of array or record OBJ; but if OBJ is already constrained, + -- convert it to the base of an unbounded object (so this unboxes the + -- records). + function Get_Composite_Unbounded_Base (Obj : Mnode) return Mnode; -- Get the bounds of composite ARR (an array or an unbounded record). - function Get_Composite_Bounds (Arr : Mnode) return Mnode; + function Get_Composite_Bounds (Obj : Mnode) return Mnode; -- Get the range ot ATYPE. function Type_To_Range (Atype : Iir) return Mnode; @@ -194,16 +197,27 @@ package Trans.Chap3 is function Get_Array_Range (Arr : Mnode; Atype : Iir; Dim : Positive) return Mnode; - -- Get array bounds for type ATYPE. - function Get_Array_Type_Bounds (Atype : Iir) return Mnode; + -- Get array/record bounds for type ATYPE. + function Get_Composite_Type_Bounds (Atype : Iir) return Mnode; -- Return a pointer to the base from bounds_acc ACC. function Get_Bounds_Acc_Base (Acc : O_Enode; D_Type : Iir) return O_Enode; + -- Return bounds from layout B. + function Layout_To_Bounds (B : Mnode) return Mnode; + + -- From a record layout B, return the layout of element EL. EL must be + -- an unbounded element. + function Record_Layout_To_Element_Layout (B : Mnode; El : Iir) return Mnode; + -- From an unbounded record bounds B, get the bounds for (unbounded) -- element EL. - function Bounds_To_Element_Bounds (B : Mnode; El : Iir) return Mnode; + function Record_Bounds_To_Element_Bounds (B : Mnode; El : Iir) return Mnode; + + -- Return the offset for field EL in record B. + function Record_Layout_To_Element_Offset + (B : Mnode; El : Iir; Kind : Object_Kind_Type) return O_Lnode; -- From an unbounded array bounds B, get the bounds for the (unbounded) -- element. @@ -246,9 +260,6 @@ package Trans.Chap3 is -- it may be the result of T2M. function Get_Object_Size (Obj : Mnode; Obj_Type : Iir) return O_Enode; - -- If needed call the procedure to build OBJ. - procedure Maybe_Call_Type_Builder (Obj : Mnode; Obj_Type : Iir); - -- Allocate the base of an unbounded composite, whose length is -- determined from the bounds (already set). -- RES_PTR is a pointer to the fat pointer (must be a stable variable: it |