aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-05-17 05:35:18 +0200
committerTristan Gingold <tgingold@free.fr>2017-05-18 07:59:35 +0200
commit2e3634206b04775398f712a4da735d70a32020f2 (patch)
treef7a5f4902bc5abe5e3eaed4db51abcf86ee7230e /src
parent6230ad4e5e9329e57d44066aba8c8d7711042fa3 (diff)
downloadghdl-2e3634206b04775398f712a4da735d70a32020f2.tar.gz
ghdl-2e3634206b04775398f712a4da735d70a32020f2.tar.bz2
ghdl-2e3634206b04775398f712a4da735d70a32020f2.zip
trans-chap2: minor refactoring to clarify code.
Minor reformating.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/iirs.ads2
-rw-r--r--src/vhdl/sem.adb9
-rw-r--r--src/vhdl/translate/trans-chap2.adb15
3 files changed, 10 insertions, 16 deletions
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index 03109edb1..e06a192a8 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -897,7 +897,7 @@ package Iirs is
-- type.
-- Get/Set_Macro_Expanded_Flag (Flag2)
--
- -- True if the package declaration at least one package instantiation
+ -- True if the package declaration has least one package instantiation
-- declaration whose uninstantiated declaration needs both a body and
-- macro-expansion. In that case, the instantiation needs macro-expansion
-- of their body.
diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb
index 5ee8e8da1..82738da07 100644
--- a/src/vhdl/sem.adb
+++ b/src/vhdl/sem.adb
@@ -2506,7 +2506,7 @@ package body Sem is
-- Return true if package declaration DECL needs a body.
-- Ie, it contains subprogram specification or deferred constants.
function Package_Need_Body_P (Decl: Iir_Package_Declaration)
- return Boolean
+ return Boolean
is
El: Iir;
Def : Iir;
@@ -2641,11 +2641,10 @@ package body Sem is
-- LRM 2.5 Package Declarations.
procedure Sem_Package_Declaration (Decl: Iir_Package_Declaration)
is
- Unit : Iir_Design_Unit;
- Implicit : Implicit_Signal_Declaration_Type;
+ Unit : constant Iir_Design_Unit := Get_Design_Unit (Decl);
Header : constant Iir := Get_Package_Header (Decl);
+ Implicit : Implicit_Signal_Declaration_Type;
begin
- Unit := Get_Design_Unit (Decl);
Sem_Scopes.Add_Name (Decl);
Set_Visible_Flag (Decl, True);
Xref_Decl (Decl);
@@ -2715,7 +2714,9 @@ package body Sem is
Pop_Signals_Declarative_Part (Implicit);
Close_Declarative_Region;
+
Set_Need_Body (Decl, Package_Need_Body_P (Decl));
+
if Vhdl_Std >= Vhdl_08 then
Set_Need_Instance_Bodies
(Decl, Package_Need_Instance_Bodies_P (Decl));
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb
index fef4957ac..958158fd4 100644
--- a/src/vhdl/translate/trans-chap2.adb
+++ b/src/vhdl/translate/trans-chap2.adb
@@ -1250,6 +1250,9 @@ package body Trans.Chap2 is
Subprg_Local_Id => Src.Subprg_Local_Id,
Subprg_Exit => Src.Subprg_Exit,
Subprg_Result => Src.Subprg_Result);
+ Push_Instantiate_Var_Scope
+ (Dest.Subprg_Frame_Scope'Access,
+ Src.Subprg_Frame_Scope'Access);
when Kind_Operator =>
Dest.all :=
(Kind => Kind_Operator,
@@ -1333,17 +1336,6 @@ package body Trans.Chap2 is
Info := Add_Info (N, Orig_Info.Kind);
Copy_Info (Info, Orig_Info);
-
- case Info.Kind is
- when Kind_Subprg =>
- Push_Instantiate_Var_Scope
- (Info.Subprg_Frame_Scope'Access,
- Orig_Info.Subprg_Frame_Scope'Access);
- when Kind_Type =>
- null;
- when others =>
- null;
- end case;
end if;
for I in Fields'Range loop
@@ -1419,6 +1411,7 @@ package body Trans.Chap2 is
end loop;
if Info /= null then
+ -- Pop scope instantiations created in copy_info.
case Info.Kind is
when Kind_Subprg =>
Pop_Instantiate_Var_Scope