summaryrefslogtreecommitdiff
path: root/src/vhdl/translate/trans-chap4.adb
diff options
context:
space:
mode:
authorTristan Gingold2014-12-15 06:42:10 +0100
committerTristan Gingold2014-12-15 06:42:10 +0100
commit6d2b8c7bfcbd534406243093d1ec5e77ac4c8484 (patch)
tree082afe2c691eae5108d9781035bad22804b42585 /src/vhdl/translate/trans-chap4.adb
parentcce31df3a7327c5e35fbfa818d87580219e73128 (diff)
downloadghdl-6d2b8c7bfcbd534406243093d1ec5e77ac4c8484.tar.gz
ghdl-6d2b8c7bfcbd534406243093d1ec5e77ac4c8484.tar.bz2
ghdl-6d2b8c7bfcbd534406243093d1ec5e77ac4c8484.zip
Use same node for implicit and explicit subprogram declarations.
Diffstat (limited to 'src/vhdl/translate/trans-chap4.adb')
-rw-r--r--src/vhdl/translate/trans-chap4.adb63
1 files changed, 30 insertions, 33 deletions
diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb
index 3083e42..b6f1c66 100644
--- a/src/vhdl/translate/trans-chap4.adb
+++ b/src/vhdl/translate/trans-chap4.adb
@@ -2041,9 +2041,10 @@ package body Trans.Chap4 is
while El /= Null_Iir loop
case Get_Kind (El) is
when Iir_Kind_Procedure_Declaration
- | Iir_Kind_Function_Declaration =>
+ | Iir_Kind_Function_Declaration =>
-- Translate interfaces.
- if (not Flag_Discard_Unused or else Get_Use_Flag (El))
+ if not Is_Implicit_Subprogram (El)
+ and then (not Flag_Discard_Unused or else Get_Use_Flag (El))
and then not Is_Second_Subprogram_Specification (El)
then
Info := Add_Info (El, Kind_Subprg);
@@ -2057,9 +2058,6 @@ package body Trans.Chap4 is
when Iir_Kind_Function_Body
| Iir_Kind_Procedure_Body =>
null;
- when Iir_Kind_Implicit_Function_Declaration
- | Iir_Kind_Implicit_Procedure_Declaration =>
- null;
when others =>
Translate_Declaration (El);
end case;
@@ -2076,11 +2074,30 @@ package body Trans.Chap4 is
while El /= Null_Iir loop
case Get_Kind (El) is
when Iir_Kind_Procedure_Declaration
- | Iir_Kind_Function_Declaration =>
- -- Translate only if used.
- if Get_Info (El) /= null then
- Chap2.Translate_Subprogram_Declaration (El);
- Translate_Resolution_Function (El);
+ | Iir_Kind_Function_Declaration =>
+ if Is_Implicit_Subprogram (El) then
+ if Flag_Discard_Unused_Implicit
+ and then not Get_Use_Flag (El)
+ then
+ case Get_Implicit_Definition (El) is
+ when Iir_Predefined_Array_Equality
+ | Iir_Predefined_Array_Greater
+ | Iir_Predefined_Record_Equality =>
+ -- Used implicitly in case statement or other
+ -- predefined equality.
+ Chap7.Translate_Implicit_Subprogram (El, Infos);
+ when others =>
+ null;
+ end case;
+ else
+ Chap7.Translate_Implicit_Subprogram (El, Infos);
+ end if;
+ else
+ -- Translate only if used.
+ if Get_Info (El) /= null then
+ Chap2.Translate_Subprogram_Declaration (El);
+ Translate_Resolution_Function (El);
+ end if;
end if;
when Iir_Kind_Function_Body
| Iir_Kind_Procedure_Body =>
@@ -2103,24 +2120,6 @@ package body Trans.Chap4 is
when Iir_Kind_Protected_Type_Body =>
Chap3.Translate_Protected_Type_Body (El);
Chap3.Translate_Protected_Type_Body_Subprograms (El);
- when Iir_Kind_Implicit_Function_Declaration
- | Iir_Kind_Implicit_Procedure_Declaration =>
- if Flag_Discard_Unused_Implicit
- and then not Get_Use_Flag (El)
- then
- case Get_Implicit_Definition (El) is
- when Iir_Predefined_Array_Equality
- | Iir_Predefined_Array_Greater
- | Iir_Predefined_Record_Equality =>
- -- Used implicitly in case statement or other
- -- predefined equality.
- Chap7.Translate_Implicit_Subprogram (El, Infos);
- when others =>
- null;
- end case;
- else
- Chap7.Translate_Implicit_Subprogram (El, Infos);
- end if;
when others =>
null;
end case;
@@ -2186,17 +2185,15 @@ package body Trans.Chap4 is
when Iir_Kind_Function_Declaration
| Iir_Kind_Procedure_Declaration =>
- if Get_Info (Decl) /= null then
+ if not Is_Implicit_Subprogram (Decl)
+ and then Get_Info (Decl) /= null
+ then
Chap2.Elab_Subprogram_Interfaces (Decl);
end if;
when Iir_Kind_Function_Body
| Iir_Kind_Procedure_Body =>
null;
- when Iir_Kind_Implicit_Function_Declaration
- | Iir_Kind_Implicit_Procedure_Declaration =>
- null;
-
when Iir_Kind_Stable_Attribute
| Iir_Kind_Quiet_Attribute
| Iir_Kind_Transaction_Attribute =>