diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vhdl/translate/trans-chap2.adb | 2 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap3.adb | 28 | ||||
-rw-r--r-- | src/vhdl/translate/trans.adb | 4 | ||||
-rw-r--r-- | src/vhdl/translate/trans.ads | 10 |
4 files changed, 24 insertions, 20 deletions
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb index c4845a0..1524a08 100644 --- a/src/vhdl/translate/trans-chap2.adb +++ b/src/vhdl/translate/trans-chap2.adb @@ -1255,7 +1255,7 @@ package body Trans.Chap2 is procedure Declare_Inst_Type_And_Ptr (Scope : Var_Scope_Acc; Ptr_Type : out O_Tnode) is begin - Predeclare_Scope_Type (Scope, Create_Identifier ("INSTTYPE")); + Predeclare_Scope_Type (Scope.all, Create_Identifier ("INSTTYPE")); Declare_Scope_Acc (Scope.all, Create_Identifier ("INSTPTR"), Ptr_Type); end Declare_Inst_Type_And_Ptr; diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb index 4ea3312..3a95517 100644 --- a/src/vhdl/translate/trans-chap3.adb +++ b/src/vhdl/translate/trans-chap3.adb @@ -1336,14 +1336,17 @@ package body Trans.Chap3 is Info : constant Type_Info_Acc := Get_Info (Def); Mark : Id_Mark_Type; begin - New_Uncomplete_Record_Type (Info.Ortho_Type (Mode_Value)); - New_Type_Decl (Create_Identifier, Info.Ortho_Type (Mode_Value)); + -- 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); + Info.Ortho_Type (Mode_Value) := O_Tnode_Null; - Info.Ortho_Ptr_Type (Mode_Value) := - New_Access_Type (Info.Ortho_Type (Mode_Value)); - New_Type_Decl (Create_Identifier ("PTR"), - Info.Ortho_Ptr_Type (Mode_Value)); + -- Create a pointer type to that record. + Declare_Scope_Acc (Info.T.Prot_Scope, + Create_Identifier ("PTR"), + Info.Ortho_Ptr_Type (Mode_Value)); + -- A protected type cannot be used for signals. Info.Ortho_Type (Mode_Signal) := O_Tnode_Null; Info.Ortho_Ptr_Type (Mode_Signal) := O_Tnode_Null; @@ -1437,7 +1440,7 @@ package body Trans.Chap3 is 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); + -- Info.Ortho_Type (Mode_Value) := Get_Scope_Type (Info.T.Prot_Scope); Pop_Identifier_Prefix (Mark); end Translate_Protected_Type_Body; @@ -1500,10 +1503,11 @@ package body Trans.Chap3 is -- Allocate the object New_Assign_Stmt (New_Obj (Var_Obj), - Gen_Alloc (Alloc_System, - New_Lit (New_Sizeof (Info.Ortho_Type (Mode_Value), - Ghdl_Index_Type)), - Info.Ortho_Ptr_Type (Mode_Value))); + Gen_Alloc + (Alloc_System, + New_Lit (New_Sizeof (Get_Scope_Type (Info.T.Prot_Scope), + Ghdl_Index_Type)), + Info.Ortho_Ptr_Type (Mode_Value))); Subprgs.Set_Subprg_Instance_Field (Var_Obj, Info.T.Prot_Subprg_Instance_Field, @@ -2118,8 +2122,8 @@ package body Trans.Chap3 is end if; when Iir_Kind_Protected_Type_Declaration => - Translate_Protected_Type (Def); Info.T := Ortho_Info_Type_Prot_Init; + Translate_Protected_Type (Def); when others => Error_Kind ("translate_type_definition", Def); diff --git a/src/vhdl/translate/trans.adb b/src/vhdl/translate/trans.adb index a2f0a89..4c91300 100644 --- a/src/vhdl/translate/trans.adb +++ b/src/vhdl/translate/trans.adb @@ -223,8 +223,8 @@ package body Trans is return Scope.Scope_Type /= O_Tnode_Null; end Has_Scope_Type; - procedure Predeclare_Scope_Type (Scope : Var_Scope_Acc; Name : O_Ident) - is + procedure Predeclare_Scope_Type + (Scope : in out Var_Scope_Type; Name : O_Ident) is begin pragma Assert (Scope.Scope_Type = O_Tnode_Null); New_Uncomplete_Record_Type (Scope.Scope_Type); diff --git a/src/vhdl/translate/trans.ads b/src/vhdl/translate/trans.ads index 656bf9a..79f02c1 100644 --- a/src/vhdl/translate/trans.ads +++ b/src/vhdl/translate/trans.ads @@ -225,7 +225,8 @@ package Trans is function Has_Scope_Type (Scope : Var_Scope_Type) return Boolean; -- Create an empty and incomplete scope type for SCOPE using NAME. - procedure Predeclare_Scope_Type (Scope : Var_Scope_Acc; Name : O_Ident); + procedure Predeclare_Scope_Type + (Scope : in out Var_Scope_Type; Name : O_Ident); -- Declare a pointer PTR_TYPE with NAME to scope type SCOPE. procedure Declare_Scope_Acc @@ -522,15 +523,14 @@ package Trans is type Subprg_Instance_Stack is limited private; -- Declare an instance to be added for subprograms. - -- DECL is the node for which the instance is created. This is used by - -- PUSH_SCOPE. - -- PTR_TYPE is a pointer to DECL_TYPE. + -- SCOPE is the scope to pass to the subprogram. + -- PTR_TYPE is a pointer to SCOPE. -- IDENT is an identifier for the interface. -- The previous instance is stored to PREV. It must be restored with -- Pop_Subprg_Instance. -- Add_Subprg_Instance_Interfaces will add an interface of name IDENT -- and type PTR_TYPE for every instance declared by - -- PUSH_SUBPRG_INSTANCE. + -- Push_Subprg_Instance. procedure Push_Subprg_Instance (Scope : Var_Scope_Acc; Ptr_Type : O_Tnode; Ident : O_Ident; |