aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/evaluation.adb24
-rw-r--r--src/vhdl/iirs.adb97
-rw-r--r--src/vhdl/iirs.ads76
-rw-r--r--src/vhdl/nodes_meta.adb556
-rw-r--r--src/vhdl/nodes_meta.ads14
-rw-r--r--src/vhdl/parse.adb4
-rw-r--r--src/vhdl/sem_decls.adb182
-rw-r--r--src/vhdl/sem_expr.adb9
-rw-r--r--src/vhdl/sem_inst.adb60
-rw-r--r--src/vhdl/sem_types.adb22
-rw-r--r--src/vhdl/std_package.adb2
-rw-r--r--src/vhdl/translate/trans-chap3.adb14
-rw-r--r--src/vhdl/translate/trans-rtis.adb5
13 files changed, 664 insertions, 401 deletions
diff --git a/src/vhdl/evaluation.adb b/src/vhdl/evaluation.adb
index 8bcc6ff9e..24a365ee9 100644
--- a/src/vhdl/evaluation.adb
+++ b/src/vhdl/evaluation.adb
@@ -273,7 +273,9 @@ package body Evaluation is
Location_Copy (Res, Origin);
Set_Type (Res, Get_Type (Range_Expr));
Set_Left_Limit (Res, Get_Left_Limit (Range_Expr));
+ Set_Left_Limit_Expr (Res, Get_Left_Limit_Expr (Range_Expr));
Set_Right_Limit (Res, Get_Right_Limit (Range_Expr));
+ Set_Right_Limit_Expr (Res, Get_Right_Limit_Expr (Range_Expr));
Set_Direction (Res, Get_Direction (Range_Expr));
Set_Range_Origin (Res, Origin);
Set_Expr_Staticness (Res, Locally);
@@ -302,16 +304,12 @@ package body Evaluation is
-- Set the right limit of A_RANGE from LEN.
procedure Set_Right_Limit_By_Length (A_Range : Iir; Len : Iir_Int64)
is
- Left, Right : Iir;
+ A_Type : constant Iir := Get_Type (A_Range);
+ Left : constant Iir := Get_Left_Limit (A_Range);
+ Right : Iir;
Pos : Iir_Int64;
- A_Type : Iir;
begin
- if Get_Expr_Staticness (A_Range) /= Locally then
- raise Internal_Error;
- end if;
- A_Type := Get_Type (A_Range);
-
- Left := Get_Left_Limit (A_Range);
+ pragma Assert (Get_Expr_Staticness (A_Range) = Locally);
Pos := Eval_Pos (Left);
case Get_Direction (A_Range) is
@@ -329,6 +327,7 @@ package body Evaluation is
-- FIXME: what about nul range?
Right := Build_Discrete (Pos, A_Range);
Set_Literal_Origin (Right, Null_Iir);
+ Set_Right_Limit_Expr (A_Range, Right);
end if;
Set_Right_Limit (A_Range, Right);
end Set_Right_Limit_By_Length;
@@ -1846,13 +1845,18 @@ package body Evaluation is
end Create_Bound;
Res : Iir;
+ Lit : Iir;
begin
Res_Btype := Get_Base_Type (Res_Type);
Res := Create_Iir (Iir_Kind_Range_Expression);
Location_Copy (Res, Loc);
Set_Type (Res, Res_Btype);
- Set_Left_Limit (Res, Create_Bound (Get_Left_Limit (Rng)));
- Set_Right_Limit (Res, Create_Bound (Get_Right_Limit (Rng)));
+ Lit := Create_Bound (Get_Left_Limit (Rng));
+ Set_Left_Limit (Res, Lit);
+ Set_Left_Limit_Expr (Res, Lit);
+ Lit := Create_Bound (Get_Right_Limit (Rng));
+ Set_Right_Limit (Res, Lit);
+ Set_Right_Limit_Expr (Res, Lit);
Set_Direction (Res, Get_Direction (Rng));
Set_Expr_Staticness (Res, Locally);
return Res;
diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb
index 68e7fd95b..d7546d2d7 100644
--- a/src/vhdl/iirs.adb
+++ b/src/vhdl/iirs.adb
@@ -1945,6 +1945,22 @@ package body Iirs is
Set_Field4 (Target, Def);
end Set_Subtype_Definition;
+ function Get_Incomplete_Type_Declaration (N : Iir) return Iir is
+ begin
+ pragma Assert (N /= Null_Iir);
+ pragma Assert (Has_Incomplete_Type_Declaration (Get_Kind (N)),
+ "no field Incomplete_Type_Declaration");
+ return Get_Field5 (N);
+ end Get_Incomplete_Type_Declaration;
+
+ procedure Set_Incomplete_Type_Declaration (N : Iir; Decl : Iir) is
+ begin
+ pragma Assert (N /= Null_Iir);
+ pragma Assert (Has_Incomplete_Type_Declaration (Get_Kind (N)),
+ "no field Incomplete_Type_Declaration");
+ Set_Field5 (N, Decl);
+ end Set_Incomplete_Type_Declaration;
+
function Get_Interface_Type_Subprograms (Target : Iir) return Iir is
begin
pragma Assert (Target /= Null_Iir);
@@ -2478,6 +2494,38 @@ package body Iirs is
Set_Field3 (Def, Decl);
end Set_Type_Declarator;
+ function Get_Complete_Type_Definition (N : Iir) return Iir is
+ begin
+ pragma Assert (N /= Null_Iir);
+ pragma Assert (Has_Complete_Type_Definition (Get_Kind (N)),
+ "no field Complete_Type_Definition");
+ return Get_Field5 (N);
+ end Get_Complete_Type_Definition;
+
+ procedure Set_Complete_Type_Definition (N : Iir; Def : Iir) is
+ begin
+ pragma Assert (N /= Null_Iir);
+ pragma Assert (Has_Complete_Type_Definition (Get_Kind (N)),
+ "no field Complete_Type_Definition");
+ Set_Field5 (N, Def);
+ end Set_Complete_Type_Definition;
+
+ function Get_Incomplete_Type_Ref_Chain (N : Iir) return Iir is
+ begin
+ pragma Assert (N /= Null_Iir);
+ pragma Assert (Has_Incomplete_Type_Ref_Chain (Get_Kind (N)),
+ "no field Incomplete_Type_Ref_Chain");
+ return Get_Field0 (N);
+ end Get_Incomplete_Type_Ref_Chain;
+
+ procedure Set_Incomplete_Type_Ref_Chain (N : Iir; Def : Iir) is
+ begin
+ pragma Assert (N /= Null_Iir);
+ pragma Assert (Has_Incomplete_Type_Ref_Chain (Get_Kind (N)),
+ "no field Incomplete_Type_Ref_Chain");
+ Set_Field0 (N, Def);
+ end Set_Incomplete_Type_Ref_Chain;
+
function Get_Associated_Type (Def : Iir) return Iir is
begin
pragma Assert (Def /= Null_Iir);
@@ -2686,6 +2734,39 @@ package body Iirs is
Set_Field3 (Decl, Limit);
end Set_Right_Limit;
+ function Get_Left_Limit_Expr (Decl : Iir_Range_Expression) return Iir is
+ begin
+ pragma Assert (Decl /= Null_Iir);
+ pragma Assert (Has_Left_Limit_Expr (Get_Kind (Decl)),
+ "no field Left_Limit_Expr");
+ return Get_Field4 (Decl);
+ end Get_Left_Limit_Expr;
+
+ procedure Set_Left_Limit_Expr (Decl : Iir_Range_Expression; Limit : Iir) is
+ begin
+ pragma Assert (Decl /= Null_Iir);
+ pragma Assert (Has_Left_Limit_Expr (Get_Kind (Decl)),
+ "no field Left_Limit_Expr");
+ Set_Field4 (Decl, Limit);
+ end Set_Left_Limit_Expr;
+
+ function Get_Right_Limit_Expr (Decl : Iir_Range_Expression) return Iir is
+ begin
+ pragma Assert (Decl /= Null_Iir);
+ pragma Assert (Has_Right_Limit_Expr (Get_Kind (Decl)),
+ "no field Right_Limit_Expr");
+ return Get_Field5 (Decl);
+ end Get_Right_Limit_Expr;
+
+ procedure Set_Right_Limit_Expr (Decl : Iir_Range_Expression; Limit : Iir)
+ is
+ begin
+ pragma Assert (Decl /= Null_Iir);
+ pragma Assert (Has_Right_Limit_Expr (Get_Kind (Decl)),
+ "no field Right_Limit_Expr");
+ Set_Field5 (Decl, Limit);
+ end Set_Right_Limit_Expr;
+
function Get_Base_Type (Decl : Iir) return Iir is
begin
pragma Assert (Decl /= Null_Iir);
@@ -4907,22 +4988,6 @@ package body Iirs is
Set_Field8 (Target, Mark);
end Set_Return_Type_Mark;
- function Get_Incomplete_Type_List (Target : Iir) return Iir_List is
- begin
- pragma Assert (Target /= Null_Iir);
- pragma Assert (Has_Incomplete_Type_List (Get_Kind (Target)),
- "no field Incomplete_Type_List");
- return Iir_To_Iir_List (Get_Field2 (Target));
- end Get_Incomplete_Type_List;
-
- procedure Set_Incomplete_Type_List (Target : Iir; List : Iir_List) is
- begin
- pragma Assert (Target /= Null_Iir);
- pragma Assert (Has_Incomplete_Type_List (Get_Kind (Target)),
- "no field Incomplete_Type_List");
- Set_Field2 (Target, Iir_List_To_Iir (List));
- end Set_Incomplete_Type_List;
-
function Get_Has_Disconnect_Flag (Target : Iir) return Boolean is
begin
pragma Assert (Target /= Null_Iir);
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index 62474b51c..ae194fa8c 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -1079,6 +1079,9 @@ package Iirs is
-- Get/Set_Identifier (Field3)
--
-- Get/Set_Subtype_Definition (Field4)
+ --
+ -- Set if the type declaration completes an incomplete type declaration
+ -- Get/Set_Incomplete_Type_Declaration (Field5)
-- Iir_Kind_Type_Declaration (Short)
--
@@ -1111,7 +1114,7 @@ package Iirs is
-- point).
-- The parser set this field to null_iir for an incomplete type
-- declaration. This field is set to an incomplete_type_definition node
- -- when first analyzed.
+ -- when analyzed.
-- Get/Set_Type_Definition (Field1)
-- Get/Set_Type (Alias Field1)
--
@@ -1119,6 +1122,9 @@ package Iirs is
--
-- Get/Set_Identifier (Field3)
--
+ -- Set if the type declaration completes an incomplete type declaration
+ -- Get/Set_Incomplete_Type_Declaration (Field5)
+ --
-- Get/Set_Visible_Flag (Flag4)
--
-- Get/Set_Use_Flag (Flag6)
@@ -2181,14 +2187,19 @@ package Iirs is
--
-- access_type_definition ::= ACCESS subtype_indication
--
- -- Get/Set_Designated_Type (Field1)
+ -- Next access type that also referenced the same incomplete type when
+ -- defined.
+ -- Get/Set_Incomplete_Type_Ref_Chain (Field0)
--
- -- Get/Set_Designated_Subtype_Indication (Field5)
+ -- Get/Set_Designated_Type (Field1)
--
-- Get/Set_Type_Declarator (Field3)
--
-- Get/Set_Base_Type (Field4)
--
+ -- Can designate incomplete_type_definition.
+ -- Get/Set_Designated_Subtype_Indication (Field5)
+ --
-- Get/Set_Resolved_Flag (Flag1)
--
-- Get/Set_Signal_Type_Flag (Flag2)
@@ -2215,16 +2226,21 @@ package Iirs is
-- Iir_Kind_Incomplete_Type_Definition (Short)
-- Type definition for an incomplete type. This is created during the
- -- semantisation of the incomplete type declaration.
+ -- analysis of the incomplete type declaration.
--
- -- Get/Set_Incomplete_Type_List (Field2)
+ -- Chain of access_type_definition that designated this type. This is
+ -- simply a forward_ref as the access type is declared after the
+ -- incomplete type.
+ -- Get/Set_Incomplete_Type_Ref_Chain (Field0)
--
- -- Set to the incomplete type declaration when analyzed, and set to the
- -- complete type declaration when the latter one is analyzed.
+ -- Set to the incomplete type declaration.
-- Get/Set_Type_Declarator (Field3)
--
-- Get/Set_Base_Type (Field4)
--
+ -- Set to the complete type definition when completed.
+ -- Get/Set_Complete_Type_Definition (Field5)
+ --
-- Get/Set_Type_Staticness (State1)
--
-- Get/Set_Resolved_Flag (Flag1)
@@ -2536,10 +2552,19 @@ package Iirs is
--
-- Get/Set_Type (Field1)
--
+ -- There are two fields for both limits: those that own the node
+ -- (Left_Limit_Expr and Right_Limit_Expr) and those that reference the node
+ -- (Left_Limit and Right_Limit). Always use the reference (they cannot be
+ -- Null_Iir, while the owner nodes can be Null_Iir. Set the owner nodes
+ -- only for owning purpose.
-- Get/Set_Left_Limit (Field2)
--
-- Get/Set_Right_Limit (Field3)
--
+ -- Get/Set_Left_Limit_Expr (Field4)
+ --
+ -- Get/Set_Right_Limit_Expr (Field5)
+ --
-- Get/Set_Expr_Staticness (State1)
--
-- Get/Set_Direction (State2)
@@ -5927,6 +5952,11 @@ package Iirs is
function Get_Subtype_Definition (Target : Iir) return Iir;
procedure Set_Subtype_Definition (Target : Iir; Def : Iir);
+ -- Set if the type declaration completes an incomplete type declaration
+ -- Field: Field5 Ref
+ function Get_Incomplete_Type_Declaration (N : Iir) return Iir;
+ procedure Set_Incomplete_Type_Declaration (N : Iir; Decl : Iir);
+
-- Implicit operations of an interface type declaration.
-- Field: Field4 Chain
function Get_Interface_Type_Subprograms (Target : Iir) return Iir;
@@ -6021,6 +6051,7 @@ package Iirs is
-- Note that this node can be shared between declarations if they are
-- separated by comma, such as in:
-- variable a, b : integer := 5;
+ -- procedure p (a, b : natural := 7);
-- Field: Field4 Maybe_Ref
function Get_Default_Value (Target : Iir) return Iir;
procedure Set_Default_Value (Target : Iir; Value : Iir);
@@ -6108,6 +6139,14 @@ package Iirs is
function Get_Type_Declarator (Def : Iir) return Iir;
procedure Set_Type_Declarator (Def : Iir; Decl : Iir);
+ -- Field: Field5 Forward_Ref
+ function Get_Complete_Type_Definition (N : Iir) return Iir;
+ procedure Set_Complete_Type_Definition (N : Iir; Def : Iir);
+
+ -- Field: Field0 Forward_Ref
+ function Get_Incomplete_Type_Ref_Chain (N : Iir) return Iir;
+ procedure Set_Incomplete_Type_Ref_Chain (N : Iir; Def : Iir);
+
-- Field: Field5 Ref
function Get_Associated_Type (Def : Iir) return Iir;
procedure Set_Associated_Type (Def : Iir; Atype : Iir);
@@ -6164,14 +6203,22 @@ package Iirs is
function Get_Direction (Decl : Iir) return Iir_Direction;
procedure Set_Direction (Decl : Iir; Dir : Iir_Direction);
- -- Field: Field2
+ -- Field: Field2 Ref
function Get_Left_Limit (Decl : Iir_Range_Expression) return Iir;
procedure Set_Left_Limit (Decl : Iir_Range_Expression; Limit : Iir);
- -- Field: Field3
+ -- Field: Field3 Ref
function Get_Right_Limit (Decl : Iir_Range_Expression) return Iir;
procedure Set_Right_Limit (Decl : Iir_Range_Expression; Limit : Iir);
+ -- Field: Field4
+ function Get_Left_Limit_Expr (Decl : Iir_Range_Expression) return Iir;
+ procedure Set_Left_Limit_Expr (Decl : Iir_Range_Expression; Limit : Iir);
+
+ -- Field: Field5
+ function Get_Right_Limit_Expr (Decl : Iir_Range_Expression) return Iir;
+ procedure Set_Right_Limit_Expr (Decl : Iir_Range_Expression; Limit : Iir);
+
-- Field: Field4 Ref
function Get_Base_Type (Decl : Iir) return Iir;
procedure Set_Base_Type (Decl : Iir; Base_Type : Iir);
@@ -6258,7 +6305,7 @@ package Iirs is
function Get_Elements_Declaration_List (Decl : Iir) return Iir_List;
procedure Set_Elements_Declaration_List (Decl : Iir; List : Iir_List);
- -- Field: Field1 Ref
+ -- Field: Field1 Forward_Ref
function Get_Designated_Type (Target : Iir) return Iir;
procedure Set_Designated_Type (Target : Iir; Dtype : Iir);
@@ -6727,7 +6774,7 @@ package Iirs is
procedure Set_Suffix (Target : Iir; Suffix : Iir);
-- Set the designated index subtype of an array attribute.
- -- Field: Field2
+ -- Field: Field2 Ref
function Get_Index_Subtype (Attr : Iir) return Iir;
procedure Set_Index_Subtype (Attr : Iir; St : Iir);
@@ -6871,13 +6918,6 @@ package Iirs is
function Get_Return_Type_Mark (Target : Iir) return Iir;
procedure Set_Return_Type_Mark (Target : Iir; Mark : Iir);
- -- List of use (designated type of access types) of an incomplete type
- -- definition. The purpose is to complete the uses with the full type
- -- definition.
- -- Field: Field2 (uc)
- function Get_Incomplete_Type_List (Target : Iir) return Iir_List;
- procedure Set_Incomplete_Type_List (Target : Iir; List : Iir_List);
-
-- This flag is set on a signal_declaration, when a disconnection
-- specification applies to the signal (or a subelement of it).
-- This is used to check 'others' and 'all' designators.
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index 250cd963f..bfad5ab47 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -107,6 +107,7 @@ package body Nodes_Meta is
Field_Discrete_Range => Type_Iir,
Field_Type_Definition => Type_Iir,
Field_Subtype_Definition => Type_Iir,
+ Field_Incomplete_Type_Declaration => Type_Iir,
Field_Interface_Type_Subprograms => Type_Iir,
Field_Nature => Type_Iir,
Field_Mode => Type_Iir_Mode,
@@ -140,6 +141,8 @@ package body Nodes_Meta is
Field_Context_Reference_Chain => Type_Iir,
Field_Selected_Name => Type_Iir,
Field_Type_Declarator => Type_Iir,
+ Field_Complete_Type_Definition => Type_Iir,
+ Field_Incomplete_Type_Ref_Chain => Type_Iir,
Field_Associated_Type => Type_Iir,
Field_Enumeration_Literal_List => Type_Iir_List,
Field_Entity_Class_Entry_Chain => Type_Iir,
@@ -153,6 +156,8 @@ package body Nodes_Meta is
Field_Direction => Type_Iir_Direction,
Field_Left_Limit => Type_Iir,
Field_Right_Limit => Type_Iir,
+ Field_Left_Limit_Expr => Type_Iir,
+ Field_Right_Limit_Expr => Type_Iir,
Field_Base_Type => Type_Iir,
Field_Resolution_Indication => Type_Iir,
Field_Record_Element_Resolution_Chain => Type_Iir,
@@ -291,7 +296,6 @@ package body Nodes_Meta is
Field_Type_Mark => Type_Iir,
Field_File_Type_Mark => Type_Iir,
Field_Return_Type_Mark => Type_Iir,
- Field_Incomplete_Type_List => Type_Iir_List,
Field_Has_Disconnect_Flag => Type_Boolean,
Field_Has_Active_Flag => Type_Boolean,
Field_Is_Within_Flag => Type_Boolean,
@@ -516,6 +520,8 @@ package body Nodes_Meta is
return "type_definition";
when Field_Subtype_Definition =>
return "subtype_definition";
+ when Field_Incomplete_Type_Declaration =>
+ return "incomplete_type_declaration";
when Field_Interface_Type_Subprograms =>
return "interface_type_subprograms";
when Field_Nature =>
@@ -582,6 +588,10 @@ package body Nodes_Meta is
return "selected_name";
when Field_Type_Declarator =>
return "type_declarator";
+ when Field_Complete_Type_Definition =>
+ return "complete_type_definition";
+ when Field_Incomplete_Type_Ref_Chain =>
+ return "incomplete_type_ref_chain";
when Field_Associated_Type =>
return "associated_type";
when Field_Enumeration_Literal_List =>
@@ -608,6 +618,10 @@ package body Nodes_Meta is
return "left_limit";
when Field_Right_Limit =>
return "right_limit";
+ when Field_Left_Limit_Expr =>
+ return "left_limit_expr";
+ when Field_Right_Limit_Expr =>
+ return "right_limit_expr";
when Field_Base_Type =>
return "base_type";
when Field_Resolution_Indication =>
@@ -884,8 +898,6 @@ package body Nodes_Meta is
return "file_type_mark";
when Field_Return_Type_Mark =>
return "return_type_mark";
- when Field_Incomplete_Type_List =>
- return "incomplete_type_list";
when Field_Has_Disconnect_Flag =>
return "has_disconnect_flag";
when Field_Has_Active_Flag =>
@@ -1674,6 +1686,8 @@ package body Nodes_Meta is
return Attr_None;
when Field_Subtype_Definition =>
return Attr_None;
+ when Field_Incomplete_Type_Declaration =>
+ return Attr_Ref;
when Field_Interface_Type_Subprograms =>
return Attr_Chain;
when Field_Nature =>
@@ -1740,6 +1754,10 @@ package body Nodes_Meta is
return Attr_None;
when Field_Type_Declarator =>
return Attr_Ref;
+ when Field_Complete_Type_Definition =>
+ return Attr_Forward_Ref;
+ when Field_Incomplete_Type_Ref_Chain =>
+ return Attr_Forward_Ref;
when Field_Associated_Type =>
return Attr_Ref;
when Field_Enumeration_Literal_List =>
@@ -1763,8 +1781,12 @@ package body Nodes_Meta is
when Field_Direction =>
return Attr_None;
when Field_Left_Limit =>
- return Attr_None;
+ return Attr_Ref;
when Field_Right_Limit =>
+ return Attr_Ref;
+ when Field_Left_Limit_Expr =>
+ return Attr_None;
+ when Field_Right_Limit_Expr =>
return Attr_None;
when Field_Base_Type =>
return Attr_Ref;
@@ -1805,7 +1827,7 @@ package body Nodes_Meta is
when Field_Elements_Declaration_List =>
return Attr_None;
when Field_Designated_Type =>
- return Attr_Ref;
+ return Attr_Forward_Ref;
when Field_Designated_Subtype_Indication =>
return Attr_None;
when Field_Index_List =>
@@ -1989,7 +2011,7 @@ package body Nodes_Meta is
when Field_Suffix =>
return Attr_None;
when Field_Index_Subtype =>
- return Attr_None;
+ return Attr_Ref;
when Field_Parameter =>
return Attr_None;
when Field_Actual_Type =>
@@ -2042,8 +2064,6 @@ package body Nodes_Meta is
return Attr_None;
when Field_Return_Type_Mark =>
return Attr_None;
- when Field_Incomplete_Type_List =>
- return Attr_None;
when Field_Has_Disconnect_Flag =>
return Attr_None;
when Field_Has_Active_Flag =>
@@ -2417,6 +2437,7 @@ package body Nodes_Meta is
Field_Signal_Type_Flag,
Field_Type_Staticness,
Field_Designated_Subtype_Indication,
+ Field_Incomplete_Type_Ref_Chain,
Field_Designated_Type,
Field_Type_Declarator,
Field_Base_Type,
@@ -2425,9 +2446,10 @@ package body Nodes_Meta is
Field_Signal_Type_Flag,
Field_Has_Signal_Flag,
Field_Type_Staticness,
- Field_Incomplete_Type_List,
+ Field_Incomplete_Type_Ref_Chain,
Field_Type_Declarator,
Field_Base_Type,
+ Field_Complete_Type_Definition,
-- Iir_Kind_Interface_Type_Definition
Field_Resolved_Flag,
Field_Signal_Type_Flag,
@@ -2594,9 +2616,11 @@ package body Nodes_Meta is
Field_Expr_Staticness,
Field_Direction,
Field_Range_Origin,
+ Field_Left_Limit_Expr,
+ Field_Right_Limit_Expr,
+ Field_Type,
Field_Left_Limit,
Field_Right_Limit,
- Field_Type,
-- Iir_Kind_Protected_Type_Body
Field_Identifier,
Field_End_Has_Reserved_Id,
@@ -2630,12 +2654,14 @@ package body Nodes_Meta is
Field_Type_Definition,
Field_Chain,
Field_Parent,
+ Field_Incomplete_Type_Declaration,
-- Iir_Kind_Anonymous_Type_Declaration
Field_Identifier,
Field_Type_Definition,
Field_Chain,
Field_Subtype_Definition,
Field_Parent,
+ Field_Incomplete_Type_Declaration,
-- Iir_Kind_Subtype_Declaration
Field_Identifier,
Field_Visible_Flag,
@@ -4134,65 +4160,65 @@ package body Nodes_Meta is
Field_Expr_Staticness,
Field_Name_Staticness,
Field_Prefix,
- Field_Index_Subtype,
Field_Parameter,
Field_Type,
+ Field_Index_Subtype,
Field_Base_Name,
-- Iir_Kind_Right_Array_Attribute
Field_Expr_Staticness,
Field_Name_Staticness,
Field_Prefix,
- Field_Index_Subtype,
Field_Parameter,
Field_Type,
+ Field_Index_Subtype,
Field_Base_Name,
-- Iir_Kind_High_Array_Attribute
Field_Expr_Staticness,
Field_Name_Staticness,
Field_Prefix,
- Field_Index_Subtype,
Field_Parameter,
Field_Type,
+ Field_Index_Subtype,
Field_Base_Name,
-- Iir_Kind_Low_Array_Attribute
Field_Expr_Staticness,
Field_Name_Staticness,
Field_Prefix,
- Field_Index_Subtype,
Field_Parameter,
Field_Type,
+ Field_Index_Subtype,
Field_Base_Name,
-- Iir_Kind_Length_Array_Attribute
Field_Expr_Staticness,
Field_Name_Staticness,
Field_Prefix,
- Field_Index_Subtype,
Field_Parameter,
Field_Type,
+ Field_Index_Subtype,
Field_Base_Name,
-- Iir_Kind_Ascending_Array_Attribute
Field_Expr_Staticness,
Field_Name_Staticness,
Field_Prefix,
- Field_Index_Subtype,
Field_Parameter,
Field_Type,
+ Field_Index_Subtype,
Field_Base_Name,
-- Iir_Kind_Range_Array_Attribute
Field_Expr_Staticness,
Field_Name_Staticness,
Field_Prefix,
- Field_Index_Subtype,
Field_Parameter,
Field_Type,
+ Field_Index_Subtype,
Field_Base_Name,
-- Iir_Kind_Reverse_Range_Array_Attribute
Field_Expr_Staticness,
Field_Name_Staticness,
Field_Prefix,
- Field_Index_Subtype,
Field_Parameter,
Field_Type,
+ Field_Index_Subtype,
Field_Base_Name,
-- Iir_Kind_Attribute_Name
Field_Identifier,
@@ -4255,220 +4281,220 @@ package body Nodes_Meta is
Iir_Kind_Attribute_Specification => 228,
Iir_Kind_Disconnection_Specification => 233,
Iir_Kind_Configuration_Specification => 238,
- Iir_Kind_Access_Type_Definition => 245,
- Iir_Kind_Incomplete_Type_Definition => 252,
- Iir_Kind_Interface_Type_Definition => 259,
- Iir_Kind_File_Type_Definition => 266,
- Iir_Kind_Protected_Type_Declaration => 275,
- Iir_Kind_Record_Type_Definition => 285,
- Iir_Kind_Array_Type_Definition => 297,
- Iir_Kind_Array_Subtype_Definition => 312,
- Iir_Kind_Record_Subtype_Definition => 323,
- Iir_Kind_Access_Subtype_Definition => 331,
- Iir_Kind_Physical_Subtype_Definition => 340,
- Iir_Kind_Floating_Subtype_Definition => 350,
- Iir_Kind_Integer_Subtype_Definition => 359,
- Iir_Kind_Enumeration_Subtype_Definition => 368,
- Iir_Kind_Enumeration_Type_Definition => 377,
- Iir_Kind_Integer_Type_Definition => 383,
- Iir_Kind_Floating_Type_Definition => 389,
- Iir_Kind_Physical_Type_Definition => 398,
- Iir_Kind_Range_Expression => 404,
- Iir_Kind_Protected_Type_Body => 411,
- Iir_Kind_Wildcard_Type_Definition => 416,
- Iir_Kind_Subtype_Definition => 420,
- Iir_Kind_Scalar_Nature_Definition => 424,
- Iir_Kind_Overload_List => 425,
- Iir_Kind_Type_Declaration => 431,
- Iir_Kind_Anonymous_Type_Declaration => 436,
- Iir_Kind_Subtype_Declaration => 444,
- Iir_Kind_Nature_Declaration => 450,
- Iir_Kind_Subnature_Declaration => 456,
- Iir_Kind_Package_Declaration => 471,
- Iir_Kind_Package_Instantiation_Declaration => 483,
- Iir_Kind_Package_Body => 491,
- Iir_Kind_Configuration_Declaration => 500,
- Iir_Kind_Entity_Declaration => 512,
- Iir_Kind_Architecture_Body => 524,
- Iir_Kind_Context_Declaration => 530,
- Iir_Kind_Package_Header => 532,
- Iir_Kind_Unit_Declaration => 541,
- Iir_Kind_Library_Declaration => 548,
- Iir_Kind_Component_Declaration => 558,
- Iir_Kind_Attribute_Declaration => 565,
- Iir_Kind_Group_Template_Declaration => 571,
- Iir_Kind_Group_Declaration => 578,
- Iir_Kind_Element_Declaration => 585,
- Iir_Kind_Non_Object_Alias_Declaration => 593,
- Iir_Kind_Psl_Declaration => 601,
- Iir_Kind_Psl_Endpoint_Declaration => 615,
- Iir_Kind_Terminal_Declaration => 621,
- Iir_Kind_Free_Quantity_Declaration => 630,
- Iir_Kind_Across_Quantity_Declaration => 642,
- Iir_Kind_Through_Quantity_Declaration => 654,
- Iir_Kind_Enumeration_Literal => 665,
- Iir_Kind_Function_Declaration => 689,
- Iir_Kind_Procedure_Declaration => 712,
- Iir_Kind_Function_Body => 722,
- Iir_Kind_Procedure_Body => 733,
- Iir_Kind_Object_Alias_Declaration => 745,
- Iir_Kind_File_Declaration => 760,
- Iir_Kind_Guard_Signal_Declaration => 773,
- Iir_Kind_Signal_Declaration => 790,
- Iir_Kind_Variable_Declaration => 803,
- Iir_Kind_Constant_Declaration => 817,
- Iir_Kind_Iterator_Declaration => 829,
- Iir_Kind_Interface_Constant_Declaration => 845,
- Iir_Kind_Interface_Variable_Declaration => 861,
- Iir_Kind_Interface_Signal_Declaration => 882,
- Iir_Kind_Interface_File_Declaration => 898,
- Iir_Kind_Interface_Type_Declaration => 908,
- Iir_Kind_Interface_Package_Declaration => 918,
- Iir_Kind_Interface_Function_Declaration => 934,
- Iir_Kind_Interface_Procedure_Declaration => 946,
- Iir_Kind_Identity_Operator => 950,
- Iir_Kind_Negation_Operator => 954,
- Iir_Kind_Absolute_Operator => 958,
- Iir_Kind_Not_Operator => 962,
- Iir_Kind_Condition_Operator => 966,
- Iir_Kind_Reduction_And_Operator => 970,
- Iir_Kind_Reduction_Or_Operator => 974,
- Iir_Kind_Reduction_Nand_Operator => 978,
- Iir_Kind_Reduction_Nor_Operator => 982,
- Iir_Kind_Reduction_Xor_Operator => 986,
- Iir_Kind_Reduction_Xnor_Operator => 990,
- Iir_Kind_And_Operator => 995,
- Iir_Kind_Or_Operator => 1000,
- Iir_Kind_Nand_Operator => 1005,
- Iir_Kind_Nor_Operator => 1010,
- Iir_Kind_Xor_Operator => 1015,
- Iir_Kind_Xnor_Operator => 1020,
- Iir_Kind_Equality_Operator => 1025,
- Iir_Kind_Inequality_Operator => 1030,
- Iir_Kind_Less_Than_Operator => 1035,
- Iir_Kind_Less_Than_Or_Equal_Operator => 1040,
- Iir_Kind_Greater_Than_Operator => 1045,
- Iir_Kind_Greater_Than_Or_Equal_Operator => 1050,
- Iir_Kind_Match_Equality_Operator => 1055,
- Iir_Kind_Match_Inequality_Operator => 1060,
- Iir_Kind_Match_Less_Than_Operator => 1065,
- Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1070,
- Iir_Kind_Match_Greater_Than_Operator => 1075,
- Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1080,
- Iir_Kind_Sll_Operator => 1085,
- Iir_Kind_Sla_Operator => 1090,
- Iir_Kind_Srl_Operator => 1095,
- Iir_Kind_Sra_Operator => 1100,
- Iir_Kind_Rol_Operator => 1105,
- Iir_Kind_Ror_Operator => 1110,
- Iir_Kind_Addition_Operator => 1115,
- Iir_Kind_Substraction_Operator => 1120,
- Iir_Kind_Concatenation_Operator => 1125,
- Iir_Kind_Multiplication_Operator => 1130,
- Iir_Kind_Division_Operator => 1135,
- Iir_Kind_Modulus_Operator => 1140,
- Iir_Kind_Remainder_Operator => 1145,
- Iir_Kind_Exponentiation_Operator => 1150,
- Iir_Kind_Function_Call => 1158,
- Iir_Kind_Aggregate => 1164,
- Iir_Kind_Parenthesis_Expression => 1167,
- Iir_Kind_Qualified_Expression => 1171,
- Iir_Kind_Type_Conversion => 1176,
- Iir_Kind_Allocator_By_Expression => 1180,
- Iir_Kind_Allocator_By_Subtype => 1186,
- Iir_Kind_Selected_Element => 1192,
- Iir_Kind_Dereference => 1197,
- Iir_Kind_Implicit_Dereference => 1202,
- Iir_Kind_Slice_Name => 1209,
- Iir_Kind_Indexed_Name => 1215,
- Iir_Kind_Psl_Expression => 1217,
- Iir_Kind_Sensitized_Process_Statement => 1237,
- Iir_Kind_Process_Statement => 1257,
- Iir_Kind_Concurrent_Simple_Signal_Assignment => 1268,
- Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1279,
- Iir_Kind_Concurrent_Selected_Signal_Assignment => 1291,
- Iir_Kind_Concurrent_Assertion_Statement => 1299,
- Iir_Kind_Concurrent_Procedure_Call_Statement => 1306,
- Iir_Kind_Psl_Assert_Statement => 1319,
- Iir_Kind_Psl_Cover_Statement => 1332,
- Iir_Kind_Block_Statement => 1345,
- Iir_Kind_If_Generate_Statement => 1355,
- Iir_Kind_Case_Generate_Statement => 1364,
- Iir_Kind_For_Generate_Statement => 1373,
- Iir_Kind_Component_Instantiation_Statement => 1383,
- Iir_Kind_Psl_Default_Clock => 1387,
- Iir_Kind_Simple_Simultaneous_Statement => 1394,
- Iir_Kind_Generate_Statement_Body => 1405,
- Iir_Kind_If_Generate_Else_Clause => 1410,
- Iir_Kind_Simple_Signal_Assignment_Statement => 1419,
- Iir_Kind_Conditional_Signal_Assignment_Statement => 1428,
- Iir_Kind_Null_Statement => 1432,
- Iir_Kind_Assertion_Statement => 1439,
- Iir_Kind_Report_Statement => 1445,
- Iir_Kind_Wait_Statement => 1452,
- Iir_Kind_Variable_Assignment_Statement => 1458,
- Iir_Kind_Conditional_Variable_Assignment_Statement => 1464,
- Iir_Kind_Return_Statement => 1470,
- Iir_Kind_For_Loop_Statement => 1479,
- Iir_Kind_While_Loop_Statement => 1487,
- Iir_Kind_Next_Statement => 1493,
- Iir_Kind_Exit_Statement => 1499,
- Iir_Kind_Case_Statement => 1507,
- Iir_Kind_Procedure_Call_Statement => 1513,
- Iir_Kind_If_Statement => 1522,
- Iir_Kind_Elsif => 1527,
- Iir_Kind_Character_Literal => 1534,
- Iir_Kind_Simple_Name => 1541,
- Iir_Kind_Selected_Name => 1549,
- Iir_Kind_Operator_Symbol => 1554,
- Iir_Kind_Selected_By_All_Name => 1559,
- Iir_Kind_Parenthesis_Name => 1563,
- Iir_Kind_External_Constant_Name => 1572,
- Iir_Kind_External_Signal_Name => 1581,
- Iir_Kind_External_Variable_Name => 1590,
- Iir_Kind_Package_Pathname => 1593,
- Iir_Kind_Absolute_Pathname => 1594,
- Iir_Kind_Relative_Pathname => 1595,
- Iir_Kind_Pathname_Element => 1599,
- Iir_Kind_Base_Attribute => 1601,
- Iir_Kind_Left_Type_Attribute => 1606,
- Iir_Kind_Right_Type_Attribute => 1611,
- Iir_Kind_High_Type_Attribute => 1616,
- Iir_Kind_Low_Type_Attribute => 1621,
- Iir_Kind_Ascending_Type_Attribute => 1626,
- Iir_Kind_Image_Attribute => 1632,
- Iir_Kind_Value_Attribute => 1638,
- Iir_Kind_Pos_Attribute => 1644,
- Iir_Kind_Val_Attribute => 1650,
- Iir_Kind_Succ_Attribute => 1656,
- Iir_Kind_Pred_Attribute => 1662,
- Iir_Kind_Leftof_Attribute => 1668,
- Iir_Kind_Rightof_Attribute => 1674,
- Iir_Kind_Delayed_Attribute => 1682,
- Iir_Kind_Stable_Attribute => 1690,
- Iir_Kind_Quiet_Attribute => 1698,
- Iir_Kind_Transaction_Attribute => 1706,
- Iir_Kind_Event_Attribute => 1710,
- Iir_Kind_Active_Attribute => 1714,
- Iir_Kind_Last_Event_Attribute => 1718,
- Iir_Kind_Last_Active_Attribute => 1722,
- Iir_Kind_Last_Value_Attribute => 1726,
- Iir_Kind_Driving_Attribute => 1730,
- Iir_Kind_Driving_Value_Attribute => 1734,
- Iir_Kind_Behavior_Attribute => 1734,
- Iir_Kind_Structure_Attribute => 1734,
- Iir_Kind_Simple_Name_Attribute => 1741,
- Iir_Kind_Instance_Name_Attribute => 1746,
- Iir_Kind_Path_Name_Attribute => 1751,
- Iir_Kind_Left_Array_Attribute => 1758,
- Iir_Kind_Right_Array_Attribute => 1765,
- Iir_Kind_High_Array_Attribute => 1772,
- Iir_Kind_Low_Array_Attribute => 1779,
- Iir_Kind_Length_Array_Attribute => 1786,
- Iir_Kind_Ascending_Array_Attribute => 1793,
- Iir_Kind_Range_Array_Attribute => 1800,
- Iir_Kind_Reverse_Range_Array_Attribute => 1807,
- Iir_Kind_Attribute_Name => 1815
+ Iir_Kind_Access_Type_Definition => 246,
+ Iir_Kind_Incomplete_Type_Definition => 254,
+ Iir_Kind_Interface_Type_Definition => 261,
+ Iir_Kind_File_Type_Definition => 268,
+ Iir_Kind_Protected_Type_Declaration => 277,
+ Iir_Kind_Record_Type_Definition => 287,
+ Iir_Kind_Array_Type_Definition => 299,
+ Iir_Kind_Array_Subtype_Definition => 314,
+ Iir_Kind_Record_Subtype_Definition => 325,
+ Iir_Kind_Access_Subtype_Definition => 333,
+ Iir_Kind_Physical_Subtype_Definition => 342,
+ Iir_Kind_Floating_Subtype_Definition => 352,
+ Iir_Kind_Integer_Subtype_Definition => 361,
+ Iir_Kind_Enumeration_Subtype_Definition => 370,
+ Iir_Kind_Enumeration_Type_Definition => 379,
+ Iir_Kind_Integer_Type_Definition => 385,
+ Iir_Kind_Floating_Type_Definition => 391,
+ Iir_Kind_Physical_Type_Definition => 400,
+ Iir_Kind_Range_Expression => 408,
+ Iir_Kind_Protected_Type_Body => 415,
+ Iir_Kind_Wildcard_Type_Definition => 420,
+ Iir_Kind_Subtype_Definition => 424,
+ Iir_Kind_Scalar_Nature_Definition => 428,
+ Iir_Kind_Overload_List => 429,
+ Iir_Kind_Type_Declaration => 436,
+ Iir_Kind_Anonymous_Type_Declaration => 442,
+ Iir_Kind_Subtype_Declaration => 450,
+ Iir_Kind_Nature_Declaration => 456,
+ Iir_Kind_Subnature_Declaration => 462,
+ Iir_Kind_Package_Declaration => 477,
+ Iir_Kind_Package_Instantiation_Declaration => 489,
+ Iir_Kind_Package_Body => 497,
+ Iir_Kind_Configuration_Declaration => 506,
+ Iir_Kind_Entity_Declaration => 518,
+ Iir_Kind_Architecture_Body => 530,
+ Iir_Kind_Context_Declaration => 536,
+ Iir_Kind_Package_Header => 538,
+ Iir_Kind_Unit_Declaration => 547,
+ Iir_Kind_Library_Declaration => 554,
+ Iir_Kind_Component_Declaration => 564,
+ Iir_Kind_Attribute_Declaration => 571,
+ Iir_Kind_Group_Template_Declaration => 577,
+ Iir_Kind_Group_Declaration => 584,
+ Iir_Kind_Element_Declaration => 591,
+ Iir_Kind_Non_Object_Alias_Declaration => 599,
+ Iir_Kind_Psl_Declaration => 607,
+ Iir_Kind_Psl_Endpoint_Declaration => 621,
+ Iir_Kind_Terminal_Declaration => 627,
+ Iir_Kind_Free_Quantity_Declaration => 636,
+ Iir_Kind_Across_Quantity_Declaration => 648,
+ Iir_Kind_Through_Quantity_Declaration => 660,
+ Iir_Kind_Enumeration_Literal => 671,
+ Iir_Kind_Function_Declaration => 695,
+ Iir_Kind_Procedure_Declaration => 718,
+ Iir_Kind_Function_Body => 728,
+ Iir_Kind_Procedure_Body => 739,
+ Iir_Kind_Object_Alias_Declaration => 751,
+ Iir_Kind_File_Declaration => 766,
+ Iir_Kind_Guard_Signal_Declaration => 779,
+ Iir_Kind_Signal_Declaration => 796,
+ Iir_Kind_Variable_Declaration => 809,
+ Iir_Kind_Constant_Declaration => 823,
+ Iir_Kind_Iterator_Declaration => 835,
+ Iir_Kind_Interface_Constant_Declaration => 851,
+ Iir_Kind_Interface_Variable_Declaration => 867,
+ Iir_Kind_Interface_Signal_Declaration => 888,
+ Iir_Kind_Interface_File_Declaration => 904,
+ Iir_Kind_Interface_Type_Declaration => 914,
+ Iir_Kind_Interface_Package_Declaration => 924,
+ Iir_Kind_Interface_Function_Declaration => 940,
+ Iir_Kind_Interface_Procedure_Declaration => 952,
+ Iir_Kind_Identity_Operator => 956,
+ Iir_Kind_Negation_Operator => 960,
+ Iir_Kind_Absolute_Operator => 964,
+ Iir_Kind_Not_Operator => 968,
+ Iir_Kind_Condition_Operator => 972,
+ Iir_Kind_Reduction_And_Operator => 976,
+ Iir_Kind_Reduction_Or_Operator => 980,
+ Iir_Kind_Reduction_Nand_Operator => 984,
+ Iir_Kind_Reduction_Nor_Operator => 988,
+ Iir_Kind_Reduction_Xor_Operator => 992,
+ Iir_Kind_Reduction_Xnor_Operator => 996,
+ Iir_Kind_And_Operator => 1001,
+ Iir_Kind_Or_Operator => 1006,
+ Iir_Kind_Nand_Operator => 1011,
+ Iir_Kind_Nor_Operator => 1016,
+ Iir_Kind_Xor_Operator => 1021,
+ Iir_Kind_Xnor_Operator => 1026,
+ Iir_Kind_Equality_Operator => 1031,
+ Iir_Kind_Inequality_Operator => 1036,
+ Iir_Kind_Less_Than_Operator => 1041,
+ Iir_Kind_Less_Than_Or_Equal_Operator => 1046,
+ Iir_Kind_Greater_Than_Operator => 1051,
+ Iir_Kind_Greater_Than_Or_Equal_Operator => 1056,
+ Iir_Kind_Match_Equality_Operator => 1061,
+ Iir_Kind_Match_Inequality_Operator => 1066,
+ Iir_Kind_Match_Less_Than_Operator => 1071,
+ Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1076,
+ Iir_Kind_Match_Greater_Than_Operator => 1081,
+ Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1086,
+ Iir_Kind_Sll_Operator => 1091,
+ Iir_Kind_Sla_Operator => 1096,
+ Iir_Kind_Srl_Operator => 1101,
+ Iir_Kind_Sra_Operator => 1106,
+ Iir_Kind_Rol_Operator => 1111,
+ Iir_Kind_Ror_Operator => 1116,
+ Iir_Kind_Addition_Operator => 1121,
+ Iir_Kind_Substraction_Operator => 1126,
+ Iir_Kind_Concatenation_Operator => 1131,
+ Iir_Kind_Multiplication_Operator => 1136,
+ Iir_Kind_Division_Operator => 1141,
+ Iir_Kind_Modulus_Operator => 1146,
+ Iir_Kind_Remainder_Operator => 1151,
+ Iir_Kind_Exponentiation_Operator => 1156,
+ Iir_Kind_Function_Call => 1164,
+ Iir_Kind_Aggregate => 1170,
+ Iir_Kind_Parenthesis_Expression => 1173,
+ Iir_Kind_Qualified_Expression => 1177,
+ Iir_Kind_Type_Conversion => 1182,
+ Iir_Kind_Allocator_By_Expression => 1186,
+ Iir_Kind_Allocator_By_Subtype => 1192,
+ Iir_Kind_Selected_Element => 1198,
+ Iir_Kind_Dereference => 1203,
+ Iir_Kind_Implicit_Dereference => 1208,
+ Iir_Kind_Slice_Name => 1215,
+ Iir_Kind_Indexed_Name => 1221,
+ Iir_Kind_Psl_Expression => 1223,
+ Iir_Kind_Sensitized_Process_Statement => 1243,
+ Iir_Kind_Process_Statement => 1263,
+ Iir_Kind_Concurrent_Simple_Signal_Assignment => 1274,
+ Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1285,
+ Iir_Kind_Concurrent_Selected_Signal_Assignment => 1297,
+ Iir_Kind_Concurrent_Assertion_Statement => 1305,
+ Iir_Kind_Concurrent_Procedure_Call_Statement => 1312,
+ Iir_Kind_Psl_Assert_Statement => 1325,
+ Iir_Kind_Psl_Cover_Statement => 1338,
+ Iir_Kind_Block_Statement => 1351,
+ Iir_Kind_If_Generate_Statement => 1361,
+ Iir_Kind_Case_Generate_Statement => 1370,
+ Iir_Kind_For_Generate_Statement => 1379,
+ Iir_Kind_Component_Instantiation_Statement => 1389,
+ Iir_Kind_Psl_Default_Clock => 1393,
+ Iir_Kind_Simple_Simultaneous_Statement => 1400,
+ Iir_Kind_Generate_Statement_Body => 1411,
+ Iir_Kind_If_Generate_Else_Clause => 1416,
+ Iir_Kind_Simple_Signal_Assignment_Statement => 1425,
+ Iir_Kind_Conditional_Signal_Assignment_Statement => 1434,
+ Iir_Kind_Null_Statement => 1438,
+ Iir_Kind_Assertion_Statement => 1445,
+ Iir_Kind_Report_Statement => 1451,
+ Iir_Kind_Wait_Statement => 1458,
+ Iir_Kind_Variable_Assignment_Statement => 1464,
+ Iir_Kind_Conditional_Variable_Assignment_Statement => 1470,
+ Iir_Kind_Return_Statement => 1476,
+ Iir_Kind_For_Loop_Statement => 1485,
+ Iir_Kind_While_Loop_Statement => 1493,
+ Iir_Kind_Next_Statement => 1499,
+ Iir_Kind_Exit_Statement => 1505,
+ Iir_Kind_Case_Statement => 1513,
+ Iir_Kind_Procedure_Call_Statement => 1519,
+ Iir_Kind_If_Statement => 1528,
+ Iir_Kind_Elsif => 1533,
+ Iir_Kind_Character_Literal => 1540,
+ Iir_Kind_Simple_Name => 1547,
+ Iir_Kind_Selected_Name => 1555,
+ Iir_Kind_Operator_Symbol => 1560,
+ Iir_Kind_Selected_By_All_Name => 1565,
+ Iir_Kind_Parenthesis_Name => 1569,
+ Iir_Kind_External_Constant_Name => 1578,
+ Iir_Kind_External_Signal_Name => 1587,
+ Iir_Kind_External_Variable_Name => 1596,
+ Iir_Kind_Package_Pathname => 1599,
+ Iir_Kind_Absolute_Pathname => 1600,
+ Iir_Kind_Relative_Pathname => 1601,
+ Iir_Kind_Pathname_Element => 1605,
+ Iir_Kind_Base_Attribute => 1607,
+ Iir_Kind_Left_Type_Attribute => 1612,
+ Iir_Kind_Right_Type_Attribute => 1617,
+ Iir_Kind_High_Type_Attribute => 1622,
+ Iir_Kind_Low_Type_Attribute => 1627,
+ Iir_Kind_Ascending_Type_Attribute => 1632,
+ Iir_Kind_Image_Attribute => 1638,
+ Iir_Kind_Value_Attribute => 1644,
+ Iir_Kind_Pos_Attribute => 1650,
+ Iir_Kind_Val_Attribute => 1656,
+ Iir_Kind_Succ_Attribute => 1662,
+ Iir_Kind_Pred_Attribute => 1668,
+ Iir_Kind_Leftof_Attribute => 1674,
+ Iir_Kind_Rightof_Attribute => 1680,
+ Iir_Kind_Delayed_Attribute => 1688,
+ Iir_Kind_Stable_Attribute => 1696,
+ Iir_Kind_Quiet_Attribute => 1704,
+ Iir_Kind_Transaction_Attribute => 1712,
+ Iir_Kind_Event_Attribute => 1716,
+ Iir_Kind_Active_Attribute => 1720,
+ Iir_Kind_Last_Event_Attribute => 1724,
+ Iir_Kind_Last_Active_Attribute => 1728,
+ Iir_Kind_Last_Value_Attribute => 1732,
+ Iir_Kind_Driving_Attribute => 1736,
+ Iir_Kind_Driving_Value_Attribute => 1740,
+ Iir_Kind_Behavior_Attribute => 1740,
+ Iir_Kind_Structure_Attribute => 1740,
+ Iir_Kind_Simple_Name_Attribute => 1747,
+ Iir_Kind_Instance_Name_Attribute => 1752,
+ Iir_Kind_Path_Name_Attribute => 1757,
+ Iir_Kind_Left_Array_Attribute => 1764,
+ Iir_Kind_Right_Array_Attribute => 1771,
+ Iir_Kind_High_Array_Attribute => 1778,
+ Iir_Kind_Low_Array_Attribute => 1785,
+ Iir_Kind_Length_Array_Attribute => 1792,
+ Iir_Kind_Ascending_Array_Attribute => 1799,
+ Iir_Kind_Range_Array_Attribute => 1806,
+ Iir_Kind_Reverse_Range_Array_Attribute => 1813,
+ Iir_Kind_Attribute_Name => 1821
);
function Get_Fields (K : Iir_Kind) return Fields_Array
@@ -4930,6 +4956,8 @@ package body Nodes_Meta is
return Get_Type_Definition (N);
when Field_Subtype_Definition =>
return Get_Subtype_Definition (N);
+ when Field_Incomplete_Type_Declaration =>
+ return Get_Incomplete_Type_Declaration (N);
when Field_Interface_Type_Subprograms =>
return Get_Interface_Type_Subprograms (N);
when Field_Nature =>
@@ -4974,6 +5002,10 @@ package body Nodes_Meta is
return Get_Selected_Name (N);
when Field_Type_Declarator =>
return Get_Type_Declarator (N);
+ when Field_Complete_Type_Definition =>
+ return Get_Complete_Type_Definition (N);
+ when Field_Incomplete_Type_Ref_Chain =>
+ return Get_Incomplete_Type_Ref_Chain (N);
when Field_Associated_Type =>
return Get_Associated_Type (N);
when Field_Entity_Class_Entry_Chain =>
@@ -4988,6 +5020,10 @@ package body Nodes_Meta is
return Get_Left_Limit (N);
when Field_Right_Limit =>
return Get_Right_Limit (N);
+ when Field_Left_Limit_Expr =>
+ return Get_Left_Limit_Expr (N);
+ when Field_Right_Limit_Expr =>
+ return Get_Right_Limit_Expr (N);
when Field_Base_Type =>
return Get_Base_Type (N);
when Field_Resolution_Indication =>
@@ -5308,6 +5344,8 @@ package body Nodes_Meta is
Set_Type_Definition (N, V);
when Field_Subtype_Definition =>
Set_Subtype_Definition (N, V);
+ when Field_Incomplete_Type_Declaration =>
+ Set_Incomplete_Type_Declaration (N, V);
when Field_Interface_Type_Subprograms =>
Set_Interface_Type_Subprograms (N, V);
when Field_Nature =>
@@ -5352,6 +5390,10 @@ package body Nodes_Meta is
Set_Selected_Name (N, V);
when Field_Type_Declarator =>
Set_Type_Declarator (N, V);
+ when Field_Complete_Type_Definition =>
+ Set_Complete_Type_Definition (N, V);
+ when Field_Incomplete_Type_Ref_Chain =>
+ Set_Incomplete_Type_Ref_Chain (N, V);
when Field_Associated_Type =>
Set_Associated_Type (N, V);
when Field_Entity_Class_Entry_Chain =>
@@ -5366,6 +5408,10 @@ package body Nodes_Meta is
Set_Left_Limit (N, V);
when Field_Right_Limit =>
Set_Right_Limit (N, V);
+ when Field_Left_Limit_Expr =>
+ Set_Left_Limit_Expr (N, V);
+ when Field_Right_Limit_Expr =>
+ Set_Right_Limit_Expr (N, V);
when Field_Base_Type =>
Set_Base_Type (N, V);
when Field_Resolution_Indication =>
@@ -5828,8 +5874,6 @@ package body Nodes_Meta is
return Get_Guard_Sensitivity_List (N);
when Field_Instantiation_List =>
return Get_Instantiation_List (N);
- when Field_Incomplete_Type_List =>
- return Get_Incomplete_Type_List (N);
when Field_Type_Marks_List =>
return Get_Type_Marks_List (N);
when Field_Overload_List =>
@@ -5880,8 +5924,6 @@ package body Nodes_Meta is
Set_Guard_Sensitivity_List (N, V);
when Field_Instantiation_List =>
Set_Instantiation_List (N, V);
- when Field_Incomplete_Type_List =>
- Set_Incomplete_Type_List (N, V);
when Field_Type_Marks_List =>
Set_Type_Marks_List (N, V);
when Field_Overload_List =>
@@ -7256,6 +7298,17 @@ package body Nodes_Meta is
return K = Iir_Kind_Anonymous_Type_Declaration;
end Has_Subtype_Definition;
+ function Has_Incomplete_Type_Declaration (K : Iir_Kind) return Boolean is
+ begin
+ case K is
+ when Iir_Kind_Type_Declaration
+ | Iir_Kind_Anonymous_Type_Declaration =>
+ return True;
+ when others =>
+ return False;
+ end case;
+ end Has_Incomplete_Type_Declaration;
+
function Has_Interface_Type_Subprograms (K : Iir_Kind) return Boolean is
begin
return K = Iir_Kind_Interface_Type_Declaration;
@@ -7660,6 +7713,22 @@ package body Nodes_Meta is
end case;
end Has_Type_Declarator;
+ function Has_Complete_Type_Definition (K : Iir_Kind) return Boolean is
+ begin
+ return K = Iir_Kind_Incomplete_Type_Definition;
+ end Has_Complete_Type_Definition;
+
+ function Has_Incomplete_Type_Ref_Chain (K : Iir_Kind) return Boolean is
+ begin
+ case K is
+ when Iir_Kind_Access_Type_Definition
+ | Iir_Kind_Incomplete_Type_Definition =>
+ return True;
+ when others =>
+ return False;
+ end case;
+ end Has_Incomplete_Type_Ref_Chain;
+
function Has_Associated_Type (K : Iir_Kind) return Boolean is
begin
return K = Iir_Kind_Interface_Type_Definition;
@@ -7943,6 +8012,16 @@ package body Nodes_Meta is
return K = Iir_Kind_Range_Expression;
end Has_Right_Limit;
+ function Has_Left_Limit_Expr (K : Iir_Kind) return Boolean is
+ begin
+ return K = Iir_Kind_Range_Expression;
+ end Has_Left_Limit_Expr;
+
+ function Has_Right_Limit_Expr (K : Iir_Kind) return Boolean is
+ begin
+ return K = Iir_Kind_Range_Expression;
+ end Has_Right_Limit_Expr;
+
function Has_Base_Type (K : Iir_Kind) return Boolean is
begin
case K is
@@ -9751,11 +9830,6 @@ package body Nodes_Meta is
end case;
end Has_Return_Type_Mark;
- function Has_Incomplete_Type_List (K : Iir_Kind) return Boolean is
- begin
- return K = Iir_Kind_Incomplete_Type_Definition;
- end Has_Incomplete_Type_List;
-
function Has_Has_Disconnect_Flag (K : Iir_Kind) return Boolean is
begin
case K is
diff --git a/src/vhdl/nodes_meta.ads b/src/vhdl/nodes_meta.ads
index c31d87ea7..4d1cb3710 100644
--- a/src/vhdl/nodes_meta.ads
+++ b/src/vhdl/nodes_meta.ads
@@ -147,6 +147,7 @@ package Nodes_Meta is
Field_Discrete_Range,
Field_Type_Definition,
Field_Subtype_Definition,
+ Field_Incomplete_Type_Declaration,
Field_Interface_Type_Subprograms,
Field_Nature,
Field_Mode,
@@ -180,6 +181,8 @@ package Nodes_Meta is
Field_Context_Reference_Chain,
Field_Selected_Name,
Field_Type_Declarator,
+ Field_Complete_Type_Definition,
+ Field_Incomplete_Type_Ref_Chain,
Field_Associated_Type,
Field_Enumeration_Literal_List,
Field_Entity_Class_Entry_Chain,
@@ -193,6 +196,8 @@ package Nodes_Meta is
Field_Direction,
Field_Left_Limit,
Field_Right_Limit,
+ Field_Left_Limit_Expr,
+ Field_Right_Limit_Expr,
Field_Base_Type,
Field_Resolution_Indication,
Field_Record_Element_Resolution_Chain,
@@ -331,7 +336,6 @@ package Nodes_Meta is
Field_Type_Mark,
Field_File_Type_Mark,
Field_Return_Type_Mark,
- Field_Incomplete_Type_List,
Field_Has_Disconnect_Flag,
Field_Has_Active_Flag,
Field_Is_Within_Flag,
@@ -386,7 +390,7 @@ package Nodes_Meta is
type Field_Attribute is
(
Attr_None,
- Attr_Ref, Attr_Maybe_Ref, Attr_Of_Ref,
+ Attr_Ref, Attr_Maybe_Ref, Attr_Of_Ref, Attr_Forward_Ref,
Attr_Chain, Attr_Chain_Next
);
@@ -641,6 +645,7 @@ package Nodes_Meta is
function Has_Discrete_Range (K : Iir_Kind) return Boolean;
function Has_Type_Definition (K : Iir_Kind) return Boolean;
function Has_Subtype_Definition (K : Iir_Kind) return Boolean;
+ function Has_Incomplete_Type_Declaration (K : Iir_Kind) return Boolean;
function Has_Interface_Type_Subprograms (K : Iir_Kind) return Boolean;
function Has_Nature (K : Iir_Kind) return Boolean;
function Has_Mode (K : Iir_Kind) return Boolean;
@@ -674,6 +679,8 @@ package Nodes_Meta is
function Has_Context_Reference_Chain (K : Iir_Kind) return Boolean;
function Has_Selected_Name (K : Iir_Kind) return Boolean;
function Has_Type_Declarator (K : Iir_Kind) return Boolean;
+ function Has_Complete_Type_Definition (K : Iir_Kind) return Boolean;
+ function Has_Incomplete_Type_Ref_Chain (K : Iir_Kind) return Boolean;
function Has_Associated_Type (K : Iir_Kind) return Boolean;
function Has_Enumeration_Literal_List (K : Iir_Kind) return Boolean;
function Has_Entity_Class_Entry_Chain (K : Iir_Kind) return Boolean;
@@ -687,6 +694,8 @@ package Nodes_Meta is
function Has_Direction (K : Iir_Kind) return Boolean;
function Has_Left_Limit (K : Iir_Kind) return Boolean;
function Has_Right_Limit (K : Iir_Kind) return Boolean;
+ function Has_Left_Limit_Expr (K : Iir_Kind) return Boolean;
+ function Has_Right_Limit_Expr (K : Iir_Kind) return Boolean;
function Has_Base_Type (K : Iir_Kind) return Boolean;
function Has_Resolution_Indication (K : Iir_Kind) return Boolean;
function Has_Record_Element_Resolution_Chain (K : Iir_Kind)
@@ -832,7 +841,6 @@ package Nodes_Meta is
function Has_Type_Mark (K : Iir_Kind) return Boolean;
function Has_File_Type_Mark (K : Iir_Kind) return Boolean;
function Has_Return_Type_Mark (K : Iir_Kind) return Boolean;
- function Has_Incomplete_Type_List (K : Iir_Kind) return Boolean;
function Has_Has_Disconnect_Flag (K : Iir_Kind) return Boolean;
function Has_Has_Active_Flag (K : Iir_Kind) return Boolean;
function Has_Is_Within_Flag (K : Iir_Kind) return Boolean;
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index 00ec78fb8..1bcb66e78 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -291,7 +291,7 @@ package body Parse is
Res : Iir;
begin
Res := Create_Iir (Iir_Kind_Range_Expression);
- Set_Left_Limit (Res, Left);
+ Set_Left_Limit_Expr (Res, Left);
Location_Copy (Res, Left);
case Current_Token is
@@ -306,7 +306,7 @@ package body Parse is
-- Skip TO or DOWNTO.
Scan;
- Set_Right_Limit (Res, Parse_Simple_Expression);
+ Set_Right_Limit_Expr (Res, Parse_Simple_Expression);
return Res;
end Parse_Range_Expression;
diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb
index 3fd25927e..2d2dce858 100644
--- a/src/vhdl/sem_decls.adb
+++ b/src/vhdl/sem_decls.adb
@@ -1476,6 +1476,7 @@ package body Sem_Decls is
end if;
end Create_Implicit_Operations;
+ -- Analyze a type or an anonymous type declaration.
procedure Sem_Type_Declaration (Decl: Iir; Is_Global : Boolean)
is
Def: Iir;
@@ -1495,6 +1496,8 @@ package body Sem_Decls is
Iir_Kind_Incomplete_Type_Definition)
then
Old_Decl := Null_Iir;
+ else
+ Set_Incomplete_Type_Declaration (Decl, Old_Decl);
end if;
else
Old_Decl := Null_Iir;
@@ -1503,6 +1506,8 @@ package body Sem_Decls is
if Old_Decl = Null_Iir then
if Get_Kind (Decl) = Iir_Kind_Type_Declaration then
-- This is necessary at least for enumeration type definition.
+ -- Type declaration for anonymous types don't have name, only
+ -- their subtype have names. Those are added later.
Sem_Scopes.Add_Name (Decl);
end if;
else
@@ -1524,107 +1529,105 @@ package body Sem_Decls is
Set_Signal_Type_Flag (Def, True);
Set_Type_Declarator (Def, Decl);
Set_Visible_Flag (Decl, True);
- Set_Incomplete_Type_List (Def, Create_Iir_List);
+ Xref_Decl (Decl);
+
+ return;
+
+ end if;
+
+ -- A complete type declaration.
+ if Old_Decl = Null_Iir then
Xref_Decl (Decl);
else
- -- A complete type declaration.
- if Old_Decl = Null_Iir then
- Xref_Decl (Decl);
- else
- Xref_Body (Decl, Old_Decl);
- end if;
+ Xref_Body (Decl, Old_Decl);
+ end if;
- Def := Sem_Type_Definition (Def, Decl);
+ Def := Sem_Type_Definition (Def, Decl);
+ if Def = Null_Iir then
+ return;
+ end if;
- if Def /= Null_Iir then
- case Get_Kind (Def) is
- when Iir_Kind_Integer_Subtype_Definition
- | Iir_Kind_Floating_Subtype_Definition
- | Iir_Kind_Physical_Subtype_Definition
- | Iir_Kind_Array_Subtype_Definition =>
- -- Some type declaration are in fact subtype declarations.
- St_Decl := Create_Iir (Iir_Kind_Subtype_Declaration);
- Location_Copy (St_Decl, Decl);
- Set_Identifier (St_Decl, Get_Identifier (Decl));
- Set_Parent (St_Decl, Get_Parent (Decl));
- Set_Type (St_Decl, Def);
- Set_Type_Declarator (Def, St_Decl);
- Set_Chain (St_Decl, Get_Chain (Decl));
- Set_Chain (Decl, St_Decl);
-
- -- The type declaration declares the base type.
- Bt_Def := Get_Base_Type (Def);
- Set_Type_Definition (Decl, Bt_Def);
- Set_Type_Declarator (Bt_Def, Decl);
- Set_Subtype_Definition (Decl, Def);
-
- if Old_Decl = Null_Iir then
- Sem_Scopes.Add_Name (St_Decl);
- else
- Replace_Name (Get_Identifier (Decl), Old_Decl, St_Decl);
- Set_Type_Declarator
- (Get_Type_Definition (Old_Decl), St_Decl);
- end if;
+ case Get_Kind (Def) is
+ when Iir_Kind_Integer_Subtype_Definition
+ | Iir_Kind_Floating_Subtype_Definition
+ | Iir_Kind_Physical_Subtype_Definition
+ | Iir_Kind_Array_Subtype_Definition =>
+ -- Some type declaration are in fact subtype declarations.
+ St_Decl := Create_Iir (Iir_Kind_Subtype_Declaration);
+ Location_Copy (St_Decl, Decl);
+ Set_Identifier (St_Decl, Get_Identifier (Decl));
+ Set_Parent (St_Decl, Get_Parent (Decl));
+ Set_Type (St_Decl, Def);
+ Set_Type_Declarator (Def, St_Decl);
+ Set_Chain (St_Decl, Get_Chain (Decl));
+ Set_Chain (Decl, St_Decl);
+
+ -- The type declaration declares the base type.
+ Bt_Def := Get_Base_Type (Def);
+ Set_Type_Definition (Decl, Bt_Def);
+ Set_Type_Declarator (Bt_Def, Decl);
+ Set_Subtype_Definition (Decl, Def);
+
+ if Old_Decl = Null_Iir then
+ Sem_Scopes.Add_Name (St_Decl);
+ end if;
- Sem_Scopes.Name_Visible (St_Decl);
+ Sem_Scopes.Name_Visible (St_Decl);
- -- The implicit subprogram will be added in the
- -- scope just after.
- Create_Implicit_Operations (Decl, False);
+ -- The implicit subprogram will be added in the
+ -- scope just after.
+ Create_Implicit_Operations (Decl, False);
- when Iir_Kind_Enumeration_Type_Definition
- | Iir_Kind_Array_Type_Definition
- | Iir_Kind_Record_Type_Definition
- | Iir_Kind_Access_Type_Definition
- | Iir_Kind_File_Type_Definition =>
- St_Decl := Null_Iir;
- Set_Type_Declarator (Def, Decl);
+ when Iir_Kind_Enumeration_Type_Definition
+ | Iir_Kind_Array_Type_Definition
+ | Iir_Kind_Record_Type_Definition
+ | Iir_Kind_Access_Type_Definition
+ | Iir_Kind_File_Type_Definition =>
+ St_Decl := Null_Iir;
+ Set_Type_Declarator (Def, Decl);
- Sem_Scopes.Name_Visible (Decl);
+ Sem_Scopes.Name_Visible (Decl);
- -- The implicit subprogram will be added in the
- -- scope just after.
- Create_Implicit_Operations (Decl, False);
+ -- The implicit subprogram will be added in the
+ -- scope just after.
+ Create_Implicit_Operations (Decl, False);
- when Iir_Kind_Protected_Type_Declaration =>
- Set_Type_Declarator (Def, Decl);
- St_Decl := Null_Iir;
- -- No implicit subprograms.
+ when Iir_Kind_Protected_Type_Declaration =>
+ Set_Type_Declarator (Def, Decl);
+ St_Decl := Null_Iir;
+ -- No implicit subprograms.
- when others =>
- Error_Kind ("sem_type_declaration", Def);
- end case;
+ when others =>
+ Error_Kind ("sem_type_declaration", Def);
+ end case;
- if Old_Decl /= Null_Iir then
- -- Complete the type definition.
- declare
- List : Iir_List;
- El : Iir;
- Old_Def : Iir;
- begin
- Old_Def := Get_Type_Definition (Old_Decl);
- Set_Signal_Type_Flag (Old_Def, Get_Signal_Type_Flag (Def));
- List := Get_Incomplete_Type_List (Old_Def);
- for I in Natural loop
- El := Get_Nth_Element (List, I);
- exit when El = Null_Iir;
- Set_Designated_Type (El, Def);
- end loop;
- -- Complete the incomplete_type_definition node
- -- (set type_declarator and base_type).
-
- Set_Base_Type (Old_Def, Get_Base_Type (Def));
- if St_Decl = Null_Iir then
- Set_Type_Declarator (Old_Def, Decl);
- Replace_Name (Get_Identifier (Decl), Old_Decl, Decl);
- end if;
- end;
+ if Old_Decl /= Null_Iir then
+ -- Complete the type definition.
+ declare
+ Old_Def : constant Iir := Get_Type_Definition (Old_Decl);
+ Ref : Iir;
+ begin
+ Set_Signal_Type_Flag (Old_Def, Get_Signal_Type_Flag (Def));
+ Ref := Get_Incomplete_Type_Ref_Chain (Old_Def);
+ while Is_Valid (Ref) loop
+ pragma Assert
+ (Get_Kind (Ref) = Iir_Kind_Access_Type_Definition);
+ Set_Designated_Type (Ref, Def);
+ Ref := Get_Incomplete_Type_Ref_Chain (Ref);
+ end loop;
+ Set_Complete_Type_Definition (Old_Def, Def);
+
+ -- The identifier now designates the complete type declaration.
+ if St_Decl = Null_Iir then
+ Replace_Name (Get_Identifier (Decl), Old_Decl, Decl);
+ else
+ Replace_Name (Get_Identifier (Decl), Old_Decl, St_Decl);
end if;
+ end;
+ end if;
- if Is_Global then
- Set_Type_Has_Signal (Def);
- end if;
- end if;
+ if Is_Global then
+ Set_Type_Has_Signal (Def);
end if;
end Sem_Type_Declaration;
@@ -3125,11 +3128,10 @@ package body Sem_Decls is
end if;
when Iir_Kind_Type_Declaration =>
declare
- Def : Iir;
+ Def : constant Iir := Get_Type_Definition (El);
begin
- Def := Get_Type_Definition (El);
if Get_Kind (Def) = Iir_Kind_Incomplete_Type_Definition
- and then Get_Type_Declarator (Def) = El
+ and then Is_Null (Get_Complete_Type_Definition (Def))
then
Error_Msg_Sem
(+El, "missing full type declaration for %n", +El);
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index 027ed5e20..925c06826 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -553,8 +553,8 @@ package body Sem_Expr is
Expr_Type : Iir;
begin
Expr_Type := Get_Type (Expr);
- Left := Get_Left_Limit (Expr);
- Right := Get_Right_Limit (Expr);
+ Left := Get_Left_Limit_Expr (Expr);
+ Right := Get_Right_Limit_Expr (Expr);
if Expr_Type = Null_Iir then
-- Pass 1.
@@ -659,8 +659,13 @@ package body Sem_Expr is
Left := Eval_Expr_If_Static (Left);
Right := Eval_Expr_If_Static (Right);
+
+ Set_Left_Limit_Expr (Expr, Left);
+ Set_Right_Limit_Expr (Expr, Right);
+
Set_Left_Limit (Expr, Left);
Set_Right_Limit (Expr, Right);
+
Set_Expr_Staticness (Expr, Min (Get_Expr_Staticness (Left),
Get_Expr_Staticness (Right)));
diff --git a/src/vhdl/sem_inst.adb b/src/vhdl/sem_inst.adb
index d649c0ab4..df3a9781e 100644
--- a/src/vhdl/sem_inst.adb
+++ b/src/vhdl/sem_inst.adb
@@ -406,8 +406,66 @@ package body Sem_Inst is
Set_Subprogram_Body (Spec, Res);
end;
- when Field_Incomplete_Type_List =>
+ when Field_Incomplete_Type_Ref_Chain =>
+ if Get_Kind (Res) = Iir_Kind_Access_Type_Definition then
+ -- Link
+ declare
+ Def : constant Iir := Get_Named_Entity
+ (Get_Designated_Subtype_Indication (Res));
+ begin
+ if Get_Kind (Def) = Iir_Kind_Incomplete_Type_Definition
+ then
+ Set_Incomplete_Type_Ref_Chain
+ (Res, Get_Incomplete_Type_Ref_Chain (Def));
+ Set_Incomplete_Type_Ref_Chain (Def, Res);
+ end if;
+ end;
+ end if;
+
+ when Field_Designated_Type =>
null;
+ when Field_Designated_Subtype_Indication =>
+ Instantiate_Iir_Field (Res, N, F);
+ -- The designated type will be patched later if it is an
+ -- incomplete type definition
+ Set_Designated_Type
+ (Res, Get_Type (Get_Designated_Subtype_Indication (Res)));
+ when Field_Complete_Type_Definition =>
+ -- Will be set by the declaration of the complete type
+ null;
+ when Field_Incomplete_Type_Declaration =>
+ Instantiate_Iir_Field (Res, N, F);
+ declare
+ Res_Decl : constant Iir :=
+ Get_Incomplete_Type_Declaration (Res);
+ N_Decl : constant Iir :=
+ Get_Incomplete_Type_Declaration (N);
+ Res_Complete : Iir;
+ N_Def, Res_Def : Iir;
+ N_El, Next_N_El : Iir;
+ Res_El, Next_Res_El : Iir;
+ begin
+ if Is_Valid (N_Decl) then
+ -- N/RES completes a type declaration.
+ N_Def := Get_Type_Definition (N_Decl);
+ Res_Def := Get_Type_Definition (Res_Decl);
+ -- Set Complete_Type_Definition
+ Res_Complete := Get_Type (Res);
+ Set_Complete_Type_Definition (Res_Def, Res_Complete);
+ -- Rebuild the list and patch designated types
+ N_El := N_Def;
+ Res_El := Res_Def;
+ loop
+ Next_N_El := Get_Incomplete_Type_Ref_Chain (N_El);
+ exit when Is_Null (Next_N_El);
+ Next_Res_El := Get_Instance (Next_N_El);
+ Set_Designated_Type (Next_Res_El, Res_Complete);
+ Set_Incomplete_Type_Ref_Chain (Res_El, Next_Res_El);
+ N_El := Next_N_El;
+ end loop;
+ end if;
+ end;
+
when others =>
-- Common case.
diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb
index abb1373a1..edb18d16e 100644
--- a/src/vhdl/sem_types.adb
+++ b/src/vhdl/sem_types.adb
@@ -129,8 +129,8 @@ package body Sem_Types is
Left, Right: Iir;
Bt_L_Kind, Bt_R_Kind : Iir_Kind;
begin
- Left := Sem_Expression_Universal (Get_Left_Limit (Expr));
- Right := Sem_Expression_Universal (Get_Right_Limit (Expr));
+ Left := Sem_Expression_Universal (Get_Left_Limit_Expr (Expr));
+ Right := Sem_Expression_Universal (Get_Right_Limit_Expr (Expr));
if Left = Null_Iir or Right = Null_Iir then
return Null_Iir;
end if;
@@ -147,6 +147,8 @@ package body Sem_Types is
Right := Build_Extreme_Value
(Get_Direction (Expr) = Iir_To, Right);
end if;
+ Set_Left_Limit_Expr (Expr, Left);
+ Set_Right_Limit_Expr (Expr, Right);
Set_Left_Limit (Expr, Left);
Set_Right_Limit (Expr, Right);
@@ -396,16 +398,19 @@ package body Sem_Types is
end Lit_To_Phys_Lit;
Phys_Range : Iir_Range_Expression;
+ Lit : Iir;
begin
-- Create the physical range.
Phys_Range := Create_Iir (Iir_Kind_Range_Expression);
Location_Copy (Phys_Range, Range_Expr1);
Set_Type (Phys_Range, Def);
Set_Direction (Phys_Range, Get_Direction (Range_Expr1));
- Set_Left_Limit
- (Phys_Range, Lit_To_Phys_Lit (Get_Left_Limit (Range_Expr1)));
- Set_Right_Limit
- (Phys_Range, Lit_To_Phys_Lit (Get_Right_Limit (Range_Expr1)));
+ Lit := Lit_To_Phys_Lit (Get_Left_Limit (Range_Expr1));
+ Set_Left_Limit (Phys_Range, Lit);
+ Set_Left_Limit_Expr (Phys_Range, Lit);
+ Lit := Lit_To_Phys_Lit (Get_Right_Limit (Range_Expr1));
+ Set_Right_Limit (Phys_Range, Lit);
+ Set_Right_Limit_Expr (Phys_Range, Lit);
Set_Expr_Staticness
(Phys_Range, Get_Expr_Staticness (Range_Expr1));
@@ -1048,7 +1053,10 @@ package body Sem_Types is
if D_Type /= Null_Iir then
case Get_Kind (D_Type) is
when Iir_Kind_Incomplete_Type_Definition =>
- Append_Element (Get_Incomplete_Type_List (D_Type), Def);
+ -- Append on the chain of incomplete type ref
+ Set_Incomplete_Type_Ref_Chain
+ (Def, Get_Incomplete_Type_Ref_Chain (D_Type));
+ Set_Incomplete_Type_Ref_Chain (D_Type, Def);
when Iir_Kind_File_Type_Definition =>
-- LRM 3.3
-- The designated type must not be a file type.
diff --git a/src/vhdl/std_package.adb b/src/vhdl/std_package.adb
index a52c2be8c..8143d9c63 100644
--- a/src/vhdl/std_package.adb
+++ b/src/vhdl/std_package.adb
@@ -143,8 +143,10 @@ package body Std_Package is
begin
Res := Create_Std_Iir (Iir_Kind_Range_Expression);
Set_Left_Limit (Res, Left);
+ Set_Left_Limit_Expr (Res, Left);
Set_Direction (Res, Iir_To);
Set_Right_Limit (Res, Right);
+ Set_Right_Limit_Expr (Res, Right);
Set_Expr_Staticness (Res, Locally);
Set_Type (Res, Rtype);
return Res;
diff --git a/src/vhdl/translate/trans-chap3.adb b/src/vhdl/translate/trans-chap3.adb
index f7a5da6a4..faba5082a 100644
--- a/src/vhdl/translate/trans-chap3.adb
+++ b/src/vhdl/translate/trans-chap3.adb
@@ -1219,7 +1219,7 @@ package body Trans.Chap3 is
Info : Incomplete_Type_Info_Acc;
Ctype : Iir;
begin
- if Get_Nbr_Elements (Get_Incomplete_Type_List (Def)) = 0 then
+ if Is_Null (Get_Incomplete_Type_Ref_Chain (Def)) then
-- FIXME:
-- This is a work-around for dummy incomplete type (ie incomplete
-- types not used before the full type declaration).
@@ -1227,7 +1227,7 @@ package body Trans.Chap3 is
end if;
-- Get the complete type definition.
- Ctype := Get_Type (Get_Type_Declarator (Def));
+ Ctype := Get_Complete_Type_Definition (Def);
Info := Add_Info (Ctype, Kind_Incomplete_Type);
Info.Incomplete_Type := Def;
end Translate_Incomplete_Type;
@@ -1235,15 +1235,11 @@ package body Trans.Chap3 is
procedure Translate_Complete_Type
(Incomplete_Info : in out Incomplete_Type_Info_Acc)
is
- List : constant Iir_List :=
- Get_Incomplete_Type_List (Incomplete_Info.Incomplete_Type);
Atype : Iir;
Def_Info : Type_Info_Acc;
begin
- for I in Natural loop
- Atype := Get_Nth_Element (List, I);
- exit when Atype = Null_Iir;
-
+ Atype := Get_Incomplete_Type_Ref_Chain (Incomplete_Info.Incomplete_Type);
+ while Is_Valid (Atype) loop
-- Only access type can be completed.
pragma Assert (Get_Kind (Atype) = Iir_Kind_Access_Type_Definition);
@@ -1251,6 +1247,8 @@ package body Trans.Chap3 is
Finish_Access_Type
(Def_Info.Ortho_Type (Mode_Value),
Get_Ortho_Designated_Type (Atype));
+
+ Atype := Get_Incomplete_Type_Ref_Chain (Atype);
end loop;
Unchecked_Deallocation (Incomplete_Info);
end Translate_Complete_Type;
diff --git a/src/vhdl/translate/trans-rtis.adb b/src/vhdl/translate/trans-rtis.adb
index 35b2e8ce8..3da305ff8 100644
--- a/src/vhdl/translate/trans-rtis.adb
+++ b/src/vhdl/translate/trans-rtis.adb
@@ -1765,10 +1765,9 @@ package body Trans.Rtis is
return Info.Type_Rti;
end Generate_Type_Definition;
- function Generate_Incomplete_Type_Definition (Def : Iir)
- return O_Dnode
+ function Generate_Incomplete_Type_Definition (Def : Iir) return O_Dnode
is
- Ndef : constant Iir := Get_Type (Get_Type_Declarator (Def));
+ Ndef : constant Iir := Get_Complete_Type_Definition (Def);
Info : constant Type_Info_Acc := Get_Info (Ndef);
Rti_Type : O_Tnode;
begin