From 5a7a8470fc91861aa85060a758523e2d1f161585 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 30 Dec 2016 19:11:43 +0100 Subject: translate: refactoring for ortho_info_type. --- src/vhdl/translate/trans-chap1.adb | 14 +- src/vhdl/translate/trans-chap14.adb | 4 +- src/vhdl/translate/trans-chap2.adb | 3 +- src/vhdl/translate/trans-chap3.adb | 288 ++++++++++++++++++------------------ src/vhdl/translate/trans-chap4.adb | 20 +-- src/vhdl/translate/trans-chap5.adb | 12 +- src/vhdl/translate/trans-chap6.adb | 4 +- src/vhdl/translate/trans-chap7.adb | 104 ++++++------- src/vhdl/translate/trans-chap8.adb | 32 ++-- src/vhdl/translate/trans-chap9.adb | 24 +-- src/vhdl/translate/trans-rtis.adb | 38 ++--- src/vhdl/translate/trans.adb | 3 +- src/vhdl/translate/trans.ads | 65 +++++--- src/vhdl/translate/translation.adb | 2 +- 14 files changed, 319 insertions(+), 294 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/translate/trans-chap1.adb b/src/vhdl/translate/trans-chap1.adb index a84442df4..d3f3be69b 100644 --- a/src/vhdl/translate/trans-chap1.adb +++ b/src/vhdl/translate/trans-chap1.adb @@ -677,8 +677,8 @@ package body Trans.Chap1 is New_Value (New_Obj (Var_I)), New_Value (New_Selected_Element - (Get_Var (Get_Info (Iter_Type).T.Range_Var), - Type_Info.T.Range_Length)), + (Get_Var (Get_Info (Iter_Type).S.Range_Var), + Type_Info.B.Range_Length)), Ghdl_Bool_Type)); -- Selected_name is for default configurations, so -- program should not fail if a block is already @@ -725,17 +725,17 @@ package body Trans.Chap1 is begin Open_Temp; Rng := Stabilize (Chap3.Type_To_Range (Iter_Type)); - Slice := Create_Temp (Type_Info.T.Range_Type); + Slice := Create_Temp (Type_Info.B.Range_Type); Chap7.Translate_Discrete_Range (Dv2M (Slice, Type_Info, Mode_Value, - Type_Info.T.Range_Type, Type_Info.T.Range_Ptr_Type), + Type_Info.B.Range_Type, Type_Info.B.Range_Ptr_Type), Get_Suffix (Spec)); Left := Create_Temp_Init (Ghdl_Index_Type, Chap6.Translate_Index_To_Offset (Rng, New_Value (New_Selected_Element - (New_Obj (Slice), Type_Info.T.Range_Left)), + (New_Obj (Slice), Type_Info.B.Range_Left)), Spec, Iter_Type, Spec)); Right := Create_Temp_Init (Ghdl_Index_Type, @@ -743,7 +743,7 @@ package body Trans.Chap1 is (Rng, New_Value (New_Selected_Element (New_Obj (Slice), - Type_Info.T.Range_Right)), + Type_Info.B.Range_Right)), Spec, Iter_Type, Spec)); Index := Create_Temp (Ghdl_Index_Type); High := Create_Temp (Ghdl_Index_Type); @@ -754,7 +754,7 @@ package body Trans.Chap1 is New_Value (New_Selected_Element (New_Obj (Slice), - Type_Info.T.Range_Dir)), + Type_Info.B.Range_Dir)), Ghdl_Bool_Type)); -- Same direction, so left to right. New_Assign_Stmt (New_Obj (Index), diff --git a/src/vhdl/translate/trans-chap14.adb b/src/vhdl/translate/trans-chap14.adb index ac1933a27..05f017c3f 100644 --- a/src/vhdl/translate/trans-chap14.adb +++ b/src/vhdl/translate/trans-chap14.adb @@ -208,8 +208,8 @@ package body Trans.Chap14 is else Info := Get_Info (Atype); return New_Value - (New_Selected_Element (Get_Var (Info.T.Range_Var), - Info.T.Range_Dir)); + (New_Selected_Element (Get_Var (Info.S.Range_Var), + Info.B.Range_Dir)); end if; end Translate_Dir_Type_Attribute; diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb index 4f729ddc1..139bf2223 100644 --- a/src/vhdl/translate/trans-chap2.adb +++ b/src/vhdl/translate/trans-chap2.adb @@ -1121,7 +1121,8 @@ package body Trans.Chap2 is C => null, Ortho_Type => Src.Ortho_Type, Ortho_Ptr_Type => Src.Ortho_Ptr_Type, - T => Src.T, + B => Src.B, + S => Src.S, Type_Rti => Src.Type_Rti); pragma Assert (Src.C = null); when Kind_Object => diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index 00546dc02..ba82f67fe 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -118,7 +118,7 @@ package body Trans.Chap3 is (Interface_List, Info.C (Kind).Builder_Instance); case Info.Type_Mode is when Type_Mode_Fat_Array => - Ptype := Info.T.Base_Ptr_Type (Kind); + Ptype := Info.B.Base_Ptr_Type (Kind); when Type_Mode_Record => Ptype := Info.Ortho_Ptr_Type (Kind); when others => @@ -131,7 +131,7 @@ package body Trans.Chap3 is if Info.Type_Mode = Type_Mode_Fat_Array then New_Interface_Decl (Interface_List, Info.C (Kind).Builder_Bound_Param, - Get_Identifier ("bound"), Info.T.Bounds_Ptr_Type); + Get_Identifier ("bound"), Info.B.Bounds_Ptr_Type); end if; Finish_Subprogram_Decl (Interface_List, Info.C (Kind).Builder_Func); end Create_Builder_Subprogram_Decl; @@ -248,8 +248,8 @@ package body Trans.Chap3 is Info.Type_Mode := Type_Mode_E32; end if; -- Enumerations are always in their range. - Info.T.Nocheck_Low := True; - Info.T.Nocheck_Hi := True; + Info.S.Nocheck_Low := True; + Info.S.Nocheck_Hi := True; Finish_Type_Definition (Info); end Translate_Enumeration_Type; @@ -271,8 +271,8 @@ package body Trans.Chap3 is Info.Type_Mode := Type_Mode_B1; Set_Ortho_Expr (False_Lit, False_Node); Set_Ortho_Expr (True_Lit, True_Node); - Info.T.Nocheck_Low := True; - Info.T.Nocheck_Hi := True; + Info.S.Nocheck_Low := True; + Info.S.Nocheck_Hi := True; Finish_Type_Definition (Info); end Translate_Bool_Type; @@ -319,8 +319,8 @@ package body Trans.Chap3 is Info.Type_Mode := Type_Mode_I64; end case; -- Integers are always in their ranges. - Info.T.Nocheck_Low := True; - Info.T.Nocheck_Hi := True; + Info.S.Nocheck_Low := True; + Info.S.Nocheck_Hi := True; Finish_Type_Definition (Info); end Translate_Integer_Type; @@ -338,8 +338,8 @@ package body Trans.Chap3 is Info.Type_Mode := Type_Mode_F64; Info.Ortho_Type (Mode_Value) := New_Float_Type; -- Reals are always in their ranges. - Info.T.Nocheck_Low := True; - Info.T.Nocheck_Hi := True; + Info.S.Nocheck_Low := True; + Info.S.Nocheck_Hi := True; Finish_Type_Definition (Info); end Translate_Floating_Type; @@ -361,8 +361,8 @@ package body Trans.Chap3 is Info.Type_Mode := Type_Mode_P64; end case; -- Physical types are always in their ranges. - Info.T.Nocheck_Low := True; - Info.T.Nocheck_Hi := True; + Info.S.Nocheck_Low := True; + Info.S.Nocheck_Hi := True; Finish_Type_Definition (Info); end Translate_Physical_Type; @@ -483,7 +483,7 @@ package body Trans.Chap3 is Sig (Len + 1) := '.'; Sig (Len + 2) := Character'Val (10); Info := Get_Info (Def); - Info.T.File_Signature := Create_String + Info.B.File_Signature := Create_String (Sig, Create_Identifier ("FILESIG"), Global_Storage); end; end Create_File_Type_Var; @@ -508,11 +508,11 @@ package body Trans.Chap3 is begin Start_Record_Type (Constr); New_Record_Field - (Constr, Info.T.Base_Field (Kind), Wki_Base, - Info.T.Base_Ptr_Type (Kind)); + (Constr, Info.B.Base_Field (Kind), Wki_Base, + Info.B.Base_Ptr_Type (Kind)); New_Record_Field - (Constr, Info.T.Bounds_Field (Kind), Wki_Bounds, - Info.T.Bounds_Ptr_Type); + (Constr, Info.B.Bounds_Field (Kind), Wki_Bounds, + Info.B.Bounds_Ptr_Type); Finish_Record_Type (Constr, Info.Ortho_Type (Kind)); end Create_Array_Fat_Pointer; @@ -556,14 +556,14 @@ package body Trans.Chap3 is New_Record_Field (Constr, Index_Info.Index_Field, Get_Identifier (Dim (P .. Dim'Last)), - Get_Info (Get_Base_Type (Index)).T.Range_Type); + Get_Info (Get_Base_Type (Index)).B.Range_Type); end loop; - Finish_Record_Type (Constr, Info.T.Bounds_Type); + Finish_Record_Type (Constr, Info.B.Bounds_Type); New_Type_Decl (Create_Identifier ("BOUND"), - Info.T.Bounds_Type); - Info.T.Bounds_Ptr_Type := New_Access_Type (Info.T.Bounds_Type); + Info.B.Bounds_Type); + Info.B.Bounds_Ptr_Type := New_Access_Type (Info.B.Bounds_Type); New_Type_Decl (Create_Identifier ("BOUNDP"), - Info.T.Bounds_Ptr_Type); + Info.B.Bounds_Ptr_Type); end Translate_Array_Type_Bounds; procedure Translate_Array_Type_Base @@ -580,11 +580,11 @@ package body Trans.Chap3 is if Is_Complex_Type (El_Tinfo) then if El_Tinfo.Type_Mode = Type_Mode_Array then - Info.T.Base_Type := El_Tinfo.T.Base_Ptr_Type; - Info.T.Base_Ptr_Type := El_Tinfo.T.Base_Ptr_Type; + Info.B.Base_Type := El_Tinfo.B.Base_Ptr_Type; + Info.B.Base_Ptr_Type := El_Tinfo.B.Base_Ptr_Type; else - Info.T.Base_Type := El_Tinfo.Ortho_Ptr_Type; - Info.T.Base_Ptr_Type := El_Tinfo.Ortho_Ptr_Type; + Info.B.Base_Type := El_Tinfo.Ortho_Ptr_Type; + Info.B.Base_Ptr_Type := El_Tinfo.Ortho_Ptr_Type; end if; else for Kind in Mode_Value .. Type_To_Last_Object_Kind (Def) loop @@ -598,13 +598,12 @@ package body Trans.Chap3 is Id := Create_Identifier ("SIGBASE"); Idptr := Create_Identifier ("SIGBASEP"); end case; - Info.T.Base_Type (Kind) := - New_Array_Type (El_Tinfo.Ortho_Type (Kind), - Ghdl_Index_Type); - New_Type_Decl (Id, Info.T.Base_Type (Kind)); - Info.T.Base_Ptr_Type (Kind) := - New_Access_Type (Info.T.Base_Type (Kind)); - New_Type_Decl (Idptr, Info.T.Base_Ptr_Type (Kind)); + Info.B.Base_Type (Kind) := + New_Array_Type (El_Tinfo.Ortho_Type (Kind), Ghdl_Index_Type); + New_Type_Decl (Id, Info.B.Base_Type (Kind)); + Info.B.Base_Ptr_Type (Kind) := + New_Access_Type (Info.B.Base_Type (Kind)); + New_Type_Decl (Idptr, Info.B.Base_Ptr_Type (Kind)); end loop; end if; end Translate_Array_Type_Base; @@ -616,7 +615,8 @@ package body Trans.Chap3 is El_Tinfo : Type_Info_Acc; begin Info.Type_Mode := Type_Mode_Fat_Array; - Info.T := Ortho_Info_Type_Array_Init; + Info.B := Ortho_Info_Basetype_Array_Init; + Info.S := Ortho_Info_Subtype_Array_Init; Translate_Array_Type_Base (Def, Info); Translate_Array_Type_Bounds (Def, Info); Info.Ortho_Type (Mode_Signal) := O_Tnode_Null; @@ -684,8 +684,8 @@ package body Trans.Chap3 is then -- This is a complex type as the size is not known at compile -- time. - Info.Ortho_Type := Binfo.T.Base_Ptr_Type; - Info.Ortho_Ptr_Type := Binfo.T.Base_Ptr_Type; + Info.Ortho_Type := Binfo.B.Base_Ptr_Type; + Info.Ortho_Ptr_Type := Binfo.B.Base_Ptr_Type; Create_Size_Var (Def); @@ -697,7 +697,7 @@ package body Trans.Chap3 is else -- Length is known. Create a constrained array. Info.Ortho_Type (Mode_Signal) := O_Tnode_Null; - Info.Ortho_Ptr_Type := Binfo.T.Base_Ptr_Type; + Info.Ortho_Ptr_Type := Binfo.B.Base_Ptr_Type; for I in Mode_Value .. Type_To_Last_Object_Kind (Def) loop case I is when Mode_Value => @@ -706,7 +706,7 @@ package body Trans.Chap3 is Id := Create_Identifier ("SIG"); end case; Info.Ortho_Type (I) := New_Constrained_Array_Type - (Binfo.T.Base_Type (I), + (Binfo.B.Base_Type (I), New_Unsigned_Literal (Ghdl_Index_Type, Unsigned_64 (Len))); New_Type_Decl (Id, Info.Ortho_Type (I)); end loop; @@ -756,7 +756,7 @@ package body Trans.Chap3 is List : O_Record_Aggr_List; Res : O_Cnode; begin - Start_Record_Aggr (List, Baseinfo.T.Bounds_Type); + Start_Record_Aggr (List, Baseinfo.B.Bounds_Type); for I in Natural loop Index := Get_Index_Type (Indexes_List, I); exit when Index = Null_Iir; @@ -779,7 +779,7 @@ package body Trans.Chap3 is Targ : Mnode; begin Targ := Lv2M (Target, null, Mode_Value, - Baseinfo.T.Bounds_Type, Baseinfo.T.Bounds_Ptr_Type); + Baseinfo.B.Bounds_Type, Baseinfo.B.Bounds_Ptr_Type); Open_Temp; if Get_Nbr_Elements (Indexes_List) > 1 then Targ := Stabilize (Targ); @@ -796,12 +796,12 @@ package body Trans.Chap3 is begin Open_Temp; D := Create_Temp_Ptr - (Index_Info.T.Range_Ptr_Type, + (Index_Info.B.Range_Ptr_Type, New_Selected_Element (M2Lv (Targ), Base_Index_Info.Index_Field)); Chap7.Translate_Discrete_Range (Dp2M (D, Index_Info, Mode_Value, - Index_Info.T.Range_Type, Index_Info.T.Range_Ptr_Type), + Index_Info.B.Range_Type, Index_Info.B.Range_Ptr_Type), Index); Close_Temp; end; @@ -832,22 +832,22 @@ package body Trans.Chap3 is Base_Info : Type_Info_Acc; Val : O_Cnode; begin - if Info.T.Array_Bounds /= Null_Var then + if Info.S.Array_Bounds /= Null_Var then return; end if; Base_Info := Get_Info (Get_Base_Type (Def)); case Get_Array_Bounds_Staticness (Def) is when None | Globally => - Info.T.Static_Bounds := False; - Info.T.Array_Bounds := Create_Var - (Create_Var_Identifier ("STB"), Base_Info.T.Bounds_Type); + Info.S.Static_Bounds := False; + Info.S.Array_Bounds := Create_Var + (Create_Var_Identifier ("STB"), Base_Info.B.Bounds_Type); if Elab_Now then Create_Array_Subtype_Bounds - (Def, Get_Var (Info.T.Array_Bounds)); + (Def, Get_Var (Info.S.Array_Bounds)); end if; when Locally => - Info.T.Static_Bounds := True; + Info.S.Static_Bounds := True; if Global_Storage = O_Storage_External then -- Do not create the value of the type desc, since it -- is never dereferenced in a static type desc. @@ -855,9 +855,9 @@ package body Trans.Chap3 is else Val := Create_Static_Array_Subtype_Bounds (Def); end if; - Info.T.Array_Bounds := Create_Global_Const + Info.S.Array_Bounds := Create_Global_Const (Create_Identifier ("STB"), - Base_Info.T.Bounds_Type, Global_Storage, Val); + Base_Info.B.Bounds_Type, Global_Storage, Val); when Unknown => raise Internal_Error; @@ -884,7 +884,7 @@ package body Trans.Chap3 is New_Var_Decl (Var_Length, Wki_Length, O_Storage_Local, Ghdl_Index_Type); New_Var_Decl (Var_Mem, Get_Identifier ("mem"), O_Storage_Local, - Info.T.Base_Ptr_Type (Kind)); + Info.B.Base_Ptr_Type (Kind)); New_Var_Decl (Var_Off, Get_Identifier ("off"), O_Storage_Local, Ghdl_Index_Type); @@ -897,8 +897,8 @@ package body Trans.Chap3 is New_Value (Get_Var (El_Info.C (Kind).Size_Var)), Get_Bounds_Length (Dp2M (Bound, Info, Mode_Value, - Info.T.Bounds_Type, - Info.T.Bounds_Ptr_Type), + Info.B.Bounds_Type, + Info.B.Bounds_Ptr_Type), Def))); -- Find the innermost non-array element. @@ -923,7 +923,7 @@ package body Trans.Chap3 is Char_Ptr_Type)), Chararray_Type, New_Obj_Value (Var_Off)), - Info.T.Base_Ptr_Type (Kind))); + Info.B.Base_Ptr_Type (Kind))); New_Assign_Stmt (New_Obj (Var_Off), @@ -1172,12 +1172,12 @@ package body Trans.Chap3 is D_Info : constant Type_Info_Acc := Get_Info (D_Type); begin if not Is_Fully_Constrained_Type (D_Type) then - return D_Info.T.Bounds_Type; + return D_Info.B.Bounds_Type; else if D_Info.Type_Mode in Type_Mode_Arrays then -- The designated type cannot be a sub array inside ortho. -- FIXME: lift this restriction. - return D_Info.T.Base_Type (Mode_Value); + return D_Info.B.Base_Type (Mode_Value); else return D_Info.Ortho_Type (Mode_Value); end if; @@ -1269,11 +1269,11 @@ package body Trans.Chap3 is begin -- The protected type is represented by an incomplete record, that -- will be completed by the protected type body. - Predeclare_Scope_Type (Info.T.Prot_Scope, Create_Identifier); + Predeclare_Scope_Type (Info.B.Prot_Scope, Create_Identifier); Info.Ortho_Type (Mode_Value) := O_Tnode_Null; -- Create a pointer type to that record. - Declare_Scope_Acc (Info.T.Prot_Scope, + Declare_Scope_Acc (Info.B.Prot_Scope, Create_Identifier ("PTR"), Info.Ortho_Ptr_Type (Mode_Value)); @@ -1313,11 +1313,11 @@ package body Trans.Chap3 is (Inter_List, Create_Identifier ("INIT"), Global_Storage, Info.Ortho_Ptr_Type (Mode_Value)); Subprgs.Add_Subprg_Instance_Interfaces - (Inter_List, Info.T.Prot_Init_Instance); - Finish_Subprogram_Decl (Inter_List, Info.T.Prot_Init_Subprg); + (Inter_List, Info.B.Prot_Init_Instance); + Finish_Subprogram_Decl (Inter_List, Info.B.Prot_Init_Subprg); -- Use the object as instance. - Subprgs.Push_Subprg_Instance (Info.T.Prot_Scope'Unrestricted_Access, + Subprgs.Push_Subprg_Instance (Info.B.Prot_Scope'Unrestricted_Access, Info.Ortho_Ptr_Type (Mode_Value), Wki_Obj, Prev_Subprg_Instance); @@ -1326,8 +1326,8 @@ package body Trans.Chap3 is Start_Procedure_Decl (Inter_List, Create_Identifier ("FINI"), Global_Storage); Subprgs.Add_Subprg_Instance_Interfaces - (Inter_List, Info.T.Prot_Final_Instance); - Finish_Subprogram_Decl (Inter_List, Info.T.Prot_Final_Subprg); + (Inter_List, Info.B.Prot_Final_Instance); + Finish_Subprogram_Decl (Inter_List, Info.B.Prot_Final_Subprg); -- Methods. El := Get_Declaration_Chain (Def); @@ -1360,18 +1360,18 @@ package body Trans.Chap3 is Push_Identifier_Prefix (Mark, Get_Identifier (Bod)); -- Create the object type - Push_Instance_Factory (Info.T.Prot_Scope'Unrestricted_Access); + Push_Instance_Factory (Info.B.Prot_Scope'Unrestricted_Access); -- First, the previous instance. - Subprgs.Add_Subprg_Instance_Field (Info.T.Prot_Subprg_Instance_Field); + Subprgs.Add_Subprg_Instance_Field (Info.B.Prot_Subprg_Instance_Field); -- Then the object lock - Info.T.Prot_Lock_Field := Add_Instance_Factory_Field + Info.B.Prot_Lock_Field := Add_Instance_Factory_Field (Get_Identifier ("LOCK"), Ghdl_Ptr_Type); -- Translate declarations. Chap4.Translate_Declaration_Chain (Bod); - Pop_Instance_Factory (Info.T.Prot_Scope'Unrestricted_Access); - -- Info.Ortho_Type (Mode_Value) := Get_Scope_Type (Info.T.Prot_Scope); + Pop_Instance_Factory (Info.B.Prot_Scope'Unrestricted_Access); + -- Info.Ortho_Type (Mode_Value) := Get_Scope_Type (Info.B.Prot_Scope); Pop_Identifier_Prefix (Mark); end Translate_Protected_Type_Body; @@ -1386,8 +1386,8 @@ package body Trans.Chap3 is (Assoc, New_Unchecked_Address (New_Selected_Element - (Get_Instance_Ref (Info.T.Prot_Scope), - Info.T.Prot_Lock_Field), + (Get_Instance_Ref (Info.B.Prot_Scope), + Info.B.Prot_Lock_Field), Ghdl_Ptr_Type)); New_Procedure_Call (Assoc); end Call_Ghdl_Protected_Procedure; @@ -1403,17 +1403,17 @@ package body Trans.Chap3 is Push_Identifier_Prefix (Mark, Get_Identifier (Bod)); -- Subprograms of BOD. - Subprgs.Push_Subprg_Instance (Info.T.Prot_Scope'Unrestricted_Access, + Subprgs.Push_Subprg_Instance (Info.B.Prot_Scope'Unrestricted_Access, Info.Ortho_Ptr_Type (Mode_Value), Wki_Obj, Prev_Subprg_Instance); Subprgs.Start_Prev_Subprg_Instance_Use_Via_Field - (Prev_Subprg_Instance, Info.T.Prot_Subprg_Instance_Field); + (Prev_Subprg_Instance, Info.B.Prot_Subprg_Instance_Field); Chap4.Translate_Declaration_Chain_Subprograms (Bod); Subprgs.Finish_Prev_Subprg_Instance_Use_Via_Field - (Prev_Subprg_Instance, Info.T.Prot_Subprg_Instance_Field); + (Prev_Subprg_Instance, Info.B.Prot_Subprg_Instance_Field); Subprgs.Pop_Subprg_Instance (Wki_Obj, Prev_Subprg_Instance); Pop_Identifier_Prefix (Mark); @@ -1426,8 +1426,8 @@ package body Trans.Chap3 is declare Var_Obj : O_Dnode; begin - Start_Subprogram_Body (Info.T.Prot_Init_Subprg); - Subprgs.Start_Subprg_Instance_Use (Info.T.Prot_Init_Instance); + Start_Subprogram_Body (Info.B.Prot_Init_Subprg); + Subprgs.Start_Subprg_Instance_Use (Info.B.Prot_Init_Instance); New_Var_Decl (Var_Obj, Wki_Obj, O_Storage_Local, Info.Ortho_Ptr_Type (Mode_Value)); @@ -1436,15 +1436,15 @@ package body Trans.Chap3 is (New_Obj (Var_Obj), Gen_Alloc (Alloc_System, - New_Lit (New_Sizeof (Get_Scope_Type (Info.T.Prot_Scope), + New_Lit (New_Sizeof (Get_Scope_Type (Info.B.Prot_Scope), Ghdl_Index_Type)), Info.Ortho_Ptr_Type (Mode_Value))); Subprgs.Set_Subprg_Instance_Field - (Var_Obj, Info.T.Prot_Subprg_Instance_Field, - Info.T.Prot_Init_Instance); + (Var_Obj, Info.B.Prot_Subprg_Instance_Field, + Info.B.Prot_Init_Instance); - Set_Scope_Via_Param_Ptr (Info.T.Prot_Scope, Var_Obj); + Set_Scope_Via_Param_Ptr (Info.B.Prot_Scope, Var_Obj); -- Create lock. Call_Ghdl_Protected_Procedure (Decl, Ghdl_Protected_Init); @@ -1454,18 +1454,18 @@ package body Trans.Chap3 is Chap4.Elab_Declaration_Chain (Bod, Final); Close_Temp; - Clear_Scope (Info.T.Prot_Scope); + Clear_Scope (Info.B.Prot_Scope); New_Return_Stmt (New_Obj_Value (Var_Obj)); - Subprgs.Finish_Subprg_Instance_Use (Info.T.Prot_Init_Instance); + Subprgs.Finish_Subprg_Instance_Use (Info.B.Prot_Init_Instance); Finish_Subprogram_Body; end; -- Fini subprogram begin - Start_Subprogram_Body (Info.T.Prot_Final_Subprg); - Subprgs.Start_Subprg_Instance_Use (Info.T.Prot_Final_Instance); + Start_Subprogram_Body (Info.B.Prot_Final_Subprg); + Subprgs.Start_Subprg_Instance_Use (Info.B.Prot_Final_Instance); -- Deallocate fields. if Final or True then @@ -1475,7 +1475,7 @@ package body Trans.Chap3 is -- Destroy lock. Call_Ghdl_Protected_Procedure (Decl, Ghdl_Protected_Fini); - Subprgs.Finish_Subprg_Instance_Use (Info.T.Prot_Final_Instance); + Subprgs.Finish_Subprg_Instance_Use (Info.B.Prot_Final_Instance); Finish_Subprogram_Body; end; end Translate_Protected_Type_Body_Subprograms; @@ -1491,7 +1491,7 @@ package body Trans.Chap3 is begin Chap7.Translate_Range (Lv2M (Target, T_Info, Mode_Value, - T_Info.T.Range_Type, T_Info.T.Range_Ptr_Type), + T_Info.B.Range_Type, T_Info.B.Range_Ptr_Type), Get_Range_Constraint (Def), Def); end Create_Scalar_Type_Range; @@ -1510,24 +1510,24 @@ package body Trans.Chap3 is Info := Get_Info (Def); Start_Record_Type (Constr); New_Record_Field - (Constr, Info.T.Range_Left, Wki_Left, + (Constr, Info.B.Range_Left, Wki_Left, Info.Ortho_Type (Mode_Value)); New_Record_Field - (Constr, Info.T.Range_Right, Wki_Right, + (Constr, Info.B.Range_Right, Wki_Right, Info.Ortho_Type (Mode_Value)); New_Record_Field - (Constr, Info.T.Range_Dir, Wki_Dir, Ghdl_Dir_Type_Node); + (Constr, Info.B.Range_Dir, Wki_Dir, Ghdl_Dir_Type_Node); if With_Length then New_Record_Field - (Constr, Info.T.Range_Length, Wki_Length, Ghdl_Index_Type); + (Constr, Info.B.Range_Length, Wki_Length, Ghdl_Index_Type); else - Info.T.Range_Length := O_Fnode_Null; + Info.B.Range_Length := O_Fnode_Null; end if; - Finish_Record_Type (Constr, Info.T.Range_Type); - New_Type_Decl (Create_Identifier ("TRT"), Info.T.Range_Type); - Info.T.Range_Ptr_Type := New_Access_Type (Info.T.Range_Type); + Finish_Record_Type (Constr, Info.B.Range_Type); + New_Type_Decl (Create_Identifier ("TRT"), Info.B.Range_Type); + Info.B.Range_Ptr_Type := New_Access_Type (Info.B.Range_Type); New_Type_Decl (Create_Identifier ("TRPTR"), - Info.T.Range_Ptr_Type); + Info.B.Range_Ptr_Type); end Create_Scalar_Type_Range_Type; function Create_Static_Type_Definition_Type_Range (Def : Iir) @@ -1558,14 +1558,14 @@ package body Trans.Chap3 is case Get_Kind (Def) is when Iir_Kind_Enumeration_Type_Definition | Iir_Kinds_Scalar_Subtype_Definition => - Target := Get_Var (Get_Info (Def).T.Range_Var); + Target := Get_Var (Get_Info (Def).S.Range_Var); Create_Scalar_Type_Range (Def, Target); when Iir_Kind_Array_Subtype_Definition => if Get_Constraint_State (Def) = Fully_Constrained then Info := Get_Info (Def); - if not Info.T.Static_Bounds then - Target := Get_Var (Info.T.Array_Bounds); + if not Info.S.Static_Bounds then + Target := Get_Var (Info.S.Array_Bounds); Create_Array_Subtype_Bounds (Def, Target); end if; end if; @@ -1706,20 +1706,21 @@ package body Trans.Chap3 is Subtype_Info.Ortho_Type := Base_Info.Ortho_Type; Subtype_Info.Ortho_Ptr_Type := Base_Info.Ortho_Ptr_Type; Subtype_Info.Type_Mode := Base_Info.Type_Mode; - Subtype_Info.T := Base_Info.T; + Subtype_Info.B := Base_Info.B; + Subtype_Info.S := Base_Info.S; Rng := Get_Range_Constraint (Def); if Get_Expr_Staticness (Rng) /= Locally then -- Bounds are not known. -- Do the checks. - Subtype_Info.T.Nocheck_Hi := False; - Subtype_Info.T.Nocheck_Low := False; + Subtype_Info.S.Nocheck_Hi := False; + Subtype_Info.S.Nocheck_Low := False; else -- Bounds are locally static. Get_Low_High_Limit (Rng, Lo, Hi); - Subtype_Info.T.Nocheck_Hi := + Subtype_Info.S.Nocheck_Hi := Is_Equal_Limit (Hi, True, Def, Base_Info.Type_Mode); - Subtype_Info.T.Nocheck_Low := + Subtype_Info.S.Nocheck_Low := Is_Equal_Limit (Lo, False, Def, Base_Info.Type_Mode); end if; end Create_Subtype_Info_From_Type; @@ -1851,8 +1852,8 @@ package body Trans.Chap3 is case Get_Type_Staticness (Def) is when None | Globally => - Info.T.Range_Var := Create_Var - (Create_Var_Identifier (Suffix), Base_Info.T.Range_Type); + Info.S.Range_Var := Create_Var + (Create_Var_Identifier (Suffix), Base_Info.B.Range_Type); when Locally => if Global_Storage = O_Storage_External then -- Do not create the value of the type desc, since it @@ -1861,9 +1862,9 @@ package body Trans.Chap3 is else Val := Create_Static_Type_Definition_Type_Range (Def); end if; - Info.T.Range_Var := Create_Global_Const + Info.S.Range_Var := Create_Global_Const (Create_Identifier (Suffix), - Base_Info.T.Range_Type, Global_Storage, Val); + Base_Info.B.Range_Type, Global_Storage, Val); when Unknown => raise Internal_Error; end case; @@ -1964,7 +1965,7 @@ package body Trans.Chap3 is if With_Vars and Get_Type_Staticness (Def) /= Locally then Translate_Physical_Units (Def); else - Info.T.Range_Var := Null_Var; + Info.S.Range_Var := Null_Var; end if; when Iir_Kind_Floating_Type_Definition => @@ -1976,7 +1977,7 @@ package body Trans.Chap3 is if With_Vars then Create_Type_Range_Var (Def); else - Info.T.Range_Var := Null_Var; + Info.S.Range_Var := Null_Var; end if; when Iir_Kind_Array_Type_Definition => @@ -2005,7 +2006,8 @@ package body Trans.Chap3 is end; end if; Translate_Array_Subtype_Definition (Def); - Info.T := Base_Info.T; + Info.B := Base_Info.B; + Info.S := Base_Info.S; --Info.Type_Range_Type := Base_Info.Type_Range_Type; if With_Vars then Create_Array_Subtype_Bounds_Var (Def, False); @@ -2020,7 +2022,7 @@ package body Trans.Chap3 is when Iir_Kind_Record_Type_Definition => Translate_Record_Type (Def); - Info.T := Ortho_Info_Type_Record_Init; + Info.B := Ortho_Info_Basetype_Record_Init; when Iir_Kind_Record_Subtype_Definition | Iir_Kind_Access_Subtype_Definition => @@ -2040,13 +2042,13 @@ package body Trans.Chap3 is when Iir_Kind_File_Type_Definition => Translate_File_Type (Def); - Info.T := Ortho_Info_Type_File_Init; + Info.B := Ortho_Info_Basetype_File_Init; if With_Vars then Create_File_Type_Var (Def); end if; when Iir_Kind_Protected_Type_Declaration => - Info.T := Ortho_Info_Type_Prot_Init; + Info.B := Ortho_Info_Basetype_Prot_Init; Translate_Protected_Type (Def); when others => @@ -2261,15 +2263,15 @@ package body Trans.Chap3 is return Lv2M (New_Selected_Element (M2Lv (B), Base_Index_Info.Index_Field), Iinfo, Mode_Value, - Iinfo.T.Range_Type, Iinfo.T.Range_Ptr_Type); + Iinfo.B.Range_Type, Iinfo.B.Range_Ptr_Type); end Bounds_To_Range; function Type_To_Range (Atype : Iir) return Mnode is Info : constant Type_Info_Acc := Get_Info (Atype); begin - return Varv2M (Info.T.Range_Var, Info, Mode_Value, - Info.T.Range_Type, Info.T.Range_Ptr_Type); + return Varv2M (Info.S.Range_Var, Info, Mode_Value, + Info.B.Range_Type, Info.B.Range_Ptr_Type); end Type_To_Range; function Range_To_Length (R : Mnode) return Mnode @@ -2277,7 +2279,7 @@ package body Trans.Chap3 is Tinfo : constant Type_Info_Acc := Get_Type_Info (R); begin return Lv2M (New_Selected_Element (M2Lv (R), - Tinfo.T.Range_Length), + Tinfo.B.Range_Length), Tinfo, Mode_Value); end Range_To_Length; @@ -2287,7 +2289,7 @@ package body Trans.Chap3 is Tinfo : constant Type_Info_Acc := Get_Type_Info (R); begin return Lv2M (New_Selected_Element (M2Lv (R), - Tinfo.T.Range_Dir), + Tinfo.B.Range_Dir), Tinfo, Mode_Value); end Range_To_Dir; @@ -2298,7 +2300,7 @@ package body Trans.Chap3 is begin Tinfo := Get_Type_Info (R); return Lv2M (New_Selected_Element (M2Lv (R), - Tinfo.T.Range_Left), + Tinfo.B.Range_Left), Tinfo, Mode_Value); end Range_To_Left; @@ -2309,7 +2311,7 @@ package body Trans.Chap3 is begin Tinfo := Get_Type_Info (R); return Lv2M (New_Selected_Element (M2Lv (R), - Tinfo.T.Range_Right), + Tinfo.B.Range_Right), Tinfo, Mode_Value); end Range_To_Right; @@ -2321,10 +2323,10 @@ package body Trans.Chap3 is when Type_Mode_Fat_Array => raise Internal_Error; when Type_Mode_Array => - return Varv2M (Info.T.Array_Bounds, + return Varv2M (Info.S.Array_Bounds, Info, Mode_Value, - Info.T.Bounds_Type, - Info.T.Bounds_Ptr_Type); + Info.B.Bounds_Type, + Info.B.Bounds_Ptr_Type); when others => raise Internal_Error; end case; @@ -2346,11 +2348,11 @@ package body Trans.Chap3 is begin return Lp2M (New_Selected_Element (M2Lv (Arr), - Info.T.Bounds_Field (Kind)), + Info.B.Bounds_Field (Kind)), Info, Mode_Value, - Info.T.Bounds_Type, - Info.T.Bounds_Ptr_Type); + Info.B.Bounds_Type, + Info.B.Bounds_Ptr_Type); end; when Type_Mode_Array => return Get_Array_Type_Bounds (Info); @@ -2432,11 +2434,11 @@ package body Trans.Chap3 is begin return Lp2M (New_Selected_Element (M2Lv (Arr), - Info.T.Base_Field (Kind)), + Info.B.Base_Field (Kind)), Info, Kind, - Info.T.Base_Type (Kind), - Info.T.Base_Ptr_Type (Kind)); + Info.B.Base_Type (Kind), + Info.B.Base_Ptr_Type (Kind)); end; when Type_Mode_Array => return Arr; @@ -2452,8 +2454,8 @@ package body Trans.Chap3 is begin return Add_Pointer (Acc, - New_Lit (New_Sizeof (D_Info.T.Bounds_Type, Ghdl_Index_Type)), - D_Info.T.Base_Ptr_Type (Mode_Value)); + New_Lit (New_Sizeof (D_Info.B.Bounds_Type, Ghdl_Index_Type)), + D_Info.B.Base_Ptr_Type (Mode_Value)); end Get_Bounds_Acc_Base; function Reindex_Complex_Array @@ -2502,11 +2504,11 @@ package body Trans.Chap3 is return Reindex_Complex_Array (Base, Atype, Index, T_Info); else return Lv2M (New_Slice (M2Lv (Base), - T_Info.T.Base_Type (Kind), + T_Info.B.Base_Type (Kind), Index), T_Info, Kind, - T_Info.T.Base_Type (Kind), - T_Info.T.Base_Ptr_Type (Kind)); + T_Info.B.Base_Type (Kind), + T_Info.B.Base_Ptr_Type (Kind)); end if; end Slice_Base; @@ -2540,7 +2542,7 @@ package body Trans.Chap3 is -- Allocate the storage for the elements. New_Assign_Stmt (M2Lp (Chap3.Get_Array_Base (Res)), - Gen_Alloc (Alloc_Kind, Length, Dinfo.T.Base_Ptr_Type (Kind))); + Gen_Alloc (Alloc_Kind, Length, Dinfo.B.Base_Ptr_Type (Kind))); Maybe_Call_Type_Builder (Res, Arr_Type); end Allocate_Fat_Array_Base; @@ -2649,7 +2651,7 @@ package body Trans.Chap3 is begin Gen_Memcpy (Dest, Src, - New_Lit (New_Sizeof (Tinfo.T.Bounds_Type, Ghdl_Index_Type))); + New_Lit (New_Sizeof (Tinfo.B.Bounds_Type, Ghdl_Index_Type))); end Copy_Bounds; procedure Copy_Bounds (Dest : Mnode; Src : Mnode; Obj_Type : Iir) is @@ -2671,9 +2673,9 @@ package body Trans.Chap3 is New_Assign_Stmt (M2Lp (Chap3.Get_Array_Bounds (Res)), Gen_Alloc (Alloc_Kind, - New_Lit (New_Sizeof (Dinfo.T.Bounds_Type, + New_Lit (New_Sizeof (Dinfo.B.Bounds_Type, Ghdl_Index_Type)), - Dinfo.T.Bounds_Ptr_Type)); + Dinfo.B.Bounds_Ptr_Type)); -- Copy bounds to the allocated area. Copy_Bounds (Chap3.Get_Array_Bounds (Res), Bounds, Obj_Type); @@ -2728,23 +2730,23 @@ package body Trans.Chap3 is is L, H : O_Enode; begin - if not Info.T.Nocheck_Low then + if not Info.S.Nocheck_Low then L := New_Compare_Op (ON_Lt, New_Obj_Value (Value), Low, Ghdl_Bool_Type); end if; - if not Info.T.Nocheck_Hi then + if not Info.S.Nocheck_Hi then H := New_Compare_Op (ON_Gt, New_Obj_Value (Value), Hi, Ghdl_Bool_Type); end if; - if Info.T.Nocheck_Hi then - if Info.T.Nocheck_Low then + if Info.S.Nocheck_Hi then + if Info.S.Nocheck_Low then -- Should not happen! return New_Lit (Ghdl_Bool_False_Node); else return L; end if; else - if Info.T.Nocheck_Low then + if Info.S.Nocheck_Low then return H; else return New_Dyadic_Op (ON_Or, L, H); @@ -2813,7 +2815,7 @@ package body Trans.Chap3 is is Info : constant Type_Info_Acc := Get_Info (Atype); begin - if Info.T.Nocheck_Low and Info.T.Nocheck_Hi then + if Info.S.Nocheck_Low and Info.S.Nocheck_Hi then return False; end if; if Expr /= Null_Iir and then Get_Type (Expr) = Atype then diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb index e2a9a50c5..6bcc41eb8 100644 --- a/src/vhdl/translate/trans-chap4.adb +++ b/src/vhdl/translate/trans-chap4.adb @@ -392,8 +392,8 @@ package body Trans.Chap4 is Assoc : O_Assoc_List; begin -- Call the initializer. - Start_Association (Assoc, Info.T.Prot_Init_Subprg); - Subprgs.Add_Subprg_Instance_Assoc (Assoc, Info.T.Prot_Init_Instance); + Start_Association (Assoc, Info.B.Prot_Init_Subprg); + Subprgs.Add_Subprg_Instance_Assoc (Assoc, Info.B.Prot_Init_Instance); -- Use of M2Lp is a little bit fragile (not sure we get the -- variable, but should work: we didn't stabilize it). New_Assign_Stmt (M2Lp (Obj), New_Function_Call (Assoc)); @@ -407,7 +407,7 @@ package body Trans.Chap4 is begin Obj := Chap6.Translate_Name (Decl, Mode_Value); -- Call the Finalizator. - Start_Association (Assoc, Info.T.Prot_Final_Subprg); + Start_Association (Assoc, Info.B.Prot_Final_Subprg); New_Association (Assoc, M2E (Obj)); New_Procedure_Call (Assoc); end Fini_Protected_Object; @@ -1370,9 +1370,9 @@ package body Trans.Chap4 is else Start_Association (Constr, Ghdl_File_Elaborate); Info := Get_Info (Get_Type (Decl)); - if Info.T.File_Signature /= O_Dnode_Null then + if Info.B.File_Signature /= O_Dnode_Null then New_Association - (Constr, New_Address (New_Obj (Info.T.File_Signature), + (Constr, New_Address (New_Obj (Info.B.File_Signature), Char_Ptr_Type)); else New_Association (Constr, @@ -1997,7 +1997,7 @@ package body Trans.Chap4 is (Var_Length, Wki_Length, O_Storage_Local, Ghdl_Index_Type); New_Var_Decl (Var_Bound, Get_Identifier ("BOUND"), O_Storage_Local, - Base_Info.T.Bounds_Type); + Base_Info.B.Bounds_Type); New_Var_Decl (Var_Array, Get_Identifier ("VARRAY"), O_Storage_Local, Base_Info.Ortho_Type (Mode_Value)); @@ -2022,14 +2022,14 @@ package body Trans.Chap4 is Range_Ptr := Lv2M (New_Selected_Element (New_Obj (Var_Bound), Index_Info.Index_Field), Index_Tinfo, Mode_Value, - Index_Tinfo.T.Range_Type, - Index_Tinfo.T.Range_Ptr_Type); + Index_Tinfo.B.Range_Type, + Index_Tinfo.B.Range_Ptr_Type); Chap3.Create_Range_From_Length (Index_Type, Var_Length, Range_Ptr, Func); New_Assign_Stmt (New_Selected_Element (New_Obj (Var_Array), - Base_Info.T.Bounds_Field (Mode_Value)), - New_Address (New_Obj (Var_Bound), Base_Info.T.Bounds_Ptr_Type)); + Base_Info.B.Bounds_Field (Mode_Value)), + New_Address (New_Obj (Var_Bound), Base_Info.B.Bounds_Ptr_Type)); -- Allocate the array. Chap3.Allocate_Fat_Array_Base diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index 18f54fd7e..eee9c24b2 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -506,16 +506,16 @@ package body Trans.Chap5 is Tinfo : constant Type_Info_Acc := Get_Info (Atype); Var : O_Dnode; begin - Var := Create_Temp (Tinfo.T.Bounds_Ptr_Type); + Var := Create_Temp (Tinfo.B.Bounds_Ptr_Type); New_Assign_Stmt (New_Obj (Var), Gen_Alloc (Alloc, - New_Lit (New_Sizeof (Tinfo.T.Bounds_Type, + New_Lit (New_Sizeof (Tinfo.B.Bounds_Type, Ghdl_Index_Type)), - Tinfo.T.Bounds_Ptr_Type)); + Tinfo.B.Bounds_Ptr_Type)); return Dp2M (Var, Tinfo, Mode_Value, - Tinfo.T.Bounds_Type, - Tinfo.T.Bounds_Ptr_Type); + Tinfo.B.Bounds_Type, + Tinfo.B.Bounds_Ptr_Type); end Alloc_Bounds; function Get_Unconstrained_Port_Bounds (Assoc : Iir; Inter : Iir) @@ -538,7 +538,7 @@ package body Trans.Chap5 is Tinfo := Get_Info (Actual_Type); if Save and then - Get_Alloc_Kind_For_Var (Tinfo.T.Array_Bounds) = Alloc_Stack + Get_Alloc_Kind_For_Var (Tinfo.S.Array_Bounds) = Alloc_Stack then -- We need a copy. Bounds_Copy := Alloc_Bounds (Actual_Type, Alloc_System); diff --git a/src/vhdl/translate/trans-chap6.adb b/src/vhdl/translate/trans-chap6.adb index d1375c728..da87fd88b 100644 --- a/src/vhdl/translate/trans-chap6.adb +++ b/src/vhdl/translate/trans-chap6.adb @@ -707,11 +707,11 @@ package body Trans.Chap6 is Res_D := Create_Temp (Slice_Info.Ortho_Type (Kind)); New_Assign_Stmt (New_Selected_Element (New_Obj (Res_D), - Slice_Info.T.Bounds_Field (Kind)), + Slice_Info.B.Bounds_Field (Kind)), New_Value (M2Lp (Data.Slice_Range))); New_Assign_Stmt (New_Selected_Element (New_Obj (Res_D), - Slice_Info.T.Base_Field (Kind)), + Slice_Info.B.Base_Field (Kind)), M2E (Chap3.Slice_Base (Chap3.Get_Array_Base (Prefix), Slice_Type, diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb index 1f4d71b3b..9e7e6ec75 100644 --- a/src/vhdl/translate/trans-chap7.adb +++ b/src/vhdl/translate/trans-chap7.adb @@ -79,22 +79,22 @@ package body Trans.Chap7 is Val := Create_Global_Const (Create_Uniq_Identifier, Expr_Info.Ortho_Type (Mode_Value), O_Storage_Private, Expr); - Bound := Expr_Info.T.Array_Bounds; + Bound := Expr_Info.S.Array_Bounds; if Bound = Null_Var then Bound := Create_Global_Const - (Create_Uniq_Identifier, Expr_Info.T.Bounds_Type, + (Create_Uniq_Identifier, Expr_Info.B.Bounds_Type, O_Storage_Private, Chap3.Create_Static_Array_Subtype_Bounds (Expr_Type)); - Expr_Info.T.Array_Bounds := Bound; + Expr_Info.S.Array_Bounds := Bound; end if; Start_Record_Aggr (List, Res_Info.Ortho_Type (Mode_Value)); New_Record_Aggr_El (List, New_Global_Address (Get_Var_Label (Val), - Res_Info.T.Base_Ptr_Type (Mode_Value))); + Res_Info.B.Base_Ptr_Type (Mode_Value))); New_Record_Aggr_El (List, New_Global_Address (Get_Var_Label (Bound), - Expr_Info.T.Bounds_Ptr_Type)); + Expr_Info.B.Bounds_Ptr_Type)); Finish_Record_Aggr (List, Res); return Res; @@ -310,7 +310,7 @@ package body Trans.Chap7 is begin -- Create the string value. Arr_Type := New_Constrained_Array_Type - (Get_Info (Str_Type).T.Base_Type (Mode_Value), + (Get_Info (Str_Type).B.Base_Type (Mode_Value), New_Unsigned_Literal (Ghdl_Index_Type, Unsigned_64 (Get_String_Length (Str)))); @@ -343,8 +343,8 @@ package body Trans.Chap7 is if Type_Info.Type_Mode = Type_Mode_Fat_Array then -- Create the string bound. - Start_Record_Aggr (Bound_Aggr, Type_Info.T.Bounds_Type); - Start_Record_Aggr (Index_Aggr, Index_Type_Info.T.Range_Type); + Start_Record_Aggr (Bound_Aggr, Type_Info.B.Bounds_Type); + Start_Record_Aggr (Index_Aggr, Index_Type_Info.B.Range_Type); New_Record_Aggr_El (Index_Aggr, New_Signed_Literal @@ -362,7 +362,7 @@ package body Trans.Chap7 is New_Record_Aggr_El (Bound_Aggr, Res); Finish_Record_Aggr (Bound_Aggr, Res); Bound := Create_Global_Const - (Create_Uniq_Identifier, Type_Info.T.Bounds_Type, + (Create_Uniq_Identifier, Type_Info.B.Bounds_Type, O_Storage_Private, Res); -- The descriptor. @@ -370,11 +370,11 @@ package body Trans.Chap7 is New_Record_Aggr_El (Res_Aggr, New_Global_Address (Get_Var_Label (Val), - Type_Info.T.Base_Ptr_Type (Mode_Value))); + Type_Info.B.Base_Ptr_Type (Mode_Value))); New_Record_Aggr_El (Res_Aggr, New_Global_Address (Get_Var_Label (Bound), - Type_Info.T.Bounds_Ptr_Type)); + Type_Info.B.Bounds_Ptr_Type)); Finish_Record_Aggr (Res_Aggr, Res); Val := Create_Global_Const @@ -761,7 +761,7 @@ package body Trans.Chap7 is New_Assign_Stmt (M2Lp (Chap3.Get_Array_Base (Res)), New_Convert_Ov (M2Addr (Chap3.Get_Array_Base (Stable_Expr)), - Type_Info.T.Base_Ptr_Type (Kind))); + Type_Info.B.Base_Ptr_Type (Kind))); New_Assign_Stmt (M2Lp (Chap3.Get_Array_Bounds (Res)), M2Addr (Chap3.Get_Array_Bounds (Stable_Expr))); @@ -1409,14 +1409,14 @@ package body Trans.Chap7 is begin -- Bounds Var_Bounds := Dv2M - (Create_Temp (Info.T.Bounds_Type), Info, Mode_Value, - Info.T.Bounds_Type, Info.T.Bounds_Ptr_Type); + (Create_Temp (Info.B.Bounds_Type), Info, Mode_Value, + Info.B.Bounds_Type, Info.B.Bounds_Ptr_Type); -- Base - Arr_Ptr := Create_Temp (Info.T.Base_Ptr_Type (Mode_Value)); + Arr_Ptr := Create_Temp (Info.B.Base_Ptr_Type (Mode_Value)); Var_Arr := Dp2M (Arr_Ptr, Info, Mode_Value, - Info.T.Base_Type (Mode_Value), - Info.T.Base_Ptr_Type (Mode_Value)); + Info.B.Base_Type (Mode_Value), + Info.B.Base_Ptr_Type (Mode_Value)); -- Result Var_Res := Create_Temp (Info.Ortho_Type (Mode_Value)); @@ -1575,7 +1575,7 @@ package body Trans.Chap7 is (New_Obj (Arr_Ptr), Gen_Alloc (Alloc_Stack, Chap3.Get_Object_Size (Res, Expr_Type), - Info.T.Base_Ptr_Type (Mode_Value))); + Info.B.Base_Ptr_Type (Mode_Value))); New_Assign_Stmt (M2Lp (Chap3.Get_Array_Base (Res)), M2Addr (Var_Arr)); @@ -1776,7 +1776,7 @@ package body Trans.Chap7 is Res_Btype : constant Iir := Get_Base_Type (Res_Type); Res_Info : constant Type_Info_Acc := Get_Info (Res_Btype); Base_Ptr_Type : constant O_Tnode := - Res_Info.T.Base_Ptr_Type (Mode_Value); + Res_Info.B.Base_Ptr_Type (Mode_Value); Arr : Mnode; El : O_Dnode; Base : O_Dnode; @@ -2244,16 +2244,16 @@ package body Trans.Chap7 is V1 := New_Compare_Op (Op1, New_Value_Selected_Acc_Value - (New_Obj (L), B.T.Base_Field (Mode_Value)), + (New_Obj (L), B.B.Base_Field (Mode_Value)), New_Value_Selected_Acc_Value - (New_Obj (R), B.T.Base_Field (Mode_Value)), + (New_Obj (R), B.B.Base_Field (Mode_Value)), Std_Boolean_Type_Node); V2 := New_Compare_Op (Op1, New_Value_Selected_Acc_Value - (New_Obj (L), B.T.Bounds_Field (Mode_Value)), + (New_Obj (L), B.B.Bounds_Field (Mode_Value)), New_Value_Selected_Acc_Value - (New_Obj (R), B.T.Bounds_Field (Mode_Value)), + (New_Obj (R), B.B.Bounds_Field (Mode_Value)), Std_Boolean_Type_Node); return New_Dyadic_Op (Op2, V1, V2); end; @@ -3142,8 +3142,8 @@ package body Trans.Chap7 is Chap3.Translate_Anonymous_Type_Definition (Subaggr_Type); A_Range := - Dv2M (Create_Temp (Rinfo.T.Range_Type), Rinfo, Mode_Value, - Rinfo.T.Range_Type, Rinfo.T.Range_Ptr_Type); + Dv2M (Create_Temp (Rinfo.B.Range_Type), Rinfo, Mode_Value, + Rinfo.B.Range_Type, Rinfo.B.Range_Ptr_Type); Chap7.Translate_Range (A_Range, Get_Range_Constraint (Subaggr_Type), Subaggr_Type); @@ -3304,7 +3304,7 @@ package body Trans.Chap7 is -- Size of the bounds. Bounds_Size := - New_Sizeof (D_Info.T.Bounds_Type, Ghdl_Index_Type); + New_Sizeof (D_Info.B.Bounds_Type, Ghdl_Index_Type); -- Allocate the object. New_Assign_Stmt @@ -3353,7 +3353,7 @@ package body Trans.Chap7 is New_Assign_Stmt (M2Lp (Chap3.Get_Array_Bounds (Res)), - New_Convert_Ov (New_Obj_Value (Ptr), D_Info.T.Bounds_Ptr_Type)); + New_Convert_Ov (New_Obj_Value (Ptr), D_Info.B.Bounds_Ptr_Type)); New_Assign_Stmt (M2Lp (Chap3.Get_Array_Base (Res)), Chap3.Get_Bounds_Acc_Base (New_Obj_Value (Ptr), D_Type)); @@ -3392,7 +3392,7 @@ package body Trans.Chap7 is -- Size of the bounds. Bounds_Size := - New_Sizeof (D_Info.T.Bounds_Type, Ghdl_Index_Type); + New_Sizeof (D_Info.B.Bounds_Type, Ghdl_Index_Type); -- Allocate the object. New_Assign_Stmt @@ -3564,7 +3564,7 @@ package body Trans.Chap7 is Bounds : O_Dnode; begin Res := Create_Temp (Res_Info, Mode_Value); - Bounds := Create_Temp (Res_Info.T.Bounds_Type); + Bounds := Create_Temp (Res_Info.B.Bounds_Type); Open_Temp; E := Stabilize (E2M (Expr, Expr_Info, Mode_Value)); @@ -3573,16 +3573,16 @@ package body Trans.Chap7 is New_Assign_Stmt (M2Lp (Chap3.Get_Array_Base (Res)), New_Convert_Ov (M2Addr (Chap3.Get_Array_Base (E)), - Res_Info.T.Base_Ptr_Type (Mode_Value))); + Res_Info.B.Base_Ptr_Type (Mode_Value))); -- Set bounds. New_Assign_Stmt (M2Lp (Chap3.Get_Array_Bounds (Res)), - New_Address (New_Obj (Bounds), Res_Info.T.Bounds_Ptr_Type)); + New_Address (New_Obj (Bounds), Res_Info.B.Bounds_Ptr_Type)); -- Convert bounds. Translate_Type_Conversion_Bounds (Dv2M (Bounds, Res_Info, Mode_Value, - Res_Info.T.Bounds_Type, Res_Info.T.Bounds_Ptr_Type), + Res_Info.B.Bounds_Type, Res_Info.B.Bounds_Ptr_Type), Stabilize (Chap3.Get_Array_Bounds (E)), Res_Type, Expr_Type, Loc); @@ -4159,7 +4159,7 @@ package body Trans.Chap7 is New_Assign_Stmt (M2Lv (Chap3.Range_To_Dir (Res1)), New_Lit (Chap7.Translate_Static_Range_Dir (Expr))); - if T_Info.T.Range_Length /= O_Fnode_Null then + if T_Info.B.Range_Length /= O_Fnode_Null then if Get_Expr_Staticness (Expr) = Locally then New_Assign_Stmt (M2Lv (Chap3.Range_To_Length (Res1)), @@ -4197,7 +4197,7 @@ package body Trans.Chap7 is begin Open_Temp; Arange1 := Stabilize (Lv2M (Arange, Rinfo, Mode_Value, - Rinfo.T.Range_Type, Rinfo.T.Range_Ptr_Type)); + Rinfo.B.Range_Type, Rinfo.B.Range_Ptr_Type)); Res1 := Stabilize (Res); New_Assign_Stmt (M2Lv (Chap3.Range_To_Left (Res1)), M2E (Chap3.Range_To_Right (Arange1))); @@ -4234,7 +4234,7 @@ package body Trans.Chap7 is M2E (Chap3.Range_To_Right (Src1))); New_Assign_Stmt (M2Lv (Chap3.Range_To_Dir (Dest1)), M2E (Chap3.Range_To_Dir (Src1))); - if Info.T.Range_Length /= O_Fnode_Null then + if Info.B.Range_Length /= O_Fnode_Null then -- Floating point types have no length. New_Assign_Stmt (M2Lv (Chap3.Range_To_Length (Dest1)), M2E (Chap3.Range_To_Length (Src1))); @@ -4253,11 +4253,11 @@ package body Trans.Chap7 is begin Open_Temp; Ptr := Create_Temp_Ptr - (Rinfo.T.Range_Ptr_Type, + (Rinfo.B.Range_Ptr_Type, Chap14.Translate_Range_Array_Attribute (Arange)); Copy_Range (Res, Dp2M (Ptr, Rinfo, Mode_Value, - Rinfo.T.Range_Type, Rinfo.T.Range_Ptr_Type)); + Rinfo.B.Range_Type, Rinfo.B.Range_Ptr_Type)); Close_Temp; end; when Iir_Kind_Reverse_Range_Array_Attribute => @@ -4280,10 +4280,10 @@ package body Trans.Chap7 is declare Rinfo : constant Type_Info_Acc := Get_Info (Arange); begin - Copy_Range (Res, Lv2M (Get_Var (Rinfo.T.Range_Var), + Copy_Range (Res, Lv2M (Get_Var (Rinfo.S.Range_Var), Rinfo, Mode_Value, - Rinfo.T.Range_Type, - Rinfo.T.Range_Ptr_Type)); + Rinfo.B.Range_Type, + Rinfo.B.Range_Ptr_Type)); end; else Translate_Range (Res, @@ -4306,7 +4306,7 @@ package body Trans.Chap7 is return Translate_Range (Get_Named_Entity (Arange), Range_Type); when Iir_Kind_Subtype_Declaration => -- Must be a scalar subtype. Range of types is static. - return Get_Var (Get_Info (Get_Type (Arange)).T.Range_Var); + return Get_Var (Get_Info (Get_Type (Arange)).S.Range_Var); when Iir_Kind_Range_Array_Attribute => return Chap14.Translate_Range_Array_Attribute (Arange); when Iir_Kind_Reverse_Range_Array_Attribute => @@ -4314,7 +4314,7 @@ package body Trans.Chap7 is Rinfo : constant Type_Info_Acc := Get_Info (Range_Type); Res : O_Dnode; begin - Res := Create_Temp (Rinfo.T.Range_Type); + Res := Create_Temp (Rinfo.B.Range_Type); Translate_Reverse_Range (Dv2M (Res, Rinfo, Mode_Value), Chap14.Translate_Range_Array_Attribute (Arange), @@ -4326,10 +4326,10 @@ package body Trans.Chap7 is Rinfo : constant Type_Info_Acc := Get_Info (Range_Type); Res : O_Dnode; begin - Res := Create_Temp (Rinfo.T.Range_Type); + Res := Create_Temp (Rinfo.B.Range_Type); Translate_Range_Expression (Dv2M (Res, Rinfo, Mode_Value, - Rinfo.T.Range_Type, Rinfo.T.Range_Ptr_Type), + Rinfo.B.Range_Type, Rinfo.B.Range_Ptr_Type), Arange, Range_Type); return New_Obj (Res); end; @@ -4345,14 +4345,14 @@ package body Trans.Chap7 is Res : O_Cnode; T_Info : constant Type_Info_Acc := Get_Info (Range_Type); begin - Start_Record_Aggr (Constr, T_Info.T.Range_Type); + Start_Record_Aggr (Constr, T_Info.B.Range_Type); New_Record_Aggr_El (Constr, Chap7.Translate_Static_Range_Left (Arange, Range_Type)); New_Record_Aggr_El (Constr, Chap7.Translate_Static_Range_Right (Arange, Range_Type)); New_Record_Aggr_El (Constr, Chap7.Translate_Static_Range_Dir (Arange)); - if T_Info.T.Range_Length /= O_Fnode_Null then + if T_Info.B.Range_Length /= O_Fnode_Null then New_Record_Aggr_El (Constr, Chap7.Translate_Static_Range_Length (Arange)); end if; @@ -4784,13 +4784,13 @@ package body Trans.Chap7 is Ghdl_Index_Type); New_Var_Decl (Var_I, Wki_I, O_Storage_Local, Ghdl_Index_Type); New_Var_Decl (Var_Base, Get_Identifier ("base"), O_Storage_Local, - Info.T.Base_Ptr_Type (Mode_Value)); + Info.B.Base_Ptr_Type (Mode_Value)); New_Var_Decl (Var_L_Base, Get_Identifier ("l_base"), O_Storage_Local, - Info.T.Base_Ptr_Type (Mode_Value)); + Info.B.Base_Ptr_Type (Mode_Value)); if not Is_Monadic then New_Var_Decl (Var_R_Base, Get_Identifier ("r_base"), O_Storage_Local, - Info.T.Base_Ptr_Type (Mode_Value)); + Info.B.Base_Ptr_Type (Mode_Value)); end if; Open_Temp; -- Get length of LEFT. @@ -5065,9 +5065,9 @@ package body Trans.Chap7 is New_Var_Decl (Var_I1, Get_Identifier ("I1"), O_Storage_Local, Ghdl_Index_Type); New_Var_Decl (Var_Res_Base, Get_Identifier ("res_base"), - O_Storage_Local, Info.T.Base_Ptr_Type (Mode_Value)); + O_Storage_Local, Info.B.Base_Ptr_Type (Mode_Value)); New_Var_Decl (Var_L_Base, Get_Identifier ("l_base"), - O_Storage_Local, Info.T.Base_Ptr_Type (Mode_Value)); + O_Storage_Local, Info.B.Base_Ptr_Type (Mode_Value)); if Shift = Sh_Arith then New_Var_Decl (Var_E, Get_Identifier ("E"), O_Storage_Local, Get_Info (Get_Element_Subtype (Arr_Type)). @@ -5111,7 +5111,7 @@ package body Trans.Chap7 is New_Assign_Stmt (New_Obj (Var_Res_Base), Gen_Alloc (Alloc_Return, New_Obj_Value (Var_Length), - Info.T.Base_Ptr_Type (Mode_Value))); + Info.B.Base_Ptr_Type (Mode_Value))); New_Assign_Stmt (M2Lp (Chap3.Get_Array_Base (Res)), New_Obj_Value (Var_Res_Base)); diff --git a/src/vhdl/translate/trans-chap8.adb b/src/vhdl/translate/trans-chap8.adb index b92c6c68e..311d73aeb 100644 --- a/src/vhdl/translate/trans-chap8.adb +++ b/src/vhdl/translate/trans-chap8.adb @@ -481,7 +481,7 @@ package body Trans.Chap8 is else It_Info.Iterator_Range := Create_Var (Create_Var_Identifier ("IT_RANGE"), - Iter_Type_Info.T.Range_Ptr_Type, + Iter_Type_Info.B.Range_Ptr_Type, O_Storage_Local); end if; end Translate_For_Loop_Statement_Declaration; @@ -522,17 +522,17 @@ package body Trans.Chap8 is New_Assign_Stmt (Get_Var (It_Info.Iterator_Range), New_Address (Chap7.Translate_Range (Constraint, Iter_Base_Type), - Iter_Type_Info.T.Range_Ptr_Type)); + Iter_Type_Info.B.Range_Ptr_Type)); New_Assign_Stmt (Get_Var (It_Info.Iterator_Var), Get_Range_Ptr_Field_Value (Get_Var (It_Info.Iterator_Range), - Iter_Type_Info.T.Range_Left)); + Iter_Type_Info.B.Range_Left)); -- Before starting the loop, check whether there will be at least -- one iteration. Cond := New_Compare_Op (ON_Gt, Get_Range_Ptr_Field_Value (Get_Var (It_Info.Iterator_Range), - Iter_Type_Info.T.Range_Length), + Iter_Type_Info.B.Range_Length), New_Lit (Ghdl_Index_0), Ghdl_Bool_Type); end if; @@ -554,7 +554,7 @@ package body Trans.Chap8 is Val := New_Value (Get_Var (It_Info.Iterator_Right)); else Val := Get_Range_Ptr_Field_Value - (Get_Var (It_Info.Iterator_Range), Iter_Type_Info.T.Range_Right); + (Get_Var (It_Info.Iterator_Range), Iter_Type_Info.B.Range_Right); end if; Cond := New_Compare_Op (ON_Eq, New_Value (Get_Var (It_Info.Iterator_Var)), Val, @@ -586,7 +586,7 @@ package body Trans.Chap8 is (If_Blk1, New_Compare_Op (ON_Eq, Get_Range_Ptr_Field_Value (Get_Var (It_Info.Iterator_Range), - Iter_Type_Info.T.Range_Dir), + Iter_Type_Info.B.Range_Dir), New_Lit (Ghdl_Dir_To_Node), Ghdl_Bool_Type)); Gen_Update_Iterator (It_Info.Iterator_Var, @@ -1102,7 +1102,7 @@ package body Trans.Chap8 is Func_Info : Subprg_Info_Acc; begin New_Assign_Stmt (New_Selected_Element (New_Obj (Val_Node), - Tinfo.T.Base_Field (Mode_Value)), + Tinfo.B.Base_Field (Mode_Value)), Val); Func_Info := Get_Info (Func); Start_Association (Assoc, Func_Info.Ortho_Func); @@ -1140,9 +1140,9 @@ package body Trans.Chap8 is C_Node := Create_Temp (Tinfo.Ortho_Type (Mode_Value)); New_Assign_Stmt (New_Selected_Element (New_Obj (C_Node), - Tinfo.T.Bounds_Field (Mode_Value)), + Tinfo.B.Bounds_Field (Mode_Value)), New_Value_Selected_Acc_Value - (New_Obj (Expr_Node), Tinfo.T.Bounds_Field (Mode_Value))); + (New_Obj (Expr_Node), Tinfo.B.Bounds_Field (Mode_Value))); end Translate_String_Case_Statement_Common; -- Translate a string case statement using a dichotomy. @@ -1307,7 +1307,7 @@ package body Trans.Chap8 is Sel_Length := Eval_Discrete_Type_Length (Get_String_Type_Bound_Type (Expr_Type)); String_Type := New_Constrained_Array_Type - (Tinfo.T.Base_Type (Mode_Value), + (Tinfo.B.Base_Type (Mode_Value), New_Unsigned_Literal (Ghdl_Index_Type, Unsigned_64 (Sel_Length))); Table_Base_Type := New_Array_Type (String_Type, Ghdl_Index_Type); New_Type_Decl (Create_Uniq_Identifier, Table_Base_Type); @@ -1406,7 +1406,7 @@ package body Trans.Chap8 is (Expr_Node, New_Address (New_Indexed_Element (New_Obj (Table), New_Obj_Value (Var_Mid)), - Tinfo.T.Base_Ptr_Type (Mode_Value)), + Tinfo.B.Base_Ptr_Type (Mode_Value)), C_Node, Tinfo, Func)); -- Generate: @@ -2329,7 +2329,7 @@ package body Trans.Chap8 is -- Type of actual was not yet translated. Possible -- only for slice. Do it manually. Atype_Binfo := Get_Info (Get_Base_Type (Act_Type)); - Ref_Type := Atype_Binfo.T.Base_Ptr_Type (Object_Kind); + Ref_Type := Atype_Binfo.B.Base_Ptr_Type (Object_Kind); end if; Call_Assoc_Info.Call_Assoc_Ref := Create_Var (Create_Var_Identifier (Inter, "__REF", Num), @@ -2344,7 +2344,7 @@ package body Trans.Chap8 is -- - the array (if the actual is constrained and not -- complex) - TODO -- - a pointer to the base. - Val_Type := Ftype_Info.T.Base_Ptr_Type (Mode); + Val_Type := Ftype_Info.B.Base_Ptr_Type (Mode); else -- For constrained arrays/records: -- - the base if not complex @@ -2371,7 +2371,7 @@ package body Trans.Chap8 is if Has_Bounds_Field then Call_Assoc_Info.Call_Assoc_Bounds := Create_Var (Create_Var_Identifier (Inter, "__BND", Num), - Ftype_Info.T.Bounds_Type, O_Storage_Local); + Ftype_Info.B.Bounds_Type, O_Storage_Local); end if; if Has_Fat_Pointer_Field then @@ -2894,8 +2894,8 @@ package body Trans.Chap8 is Bnd := Stabilize (Lv2M (Get_Var (Assoc_Info.Call_Assoc_Bounds), Ftype_Info, Mode_Value, - Ftype_Info.T.Bounds_Type, - Ftype_Info.T.Bounds_Ptr_Type)); + Ftype_Info.B.Bounds_Type, + Ftype_Info.B.Bounds_Ptr_Type)); Chap3.Copy_Bounds (Bnd, Chap3.Get_Array_Bounds (Mval), Formal_Type); New_Assign_Stmt diff --git a/src/vhdl/translate/trans-chap9.adb b/src/vhdl/translate/trans-chap9.adb index 90995f21b..a17e7630b 100644 --- a/src/vhdl/translate/trans-chap9.adb +++ b/src/vhdl/translate/trans-chap9.adb @@ -1911,10 +1911,10 @@ package body Trans.Chap9 is (Get_Choice_Expression (Alt), Base_Type), Ghdl_Bool_Type); when Iir_Kind_Choice_By_Range => - Var_Rng := Create_Temp (Tinfo.T.Range_Type); + Var_Rng := Create_Temp (Tinfo.B.Range_Type); Rng := Dv2M (Var_Rng, Tinfo, Mode_Value, - Tinfo.T.Range_Type, - Tinfo.T.Range_Ptr_Type); + Tinfo.B.Range_Type, + Tinfo.B.Range_Ptr_Type); Chap7.Translate_Discrete_Range (Rng, Get_Choice_Range (Alt)); C1 := New_Dyadic_Op @@ -2090,8 +2090,8 @@ package body Trans.Chap9 is Chap3.Elab_Object_Subtype (Iter_Type); Range_Ptr := Create_Temp_Ptr - (Iter_Type_Info.T.Range_Ptr_Type, - Get_Var (Get_Info (Iter_Type).T.Range_Var)); + (Iter_Type_Info.B.Range_Ptr_Type, + Get_Var (Get_Info (Iter_Type).S.Range_Var)); -- Allocate instances. Var_Inst := Create_Temp (Info.Block_Decls_Array_Ptr_Type); @@ -2102,7 +2102,7 @@ package body Trans.Chap9 is New_Dyadic_Op (ON_Mul_Ov, New_Value_Selected_Acc_Value (New_Obj (Range_Ptr), - Iter_Type_Info.T.Range_Length), + Iter_Type_Info.B.Range_Length), New_Lit (Get_Scope_Size (Info.Block_Scope))), Info.Block_Decls_Array_Ptr_Type)); @@ -2121,7 +2121,7 @@ package body Trans.Chap9 is New_Obj_Value (Var_I), New_Value_Selected_Acc_Value (New_Obj (Range_Ptr), - Iter_Type_Info.T.Range_Length), + Iter_Type_Info.B.Range_Length), Ghdl_Bool_Type)); Var := Create_Temp_Ptr @@ -2152,16 +2152,16 @@ package body Trans.Chap9 is New_Compare_Op (ON_Eq, New_Value_Selected_Acc_Value (New_Obj (Range_Ptr), - Iter_Type_Info.T.Range_Dir), + Iter_Type_Info.B.Range_Dir), New_Lit (Ghdl_Dir_To_Node), Ghdl_Bool_Type)); New_Assign_Stmt (New_Obj (Val), New_Value_Selected_Acc_Value (New_Obj (Range_Ptr), - Iter_Type_Info.T.Range_Left)); + Iter_Type_Info.B.Range_Left)); New_Else_Stmt (If_Blk); New_Assign_Stmt (New_Obj (Val), New_Value_Selected_Acc_Value (New_Obj (Range_Ptr), - Iter_Type_Info.T.Range_Right)); + Iter_Type_Info.B.Range_Right)); Finish_If_Stmt (If_Blk); New_Assign_Stmt @@ -2213,8 +2213,8 @@ package body Trans.Chap9 is Var_Len := Create_Temp_Init (Ghdl_Index_Type, New_Value (New_Selected_Element - (Get_Var (Get_Info (Iter_Type).T.Range_Var), - Iter_Type_Info.T.Range_Length))); + (Get_Var (Get_Info (Iter_Type).S.Range_Var), + Iter_Type_Info.B.Range_Length))); -- Start loop. Var_I := Create_Temp (Ghdl_Index_Type); diff --git a/src/vhdl/translate/trans-rtis.adb b/src/vhdl/translate/trans-rtis.adb index 7623b5032..d28f3bb6e 100644 --- a/src/vhdl/translate/trans-rtis.adb +++ b/src/vhdl/translate/trans-rtis.adb @@ -1066,7 +1066,7 @@ package body Trans.Rtis is Val : O_Cnode; begin Generate_Type_Rti (Info, Ghdl_Rtin_Type_Enum); - Info.T.Rti_Max_Depth := 0; + Info.B.Rti_Max_Depth := 0; if Global_Storage = O_Storage_External then return; @@ -1150,7 +1150,7 @@ package body Trans.Rtis is Info := Get_Info (Atype); Generate_Type_Rti (Info, Ghdl_Rtin_Type_Scalar); - Info.T.Rti_Max_Depth := 0; + Info.B.Rti_Max_Depth := 0; if Global_Storage = O_Storage_External then return; @@ -1307,7 +1307,7 @@ package body Trans.Rtis is end if; Generate_Type_Rti (Info, Ghdl_Rtin_Subtype_Scalar); - Info.T.Rti_Max_Depth := Get_Depth_From_Var (Info.T.Range_Var); + Info.B.Rti_Max_Depth := Get_Depth_From_Var (Info.S.Range_Var); if Global_Storage = O_Storage_External then return; end if; @@ -1316,12 +1316,12 @@ package body Trans.Rtis is Start_Record_Aggr (Aggr, Ghdl_Rtin_Subtype_Scalar); New_Record_Aggr_El (Aggr, Generate_Common_Type (Ghdl_Rtik_Subtype_Scalar, - Info.T.Rti_Max_Depth, - Info.T.Rti_Max_Depth)); + Info.B.Rti_Max_Depth, + Info.B.Rti_Max_Depth)); New_Record_Aggr_El (Aggr, New_Name_Address (Name)); New_Record_Aggr_El (Aggr, New_Rti_Address (Base_Info.Type_Rti)); - New_Record_Aggr_El (Aggr, Var_Acc_To_Loc (Info.T.Range_Var)); + New_Record_Aggr_El (Aggr, Var_Acc_To_Loc (Info.S.Range_Var)); Finish_Record_Aggr (Aggr, Val); Finish_Init_Value (Info.Type_Rti, Val); end Generate_Scalar_Subtype_Definition; @@ -1339,7 +1339,7 @@ package body Trans.Rtis is Generate_Type_Rti (Info, Ghdl_Rtin_Type_Fileacc); if Global_Storage = O_Storage_External then - Info.T.Rti_Max_Depth := 0; + Info.B.Rti_Max_Depth := 0; return; end if; @@ -1377,16 +1377,16 @@ package body Trans.Rtis is Error_Kind ("rti.generate_fileacc_type_definition", Atype); end case; if Base_Type = Null_Iir then - Info.T.Rti_Max_Depth := 0; + Info.B.Rti_Max_Depth := 0; else - Info.T.Rti_Max_Depth := Get_Info (Base_Type).T.Rti_Max_Depth; + Info.B.Rti_Max_Depth := Get_Info (Base_Type).B.Rti_Max_Depth; end if; Name := Generate_Type_Name (Atype); Start_Init_Value (Info.Type_Rti); Start_Record_Aggr (List, Ghdl_Rtin_Type_Fileacc); New_Record_Aggr_El - (List, Generate_Common_Type (Kind, 0, Info.T.Rti_Max_Depth)); + (List, Generate_Common_Type (Kind, 0, Info.B.Rti_Max_Depth)); New_Record_Aggr_El (List, New_Name_Address (Name)); New_Record_Aggr_El (List, New_Rti_Address (Base)); Finish_Record_Aggr (List, Val); @@ -1412,7 +1412,7 @@ package body Trans.Rtis is Push_Identifier_Prefix (Mark, "DIM", Iir_Int32 (I)); Tmp := Generate_Type_Definition (Index); Max_Depth := Rti_Depth_Type'Max (Max_Depth, - Get_Info (Index).T.Rti_Max_Depth); + Get_Info (Index).B.Rti_Max_Depth); Pop_Identifier_Prefix (Mark); end loop; @@ -1483,11 +1483,11 @@ package body Trans.Rtis is Pop_Identifier_Prefix (Mark); end; end if; - Max_Depth := El_Info.T.Rti_Max_Depth; + Max_Depth := El_Info.B.Rti_Max_Depth; -- Translate each index. Generate_Array_Type_Indexes (Atype, Arr, Max_Depth); - Info.T.Rti_Max_Depth := Max_Depth; + Info.B.Rti_Max_Depth := Max_Depth; List := Get_Index_Subtype_List (Atype); -- Generate node. @@ -1539,10 +1539,10 @@ package body Trans.Rtis is Pop_Identifier_Prefix (Mark); end if; - Bounds := Info.T.Array_Bounds; + Bounds := Info.S.Array_Bounds; Depth := Get_Depth_From_Var (Bounds); - Info.T.Rti_Max_Depth := - Rti_Depth_Type'Max (Depth, Base_Info.T.Rti_Max_Depth); + Info.B.Rti_Max_Depth := + Rti_Depth_Type'Max (Depth, Base_Info.B.Rti_Max_Depth); -- Generate node. Generate_Type_Rti (Info, Ghdl_Rtin_Subtype_Array); @@ -1566,7 +1566,7 @@ package body Trans.Rtis is New_Record_Aggr_El (Aggr, Generate_Common_Type - (Kind, Depth, Info.T.Rti_Max_Depth, Type_To_Mode (Atype))); + (Kind, Depth, Info.B.Rti_Max_Depth, Type_To_Mode (Atype))); New_Record_Aggr_El (Aggr, New_Name_Address (Name)); New_Record_Aggr_El (Aggr, New_Rti_Address (Base_Info.Type_Rti)); if Bounds = Null_Var then @@ -1639,7 +1639,7 @@ package body Trans.Rtis is Type_Rti := Generate_Type_Definition (El_Type); Max_Depth := Rti_Depth_Type'Max (Max_Depth, - Get_Info (El_Type).T.Rti_Max_Depth); + Get_Info (El_Type).B.Rti_Max_Depth); El_Name := Generate_Name (El); New_Const_Decl (El_Const, Create_Identifier ("RTIEL"), @@ -1670,7 +1670,7 @@ package body Trans.Rtis is El_Arr := Generate_Rti_Array (Create_Identifier ("RTIARRAY")); Pop_Rti_Node (Prev); - Info.T.Rti_Max_Depth := Max_Depth; + Info.B.Rti_Max_Depth := Max_Depth; -- Generate record. declare Aggr : O_Record_Aggr_List; diff --git a/src/vhdl/translate/trans.adb b/src/vhdl/translate/trans.adb index d6fdbe9d4..ebedf7492 100644 --- a/src/vhdl/translate/trans.adb +++ b/src/vhdl/translate/trans.adb @@ -1415,7 +1415,8 @@ package body Trans is Free_Type_Info (Info); when Iir_Kind_Array_Subtype_Definition => if Get_Index_Constraint_Flag (I) then - Info.T := Ortho_Info_Type_Array_Init; + Info.B := Ortho_Info_Basetype_Array_Init; + Info.S := Ortho_Info_Subtype_Array_Init; Free_Type_Info (Info); end if; when Iir_Kind_Function_Declaration => diff --git a/src/vhdl/translate/trans.ads b/src/vhdl/translate/trans.ads index 3a3d0b960..86f246460 100644 --- a/src/vhdl/translate/trans.ads +++ b/src/vhdl/translate/trans.ads @@ -700,8 +700,8 @@ package Trans is type Rti_Depth_Type is new Natural range 0 .. 255; - type Ortho_Info_Type_Type (Kind : Ortho_Info_Type_Kind := Kind_Type_Scalar) - is record + type Ortho_Info_Basetype_Type + (Kind : Ortho_Info_Type_Kind := Kind_Type_Scalar) is record -- For all types: -- This is the maximum depth of RTI, that is the max of the depth of -- the type itself and every types it depends on. @@ -710,19 +710,12 @@ package Trans is case Kind is when Kind_Type_Scalar => -- For scalar types: - -- True if no need to check against low/high bound. - Nocheck_Low : Boolean := False; - Nocheck_Hi : Boolean := False; - -- Ortho type for the range record type. Range_Type : O_Tnode; -- Ortho type for an access to the range record type. Range_Ptr_Type : O_Tnode; - -- Tree for the range record declaration. - Range_Var : Var_Type; - -- Fields of TYPE_RANGE_TYPE. Range_Left : O_Fnode; Range_Right : O_Fnode; @@ -738,12 +731,6 @@ package Trans is Base_Field : O_Fnode_Array; Bounds_Field : O_Fnode_Array; - -- True if the array bounds are static. - Static_Bounds : Boolean; - - -- Variable containing the bounds for a constrained array. - Array_Bounds : Var_Type; - -- Variable containing the description for each index. Array_Index_Desc : Var_Type; @@ -771,6 +758,36 @@ package Trans is end case; end record; + type Ortho_Info_Subtype_Type + (Kind : Ortho_Info_Type_Kind := Kind_Type_Scalar) is record + case Kind is + when Kind_Type_Scalar => + -- For scalar types: + -- True if no need to check against low/high bound. + Nocheck_Low : Boolean := False; + Nocheck_Hi : Boolean := False; + + -- Tree for the range record declaration. + Range_Var : Var_Type; + + when Kind_Type_Array => + -- True if the array bounds are static. + Static_Bounds : Boolean; + + -- Variable containing the bounds for a constrained array. + Array_Bounds : Var_Type; + + when Kind_Type_Record => + null; + + when Kind_Type_File => + null; + + when Kind_Type_Protected => + null; + end case; + end record; + -- Ortho_Info_Type_Scalar_Init : constant Ortho_Info_Type_Type := -- (Kind => Kind_Type_Scalar, -- Range_Type => O_Tnode_Null, @@ -781,7 +798,7 @@ package Trans is -- Range_Dir => O_Fnode_Null, -- Range_Length => O_Fnode_Null); - Ortho_Info_Type_Array_Init : constant Ortho_Info_Type_Type := + Ortho_Info_Basetype_Array_Init : constant Ortho_Info_Basetype_Type := (Kind => Kind_Type_Array, Rti_Max_Depth => 0, Base_Type => (O_Tnode_Null, O_Tnode_Null), @@ -790,21 +807,24 @@ package Trans is Bounds_Ptr_Type => O_Tnode_Null, Base_Field => (O_Fnode_Null, O_Fnode_Null), Bounds_Field => (O_Fnode_Null, O_Fnode_Null), - Static_Bounds => False, - Array_Bounds => Null_Var, Array_Index_Desc => Null_Var); - Ortho_Info_Type_Record_Init : constant Ortho_Info_Type_Type := + Ortho_Info_Subtype_Array_Init : constant Ortho_Info_Subtype_Type := + (Kind => Kind_Type_Array, + Static_Bounds => False, + Array_Bounds => Null_Var); + + Ortho_Info_Basetype_Record_Init : constant Ortho_Info_Basetype_Type := (Kind => Kind_Type_Record, Rti_Max_Depth => 0, Record_El_Desc => Null_Var); - Ortho_Info_Type_File_Init : constant Ortho_Info_Type_Type := + Ortho_Info_Basetype_File_Init : constant Ortho_Info_Basetype_Type := (Kind => Kind_Type_File, Rti_Max_Depth => 0, File_Signature => O_Dnode_Null); - Ortho_Info_Type_Prot_Init : constant Ortho_Info_Type_Type := + Ortho_Info_Basetype_Prot_Init : constant Ortho_Info_Basetype_Type := (Kind => Kind_Type_Protected, Rti_Max_Depth => 0, Prot_Scope => Null_Var_Scope, @@ -1150,7 +1170,8 @@ package Trans is Ortho_Ptr_Type : O_Tnode_Array; -- More info according to the type. - T : Ortho_Info_Type_Type; + B : Ortho_Info_Basetype_Type; + S : Ortho_Info_Subtype_Type; -- Run-time information. Type_Rti : O_Dnode := O_Dnode_Null; diff --git a/src/vhdl/translate/translation.adb b/src/vhdl/translate/translation.adb index bc69661bb..4f87db2f8 100644 --- a/src/vhdl/translate/translation.adb +++ b/src/vhdl/translate/translation.adb @@ -1811,7 +1811,7 @@ package body Translation is Ghdl_Real_Type, Std_String_Ptr_Node, Get_Identifier ("format")); declare Bv_Base_Ptr : constant O_Tnode := - Get_Info (Bit_Vector_Type_Definition).T.Base_Ptr_Type (Mode_Value); + Get_Info (Bit_Vector_Type_Definition).B.Base_Ptr_Type (Mode_Value); begin Create_To_String_Subprogram ("__ghdl_bv_to_ostring", Ghdl_BV_To_Ostring, -- cgit v1.2.3