aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vhdl/iirs.ads22
-rw-r--r--src/vhdl/iirs_utils.adb12
-rw-r--r--src/vhdl/iirs_utils.ads10
-rw-r--r--src/vhdl/nodes_meta.adb296
-rw-r--r--src/vhdl/sem.adb61
-rw-r--r--src/vhdl/sem.ads1
-rw-r--r--src/vhdl/sem_decls.adb7
-rw-r--r--src/vhdl/sem_expr.adb4
-rw-r--r--src/vhdl/sem_names.adb22
-rw-r--r--src/vhdl/sem_scopes.adb1
10 files changed, 250 insertions, 186 deletions
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index c93fad0c7..75d569377 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -1464,6 +1464,8 @@ package Iirs is
--
-- Only for Iir_Kind_Interface_Function_Declaration:
-- Get/Set_Has_Pure (Flag8)
+ --
+ -- Get/Set_All_Sensitized_State (State3)
-- Iir_Kind_Signal_Declaration (Short)
--
@@ -3930,10 +3932,10 @@ package Iirs is
Iir_Kind_Interface_Variable_Declaration, -- object, interface
Iir_Kind_Interface_Signal_Declaration, -- object, interface
Iir_Kind_Interface_File_Declaration, -- object, interface
- Iir_Kind_Interface_Type_Declaration,
- Iir_Kind_Interface_Package_Declaration,
- Iir_Kind_Interface_Function_Declaration,
- Iir_Kind_Interface_Procedure_Declaration,
+ Iir_Kind_Interface_Type_Declaration, -- interface
+ Iir_Kind_Interface_Package_Declaration, -- interface
+ Iir_Kind_Interface_Function_Declaration, -- interface
+ Iir_Kind_Interface_Procedure_Declaration, -- interface
-- Expressions.
Iir_Kind_Identity_Operator,
@@ -4774,6 +4776,10 @@ package Iirs is
Iir_Kind_Function_Declaration ..
Iir_Kind_Procedure_Declaration;
+ subtype Iir_Kinds_Subprogram_Body is Iir_Kind range
+ Iir_Kind_Function_Body ..
+ Iir_Kind_Procedure_Body;
+
subtype Iir_Kinds_Process_Statement is Iir_Kind range
Iir_Kind_Sensitized_Process_Statement ..
Iir_Kind_Process_Statement;
@@ -4790,7 +4796,9 @@ package Iirs is
--Iir_Kind_Interface_Signal_Declaration
--Iir_Kind_Interface_File_Declaration
--Iir_Kind_Interface_Type_Declaration
- Iir_Kind_Interface_Package_Declaration;
+ --Iir_Kind_Interface_Package_Declaration
+ --Iir_Kind_Interface_Function_Declaration
+ Iir_Kind_Interface_Procedure_Declaration;
subtype Iir_Kinds_Object_Declaration is Iir_Kind range
Iir_Kind_Object_Alias_Declaration ..
@@ -4805,6 +4813,10 @@ package Iirs is
--Iir_Kind_Interface_Signal_Declaration
Iir_Kind_Interface_File_Declaration;
+ subtype Iir_Kinds_Interface_Subprogram_Declaration is Iir_Kind range
+ Iir_Kind_Interface_Function_Declaration ..
+ Iir_Kind_Interface_Procedure_Declaration;
+
subtype Iir_Kinds_Branch_Quantity_Declaration is Iir_Kind range
Iir_Kind_Across_Quantity_Declaration ..
Iir_Kind_Through_Quantity_Declaration;
diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb
index 7a8dd84bf..8cac2f33a 100644
--- a/src/vhdl/iirs_utils.adb
+++ b/src/vhdl/iirs_utils.adb
@@ -908,6 +908,18 @@ package body Iirs_Utils is
and then Get_Implicit_Definition (Spec) in Iir_Predefined_Implicit;
end Is_Implicit_Subprogram;
+ function Is_Function_Declaration (N : Iir) return Boolean is
+ begin
+ return Kind_In (N, Iir_Kind_Function_Declaration,
+ Iir_Kind_Interface_Function_Declaration);
+ end Is_Function_Declaration;
+
+ function Is_Procedure_Declaration (N : Iir) return Boolean is
+ begin
+ return Kind_In (N, Iir_Kind_Procedure_Declaration,
+ Iir_Kind_Interface_Procedure_Declaration);
+ end Is_Procedure_Declaration;
+
function Is_Same_Profile (L, R: Iir) return Boolean
is
L1, R1 : Iir;
diff --git a/src/vhdl/iirs_utils.ads b/src/vhdl/iirs_utils.ads
index de420b5cb..d5ea438c0 100644
--- a/src/vhdl/iirs_utils.ads
+++ b/src/vhdl/iirs_utils.ads
@@ -148,6 +148,16 @@ package Iirs_Utils is
function Is_Implicit_Subprogram (Spec : Iir) return Boolean;
pragma Inline (Is_Implicit_Subprogram);
+ -- Return True if N is a function_declaration or an
+ -- interface_function_declaration.
+ function Is_Function_Declaration (N : Iir) return Boolean;
+ pragma Inline (Is_Function_Declaration);
+
+ -- Return True if N is a procedure_declaration or an
+ -- interface_procedure_declaration.
+ function Is_Procedure_Declaration (N : Iir) return Boolean;
+ pragma Inline (Is_Procedure_Declaration);
+
-- If NAME is a simple or an expanded name, return the denoted declaration.
-- Otherwise, return NAME.
function Strip_Denoting_Name (Name : Iir) return Iir;
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index 7bfbc7364..71cb3a684 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -3166,6 +3166,7 @@ package body Nodes_Meta is
Field_Use_Flag,
Field_Resolution_Function_Flag,
Field_Has_Pure,
+ Field_All_Sensitized_State,
Field_Chain,
Field_Interface_Declaration_Chain,
Field_Return_Type_Mark,
@@ -3179,6 +3180,7 @@ package body Nodes_Meta is
Field_Foreign_Flag,
Field_Visible_Flag,
Field_Use_Flag,
+ Field_All_Sensitized_State,
Field_Chain,
Field_Interface_Declaration_Chain,
Field_Return_Type_Mark,
@@ -4316,151 +4318,151 @@ package body Nodes_Meta is
Iir_Kind_Interface_File_Declaration => 897,
Iir_Kind_Interface_Type_Declaration => 907,
Iir_Kind_Interface_Package_Declaration => 917,
- Iir_Kind_Interface_Function_Declaration => 932,
- Iir_Kind_Interface_Procedure_Declaration => 943,
- Iir_Kind_Identity_Operator => 947,
- Iir_Kind_Negation_Operator => 951,
- Iir_Kind_Absolute_Operator => 955,
- Iir_Kind_Not_Operator => 959,
- Iir_Kind_Condition_Operator => 963,
- Iir_Kind_Reduction_And_Operator => 967,
- Iir_Kind_Reduction_Or_Operator => 971,
- Iir_Kind_Reduction_Nand_Operator => 975,
- Iir_Kind_Reduction_Nor_Operator => 979,
- Iir_Kind_Reduction_Xor_Operator => 983,
- Iir_Kind_Reduction_Xnor_Operator => 987,
- Iir_Kind_And_Operator => 992,
- Iir_Kind_Or_Operator => 997,
- Iir_Kind_Nand_Operator => 1002,
- Iir_Kind_Nor_Operator => 1007,
- Iir_Kind_Xor_Operator => 1012,
- Iir_Kind_Xnor_Operator => 1017,
- Iir_Kind_Equality_Operator => 1022,
- Iir_Kind_Inequality_Operator => 1027,
- Iir_Kind_Less_Than_Operator => 1032,
- Iir_Kind_Less_Than_Or_Equal_Operator => 1037,
- Iir_Kind_Greater_Than_Operator => 1042,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 1047,
- Iir_Kind_Match_Equality_Operator => 1052,
- Iir_Kind_Match_Inequality_Operator => 1057,
- Iir_Kind_Match_Less_Than_Operator => 1062,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1067,
- Iir_Kind_Match_Greater_Than_Operator => 1072,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1077,
- Iir_Kind_Sll_Operator => 1082,
- Iir_Kind_Sla_Operator => 1087,
- Iir_Kind_Srl_Operator => 1092,
- Iir_Kind_Sra_Operator => 1097,
- Iir_Kind_Rol_Operator => 1102,
- Iir_Kind_Ror_Operator => 1107,
- Iir_Kind_Addition_Operator => 1112,
- Iir_Kind_Substraction_Operator => 1117,
- Iir_Kind_Concatenation_Operator => 1122,
- Iir_Kind_Multiplication_Operator => 1127,
- Iir_Kind_Division_Operator => 1132,
- Iir_Kind_Modulus_Operator => 1137,
- Iir_Kind_Remainder_Operator => 1142,
- Iir_Kind_Exponentiation_Operator => 1147,
- Iir_Kind_Function_Call => 1155,
- Iir_Kind_Aggregate => 1161,
- Iir_Kind_Parenthesis_Expression => 1164,
- Iir_Kind_Qualified_Expression => 1168,
- Iir_Kind_Type_Conversion => 1173,
- Iir_Kind_Allocator_By_Expression => 1177,
- Iir_Kind_Allocator_By_Subtype => 1183,
- Iir_Kind_Selected_Element => 1189,
- Iir_Kind_Dereference => 1194,
- Iir_Kind_Implicit_Dereference => 1199,
- Iir_Kind_Slice_Name => 1206,
- Iir_Kind_Indexed_Name => 1212,
- Iir_Kind_Psl_Expression => 1214,
- Iir_Kind_Sensitized_Process_Statement => 1234,
- Iir_Kind_Process_Statement => 1254,
- Iir_Kind_Concurrent_Simple_Signal_Assignment => 1265,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1276,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1288,
- Iir_Kind_Concurrent_Assertion_Statement => 1296,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1303,
- Iir_Kind_Psl_Assert_Statement => 1316,
- Iir_Kind_Psl_Cover_Statement => 1329,
- Iir_Kind_Block_Statement => 1342,
- Iir_Kind_If_Generate_Statement => 1352,
- Iir_Kind_Case_Generate_Statement => 1361,
- Iir_Kind_For_Generate_Statement => 1370,
- Iir_Kind_Component_Instantiation_Statement => 1380,
- Iir_Kind_Psl_Default_Clock => 1384,
- Iir_Kind_Simple_Simultaneous_Statement => 1391,
- Iir_Kind_Generate_Statement_Body => 1402,
- Iir_Kind_If_Generate_Else_Clause => 1407,
- Iir_Kind_Simple_Signal_Assignment_Statement => 1416,
- Iir_Kind_Conditional_Signal_Assignment_Statement => 1425,
- Iir_Kind_Null_Statement => 1429,
- Iir_Kind_Assertion_Statement => 1436,
- Iir_Kind_Report_Statement => 1442,
- Iir_Kind_Wait_Statement => 1449,
- Iir_Kind_Variable_Assignment_Statement => 1455,
- Iir_Kind_Conditional_Variable_Assignment_Statement => 1461,
- Iir_Kind_Return_Statement => 1467,
- Iir_Kind_For_Loop_Statement => 1476,
- Iir_Kind_While_Loop_Statement => 1484,
- Iir_Kind_Next_Statement => 1490,
- Iir_Kind_Exit_Statement => 1496,
- Iir_Kind_Case_Statement => 1504,
- Iir_Kind_Procedure_Call_Statement => 1510,
- Iir_Kind_If_Statement => 1519,
- Iir_Kind_Elsif => 1524,
- Iir_Kind_Character_Literal => 1531,
- Iir_Kind_Simple_Name => 1538,
- Iir_Kind_Selected_Name => 1546,
- Iir_Kind_Operator_Symbol => 1551,
- Iir_Kind_Selected_By_All_Name => 1556,
- Iir_Kind_Parenthesis_Name => 1560,
- Iir_Kind_External_Constant_Name => 1569,
- Iir_Kind_External_Signal_Name => 1578,
- Iir_Kind_External_Variable_Name => 1587,
- Iir_Kind_Package_Pathname => 1590,
- Iir_Kind_Absolute_Pathname => 1591,
- Iir_Kind_Relative_Pathname => 1592,
- Iir_Kind_Pathname_Element => 1596,
- Iir_Kind_Base_Attribute => 1598,
- Iir_Kind_Left_Type_Attribute => 1603,
- Iir_Kind_Right_Type_Attribute => 1608,
- Iir_Kind_High_Type_Attribute => 1613,
- Iir_Kind_Low_Type_Attribute => 1618,
- Iir_Kind_Ascending_Type_Attribute => 1623,
- Iir_Kind_Image_Attribute => 1629,
- Iir_Kind_Value_Attribute => 1635,
- Iir_Kind_Pos_Attribute => 1641,
- Iir_Kind_Val_Attribute => 1647,
- Iir_Kind_Succ_Attribute => 1653,
- Iir_Kind_Pred_Attribute => 1659,
- Iir_Kind_Leftof_Attribute => 1665,
- Iir_Kind_Rightof_Attribute => 1671,
- Iir_Kind_Delayed_Attribute => 1679,
- Iir_Kind_Stable_Attribute => 1687,
- Iir_Kind_Quiet_Attribute => 1695,
- Iir_Kind_Transaction_Attribute => 1703,
- Iir_Kind_Event_Attribute => 1707,
- Iir_Kind_Active_Attribute => 1711,
- Iir_Kind_Last_Event_Attribute => 1715,
- Iir_Kind_Last_Active_Attribute => 1719,
- Iir_Kind_Last_Value_Attribute => 1723,
- Iir_Kind_Driving_Attribute => 1727,
- Iir_Kind_Driving_Value_Attribute => 1731,
- Iir_Kind_Behavior_Attribute => 1731,
- Iir_Kind_Structure_Attribute => 1731,
- Iir_Kind_Simple_Name_Attribute => 1738,
- Iir_Kind_Instance_Name_Attribute => 1743,
- Iir_Kind_Path_Name_Attribute => 1748,
- Iir_Kind_Left_Array_Attribute => 1755,
- Iir_Kind_Right_Array_Attribute => 1762,
- Iir_Kind_High_Array_Attribute => 1769,
- Iir_Kind_Low_Array_Attribute => 1776,
- Iir_Kind_Length_Array_Attribute => 1783,
- Iir_Kind_Ascending_Array_Attribute => 1790,
- Iir_Kind_Range_Array_Attribute => 1797,
- Iir_Kind_Reverse_Range_Array_Attribute => 1804,
- Iir_Kind_Attribute_Name => 1812
+ Iir_Kind_Interface_Function_Declaration => 933,
+ Iir_Kind_Interface_Procedure_Declaration => 945,
+ Iir_Kind_Identity_Operator => 949,
+ Iir_Kind_Negation_Operator => 953,
+ Iir_Kind_Absolute_Operator => 957,
+ Iir_Kind_Not_Operator => 961,
+ Iir_Kind_Condition_Operator => 965,
+ Iir_Kind_Reduction_And_Operator => 969,
+ Iir_Kind_Reduction_Or_Operator => 973,
+ Iir_Kind_Reduction_Nand_Operator => 977,
+ Iir_Kind_Reduction_Nor_Operator => 981,
+ Iir_Kind_Reduction_Xor_Operator => 985,
+ Iir_Kind_Reduction_Xnor_Operator => 989,
+ Iir_Kind_And_Operator => 994,
+ Iir_Kind_Or_Operator => 999,
+ Iir_Kind_Nand_Operator => 1004,
+ Iir_Kind_Nor_Operator => 1009,
+ Iir_Kind_Xor_Operator => 1014,
+ Iir_Kind_Xnor_Operator => 1019,
+ Iir_Kind_Equality_Operator => 1024,
+ Iir_Kind_Inequality_Operator => 1029,
+ Iir_Kind_Less_Than_Operator => 1034,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 1039,
+ Iir_Kind_Greater_Than_Operator => 1044,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 1049,
+ Iir_Kind_Match_Equality_Operator => 1054,
+ Iir_Kind_Match_Inequality_Operator => 1059,
+ Iir_Kind_Match_Less_Than_Operator => 1064,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1069,
+ Iir_Kind_Match_Greater_Than_Operator => 1074,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1079,
+ Iir_Kind_Sll_Operator => 1084,
+ Iir_Kind_Sla_Operator => 1089,
+ Iir_Kind_Srl_Operator => 1094,
+ Iir_Kind_Sra_Operator => 1099,
+ Iir_Kind_Rol_Operator => 1104,
+ Iir_Kind_Ror_Operator => 1109,
+ Iir_Kind_Addition_Operator => 1114,
+ Iir_Kind_Substraction_Operator => 1119,
+ Iir_Kind_Concatenation_Operator => 1124,
+ Iir_Kind_Multiplication_Operator => 1129,
+ Iir_Kind_Division_Operator => 1134,
+ Iir_Kind_Modulus_Operator => 1139,
+ Iir_Kind_Remainder_Operator => 1144,
+ Iir_Kind_Exponentiation_Operator => 1149,
+ Iir_Kind_Function_Call => 1157,
+ Iir_Kind_Aggregate => 1163,
+ Iir_Kind_Parenthesis_Expression => 1166,
+ Iir_Kind_Qualified_Expression => 1170,
+ Iir_Kind_Type_Conversion => 1175,
+ Iir_Kind_Allocator_By_Expression => 1179,
+ Iir_Kind_Allocator_By_Subtype => 1185,
+ Iir_Kind_Selected_Element => 1191,
+ Iir_Kind_Dereference => 1196,
+ Iir_Kind_Implicit_Dereference => 1201,
+ Iir_Kind_Slice_Name => 1208,
+ Iir_Kind_Indexed_Name => 1214,
+ Iir_Kind_Psl_Expression => 1216,
+ Iir_Kind_Sensitized_Process_Statement => 1236,
+ Iir_Kind_Process_Statement => 1256,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment => 1267,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1278,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1290,
+ Iir_Kind_Concurrent_Assertion_Statement => 1298,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1305,
+ Iir_Kind_Psl_Assert_Statement => 1318,
+ Iir_Kind_Psl_Cover_Statement => 1331,
+ Iir_Kind_Block_Statement => 1344,
+ Iir_Kind_If_Generate_Statement => 1354,
+ Iir_Kind_Case_Generate_Statement => 1363,
+ Iir_Kind_For_Generate_Statement => 1372,
+ Iir_Kind_Component_Instantiation_Statement => 1382,
+ Iir_Kind_Psl_Default_Clock => 1386,
+ Iir_Kind_Simple_Simultaneous_Statement => 1393,
+ Iir_Kind_Generate_Statement_Body => 1404,
+ Iir_Kind_If_Generate_Else_Clause => 1409,
+ Iir_Kind_Simple_Signal_Assignment_Statement => 1418,
+ Iir_Kind_Conditional_Signal_Assignment_Statement => 1427,
+ Iir_Kind_Null_Statement => 1431,
+ Iir_Kind_Assertion_Statement => 1438,
+ Iir_Kind_Report_Statement => 1444,
+ Iir_Kind_Wait_Statement => 1451,
+ Iir_Kind_Variable_Assignment_Statement => 1457,
+ Iir_Kind_Conditional_Variable_Assignment_Statement => 1463,
+ Iir_Kind_Return_Statement => 1469,
+ Iir_Kind_For_Loop_Statement => 1478,
+ Iir_Kind_While_Loop_Statement => 1486,
+ Iir_Kind_Next_Statement => 1492,
+ Iir_Kind_Exit_Statement => 1498,
+ Iir_Kind_Case_Statement => 1506,
+ Iir_Kind_Procedure_Call_Statement => 1512,
+ Iir_Kind_If_Statement => 1521,
+ Iir_Kind_Elsif => 1526,
+ Iir_Kind_Character_Literal => 1533,
+ Iir_Kind_Simple_Name => 1540,
+ Iir_Kind_Selected_Name => 1548,
+ Iir_Kind_Operator_Symbol => 1553,
+ Iir_Kind_Selected_By_All_Name => 1558,
+ Iir_Kind_Parenthesis_Name => 1562,
+ Iir_Kind_External_Constant_Name => 1571,
+ Iir_Kind_External_Signal_Name => 1580,
+ Iir_Kind_External_Variable_Name => 1589,
+ Iir_Kind_Package_Pathname => 1592,
+ Iir_Kind_Absolute_Pathname => 1593,
+ Iir_Kind_Relative_Pathname => 1594,
+ Iir_Kind_Pathname_Element => 1598,
+ Iir_Kind_Base_Attribute => 1600,
+ Iir_Kind_Left_Type_Attribute => 1605,
+ Iir_Kind_Right_Type_Attribute => 1610,
+ Iir_Kind_High_Type_Attribute => 1615,
+ Iir_Kind_Low_Type_Attribute => 1620,
+ Iir_Kind_Ascending_Type_Attribute => 1625,
+ Iir_Kind_Image_Attribute => 1631,
+ Iir_Kind_Value_Attribute => 1637,
+ Iir_Kind_Pos_Attribute => 1643,
+ Iir_Kind_Val_Attribute => 1649,
+ Iir_Kind_Succ_Attribute => 1655,
+ Iir_Kind_Pred_Attribute => 1661,
+ Iir_Kind_Leftof_Attribute => 1667,
+ Iir_Kind_Rightof_Attribute => 1673,
+ Iir_Kind_Delayed_Attribute => 1681,
+ Iir_Kind_Stable_Attribute => 1689,
+ Iir_Kind_Quiet_Attribute => 1697,
+ Iir_Kind_Transaction_Attribute => 1705,
+ Iir_Kind_Event_Attribute => 1709,
+ Iir_Kind_Active_Attribute => 1713,
+ Iir_Kind_Last_Event_Attribute => 1717,
+ Iir_Kind_Last_Active_Attribute => 1721,
+ Iir_Kind_Last_Value_Attribute => 1725,
+ Iir_Kind_Driving_Attribute => 1729,
+ Iir_Kind_Driving_Value_Attribute => 1733,
+ Iir_Kind_Behavior_Attribute => 1733,
+ Iir_Kind_Structure_Attribute => 1733,
+ Iir_Kind_Simple_Name_Attribute => 1740,
+ Iir_Kind_Instance_Name_Attribute => 1745,
+ Iir_Kind_Path_Name_Attribute => 1750,
+ Iir_Kind_Left_Array_Attribute => 1757,
+ Iir_Kind_Right_Array_Attribute => 1764,
+ Iir_Kind_High_Array_Attribute => 1771,
+ Iir_Kind_Low_Array_Attribute => 1778,
+ Iir_Kind_Length_Array_Attribute => 1785,
+ Iir_Kind_Ascending_Array_Attribute => 1792,
+ Iir_Kind_Range_Array_Attribute => 1799,
+ Iir_Kind_Reverse_Range_Array_Attribute => 1806,
+ Iir_Kind_Attribute_Name => 1814
);
function Get_Fields (K : Iir_Kind) return Fields_Array
@@ -8357,7 +8359,9 @@ package body Nodes_Meta is
begin
case K is
when Iir_Kind_Function_Declaration
- | Iir_Kind_Procedure_Declaration =>
+ | Iir_Kind_Procedure_Declaration
+ | Iir_Kind_Interface_Function_Declaration
+ | Iir_Kind_Interface_Procedure_Declaration =>
return True;
when others =>
return False;
diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb
index 90cdc3179..a886e8431 100644
--- a/src/vhdl/sem.adb
+++ b/src/vhdl/sem.adb
@@ -1845,31 +1845,11 @@ package body Sem is
Set_Subprogram_Hash (Subprg, To_Int32 (Hash + Sig));
end Compute_Subprogram_Hash;
- -- LRM 2.1 Subprogram Declarations.
- procedure Sem_Subprogram_Declaration (Subprg: Iir)
+ procedure Sem_Subprogram_Specification (Subprg: Iir)
is
- Parent : constant Iir := Get_Parent (Subprg);
- Spec: Iir;
Interface_Chain : Iir;
- Subprg_Body : Iir;
Return_Type : Iir;
begin
- -- Set depth.
- case Get_Kind (Parent) is
- when Iir_Kind_Function_Declaration
- | Iir_Kind_Procedure_Declaration =>
- raise Internal_Error;
- when Iir_Kind_Function_Body
- | Iir_Kind_Procedure_Body =>
- Set_Subprogram_Depth
- (Subprg,
- Get_Subprogram_Depth
- (Get_Subprogram_Specification (Parent)) + 1);
- when others =>
- -- FIXME: protected type ?
- Set_Subprogram_Depth (Subprg, 0);
- end case;
-
-- LRM 10.1 Declarative Region
-- 3. A subprogram declaration, together with the corresponding
-- subprogram body.
@@ -1878,7 +1858,8 @@ package body Sem is
-- Sem interfaces.
Interface_Chain := Get_Interface_Declaration_Chain (Subprg);
case Get_Kind (Subprg) is
- when Iir_Kind_Function_Declaration =>
+ when Iir_Kind_Function_Declaration
+ | Iir_Kind_Interface_Function_Declaration =>
Sem_Interface_Chain
(Interface_Chain, Function_Parameter_Interface_List);
Return_Type := Get_Return_Type_Mark (Subprg);
@@ -1925,9 +1906,14 @@ package body Sem is
end if;
end case;
+ when Iir_Kind_Interface_Procedure_Declaration =>
+ Sem_Interface_Chain
+ (Interface_Chain, Procedure_Parameter_Interface_List);
+
when Iir_Kind_Procedure_Declaration =>
Sem_Interface_Chain
(Interface_Chain, Procedure_Parameter_Interface_List);
+
-- Unless the body is analyzed, the procedure purity is unknown.
Set_Purity_State (Subprg, Unknown);
-- Check if the procedure is passive.
@@ -1967,12 +1953,37 @@ package body Sem is
-- The specification has been analyzed, close the declarative region
-- now.
Close_Declarative_Region;
+ end Sem_Subprogram_Specification;
+
+ -- LRM 2.1 Subprogram Declarations.
+ procedure Sem_Subprogram_Declaration (Subprg: Iir)
+ is
+ Parent : constant Iir := Get_Parent (Subprg);
+ Spec: Iir;
+ Subprg_Body : Iir;
+ begin
+ -- Set depth.
+ case Get_Kind (Parent) is
+ when Iir_Kind_Function_Declaration
+ | Iir_Kind_Procedure_Declaration =>
+ raise Internal_Error;
+ when Iir_Kind_Function_Body
+ | Iir_Kind_Procedure_Body =>
+ Set_Subprogram_Depth
+ (Subprg,
+ Get_Subprogram_Depth
+ (Get_Subprogram_Specification (Parent)) + 1);
+ when others =>
+ -- FIXME: protected type ?
+ Set_Subprogram_Depth (Subprg, 0);
+ end case;
+
+ Sem_Subprogram_Specification (Subprg);
-- Look if there is an associated body (the next node).
Subprg_Body := Get_Chain (Subprg);
if Subprg_Body /= Null_Iir
- and then (Get_Kind (Subprg_Body) = Iir_Kind_Function_Body
- or else Get_Kind (Subprg_Body) = Iir_Kind_Procedure_Body)
+ and then Get_Kind (Subprg_Body) in Iir_Kinds_Subprogram_Body
then
Spec := Find_Subprogram_Specification (Subprg);
else
@@ -2629,6 +2640,8 @@ package body Sem is
return True;
end if;
end;
+ when Iir_Kinds_Interface_Subprogram_Declaration =>
+ return True;
end case;
Inter := Get_Chain (Inter);
end loop;
diff --git a/src/vhdl/sem.ads b/src/vhdl/sem.ads
index 12cbc13e8..0b5ac0204 100644
--- a/src/vhdl/sem.ads
+++ b/src/vhdl/sem.ads
@@ -65,6 +65,7 @@ package Sem is
procedure Compute_Subprogram_Hash (Subprg : Iir);
-- LRM 2.1 Subprogram Declarations.
+ procedure Sem_Subprogram_Specification (Subprg: Iir);
procedure Sem_Subprogram_Declaration (Subprg: Iir);
-- LRM 2.2 Subprogram Bodies.
diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb
index aaafcf023..7cf490249 100644
--- a/src/vhdl/sem_decls.adb
+++ b/src/vhdl/sem_decls.adb
@@ -448,6 +448,11 @@ package body Sem_Decls is
Xref_Decl (Inter);
end Sem_Interface_Type_Declaration;
+ procedure Sem_Interface_Subprogram_Declaration (Inter : Iir) is
+ begin
+ Sem_Subprogram_Specification (Inter);
+ end Sem_Interface_Subprogram_Declaration;
+
procedure Sem_Interface_Chain (Interface_Chain: Iir;
Interface_Kind : Interface_Kind_Type)
is
@@ -474,6 +479,8 @@ package body Sem_Decls is
Sem_Interface_Package_Declaration (Inter);
when Iir_Kind_Interface_Type_Declaration =>
Sem_Interface_Type_Declaration (Inter);
+ when Iir_Kinds_Interface_Subprogram_Declaration =>
+ Sem_Interface_Subprogram_Declaration (Inter);
end case;
-- LRM08 6.5.6 Interface lists
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index 620931b24..902162d12 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -1395,7 +1395,7 @@ package body Sem_Expr is
else
-- Only one interpretation for the subprogram name.
if Is_Func then
- if Get_Kind (Inter_List) /= Iir_Kind_Function_Declaration then
+ if not Is_Function_Declaration (Inter_List) then
Error_Msg_Sem (+Expr, "name does not designate a function",
Cont => True);
Error_Msg_Sem (+Expr, "name is %n defined at %l",
@@ -1403,7 +1403,7 @@ package body Sem_Expr is
return Null_Iir;
end if;
else
- if Get_Kind (Inter_List) /= Iir_Kind_Procedure_Declaration then
+ if not Is_Procedure_Declaration (Inter_List) then
Error_Msg_Sem (+Expr, "name does not designate a procedure",
Cont => True);
Error_Msg_Sem (+Expr, "name is %n defined at %l",
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index ad13eb5ba..585af6aa7 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -1526,11 +1526,13 @@ package body Sem_Names is
Name_Res := Finish_Sem_Denoting_Name (Name, Res);
Set_Base_Name (Name_Res, Res);
return Name_Res;
- when Iir_Kind_Function_Declaration =>
+ when Iir_Kind_Function_Declaration
+ | Iir_Kind_Interface_Function_Declaration =>
Name_Res := Finish_Sem_Denoting_Name (Name, Res);
Set_Type (Name_Res, Get_Return_Type (Res));
return Name_Res;
- when Iir_Kind_Procedure_Declaration =>
+ when Iir_Kind_Procedure_Declaration
+ | Iir_Kind_Interface_Procedure_Declaration =>
return Finish_Sem_Denoting_Name (Name, Res);
when Iir_Kind_Type_Conversion =>
pragma Assert (Get_Kind (Name) = Iir_Kind_Parenthesis_Name);
@@ -2227,7 +2229,7 @@ package body Sem_Names is
-- Only values can be indexed or sliced.
-- Catch errors such as slice of a type conversion.
if Name_To_Value (Sub_Name) = Null_Iir
- and then Get_Kind (Sub_Name) /= Iir_Kind_Function_Declaration
+ and then not Is_Function_Declaration (Sub_Name)
then
if Finish then
Error_Msg_Sem
@@ -2343,7 +2345,7 @@ package body Sem_Names is
Call : Iir;
begin
Used := False;
- if Get_Kind (Sub_Name) = Iir_Kind_Function_Declaration then
+ if Is_Function_Declaration (Sub_Name) then
Sem_Association_Chain
(Get_Interface_Declaration_Chain (Sub_Name),
Assoc_Chain, False, Missing_Parameter, Name, Match);
@@ -2354,7 +2356,7 @@ package body Sem_Names is
Used := True;
end if;
end if;
- if Get_Kind (Sub_Name) /= Iir_Kind_Procedure_Declaration then
+ if not Is_Procedure_Declaration (Sub_Name) then
R := Sem_As_Indexed_Or_Slice_Name (Sub_Name, False);
if R /= Null_Iir then
Add_Result (Res, R);
@@ -2393,8 +2395,8 @@ package body Sem_Names is
Assoc_Chain := Get_Association_Chain (Name);
Actual := Get_One_Actual (Assoc_Chain);
- if Get_Kind (Prefix) = Iir_Kind_Type_Declaration
- or else Get_Kind (Prefix) = Iir_Kind_Subtype_Declaration
+ if Kind_In (Prefix, Iir_Kind_Type_Declaration,
+ Iir_Kind_Subtype_Declaration)
then
-- A type conversion. The prefix is a type mark.
@@ -2465,7 +2467,8 @@ package body Sem_Names is
(+Name, "no overloaded function found matching %n",
+Prefix_Name);
end if;
- when Iir_Kind_Function_Declaration =>
+ when Iir_Kind_Function_Declaration
+ | Iir_Kind_Interface_Function_Declaration =>
Sem_Parenthesis_Function (Prefix);
if Res = Null_Iir then
Error_Parenthesis_Function (Prefix);
@@ -2527,7 +2530,8 @@ package body Sem_Names is
end if;
return;
- when Iir_Kind_Procedure_Declaration =>
+ when Iir_Kind_Procedure_Declaration
+ | Iir_Kind_Interface_Procedure_Declaration =>
Error_Msg_Sem (+Name, "function name is a procedure");
when Iir_Kinds_Process_Statement
diff --git a/src/vhdl/sem_scopes.adb b/src/vhdl/sem_scopes.adb
index 0b62cff03..d6d895231 100644
--- a/src/vhdl/sem_scopes.adb
+++ b/src/vhdl/sem_scopes.adb
@@ -962,6 +962,7 @@ package body Sem_Scopes is
| Iir_Kind_Non_Object_Alias_Declaration
| Iir_Kinds_Interface_Object_Declaration
| Iir_Kind_Interface_Package_Declaration
+ | Iir_Kinds_Interface_Subprogram_Declaration
| Iir_Kind_Component_Declaration
| Iir_Kind_Attribute_Declaration
| Iir_Kind_Group_Template_Declaration