aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/translate/trans.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-01-11 06:49:03 +0100
committerTristan Gingold <tgingold@free.fr>2018-01-11 12:51:48 +0100
commit1f5df6e6262b6f01ca51b9bd1fefe9d8e2ba7308 (patch)
tree27424c20ba3a380e72b263339f1029fb4fc45934 /src/vhdl/translate/trans.adb
parentec3ef23d5ec3529406d8102f0e2792e957c4ba67 (diff)
downloadghdl-1f5df6e6262b6f01ca51b9bd1fefe9d8e2ba7308.tar.gz
ghdl-1f5df6e6262b6f01ca51b9bd1fefe9d8e2ba7308.tar.bz2
ghdl-1f5df6e6262b6f01ca51b9bd1fefe9d8e2ba7308.zip
translate: fix bug wrt complex variable while unnesting subprograms.
Diffstat (limited to 'src/vhdl/translate/trans.adb')
-rw-r--r--src/vhdl/translate/trans.adb27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/vhdl/translate/trans.adb b/src/vhdl/translate/trans.adb
index e776aae22..b298ad583 100644
--- a/src/vhdl/translate/trans.adb
+++ b/src/vhdl/translate/trans.adb
@@ -244,6 +244,9 @@ package body Trans is
-- Common routine for instance and frame.
procedure Start_Instance_Factory (Inst : Inst_Build_Acc) is
begin
+ Inst.Prev := Inst_Build;
+ Inst.Prev_Id_Start := Identifier_Start;
+
Identifier_Start := Identifier_Len + 1;
if Inst.Scope.Scope_Type /= O_Tnode_Null then
@@ -260,20 +263,21 @@ package body Trans is
Inst : Inst_Build_Acc;
begin
Inst := new Inst_Build_Type (Instance);
- Inst.Prev := Inst_Build;
- Inst.Prev_Id_Start := Identifier_Start;
Inst.Scope := Scope;
Start_Instance_Factory (Inst);
end Push_Instance_Factory;
- procedure Push_Frame_Factory (Scope : Var_Scope_Acc)
+ procedure Push_Frame_Factory (Scope : Var_Scope_Acc;
+ Persistant : Boolean)
is
Inst : Inst_Build_Acc;
begin
- Inst := new Inst_Build_Type (Frame);
- Inst.Prev := Inst_Build;
- Inst.Prev_Id_Start := Identifier_Start;
+ if Persistant then
+ Inst := new Inst_Build_Type (Persistant_Frame);
+ else
+ Inst := new Inst_Build_Type (Stack_Frame);
+ end if;
Inst.Scope := Scope;
Start_Instance_Factory (Inst);
@@ -324,7 +328,7 @@ package body Trans is
procedure Pop_Frame_Factory (Scope : in Var_Scope_Acc) is
begin
-- Not matching.
- pragma Assert (Inst_Build.Kind = Frame);
+ pragma Assert (Inst_Build.Kind in Stack_Frame .. Persistant_Frame);
Finish_Instance_Factory (Scope);
end Pop_Frame_Factory;
@@ -367,7 +371,8 @@ package body Trans is
case Inst_Build.Kind is
when Local
| Instance
- | Frame =>
+ | Stack_Frame
+ | Persistant_Frame =>
return True;
when Global =>
return False;
@@ -528,7 +533,7 @@ package body Trans is
-- Create a var.
New_Var_Decl (Res, Name.Id, O_Storage_Local, Vtype);
return Var_Type'(Kind => Var_Local, E => Res);
- when Instance | Frame =>
+ when Instance | Stack_Frame | Persistant_Frame =>
-- Create a field.
New_Record_Field (Inst_Build.Elements, Field, Name.Id, Vtype);
return Var_Type'(Kind => Var_Scope, I_Build_Kind => K,
@@ -628,7 +633,9 @@ package body Trans is
return Alloc_System;
when Var_Scope =>
case Var.I_Build_Kind is
- when Frame =>
+ when Stack_Frame =>
+ return Alloc_Stack;
+ when Persistant_Frame =>
return Alloc_Return;
when Instance =>
return Alloc_System;