diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-10-11 06:19:19 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-10-11 06:19:19 +0200 |
commit | ec63ed6f4287ef5a0a19817f3803972899cf7648 (patch) | |
tree | be459880175235d631ac0f5249440d63cfc7a3de /src/vhdl | |
parent | 498665c5328fa2c2e0a0d114e39c545d04fbdfe9 (diff) | |
download | ghdl-ec63ed6f4287ef5a0a19817f3803972899cf7648.tar.gz ghdl-ec63ed6f4287ef5a0a19817f3803972899cf7648.tar.bz2 ghdl-ec63ed6f4287ef5a0a19817f3803972899cf7648.zip |
Rework AST to setup ownership and reference policy.
Check it with nodes_gc.
Diffstat (limited to 'src/vhdl')
36 files changed, 1900 insertions, 1122 deletions
diff --git a/src/vhdl/canon.adb b/src/vhdl/canon.adb index b39caab9b..f8ed243ed 100644 --- a/src/vhdl/canon.adb +++ b/src/vhdl/canon.adb @@ -2518,8 +2518,7 @@ package body Canon is -- Return the new package declaration (if any). function Canon_Package_Instantiation_Declaration (Decl : Iir) return Iir is - Pkg : constant Iir := - Get_Named_Entity (Get_Uninstantiated_Package_Name (Decl)); + Pkg : constant Iir := Get_Uninstantiated_Package_Decl (Decl); begin -- Canon map aspect. Set_Generic_Map_Aspect_Chain diff --git a/src/vhdl/disp_tree.adb b/src/vhdl/disp_tree.adb index c408651bc..062f98d9a 100644 --- a/src/vhdl/disp_tree.adb +++ b/src/vhdl/disp_tree.adb @@ -401,7 +401,8 @@ package body Disp_Tree is when Attr_None => Disp_Iir (Get_Iir (N, F), Sub_Indent, Depth - 1); when Attr_Ref - | Attr_Forward_Ref => + | Attr_Forward_Ref + | Attr_Maybe_Forward_Ref => Disp_Iir (Get_Iir (N, F), Sub_Indent, 0); when Attr_Maybe_Ref => if Get_Is_Ref (N) then diff --git a/src/vhdl/disp_vhdl.adb b/src/vhdl/disp_vhdl.adb index b3abdcdb1..bfa044e9c 100644 --- a/src/vhdl/disp_vhdl.adb +++ b/src/vhdl/disp_vhdl.adb @@ -383,9 +383,18 @@ package body Disp_Vhdl is when Iir_Kinds_Denoting_Name => Disp_Name (Ind); when Iir_Kind_Array_Element_Resolution => - Put ("("); - Inner (Get_Resolution_Indication (Ind)); - Put (")"); + declare + Res : constant Iir := Get_Resolution_Indication (Ind); + begin + Put ("("); + if Is_Valid (Res) then + Inner (Res); + else + Disp_Name (Get_Resolution_Indication + (Get_Element_Subtype_Indication (Ind))); + end if; + Put (")"); + end; when others => Error_Kind ("disp_resolution_indication", Ind); end case; @@ -708,7 +717,9 @@ package body Disp_Vhdl is Put (";"); end Disp_Array_Type_Definition; - procedure Disp_Physical_Literal (Lit: Iir) is + procedure Disp_Physical_Literal (Lit: Iir) + is + Unit : Iir; begin case Get_Kind (Lit) is when Iir_Kind_Physical_Int_Literal => @@ -722,7 +733,12 @@ package body Disp_Vhdl is Error_Kind ("disp_physical_literal", Lit); end case; Put (' '); - Disp_Name (Get_Unit_Name (Lit)); + + Unit := Get_Unit_Name (Lit); + if Is_Valid (Unit) then + -- No unit in range_constraint of physical type declaration. + Disp_Name (Unit); + end if; end Disp_Physical_Literal; procedure Disp_Physical_Subtype_Definition @@ -1232,10 +1248,14 @@ package body Disp_Vhdl is procedure Disp_Signature (Sig : Iir) is + Prefix : constant Iir := Get_Signature_Prefix (Sig); List : Iir_List; El : Iir; begin - Disp_Name (Get_Signature_Prefix (Sig)); + if Is_Valid (Prefix) then + -- Only in alias. + Disp_Name (Prefix); + end if; Put (" ["); List := Get_Type_Marks_List (Sig); if List /= Null_Iir_List then @@ -1280,10 +1300,9 @@ package body Disp_Vhdl is Put ("alias "); Disp_Function_Name (Decl); Put (" is "); + Disp_Name (Get_Name (Decl)); if Sig /= Null_Iir then Disp_Signature (Sig); - else - Disp_Name (Get_Name (Decl)); end if; Put_Line (";"); end Disp_Non_Object_Alias_Declaration; @@ -1570,10 +1589,9 @@ package body Disp_Vhdl is is Sig : constant Iir := Get_Attribute_Signature (Attr); begin + Disp_Name (Get_Prefix (Attr)); if Sig /= Null_Iir then Disp_Signature (Sig); - else - Disp_Name (Get_Prefix (Attr)); end if; Put ("'"); Disp_Ident (Get_Identifier (Attr)); diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb index 66ace9652..7f34d2689 100644 --- a/src/vhdl/errorout.adb +++ b/src/vhdl/errorout.adb @@ -792,6 +792,9 @@ package body Errorout is return ''' & Name_Table.Nam_Buffer (1 .. Name_Table.Nam_Length) & '''; + when Iir_Kind_Reference_Name => + -- Shouldn't happen. + return "name"; when Iir_Kind_External_Constant_Name => return "external constant name"; when Iir_Kind_External_Signal_Name => diff --git a/src/vhdl/evaluation.adb b/src/vhdl/evaluation.adb index 9c5f4cf3c..cdac9e5a5 100644 --- a/src/vhdl/evaluation.adb +++ b/src/vhdl/evaluation.adb @@ -40,8 +40,7 @@ package body Evaluation is when Iir_Kind_Physical_Int_Literal | Iir_Kind_Physical_Fp_Literal => -- Extract Unit. - Unit := Get_Physical_Unit_Value - (Get_Named_Entity (Get_Unit_Name (Expr))); + Unit := Get_Physical_Unit_Value (Get_Physical_Unit (Expr)); case Kind is when Iir_Kind_Physical_Int_Literal => return Get_Value (Expr) * Get_Value (Unit); @@ -110,8 +109,8 @@ package body Evaluation is begin Res := Create_Iir (Iir_Kind_Physical_Int_Literal); Location_Copy (Res, Origin); - Unit_Name := Get_Primary_Unit_Name (Get_Base_Type (Get_Type (Origin))); - Set_Unit_Name (Res, Unit_Name); + Unit_Name := Get_Primary_Unit (Get_Base_Type (Get_Type (Origin))); + Set_Physical_Unit (Res, Unit_Name); Set_Value (Res, Val); Set_Type (Res, Get_Type (Origin)); Set_Literal_Origin (Res, Origin); @@ -148,9 +147,14 @@ package body Evaluation is return Res; end Build_String; - function Build_Simple_Aggregate - (El_List : Iir_List; Origin : Iir; Stype : Iir) - return Iir_Simple_Aggregate + -- Build a simple aggregate composed of EL_LIST from ORIGIN. STYPE is the + -- type of the aggregate. DEF_TYPE should be either Null_Iir or STYPE. It + -- is set only when a new subtype has been created for the aggregate. + function Build_Simple_Aggregate (El_List : Iir_List; + Origin : Iir; + Stype : Iir; + Def_Type : Iir := Null_Iir) + return Iir_Simple_Aggregate is Res : Iir_Simple_Aggregate; begin @@ -160,7 +164,7 @@ package body Evaluation is Set_Type (Res, Stype); Set_Literal_Origin (Res, Origin); Set_Expr_Staticness (Res, Locally); - Set_Literal_Subtype (Res, Stype); + Set_Literal_Subtype (Res, Def_Type); return Res; end Build_Simple_Aggregate; @@ -203,14 +207,14 @@ package body Evaluation is when Iir_Kind_Physical_Int_Literal | Iir_Kind_Physical_Fp_Literal => Res := Create_Iir (Iir_Kind_Physical_Int_Literal); - Set_Unit_Name (Res, Get_Primary_Unit_Name - (Get_Base_Type (Get_Type (Origin)))); + Set_Physical_Unit (Res, Get_Primary_Unit + (Get_Base_Type (Get_Type (Origin)))); Set_Value (Res, Get_Physical_Value (Val)); when Iir_Kind_Unit_Declaration => Res := Create_Iir (Iir_Kind_Physical_Int_Literal); Set_Value (Res, Get_Physical_Value (Val)); - Set_Unit_Name (Res, Get_Primary_Unit_Name (Get_Type (Val))); + Set_Physical_Unit (Res, Get_Primary_Unit (Get_Type (Val))); when Iir_Kind_String_Literal8 => Res := Create_Iir (Iir_Kind_String_Literal8); @@ -220,7 +224,6 @@ package body Evaluation is when Iir_Kind_Simple_Aggregate => Res := Create_Iir (Iir_Kind_Simple_Aggregate); Set_Simple_Aggregate_List (Res, Get_Simple_Aggregate_List (Val)); - Set_Literal_Subtype (Res, Get_Type (Origin)); when Iir_Kind_Overflow_Literal => Res := Create_Iir (Iir_Kind_Overflow_Literal); @@ -235,6 +238,15 @@ package body Evaluation is return Res; end Build_Constant; + function Copy_Constant (Val : Iir) return Iir + is + Res : Iir; + begin + Res := Build_Constant (Val, Val); + Set_Literal_Origin (Res, Null_Iir); + return Res; + end Copy_Constant; + -- FIXME: origin ? function Build_Boolean (Cond : Boolean) return Iir is begin @@ -273,9 +285,7 @@ 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); @@ -908,7 +918,7 @@ package body Evaluation is end if; -- FIXME: this is not necessarily a string, it may be an aggregate if -- element type is not a character type. - return Build_Simple_Aggregate (Res_List, Orig, Res_Type); + return Build_Simple_Aggregate (Res_List, Orig, Res_Type, Res_Type); end Eval_Concatenation; function Eval_Discrete_Compare (Left, Right : Iir) return Compare_Type @@ -1951,7 +1961,7 @@ package body Evaluation is if Get_Kind (Res) /= Iir_Kind_Overflow_Literal then Warning_Msg_Sem (Warnid_Runtime_Error, +Expr, "result of conversion out of bounds"); - Res := Build_Overflow (Res); + Res := Build_Overflow (Expr); end if; end if; return Res; @@ -1965,13 +1975,9 @@ package body Evaluation is when Iir_Kind_Physical_Fp_Literal => Val := Expr; when Iir_Kind_Physical_Int_Literal => - if Get_Named_Entity (Get_Unit_Name (Expr)) - = Get_Primary_Unit (Get_Base_Type (Get_Type (Expr))) - then - return Expr; - else - Val := Expr; - end if; + -- Create a copy even if the literal has the primary unit. This + -- is required for ownership rule. + Val := Expr; when Iir_Kind_Unit_Declaration => Val := Expr; when Iir_Kinds_Denoting_Name => @@ -2785,10 +2791,23 @@ package body Evaluation is end if; -- Normalize the range expression. - Set_Left_Limit - (Expr, Eval_Expr_Keep_Orig (Get_Left_Limit (Expr), True)); - Set_Right_Limit - (Expr, Eval_Expr_Keep_Orig (Get_Right_Limit (Expr), True)); + declare + Left : Iir; + Right : Iir; + begin + Left := Get_Left_Limit_Expr (Expr); + if Is_Valid (Left) then + Left := Eval_Expr_Keep_Orig (Left, False); + Set_Left_Limit_Expr (Expr, Left); + Set_Left_Limit (Expr, Left); + end if; + Right := Get_Right_Limit_Expr (Expr); + if Is_Valid (Right) then + Right := Eval_Expr_Keep_Orig (Right, False); + Set_Right_Limit_Expr (Expr, Right); + Set_Right_Limit (Expr, Right); + end if; + end; return Expr; when Iir_Kind_Integer_Subtype_Definition | Iir_Kind_Floating_Subtype_Definition diff --git a/src/vhdl/evaluation.ads b/src/vhdl/evaluation.ads index 29ab8e799..95eb0202f 100644 --- a/src/vhdl/evaluation.ads +++ b/src/vhdl/evaluation.ads @@ -179,4 +179,7 @@ package Evaluation is function Get_Path_Instance_Name_Suffix (Attr : Iir) return Path_Instance_Name_Type; + + -- Create a copy of VAL. + function Copy_Constant (Val : Iir) return Iir; end Evaluation; diff --git a/src/vhdl/iirs.adb b/src/vhdl/iirs.adb index 5e940d3ac..b963826df 100644 --- a/src/vhdl/iirs.adb +++ b/src/vhdl/iirs.adb @@ -423,6 +423,7 @@ package body Iirs is | Iir_Kind_Simple_Name | Iir_Kind_Selected_Name | Iir_Kind_Operator_Symbol + | Iir_Kind_Reference_Name | Iir_Kind_Selected_By_All_Name | Iir_Kind_Parenthesis_Name | Iir_Kind_External_Constant_Name @@ -1646,7 +1647,7 @@ package body Iirs is pragma Assert (Target /= Null_Iir); pragma Assert (Has_Spec_Chain (Get_Kind (Target)), "no field Spec_Chain"); - return Get_Field0 (Target); + return Get_Field2 (Target); end Get_Spec_Chain; procedure Set_Spec_Chain (Target : Iir; Chain : Iir) is @@ -1654,9 +1655,25 @@ package body Iirs is pragma Assert (Target /= Null_Iir); pragma Assert (Has_Spec_Chain (Get_Kind (Target)), "no field Spec_Chain"); - Set_Field0 (Target, Chain); + Set_Field2 (Target, Chain); end Set_Spec_Chain; + function Get_Value_Chain (Target : Iir) return Iir is + begin + pragma Assert (Target /= Null_Iir); + pragma Assert (Has_Value_Chain (Get_Kind (Target)), + "no field Value_Chain"); + return Get_Field0 (Target); + end Get_Value_Chain; + + procedure Set_Value_Chain (Target : Iir; Chain : Iir) is + begin + pragma Assert (Target /= Null_Iir); + pragma Assert (Has_Value_Chain (Get_Kind (Target)), + "no field Value_Chain"); + Set_Field0 (Target, Chain); + end Set_Value_Chain; + function Get_Attribute_Value_Spec_Chain (Target : Iir) return Iir is begin pragma Assert (Target /= Null_Iir); @@ -2399,6 +2416,22 @@ package body Iirs is Set_Field4 (Target, Iir_Index32'Pos (Pos)); end Set_Element_Position; + function Get_Base_Element_Declaration (Target : Iir) return Iir is + begin + pragma Assert (Target /= Null_Iir); + pragma Assert (Has_Base_Element_Declaration (Get_Kind (Target)), + "no field Base_Element_Declaration"); + return Get_Field2 (Target); + end Get_Base_Element_Declaration; + + procedure Set_Base_Element_Declaration (Target : Iir; El : Iir) is + begin + pragma Assert (Target /= Null_Iir); + pragma Assert (Has_Base_Element_Declaration (Get_Kind (Target)), + "no field Base_Element_Declaration"); + Set_Field2 (Target, El); + end Set_Base_Element_Declaration; + function Get_Element_Declaration (Target : Iir) return Iir is begin pragma Assert (Target /= Null_Iir); @@ -2708,7 +2741,7 @@ package body Iirs is pragma Assert (Decl /= Null_Iir); pragma Assert (Has_Left_Limit (Get_Kind (Decl)), "no field Left_Limit"); - return Get_Field2 (Decl); + return Get_Field4 (Decl); end Get_Left_Limit; procedure Set_Left_Limit (Decl : Iir_Range_Expression; Limit : Iir) is @@ -2716,7 +2749,7 @@ package body Iirs is pragma Assert (Decl /= Null_Iir); pragma Assert (Has_Left_Limit (Get_Kind (Decl)), "no field Left_Limit"); - Set_Field2 (Decl, Limit); + Set_Field4 (Decl, Limit); end Set_Left_Limit; function Get_Right_Limit (Decl : Iir_Range_Expression) return Iir is @@ -2724,7 +2757,7 @@ package body Iirs is pragma Assert (Decl /= Null_Iir); pragma Assert (Has_Right_Limit (Get_Kind (Decl)), "no field Right_Limit"); - return Get_Field3 (Decl); + return Get_Field5 (Decl); end Get_Right_Limit; procedure Set_Right_Limit (Decl : Iir_Range_Expression; Limit : Iir) is @@ -2732,7 +2765,7 @@ package body Iirs is pragma Assert (Decl /= Null_Iir); pragma Assert (Has_Right_Limit (Get_Kind (Decl)), "no field Right_Limit"); - Set_Field3 (Decl, Limit); + Set_Field5 (Decl, Limit); end Set_Right_Limit; function Get_Left_Limit_Expr (Decl : Iir_Range_Expression) return Iir is @@ -2740,7 +2773,7 @@ package body Iirs is pragma Assert (Decl /= Null_Iir); pragma Assert (Has_Left_Limit_Expr (Get_Kind (Decl)), "no field Left_Limit_Expr"); - return Get_Field4 (Decl); + return Get_Field2 (Decl); end Get_Left_Limit_Expr; procedure Set_Left_Limit_Expr (Decl : Iir_Range_Expression; Limit : Iir) is @@ -2748,7 +2781,7 @@ package body Iirs is pragma Assert (Decl /= Null_Iir); pragma Assert (Has_Left_Limit_Expr (Get_Kind (Decl)), "no field Left_Limit_Expr"); - Set_Field4 (Decl, Limit); + Set_Field2 (Decl, Limit); end Set_Left_Limit_Expr; function Get_Right_Limit_Expr (Decl : Iir_Range_Expression) return Iir is @@ -2756,7 +2789,7 @@ package body Iirs is pragma Assert (Decl /= Null_Iir); pragma Assert (Has_Right_Limit_Expr (Get_Kind (Decl)), "no field Right_Limit_Expr"); - return Get_Field5 (Decl); + return Get_Field3 (Decl); end Get_Right_Limit_Expr; procedure Set_Right_Limit_Expr (Decl : Iir_Range_Expression; Limit : Iir) @@ -2765,7 +2798,7 @@ package body Iirs is pragma Assert (Decl /= Null_Iir); pragma Assert (Has_Right_Limit_Expr (Get_Kind (Decl)), "no field Right_Limit_Expr"); - Set_Field5 (Decl, Limit); + Set_Field3 (Decl, Limit); end Set_Right_Limit_Expr; function Get_Base_Type (Decl : Iir) return Iir is @@ -4018,6 +4051,22 @@ package body Iirs is Set_Field7 (Inst, Name); end Set_Uninstantiated_Package_Name; + function Get_Uninstantiated_Package_Decl (Inst : Iir) return Iir is + begin + pragma Assert (Inst /= Null_Iir); + pragma Assert (Has_Uninstantiated_Package_Decl (Get_Kind (Inst)), + "no field Uninstantiated_Package_Decl"); + return Get_Field9 (Inst); + end Get_Uninstantiated_Package_Decl; + + procedure Set_Uninstantiated_Package_Decl (Inst : Iir; Pkg : Iir) is + begin + pragma Assert (Inst /= Null_Iir); + pragma Assert (Has_Uninstantiated_Package_Decl (Get_Kind (Inst)), + "no field Uninstantiated_Package_Decl"); + Set_Field9 (Inst, Pkg); + end Set_Uninstantiated_Package_Decl; + function Get_Generate_Block_Configuration (Target : Iir) return Iir is begin pragma Assert (Target /= Null_Iir); @@ -4308,6 +4357,22 @@ package body Iirs is Set_Field2 (Name, Val); end Set_Alias_Declaration; + function Get_Referenced_Name (N : Iir) return Iir is + begin + pragma Assert (N /= Null_Iir); + pragma Assert (Has_Referenced_Name (Get_Kind (N)), + "no field Referenced_Name"); + return Get_Field2 (N); + end Get_Referenced_Name; + + procedure Set_Referenced_Name (N : Iir; Name : Iir) is + begin + pragma Assert (N /= Null_Iir); + pragma Assert (Has_Referenced_Name (Get_Kind (N)), + "no field Referenced_Name"); + Set_Field2 (N, Name); + end Set_Referenced_Name; + function Get_Expr_Staticness (Target : Iir) return Iir_Staticness is begin pragma Assert (Target /= Null_Iir); @@ -4388,12 +4453,28 @@ package body Iirs is Set_Field4 (Target, An_Iir); end Set_Right; + function Get_Physical_Unit (Lit : Iir) return Iir is + begin + pragma Assert (Lit /= Null_Iir); + pragma Assert (Has_Physical_Unit (Get_Kind (Lit)), + "no field Physical_Unit"); + return Get_Field3 (Lit); + end Get_Physical_Unit; + + procedure Set_Physical_Unit (Lit : Iir; Name : Iir) is + begin + pragma Assert (Lit /= Null_Iir); + pragma Assert (Has_Physical_Unit (Get_Kind (Lit)), + "no field Physical_Unit"); + Set_Field3 (Lit, Name); + end Set_Physical_Unit; + function Get_Unit_Name (Target : Iir) return Iir is begin pragma Assert (Target /= Null_Iir); pragma Assert (Has_Unit_Name (Get_Kind (Target)), "no field Unit_Name"); - return Get_Field3 (Target); + return Get_Field0 (Target); end Get_Unit_Name; procedure Set_Unit_Name (Target : Iir; Name : Iir) is @@ -4401,7 +4482,7 @@ package body Iirs is pragma Assert (Target /= Null_Iir); pragma Assert (Has_Unit_Name (Get_Kind (Target)), "no field Unit_Name"); - Set_Field3 (Target, Name); + Set_Field0 (Target, Name); end Set_Unit_Name; function Get_Name (Target : Iir) return Iir is @@ -4633,7 +4714,7 @@ package body Iirs is pragma Assert (Target /= Null_Iir); pragma Assert (Has_Actual_Type (Get_Kind (Target)), "no field Actual_Type"); - return Get_Field5 (Target); + return Get_Field3 (Target); end Get_Actual_Type; procedure Set_Actual_Type (Target : Iir; Atype : Iir) is @@ -4641,9 +4722,25 @@ package body Iirs is pragma Assert (Target /= Null_Iir); pragma Assert (Has_Actual_Type (Get_Kind (Target)), "no field Actual_Type"); - Set_Field5 (Target, Atype); + Set_Field3 (Target, Atype); end Set_Actual_Type; + function Get_Actual_Type_Definition (Target : Iir) return Iir is + begin + pragma Assert (Target /= Null_Iir); + pragma Assert (Has_Actual_Type_Definition (Get_Kind (Target)), + "no field Actual_Type_Definition"); + return Get_Field5 (Target); + end Get_Actual_Type_Definition; + + procedure Set_Actual_Type_Definition (Target : Iir; Atype : Iir) is + begin + pragma Assert (Target /= Null_Iir); + pragma Assert (Has_Actual_Type_Definition (Get_Kind (Target)), + "no field Actual_Type_Definition"); + Set_Field5 (Target, Atype); + end Set_Actual_Type_Definition; + function Get_Association_Chain (Target : Iir) return Iir is begin pragma Assert (Target /= Null_Iir); @@ -5501,6 +5598,22 @@ package body Iirs is Set_Flag7 (N, Ref); end Set_Is_Ref; + function Get_Is_Forward_Ref (N : Iir) return Boolean is + begin + pragma Assert (N /= Null_Iir); + pragma Assert (Has_Is_Forward_Ref (Get_Kind (N)), + "no field Is_Forward_Ref"); + return Get_Flag1 (N); + end Get_Is_Forward_Ref; + + procedure Set_Is_Forward_Ref (N : Iir; Ref : Boolean) is + begin + pragma Assert (N /= Null_Iir); + pragma Assert (Has_Is_Forward_Ref (Get_Kind (N)), + "no field Is_Forward_Ref"); + Set_Flag1 (N, Ref); + end Set_Is_Forward_Ref; + function Get_Psl_Property (Decl : Iir) return PSL_Node is begin pragma Assert (Decl /= Null_Iir); diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads index f87159185..4c3ea7296 100644 --- a/src/vhdl/iirs.ads +++ b/src/vhdl/iirs.ads @@ -62,6 +62,8 @@ package Iirs is -- have both an index_subtype_list and an index_constraint_list. -- - Maybe_Ref trick: the Is_Ref flag tells whether the Maybe_Ref are -- owner or ref. + -- - Maybe_Forward_Ref: the Is_Forward_Ref tells whether the field is + -- ref or forward_ref -- The root of a semantic tree is a library_declaration. -- All the library_declarations are kept in a private list, held by @@ -296,8 +298,6 @@ package Iirs is -- Iir_Kind_String_Literal8 (Short) -- - -- Get/Set_Type (Field1) - -- -- Used for computed literals. Literal_Origin contains the expression -- whose value was computed during analysis and replaces the expression. -- Get/Set_Literal_Origin (Field2) @@ -305,6 +305,8 @@ package Iirs is -- Same as Type, but marked as property of that node. -- Get/Set_Literal_Subtype (Field3) -- + -- Get/Set_Type (Field1) + -- -- Number of literals in the expanded string. -- Get/Set_String_Length (Field4) -- @@ -328,24 +330,24 @@ package Iirs is -- Iir_Kind_Integer_Literal (Int) -- - -- Get/Set_Type (Field1) - -- -- Get/Set the value of the integer. -- Get/Set_Value (Int64) -- -- Get/Set_Literal_Origin (Field2) -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Expr_Staticness (State1) -- Iir_Kind_Floating_Point_Literal (Fp) -- - -- Get/Set_Type (Field1) - -- -- The value of the literal. -- Get/Set_Fp_Value (Fp64) -- -- Get/Set_Literal_Origin (Field2) -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Expr_Staticness (State1) -- Iir_Kind_Null_Literal (Short) @@ -358,12 +360,15 @@ package Iirs is -- Iir_Kind_Physical_Int_Literal (Int) -- Iir_Kind_Physical_Fp_Literal (Fp) -- - -- Get/Set_Type (Field1) - -- -- Get/Set_Literal_Origin (Field2) -- -- The physical unit of the literal. - -- Get/Set_Unit_Name (Field3) + -- Get/Set_Physical_Unit (Field3) + -- + -- The name of the physical unit (if any). + -- Get/Set_Unit_Name (Field0) + -- + -- Get/Set_Type (Field1) -- -- Must be set to locally except for time literal, which is globally. -- Get/Set_Expr_Staticness (State1) @@ -380,26 +385,26 @@ package Iirs is -- This node can only be generated by evaluation: it is an unidimentional -- positional aggregate. -- - -- Get/Set_Type (Field1) - -- - -- Get/Set_Literal_Origin (Field2) - -- -- Same as Type, but marked as property of that node. -- Get/Set_Literal_Subtype (Field3) -- + -- Get/Set_Literal_Origin (Field2) + -- -- List of elements -- Get/Set_Simple_Aggregate_List (Field4) -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Expr_Staticness (State1) -- Iir_Kind_Overflow_Literal (Short) -- This node can only be generated by evaluation to represent an error: out -- of range, division by zero... -- - -- Get/Set_Type (Field1) - -- -- Get/Set_Literal_Origin (Field2) -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Expr_Staticness (State1) ------------- @@ -436,13 +441,17 @@ package Iirs is -- Only for Iir_Kind_Association_Element_Type: -- Get/Set_Subprogram_Association_Chain (Field4) -- - -- Only for Iir_Kind_Association_Element_By_Individual: - -- Get/Set_Actual_Type (Field5) - -- -- A function call or a type conversion for the formal. -- Only for Iir_Kind_Association_Element_By_Expression: -- Get/Set_Out_Conversion (Field5) -- + -- Owner of Actual_Type if needed. + -- Only for Iir_Kind_Association_Element_By_Individual: + -- Get/Set_Actual_Type_Definition (Field5) + -- + -- Only for Iir_Kind_Association_Element_By_Individual: + -- Get/Set_Actual_Type (Field3) + -- -- Get/Set the whole association flag (true if the formal is associated in -- whole and not individually, see LRM93 4.3.2.2) -- Get/Set_Whole_Association_Flag (Flag1) @@ -519,6 +528,7 @@ package Iirs is -- * a sequential statement chain for a case_statement. -- Get/Set_Associated_Chain (Field4) -- + -- Should be a simple_name. -- Only for Iir_Kind_Choice_By_Name: -- Get/Set_Choice_Name (Field5) -- @@ -619,8 +629,7 @@ package Iirs is -- -- Get/Set_Component_Name (Field4) -- - -- Must be one of designator_list, designator_by_others or - -- designator_by_all. + -- A list, list_others or list_all. -- Get/Set_Instantiation_List (Field1) -- -- Only for Iir_Kind_Component_Configuration: @@ -701,16 +710,16 @@ package Iirs is -- -- Get/Set_Entity_Class (Field3) -- - -- Get/Set_Attribute_Value_Spec_Chain (Field4) + -- Get/Set_Entity_Name_List (Field8) -- -- Get/Set_Expression (Field5) -- + -- Get/Set_Attribute_Value_Spec_Chain (Field4) + -- -- Always a simple name. -- Get/Set_Attribute_Designator (Field6) -- -- Get/Set_Attribute_Specification_Chain (Field7) - -- - -- Get/Set_Entity_Name_List (Field8) -- Iir_Kind_Attribute_Value (Short) -- An attribute value is the element of the chain of attribute of an @@ -721,11 +730,13 @@ package Iirs is -- This makes elaboration (and more precisely, expression evaluation) -- easier. -- - -- Get/Set_Spec_Chain (Field0) + -- Chain of attribute_value for the attribute specification + -- Get/Set_Spec_Chain (Field2) -- -- Get/Set_Type (Field1) -- - -- Get/Set_Chain (Field2) + -- Chain of all attribute_value for the node containing declarations + -- Get/Set_Value_Chain (Field0) -- -- Get/Set_Designated_Entity (Field3) -- @@ -768,18 +779,18 @@ package Iirs is -- Get/Set_Parent (Field0) -- Get/Set_Design_Unit (Alias Field0) -- - -- Get/Set_Declaration_Chain (Field1) - -- -- Get/Set_Identifier (Field3) -- - -- Get/Set_Attribute_Value_Chain (Field4) - -- - -- Get/Set_Concurrent_Statement_Chain (Field5) - -- -- Get/Set_Generic_Chain (Field6) -- -- Get/Set_Port_Chain (Field7) -- + -- Get/Set_Declaration_Chain (Field1) + -- + -- Get/Set_Concurrent_Statement_Chain (Field5) + -- + -- Get/Set_Attribute_Value_Chain (Field4) + -- -- Get/Set_Visible_Flag (Flag4) -- -- Get/Set_Is_Within_Flag (Flag5) @@ -795,17 +806,17 @@ package Iirs is -- Get/Set_Parent (Field0) -- Get/Set_Design_Unit (Alias Field0) -- - -- Get/Set_Declaration_Chain (Field1) - -- -- Name of the entity declaration for the architecture. -- Get/Set_Entity_Name (Field2) -- - -- Get/Set_Identifier (Field3) + -- Get/Set_Declaration_Chain (Field1) -- - -- Get/Set_Attribute_Value_Chain (Field4) + -- Get/Set_Identifier (Field3) -- -- Get/Set_Concurrent_Statement_Chain (Field5) -- + -- Get/Set_Attribute_Value_Chain (Field4) + -- -- The default configuration created by canon. This is a design unit. -- Get/Set_Default_Configuration_Declaration (Field6) -- @@ -852,19 +863,19 @@ package Iirs is -- Get/Set_Parent (Field0) -- Get/Set_Design_Unit (Alias Field0) -- + -- Get/Set_Identifier (Field3) + -- + -- Get/Set_Package_Header (Field6) + -- -- Get/Set_Declaration_Chain (Field1) -- -- For nested packages -- Get/Set_Chain (Field2) -- - -- Get/Set_Identifier (Field3) - -- -- Get/Set_Attribute_Value_Chain (Field4) -- -- Get/Set_Package_Body (Field5) -- - -- Get/Set_Package_Header (Field6) - -- -- Get/Set_Package_Origin (Field7) -- -- Chain of bodies for package instantiation. Present only in certain @@ -920,23 +931,28 @@ package Iirs is -- Get/Set_Parent (Field0) -- Get/Set_Design_Unit (Alias Field0) -- + -- Get/Set_Identifier (Field3) + -- + -- The name of the uninstantiated package as it appear in the sources. May + -- be Null_Iir. + -- Get/Set_Uninstantiated_Package_Name (Field7) + -- + -- The uninstantiated package declaration. + -- Get/Set_Uninstantiated_Package_Decl (Field9) + -- + -- Get/Set_Generic_Chain (Field6) + -- + -- Get/Set_Generic_Map_Aspect_Chain (Field8) + -- -- Get/Set_Declaration_Chain (Field1) -- -- For nested packages -- Get/Set_Chain (Field2) -- - -- Get/Set_Identifier (Field3) - -- -- Get/Set_Attribute_Value_Chain (Field4) -- -- Get/Set_Package_Body (Field5) -- - -- Get/Set_Generic_Chain (Field6) - -- - -- Get/Set_Uninstantiated_Package_Name (Field7) - -- - -- Get/Set_Generic_Map_Aspect_Chain (Field8) - -- -- Get/Set_Visible_Flag (Flag4) -- -- Get/Set_End_Has_Reserved_Id (Flag8) @@ -1019,10 +1035,6 @@ package Iirs is -- -- Get/Set_Parent (Field0) -- - -- The type can be deduced from the subtype indication, but this field is - -- present for uniformity (and speed). - -- Get/Set_Type (Field1) - -- -- Get/Set_Chain (Field2) -- -- Get/Set_Identifier (Field3) @@ -1032,6 +1044,10 @@ package Iirs is -- The subtype indication may not be present. -- Get/Set_Subtype_Indication (Field5) -- + -- The type can be deduced from the subtype indication, but this field is + -- present for uniformity (and speed). + -- Get/Set_Type (Field1) + -- -- Get/Set_Expr_Staticness (State1) -- -- Get/Set_Name_Staticness (State2) @@ -1133,14 +1149,16 @@ package Iirs is -- -- Get/Set_Parent (Field0) -- - -- Get/Set_Type (Field1) - -- -- Get/Set_Chain (Field2) -- -- Get/Set_Identifier (Field3) -- + -- For integer and real types, the subtype_indication of the implicitly + -- declared subtype for the type is the subtype definition. -- Get/Set_Subtype_Indication (Field5) -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Visible_Flag (Flag4) -- -- Get/Set_Use_Flag (Flag6) @@ -1184,18 +1202,18 @@ package Iirs is -- Useful to distinguish a port and an interface. -- Get/Set_Parent (Field0) -- - -- The type can be deduced from the subtype indication, but this field is - -- present for uniformity (and speed). - -- Get/Set_Type (Field1) - -- -- Get/Set_Chain (Field2) -- -- Get/Set_Identifier (Field3) -- + -- Get/Set_Subtype_Indication (Field5) + -- -- Must always be null_iir for iir_kind_interface_file_declaration. -- Get/Set_Default_Value (Field4) -- - -- Get/Set_Subtype_Indication (Field5) + -- The type can be deduced from the subtype indication, but this field is + -- present for uniformity (and speed). + -- Get/Set_Type (Field1) -- -- Get/Set_Mode (Odigit1) -- @@ -1269,20 +1287,22 @@ package Iirs is -- -- Get/Set_Parent (Field0) -- - -- Get/Set_Declaration_Chain (Field1) - -- - -- Get/Set_Chain (Field2) - -- -- Get/Set_Identifier (Field3) -- - -- Get/Set_Attribute_Value_Chain (Field4) + -- Get/Set_Uninstantiated_Package_Name (Field7) -- - -- Get/Set_Generic_Chain (Field6) + -- Get/Set_Uninstantiated_Package_Decl (Field9) -- - -- Get/Set_Uninstantiated_Package_Name (Field7) + -- Get/Set_Generic_Chain (Field6) -- -- Get/Set_Generic_Map_Aspect_Chain (Field8) -- + -- Get/Set_Declaration_Chain (Field1) + -- + -- Get/Set_Chain (Field2) + -- + -- Get/Set_Attribute_Value_Chain (Field4) + -- -- Get/Set_Visible_Flag (Flag4) -- -- Get/Set_Is_Within_Flag (Flag5) @@ -1494,15 +1514,15 @@ package Iirs is -- -- Get/Set_Parent (Field0) -- - -- Get/Set_Type (Field1) - -- -- Get/Set_Chain (Field2) -- -- Get/Set_Identifier (Field3) -- + -- Get/Set_Subtype_Indication (Field5) + -- -- Get/Set_Default_Value (Field4) -- - -- Get/Set_Subtype_Indication (Field5) + -- Get/Set_Type (Field1) -- -- For a non-resolved signal: null_iir if the signal has no driver, or -- a process/concurrent_statement for which the signal should have a @@ -1578,17 +1598,10 @@ package Iirs is -- -- Get/Set_Parent (Field0) -- - -- Get/Set_Type (Field1) - -- -- Get/Set_Chain (Field2) -- -- Get/Set_Identifier (Field3) -- - -- Only for Iir_Kind_Constant_Declaration: - -- Default value of a deferred constant points to the full constant - -- declaration. - -- Get/Set_Default_Value (Field4) - -- -- For iterator, this is the reconstructed subtype indication. -- Get/Set_Subtype_Indication (Field5) -- @@ -1596,6 +1609,15 @@ package Iirs is -- Get/Set_Discrete_Range (Field6) -- -- Only for Iir_Kind_Constant_Declaration: + -- Default value of a deferred constant points to the full constant + -- declaration. + -- Get/Set_Default_Value (Field4) + -- + -- Note that the type may be extracted from the default_value if the subtype + -- indication is unconstrained. + -- Get/Set_Type (Field1) + -- + -- Only for Iir_Kind_Constant_Declaration: -- Summary: -- | constant C1 : integer; -- Deferred declaration (in a package) -- | constant C2 : integer := 4; -- Declaration @@ -1628,15 +1650,15 @@ package Iirs is -- -- Get/Set_Parent (Field0) -- - -- Get/Set_Type (Field1) - -- -- Get/Set_Chain (Field2) -- -- Get/Set_Identifier (Field3) -- + -- Get/Set_Subtype_Indication (Field5) + -- -- Get/Set_Default_Value (Field4) -- - -- Get/Set_Subtype_Indication (Field5) + -- Get/Set_Type (Field1) -- -- True if the variable is a shared variable. -- Get/Set_Shared_Flag (Flag2) @@ -1711,17 +1733,22 @@ package Iirs is -- -- element_subtype_definition ::= subtype_indication -- - -- The type can be deduced from the subtype indication, but this field is - -- present for uniformity (and speed). - -- Get/Set_Type (Field1) - -- -- Get/Set_Identifier (Field3) -- + -- Get/Set_Subtype_Indication (Field5) + -- -- Return the position of the element in the record, starting from 0 for -- the first record element, increasing by one for each successive element. -- Get/Set_Element_Position (Field4) -- - -- Get/Set_Subtype_Indication (Field5) + -- The type can be deduced from the subtype indication, but this field is + -- present for uniformity (and speed). + -- Get/Set_Type (Field1) + -- + -- The 'primary' element declaration, the one declared in the record type + -- definition. Other element declarations might be created for new + -- constraints in record subtypes. + -- Get/Set_Base_Element_Declaration (Field2) -- -- Get/Set_Has_Identifier_List (Flag3) -- @@ -1984,16 +2011,17 @@ package Iirs is -- Iir_Kind_Enumeration_Type_Definition (Short) -- - -- Get the range of the type (This is just an ascending range from the - -- first literal to the last declared literal). - -- Get/Set_Range_Constraint (Field1) - -- -- Return the list of literals. This list is created when the node is -- created. -- Get/Set_Enumeration_Literal_List (Field2) -- + -- Get the range of the type (This is just an ascending range from the + -- first literal to the last declared literal). + -- Get/Set_Range_Constraint (Field1) + -- -- Get/Set_Type_Declarator (Field3) -- + -- Always itself -- Get/Set_Base_Type (Field4) -- -- Get/Set_Resolved_Flag (Flag1) @@ -2004,6 +2032,8 @@ package Iirs is -- -- Get/Set_Only_Characters_Flag (Flag4) -- + -- Get/Set_Is_Ref (Flag7) + -- -- Get/Set_Type_Staticness (State1) -- Iir_Kind_Enumeration_Literal (Short) @@ -2081,14 +2111,14 @@ package Iirs is -- -- Get/Set_Identifier (Field3) -- - -- The Physical_Literal is the expression that appear in the sources, so - -- this is Null_Iir for a primary unit. - -- Get/Set_Physical_Literal (Field4) - -- -- The value of the unit, computed from the primary unit. This is always -- a physical integer literal. -- Get/Set_Physical_Unit_Value (Field5) -- + -- The Physical_Literal is the expression that appear in the sources, so + -- this is Null_Iir for a primary unit. + -- Get/Set_Physical_Literal (Field4) + -- -- Get/Set_Expr_Staticness (State1) -- -- Get/Set_Name_Staticness (State2) @@ -2132,19 +2162,19 @@ package Iirs is -- -- index_subtype_definition ::= type_mark RANGE <> -- - -- Get/Set_Element_Subtype (Field1) + -- This is a list of type marks. + -- Get/Set_Index_Subtype_Definition_List (Field6) -- -- Get/Set_Element_Subtype_Indication (Field2) -- - -- Get/Set_Type_Declarator (Field3) + -- Same as the index_subtype_definition_list. + -- Get/Set_Index_Subtype_List (Field9) -- - -- Get/Set_Base_Type (Field4) + -- Get/Set_Element_Subtype (Field1) -- - -- This is a list of type marks. - -- Get/Set_Index_Subtype_Definition_List (Field6) + -- Get/Set_Type_Declarator (Field3) -- - -- Same as the index_subtype_definition_list. - -- Get/Set_Index_Subtype_List (Field9) + -- Get/Set_Base_Type (Field4) -- -- Get/Set_Type_Staticness (State1) -- @@ -2194,18 +2224,20 @@ package Iirs is -- -- access_type_definition ::= ACCESS subtype_indication -- - -- Next access type that also referenced the same incomplete type when - -- defined. - -- Get/Set_Incomplete_Type_Ref_Chain (Field0) + -- The subtype_indication as it appears. Can designate an + -- incomplete_type_definition. + -- Get/Set_Designated_Subtype_Indication (Field5) -- + -- The resolved designated type. -- 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) + -- Next access type that also referenced the same incomplete type when + -- defined. + -- Get/Set_Incomplete_Type_Ref_Chain (Field0) -- -- Get/Set_Resolved_Flag (Flag1) -- @@ -2419,6 +2451,8 @@ package Iirs is -- -- Get/Set_Has_Signal_Flag (Flag3) -- + -- Get/Set_Is_Ref (Flag7) + -- -- Get/Set_Type_Staticness (State1) -- Iir_Kind_Floating_Subtype_Definition (Medium) @@ -2441,6 +2475,8 @@ package Iirs is -- -- Get/Set_Has_Signal_Flag (Flag3) -- + -- Get/Set_Is_Ref (Flag7) + -- -- Get/Set_Type_Staticness (State1) -- Iir_Kind_Access_Subtype_Definition (Short) @@ -2469,7 +2505,11 @@ package Iirs is -- -- array_element_resolution ::= resolution_indication -- + -- The indication as it appears in the sources. -- Get/Set_Resolution_Indication (Field5) + -- + -- The subtype definition of the element. Owner of it. + -- Get/Set_Element_Subtype_Indication (Field2) -- Iir_Kind_Record_Resolution (Short) -- @@ -2519,28 +2559,28 @@ package Iirs is -- Iir_Kind_Array_Subtype_Definition (Medium) -- - -- Get/Set_Element_Subtype (Field1) - -- -- Get/Set_Subtype_Type_Mark (Field2) -- - -- Get/Set_Type_Declarator (Field3) - -- - -- Get/Set_Base_Type (Field4) - -- -- Get/Set_Resolution_Indication (Field5) -- -- The index_constraint list as it appears in the subtype indication (if -- present). This is a list of subtype indication. -- Get/Set_Index_Constraint_List (Field6) -- - -- Get/Set_Tolerance (Field7) - -- - -- Get/Set_Array_Element_Constraint (Field8) - -- -- The type of the index. This is either the index_constraint list or the -- index subtypes of the type_mark. -- Get/Set_Index_Subtype_List (Field9) -- + -- Get/Set_Array_Element_Constraint (Field8) + -- + -- Get/Set_Tolerance (Field7) + -- + -- Get/Set_Element_Subtype (Field1) + -- + -- Get/Set_Type_Declarator (Field3) + -- + -- Get/Set_Base_Type (Field4) + -- -- Get/Set_Type_Staticness (State1) -- -- Get/Set_Constraint_State (State2) @@ -2555,22 +2595,22 @@ package Iirs is -- Iir_Kind_Range_Expression (Short) -- - -- Get/Set_Range_Origin (Field0) - -- - -- 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_Left_Limit_Expr (Field2) + -- + -- Get/Set_Right_Limit_Expr (Field3) + -- + -- Get/Set_Range_Origin (Field0) -- - -- Get/Set_Right_Limit (Field3) + -- Get/Set_Type (Field1) -- - -- Get/Set_Left_Limit_Expr (Field4) + -- Get/Set_Left_Limit (Field4) -- - -- Get/Set_Right_Limit_Expr (Field5) + -- Get/Set_Right_Limit (Field5) -- -- Get/Set_Expr_Staticness (State1) -- @@ -2587,6 +2627,8 @@ package Iirs is -- Get/Set_Resolution_Indication (Field5) -- -- Get/Set_Tolerance (Field7) + -- + -- Get/Set_Is_Ref (Flag7) ------------------------- -- Nature definitions -- @@ -2822,6 +2864,12 @@ package Iirs is -- -- Get/Set_Parent (Field0) -- + -- get/set_guard_decl is used for semantic analysis, in order to add + -- a signal declaration. + -- Get/Set_Guard_Decl (Field8) + -- + -- Get/Set_Block_Header (Field7) + -- -- Get/Set_Declaration_Chain (Field1) -- -- Get/Set_Chain (Field2) @@ -2835,12 +2883,6 @@ package Iirs is -- -- Get/Set_Block_Block_Configuration (Field6) -- - -- Get/Set_Block_Header (Field7) - -- - -- get/set_guard_decl is used for semantic analysis, in order to add - -- a signal declaration. - -- Get/Set_Guard_Decl (Field8) - -- -- Get/Set_Visible_Flag (Flag4) -- -- Get/Set_Is_Within_Flag (Flag5) @@ -3347,14 +3389,14 @@ package Iirs is -- Iir_Kind_Aggregate (Short) -- - -- Get/Set_Type (Field1) - -- - -- Get/Set_Aggregate_Info (Field2) + -- Get/Set_Association_Choices_Chain (Field4) -- -- Same as Type, but marked as property of that node. -- Get/Set_Literal_Subtype (Field3) -- - -- Get/Set_Association_Choices_Chain (Field4) + -- Get/Set_Aggregate_Info (Field2) + -- + -- Get/Set_Type (Field1) -- -- Get/Set_Expr_Staticness (State1) -- @@ -3395,10 +3437,10 @@ package Iirs is -- Iir_Kind_Parenthesis_Expression (Short) -- - -- Get/Set_Type (Field1) - -- -- Get/Set_Expression (Field5) -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Expr_Staticness (State1) -- Iir_Kind_Qualified_Expression (Short) @@ -3448,15 +3490,6 @@ package Iirs is -- -- Get/Set_Type (Field1) -- - -- To ease analysis: set to the designated type (either the type of the - -- expression or the subtype) - -- Get/Set_Allocator_Designated_Type (Field2) - -- - -- Only for Iir_Kind_Allocator_By_Subtype: - -- Same as subtype indication but set when the allocator defines a new - -- subtype. - -- Get/Set_Allocator_Subtype (Field3) - -- -- Only for Iir_Kind_Allocator_By_Expression: -- Contains the expression for a by expression allocator. -- Get/Set_Expression (Field5) @@ -3465,6 +3498,15 @@ package Iirs is -- Contains the subtype indication for a by subtype allocator. -- Get/Set_Subtype_Indication (Field5) -- + -- Only for Iir_Kind_Allocator_By_Subtype: + -- Same as subtype indication but set when the allocator defines a new + -- subtype. Used to track when an anonymous subtype is created. + -- Get/Set_Allocator_Subtype (Field3) + -- + -- To ease analysis: set to the designated type (either the type of the + -- expression or the subtype) + -- Get/Set_Allocator_Designated_Type (Field2) + -- -- Get/Set_Expr_Staticness (State1) ------------ @@ -3483,6 +3525,8 @@ package Iirs is -- -- Get/Set_Base_Name (Field5) -- + -- Get/Set_Is_Forward_Ref (Flag1) + -- -- Get/Set_Expr_Staticness (State1) -- -- Get/Set_Name_Staticness (State2) @@ -3499,6 +3543,8 @@ package Iirs is -- -- Get/Set_Base_Name (Field5) -- + -- Get/Set_Is_Forward_Ref (Flag1) + -- -- Get/Set_Expr_Staticness (State1) -- -- Get/Set_Name_Staticness (State2) @@ -3514,6 +3560,19 @@ package Iirs is -- Get/Set_Named_Entity (Field4) -- -- Get/Set_Base_Name (Field5) + -- + -- Get/Set_Is_Forward_Ref (Flag1) + + -- Iir_Kind_Reference_Name (Short) + -- + -- This doesn't correspond to a name in the sources. This is an artificial + -- name in the tree which is owned and reference another name. + -- + -- Get/Set_Named_Entity (Field4) + -- + -- Get/Set_Referenced_Name (Field2) + -- + -- Get/Set_Is_Forward_Ref (Flag1) -- Iir_Kind_Selected_Name (Short) -- @@ -3529,6 +3588,8 @@ package Iirs is -- -- Get/Set_Base_Name (Field5) -- + -- Get/Set_Is_Forward_Ref (Flag1) + -- -- Get/Set_Expr_Staticness (State1) -- -- Get/Set_Name_Staticness (State2) @@ -3543,6 +3604,8 @@ package Iirs is -- -- Get/Set_Base_Name (Field5) -- + -- Get/Set_Is_Forward_Ref (Flag1) + -- -- Get/Set_Expr_Staticness (State1) -- Iir_Kind_Indexed_Name (Short) @@ -3564,12 +3627,12 @@ package Iirs is -- -- Get/Set_Prefix (Field0) -- - -- Get/Set_Type (Field1) - -- -- Get/Set_Suffix (Field2) -- -- Get/Set_Slice_Subtype (Field3) -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Base_Name (Field5) -- -- Get/Set_Expr_Staticness (State1) @@ -3589,6 +3652,8 @@ package Iirs is -- Get/Set_Association_Chain (Field2) -- -- Get/Set_Named_Entity (Field4) + -- + -- Get/Set_Is_Forward_Ref (Flag1) -- Iir_Kind_Selected_Element (Short) -- A record element selection. This corresponds to a reffined selected @@ -3650,6 +3715,8 @@ package Iirs is -- Get/Set_Identifier (Field3) -- -- Get/Set_Named_Entity (Field4) + -- + -- Get/Set_Is_Forward_Ref (Flag1) -- Iir_Kind_Absolute_Pathname (Short) -- Represents only the '.'. @@ -3670,6 +3737,8 @@ package Iirs is -- Get/Set_Named_Entity (Field4) -- -- Get/Set_Pathname_Expression (Field5) + -- + -- Get/Set_Is_Forward_Ref (Flag1) ----------------- -- Attributes -- @@ -3689,6 +3758,8 @@ package Iirs is -- -- Get/Set_Base_Name (Field5) -- + -- Get/Set_Is_Forward_Ref (Flag1) + -- -- Get/Set_Expr_Staticness (State1) -- -- Get/Set_Name_Staticness (State2) @@ -3823,14 +3894,14 @@ package Iirs is -- -- Get/Set_Prefix (Field0) -- - -- Get/Set_Type (Field1) - -- -- Only for Iir_Kind_Simple_Name_Attribute: -- Get/Set_Simple_Name_Identifier (Field3) -- -- Only for Iir_Kind_Simple_Name_Attribute: -- Get/Set_Simple_Name_Subtype (Field4) -- + -- Get/Set_Type (Field1) + -- -- Get/Set_Base_Name (Field5) -- -- Get/Set_Expr_Staticness (State1) @@ -4114,6 +4185,7 @@ package Iirs is Iir_Kind_Simple_Name, -- denoting_name Iir_Kind_Selected_Name, -- denoting_name Iir_Kind_Operator_Symbol, -- denoting_name + Iir_Kind_Reference_Name, -- denoting_name Iir_Kind_Selected_By_All_Name, Iir_Kind_Parenthesis_Name, @@ -4194,6 +4266,7 @@ package Iirs is subtype Iir_In_Modes is Iir_Mode range Iir_Inout_Mode .. Iir_In_Mode; subtype Iir_Out_Modes is Iir_Mode range Iir_Out_Mode .. Iir_Inout_Mode; + subtype Iir_Parameter_Modes is Iir_Mode range Iir_Out_Mode .. Iir_In_Mode; type Iir_Delay_Mechanism is (Iir_Inertial_Delay, Iir_Transport_Delay); @@ -4931,13 +5004,15 @@ package Iirs is Iir_Kind_Character_Literal .. --Iir_Kind_Simple_Name --Iir_Kind_Selected_Name - Iir_Kind_Operator_Symbol; + --Iir_Kind_Operator_Symbol + Iir_Kind_Reference_Name; subtype Iir_Kinds_Name is Iir_Kind range Iir_Kind_Character_Literal .. --Iir_Kind_Simple_Name --Iir_Kind_Selected_Name --Iir_Kind_Operator_Symbol + --Iir_Kind_Reference_Name --Iir_Kind_Selected_By_All_Name Iir_Kind_Parenthesis_Name; @@ -5621,7 +5696,7 @@ package Iirs is -- Every design unit is put in an hash table to find quickly found by its -- name. This field is a single chain for collisions. - -- Field: Field7 Ref + -- Field: Field7 Forward_Ref function Get_Hash_Chain (Design_Unit : Iir_Design_Unit) return Iir; procedure Set_Hash_Chain (Design_Unit : Iir_Design_Unit; Chain : Iir); @@ -5652,7 +5727,7 @@ package Iirs is function Get_Enum_Pos (Lit : Iir) return Iir_Int32; procedure Set_Enum_Pos (Lit : Iir; Val : Iir_Int32); - -- Field: Field4 + -- Field: Field4 Ref function Get_Physical_Literal (Unit : Iir) return Iir; procedure Set_Physical_Literal (Unit : Iir; Lit : Iir); @@ -5667,7 +5742,7 @@ package Iirs is procedure Set_Fp_Value (Lit : Iir; Val : Iir_Fp64); -- List of elements of a simple aggregate. - -- Field: Field4 (uc) + -- Field: Field4 Ref (uc) function Get_Simple_Aggregate_List (Target : Iir) return Iir_List; procedure Set_Simple_Aggregate_List (Target : Iir; List : Iir_List); @@ -5738,7 +5813,7 @@ package Iirs is -- Chain of attribute specifications. This is used only during sem, to -- check that no named entity of a given class appear after an attr. spec. -- with the entity name list OTHERS or ALL. - -- Field: Field7 + -- Field: Field7 Ref function Get_Attribute_Specification_Chain (Target : Iir) return Iir; procedure Set_Attribute_Specification_Chain (Target : Iir; Chain : Iir); @@ -5750,7 +5825,7 @@ package Iirs is function Get_Signal_List (Target : Iir) return Iir_List; procedure Set_Signal_List (Target : Iir; List : Iir_List); - -- Field: Field3 Ref + -- Field: Field3 Forward_Ref function Get_Designated_Entity (Val : Iir_Attribute_Value) return Iir; procedure Set_Designated_Entity (Val : Iir_Attribute_Value; Entity : Iir); @@ -5865,19 +5940,26 @@ package Iirs is procedure Set_Configuration_Item_Chain (Target : Iir; Chain : Iir); -- Chain of attribute values for declared items. - -- To be used with Get/Set_Chain. + -- To be used with Get/Set_Value_Chain. -- There is no order, therefore, a new attribute value may be always -- prepended. - -- Field: Field4 Chain + -- Field: Field4 Ref function Get_Attribute_Value_Chain (Target : Iir) return Iir; procedure Set_Attribute_Value_Chain (Target : Iir; Chain : Iir); -- Next attribute value in the attribute specification chain (of attribute -- value). - -- Field: Field0 + -- FIXME: should be a Chain. + -- Field: Field2 function Get_Spec_Chain (Target : Iir) return Iir; procedure Set_Spec_Chain (Target : Iir; Chain : Iir); + -- Next attribute value in the attribute specification chain (of attribute + -- value). + -- Field: Field0 Ref + function Get_Value_Chain (Target : Iir) return Iir; + procedure Set_Value_Chain (Target : Iir; Chain : Iir); + -- Chain of attribute values for attribute specification. -- To be used with Get/Set_Spec_Chain. -- Field: Field4 @@ -5895,7 +5977,7 @@ package Iirs is procedure Set_Package (Package_Body : Iir; Decl : Iir); -- The package body corresponding to the package declaration. - -- Field: Field5 Ref + -- Field: Field5 Forward_Ref function Get_Package_Body (Pkg : Iir) return Iir; procedure Set_Package_Body (Pkg : Iir; Decl : Iir); @@ -5960,7 +6042,7 @@ package Iirs is procedure Set_Type_Definition (Decl : Iir; Atype : Iir); -- The subtype definition associated with the type declaration (if any). - -- Field: Field4 + -- Field: Field4 Forward_Ref function Get_Subtype_Definition (Target : Iir) return Iir; procedure Set_Subtype_Definition (Target : Iir; Def : Iir); @@ -6013,7 +6095,7 @@ package Iirs is function Get_Sequential_Statement_Chain (Target : Iir) return Iir; procedure Set_Sequential_Statement_Chain (Target : Iir; Chain : Iir); - -- Field: Field9 Ref + -- Field: Field9 Forward_Ref function Get_Subprogram_Body (Target : Iir) return Iir; procedure Set_Subprogram_Body (Target : Iir; A_Body : Iir); @@ -6072,7 +6154,7 @@ package Iirs is -- declaration for a full constant declaration, or is null_iir for a -- usual or deferred constant declaration. -- Set only during sem. - -- Field: Field6 Ref + -- Field: Field6 Forward_Ref function Get_Deferred_Declaration (Target : Iir) return Iir; procedure Set_Deferred_Declaration (Target : Iir; Decl : Iir); @@ -6123,6 +6205,10 @@ package Iirs is function Get_Element_Position (Target : Iir) return Iir_Index32; procedure Set_Element_Position (Target : Iir; Pos : Iir_Index32); + -- Field: Field2 Ref + function Get_Base_Element_Declaration (Target : Iir) return Iir; + procedure Set_Base_Element_Declaration (Target : Iir; El : Iir); + -- Field: Field2 function Get_Element_Declaration (Target : Iir) return Iir; procedure Set_Element_Declaration (Target : Iir; El : Iir); @@ -6207,7 +6293,7 @@ package Iirs is function Get_Visible_Flag (Target : Iir) return Boolean; procedure Set_Visible_Flag (Target : Iir; Flag : Boolean); - -- Field: Field1 + -- Field: Field1 Maybe_Ref function Get_Range_Constraint (Target : Iir) return Iir; procedure Set_Range_Constraint (Target : Iir; Constraint : Iir); @@ -6215,19 +6301,19 @@ package Iirs is function Get_Direction (Decl : Iir) return Iir_Direction; procedure Set_Direction (Decl : Iir; Dir : Iir_Direction); - -- Field: Field2 Ref + -- Field: Field4 Ref function Get_Left_Limit (Decl : Iir_Range_Expression) return Iir; procedure Set_Left_Limit (Decl : Iir_Range_Expression; Limit : Iir); - -- Field: Field3 Ref + -- Field: Field5 Ref function Get_Right_Limit (Decl : Iir_Range_Expression) return Iir; procedure Set_Right_Limit (Decl : Iir_Range_Expression; Limit : Iir); - -- Field: Field4 + -- Field: Field2 function Get_Left_Limit_Expr (Decl : Iir_Range_Expression) return Iir; procedure Set_Left_Limit_Expr (Decl : Iir_Range_Expression; Limit : Iir); - -- Field: Field5 + -- Field: Field3 function Get_Right_Limit_Expr (Decl : Iir_Range_Expression) return Iir; procedure Set_Right_Limit_Expr (Decl : Iir_Range_Expression; Limit : Iir); @@ -6355,7 +6441,7 @@ package Iirs is function Get_Waveform_Chain (Target : Iir) return Iir; procedure Set_Waveform_Chain (Target : Iir; Chain : Iir); - -- Field: Field8 + -- Field: Field8 Ref function Get_Guard (Target : Iir) return Iir; procedure Set_Guard (Target : Iir; Guard : Iir); @@ -6545,12 +6631,12 @@ package Iirs is procedure Set_Configuration_Name (Target : Iir; Conf : Iir); -- Component configuration for a component_instantiation_statement. - -- Field: Field6 + -- Field: Field6 Forward_Ref function Get_Component_Configuration (Target : Iir) return Iir; procedure Set_Component_Configuration (Target : Iir; Conf : Iir); -- Configuration specification for a component_instantiation_statement. - -- Field: Field7 + -- Field: Field7 Ref function Get_Configuration_Specification (Target : Iir) return Iir; procedure Set_Configuration_Specification (Target : Iir; Conf : Iir); @@ -6611,7 +6697,7 @@ package Iirs is procedure Set_Signal_Attribute_Chain (Decl : Iir; Chain : Iir); -- Block_Configuration that applies to this block statement. - -- Field: Field6 + -- Field: Field6 Forward_Ref function Get_Block_Block_Configuration (Block : Iir) return Iir; procedure Set_Block_Block_Configuration (Block : Iir; Conf : Iir); @@ -6627,10 +6713,14 @@ package Iirs is function Get_Uninstantiated_Package_Name (Inst : Iir) return Iir; procedure Set_Uninstantiated_Package_Name (Inst : Iir; Name : Iir); + -- Field: Field9 Ref + function Get_Uninstantiated_Package_Decl (Inst : Iir) return Iir; + procedure Set_Uninstantiated_Package_Decl (Inst : Iir; Pkg : Iir); + -- Get/Set the block_configuration (there may be several -- block_configuration through the use of prev_configuration singly linked -- list) that apply to this generate statement. - -- Field: Field2 + -- Field: Field2 Forward_Ref function Get_Generate_Block_Configuration (Target : Iir) return Iir; procedure Set_Generate_Block_Configuration (Target : Iir; Conf : Iir); @@ -6703,16 +6793,20 @@ package Iirs is procedure Set_Binding_Indication (Target : Iir; Binding : Iir); -- The named entity designated by a name. - -- Field: Field4 Ref + -- Field: Field4 Maybe_Forward_Ref function Get_Named_Entity (Name : Iir) return Iir; procedure Set_Named_Entity (Name : Iir; Val : Iir); -- If a name designate a non-object alias, the designated alias. -- Named_Entity will designate the aliased entity. - -- Field: Field2 + -- Field: Field2 Ref function Get_Alias_Declaration (Name : Iir) return Iir; procedure Set_Alias_Declaration (Name : Iir; Val : Iir); + -- Field: Field2 Ref + function Get_Referenced_Name (N : Iir) return Iir; + procedure Set_Referenced_Name (N : Iir; Name : Iir); + -- Expression staticness, defined by rules of LRM 7.4 -- Field: State1 (pos) function Get_Expr_Staticness (Target : Iir) return Iir_Staticness; @@ -6738,7 +6832,11 @@ package Iirs is function Get_Right (Target : Iir) return Iir; procedure Set_Right (Target : Iir; An_Iir : Iir); - -- Field: Field3 + -- Field: Field3 Ref + function Get_Physical_Unit (Lit : Iir) return Iir; + procedure Set_Physical_Unit (Lit : Iir; Name : Iir); + + -- Field: Field0 function Get_Unit_Name (Target : Iir) return Iir; procedure Set_Unit_Name (Target : Iir; Name : Iir); @@ -6761,7 +6859,7 @@ package Iirs is procedure Set_Prefix (Target : Iir; Prefix : Iir); -- Prefix of a name signature - -- Field: Field1 Ref + -- Field: Field1 function Get_Signature_Prefix (Sign : Iir) return Iir; procedure Set_Signature_Prefix (Sign : Iir; Prefix : Iir); @@ -6811,17 +6909,21 @@ package Iirs is -- Unless the formal is an unconstrained array type, this is the same as -- the formal type. -- Subtype indiciation for a type association. - -- Field: Field5 + -- Field: Field3 Ref function Get_Actual_Type (Target : Iir) return Iir; procedure Set_Actual_Type (Target : Iir; Atype : Iir); + -- Field: Field5 + function Get_Actual_Type_Definition (Target : Iir) return Iir; + procedure Set_Actual_Type_Definition (Target : Iir; Atype : Iir); + -- List of individual associations for association_element_by_individual. -- Associations for parenthesis_name. -- Field: Field2 Chain function Get_Association_Chain (Target : Iir) return Iir; procedure Set_Association_Chain (Target : Iir; Chain : Iir); - -- List of individual associations for association_element_by_individual. + -- List of choices for association_element_by_individual. -- Field: Field4 Chain function Get_Individual_Association_Chain (Target : Iir) return Iir; procedure Set_Individual_Association_Chain (Target : Iir; Chain : Iir); @@ -6856,12 +6958,12 @@ package Iirs is procedure Set_Aggr_Min_Length (Info : Iir_Aggregate_Info; Nbr : Iir_Int32); -- Highest index choice, if any. - -- Field: Field2 + -- Field: Field2 Ref function Get_Aggr_Low_Limit (Target : Iir_Aggregate_Info) return Iir; procedure Set_Aggr_Low_Limit (Target : Iir_Aggregate_Info; Limit : Iir); -- Highest index choice, if any. - -- Field: Field3 + -- Field: Field3 Ref function Get_Aggr_High_Limit (Target : Iir_Aggregate_Info) return Iir; procedure Set_Aggr_High_Limit (Target : Iir_Aggregate_Info; Limit : Iir); @@ -6913,7 +7015,7 @@ package Iirs is procedure Set_Parameter_Association_Chain (Target : Iir; Chain : Iir); -- Object of a method call. NULL_IIR if the subprogram is not a method. - -- Field: Field4 + -- Field: Field4 Ref function Get_Method_Object (Target : Iir) return Iir; procedure Set_Method_Object (Target : Iir; Object : Iir); @@ -6993,7 +7095,7 @@ package Iirs is procedure Set_Simple_Name_Subtype (Target : Iir; Atype : Iir); -- Body of a protected type declaration. - -- Field: Field2 Ref + -- Field: Field2 Forward_Ref function Get_Protected_Type_Body (Target : Iir) return Iir; procedure Set_Protected_Type_Body (Target : Iir; Bod : Iir); @@ -7099,6 +7201,10 @@ package Iirs is function Get_Is_Ref (N : Iir) return Boolean; procedure Set_Is_Ref (N : Iir; Ref : Boolean); + -- Field: Flag1 + function Get_Is_Forward_Ref (N : Iir) return Boolean; + procedure Set_Is_Forward_Ref (N : Iir; Ref : Boolean); + -- Field: Field1 (uc) function Get_Psl_Property (Decl : Iir) return PSL_Node; procedure Set_Psl_Property (Decl : Iir; Prop : PSL_Node); diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb index 09ebadf0f..19966f306 100644 --- a/src/vhdl/iirs_utils.adb +++ b/src/vhdl/iirs_utils.adb @@ -800,6 +800,17 @@ package body Iirs_Utils is return Build_Simple_Name (Ref, Get_Location (Loc)); end Build_Simple_Name; + function Build_Reference_Name (Name : Iir) return Iir + is + Res : Iir; + begin + Res := Create_Iir (Iir_Kind_Reference_Name); + Location_Copy (Res, Name); + Set_Referenced_Name (Res, Name); + Set_Named_Entity (Res, Get_Named_Entity (Name)); + return Res; + end Build_Reference_Name; + function Has_Resolution_Function (Subtyp : Iir) return Iir is Ind : constant Iir := Get_Resolution_Indication (Subtyp); @@ -813,13 +824,6 @@ package body Iirs_Utils is end if; end Has_Resolution_Function; - function Get_Primary_Unit_Name (Physical_Def : Iir) return Iir - is - Unit : constant Iir := Get_Primary_Unit (Physical_Def); - begin - return Get_Unit_Name (Get_Physical_Unit_Value (Unit)); - end Get_Primary_Unit_Name; - function Is_Type_Name (Name : Iir) return Iir is Ent : Iir; diff --git a/src/vhdl/iirs_utils.ads b/src/vhdl/iirs_utils.ads index d5ea438c0..843adce7c 100644 --- a/src/vhdl/iirs_utils.ads +++ b/src/vhdl/iirs_utils.ads @@ -166,16 +166,13 @@ package Iirs_Utils is function Build_Simple_Name (Ref : Iir; Loc : Location_Type) return Iir; function Build_Simple_Name (Ref : Iir; Loc : Iir) return Iir; + -- Create a name that referenced the same named entity as NAME. + function Build_Reference_Name (Name : Iir) return Iir; + -- If SUBTYP has a resolution indication that is a function name, returns -- the function declaration (not the name). function Has_Resolution_Function (Subtyp : Iir) return Iir; - -- Return a simple name for the primary unit of physical type PHYSICAL_DEF. - -- This is the artificial unit name for the value of the primary unit, thus - -- its location is the location of the primary unit. Used mainly to build - -- evaluated literals. - function Get_Primary_Unit_Name (Physical_Def : Iir) return Iir; - -- Get the type of any node representing a subtype indication. This simply -- skip over denoting names. function Get_Type_Of_Subtype_Indication (Ind : Iir) return Iir; diff --git a/src/vhdl/nodes_gc.adb b/src/vhdl/nodes_gc.adb index c73331e3a..3ff1002a2 100644 --- a/src/vhdl/nodes_gc.adb +++ b/src/vhdl/nodes_gc.adb @@ -19,7 +19,8 @@ with Ada.Text_IO; with Types; use Types; with Nodes; -with Nodes_Meta; +with Nodes_Meta; use Nodes_Meta; +with Errorout; use Errorout; with Iirs; use Iirs; with Libraries; with Disp_Tree; @@ -30,6 +31,8 @@ package body Nodes_GC is type Marker_Array is array (Iir range <>) of Boolean; type Marker_Array_Acc is access Marker_Array; + Has_Error : Boolean := False; + Markers : Marker_Array_Acc; procedure Mark_Iir (N : Iir); @@ -66,8 +69,9 @@ package body Nodes_GC is is use Ada.Text_IO; begin + Put ("Already marked "); Disp_Tree.Disp_Tree (N, True); - return; + Has_Error := True; end Report_Already_Marked; procedure Already_Marked (N : Iir) is @@ -94,7 +98,7 @@ package body Nodes_GC is Report_Already_Marked (N); end Already_Marked; - procedure Not_Marked (N : Iir; F : Nodes_Meta.Fields_Enum) + procedure Report_Early_Reference (N : Iir; F : Nodes_Meta.Fields_Enum) is use Ada.Text_IO; begin @@ -102,7 +106,8 @@ package body Nodes_GC is Put (Nodes_Meta.Get_Field_Image (F)); Put (" in "); Disp_Tree.Disp_Tree (N, True); - end Not_Marked; + Has_Error := True; + end Report_Early_Reference; procedure Mark_Chain (Head : Iir) is @@ -118,8 +123,41 @@ package body Nodes_GC is procedure Report_Unreferenced_Node (N : Iir) is begin Disp_Tree.Disp_Tree (N, True); + -- Has_Error := True; end Report_Unreferenced_Node; + procedure Mark_Iir_Ref_Field (N : Iir; F : Fields_Enum) is + begin + case Get_Field_Type (F) is + when Type_Iir => + declare + Nf : constant Iir := Get_Iir (N, F); + begin + if Is_Valid (Nf) and then not Markers (Nf) then + Report_Early_Reference (N, F); + end if; + end; + when Type_Iir_List => + declare + Nl : constant Iir_List := Get_Iir_List (N, F); + El : Iir; + begin + if Is_Null_List (Nl) or else Nl in Iir_Lists_All_Others then + return; + end if; + for I in Natural loop + El := Get_Nth_Element (Nl, I); + exit when El = Null_Iir; + if not Markers (El) then + Report_Early_Reference (El, F); + end if; + end loop; + end; + when others => + raise Internal_Error; + end case; + end Mark_Iir_Ref_Field; + procedure Mark_Iir (N : Iir) is begin if N = Null_Iir then @@ -132,7 +170,6 @@ package body Nodes_GC is end if; declare - use Nodes_Meta; Fields : constant Fields_Array := Get_Fields (Get_Kind (N)); F : Fields_Enum; begin @@ -140,17 +177,37 @@ package body Nodes_GC is F := Fields (I); case Get_Field_Attribute (F) is when Attr_Ref => - pragma Assert (Get_Field_Type (F) = Type_Iir); - if Is_Valid (Get_Iir (N, F)) - and then not Markers (Get_Iir (N, F)) - then - Not_Marked (N, F); - end if; + Mark_Iir_Ref_Field (N, F); when Attr_Forward_Ref | Attr_Chain_Next => null; + when Attr_Maybe_Forward_Ref => + -- Only used for Named_Entity + pragma Assert (F = Field_Named_Entity); + + -- Overload_List has to be handled specially, as it that + -- case the Ref applies to the elements of the list. + declare + Nf : constant Iir := Get_Iir (N, F); + begin + if Nf /= Null_Iir then + if Get_Is_Forward_Ref (N) then + pragma Assert + (Get_Kind (Nf) /= Iir_Kind_Overload_List); + null; + else + if Get_Kind (Nf) = Iir_Kind_Overload_List then + Mark_Iir (Nf); + else + Mark_Iir_Ref_Field (N, F); + end if; + end if; + end if; + end; when Attr_Maybe_Ref => - if not Get_Is_Ref (N) then + if Get_Is_Ref (N) then + Mark_Iir_Ref_Field (N, F); + else Mark_Iir (Get_Iir (N, F)); end if; when Attr_Chain => @@ -169,12 +226,53 @@ package body Nodes_GC is null; end case; when Attr_Of_Ref => - null; + Mark_Iir_Ref_Field (N, F); end case; end loop; end; end Mark_Iir; + procedure Mark_Unit (Unit : Iir) + is + List : Iir_List; + El : Iir; + begin + pragma Assert (Get_Kind (Unit) = Iir_Kind_Design_Unit); + if Markers (Unit) then + return; + end if; + + -- First mark dependences + List := Get_Dependence_List (Unit); + if List /= Null_Iir_List then + for I in Natural loop + El := Get_Nth_Element (List, I); + exit when El = Null_Iir; + + case Get_Kind (El) is + when Iir_Kind_Design_Unit => + Mark_Unit (El); + when Iir_Kind_Entity_Aspect_Entity => + declare + Ent : constant Iir := Get_Entity_Name (El); + Arch : constant Iir := Get_Architecture (El); + begin + Mark_Unit (Get_Design_Unit (Get_Named_Entity (Ent))); + if Is_Valid (Arch) + and then Is_Valid (Get_Named_Entity (Arch)) + then + Mark_Unit (Get_Named_Entity (Arch)); + end if; + end; + when others => + Error_Kind ("mark_unit", El); + end case; + end loop; + end if; + + Mark_Iir (Unit); + end Mark_Unit; + procedure Report_Unreferenced is use Ada.Text_IO; @@ -184,18 +282,92 @@ package body Nodes_GC is begin Markers := new Marker_Array'(Null_Iir .. Iirs.Get_Last_Node => False); - if Flag_Disp_Multiref then - Put_Line ("** nodes already marked:"); - end if; + Has_Error := False; + + -- Node not owned, but used for "/" (time, time). + Markers (Convertible_Integer_Type_Definition) := True; + Markers (Convertible_Real_Type_Definition) := True; + + -- The user nodes. + declare + Lib : Iir; + File : Iir; + Unit : Iir; + begin + -- First mark all known libraries and file. + Lib := Libraries.Get_Libraries_Chain; + while Is_Valid (Lib) loop + pragma Assert (Get_Kind (Lib) = Iir_Kind_Library_Declaration); + pragma Assert (not Markers (Lib)); + Markers (Lib) := True; + File := Get_Design_File_Chain (Lib); + while Is_Valid (File) loop + pragma Assert (Get_Kind (File) = Iir_Kind_Design_File); + pragma Assert (not Markers (File)); + Markers (File) := True; + File := Get_Chain (File); + end loop; + Lib := Get_Chain (Lib); + end loop; + + -- Then mark all design units. This has to consider first the + -- dependencies. + Lib := Libraries.Get_Libraries_Chain; + while Is_Valid (Lib) loop + pragma Assert (Get_Kind (Lib) = Iir_Kind_Library_Declaration); + File := Get_Design_File_Chain (Lib); + while Is_Valid (File) loop + pragma Assert (Get_Kind (File) = Iir_Kind_Design_File); + Unit := Get_First_Design_Unit (File); + while Is_Valid (Unit) loop + Mark_Unit (Unit); + Unit := Get_Chain (Unit); + end loop; + File := Get_Chain (File); + end loop; + Lib := Get_Chain (Lib); + end loop; + end; + + -- Obsoleted units. + declare + Unit : Iir; + begin + Unit := Libraries.Obsoleted_Design_Units; + while Is_Valid (Unit) loop + pragma Assert (Get_Kind (Unit) = Iir_Kind_Design_Unit); + -- FIXME: obsoleted units may be in various state: + -- - unit created by the .cf file and replaced by the loaded one + -- (should have been free) + -- - unit directly obsoleted by a new unit in the same file + -- - unit indirectly obsoleted. + if Get_Date_State (Unit) <= Date_Disk then + -- Never loaded unit, so not referenced and removed from its + -- design file. + -- FIXME: free it early. + pragma Assert (Get_Dependence_List (Unit) = Null_Iir_List); + Mark_Iir (Unit); + else + if not Markers (Unit) then + Mark_Iir (Unit); + end if; + end if; + Unit := Get_Chain (Unit); + end loop; + end; + + -- These nodes are owned by type/subtype declarations, so unmark them + -- before marking their owner. + Markers (Convertible_Integer_Type_Definition) := False; + Markers (Convertible_Real_Type_Definition) := False; - Mark_Chain (Libraries.Get_Libraries_Chain); - Mark_Chain (Libraries.Obsoleted_Design_Units); + -- These nodes are not rooted. Mark_Iir (Convertible_Integer_Type_Declaration); Mark_Iir (Convertible_Integer_Subtype_Declaration); Mark_Iir (Convertible_Real_Type_Declaration); Mark_Iir (Universal_Integer_One); - Mark_Iir (Error_Mark); Mark_Chain (Wildcard_Type_Declaration_Chain); + Mark_Iir (Error_Mark); El := Error_Mark; Nbr_Unreferenced := 0; @@ -210,7 +382,7 @@ package body Nodes_GC is El := Iir (Nodes.Next_Node (Nodes.Node_Type (El))); end loop; - if Nbr_Unreferenced /= 0 then + if Has_Error then raise Internal_Error; end if; end Report_Unreferenced; diff --git a/src/vhdl/nodes_gc.ads b/src/vhdl/nodes_gc.ads index ef8e647c3..ad17c67b7 100644 --- a/src/vhdl/nodes_gc.ads +++ b/src/vhdl/nodes_gc.ads @@ -17,7 +17,7 @@ -- 02111-1307, USA. package Nodes_GC is - Flag_Disp_Multiref : Boolean := False; + Flag_Disp_Multiref : Boolean := True; procedure Report_Unreferenced; -- Display nodes that aren't referenced. diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb index 0efd08967..954610a6f 100644 --- a/src/vhdl/nodes_meta.adb +++ b/src/vhdl/nodes_meta.adb @@ -89,6 +89,7 @@ package body Nodes_Meta is Field_Configuration_Item_Chain => Type_Iir, Field_Attribute_Value_Chain => Type_Iir, Field_Spec_Chain => Type_Iir, + Field_Value_Chain => Type_Iir, Field_Attribute_Value_Spec_Chain => Type_Iir, Field_Entity_Name => Type_Iir, Field_Package => Type_Iir, @@ -135,6 +136,7 @@ package body Nodes_Meta is Field_File_Logical_Name => Type_Iir, Field_File_Open_Kind => Type_Iir, Field_Element_Position => Type_Iir_Index32, + Field_Base_Element_Declaration => Type_Iir, Field_Element_Declaration => Type_Iir, Field_Selected_Element => Type_Iir, Field_Use_Clause_Chain => Type_Iir, @@ -236,6 +238,7 @@ package body Nodes_Meta is Field_Package_Header => Type_Iir, Field_Block_Header => Type_Iir, Field_Uninstantiated_Package_Name => Type_Iir, + Field_Uninstantiated_Package_Decl => Type_Iir, Field_Generate_Block_Configuration => Type_Iir, Field_Generate_Statement_Body => Type_Iir, Field_Alternative_Label => Type_Name_Id, @@ -254,11 +257,13 @@ package body Nodes_Meta is Field_Binding_Indication => Type_Iir, Field_Named_Entity => Type_Iir, Field_Alias_Declaration => Type_Iir, + Field_Referenced_Name => Type_Iir, Field_Expr_Staticness => Type_Iir_Staticness, Field_Error_Origin => Type_Iir, Field_Operand => Type_Iir, Field_Left => Type_Iir, Field_Right => Type_Iir, + Field_Physical_Unit => Type_Iir, Field_Unit_Name => Type_Iir, Field_Name => Type_Iir, Field_Group_Template_Name => Type_Iir, @@ -275,6 +280,7 @@ package body Nodes_Meta is Field_Attr_Chain => Type_Iir, Field_Signal_Attribute_Declaration => Type_Iir, Field_Actual_Type => Type_Iir, + Field_Actual_Type_Definition => Type_Iir, Field_Association_Chain => Type_Iir, Field_Individual_Association_Chain => Type_Iir, Field_Subprogram_Association_Chain => Type_Iir, @@ -328,6 +334,7 @@ package body Nodes_Meta is Field_Has_Class => Type_Boolean, Field_Suspend_Flag => Type_Boolean, Field_Is_Ref => Type_Boolean, + Field_Is_Forward_Ref => Type_Boolean, Field_Psl_Property => Type_PSL_Node, Field_Psl_Sequence => Type_PSL_Node, Field_Psl_Declaration => Type_PSL_Node, @@ -488,6 +495,8 @@ package body Nodes_Meta is return "attribute_value_chain"; when Field_Spec_Chain => return "spec_chain"; + when Field_Value_Chain => + return "value_chain"; when Field_Attribute_Value_Spec_Chain => return "attribute_value_spec_chain"; when Field_Entity_Name => @@ -580,6 +589,8 @@ package body Nodes_Meta is return "file_open_kind"; when Field_Element_Position => return "element_position"; + when Field_Base_Element_Declaration => + return "base_element_declaration"; when Field_Element_Declaration => return "element_declaration"; when Field_Selected_Element => @@ -782,6 +793,8 @@ package body Nodes_Meta is return "block_header"; when Field_Uninstantiated_Package_Name => return "uninstantiated_package_name"; + when Field_Uninstantiated_Package_Decl => + return "uninstantiated_package_decl"; when Field_Generate_Block_Configuration => return "generate_block_configuration"; when Field_Generate_Statement_Body => @@ -818,6 +831,8 @@ package body Nodes_Meta is return "named_entity"; when Field_Alias_Declaration => return "alias_declaration"; + when Field_Referenced_Name => + return "referenced_name"; when Field_Expr_Staticness => return "expr_staticness"; when Field_Error_Origin => @@ -828,6 +843,8 @@ package body Nodes_Meta is return "left"; when Field_Right => return "right"; + when Field_Physical_Unit => + return "physical_unit"; when Field_Unit_Name => return "unit_name"; when Field_Name => @@ -860,6 +877,8 @@ package body Nodes_Meta is return "signal_attribute_declaration"; when Field_Actual_Type => return "actual_type"; + when Field_Actual_Type_Definition => + return "actual_type_definition"; when Field_Association_Chain => return "association_chain"; when Field_Individual_Association_Chain => @@ -966,6 +985,8 @@ package body Nodes_Meta is return "suspend_flag"; when Field_Is_Ref => return "is_ref"; + when Field_Is_Forward_Ref => + return "is_forward_ref"; when Field_Psl_Property => return "psl_property"; when Field_Psl_Sequence => @@ -1422,6 +1443,8 @@ package body Nodes_Meta is return "selected_name"; when Iir_Kind_Operator_Symbol => return "operator_symbol"; + when Iir_Kind_Reference_Name => + return "reference_name"; when Iir_Kind_Selected_By_All_Name => return "selected_by_all_name"; when Iir_Kind_Parenthesis_Name => @@ -1563,7 +1586,7 @@ package body Nodes_Meta is when Field_Library_Unit => return Attr_None; when Field_Hash_Chain => - return Attr_Ref; + return Attr_Forward_Ref; when Field_Design_Unit_Source_Pos => return Attr_None; when Field_Design_Unit_Source_Line => @@ -1575,13 +1598,13 @@ package body Nodes_Meta is when Field_Enum_Pos => return Attr_None; when Field_Physical_Literal => - return Attr_None; + return Attr_Ref; when Field_Physical_Unit_Value => return Attr_None; when Field_Fp_Value => return Attr_None; when Field_Simple_Aggregate_List => - return Attr_None; + return Attr_Ref; when Field_String8_Id => return Attr_None; when Field_String_Length => @@ -1609,13 +1632,13 @@ package body Nodes_Meta is when Field_Attribute_Designator => return Attr_None; when Field_Attribute_Specification_Chain => - return Attr_None; + return Attr_Ref; when Field_Attribute_Specification => return Attr_Ref; when Field_Signal_List => return Attr_None; when Field_Designated_Entity => - return Attr_Ref; + return Attr_Forward_Ref; when Field_Formal => return Attr_None; when Field_Actual => @@ -1661,9 +1684,11 @@ package body Nodes_Meta is when Field_Configuration_Item_Chain => return Attr_Chain; when Field_Attribute_Value_Chain => - return Attr_Chain; + return Attr_Ref; when Field_Spec_Chain => return Attr_None; + when Field_Value_Chain => + return Attr_Ref; when Field_Attribute_Value_Spec_Chain => return Attr_None; when Field_Entity_Name => @@ -1671,7 +1696,7 @@ package body Nodes_Meta is when Field_Package => return Attr_Ref; when Field_Package_Body => - return Attr_Ref; + return Attr_Forward_Ref; when Field_Package_Instantiation_Bodies_Chain => return Attr_Chain; when Field_Need_Body => @@ -1699,7 +1724,7 @@ package body Nodes_Meta is when Field_Type_Definition => return Attr_None; when Field_Subtype_Definition => - return Attr_None; + return Attr_Forward_Ref; when Field_Incomplete_Type_Declaration => return Attr_Ref; when Field_Interface_Type_Subprograms => @@ -1721,7 +1746,7 @@ package body Nodes_Meta is when Field_Sequential_Statement_Chain => return Attr_Chain; when Field_Subprogram_Body => - return Attr_Ref; + return Attr_Forward_Ref; when Field_Overload_Number => return Attr_None; when Field_Subprogram_Depth => @@ -1737,7 +1762,7 @@ package body Nodes_Meta is when Field_Default_Value => return Attr_Maybe_Ref; when Field_Deferred_Declaration => - return Attr_Ref; + return Attr_Forward_Ref; when Field_Deferred_Declaration_Flag => return Attr_None; when Field_Shared_Flag => @@ -1756,6 +1781,8 @@ package body Nodes_Meta is return Attr_None; when Field_Element_Position => return Attr_None; + when Field_Base_Element_Declaration => + return Attr_Ref; when Field_Element_Declaration => return Attr_None; when Field_Selected_Element => @@ -1791,7 +1818,7 @@ package body Nodes_Meta is when Field_Visible_Flag => return Attr_None; when Field_Range_Constraint => - return Attr_None; + return Attr_Maybe_Ref; when Field_Direction => return Attr_None; when Field_Left_Limit => @@ -1859,7 +1886,7 @@ package body Nodes_Meta is when Field_Waveform_Chain => return Attr_Chain; when Field_Guard => - return Attr_None; + return Attr_Ref; when Field_Delay_Mechanism => return Attr_None; when Field_Reject_Time_Expression => @@ -1925,9 +1952,9 @@ package body Nodes_Meta is when Field_Configuration_Name => return Attr_None; when Field_Component_Configuration => - return Attr_None; + return Attr_Forward_Ref; when Field_Configuration_Specification => - return Attr_None; + return Attr_Ref; when Field_Default_Binding_Indication => return Attr_None; when Field_Default_Configuration_Declaration => @@ -1951,15 +1978,17 @@ package body Nodes_Meta is when Field_Signal_Attribute_Chain => return Attr_Forward_Ref; when Field_Block_Block_Configuration => - return Attr_None; + return Attr_Forward_Ref; when Field_Package_Header => return Attr_None; when Field_Block_Header => return Attr_None; when Field_Uninstantiated_Package_Name => return Attr_None; + when Field_Uninstantiated_Package_Decl => + return Attr_Ref; when Field_Generate_Block_Configuration => - return Attr_None; + return Attr_Forward_Ref; when Field_Generate_Statement_Body => return Attr_None; when Field_Alternative_Label => @@ -1991,9 +2020,11 @@ package body Nodes_Meta is when Field_Binding_Indication => return Attr_None; when Field_Named_Entity => - return Attr_Ref; + return Attr_Maybe_Forward_Ref; when Field_Alias_Declaration => - return Attr_None; + return Attr_Ref; + when Field_Referenced_Name => + return Attr_Ref; when Field_Expr_Staticness => return Attr_None; when Field_Error_Origin => @@ -2004,6 +2035,8 @@ package body Nodes_Meta is return Attr_None; when Field_Right => return Attr_None; + when Field_Physical_Unit => + return Attr_Ref; when Field_Unit_Name => return Attr_None; when Field_Name => @@ -2015,7 +2048,7 @@ package body Nodes_Meta is when Field_Prefix => return Attr_None; when Field_Signature_Prefix => - return Attr_Ref; + return Attr_None; when Field_External_Pathname => return Attr_None; when Field_Pathname_Suffix => @@ -2035,6 +2068,8 @@ package body Nodes_Meta is when Field_Signal_Attribute_Declaration => return Attr_Forward_Ref; when Field_Actual_Type => + return Attr_Ref; + when Field_Actual_Type_Definition => return Attr_None; when Field_Association_Chain => return Attr_Chain; @@ -2051,9 +2086,9 @@ package body Nodes_Meta is when Field_Aggr_Min_Length => return Attr_None; when Field_Aggr_Low_Limit => - return Attr_None; + return Attr_Ref; when Field_Aggr_High_Limit => - return Attr_None; + return Attr_Ref; when Field_Aggr_Others_Flag => return Attr_None; when Field_Aggr_Named_Flag => @@ -2073,7 +2108,7 @@ package body Nodes_Meta is when Field_Parameter_Association_Chain => return Attr_Chain; when Field_Method_Object => - return Attr_None; + return Attr_Ref; when Field_Subtype_Type_Mark => return Attr_None; when Field_Type_Conversion_Subtype => @@ -2105,7 +2140,7 @@ package body Nodes_Meta is when Field_Simple_Name_Subtype => return Attr_None; when Field_Protected_Type_Body => - return Attr_Ref; + return Attr_Forward_Ref; when Field_Protected_Type_Declaration => return Attr_Ref; when Field_End_Location => @@ -2142,6 +2177,8 @@ package body Nodes_Meta is return Attr_None; when Field_Is_Ref => return Attr_None; + when Field_Is_Forward_Ref => + return Attr_None; when Field_Psl_Property => return Attr_None; when Field_Psl_Sequence => @@ -2173,8 +2210,8 @@ package body Nodes_Meta is Field_Signal_Type_Flag, Field_Has_Signal_Flag, Field_Expr_Staticness, - Field_Error_Origin, Field_Type, + Field_Error_Origin, Field_Type_Declarator, Field_Base_Type, -- Iir_Kind_Design_File @@ -2183,10 +2220,10 @@ package body Nodes_Meta is Field_Analysis_Time_Stamp, Field_File_Checksum, Field_Elab_Flag, + Field_Library, Field_File_Dependence_List, Field_Chain, Field_First_Design_Unit, - Field_Library, Field_Last_Design_Unit, -- Iir_Kind_Design_Unit Field_Design_Unit_Source_Pos, @@ -2199,29 +2236,29 @@ package body Nodes_Meta is Field_Configuration_Mark_Flag, Field_Configuration_Done_Flag, Field_Date_State, + Field_Design_File, Field_Context_Items, Field_Chain, Field_Library_Unit, - Field_Design_File, Field_Hash_Chain, Field_Dependence_List, Field_Analysis_Checks_List, -- Iir_Kind_Library_Clause Field_Identifier, Field_Has_Identifier_List, - Field_Chain, Field_Parent, Field_Library_Declaration, + Field_Chain, -- Iir_Kind_Use_Clause + Field_Parent, Field_Selected_Name, Field_Chain, Field_Use_Clause_Chain, - Field_Parent, -- Iir_Kind_Context_Reference + Field_Parent, Field_Selected_Name, Field_Chain, Field_Context_Reference_Chain, - Field_Parent, -- Iir_Kind_Integer_Literal Field_Value, Field_Expr_Staticness, @@ -2250,18 +2287,20 @@ package body Nodes_Meta is Field_Value, Field_Expr_Staticness, Field_Literal_Origin, + Field_Physical_Unit, Field_Unit_Name, Field_Type, -- Iir_Kind_Physical_Fp_Literal Field_Fp_Value, Field_Expr_Staticness, Field_Literal_Origin, + Field_Physical_Unit, Field_Unit_Name, Field_Type, -- Iir_Kind_Simple_Aggregate Field_Expr_Staticness, - Field_Literal_Origin, Field_Literal_Subtype, + Field_Literal_Origin, Field_Simple_Aggregate_List, Field_Type, -- Iir_Kind_Overflow_Literal @@ -2270,16 +2309,16 @@ package body Nodes_Meta is Field_Type, -- Iir_Kind_Waveform_Element Field_We_Value, - Field_Chain, Field_Time, + Field_Chain, -- Iir_Kind_Conditional_Waveform Field_Condition, - Field_Chain, Field_Waveform_Chain, + Field_Chain, -- Iir_Kind_Conditional_Expression Field_Condition, - Field_Chain, Field_Expression, + Field_Chain, -- Iir_Kind_Association_Element_By_Expression Field_Whole_Association_Flag, Field_Collapse_Signal_Flag, @@ -2295,6 +2334,7 @@ package body Nodes_Meta is Field_Formal, Field_Chain, Field_Individual_Association_Chain, + Field_Actual_Type_Definition, Field_Actual_Type, -- Iir_Kind_Association_Element_Open Field_Whole_Association_Flag, @@ -2323,39 +2363,39 @@ package body Nodes_Meta is Field_Actual, -- Iir_Kind_Choice_By_Others Field_Same_Alternative_Flag, + Field_Parent, Field_Chain, Field_Associated_Expr, Field_Associated_Chain, - Field_Parent, -- Iir_Kind_Choice_By_Expression Field_Same_Alternative_Flag, Field_Choice_Staticness, + Field_Parent, Field_Chain, Field_Associated_Expr, Field_Associated_Chain, Field_Choice_Expression, - Field_Parent, -- Iir_Kind_Choice_By_Range Field_Same_Alternative_Flag, Field_Choice_Staticness, + Field_Parent, Field_Chain, Field_Associated_Expr, Field_Associated_Chain, Field_Choice_Range, - Field_Parent, -- Iir_Kind_Choice_By_None Field_Same_Alternative_Flag, + Field_Parent, Field_Chain, Field_Associated_Expr, Field_Associated_Chain, - Field_Parent, -- Iir_Kind_Choice_By_Name Field_Same_Alternative_Flag, + Field_Parent, Field_Chain, Field_Associated_Expr, Field_Associated_Chain, Field_Choice_Name, - Field_Parent, -- Iir_Kind_Entity_Aspect_Entity Field_Entity_Name, Field_Architecture, @@ -2363,24 +2403,24 @@ package body Nodes_Meta is Field_Configuration_Name, -- Iir_Kind_Entity_Aspect_Open -- Iir_Kind_Block_Configuration + Field_Parent, Field_Declaration_Chain, Field_Chain, Field_Configuration_Item_Chain, - Field_Block_Specification, - Field_Parent, Field_Prev_Block_Configuration, + Field_Block_Specification, -- Iir_Kind_Block_Header Field_Generic_Chain, Field_Port_Chain, Field_Generic_Map_Aspect_Chain, Field_Port_Map_Aspect_Chain, -- Iir_Kind_Component_Configuration - Field_Instantiation_List, - Field_Chain, - Field_Binding_Indication, + Field_Parent, Field_Component_Name, + Field_Instantiation_List, Field_Block_Configuration, - Field_Parent, + Field_Binding_Indication, + Field_Chain, -- Iir_Kind_Binding_Indication Field_Default_Entity_Aspect, Field_Entity_Aspect, @@ -2395,15 +2435,15 @@ package body Nodes_Meta is Field_Expr_Staticness, Field_Name_Staticness, Field_Spec_Chain, - Field_Chain, Field_Type, + Field_Value_Chain, Field_Designated_Entity, Field_Attribute_Specification, Field_Base_Name, -- Iir_Kind_Signature + Field_Signature_Prefix, Field_Type_Marks_List, Field_Return_Type_Mark, - Field_Signature_Prefix, -- Iir_Kind_Aggregate_Info Field_Aggr_Min_Length, Field_Aggr_Others_Flag, @@ -2415,17 +2455,18 @@ package body Nodes_Meta is -- Iir_Kind_Procedure_Call Field_Prefix, Field_Parameter_Association_Chain, - Field_Method_Object, Field_Implementation, + Field_Method_Object, -- Iir_Kind_Record_Element_Constraint Field_Identifier, Field_Element_Position, Field_Visible_Flag, - Field_Element_Declaration, Field_Parent, Field_Type, + Field_Element_Declaration, -- Iir_Kind_Array_Element_Resolution Field_Resolution_Indication, + Field_Element_Subtype_Indication, -- Iir_Kind_Record_Resolution Field_Record_Element_Resolution_Chain, -- Iir_Kind_Record_Element_Resolution @@ -2434,34 +2475,34 @@ package body Nodes_Meta is Field_Resolution_Indication, -- Iir_Kind_Attribute_Specification Field_Entity_Class, + Field_Parent, Field_Chain, - Field_Attribute_Value_Spec_Chain, + Field_Entity_Name_List, Field_Expression, + Field_Attribute_Value_Spec_Chain, Field_Attribute_Designator, Field_Attribute_Specification_Chain, - Field_Entity_Name_List, - Field_Parent, -- Iir_Kind_Disconnection_Specification + Field_Parent, Field_Chain, Field_Signal_List, Field_Type_Mark, Field_Expression, - Field_Parent, -- Iir_Kind_Configuration_Specification + Field_Parent, + Field_Component_Name, Field_Instantiation_List, - Field_Chain, Field_Binding_Indication, - Field_Component_Name, - Field_Parent, + Field_Chain, -- Iir_Kind_Access_Type_Definition Field_Resolved_Flag, 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, + Field_Incomplete_Type_Ref_Chain, -- Iir_Kind_Incomplete_Type_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, @@ -2515,12 +2556,12 @@ package body Nodes_Meta is Field_Index_Constraint_Flag, Field_Type_Staticness, Field_Constraint_State, - Field_Element_Subtype_Indication, Field_Index_Subtype_Definition_List, + Field_Element_Subtype_Indication, + Field_Index_Subtype_List, Field_Element_Subtype, Field_Type_Declarator, Field_Base_Type, - Field_Index_Subtype_List, -- Iir_Kind_Array_Subtype_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, @@ -2531,12 +2572,12 @@ package body Nodes_Meta is Field_Subtype_Type_Mark, Field_Resolution_Indication, Field_Index_Constraint_List, - Field_Tolerance, + Field_Index_Subtype_List, Field_Array_Element_Constraint, + Field_Tolerance, Field_Element_Subtype, Field_Type_Declarator, Field_Base_Type, - Field_Index_Subtype_List, -- Iir_Kind_Record_Subtype_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, @@ -2545,68 +2586,73 @@ package body Nodes_Meta is Field_Constraint_State, Field_Elements_Declaration_List, Field_Subtype_Type_Mark, - Field_Resolution_Indication, - Field_Tolerance, Field_Type_Declarator, Field_Base_Type, + Field_Resolution_Indication, + Field_Tolerance, -- Iir_Kind_Access_Subtype_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, Field_Type_Staticness, - Field_Subtype_Type_Mark, - Field_Designated_Subtype_Indication, Field_Designated_Type, + Field_Subtype_Type_Mark, Field_Type_Declarator, Field_Base_Type, + Field_Designated_Subtype_Indication, -- Iir_Kind_Physical_Subtype_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, Field_Has_Signal_Flag, + Field_Is_Ref, Field_Type_Staticness, Field_Range_Constraint, Field_Subtype_Type_Mark, - Field_Resolution_Indication, Field_Type_Declarator, Field_Base_Type, + Field_Resolution_Indication, -- Iir_Kind_Floating_Subtype_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, Field_Has_Signal_Flag, + Field_Is_Ref, Field_Type_Staticness, Field_Range_Constraint, Field_Subtype_Type_Mark, - Field_Resolution_Indication, - Field_Tolerance, Field_Type_Declarator, Field_Base_Type, + Field_Resolution_Indication, + Field_Tolerance, -- Iir_Kind_Integer_Subtype_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, Field_Has_Signal_Flag, + Field_Is_Ref, Field_Type_Staticness, Field_Range_Constraint, Field_Subtype_Type_Mark, - Field_Resolution_Indication, Field_Type_Declarator, Field_Base_Type, + Field_Resolution_Indication, -- Iir_Kind_Enumeration_Subtype_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, Field_Has_Signal_Flag, + Field_Is_Ref, Field_Type_Staticness, Field_Range_Constraint, Field_Subtype_Type_Mark, - Field_Resolution_Indication, Field_Type_Declarator, Field_Base_Type, + Field_Resolution_Indication, -- Iir_Kind_Enumeration_Type_Definition Field_Resolved_Flag, Field_Signal_Type_Flag, Field_Has_Signal_Flag, Field_Only_Characters_Flag, + Field_Is_Ref, Field_Type_Staticness, - Field_Range_Constraint, Field_Enumeration_Literal_List, + Field_Range_Constraint, Field_Type_Declarator, Field_Base_Type, -- Iir_Kind_Integer_Type_Definition @@ -2636,9 +2682,9 @@ package body Nodes_Meta is -- Iir_Kind_Range_Expression Field_Expr_Staticness, Field_Direction, - Field_Range_Origin, Field_Left_Limit_Expr, Field_Right_Limit_Expr, + Field_Range_Origin, Field_Type, Field_Left_Limit, Field_Right_Limit, @@ -2646,9 +2692,9 @@ package body Nodes_Meta is Field_Identifier, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Declaration_Chain, Field_Chain, - Field_Parent, Field_Protected_Type_Declaration, -- Iir_Kind_Wildcard_Type_Definition Field_Resolved_Flag, @@ -2657,6 +2703,7 @@ package body Nodes_Meta is Field_Type_Declarator, Field_Base_Type, -- Iir_Kind_Subtype_Definition + Field_Is_Ref, Field_Range_Constraint, Field_Subtype_Type_Mark, Field_Resolution_Indication, @@ -2672,39 +2719,39 @@ package body Nodes_Meta is Field_Identifier, Field_Visible_Flag, Field_Use_Flag, + Field_Parent, Field_Type_Definition, Field_Chain, - Field_Parent, Field_Incomplete_Type_Declaration, -- Iir_Kind_Anonymous_Type_Declaration Field_Identifier, + Field_Parent, Field_Type_Definition, Field_Chain, Field_Subtype_Definition, - Field_Parent, Field_Incomplete_Type_Declaration, -- Iir_Kind_Subtype_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, + Field_Parent, Field_Chain, Field_Subtype_Indication, - Field_Parent, Field_Type, -- Iir_Kind_Nature_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, + Field_Parent, Field_Nature, Field_Chain, - Field_Parent, -- Iir_Kind_Subnature_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, + Field_Parent, Field_Nature, Field_Chain, - Field_Parent, -- Iir_Kind_Package_Declaration Field_Identifier, Field_Need_Body, @@ -2713,46 +2760,47 @@ package body Nodes_Meta is Field_Visible_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, + Field_Package_Header, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, - Field_Package_Header, + Field_Package_Body, Field_Package_Origin, Field_Package_Instantiation_Bodies_Chain, - Field_Parent, - Field_Package_Body, -- Iir_Kind_Package_Instantiation_Declaration Field_Identifier, Field_Visible_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, + Field_Uninstantiated_Package_Name, + Field_Uninstantiated_Package_Decl, + Field_Generic_Chain, + Field_Generic_Map_Aspect_Chain, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, - Field_Generic_Chain, - Field_Uninstantiated_Package_Name, - Field_Generic_Map_Aspect_Chain, - Field_Parent, Field_Package_Body, -- Iir_Kind_Package_Body Field_Identifier, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, - Field_Parent, Field_Package, -- Iir_Kind_Configuration_Declaration Field_Identifier, Field_Visible_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Declaration_Chain, Field_Entity_Name, Field_Attribute_Value_Chain, Field_Block_Configuration, - Field_Parent, -- Iir_Kind_Entity_Declaration Field_Identifier, Field_Has_Begin, @@ -2760,12 +2808,12 @@ package body Nodes_Meta is Field_Is_Within_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, - Field_Declaration_Chain, - Field_Attribute_Value_Chain, - Field_Concurrent_Statement_Chain, + Field_Parent, Field_Generic_Chain, Field_Port_Chain, - Field_Parent, + Field_Declaration_Chain, + Field_Concurrent_Statement_Chain, + Field_Attribute_Value_Chain, -- Iir_Kind_Architecture_Body Field_Identifier, Field_Foreign_Flag, @@ -2773,19 +2821,19 @@ package body Nodes_Meta is Field_Is_Within_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, - Field_Declaration_Chain, + Field_Parent, Field_Entity_Name, - Field_Attribute_Value_Chain, + Field_Declaration_Chain, Field_Concurrent_Statement_Chain, + Field_Attribute_Value_Chain, Field_Default_Configuration_Declaration, - Field_Parent, -- Iir_Kind_Context_Declaration Field_Identifier, Field_Visible_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, - Field_Context_Items, Field_Parent, + Field_Context_Items, -- Iir_Kind_Package_Header Field_Generic_Chain, Field_Generic_Map_Aspect_Chain, @@ -2794,11 +2842,11 @@ package body Nodes_Meta is Field_Visible_Flag, Field_Expr_Staticness, Field_Name_Staticness, - Field_Chain, - Field_Physical_Literal, - Field_Physical_Unit_Value, Field_Parent, Field_Type, + Field_Chain, + Field_Physical_Unit_Value, + Field_Physical_Literal, -- Iir_Kind_Library_Declaration Field_Identifier, Field_Date, @@ -2814,33 +2862,33 @@ package body Nodes_Meta is Field_Has_Is, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Chain, Field_Generic_Chain, Field_Port_Chain, - Field_Parent, -- Iir_Kind_Attribute_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, - Field_Chain, - Field_Type_Mark, Field_Parent, Field_Type, + Field_Chain, + Field_Type_Mark, -- Iir_Kind_Group_Template_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, + Field_Parent, Field_Entity_Class_Entry_Chain, Field_Chain, - Field_Parent, -- Iir_Kind_Group_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, + Field_Parent, Field_Group_Constituent_List, Field_Chain, Field_Group_Template_Name, - Field_Parent, -- Iir_Kind_Element_Declaration Field_Identifier, Field_Element_Position, @@ -2848,15 +2896,16 @@ package body Nodes_Meta is Field_Visible_Flag, Field_Subtype_Indication, Field_Type, + Field_Base_Element_Declaration, -- Iir_Kind_Non_Object_Alias_Declaration Field_Identifier, Field_Implicit_Alias_Flag, Field_Visible_Flag, Field_Use_Flag, + Field_Parent, Field_Chain, Field_Name, Field_Alias_Signature, - Field_Parent, -- Iir_Kind_Psl_Declaration Field_Identifier, Field_Psl_Declaration, @@ -2864,8 +2913,8 @@ package body Nodes_Meta is Field_PSL_NFA, Field_Visible_Flag, Field_Use_Flag, - Field_Chain, Field_Parent, + Field_Chain, -- Iir_Kind_Psl_Endpoint_Declaration Field_Identifier, Field_Psl_Declaration, @@ -2877,53 +2926,53 @@ package body Nodes_Meta is Field_Use_Flag, Field_Expr_Staticness, Field_Name_Staticness, - Field_PSL_Clock_Sensitivity, - Field_Chain, Field_Parent, Field_Type, + Field_Chain, + Field_PSL_Clock_Sensitivity, -- Iir_Kind_Terminal_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, + Field_Parent, Field_Nature, Field_Chain, - Field_Parent, -- Iir_Kind_Free_Quantity_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, Field_Expr_Staticness, Field_Name_Staticness, - Field_Chain, - Field_Default_Value, Field_Parent, Field_Type, + Field_Chain, + Field_Default_Value, -- Iir_Kind_Across_Quantity_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, + Field_Type, Field_Chain, + Field_Default_Value, Field_Tolerance, Field_Plus_Terminal, Field_Minus_Terminal, - Field_Default_Value, - Field_Parent, - Field_Type, -- Iir_Kind_Through_Quantity_Declaration Field_Identifier, Field_Visible_Flag, Field_Use_Flag, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, + Field_Type, Field_Chain, + Field_Default_Value, Field_Tolerance, Field_Plus_Terminal, Field_Minus_Terminal, - Field_Default_Value, - Field_Parent, - Field_Type, -- Iir_Kind_Enumeration_Literal Field_Identifier, Field_Subprogram_Hash, @@ -2933,9 +2982,9 @@ package body Nodes_Meta is Field_Is_Within_Flag, Field_Expr_Staticness, Field_Name_Staticness, - Field_Literal_Origin, Field_Parent, Field_Type, + Field_Literal_Origin, -- Iir_Kind_Function_Declaration Field_Subprogram_Depth, Field_Overload_Number, @@ -2955,12 +3004,12 @@ package body Nodes_Meta is Field_Has_Body, Field_Wait_State, Field_All_Sensitized_State, + Field_Parent, + Field_Return_Type, Field_Chain, Field_Interface_Declaration_Chain, Field_Generic_Chain, Field_Return_Type_Mark, - Field_Parent, - Field_Return_Type, Field_Subprogram_Body, -- Iir_Kind_Procedure_Declaration Field_Subprogram_Depth, @@ -2981,21 +3030,21 @@ package body Nodes_Meta is Field_Wait_State, Field_Purity_State, Field_All_Sensitized_State, + Field_Parent, Field_Chain, Field_Interface_Declaration_Chain, Field_Generic_Chain, Field_Return_Type_Mark, - Field_Parent, Field_Subprogram_Body, -- Iir_Kind_Function_Body Field_Impure_Depth, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, Field_Sequential_Statement_Chain, - Field_Parent, Field_Subprogram_Specification, Field_Callees_List, -- Iir_Kind_Procedure_Body @@ -3003,11 +3052,11 @@ package body Nodes_Meta is Field_Suspend_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, Field_Sequential_Statement_Chain, - Field_Parent, Field_Subprogram_Specification, Field_Callees_List, -- Iir_Kind_Object_Alias_Declaration @@ -3017,10 +3066,10 @@ package body Nodes_Meta is Field_Use_Flag, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Name, Field_Subtype_Indication, - Field_Parent, Field_Type, -- Iir_Kind_File_Declaration Field_Identifier, @@ -3031,12 +3080,12 @@ package body Nodes_Meta is Field_Mode, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, + Field_Type, Field_Chain, Field_Subtype_Indication, Field_File_Logical_Name, Field_File_Open_Kind, - Field_Parent, - Field_Type, -- Iir_Kind_Guard_Signal_Declaration Field_Identifier, Field_Has_Active_Flag, @@ -3046,10 +3095,10 @@ package body Nodes_Meta is Field_Signal_Kind, Field_Expr_Staticness, Field_Name_Staticness, - Field_Guard_Expression, - Field_Guard_Sensitivity_List, Field_Parent, Field_Type, + Field_Guard_Expression, + Field_Guard_Sensitivity_List, Field_Block_Statement, -- Iir_Kind_Signal_Declaration Field_Identifier, @@ -3064,10 +3113,10 @@ package body Nodes_Meta is Field_Signal_Kind, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Subtype_Indication, Field_Default_Value, - Field_Parent, Field_Type, -- Iir_Kind_Variable_Declaration Field_Identifier, @@ -3078,10 +3127,10 @@ package body Nodes_Meta is Field_Is_Ref, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Subtype_Indication, Field_Default_Value, - Field_Parent, Field_Type, -- Iir_Kind_Constant_Declaration Field_Identifier, @@ -3092,10 +3141,10 @@ package body Nodes_Meta is Field_Is_Ref, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Subtype_Indication, Field_Default_Value, - Field_Parent, Field_Type, Field_Deferred_Declaration, -- Iir_Kind_Iterator_Declaration @@ -3105,11 +3154,11 @@ package body Nodes_Meta is Field_Use_Flag, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Subtype_Indication, - Field_Parent, - Field_Type, Field_Discrete_Range, + Field_Type, -- Iir_Kind_Interface_Constant_Declaration Field_Identifier, Field_Has_Mode, @@ -3122,10 +3171,10 @@ package body Nodes_Meta is Field_Mode, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Subtype_Indication, Field_Default_Value, - Field_Parent, Field_Type, -- Iir_Kind_Interface_Variable_Declaration Field_Identifier, @@ -3139,10 +3188,10 @@ package body Nodes_Meta is Field_Mode, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Subtype_Indication, Field_Default_Value, - Field_Parent, Field_Type, -- Iir_Kind_Interface_Signal_Declaration Field_Identifier, @@ -3161,10 +3210,10 @@ package body Nodes_Meta is Field_Mode, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Subtype_Indication, Field_Default_Value, - Field_Parent, Field_Type, -- Iir_Kind_Interface_File_Declaration Field_Identifier, @@ -3178,10 +3227,10 @@ package body Nodes_Meta is Field_Mode, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, Field_Chain, Field_Subtype_Indication, Field_Default_Value, - Field_Parent, Field_Type, -- Iir_Kind_Interface_Type_Declaration Field_Identifier, @@ -3190,21 +3239,22 @@ package body Nodes_Meta is Field_Use_Flag, Field_Is_Ref, Field_Name_Staticness, - Field_Chain, - Field_Interface_Type_Subprograms, Field_Parent, Field_Type, + Field_Chain, + Field_Interface_Type_Subprograms, -- Iir_Kind_Interface_Package_Declaration Field_Identifier, Field_Visible_Flag, Field_Is_Within_Flag, + Field_Parent, + Field_Uninstantiated_Package_Name, + Field_Uninstantiated_Package_Decl, + Field_Generic_Chain, + Field_Generic_Map_Aspect_Chain, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, - Field_Generic_Chain, - Field_Uninstantiated_Package_Name, - Field_Generic_Map_Aspect_Chain, - Field_Parent, -- Iir_Kind_Interface_Function_Declaration Field_Subprogram_Depth, Field_Identifier, @@ -3218,11 +3268,11 @@ package body Nodes_Meta is Field_Resolution_Function_Flag, Field_Has_Pure, Field_All_Sensitized_State, + Field_Parent, + Field_Return_Type, Field_Chain, Field_Interface_Declaration_Chain, Field_Return_Type_Mark, - Field_Parent, - Field_Return_Type, -- Iir_Kind_Interface_Procedure_Declaration Field_Subprogram_Depth, Field_Identifier, @@ -3233,276 +3283,276 @@ package body Nodes_Meta is Field_Visible_Flag, Field_Use_Flag, Field_All_Sensitized_State, + Field_Parent, Field_Chain, Field_Interface_Declaration_Chain, Field_Return_Type_Mark, - Field_Parent, -- Iir_Kind_Signal_Attribute_Declaration - Field_Chain, Field_Parent, + Field_Chain, Field_Signal_Attribute_Chain, -- Iir_Kind_Identity_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Negation_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Absolute_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Not_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Condition_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Reduction_And_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Reduction_Or_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Reduction_Nand_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Reduction_Nor_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Reduction_Xor_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_Reduction_Xnor_Operator Field_Expr_Staticness, - Field_Operand, Field_Type, + Field_Operand, Field_Implementation, -- Iir_Kind_And_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Or_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Nand_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Nor_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Xor_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Xnor_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Equality_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Inequality_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Less_Than_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Less_Than_Or_Equal_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Greater_Than_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Greater_Than_Or_Equal_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Match_Equality_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Match_Inequality_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Match_Less_Than_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Match_Less_Than_Or_Equal_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Match_Greater_Than_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Match_Greater_Than_Or_Equal_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Sll_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Sla_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Srl_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Sra_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Rol_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Ror_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Addition_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Substraction_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Concatenation_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Multiplication_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Division_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Modulus_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Remainder_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Exponentiation_Operator Field_Expr_Staticness, - Field_Left, - Field_Right, Field_Type, + Field_Left, Field_Implementation, + Field_Right, -- Iir_Kind_Function_Call Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter_Association_Chain, - Field_Method_Object, Field_Type, + Field_Parameter_Association_Chain, Field_Implementation, + Field_Method_Object, Field_Base_Name, -- Iir_Kind_Aggregate Field_Expr_Staticness, Field_Value_Staticness, - Field_Aggregate_Info, - Field_Literal_Subtype, Field_Association_Choices_Chain, + Field_Literal_Subtype, + Field_Aggregate_Info, Field_Type, -- Iir_Kind_Parenthesis_Expression Field_Expr_Staticness, @@ -3510,26 +3560,26 @@ package body Nodes_Meta is Field_Type, -- Iir_Kind_Qualified_Expression Field_Expr_Staticness, + Field_Type, Field_Type_Mark, Field_Expression, - Field_Type, -- Iir_Kind_Type_Conversion Field_Expr_Staticness, + Field_Type, Field_Type_Conversion_Subtype, Field_Type_Mark, Field_Expression, - Field_Type, -- Iir_Kind_Allocator_By_Expression Field_Expr_Staticness, - Field_Expression, Field_Type, + Field_Expression, Field_Allocator_Designated_Type, -- Iir_Kind_Allocator_By_Subtype Field_Expr_Staticness, - Field_Subtype_Indication, Field_Type, - Field_Allocator_Designated_Type, + Field_Subtype_Indication, Field_Allocator_Subtype, + Field_Allocator_Designated_Type, -- Iir_Kind_Selected_Element Field_Expr_Staticness, Field_Name_Staticness, @@ -3561,8 +3611,8 @@ package body Nodes_Meta is Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Index_List, Field_Type, + Field_Index_List, Field_Base_Name, -- Iir_Kind_Psl_Expression Field_Psl_Expression, @@ -3580,14 +3630,14 @@ package body Nodes_Meta is Field_End_Has_Reserved_Id, Field_End_Has_Identifier, Field_Wait_State, + Field_Parent, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, Field_Sequential_Statement_Chain, Field_Sensitivity_List, - Field_Process_Origin, - Field_Parent, Field_Callees_List, + Field_Process_Origin, -- Iir_Kind_Process_Statement Field_Label, Field_Seen_Flag, @@ -3602,67 +3652,67 @@ package body Nodes_Meta is Field_End_Has_Reserved_Id, Field_End_Has_Identifier, Field_Wait_State, + Field_Parent, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, Field_Sequential_Statement_Chain, - Field_Process_Origin, - Field_Parent, Field_Callees_List, + Field_Process_Origin, -- Iir_Kind_Concurrent_Simple_Signal_Assignment Field_Label, Field_Delay_Mechanism, Field_Postponed_Flag, Field_Visible_Flag, Field_Guarded_Target_State, + Field_Parent, Field_Target, Field_Chain, Field_Reject_Time_Expression, Field_Waveform_Chain, Field_Guard, - Field_Parent, -- Iir_Kind_Concurrent_Conditional_Signal_Assignment Field_Label, Field_Delay_Mechanism, Field_Postponed_Flag, Field_Visible_Flag, Field_Guarded_Target_State, + Field_Parent, Field_Target, Field_Chain, Field_Reject_Time_Expression, Field_Conditional_Waveform_Chain, Field_Guard, - Field_Parent, -- Iir_Kind_Concurrent_Selected_Signal_Assignment Field_Label, Field_Delay_Mechanism, Field_Postponed_Flag, Field_Visible_Flag, Field_Guarded_Target_State, + Field_Parent, Field_Target, Field_Chain, Field_Reject_Time_Expression, Field_Expression, Field_Selected_Waveform_Chain, Field_Guard, - Field_Parent, -- Iir_Kind_Concurrent_Assertion_Statement Field_Label, Field_Postponed_Flag, Field_Visible_Flag, + Field_Parent, Field_Assertion_Condition, Field_Chain, Field_Severity_Expression, Field_Report_Expression, - Field_Parent, -- Iir_Kind_Concurrent_Procedure_Call_Statement Field_Label, Field_Suspend_Flag, Field_Postponed_Flag, Field_Visible_Flag, + Field_Parent, Field_Procedure_Call, Field_Chain, - Field_Parent, -- Iir_Kind_Psl_Assert_Statement Field_Psl_Property, Field_Label, @@ -3672,11 +3722,11 @@ package body Nodes_Meta is Field_PSL_EOS_Flag, Field_Postponed_Flag, Field_Visible_Flag, - Field_PSL_Clock_Sensitivity, + Field_Parent, Field_Chain, Field_Severity_Expression, Field_Report_Expression, - Field_Parent, + Field_PSL_Clock_Sensitivity, -- Iir_Kind_Psl_Cover_Statement Field_Psl_Sequence, Field_Label, @@ -3686,80 +3736,80 @@ package body Nodes_Meta is Field_PSL_EOS_Flag, Field_Postponed_Flag, Field_Visible_Flag, - Field_PSL_Clock_Sensitivity, + Field_Parent, Field_Chain, Field_Severity_Expression, Field_Report_Expression, - Field_Parent, + Field_PSL_Clock_Sensitivity, -- Iir_Kind_Block_Statement Field_Label, Field_Visible_Flag, Field_Is_Within_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, + Field_Guard_Decl, + Field_Block_Header, Field_Declaration_Chain, Field_Chain, Field_Attribute_Value_Chain, Field_Concurrent_Statement_Chain, Field_Block_Block_Configuration, - Field_Block_Header, - Field_Guard_Decl, - Field_Parent, -- Iir_Kind_If_Generate_Statement Field_Label, Field_Visible_Flag, Field_Is_Within_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Condition, Field_Chain, Field_Generate_Statement_Body, Field_Generate_Else_Clause, - Field_Parent, -- Iir_Kind_Case_Generate_Statement Field_Label, Field_Visible_Flag, Field_Is_Within_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Case_Statement_Alternative_Chain, Field_Chain, Field_Expression, - Field_Parent, -- Iir_Kind_For_Generate_Statement Field_Label, Field_Visible_Flag, Field_Is_Within_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, + Field_Parent, Field_Parameter_Specification, Field_Chain, Field_Generate_Statement_Body, - Field_Parent, -- Iir_Kind_Component_Instantiation_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Instantiated_Unit, Field_Chain, Field_Default_Binding_Indication, - Field_Component_Configuration, - Field_Configuration_Specification, Field_Generic_Map_Aspect_Chain, Field_Port_Map_Aspect_Chain, - Field_Parent, + Field_Configuration_Specification, + Field_Component_Configuration, -- Iir_Kind_Psl_Default_Clock Field_Psl_Boolean, Field_Label, - Field_Chain, Field_Parent, + Field_Chain, -- Iir_Kind_Simple_Simultaneous_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Chain, Field_Simultaneous_Left, Field_Simultaneous_Right, Field_Tolerance, - Field_Parent, -- Iir_Kind_Generate_Statement_Body Field_Alternative_Label, Field_Has_Begin, @@ -3767,222 +3817,233 @@ package body Nodes_Meta is Field_Is_Within_Flag, Field_Has_Label, Field_End_Has_Identifier, + Field_Parent, Field_Declaration_Chain, Field_Generate_Block_Configuration, Field_Attribute_Value_Chain, Field_Concurrent_Statement_Chain, - Field_Parent, -- Iir_Kind_If_Generate_Else_Clause Field_Visible_Flag, + Field_Parent, Field_Condition, Field_Generate_Statement_Body, Field_Generate_Else_Clause, - Field_Parent, -- Iir_Kind_Simple_Signal_Assignment_Statement Field_Label, Field_Delay_Mechanism, Field_Visible_Flag, Field_Guarded_Target_State, + Field_Parent, Field_Target, Field_Chain, Field_Reject_Time_Expression, Field_Waveform_Chain, - Field_Parent, -- Iir_Kind_Conditional_Signal_Assignment_Statement Field_Label, Field_Delay_Mechanism, Field_Visible_Flag, Field_Guarded_Target_State, + Field_Parent, Field_Target, Field_Chain, Field_Reject_Time_Expression, Field_Conditional_Waveform_Chain, - Field_Parent, -- Iir_Kind_Null_Statement Field_Label, Field_Visible_Flag, - Field_Chain, Field_Parent, + Field_Chain, -- Iir_Kind_Assertion_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Assertion_Condition, Field_Chain, Field_Severity_Expression, Field_Report_Expression, - Field_Parent, -- Iir_Kind_Report_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Chain, Field_Severity_Expression, Field_Report_Expression, - Field_Parent, -- Iir_Kind_Wait_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Timeout_Clause, Field_Chain, Field_Condition_Clause, Field_Sensitivity_List, - Field_Parent, -- Iir_Kind_Variable_Assignment_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Target, Field_Chain, Field_Expression, - Field_Parent, -- Iir_Kind_Conditional_Variable_Assignment_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Target, Field_Chain, Field_Conditional_Expression, - Field_Parent, -- Iir_Kind_Return_Statement Field_Label, Field_Visible_Flag, - Field_Chain, - Field_Expression, Field_Parent, Field_Type, + Field_Chain, + Field_Expression, -- Iir_Kind_For_Loop_Statement Field_Label, Field_Suspend_Flag, Field_Visible_Flag, Field_Is_Within_Flag, Field_End_Has_Identifier, + Field_Parent, Field_Parameter_Specification, Field_Chain, Field_Sequential_Statement_Chain, - Field_Parent, -- Iir_Kind_While_Loop_Statement Field_Label, Field_Suspend_Flag, Field_Visible_Flag, Field_End_Has_Identifier, + Field_Parent, Field_Condition, Field_Chain, Field_Sequential_Statement_Chain, - Field_Parent, -- Iir_Kind_Next_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Condition, Field_Chain, Field_Loop_Label, - Field_Parent, -- Iir_Kind_Exit_Statement Field_Label, Field_Visible_Flag, + Field_Parent, Field_Condition, Field_Chain, Field_Loop_Label, - Field_Parent, -- Iir_Kind_Case_Statement Field_Label, Field_Suspend_Flag, Field_Visible_Flag, Field_End_Has_Identifier, + Field_Parent, Field_Case_Statement_Alternative_Chain, Field_Chain, Field_Expression, - Field_Parent, -- Iir_Kind_Procedure_Call_Statement Field_Label, Field_Suspend_Flag, Field_Visible_Flag, + Field_Parent, Field_Procedure_Call, Field_Chain, - Field_Parent, -- Iir_Kind_If_Statement Field_Label, Field_Suspend_Flag, Field_Visible_Flag, Field_End_Has_Identifier, + Field_Parent, Field_Condition, Field_Chain, Field_Else_Clause, Field_Sequential_Statement_Chain, - Field_Parent, -- Iir_Kind_Elsif Field_End_Has_Identifier, + Field_Parent, Field_Condition, Field_Else_Clause, Field_Sequential_Statement_Chain, - Field_Parent, -- Iir_Kind_Character_Literal Field_Identifier, + Field_Is_Forward_Ref, Field_Expr_Staticness, Field_Name_Staticness, - Field_Alias_Declaration, Field_Type, + Field_Alias_Declaration, Field_Named_Entity, Field_Base_Name, -- Iir_Kind_Simple_Name Field_Identifier, + Field_Is_Forward_Ref, Field_Expr_Staticness, Field_Name_Staticness, - Field_Alias_Declaration, Field_Type, + Field_Alias_Declaration, Field_Named_Entity, Field_Base_Name, -- Iir_Kind_Selected_Name Field_Identifier, + Field_Is_Forward_Ref, Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Alias_Declaration, Field_Type, + Field_Alias_Declaration, Field_Named_Entity, Field_Base_Name, -- Iir_Kind_Operator_Symbol Field_Identifier, - Field_Alias_Declaration, + Field_Is_Forward_Ref, Field_Type, + Field_Alias_Declaration, Field_Named_Entity, Field_Base_Name, + -- Iir_Kind_Reference_Name + Field_Is_Forward_Ref, + Field_Named_Entity, + Field_Referenced_Name, -- Iir_Kind_Selected_By_All_Name + Field_Is_Forward_Ref, Field_Expr_Staticness, Field_Prefix, Field_Type, Field_Named_Entity, Field_Base_Name, -- Iir_Kind_Parenthesis_Name + Field_Is_Forward_Ref, Field_Prefix, - Field_Association_Chain, Field_Type, + Field_Association_Chain, Field_Named_Entity, -- Iir_Kind_External_Constant_Name Field_Shared_Flag, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, + Field_Type, Field_Chain, Field_External_Pathname, Field_Subtype_Indication, - Field_Parent, - Field_Type, -- Iir_Kind_External_Signal_Name Field_Shared_Flag, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, + Field_Type, Field_Chain, Field_External_Pathname, Field_Subtype_Indication, - Field_Parent, - Field_Type, -- Iir_Kind_External_Variable_Name Field_Shared_Flag, Field_Expr_Staticness, Field_Name_Staticness, + Field_Parent, + Field_Type, Field_Chain, Field_External_Pathname, Field_Subtype_Indication, - Field_Parent, - Field_Type, -- Iir_Kind_Package_Pathname Field_Identifier, + Field_Is_Forward_Ref, Field_Pathname_Suffix, Field_Named_Entity, -- Iir_Kind_Absolute_Pathname @@ -3991,9 +4052,10 @@ package body Nodes_Meta is Field_Pathname_Suffix, -- Iir_Kind_Pathname_Element Field_Identifier, + Field_Is_Forward_Ref, Field_Pathname_Suffix, - Field_Pathname_Expression, Field_Named_Entity, + Field_Pathname_Expression, -- Iir_Kind_Base_Attribute Field_Prefix, Field_Type, @@ -4031,57 +4093,57 @@ package body Nodes_Meta is Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Value_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Pos_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Val_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Succ_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Pred_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Leftof_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Rightof_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Delayed_Attribute Field_Has_Active_Flag, @@ -4184,73 +4246,74 @@ package body Nodes_Meta is Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, Field_Index_Subtype, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Right_Array_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, Field_Index_Subtype, + Field_Parameter, Field_Base_Name, -- Iir_Kind_High_Array_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, Field_Index_Subtype, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Low_Array_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, Field_Index_Subtype, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Length_Array_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, Field_Index_Subtype, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Ascending_Array_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, Field_Index_Subtype, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Range_Array_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, Field_Index_Subtype, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Reverse_Range_Array_Attribute Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Parameter, Field_Type, Field_Index_Subtype, + Field_Parameter, Field_Base_Name, -- Iir_Kind_Attribute_Name Field_Identifier, + Field_Is_Forward_Ref, Field_Expr_Staticness, Field_Name_Staticness, Field_Prefix, - Field_Attribute_Signature, Field_Type, + Field_Attribute_Signature, Field_Named_Entity, Field_Base_Name ); @@ -4268,258 +4331,259 @@ package body Nodes_Meta is Iir_Kind_Floating_Point_Literal => 55, Iir_Kind_Null_Literal => 57, Iir_Kind_String_Literal8 => 67, - Iir_Kind_Physical_Int_Literal => 72, - Iir_Kind_Physical_Fp_Literal => 77, - Iir_Kind_Simple_Aggregate => 82, - Iir_Kind_Overflow_Literal => 85, - Iir_Kind_Waveform_Element => 88, - Iir_Kind_Conditional_Waveform => 91, - Iir_Kind_Conditional_Expression => 94, - Iir_Kind_Association_Element_By_Expression => 101, - Iir_Kind_Association_Element_By_Individual => 108, - Iir_Kind_Association_Element_Open => 113, - Iir_Kind_Association_Element_Package => 118, - Iir_Kind_Association_Element_Type => 124, - Iir_Kind_Association_Element_Subprogram => 129, - Iir_Kind_Choice_By_Others => 134, - Iir_Kind_Choice_By_Expression => 141, - Iir_Kind_Choice_By_Range => 148, - Iir_Kind_Choice_By_None => 153, - Iir_Kind_Choice_By_Name => 159, - Iir_Kind_Entity_Aspect_Entity => 161, - Iir_Kind_Entity_Aspect_Configuration => 162, - Iir_Kind_Entity_Aspect_Open => 162, - Iir_Kind_Block_Configuration => 168, - Iir_Kind_Block_Header => 172, - Iir_Kind_Component_Configuration => 178, - Iir_Kind_Binding_Indication => 184, - Iir_Kind_Entity_Class => 186, - Iir_Kind_Attribute_Value => 194, - Iir_Kind_Signature => 197, - Iir_Kind_Aggregate_Info => 204, - Iir_Kind_Procedure_Call => 208, - Iir_Kind_Record_Element_Constraint => 214, - Iir_Kind_Array_Element_Resolution => 215, - Iir_Kind_Record_Resolution => 216, - Iir_Kind_Record_Element_Resolution => 219, - Iir_Kind_Attribute_Specification => 227, - Iir_Kind_Disconnection_Specification => 232, - Iir_Kind_Configuration_Specification => 237, - Iir_Kind_Access_Type_Definition => 245, - Iir_Kind_Incomplete_Type_Definition => 253, - Iir_Kind_Interface_Type_Definition => 260, - Iir_Kind_File_Type_Definition => 267, - Iir_Kind_Protected_Type_Declaration => 276, - Iir_Kind_Record_Type_Definition => 286, - Iir_Kind_Array_Type_Definition => 298, - Iir_Kind_Array_Subtype_Definition => 313, - Iir_Kind_Record_Subtype_Definition => 324, - Iir_Kind_Access_Subtype_Definition => 332, - Iir_Kind_Physical_Subtype_Definition => 341, - Iir_Kind_Floating_Subtype_Definition => 351, - Iir_Kind_Integer_Subtype_Definition => 360, - Iir_Kind_Enumeration_Subtype_Definition => 369, - Iir_Kind_Enumeration_Type_Definition => 378, - Iir_Kind_Integer_Type_Definition => 384, - Iir_Kind_Floating_Type_Definition => 390, - Iir_Kind_Physical_Type_Definition => 399, - Iir_Kind_Range_Expression => 407, - Iir_Kind_Protected_Type_Body => 414, - Iir_Kind_Wildcard_Type_Definition => 419, - Iir_Kind_Subtype_Definition => 423, - Iir_Kind_Scalar_Nature_Definition => 427, - Iir_Kind_Overload_List => 428, - Iir_Kind_Type_Declaration => 435, - Iir_Kind_Anonymous_Type_Declaration => 441, - Iir_Kind_Subtype_Declaration => 448, - Iir_Kind_Nature_Declaration => 454, - Iir_Kind_Subnature_Declaration => 460, - Iir_Kind_Package_Declaration => 475, - Iir_Kind_Package_Instantiation_Declaration => 487, - Iir_Kind_Package_Body => 495, - Iir_Kind_Configuration_Declaration => 504, - Iir_Kind_Entity_Declaration => 516, - Iir_Kind_Architecture_Body => 528, - Iir_Kind_Context_Declaration => 534, - Iir_Kind_Package_Header => 536, - Iir_Kind_Unit_Declaration => 545, - Iir_Kind_Library_Declaration => 552, - Iir_Kind_Component_Declaration => 562, - Iir_Kind_Attribute_Declaration => 569, - Iir_Kind_Group_Template_Declaration => 575, - Iir_Kind_Group_Declaration => 582, - Iir_Kind_Element_Declaration => 588, - Iir_Kind_Non_Object_Alias_Declaration => 596, - Iir_Kind_Psl_Declaration => 604, - Iir_Kind_Psl_Endpoint_Declaration => 618, - Iir_Kind_Terminal_Declaration => 624, - Iir_Kind_Free_Quantity_Declaration => 633, - Iir_Kind_Across_Quantity_Declaration => 645, - Iir_Kind_Through_Quantity_Declaration => 657, - Iir_Kind_Enumeration_Literal => 668, - Iir_Kind_Function_Declaration => 693, - Iir_Kind_Procedure_Declaration => 717, - Iir_Kind_Function_Body => 727, - Iir_Kind_Procedure_Body => 738, - Iir_Kind_Object_Alias_Declaration => 749, - Iir_Kind_File_Declaration => 763, - Iir_Kind_Guard_Signal_Declaration => 776, - Iir_Kind_Signal_Declaration => 793, - Iir_Kind_Variable_Declaration => 806, - Iir_Kind_Constant_Declaration => 820, - Iir_Kind_Iterator_Declaration => 831, - Iir_Kind_Interface_Constant_Declaration => 847, - Iir_Kind_Interface_Variable_Declaration => 863, - Iir_Kind_Interface_Signal_Declaration => 884, - Iir_Kind_Interface_File_Declaration => 900, - Iir_Kind_Interface_Type_Declaration => 910, - Iir_Kind_Interface_Package_Declaration => 920, - Iir_Kind_Interface_Function_Declaration => 937, - Iir_Kind_Interface_Procedure_Declaration => 950, - Iir_Kind_Signal_Attribute_Declaration => 953, - Iir_Kind_Identity_Operator => 957, - Iir_Kind_Negation_Operator => 961, - Iir_Kind_Absolute_Operator => 965, - Iir_Kind_Not_Operator => 969, - Iir_Kind_Condition_Operator => 973, - Iir_Kind_Reduction_And_Operator => 977, - Iir_Kind_Reduction_Or_Operator => 981, - Iir_Kind_Reduction_Nand_Operator => 985, - Iir_Kind_Reduction_Nor_Operator => 989, - Iir_Kind_Reduction_Xor_Operator => 993, - Iir_Kind_Reduction_Xnor_Operator => 997, - Iir_Kind_And_Operator => 1002, - Iir_Kind_Or_Operator => 1007, - Iir_Kind_Nand_Operator => 1012, - Iir_Kind_Nor_Operator => 1017, - Iir_Kind_Xor_Operator => 1022, - Iir_Kind_Xnor_Operator => 1027, - Iir_Kind_Equality_Operator => 1032, - Iir_Kind_Inequality_Operator => 1037, - Iir_Kind_Less_Than_Operator => 1042, - Iir_Kind_Less_Than_Or_Equal_Operator => 1047, - Iir_Kind_Greater_Than_Operator => 1052, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1057, - Iir_Kind_Match_Equality_Operator => 1062, - Iir_Kind_Match_Inequality_Operator => 1067, - Iir_Kind_Match_Less_Than_Operator => 1072, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1077, - Iir_Kind_Match_Greater_Than_Operator => 1082, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1087, - Iir_Kind_Sll_Operator => 1092, - Iir_Kind_Sla_Operator => 1097, - Iir_Kind_Srl_Operator => 1102, - Iir_Kind_Sra_Operator => 1107, - Iir_Kind_Rol_Operator => 1112, - Iir_Kind_Ror_Operator => 1117, - Iir_Kind_Addition_Operator => 1122, - Iir_Kind_Substraction_Operator => 1127, - Iir_Kind_Concatenation_Operator => 1132, - Iir_Kind_Multiplication_Operator => 1137, - Iir_Kind_Division_Operator => 1142, - Iir_Kind_Modulus_Operator => 1147, - Iir_Kind_Remainder_Operator => 1152, - Iir_Kind_Exponentiation_Operator => 1157, - Iir_Kind_Function_Call => 1165, - Iir_Kind_Aggregate => 1171, - Iir_Kind_Parenthesis_Expression => 1174, - Iir_Kind_Qualified_Expression => 1178, - Iir_Kind_Type_Conversion => 1183, - Iir_Kind_Allocator_By_Expression => 1187, - 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 => 1577, - Iir_Kind_External_Signal_Name => 1585, - Iir_Kind_External_Variable_Name => 1593, - Iir_Kind_Package_Pathname => 1596, - Iir_Kind_Absolute_Pathname => 1597, - Iir_Kind_Relative_Pathname => 1598, - Iir_Kind_Pathname_Element => 1602, - Iir_Kind_Base_Attribute => 1604, - Iir_Kind_Left_Type_Attribute => 1609, - Iir_Kind_Right_Type_Attribute => 1614, - Iir_Kind_High_Type_Attribute => 1619, - Iir_Kind_Low_Type_Attribute => 1624, - Iir_Kind_Ascending_Type_Attribute => 1629, - Iir_Kind_Image_Attribute => 1635, - Iir_Kind_Value_Attribute => 1641, - Iir_Kind_Pos_Attribute => 1647, - Iir_Kind_Val_Attribute => 1653, - Iir_Kind_Succ_Attribute => 1659, - Iir_Kind_Pred_Attribute => 1665, - Iir_Kind_Leftof_Attribute => 1671, - Iir_Kind_Rightof_Attribute => 1677, - Iir_Kind_Delayed_Attribute => 1686, - Iir_Kind_Stable_Attribute => 1695, - Iir_Kind_Quiet_Attribute => 1704, - Iir_Kind_Transaction_Attribute => 1713, - Iir_Kind_Event_Attribute => 1717, - Iir_Kind_Active_Attribute => 1721, - Iir_Kind_Last_Event_Attribute => 1725, - Iir_Kind_Last_Active_Attribute => 1729, - Iir_Kind_Last_Value_Attribute => 1733, - Iir_Kind_Driving_Attribute => 1737, - Iir_Kind_Driving_Value_Attribute => 1741, - Iir_Kind_Behavior_Attribute => 1741, - Iir_Kind_Structure_Attribute => 1741, - Iir_Kind_Simple_Name_Attribute => 1748, - Iir_Kind_Instance_Name_Attribute => 1753, - Iir_Kind_Path_Name_Attribute => 1758, - Iir_Kind_Left_Array_Attribute => 1765, - Iir_Kind_Right_Array_Attribute => 1772, - Iir_Kind_High_Array_Attribute => 1779, - Iir_Kind_Low_Array_Attribute => 1786, - Iir_Kind_Length_Array_Attribute => 1793, - Iir_Kind_Ascending_Array_Attribute => 1800, - Iir_Kind_Range_Array_Attribute => 1807, - Iir_Kind_Reverse_Range_Array_Attribute => 1814, - Iir_Kind_Attribute_Name => 1822 + Iir_Kind_Physical_Int_Literal => 73, + Iir_Kind_Physical_Fp_Literal => 79, + Iir_Kind_Simple_Aggregate => 84, + Iir_Kind_Overflow_Literal => 87, + Iir_Kind_Waveform_Element => 90, + Iir_Kind_Conditional_Waveform => 93, + Iir_Kind_Conditional_Expression => 96, + Iir_Kind_Association_Element_By_Expression => 103, + Iir_Kind_Association_Element_By_Individual => 111, + Iir_Kind_Association_Element_Open => 116, + Iir_Kind_Association_Element_Package => 121, + Iir_Kind_Association_Element_Type => 127, + Iir_Kind_Association_Element_Subprogram => 132, + Iir_Kind_Choice_By_Others => 137, + Iir_Kind_Choice_By_Expression => 144, + Iir_Kind_Choice_By_Range => 151, + Iir_Kind_Choice_By_None => 156, + Iir_Kind_Choice_By_Name => 162, + Iir_Kind_Entity_Aspect_Entity => 164, + Iir_Kind_Entity_Aspect_Configuration => 165, + Iir_Kind_Entity_Aspect_Open => 165, + Iir_Kind_Block_Configuration => 171, + Iir_Kind_Block_Header => 175, + Iir_Kind_Component_Configuration => 181, + Iir_Kind_Binding_Indication => 187, + Iir_Kind_Entity_Class => 189, + Iir_Kind_Attribute_Value => 197, + Iir_Kind_Signature => 200, + Iir_Kind_Aggregate_Info => 207, + Iir_Kind_Procedure_Call => 211, + Iir_Kind_Record_Element_Constraint => 217, + Iir_Kind_Array_Element_Resolution => 219, + Iir_Kind_Record_Resolution => 220, + Iir_Kind_Record_Element_Resolution => 223, + Iir_Kind_Attribute_Specification => 231, + Iir_Kind_Disconnection_Specification => 236, + Iir_Kind_Configuration_Specification => 241, + Iir_Kind_Access_Type_Definition => 249, + Iir_Kind_Incomplete_Type_Definition => 257, + Iir_Kind_Interface_Type_Definition => 264, + Iir_Kind_File_Type_Definition => 271, + Iir_Kind_Protected_Type_Declaration => 280, + Iir_Kind_Record_Type_Definition => 290, + Iir_Kind_Array_Type_Definition => 302, + Iir_Kind_Array_Subtype_Definition => 317, + Iir_Kind_Record_Subtype_Definition => 328, + Iir_Kind_Access_Subtype_Definition => 336, + Iir_Kind_Physical_Subtype_Definition => 346, + Iir_Kind_Floating_Subtype_Definition => 357, + Iir_Kind_Integer_Subtype_Definition => 367, + Iir_Kind_Enumeration_Subtype_Definition => 377, + Iir_Kind_Enumeration_Type_Definition => 387, + Iir_Kind_Integer_Type_Definition => 393, + Iir_Kind_Floating_Type_Definition => 399, + Iir_Kind_Physical_Type_Definition => 408, + Iir_Kind_Range_Expression => 416, + Iir_Kind_Protected_Type_Body => 423, + Iir_Kind_Wildcard_Type_Definition => 428, + Iir_Kind_Subtype_Definition => 433, + Iir_Kind_Scalar_Nature_Definition => 437, + Iir_Kind_Overload_List => 438, + Iir_Kind_Type_Declaration => 445, + Iir_Kind_Anonymous_Type_Declaration => 451, + Iir_Kind_Subtype_Declaration => 458, + Iir_Kind_Nature_Declaration => 464, + Iir_Kind_Subnature_Declaration => 470, + Iir_Kind_Package_Declaration => 485, + Iir_Kind_Package_Instantiation_Declaration => 498, + Iir_Kind_Package_Body => 506, + Iir_Kind_Configuration_Declaration => 515, + Iir_Kind_Entity_Declaration => 527, + Iir_Kind_Architecture_Body => 539, + Iir_Kind_Context_Declaration => 545, + Iir_Kind_Package_Header => 547, + Iir_Kind_Unit_Declaration => 556, + Iir_Kind_Library_Declaration => 563, + Iir_Kind_Component_Declaration => 573, + Iir_Kind_Attribute_Declaration => 580, + Iir_Kind_Group_Template_Declaration => 586, + Iir_Kind_Group_Declaration => 593, + Iir_Kind_Element_Declaration => 600, + Iir_Kind_Non_Object_Alias_Declaration => 608, + Iir_Kind_Psl_Declaration => 616, + Iir_Kind_Psl_Endpoint_Declaration => 630, + Iir_Kind_Terminal_Declaration => 636, + Iir_Kind_Free_Quantity_Declaration => 645, + Iir_Kind_Across_Quantity_Declaration => 657, + Iir_Kind_Through_Quantity_Declaration => 669, + Iir_Kind_Enumeration_Literal => 680, + Iir_Kind_Function_Declaration => 705, + Iir_Kind_Procedure_Declaration => 729, + Iir_Kind_Function_Body => 739, + Iir_Kind_Procedure_Body => 750, + Iir_Kind_Object_Alias_Declaration => 761, + Iir_Kind_File_Declaration => 775, + Iir_Kind_Guard_Signal_Declaration => 788, + Iir_Kind_Signal_Declaration => 805, + Iir_Kind_Variable_Declaration => 818, + Iir_Kind_Constant_Declaration => 832, + Iir_Kind_Iterator_Declaration => 843, + Iir_Kind_Interface_Constant_Declaration => 859, + Iir_Kind_Interface_Variable_Declaration => 875, + Iir_Kind_Interface_Signal_Declaration => 896, + Iir_Kind_Interface_File_Declaration => 912, + Iir_Kind_Interface_Type_Declaration => 922, + Iir_Kind_Interface_Package_Declaration => 933, + Iir_Kind_Interface_Function_Declaration => 950, + Iir_Kind_Interface_Procedure_Declaration => 963, + Iir_Kind_Signal_Attribute_Declaration => 966, + Iir_Kind_Identity_Operator => 970, + Iir_Kind_Negation_Operator => 974, + Iir_Kind_Absolute_Operator => 978, + Iir_Kind_Not_Operator => 982, + Iir_Kind_Condition_Operator => 986, + Iir_Kind_Reduction_And_Operator => 990, + Iir_Kind_Reduction_Or_Operator => 994, + Iir_Kind_Reduction_Nand_Operator => 998, + Iir_Kind_Reduction_Nor_Operator => 1002, + Iir_Kind_Reduction_Xor_Operator => 1006, + Iir_Kind_Reduction_Xnor_Operator => 1010, + Iir_Kind_And_Operator => 1015, + Iir_Kind_Or_Operator => 1020, + Iir_Kind_Nand_Operator => 1025, + Iir_Kind_Nor_Operator => 1030, + Iir_Kind_Xor_Operator => 1035, + Iir_Kind_Xnor_Operator => 1040, + Iir_Kind_Equality_Operator => 1045, + Iir_Kind_Inequality_Operator => 1050, + Iir_Kind_Less_Than_Operator => 1055, + Iir_Kind_Less_Than_Or_Equal_Operator => 1060, + Iir_Kind_Greater_Than_Operator => 1065, + Iir_Kind_Greater_Than_Or_Equal_Operator => 1070, + Iir_Kind_Match_Equality_Operator => 1075, + Iir_Kind_Match_Inequality_Operator => 1080, + Iir_Kind_Match_Less_Than_Operator => 1085, + Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1090, + Iir_Kind_Match_Greater_Than_Operator => 1095, + Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1100, + Iir_Kind_Sll_Operator => 1105, + Iir_Kind_Sla_Operator => 1110, + Iir_Kind_Srl_Operator => 1115, + Iir_Kind_Sra_Operator => 1120, + Iir_Kind_Rol_Operator => 1125, + Iir_Kind_Ror_Operator => 1130, + Iir_Kind_Addition_Operator => 1135, + Iir_Kind_Substraction_Operator => 1140, + Iir_Kind_Concatenation_Operator => 1145, + Iir_Kind_Multiplication_Operator => 1150, + Iir_Kind_Division_Operator => 1155, + Iir_Kind_Modulus_Operator => 1160, + Iir_Kind_Remainder_Operator => 1165, + Iir_Kind_Exponentiation_Operator => 1170, + Iir_Kind_Function_Call => 1178, + Iir_Kind_Aggregate => 1184, + Iir_Kind_Parenthesis_Expression => 1187, + Iir_Kind_Qualified_Expression => 1191, + Iir_Kind_Type_Conversion => 1196, + Iir_Kind_Allocator_By_Expression => 1200, + Iir_Kind_Allocator_By_Subtype => 1205, + Iir_Kind_Selected_Element => 1211, + Iir_Kind_Dereference => 1216, + Iir_Kind_Implicit_Dereference => 1221, + Iir_Kind_Slice_Name => 1228, + Iir_Kind_Indexed_Name => 1234, + Iir_Kind_Psl_Expression => 1236, + Iir_Kind_Sensitized_Process_Statement => 1256, + Iir_Kind_Process_Statement => 1276, + Iir_Kind_Concurrent_Simple_Signal_Assignment => 1287, + Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1298, + Iir_Kind_Concurrent_Selected_Signal_Assignment => 1310, + Iir_Kind_Concurrent_Assertion_Statement => 1318, + Iir_Kind_Concurrent_Procedure_Call_Statement => 1325, + Iir_Kind_Psl_Assert_Statement => 1338, + Iir_Kind_Psl_Cover_Statement => 1351, + Iir_Kind_Block_Statement => 1364, + Iir_Kind_If_Generate_Statement => 1374, + Iir_Kind_Case_Generate_Statement => 1383, + Iir_Kind_For_Generate_Statement => 1392, + Iir_Kind_Component_Instantiation_Statement => 1402, + Iir_Kind_Psl_Default_Clock => 1406, + Iir_Kind_Simple_Simultaneous_Statement => 1413, + Iir_Kind_Generate_Statement_Body => 1424, + Iir_Kind_If_Generate_Else_Clause => 1429, + Iir_Kind_Simple_Signal_Assignment_Statement => 1438, + Iir_Kind_Conditional_Signal_Assignment_Statement => 1447, + Iir_Kind_Null_Statement => 1451, + Iir_Kind_Assertion_Statement => 1458, + Iir_Kind_Report_Statement => 1464, + Iir_Kind_Wait_Statement => 1471, + Iir_Kind_Variable_Assignment_Statement => 1477, + Iir_Kind_Conditional_Variable_Assignment_Statement => 1483, + Iir_Kind_Return_Statement => 1489, + Iir_Kind_For_Loop_Statement => 1498, + Iir_Kind_While_Loop_Statement => 1506, + Iir_Kind_Next_Statement => 1512, + Iir_Kind_Exit_Statement => 1518, + Iir_Kind_Case_Statement => 1526, + Iir_Kind_Procedure_Call_Statement => 1532, + Iir_Kind_If_Statement => 1541, + Iir_Kind_Elsif => 1546, + Iir_Kind_Character_Literal => 1554, + Iir_Kind_Simple_Name => 1562, + Iir_Kind_Selected_Name => 1571, + Iir_Kind_Operator_Symbol => 1577, + Iir_Kind_Reference_Name => 1580, + Iir_Kind_Selected_By_All_Name => 1586, + Iir_Kind_Parenthesis_Name => 1591, + Iir_Kind_External_Constant_Name => 1599, + Iir_Kind_External_Signal_Name => 1607, + Iir_Kind_External_Variable_Name => 1615, + Iir_Kind_Package_Pathname => 1619, + Iir_Kind_Absolute_Pathname => 1620, + Iir_Kind_Relative_Pathname => 1621, + Iir_Kind_Pathname_Element => 1626, + Iir_Kind_Base_Attribute => 1628, + Iir_Kind_Left_Type_Attribute => 1633, + Iir_Kind_Right_Type_Attribute => 1638, + Iir_Kind_High_Type_Attribute => 1643, + Iir_Kind_Low_Type_Attribute => 1648, + Iir_Kind_Ascending_Type_Attribute => 1653, + Iir_Kind_Image_Attribute => 1659, + Iir_Kind_Value_Attribute => 1665, + Iir_Kind_Pos_Attribute => 1671, + Iir_Kind_Val_Attribute => 1677, + Iir_Kind_Succ_Attribute => 1683, + Iir_Kind_Pred_Attribute => 1689, + Iir_Kind_Leftof_Attribute => 1695, + Iir_Kind_Rightof_Attribute => 1701, + Iir_Kind_Delayed_Attribute => 1710, + Iir_Kind_Stable_Attribute => 1719, + Iir_Kind_Quiet_Attribute => 1728, + Iir_Kind_Transaction_Attribute => 1737, + Iir_Kind_Event_Attribute => 1741, + Iir_Kind_Active_Attribute => 1745, + Iir_Kind_Last_Event_Attribute => 1749, + Iir_Kind_Last_Active_Attribute => 1753, + Iir_Kind_Last_Value_Attribute => 1757, + Iir_Kind_Driving_Attribute => 1761, + Iir_Kind_Driving_Value_Attribute => 1765, + Iir_Kind_Behavior_Attribute => 1765, + Iir_Kind_Structure_Attribute => 1765, + Iir_Kind_Simple_Name_Attribute => 1772, + Iir_Kind_Instance_Name_Attribute => 1777, + Iir_Kind_Path_Name_Attribute => 1782, + Iir_Kind_Left_Array_Attribute => 1789, + Iir_Kind_Right_Array_Attribute => 1796, + Iir_Kind_High_Array_Attribute => 1803, + Iir_Kind_Low_Array_Attribute => 1810, + Iir_Kind_Length_Array_Attribute => 1817, + Iir_Kind_Ascending_Array_Attribute => 1824, + Iir_Kind_Range_Array_Attribute => 1831, + Iir_Kind_Reverse_Range_Array_Attribute => 1838, + Iir_Kind_Attribute_Name => 1847 ); function Get_Fields (K : Iir_Kind) return Fields_Array @@ -4675,6 +4739,8 @@ package body Nodes_Meta is return Get_Suspend_Flag (N); when Field_Is_Ref => return Get_Is_Ref (N); + when Field_Is_Forward_Ref => + return Get_Is_Forward_Ref (N); when Field_PSL_EOS_Flag => return Get_PSL_EOS_Flag (N); when others => @@ -4797,6 +4863,8 @@ package body Nodes_Meta is Set_Suspend_Flag (N, V); when Field_Is_Ref => Set_Is_Ref (N, V); + when Field_Is_Forward_Ref => + Set_Is_Forward_Ref (N, V); when Field_PSL_EOS_Flag => Set_PSL_EOS_Flag (N, V); when others => @@ -4955,6 +5023,8 @@ package body Nodes_Meta is return Get_Attribute_Value_Chain (N); when Field_Spec_Chain => return Get_Spec_Chain (N); + when Field_Value_Chain => + return Get_Value_Chain (N); when Field_Attribute_Value_Spec_Chain => return Get_Attribute_Value_Spec_Chain (N); when Field_Entity_Name => @@ -5019,6 +5089,8 @@ package body Nodes_Meta is return Get_File_Logical_Name (N); when Field_File_Open_Kind => return Get_File_Open_Kind (N); + when Field_Base_Element_Declaration => + return Get_Base_Element_Declaration (N); when Field_Element_Declaration => return Get_Element_Declaration (N); when Field_Selected_Element => @@ -5149,6 +5221,8 @@ package body Nodes_Meta is return Get_Block_Header (N); when Field_Uninstantiated_Package_Name => return Get_Uninstantiated_Package_Name (N); + when Field_Uninstantiated_Package_Decl => + return Get_Uninstantiated_Package_Decl (N); when Field_Generate_Block_Configuration => return Get_Generate_Block_Configuration (N); when Field_Generate_Statement_Body => @@ -5181,6 +5255,8 @@ package body Nodes_Meta is return Get_Named_Entity (N); when Field_Alias_Declaration => return Get_Alias_Declaration (N); + when Field_Referenced_Name => + return Get_Referenced_Name (N); when Field_Error_Origin => return Get_Error_Origin (N); when Field_Operand => @@ -5189,6 +5265,8 @@ package body Nodes_Meta is return Get_Left (N); when Field_Right => return Get_Right (N); + when Field_Physical_Unit => + return Get_Physical_Unit (N); when Field_Unit_Name => return Get_Unit_Name (N); when Field_Name => @@ -5219,6 +5297,8 @@ package body Nodes_Meta is return Get_Signal_Attribute_Declaration (N); when Field_Actual_Type => return Get_Actual_Type (N); + when Field_Actual_Type_Definition => + return Get_Actual_Type_Definition (N); when Field_Association_Chain => return Get_Association_Chain (N); when Field_Individual_Association_Chain => @@ -5349,6 +5429,8 @@ package body Nodes_Meta is Set_Attribute_Value_Chain (N, V); when Field_Spec_Chain => Set_Spec_Chain (N, V); + when Field_Value_Chain => + Set_Value_Chain (N, V); when Field_Attribute_Value_Spec_Chain => Set_Attribute_Value_Spec_Chain (N, V); when Field_Entity_Name => @@ -5413,6 +5495,8 @@ package body Nodes_Meta is Set_File_Logical_Name (N, V); when Field_File_Open_Kind => Set_File_Open_Kind (N, V); + when Field_Base_Element_Declaration => + Set_Base_Element_Declaration (N, V); when Field_Element_Declaration => Set_Element_Declaration (N, V); when Field_Selected_Element => @@ -5543,6 +5627,8 @@ package body Nodes_Meta is Set_Block_Header (N, V); when Field_Uninstantiated_Package_Name => Set_Uninstantiated_Package_Name (N, V); + when Field_Uninstantiated_Package_Decl => + Set_Uninstantiated_Package_Decl (N, V); when Field_Generate_Block_Configuration => Set_Generate_Block_Configuration (N, V); when Field_Generate_Statement_Body => @@ -5575,6 +5661,8 @@ package body Nodes_Meta is Set_Named_Entity (N, V); when Field_Alias_Declaration => Set_Alias_Declaration (N, V); + when Field_Referenced_Name => + Set_Referenced_Name (N, V); when Field_Error_Origin => Set_Error_Origin (N, V); when Field_Operand => @@ -5583,6 +5671,8 @@ package body Nodes_Meta is Set_Left (N, V); when Field_Right => Set_Right (N, V); + when Field_Physical_Unit => + Set_Physical_Unit (N, V); when Field_Unit_Name => Set_Unit_Name (N, V); when Field_Name => @@ -5613,6 +5703,8 @@ package body Nodes_Meta is Set_Signal_Attribute_Declaration (N, V); when Field_Actual_Type => Set_Actual_Type (N, V); + when Field_Actual_Type_Definition => + Set_Actual_Type_Definition (N, V); when Field_Association_Chain => Set_Association_Chain (N, V); when Field_Individual_Association_Chain => @@ -6922,6 +7014,11 @@ package body Nodes_Meta is return K = Iir_Kind_Attribute_Value; end Has_Spec_Chain; + function Has_Value_Chain (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Attribute_Value; + end Has_Value_Chain; + function Has_Attribute_Value_Spec_Chain (K : Iir_Kind) return Boolean is begin return K = Iir_Kind_Attribute_Specification; @@ -7025,7 +7122,6 @@ package body Nodes_Meta is | Iir_Kind_Block_Configuration | Iir_Kind_Component_Configuration | Iir_Kind_Entity_Class - | Iir_Kind_Attribute_Value | Iir_Kind_Record_Element_Resolution | Iir_Kind_Attribute_Specification | Iir_Kind_Disconnection_Specification @@ -7690,6 +7786,11 @@ package body Nodes_Meta is end case; end Has_Element_Position; + function Has_Base_Element_Declaration (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Element_Declaration; + end Has_Base_Element_Declaration; + function Has_Element_Declaration (K : Iir_Kind) return Boolean is begin return K = Iir_Kind_Record_Element_Constraint; @@ -8231,7 +8332,13 @@ package body Nodes_Meta is function Has_Element_Subtype_Indication (K : Iir_Kind) return Boolean is begin - return K = Iir_Kind_Array_Type_Definition; + case K is + when Iir_Kind_Array_Element_Resolution + | Iir_Kind_Array_Type_Definition => + return True; + when others => + return False; + end case; end Has_Element_Subtype_Indication; function Has_Element_Subtype (K : Iir_Kind) return Boolean is @@ -8867,6 +8974,17 @@ package body Nodes_Meta is end case; end Has_Uninstantiated_Package_Name; + function Has_Uninstantiated_Package_Decl (K : Iir_Kind) return Boolean is + begin + case K is + when Iir_Kind_Package_Instantiation_Declaration + | Iir_Kind_Interface_Package_Declaration => + return True; + when others => + return False; + end case; + end Has_Uninstantiated_Package_Decl; + function Has_Generate_Block_Configuration (K : Iir_Kind) return Boolean is begin return K = Iir_Kind_Generate_Statement_Body; @@ -9122,6 +9240,7 @@ package body Nodes_Meta is | Iir_Kind_Simple_Name | Iir_Kind_Selected_Name | Iir_Kind_Operator_Symbol + | Iir_Kind_Reference_Name | Iir_Kind_Selected_By_All_Name | Iir_Kind_Parenthesis_Name | Iir_Kind_Package_Pathname @@ -9146,6 +9265,11 @@ package body Nodes_Meta is end case; end Has_Alias_Declaration; + function Has_Referenced_Name (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Reference_Name; + end Has_Referenced_Name; + function Has_Expr_Staticness (K : Iir_Kind) return Boolean is begin case K is @@ -9388,6 +9512,17 @@ package body Nodes_Meta is end case; end Has_Right; + function Has_Physical_Unit (K : Iir_Kind) return Boolean is + begin + case K is + when Iir_Kind_Physical_Int_Literal + | Iir_Kind_Physical_Fp_Literal => + return True; + when others => + return False; + end case; + end Has_Physical_Unit; + function Has_Unit_Name (K : Iir_Kind) return Boolean is begin case K is @@ -9669,6 +9804,11 @@ package body Nodes_Meta is return K = Iir_Kind_Association_Element_By_Individual; end Has_Actual_Type; + function Has_Actual_Type_Definition (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Association_Element_By_Individual; + end Has_Actual_Type_Definition; + function Has_Association_Chain (K : Iir_Kind) return Boolean is begin return K = Iir_Kind_Parenthesis_Name; @@ -10258,7 +10398,13 @@ package body Nodes_Meta is function Has_Is_Ref (K : Iir_Kind) return Boolean is begin case K is - when Iir_Kind_Signal_Declaration + when Iir_Kind_Physical_Subtype_Definition + | Iir_Kind_Floating_Subtype_Definition + | Iir_Kind_Integer_Subtype_Definition + | Iir_Kind_Enumeration_Subtype_Definition + | Iir_Kind_Enumeration_Type_Definition + | Iir_Kind_Subtype_Definition + | Iir_Kind_Signal_Declaration | Iir_Kind_Variable_Declaration | Iir_Kind_Constant_Declaration | Iir_Kind_Interface_Constant_Declaration @@ -10272,6 +10418,25 @@ package body Nodes_Meta is end case; end Has_Is_Ref; + function Has_Is_Forward_Ref (K : Iir_Kind) return Boolean is + begin + case K is + when Iir_Kind_Character_Literal + | Iir_Kind_Simple_Name + | Iir_Kind_Selected_Name + | Iir_Kind_Operator_Symbol + | Iir_Kind_Reference_Name + | Iir_Kind_Selected_By_All_Name + | Iir_Kind_Parenthesis_Name + | Iir_Kind_Package_Pathname + | Iir_Kind_Pathname_Element + | Iir_Kind_Attribute_Name => + return True; + when others => + return False; + end case; + end Has_Is_Forward_Ref; + function Has_Psl_Property (K : Iir_Kind) return Boolean is begin return K = Iir_Kind_Psl_Assert_Statement; diff --git a/src/vhdl/nodes_meta.ads b/src/vhdl/nodes_meta.ads index 49ae2c698..0904c0c63 100644 --- a/src/vhdl/nodes_meta.ads +++ b/src/vhdl/nodes_meta.ads @@ -129,6 +129,7 @@ package Nodes_Meta is Field_Configuration_Item_Chain, Field_Attribute_Value_Chain, Field_Spec_Chain, + Field_Value_Chain, Field_Attribute_Value_Spec_Chain, Field_Entity_Name, Field_Package, @@ -175,6 +176,7 @@ package Nodes_Meta is Field_File_Logical_Name, Field_File_Open_Kind, Field_Element_Position, + Field_Base_Element_Declaration, Field_Element_Declaration, Field_Selected_Element, Field_Use_Clause_Chain, @@ -276,6 +278,7 @@ package Nodes_Meta is Field_Package_Header, Field_Block_Header, Field_Uninstantiated_Package_Name, + Field_Uninstantiated_Package_Decl, Field_Generate_Block_Configuration, Field_Generate_Statement_Body, Field_Alternative_Label, @@ -294,11 +297,13 @@ package Nodes_Meta is Field_Binding_Indication, Field_Named_Entity, Field_Alias_Declaration, + Field_Referenced_Name, Field_Expr_Staticness, Field_Error_Origin, Field_Operand, Field_Left, Field_Right, + Field_Physical_Unit, Field_Unit_Name, Field_Name, Field_Group_Template_Name, @@ -315,6 +320,7 @@ package Nodes_Meta is Field_Attr_Chain, Field_Signal_Attribute_Declaration, Field_Actual_Type, + Field_Actual_Type_Definition, Field_Association_Chain, Field_Individual_Association_Chain, Field_Subprogram_Association_Chain, @@ -368,6 +374,7 @@ package Nodes_Meta is Field_Has_Class, Field_Suspend_Flag, Field_Is_Ref, + Field_Is_Forward_Ref, Field_Psl_Property, Field_Psl_Sequence, Field_Psl_Declaration, @@ -394,7 +401,8 @@ package Nodes_Meta is type Field_Attribute is ( Attr_None, - Attr_Ref, Attr_Maybe_Ref, Attr_Of_Ref, Attr_Forward_Ref, + Attr_Ref, Attr_Maybe_Ref, Attr_Of_Ref, + Attr_Forward_Ref, Attr_Maybe_Forward_Ref, Attr_Chain, Attr_Chain_Next ); @@ -630,6 +638,7 @@ package Nodes_Meta is function Has_Configuration_Item_Chain (K : Iir_Kind) return Boolean; function Has_Attribute_Value_Chain (K : Iir_Kind) return Boolean; function Has_Spec_Chain (K : Iir_Kind) return Boolean; + function Has_Value_Chain (K : Iir_Kind) return Boolean; function Has_Attribute_Value_Spec_Chain (K : Iir_Kind) return Boolean; function Has_Entity_Name (K : Iir_Kind) return Boolean; function Has_Package (K : Iir_Kind) return Boolean; @@ -677,6 +686,7 @@ package Nodes_Meta is function Has_File_Logical_Name (K : Iir_Kind) return Boolean; function Has_File_Open_Kind (K : Iir_Kind) return Boolean; function Has_Element_Position (K : Iir_Kind) return Boolean; + function Has_Base_Element_Declaration (K : Iir_Kind) return Boolean; function Has_Element_Declaration (K : Iir_Kind) return Boolean; function Has_Selected_Element (K : Iir_Kind) return Boolean; function Has_Use_Clause_Chain (K : Iir_Kind) return Boolean; @@ -782,6 +792,7 @@ package Nodes_Meta is function Has_Package_Header (K : Iir_Kind) return Boolean; function Has_Block_Header (K : Iir_Kind) return Boolean; function Has_Uninstantiated_Package_Name (K : Iir_Kind) return Boolean; + function Has_Uninstantiated_Package_Decl (K : Iir_Kind) return Boolean; function Has_Generate_Block_Configuration (K : Iir_Kind) return Boolean; function Has_Generate_Statement_Body (K : Iir_Kind) return Boolean; function Has_Alternative_Label (K : Iir_Kind) return Boolean; @@ -802,11 +813,13 @@ package Nodes_Meta is function Has_Binding_Indication (K : Iir_Kind) return Boolean; function Has_Named_Entity (K : Iir_Kind) return Boolean; function Has_Alias_Declaration (K : Iir_Kind) return Boolean; + function Has_Referenced_Name (K : Iir_Kind) return Boolean; function Has_Expr_Staticness (K : Iir_Kind) return Boolean; function Has_Error_Origin (K : Iir_Kind) return Boolean; function Has_Operand (K : Iir_Kind) return Boolean; function Has_Left (K : Iir_Kind) return Boolean; function Has_Right (K : Iir_Kind) return Boolean; + function Has_Physical_Unit (K : Iir_Kind) return Boolean; function Has_Unit_Name (K : Iir_Kind) return Boolean; function Has_Name (K : Iir_Kind) return Boolean; function Has_Group_Template_Name (K : Iir_Kind) return Boolean; @@ -823,6 +836,7 @@ package Nodes_Meta is function Has_Attr_Chain (K : Iir_Kind) return Boolean; function Has_Signal_Attribute_Declaration (K : Iir_Kind) return Boolean; function Has_Actual_Type (K : Iir_Kind) return Boolean; + function Has_Actual_Type_Definition (K : Iir_Kind) return Boolean; function Has_Association_Chain (K : Iir_Kind) return Boolean; function Has_Individual_Association_Chain (K : Iir_Kind) return Boolean; function Has_Subprogram_Association_Chain (K : Iir_Kind) return Boolean; @@ -877,6 +891,7 @@ package Nodes_Meta is function Has_Has_Class (K : Iir_Kind) return Boolean; function Has_Suspend_Flag (K : Iir_Kind) return Boolean; function Has_Is_Ref (K : Iir_Kind) return Boolean; + function Has_Is_Forward_Ref (K : Iir_Kind) return Boolean; function Has_Psl_Property (K : Iir_Kind) return Boolean; function Has_Psl_Sequence (K : Iir_Kind) return Boolean; function Has_Psl_Declaration (K : Iir_Kind) return Boolean; diff --git a/src/vhdl/nodes_meta.ads.in b/src/vhdl/nodes_meta.ads.in index 8eeaef321..fe54242b1 100644 --- a/src/vhdl/nodes_meta.ads.in +++ b/src/vhdl/nodes_meta.ads.in @@ -47,7 +47,8 @@ package Nodes_Meta is type Field_Attribute is ( Attr_None, - Attr_Ref, Attr_Maybe_Ref, Attr_Of_Ref, Attr_Forward_Ref, + Attr_Ref, Attr_Maybe_Ref, Attr_Of_Ref, + Attr_Forward_Ref, Attr_Maybe_Forward_Ref, Attr_Chain, Attr_Chain_Next ); diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index ee377792b..72ae0ea0f 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -756,7 +756,10 @@ package body Parse is Set_Location (Res); if Get_Kind (Prefix) = Iir_Kind_Signature then Set_Attribute_Signature (Res, Prefix); + + -- Transfer the prefix from the signature to the attribute. Set_Prefix (Res, Get_Signature_Prefix (Prefix)); + Set_Signature_Prefix (Prefix, Null_Iir); else Set_Prefix (Res, Prefix); end if; diff --git a/src/vhdl/post_sems.adb b/src/vhdl/post_sems.adb index 145d50a14..2a45879c0 100644 --- a/src/vhdl/post_sems.adb +++ b/src/vhdl/post_sems.adb @@ -69,7 +69,7 @@ package body Post_Sems is Ieee.Vital_Timing.Check_Vital_Level1 (Unit); end if; - Value := Get_Chain (Value); + Value := Get_Value_Chain (Value); end loop; end if; end Post_Sem_Checks; diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb index 9e57ec0e2..39e642722 100644 --- a/src/vhdl/sem.adb +++ b/src/vhdl/sem.adb @@ -2599,8 +2599,7 @@ package body Sem is case Get_Kind (El) is when Iir_Kind_Package_Instantiation_Declaration => declare - Pkg : constant Iir := - Get_Named_Entity (Get_Uninstantiated_Package_Name (El)); + Pkg : constant Iir := Get_Uninstantiated_Package_Decl (El); begin if not Is_Error (Pkg) and then Get_Need_Body (Pkg) @@ -2633,8 +2632,8 @@ package body Sem is return True; when Iir_Kind_Interface_Package_Declaration => declare - Pkg : constant Iir := Get_Named_Entity - (Get_Uninstantiated_Package_Name (Inter)); + Pkg : constant Iir := + Get_Uninstantiated_Package_Decl (Inter); begin if Get_Macro_Expanded_Flag (Pkg) then return True; @@ -2836,6 +2835,8 @@ package body Sem is return Null_Iir; end if; + Set_Uninstantiated_Package_Decl (Decl, Pkg); + return Pkg; end Sem_Uninstantiated_Package_Name; diff --git a/src/vhdl/sem_assocs.adb b/src/vhdl/sem_assocs.adb index adae8b6b4..e33775921 100644 --- a/src/vhdl/sem_assocs.adb +++ b/src/vhdl/sem_assocs.adb @@ -166,7 +166,7 @@ package body Sem_Assocs is procedure Check_Parameter_Association_Restriction (Inter : Iir; Base_Actual : Iir; Loc : Iir) is begin - case Get_Mode (Inter) is + case Iir_Parameter_Modes (Get_Mode (Inter)) is when Iir_In_Mode => if Can_Interface_Be_Read (Base_Actual) then return; @@ -181,8 +181,6 @@ package body Sem_Assocs is then return; end if; - when others => - Error_Kind ("check_parameter_association_restriction", Inter); end case; Error_Msg_Sem (+Loc, "cannot associate an " & Get_Mode_Name (Get_Mode (Base_Actual)) @@ -556,16 +554,14 @@ package body Sem_Assocs is (Sub_Assoc : in out Iir; Formal : Iir) is Base_Assoc : constant Iir := Sub_Assoc; + Index_List : constant Iir_List := Get_Index_List (Formal); + Nbr : constant Natural := Get_Nbr_Elements (Index_List); Choice : Iir; Last_Choice : Iir; - Index_List : Iir_List; Index : Iir; - Nbr : Natural; Staticness : Iir_Staticness; begin -- Find element. - Index_List := Get_Index_List (Formal); - Nbr := Get_Nbr_Elements (Index_List); for I in 0 .. Nbr - 1 loop Index := Get_Nth_Element (Index_List, I); @@ -683,6 +679,8 @@ package body Sem_Assocs is Sub_Assoc := Choice; end Add_Individual_Assoc_Selected_Name; + -- Subroutine of Add_Individual_Association. + -- Search/build the tree of choices for FORMAL, starting for IASSOC. procedure Add_Individual_Association_1 (Iassoc : in out Iir; Formal : Iir) is Base_Assoc : constant Iir := Iassoc; @@ -847,13 +845,23 @@ package body Sem_Assocs is Set_Direction (Index_Subtype_Constraint, Get_Direction (Index_Constraint)); + -- For ownership purpose, the bounds must be copied otherwise + -- they would be referenced before being defined. This is non + -- optimal but it doesn't happen often. + Low := Copy_Constant (Low); + High := Copy_Constant (High); + case Get_Direction (Index_Constraint) is when Iir_To => Set_Left_Limit (Index_Subtype_Constraint, Low); + Set_Left_Limit_Expr (Index_Subtype_Constraint, Low); Set_Right_Limit (Index_Subtype_Constraint, High); + Set_Right_Limit_Expr (Index_Subtype_Constraint, High); when Iir_Downto => Set_Left_Limit (Index_Subtype_Constraint, High); + Set_Left_Limit_Expr (Index_Subtype_Constraint, High); Set_Right_Limit (Index_Subtype_Constraint, Low); + Set_Right_Limit_Expr (Index_Subtype_Constraint, Low); end case; Set_Expr_Staticness (Index_Subtype_Constraint, Locally); Append_Element (Get_Index_Subtype_List (Actual_Type), @@ -906,6 +914,30 @@ package body Sem_Assocs is Set_Actual_Type (Assoc, Atype); end Finish_Individual_Assoc_Record; + -- Free recursively all the choices of ASSOC. + procedure Clean_Individual_Association (Assoc : Iir) + is + El, N_El : Iir; + Expr : Iir; + begin + El := Get_Individual_Association_Chain (Assoc); + Set_Individual_Association_Chain (Assoc, Null_Iir); + + while Is_Valid (El) loop + N_El := Get_Chain (El); + + pragma Assert (Get_Kind (El) in Iir_Kinds_Choice); + Expr := Get_Associated_Expr (El); + if Get_Kind (Expr) = Iir_Kind_Association_Element_By_Individual then + Clean_Individual_Association (Expr); + Free_Iir (Expr); + end if; + + Free_Iir (El); + El := N_El; + end loop; + end Clean_Individual_Association; + -- Called by sem_individual_association to finish the analyze of -- individual association ASSOC: compute bounds, detect missing elements. procedure Finish_Individual_Association (Assoc : Iir) @@ -933,6 +965,7 @@ package body Sem_Assocs is Set_Index_Constraint_Flag (Atype, True); Set_Constraint_State (Atype, Fully_Constrained); Set_Actual_Type (Assoc, Atype); + Set_Actual_Type_Definition (Assoc, Atype); Finish_Individual_Assoc_Array (Assoc, Assoc, 1); end if; when Iir_Kind_Record_Type_Definition @@ -941,12 +974,29 @@ package body Sem_Assocs is when others => Error_Kind ("finish_individual_association", Atype); end case; + + -- Free the hierarchy, keep only the top individual association. + Clean_Individual_Association (Assoc); end Finish_Individual_Association; -- Sem individual associations of ASSOCS: -- Add an Iir_Kind_Association_Element_By_Individual before each -- group of individual association for the same formal, and call -- Finish_Individual_Association with each of these added nodes. + -- + -- The purpose of By_Individual association is to have the type of the + -- actual (might be an array subtype), and also to be sure that all + -- sub-elements are associated. For that a tree is created. The tree is + -- rooted by the top Association_Element_By_Individual, which contains a + -- chain of choices (like the aggregate). The child of a choice is either + -- an Association_Element written by the user, or a new subtree rooted + -- by another Association_Element_By_Individual. The tree doesn't + -- follow all the ownership rules: the formal of sub association_element + -- are directly set to the association, and the associated_expr of the + -- choices are directly set to formals. + -- + -- This tree is temporary (used only during analysis of the individual + -- association) and removed once the check is done. procedure Sem_Individual_Association (Assoc_Chain : in out Iir) is Assoc : Iir; @@ -978,7 +1028,7 @@ package body Sem_Assocs is Location_Copy (Iassoc, Assoc); Set_Choice_Staticness (Iassoc, Locally); pragma Assert (Cur_Iface /= Null_Iir); - Set_Formal (Iassoc, Cur_Iface); + Set_Formal (Iassoc, Build_Simple_Name (Cur_Iface, Iassoc)); -- Insert IASSOC. if Prev_Assoc = Null_Iir then Assoc_Chain := Iassoc; @@ -1362,6 +1412,7 @@ package body Sem_Assocs is (Conv : Iir; Res_Type : Iir; Param_Type : Iir) return Iir is Func : Iir; + Assoc : Iir; begin if Conv = Null_Iir then return Null_Iir; @@ -1371,8 +1422,12 @@ package body Sem_Assocs is return Null_Iir; end if; case Get_Kind (Func) is - when Iir_Kind_Function_Call - | Iir_Kind_Type_Conversion => + when Iir_Kind_Function_Call => + Assoc := Get_Parameter_Association_Chain (Func); + Free_Iir (Assoc); + Set_Parameter_Association_Chain (Func, Null_Iir); + return Func; + when Iir_Kind_Type_Conversion => return Func; when others => Error_Kind ("extract_in_conversion", Func); @@ -1537,11 +1592,8 @@ package body Sem_Assocs is return; end if; - Package_Inter := - Get_Named_Entity (Get_Uninstantiated_Package_Name (Inter)); - if Get_Named_Entity (Get_Uninstantiated_Package_Name (Actual)) - /= Package_Inter - then + Package_Inter := Get_Uninstantiated_Package_Decl (Inter); + if Get_Uninstantiated_Package_Decl (Actual) /= Package_Inter then Error_Msg_Sem (+Assoc, "actual package name is not an instance of interface package"); diff --git a/src/vhdl/sem_decls.adb b/src/vhdl/sem_decls.adb index d8f4c7543..20ce9aae6 100644 --- a/src/vhdl/sem_decls.adb +++ b/src/vhdl/sem_decls.adb @@ -646,8 +646,9 @@ package body Sem_Decls is Set_Identifier (Inter, Std_Names.Name_Open_Kind); Set_Type (Inter, Std_Package.File_Open_Kind_Type_Definition); Set_Mode (Inter, Iir_In_Mode); - Set_Default_Value (Inter, - Std_Package.File_Open_Kind_Read_Mode); + Set_Default_Value + (Inter, + Build_Simple_Name (Std_Package.File_Open_Kind_Read_Mode, Loc)); Append (Last_Interface, Proc, Inter); Compute_Subprogram_Hash (Proc); -- Add it to the list. @@ -697,7 +698,7 @@ package body Sem_Decls is Inter := Create_Iir (Iir_Kind_Interface_Variable_Declaration); Set_Identifier (Inter, Std_Names.Name_Value); Set_Location (Inter, Loc); - Set_Subtype_Indication (Inter, Type_Mark); + Set_Subtype_Indication (Inter, Build_Simple_Name (Decl, Loc)); Set_Type (Inter, Type_Mark_Type); Set_Mode (Inter, Iir_Out_Mode); Append (Last_Interface, Proc, Inter); @@ -737,7 +738,7 @@ package body Sem_Decls is Inter := Create_Iir (Iir_Kind_Interface_Constant_Declaration); Set_Identifier (Inter, Std_Names.Name_Value); Set_Location (Inter, Loc); - Set_Subtype_Indication (Inter, Type_Mark); + Set_Subtype_Indication (Inter, Build_Simple_Name (Decl, Loc)); Set_Type (Inter, Type_Mark_Type); Set_Mode (Inter, Iir_In_Mode); Append (Last_Interface, Proc, Inter); @@ -1596,6 +1597,7 @@ package body Sem_Decls is Set_Identifier (St_Decl, Get_Identifier (Decl)); Set_Parent (St_Decl, Get_Parent (Decl)); Set_Type (St_Decl, Def); + Set_Subtype_Indication (St_Decl, Def); Set_Type_Declarator (Def, St_Decl); Set_Chain (St_Decl, Get_Chain (Decl)); Set_Chain (Decl, St_Decl); @@ -2664,6 +2666,11 @@ package body Sem_Decls is Set_Name (Res, Get_Name (Alias)); Set_Alias_Signature (Res, Sig); + if Is_Valid (Sig) then + -- The prefix is owned by the non_object_alias_declaration. + Set_Signature_Prefix (Sig, Null_Iir); + end if; + Sem_Scopes.Add_Name (Res); Name_Visible (Res); @@ -2757,6 +2764,14 @@ package body Sem_Decls is Replace_Nth_Element (Constituent_List, I, El); El_Name := Get_Named_Entity (El); + -- Statements are textually afer the group declaration. To avoid + -- adding a flag on each node with a base_name, this field is + -- cleared, as we don't care about base name. + if Class = Tok_Label then + Set_Is_Forward_Ref (El, True); + end if; + Set_Base_Name (El, Null_Iir); + -- LRM93 4.7 -- It is an error if the class of any group constituent in the -- group constituent list is not the same as the class specified diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index 0e13a1936..636c23188 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -2592,14 +2592,13 @@ package body Sem_Expr is Free (Arr); end Sem_Check_Continuous_Choices; - procedure Sem_Choices_Range - (Choice_Chain : in out Iir; - Sub_Type : Iir; - Is_Sub_Range : Boolean; - Is_Case_Stmt : Boolean; - Loc : Location_Type; - Low : out Iir; - High : out Iir) + procedure Sem_Choices_Range (Choice_Chain : in out Iir; + Sub_Type : Iir; + Is_Sub_Range : Boolean; + Is_Case_Stmt : Boolean; + Loc : Location_Type; + Low : out Iir; + High : out Iir) is -- Number of positionnal choice. Nbr_Pos : Iir_Int64; @@ -2826,83 +2825,6 @@ package body Sem_Expr is (Choice_Chain, Sub_Type, Is_Sub_Range, Loc, Low, High); end Sem_Choices_Range; --- -- Find out the MIN and the MAX of an all named association choice list. --- -- It also returns the number of elements associed (counting range). --- procedure Sem_Find_Min_Max_Association_Choice_List --- (List: Iir_Association_Choices_List; --- Min: out Iir; --- Max: out Iir; --- Length: out natural) --- is --- Min_Res: Iir := null; --- Max_Res: Iir := null; --- procedure Update_With_Value (Val: Iir) is --- begin --- if Min_Res = null then --- Min_Res := Val; --- Max_Res := Val; --- elsif Get_Value (Val) < Get_Value (Min_Res) then --- Min_Res := Val; --- elsif Get_Value (Val) > Get_Value (Max_Res) then --- Max_Res := Val; --- end if; --- end Update_With_Value; - --- Number_Elements: Natural; - --- procedure Update (Choice: Iir) is --- Left, Right: Iir; --- Expr: Iir; --- begin --- case Get_Kind (Choice) is --- when Iir_Kind_Choice_By_Expression => --- Update_With_Value (Get_Expression (Choice)); --- Number_Elements := Number_Elements + 1; --- when Iir_Kind_Choice_By_Range => --- Expr := Get_Expression (Choice); --- Left := Get_Left_Limit (Expr); --- Right := Get_Right_Limit (Expr); --- Update_With_Value (Left); --- Update_With_Value (Right); --- -- There can't be null range. --- case Get_Direction (Expr) is --- when Iir_To => --- Number_Elements := Number_Elements + --- Natural (Get_Value (Right) - Get_Value (Left) + 1); --- when Iir_Downto => --- Number_Elements := Number_Elements + --- Natural (Get_Value (Left) - Get_Value (Right) + 1); --- end case; --- when others => --- Error_Kind ("sem_find_min_max_association_choice_list", Choice); --- end case; --- end Update; - --- El: Iir; --- Sub_List: Iir_Association_Choices_List; --- Sub_El: Iir; --- begin --- Number_Elements := 0; --- for I in Natural loop --- El := Get_Nth_Element (List, I); --- exit when El = null; --- case Get_Kind (El) is --- when Iir_Kind_Choice_By_List => --- Sub_List := Get_Choice_List (El); --- for J in Natural loop --- Sub_El := Get_Nth_Element (Sub_List, J); --- exit when Sub_El = null; --- Update (Sub_El); --- end loop; --- when others => --- Update (El); --- end case; --- end loop; --- Min := Min_Res; --- Max := Max_Res; --- Length := Number_Elements; --- end Sem_Find_Min_Max_Association_Choice_List; - -- Perform semantisation on a (sub)aggregate AGGR, which is of type -- A_TYPE. -- return FALSE is case of failure @@ -2950,35 +2872,33 @@ package body Sem_Expr is -- FIXME: should mutate the node. function Sem_Simple_Choice (Ass : Iir) return Iir is + Expr : constant Iir := Get_Choice_Expression (Ass); N_El : Iir; - Expr : Iir; Aggr_El : Iir_Element_Declaration; begin - Expr := Get_Choice_Expression (Ass); if Get_Kind (Expr) /= Iir_Kind_Simple_Name then Error_Msg_Sem (+Ass, "element association must be a simple name"); Ok := False; return Ass; end if; - Aggr_El := Find_Name_In_List - (Get_Elements_Declaration_List (Base_Type), Get_Identifier (Expr)); + Aggr_El := Find_Name_In_List (El_List, Get_Identifier (Expr)); if Aggr_El = Null_Iir then Error_Msg_Sem (+Ass, "record has no such element %n", +Ass); Ok := False; return Ass; end if; + Set_Named_Entity (Expr, Aggr_El); + Xref_Ref (Expr, Aggr_El); N_El := Create_Iir (Iir_Kind_Choice_By_Name); Location_Copy (N_El, Ass); - Set_Choice_Name (N_El, Aggr_El); + Set_Choice_Name (N_El, Expr); Set_Associated_Expr (N_El, Get_Associated_Expr (Ass)); Set_Associated_Chain (N_El, Get_Associated_Chain (Ass)); Set_Chain (N_El, Get_Chain (Ass)); Set_Same_Alternative_Flag (N_El, Get_Same_Alternative_Flag (Ass)); - Xref_Ref (Expr, Aggr_El); Free_Iir (Ass); - Free_Iir (Expr); Add_Match (N_El, Aggr_El); return N_El; end Sem_Simple_Choice; @@ -3369,6 +3289,7 @@ package body Sem_Expr is when Iir_Kind_Choice_By_Range => Expr := Get_Choice_Range (Choice); Set_Range_Constraint (Info.Index_Subtype, Expr); + Set_Is_Ref (Info.Index_Subtype, True); -- FIXME: avoid allocation-free. Free_Iir (Index_Subtype_Constraint); when others => @@ -3636,16 +3557,11 @@ package body Sem_Expr is | Iir_Kind_Physical_Fp_Literal => Unit_Name := Get_Unit_Name (Lit); Res := Lit; - when Iir_Kind_Unit_Declaration => - Res := Create_Iir (Iir_Kind_Physical_Int_Literal); - Location_Copy (Res, Lit); - Set_Value (Res, 1); - Unit_Name := Null_Iir; - raise Program_Error; when Iir_Kinds_Denoting_Name => Res := Create_Iir (Iir_Kind_Physical_Int_Literal); Location_Copy (Res, Lit); Set_Value (Res, 1); + Set_Literal_Origin (Res, Lit); Unit_Name := Lit; when others => Error_Kind ("sem_physical_literal", Lit); @@ -3657,6 +3573,7 @@ package body Sem_Expr is Set_Named_Entity (Unit_Name, Create_Error_Name (Unit_Name)); end if; Set_Unit_Name (Res, Unit_Name); + Set_Physical_Unit (Res, Get_Named_Entity (Unit_Name)); Unit_Type := Get_Type (Unit_Name); Set_Type (Res, Unit_Type); diff --git a/src/vhdl/sem_inst.adb b/src/vhdl/sem_inst.adb index 0b0b76467..15bfc214b 100644 --- a/src/vhdl/sem_inst.adb +++ b/src/vhdl/sem_inst.adb @@ -220,6 +220,12 @@ package body Sem_Inst is -- Must be explicitely handled in Instantiate_Iir, as it -- requires special handling. raise Internal_Error; + when Attr_Maybe_Forward_Ref => + if Get_Is_Forward_Ref (N) then + raise Internal_Error; + else + R := Instantiate_Iir (S, True); + end if; when Attr_Chain => R := Instantiate_Iir_Chain (S); when Attr_Chain_Next => @@ -430,6 +436,7 @@ package body Sem_Inst is -- 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; @@ -466,6 +473,33 @@ package body Sem_Inst is end if; end; + when Field_Deferred_Declaration => + if not Get_Deferred_Declaration_Flag (N) + and then Is_Valid (Get_Deferred_Declaration (N)) + then + -- This is the completion. + declare + Incomplete_Decl_N : constant Iir := + Get_Deferred_Declaration (N); + Incomplete_Decl_Res : constant Iir := + Get_Instance (Incomplete_Decl_N); + begin + pragma Assert (Is_Valid (Incomplete_Decl_Res)); + Set_Deferred_Declaration (Res, Incomplete_Decl_Res); + Set_Deferred_Declaration (Incomplete_Decl_Res, Res); + end; + end if; + + when Field_Protected_Type_Body => + null; + when Field_Protected_Type_Declaration => + Instantiate_Iir_Field (Res, N, F); + Set_Protected_Type_Body + (Get_Protected_Type_Declaration (Res), Res); + + when Field_Subtype_Definition => + -- TODO + null; when others => -- Common case. @@ -511,7 +545,7 @@ package body Sem_Inst is case Get_Kind (Res) is when Iir_Kind_Interface_Constant_Declaration => Set_Type (Res, Get_Type (Inter)); - Set_Subtype_Indication (Res, Get_Subtype_Indication (Inter)); + Set_Subtype_Indication (Res, Null_Iir); -- Not owner Set_Mode (Res, Get_Mode (Inter)); Set_Has_Mode (Res, Get_Has_Mode (Inter)); Set_Has_Class (Res, Get_Has_Class (Inter)); @@ -521,8 +555,8 @@ package body Sem_Inst is Set_Default_Value (Res, Get_Default_Value (Inter)); Set_Is_Ref (Res, True); when Iir_Kind_Interface_Package_Declaration => - Set_Uninstantiated_Package_Name - (Res, Get_Uninstantiated_Package_Name (Inter)); + Set_Uninstantiated_Package_Decl + (Res, Get_Uninstantiated_Package_Decl (Inter)); when Iir_Kind_Interface_Type_Declaration => Set_Type (Res, Get_Type (Inter)); when Iir_Kinds_Interface_Subprogram_Declaration => @@ -587,7 +621,9 @@ package body Sem_Inst is case Get_Field_Attribute (F) is when Attr_None => Set_Instance_On_Iir (S, S_Inst); - when Attr_Ref | Attr_Forward_Ref => + when Attr_Ref + | Attr_Forward_Ref + | Attr_Maybe_Forward_Ref => null; when Attr_Maybe_Ref => if not Get_Is_Ref (N) then @@ -789,8 +825,7 @@ package body Sem_Inst is function Instantiate_Package_Body (Inst : Iir) return Iir is Inst_Decl : constant Iir := Get_Package_Origin (Inst); - Pkg : constant Iir := - Get_Named_Entity (Get_Uninstantiated_Package_Name (Inst_Decl)); + Pkg : constant Iir := Get_Uninstantiated_Package_Decl (Inst_Decl); Prev_Instance_File : constant Source_File_Entry := Instance_File; Mark : constant Instance_Index_Type := Prev_Instance_Table.Last; Res : Iir; @@ -912,7 +947,9 @@ package body Sem_Inst is case Get_Field_Attribute (F) is when Attr_None => Substitute_On_Iir (S, E, Rep); - when Attr_Ref | Attr_Forward_Ref => + when Attr_Ref + | Attr_Forward_Ref + | Attr_Maybe_Forward_Ref => null; when Attr_Maybe_Ref => if not Get_Is_Ref (N) then diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb index 58945b594..06b4cd7c6 100644 --- a/src/vhdl/sem_names.adb +++ b/src/vhdl/sem_names.adb @@ -696,7 +696,8 @@ package body Sem_Names is -- one-dimensionnal array object. Index_List := Get_Index_Subtype_List (Prefix_Type); if Get_Nbr_Elements (Index_List) /= 1 then - Error_Msg_Sem (+Name, "slice prefix must be an unidimensional array"); + Error_Msg_Sem + (+Name, "slice prefix must be an one-dimensional array"); return; end if; @@ -777,6 +778,7 @@ package body Sem_Names is Error_Kind ("sem_expr: slice_name", Get_Base_Type (Index_Type)); end case; Set_Range_Constraint (Slice_Type, Suffix); + Set_Is_Ref (Slice_Type, True); Set_Type_Staticness (Slice_Type, Staticness); Set_Base_Type (Slice_Type, Get_Base_Type (Index_Type)); Set_Location (Slice_Type, Get_Location (Suffix)); @@ -785,6 +787,8 @@ package body Sem_Names is Expr_Type := Create_Iir (Iir_Kind_Array_Subtype_Definition); Set_Location (Expr_Type, Get_Location (Suffix)); Set_Index_Subtype_List (Expr_Type, Create_Iir_List); + Set_Index_Constraint_List (Expr_Type, + Get_Index_Subtype_List (Expr_Type)); Prefix_Base_Type := Get_Base_Type (Prefix_Type); Set_Base_Type (Expr_Type, Prefix_Base_Type); Set_Signal_Type_Flag (Expr_Type, @@ -793,7 +797,7 @@ package body Sem_Names is Set_Element_Subtype (Expr_Type, Get_Element_Subtype (Prefix_Type)); if Get_Kind (Prefix_Type) = Iir_Kind_Array_Subtype_Definition then Set_Resolution_Indication - (Expr_Type, Get_Resolution_Indication (Prefix_Type)); + (Expr_Type, Sem_Types.Copy_Resolution_Indication (Prefix_Type)); else Set_Resolution_Indication (Expr_Type, Null_Iir); end if; @@ -1503,42 +1507,69 @@ package body Sem_Names is end if; end Sem_Check_All_Sensitized; - function Finish_Sem_Denoting_Name (Name : Iir; Res : Iir) return Iir + -- Free overload list of NAME but keep RES interpretation. + procedure Free_Old_Entity_Name (Name : Iir; Res : Iir) is - Prefix : Iir; + Old_Res : constant Iir := Get_Named_Entity (Name); + begin + if Old_Res /= Null_Iir and then Old_Res /= Res then + pragma Assert (Is_Overload_List (Old_Res)); + Sem_Name_Free_Result (Old_Res, Res); + end if; + Set_Named_Entity (Name, Res); + end Free_Old_Entity_Name; + + function Finish_Sem_Denoting_Name (Name : Iir; Res : Iir) return Iir is begin case Iir_Kinds_Denoting_Name (Get_Kind (Name)) is when Iir_Kind_Simple_Name | Iir_Kind_Character_Literal | Iir_Kind_Operator_Symbol => + Set_Base_Name (Name, Res); Xref_Ref (Name, Res); return Name; when Iir_Kind_Selected_Name => - Xref_Ref (Name, Res); - Prefix := Get_Prefix (Name); - loop - pragma Assert (Get_Kind (Prefix) in Iir_Kinds_Denoting_Name); - Xref_Ref (Prefix, Get_Named_Entity (Prefix)); - exit when Get_Kind (Prefix) /= Iir_Kind_Selected_Name; - Prefix := Get_Prefix (Prefix); - end loop; + declare + Prefix, Res_Prefix : Iir; + Old_Res : Iir; + begin + Xref_Ref (Name, Res); + Prefix := Name; + Res_Prefix := Res; + loop + Prefix := Get_Prefix (Prefix); + Res_Prefix := Get_Parent (Res_Prefix); + + -- Get the parent for expanded_name, may skip some parents. + case Get_Kind (Res_Prefix) is + when Iir_Kind_Design_Unit => + Res_Prefix := + Get_Library (Get_Design_File (Res_Prefix)); + when others => + null; + end case; + + pragma Assert (Get_Kind (Prefix) in Iir_Kinds_Denoting_Name); + Xref_Ref (Prefix, Res_Prefix); + + -- Cannot use Free_Old_Entity_Name as a prefix may not be + -- the parent (for protected subprogram calls). + Old_Res := Get_Named_Entity (Prefix); + if Is_Overload_List (Old_Res) then + Free_Iir (Old_Res); + Set_Named_Entity (Prefix, Res_Prefix); + end if; + + exit when Get_Kind (Prefix) /= Iir_Kind_Selected_Name; + end loop; + end; return Name; + when Iir_Kind_Reference_Name => + -- Not in the sources. + raise Internal_Error; end case; end Finish_Sem_Denoting_Name; - - -- Free overload list of NAME but keep RES interpretation. - procedure Free_Old_Entity_Name (Name : Iir; Res : Iir) - is - Old_Res : constant Iir := Get_Named_Entity (Name); - begin - if Old_Res /= Null_Iir and then Old_Res /= Res then - pragma Assert (Is_Overload_List (Old_Res)); - Sem_Name_Free_Result (Old_Res, Res); - end if; - Set_Named_Entity (Name, Res); - end Free_Old_Entity_Name; - function Finish_Sem_Name_1 (Name : Iir; Res : Iir) return Iir is Prefix : Iir; @@ -1570,6 +1601,9 @@ package body Sem_Names is pragma Assert (Get_Kind (Name) = Iir_Kind_Attribute_Name); Prefix := Finish_Sem_Name (Get_Prefix (Name)); Set_Prefix (Name, Prefix); + if Get_Is_Forward_Ref (Prefix) then + Set_Base_Name (Prefix, Null_Iir); + end if; Set_Base_Name (Name, Res); Set_Type (Name, Get_Type (Res)); Set_Name_Staticness (Name, Get_Name_Staticness (Res)); @@ -1821,7 +1855,6 @@ package body Sem_Names is Res := Create_Overload_List (Res_List); end if; - Set_Base_Name (Name, Res); Set_Named_Entity (Name, Res); end Sem_Simple_Name; @@ -2735,11 +2768,12 @@ package body Sem_Names is function Sem_User_Attribute (Attr : Iir_Attribute_Name) return Iir is + Prefix_Name : constant Iir := Get_Prefix (Attr); Prefix : Iir; Value : Iir; Attr_Id : Name_Id; begin - Prefix := Get_Named_Entity (Get_Prefix (Attr)); + Prefix := Get_Named_Entity (Prefix_Name); -- LRM93 6.6 -- If the attribute name denotes an alias, then the attribute name @@ -2773,12 +2807,14 @@ package body Sem_Names is | Iir_Kind_Procedure_Declaration | Iir_Kind_Enumeration_Literal | Iir_Kind_Unit_Declaration - | Iir_Kinds_Sequential_Statement - | Iir_Kinds_Concurrent_Statement | Iir_Kind_Component_Declaration | Iir_Kinds_Library_Unit_Declaration => -- FIXME: to complete null; + when Iir_Kinds_Sequential_Statement + | Iir_Kinds_Concurrent_Statement => + -- May appear textually before the statement. + Set_Is_Forward_Ref (Prefix_Name, True); when others => Error_Kind ("sem_user_attribute", Prefix); end case; @@ -3575,7 +3611,7 @@ package body Sem_Names is when Iir_Kind_Simple_Name | Iir_Kind_Character_Literal | Iir_Kind_Operator_Symbol => - -- String_Literal may be a symbol_operator. + -- String_Literal may be a operator_symbol. Sem_Simple_Name (Name, Keep_Alias, Soft => False); when Iir_Kind_Selected_Name => Sem_Selected_Name (Name, Keep_Alias); @@ -3601,7 +3637,7 @@ package body Sem_Names is case Get_Kind (Name) is when Iir_Kind_Simple_Name | Iir_Kind_Operator_Symbol => - -- String_Literal may be a symbol_operator. + -- String_Literal may be a operator_symbol. Sem_Simple_Name (Name, False, Soft => True); when others => Error_Kind ("sem_name_soft", Name); diff --git a/src/vhdl/sem_specs.adb b/src/vhdl/sem_specs.adb index 2d40901fe..802f5aed7 100644 --- a/src/vhdl/sem_specs.adb +++ b/src/vhdl/sem_specs.adb @@ -170,7 +170,7 @@ package body Sem_Specs is return Value; end if; end if; - Value := Get_Chain (Value); + Value := Get_Value_Chain (Value); end loop; return Null_Iir; end Find_Attribute_Value; @@ -288,7 +288,7 @@ package body Sem_Specs is end if; end; end if; - El := Get_Chain (El); + El := Get_Value_Chain (El); end loop; El := Create_Iir (Iir_Kind_Attribute_Value); @@ -306,7 +306,7 @@ package body Sem_Specs is Set_Base_Name (El, El); -- Put the attribute value in the attribute_value_chain. - Set_Chain (El, Get_Attribute_Value_Chain (Attr_Chain_Parent)); + Set_Value_Chain (El, Get_Attribute_Value_Chain (Attr_Chain_Parent)); Set_Attribute_Value_Chain (Attr_Chain_Parent, El); -- Put the attribute value in the chain of the attribute specification. @@ -1415,6 +1415,7 @@ package body Sem_Specs is (Inst, Spec, Primary_Entity_Aspect); Xref_Ref (El, Inst); Set_Named_Entity (El, Inst); + Set_Is_Forward_Ref (El, True); end if; end if; end if; @@ -1578,6 +1579,7 @@ package body Sem_Specs is Res, Last : Iir; Comp_El, Ent_El : Iir; Assoc : Iir; + Name : Iir; Found : Natural; Comp_Chain : Iir; Ent_Chain : Iir; @@ -1642,7 +1644,9 @@ package body Sem_Specs is end if; Assoc := Create_Iir (Iir_Kind_Association_Element_By_Expression); Location_Copy (Assoc, Parent); - Set_Actual (Assoc, Comp_El); + Name := Build_Simple_Name (Comp_El, Parent); + Set_Type (Name, Get_Type (Comp_El)); + Set_Actual (Assoc, Name); if Kind = Map_Port then Check_Port_Association_Bounds_Restrictions (Ent_El, Comp_El, Assoc); @@ -1650,7 +1654,9 @@ package body Sem_Specs is Found := Found + 1; end if; Set_Whole_Association_Flag (Assoc, True); - Set_Formal (Assoc, Ent_El); + Name := Build_Simple_Name (Ent_El, Parent); + Set_Type (Name, Get_Type (Ent_El)); + Set_Formal (Assoc, Name); if Kind = Map_Port and then not Error and then Comp_El /= Null_Iir diff --git a/src/vhdl/sem_stmts.adb b/src/vhdl/sem_stmts.adb index 638e9ada3..9abe1b92f 100644 --- a/src/vhdl/sem_stmts.adb +++ b/src/vhdl/sem_stmts.adb @@ -432,7 +432,7 @@ package body Sem_Stmts is Expr: Iir; begin Target := Get_Target (Stmt); - Target := Sem_Expression_Wildcard (Target, Sig_Type); + Target := Sem_Expression_Wildcard (Target, Get_Base_Type (Sig_Type)); if Target /= Null_Iir then Set_Target (Stmt, Target); diff --git a/src/vhdl/sem_types.adb b/src/vhdl/sem_types.adb index edb18d16e..4e5baa373 100644 --- a/src/vhdl/sem_types.adb +++ b/src/vhdl/sem_types.adb @@ -295,7 +295,7 @@ package body Sem_Types is begin Lit := Create_Iir (Iir_Kind_Physical_Int_Literal); Set_Value (Lit, Val); - Set_Unit_Name (Lit, Unit); + Set_Physical_Unit (Lit, Unit); Set_Expr_Staticness (Lit, Locally); Set_Type (Lit, Get_Type (Unit)); Location_Copy (Lit, Unit); @@ -307,7 +307,6 @@ package body Sem_Types is return Iir_Physical_Subtype_Definition is Unit: Iir_Unit_Declaration; - Unit_Name : Iir; Def : Iir_Physical_Type_Definition; Sub_Type: Iir_Physical_Subtype_Definition; Range_Expr1: Iir; @@ -368,8 +367,7 @@ package body Sem_Types is -- Analyze the primary unit. Unit := Get_Unit_Chain (Def); - Unit_Name := Build_Simple_Name (Unit, Unit); - Lit := Create_Physical_Literal (1, Unit_Name); + Lit := Create_Physical_Literal (1, Unit); Set_Physical_Unit_Value (Unit, Lit); Sem_Scopes.Add_Name (Unit); @@ -391,7 +389,7 @@ package body Sem_Types is Location_Copy (Res, Lim); Set_Type (Res, Def); Set_Value (Res, Get_Value (Lim)); - Set_Unit_Name (Res, Get_Primary_Unit_Name (Def)); + Set_Physical_Unit (Res, Get_Primary_Unit (Def)); Set_Expr_Staticness (Res, Locally); Set_Literal_Origin (Res, Lim); return Res; @@ -429,7 +427,6 @@ package body Sem_Types is Sem_Scopes.Add_Name (Unit); Val := Sem_Expression (Get_Physical_Literal (Unit), Def); if Val /= Null_Iir then - Set_Physical_Literal (Unit, Val); Val := Eval_Physical_Literal (Val); Set_Physical_Unit_Value (Unit, Val); @@ -861,6 +858,7 @@ package body Sem_Types is else Staticness := None; end if; + Set_Base_Element_Declaration (El, El); Sem_Scopes.Add_Name (El); Name_Visible (El); Xref_Decl (El); @@ -982,6 +980,7 @@ package body Sem_Types is Index_Name := Sem_Discrete_Range_Integer (Index_Type); if Index_Name /= Null_Iir then Index_Name := Range_To_Subtype_Indication (Index_Name); + -- Index_Name is a subtype_indication, which can be a type_mark. else -- Avoid errors. Index_Name := @@ -996,7 +995,7 @@ package body Sem_Types is -- Set the index subtype definition for the array base type. if Get_Kind (Index_Name) in Iir_Kinds_Denoting_Name then - Index_Type := Index_Name; + Index_Type := Get_Named_Entity (Index_Name); else pragma Assert (Get_Kind (Index_Name) in Iir_Kinds_Subtype_Definition); @@ -1004,16 +1003,18 @@ package body Sem_Types is if Index_Type = Null_Iir then -- From a range expression like '1 to 4' or from an attribute -- name. - declare - Subtype_Decl : constant Iir := - Get_First_Subtype_Declaration (Index_Name); - begin - Index_Type := Build_Simple_Name (Subtype_Decl, Index_Name); - Set_Type (Index_Type, Get_Type (Subtype_Decl)); - end; + Index_Type := Get_First_Subtype_Declaration (Index_Name); + else + Index_Type := Get_Named_Entity (Index_Type); end if; end if; - Append_Element (Base_Index_List, Index_Type); + + -- Create a new simple_name, as the type_mark is owned by the + -- index constraint of the array subtype. + Index_Name := Build_Simple_Name (Index_Type, Index_Name); + Set_Type (Index_Name, Get_Type (Index_Type)); + + Append_Element (Base_Index_List, Index_Name); end loop; Set_Index_Subtype_List (Def, Index_List); @@ -1340,11 +1341,113 @@ package body Sem_Types is (Def : Iir; Type_Mark : Iir; Resolution : Iir) return Iir; + -- Create a copy of elements_declaration_list of SRC and set it to DST. + procedure Copy_Record_Elements_Declaration_List (Dst : Iir; Src : Iir) + is + El_List, New_El_List : Iir_List; + El, New_El : Iir; + begin + New_El_List := Create_Iir_List; + Set_Elements_Declaration_List (Dst, New_El_List); + El_List := Get_Elements_Declaration_List (Src); + for I in Natural loop + El := Get_Nth_Element (El_List, I); + exit when El = Null_Iir; + + New_El := Create_Iir (Iir_Kind_Element_Declaration); + Location_Copy (New_El, El); + Set_Identifier (New_El, Get_Identifier (El)); + Set_Type (New_El, Get_Type (El)); + Set_Base_Element_Declaration (New_El, El); + Append_Element (New_El_List, New_El); + end loop; + end Copy_Record_Elements_Declaration_List; + + function Copy_Resolution_Indication (Subdef : Iir) return Iir + is + Ind : constant Iir := Get_Resolution_Indication (Subdef); + begin + if Is_Null (Ind) + or else Get_Kind (Ind) = Iir_Kind_Array_Element_Resolution + then + -- No need to copy array_element_resolution, it is part of the + -- element_subtype. + return Null_Iir; + else + return Build_Reference_Name (Ind); + end if; + end Copy_Resolution_Indication; + + function Copy_Subtype_Indication (Def : Iir) return Iir + is + Res : Iir; + begin + case Get_Kind (Def) is + when Iir_Kind_Integer_Subtype_Definition + | Iir_Kind_Floating_Subtype_Definition + | Iir_Kind_Enumeration_Subtype_Definition + | Iir_Kind_Physical_Subtype_Definition => + Res := Create_Iir (Get_Kind (Def)); + Set_Range_Constraint (Res, Get_Range_Constraint (Def)); + Set_Is_Ref (Res, True); + Set_Resolution_Indication + (Res, Copy_Resolution_Indication (Def)); + when Iir_Kind_Enumeration_Type_Definition => + Res := Create_Iir (Iir_Kind_Enumeration_Subtype_Definition); + Set_Range_Constraint (Res, Get_Range_Constraint (Def)); + Set_Is_Ref (Res, True); + + when Iir_Kind_Access_Subtype_Definition + | Iir_Kind_Access_Type_Definition => + Res := Create_Iir (Iir_Kind_Access_Subtype_Definition); + Set_Designated_Type (Res, Get_Designated_Type (Def)); + + when Iir_Kind_Array_Type_Definition => + Res := Create_Iir (Iir_Kind_Array_Subtype_Definition); + Set_Type_Staticness (Res, Get_Type_Staticness (Def)); + Set_Resolved_Flag (Res, Get_Resolved_Flag (Def)); + Set_Index_Constraint_List (Res, Null_Iir_List); + Set_Index_Subtype_List + (Res, Get_Index_Subtype_Definition_List (Def)); + Set_Element_Subtype (Res, Get_Element_Subtype (Def)); + Set_Index_Constraint_Flag (Res, False); + Set_Constraint_State (Res, Get_Constraint_State (Def)); + when Iir_Kind_Array_Subtype_Definition => + Res := Create_Iir (Iir_Kind_Array_Subtype_Definition); + Set_Resolution_Indication (Res, Copy_Resolution_Indication (Def)); + Set_Resolved_Flag (Res, Get_Resolved_Flag (Def)); + Set_Index_Subtype_List (Res, Get_Index_Subtype_List (Def)); + Set_Element_Subtype (Res, Get_Element_Subtype (Def)); + Set_Index_Constraint_Flag + (Res, Get_Index_Constraint_Flag (Def)); + Set_Constraint_State (Res, Get_Constraint_State (Def)); + + when Iir_Kind_Record_Type_Definition + | Iir_Kind_Record_Subtype_Definition => + Res := Create_Iir (Iir_Kind_Record_Subtype_Definition); + Set_Type_Staticness (Res, Get_Type_Staticness (Def)); + if Get_Kind (Def) = Iir_Kind_Record_Subtype_Definition then + Set_Resolution_Indication + (Res, Copy_Resolution_Indication (Def)); + end if; + Set_Resolved_Flag (Res, Get_Resolved_Flag (Def)); + Set_Constraint_State (Res, Get_Constraint_State (Def)); + Copy_Record_Elements_Declaration_List (Res, Def); + when others => + -- FIXME: todo (protected type ?) + Error_Kind ("copy_subtype_indication", Def); + end case; + Location_Copy (Res, Def); + Set_Base_Type (Res, Get_Base_Type (Def)); + Set_Type_Staticness (Res, Get_Type_Staticness (Def)); + Set_Signal_Type_Flag (Res, Get_Signal_Type_Flag (Def)); + return Res; + end Copy_Subtype_Indication; + -- DEF is an incomplete subtype_indication or array_constraint, -- TYPE_MARK is the base type of the subtype_indication. function Sem_Array_Constraint - (Def : Iir; Type_Mark : Iir; Resolution : Iir) - return Iir + (Def : Iir; Type_Mark : Iir; Resolution : Iir) return Iir is El_Type : constant Iir := Get_Element_Subtype (Type_Mark); Res : Iir; @@ -1516,6 +1619,11 @@ package body Sem_Types is -- Element subtype. if Resolv_El /= Null_Iir or else El_Def /= Null_Iir then El_Def := Sem_Subtype_Constraint (El_Def, El_Type, Resolv_El); + if Resolv_El /= Null_Iir then + -- Save EL_DEF so that it is owned. + Set_Element_Subtype_Indication (Resolution, El_Def); + Set_Resolution_Indication (Resolution, Null_Iir); + end if; end if; if El_Def = Null_Iir then El_Def := Get_Element_Subtype (Type_Mark); @@ -1708,9 +1816,7 @@ package body Sem_Types is when Iir_Kind_Array_Subtype_Definition => -- Record constraints are parsed as array constraints. - if Get_Kind (Def) /= Iir_Kind_Array_Subtype_Definition then - raise Internal_Error; - end if; + pragma Assert (Get_Kind (Def) = Iir_Kind_Array_Subtype_Definition); Index_List := Get_Index_Constraint_List (Def); El_List := Create_Iir_List; Set_Elements_Declaration_List (Res, El_List); @@ -1786,8 +1892,8 @@ package body Sem_Types is (El_Type, Tm_El_Type); when Iir_Kind_Record_Type_Definition | Iir_Kind_Record_Subtype_Definition => - El_Type := Reparse_As_Record_Constraint - (El_Type); + El_Type := + Reparse_As_Record_Constraint (El_Type); when others => Error_Msg_Sem (+El_Type, @@ -1855,7 +1961,7 @@ package body Sem_Types is Set_Constraint_State (Res, Constraint); end; else - Set_Elements_Declaration_List (Res, Tm_El_List); + Copy_Record_Elements_Declaration_List (Res, Type_Mark); Set_Constraint_State (Res, Get_Constraint_State (Type_Mark)); end if; @@ -1915,11 +2021,13 @@ package body Sem_Types is A_Range := Get_Range_Constraint (Def); if A_Range = Null_Iir then A_Range := Get_Range_Constraint (Type_Mark); + Set_Is_Ref (Res, True); else A_Range := Sem_Range_Expression (A_Range, Type_Mark, True); if A_Range = Null_Iir then -- Avoid error propagation. A_Range := Get_Range_Constraint (Type_Mark); + Set_Is_Ref (Res, True); end if; end if; Set_Range_Constraint (Res, A_Range); @@ -2000,11 +2108,11 @@ package body Sem_Types is -- of an access type in a subtype indication is an index -- constraint. declare + Base_Type : constant Iir := + Get_Designated_Type (Type_Mark); Sub_Type : Iir; - Base_Type : Iir; Res : Iir; begin - Base_Type := Get_Designated_Type (Type_Mark); Sub_Type := Sem_Array_Constraint (Def, Base_Type, Null_Iir); Res := Create_Iir (Iir_Kind_Access_Subtype_Definition); @@ -2012,6 +2120,12 @@ package body Sem_Types is Set_Base_Type (Res, Type_Mark); Set_Designated_Subtype_Indication (Res, Sub_Type); Set_Signal_Type_Flag (Res, False); + + -- The type_mark is a type_mark of the access subtype, + -- not of the array subtype. + Set_Subtype_Type_Mark + (Res, Get_Subtype_Type_Mark (Sub_Type)); + Set_Subtype_Type_Mark (Sub_Type, Null_Iir); return Res; end; when others => @@ -2104,71 +2218,6 @@ package body Sem_Types is return Res; end Sem_Subtype_Indication; - function Copy_Subtype_Indication (Def : Iir) return Iir - is - Res : Iir; - begin - case Get_Kind (Def) is - when Iir_Kind_Integer_Subtype_Definition - | Iir_Kind_Floating_Subtype_Definition - | Iir_Kind_Enumeration_Subtype_Definition - | Iir_Kind_Physical_Subtype_Definition => - Res := Create_Iir (Get_Kind (Def)); - Set_Range_Constraint (Res, Get_Range_Constraint (Def)); - Set_Resolution_Indication - (Res, Get_Resolution_Indication (Def)); - when Iir_Kind_Enumeration_Type_Definition => - Res := Create_Iir (Iir_Kind_Enumeration_Subtype_Definition); - Set_Range_Constraint (Res, Get_Range_Constraint (Def)); - - when Iir_Kind_Access_Subtype_Definition - | Iir_Kind_Access_Type_Definition => - Res := Create_Iir (Iir_Kind_Access_Subtype_Definition); - Set_Designated_Type (Res, Get_Designated_Type (Def)); - - when Iir_Kind_Array_Type_Definition => - Res := Create_Iir (Iir_Kind_Array_Subtype_Definition); - Set_Type_Staticness (Res, Get_Type_Staticness (Def)); - Set_Resolved_Flag (Res, Get_Resolved_Flag (Def)); - Set_Index_Constraint_List (Res, Null_Iir_List); - Set_Index_Subtype_List - (Res, Get_Index_Subtype_Definition_List (Def)); - Set_Element_Subtype (Res, Get_Element_Subtype (Def)); - Set_Index_Constraint_Flag (Res, False); - Set_Constraint_State (Res, Get_Constraint_State (Def)); - when Iir_Kind_Array_Subtype_Definition => - Res := Create_Iir (Iir_Kind_Array_Subtype_Definition); - Set_Resolution_Indication (Res, Get_Resolution_Indication (Def)); - Set_Resolved_Flag (Res, Get_Resolved_Flag (Def)); - Set_Index_Subtype_List (Res, Get_Index_Subtype_List (Def)); - Set_Element_Subtype (Res, Get_Element_Subtype (Def)); - Set_Index_Constraint_Flag - (Res, Get_Index_Constraint_Flag (Def)); - Set_Constraint_State (Res, Get_Constraint_State (Def)); - - when Iir_Kind_Record_Type_Definition - | Iir_Kind_Record_Subtype_Definition => - Res := Create_Iir (Iir_Kind_Record_Subtype_Definition); - Set_Type_Staticness (Res, Get_Type_Staticness (Def)); - if Get_Kind (Def) = Iir_Kind_Record_Subtype_Definition then - Set_Resolution_Indication - (Res, Get_Resolution_Indication (Def)); - end if; - Set_Resolved_Flag (Res, Get_Resolved_Flag (Def)); - Set_Constraint_State (Res, Get_Constraint_State (Def)); - Set_Elements_Declaration_List - (Res, Get_Elements_Declaration_List (Def)); - when others => - -- FIXME: todo (protected type ?) - Error_Kind ("copy_subtype_indication", Def); - end case; - Location_Copy (Res, Def); - Set_Base_Type (Res, Get_Base_Type (Def)); - Set_Type_Staticness (Res, Get_Type_Staticness (Def)); - Set_Signal_Type_Flag (Res, Get_Signal_Type_Flag (Def)); - return Res; - end Copy_Subtype_Indication; - function Sem_Subnature_Indication (Def: Iir) return Iir is Nature_Mark: Iir; diff --git a/src/vhdl/sem_types.ads b/src/vhdl/sem_types.ads index d701d5a81..5ba50dd79 100644 --- a/src/vhdl/sem_types.ads +++ b/src/vhdl/sem_types.ads @@ -52,6 +52,10 @@ package Sem_Types is -- This is used when an alias of DEF is required (eg: subtype a is b). function Copy_Subtype_Indication (Def : Iir) return Iir; + -- Return a copy of the resolution_indication in SUBDEF, or null_iir if + -- none. + function Copy_Resolution_Indication (Subdef : Iir) return Iir; + -- Although a nature is not a type, it is patterned like a type. function Sem_Subnature_Indication (Def: Iir) return Iir; end Sem_Types; diff --git a/src/vhdl/simulate/annotations.adb b/src/vhdl/simulate/annotations.adb index 4b6270afd..4758b5bed 100644 --- a/src/vhdl/simulate/annotations.adb +++ b/src/vhdl/simulate/annotations.adb @@ -1078,8 +1078,7 @@ package body Annotations is if Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration then declare - Uninst : constant Iir := - Get_Named_Entity (Get_Uninstantiated_Package_Name (Decl)); + Uninst : constant Iir := Get_Uninstantiated_Package_Decl (Decl); Uninst_Info : constant Sim_Info_Acc := Get_Info (Uninst); begin -- There is not corresponding body for an instantiation, so diff --git a/src/vhdl/simulate/elaboration.adb b/src/vhdl/simulate/elaboration.adb index 7ca7063cf..bc3fe1896 100644 --- a/src/vhdl/simulate/elaboration.adb +++ b/src/vhdl/simulate/elaboration.adb @@ -390,8 +390,7 @@ package body Elaboration is if Get_Kind (Decl) = Iir_Kind_Package_Instantiation_Declaration then -- Elaborate the body now. declare - Uninst : constant Iir := - Get_Named_Entity (Get_Uninstantiated_Package_Name (Decl)); + Uninst : constant Iir := Get_Uninstantiated_Package_Decl (Decl); begin Elaborate_Declarative_Part (Instance, Get_Declaration_Chain (Get_Package_Body (Uninst))); diff --git a/src/vhdl/std_package.adb b/src/vhdl/std_package.adb index 93cee8045..598bdc533 100644 --- a/src/vhdl/std_package.adb +++ b/src/vhdl/std_package.adb @@ -188,6 +188,8 @@ package body Std_Package is Nxt : Iir; begin Sem_Decls.Create_Implicit_Operations (Decl, True); + + -- Update Last_Decl loop Nxt := Get_Chain (Last_Decl); exit when Nxt = Null_Iir; @@ -195,6 +197,37 @@ package body Std_Package is end loop; end Add_Implicit_Operations; + -- Find implicit declaration of "**" for type declaration TYPE_DECL + -- and append it at the current end of std_package. + procedure Relocate_Exp_At_End (Type_Decl : Iir) + is + Prev_El, El : Iir; + begin + pragma Assert + (Get_Kind (Type_Decl) = Iir_Kind_Anonymous_Type_Declaration); + El := Type_Decl; + loop + Prev_El := El; + El := Get_Chain (El); + pragma Assert (Get_Kind (El) = Iir_Kind_Function_Declaration); + exit when + Get_Implicit_Definition (El) = Iir_Predefined_Integer_Exp; + exit when + Get_Implicit_Definition (El) = Iir_Predefined_Floating_Exp; + end loop; + + -- EL must not be the last element, otherwise Add_Decl will break + -- the chain. + pragma Assert (Is_Valid (Get_Chain (El))); + + -- Remove from the chain. + Set_Chain (Prev_El, Get_Chain (El)); + Set_Chain (El, Null_Iir); + + -- Append. + Add_Decl (El); + end Relocate_Exp_At_End; + procedure Create_Std_Type (Decl : out Iir; Def : Iir; Name : Name_Id) is begin Decl := Create_Std_Decl (Iir_Kind_Type_Declaration); @@ -249,6 +282,7 @@ package body Std_Package is Subtype_Decl := Create_Std_Decl (Iir_Kind_Subtype_Declaration); Set_Std_Identifier (Subtype_Decl, Get_Identifier (Type_Decl)); Set_Type (Subtype_Decl, Subtype_Definition); + Set_Subtype_Indication (Subtype_Decl, Subtype_Definition); Set_Type_Declarator (Subtype_Definition, Subtype_Decl); Set_Subtype_Definition (Type_Decl, Subtype_Definition); end Create_Integer_Subtype; @@ -579,6 +613,7 @@ package body Std_Package is Set_Signal_Type_Flag (Universal_Real_Type_Definition, True); Set_Has_Signal_Flag (Universal_Real_Type_Definition, False); + -- type universal_real is ... Universal_Real_Type_Declaration := Create_Std_Decl (Iir_Kind_Anonymous_Type_Declaration); Set_Identifier (Universal_Real_Type_Declaration, Name_Universal_Real); @@ -601,13 +636,15 @@ package body Std_Package is Set_Signal_Type_Flag (Universal_Real_Subtype_Definition, True); Set_Has_Signal_Flag (Universal_Real_Subtype_Definition, False); - -- type is + -- subtype universal_real is ... Universal_Real_Subtype_Declaration := Create_Std_Decl (Iir_Kind_Subtype_Declaration); Set_Identifier (Universal_Real_Subtype_Declaration, Name_Universal_Real); Set_Type (Universal_Real_Subtype_Declaration, Universal_Real_Subtype_Definition); + Set_Subtype_Indication (Universal_Real_Subtype_Declaration, + Universal_Real_Subtype_Definition); Set_Type_Declarator (Universal_Real_Subtype_Definition, Universal_Real_Subtype_Declaration); Set_Subtype_Definition (Universal_Real_Type_Declaration, @@ -659,10 +696,19 @@ package body Std_Package is Name_Integer); Add_Decl (Integer_Type_Declaration); - Add_Implicit_Operations (Integer_Type_Declaration); + -- Now that Integer is declared, create operations for universal + -- types. They will be inserted just after the type declaration, + -- but cannot be done before as "**" relies on Integer. Add_Implicit_Operations (Universal_Integer_Type_Declaration); Add_Implicit_Operations (Universal_Real_Type_Declaration); + -- Don't define "**" for universal types before the declaration of + -- Integer, so move them. + Relocate_Exp_At_End (Universal_Integer_Type_Declaration); + Relocate_Exp_At_End (Universal_Real_Type_Declaration); + + Add_Implicit_Operations (Integer_Type_Declaration); + Create_Integer_Subtype (Integer_Type_Definition, Integer_Type_Declaration, Integer_Subtype_Definition, @@ -709,6 +755,8 @@ package body Std_Package is Create_Std_Decl (Iir_Kind_Subtype_Declaration); Set_Std_Identifier (Real_Subtype_Declaration, Name_Real); Set_Type (Real_Subtype_Declaration, Real_Subtype_Definition); + Set_Subtype_Indication (Real_Subtype_Declaration, + Real_Subtype_Definition); Set_Type_Declarator (Real_Subtype_Definition, Real_Subtype_Declaration); Add_Decl (Real_Subtype_Declaration); @@ -731,8 +779,8 @@ package body Std_Package is begin Lit := Create_Std_Iir (Iir_Kind_Physical_Int_Literal); Set_Value (Lit, Value); - pragma Assert (Get_Kind (Unit) = Iir_Kind_Simple_Name); - Set_Unit_Name (Lit, Unit); + pragma Assert (Get_Kind (Unit) = Iir_Kind_Unit_Declaration); + Set_Physical_Unit (Lit, Unit); Set_Type (Lit, Time_Type_Definition); Set_Expr_Staticness (Lit, Time_Staticness); return Lit; @@ -743,21 +791,19 @@ package body Std_Package is Multiplier : in Iir_Unit_Declaration; Name : Name_Id) is - Lit: Iir_Physical_Int_Literal; - Mul_Name : Iir; + Lit, Lit1 : Iir_Physical_Int_Literal; begin Unit := Create_Std_Decl (Iir_Kind_Unit_Declaration); Set_Std_Identifier (Unit, Name); Set_Type (Unit, Time_Type_Definition); - Mul_Name := Iirs_Utils.Build_Simple_Name - (Multiplier, Std_Location); - Lit := Create_Std_Phys_Lit (Multiplier_Value, Mul_Name); - Set_Physical_Literal (Unit, Lit); + Lit1 := Create_Std_Phys_Lit (Multiplier_Value, Multiplier); + Set_Physical_Literal (Unit, Lit1); Lit := Create_Std_Phys_Lit (Multiplier_Value * Get_Value (Get_Physical_Unit_Value (Multiplier)), - Get_Unit_Name (Get_Physical_Unit_Value (Multiplier))); + Get_Physical_Unit (Get_Physical_Unit_Value (Multiplier))); + Set_Literal_Origin (Lit, Lit1); Set_Physical_Unit_Value (Unit, Lit); Set_Expr_Staticness (Unit, Time_Staticness); @@ -765,7 +811,6 @@ package body Std_Package is Append (Last_Unit, Time_Type_Definition, Unit); end Create_Unit; - Time_Fs_Name : Iir; Time_Fs_Unit: Iir_Unit_Declaration; Time_Ps_Unit: Iir_Unit_Declaration; Time_Ns_Unit: Iir_Unit_Declaration; @@ -798,10 +843,8 @@ package body Std_Package is Set_Type (Time_Fs_Unit, Time_Type_Definition); Set_Expr_Staticness (Time_Fs_Unit, Time_Staticness); Set_Name_Staticness (Time_Fs_Unit, Locally); - Time_Fs_Name := Iirs_Utils.Build_Simple_Name - (Time_Fs_Unit, Std_Location); Set_Physical_Unit_Value - (Time_Fs_Unit, Create_Std_Phys_Lit (1, Time_Fs_Name)); + (Time_Fs_Unit, Create_Std_Phys_Lit (1, Time_Fs_Unit)); Append (Last_Unit, Time_Type_Definition, Time_Fs_Unit); Create_Unit (Time_Ps_Unit, 1000, Time_Fs_Unit, Name_Ps); @@ -826,9 +869,9 @@ package body Std_Package is Create_Std_Iir (Iir_Kind_Physical_Subtype_Definition); Constraint := Create_Std_Range_Expr (Create_Std_Phys_Lit (Low_Bound (Flags.Flag_Time_64), - Time_Fs_Name), + Time_Fs_Unit), Create_Std_Phys_Lit (High_Bound (Flags.Flag_Time_64), - Time_Fs_Name), + Time_Fs_Unit), Time_Type_Definition); Set_Range_Constraint (Time_Subtype_Definition, Constraint); Set_Base_Type (Time_Subtype_Definition, Time_Type_Definition); @@ -844,6 +887,8 @@ package body Std_Package is Create_Std_Decl (Iir_Kind_Subtype_Declaration); Set_Std_Identifier (Time_Subtype_Declaration, Name_Time); Set_Type (Time_Subtype_Declaration, Time_Subtype_Definition); + Set_Subtype_Indication (Time_Subtype_Declaration, + Time_Subtype_Definition); Set_Type_Declarator (Time_Subtype_Definition, Time_Subtype_Declaration); Add_Decl (Time_Subtype_Declaration); @@ -881,9 +926,9 @@ package body Std_Package is (Delay_Length_Subtype_Definition, Create_Std_Type_Mark (Time_Subtype_Declaration)); Constraint := Create_Std_Range_Expr - (Create_Std_Phys_Lit (0, Time_Fs_Name), + (Create_Std_Phys_Lit (0, Time_Fs_Unit), Create_Std_Phys_Lit (High_Bound (Flags.Flag_Time_64), - Time_Fs_Name), + Time_Fs_Unit), Time_Type_Definition); Set_Range_Constraint (Delay_Length_Subtype_Definition, Constraint); Set_Base_Type @@ -1219,6 +1264,7 @@ package body Std_Package is Create_Wildcard_Type (Wildcard_Any_Access_Type, "any access type"); Error_Type := Iirs_Utils.Create_Error_Type (Wildcard_Any_Type); + Set_Error_Origin (Error_Type, Null_Iir); Create_Wildcard_Type (Error_Type, "unknown type"); end Create_Std_Standard_Package; end Std_Package; diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb index 7222f2974..54c844aea 100644 --- a/src/vhdl/translate/trans-chap2.adb +++ b/src/vhdl/translate/trans-chap2.adb @@ -1212,7 +1212,8 @@ package body Trans.Chap2 is when Attr_None => Instantiate_Iir_Info (Get_Iir (N, F)); when Attr_Ref - | Attr_Forward_Ref => + | Attr_Forward_Ref + | Attr_Maybe_Forward_Ref => null; when Attr_Maybe_Ref => if not Get_Is_Ref (N) then @@ -1313,8 +1314,7 @@ package body Trans.Chap2 is -- package_instantiation_declaration procedure Instantiate_Info_Package (Inst : Iir) is - Spec : constant Iir := - Get_Named_Entity (Get_Uninstantiated_Package_Name (Inst)); + Spec : constant Iir := Get_Uninstantiated_Package_Decl (Inst); Pkg_Info : constant Ortho_Info_Acc := Get_Info (Spec); Info : Ortho_Info_Acc; begin @@ -1337,8 +1337,7 @@ package body Trans.Chap2 is procedure Translate_Package_Instantiation_Declaration (Inst : Iir) is - Spec : constant Iir := - Get_Named_Entity (Get_Uninstantiated_Package_Name (Inst)); + Spec : constant Iir := Get_Uninstantiated_Package_Decl (Inst); Pkg_Info : constant Ortho_Info_Acc := Get_Info (Spec); Info : Ortho_Info_Acc; Interface_List : O_Inter_List; @@ -1395,8 +1394,7 @@ package body Trans.Chap2 is procedure Elab_Package_Instantiation_Declaration (Inst : Iir) is - Spec : constant Iir := - Get_Named_Entity (Get_Uninstantiated_Package_Name (Inst)); + Spec : constant Iir := Get_Uninstantiated_Package_Decl (Inst); Pkg_Info : constant Ortho_Info_Acc := Get_Info (Spec); Info : constant Ortho_Info_Acc := Get_Info (Inst); Constr : O_Assoc_List; diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb index 3fa188df4..e59e7945c 100644 --- a/src/vhdl/translate/trans-chap4.adb +++ b/src/vhdl/translate/trans-chap4.adb @@ -269,8 +269,7 @@ package body Trans.Chap4 is procedure Create_Package_Interface (Inter : Iir) is - Pkg : constant Iir := Get_Named_Entity - (Get_Uninstantiated_Package_Name (Inter)); + Pkg : constant Iir := Get_Uninstantiated_Package_Decl (Inter); Pkg_Info : constant Ortho_Info_Acc := Get_Info (Pkg); Info : Ortho_Info_Acc; begin diff --git a/src/vhdl/translate/trans-chap5.adb b/src/vhdl/translate/trans-chap5.adb index 7572032af..7a6bb0cfb 100644 --- a/src/vhdl/translate/trans-chap5.adb +++ b/src/vhdl/translate/trans-chap5.adb @@ -802,8 +802,8 @@ package body Trans.Chap5 is pragma Assert (Get_Kind (Formal) = Iir_Kind_Interface_Package_Declaration); declare - Uninst_Pkg : constant Iir := Get_Named_Entity - (Get_Uninstantiated_Package_Name (Formal)); + Uninst_Pkg : constant Iir := + Get_Uninstantiated_Package_Decl (Formal); Uninst_Info : constant Ortho_Info_Acc := Get_Info (Uninst_Pkg); Formal_Info : constant Ortho_Info_Acc := diff --git a/src/vhdl/translate/trans-chap7.adb b/src/vhdl/translate/trans-chap7.adb index 451dfcba6..c216e199d 100644 --- a/src/vhdl/translate/trans-chap7.adb +++ b/src/vhdl/translate/trans-chap7.adb @@ -3050,7 +3050,7 @@ package body Trans.Chap7 is Set_El (Get_Nth_Element (El_List, El_Index)); El_Index := El_Index + 1; when Iir_Kind_Choice_By_Name => - Set_El (Get_Choice_Name (Assoc)); + Set_El (Get_Named_Entity (Get_Choice_Name (Assoc))); El_Index := Natural'Last; when Iir_Kind_Choice_By_Others => for J in Set_Array'Range loop diff --git a/src/vhdl/translate/trans-chap8.adb b/src/vhdl/translate/trans-chap8.adb index c8f270174..296f4de7f 100644 --- a/src/vhdl/translate/trans-chap8.adb +++ b/src/vhdl/translate/trans-chap8.adb @@ -919,7 +919,7 @@ package body Trans.Chap8 is Elem := Get_Nth_Element (El_List, El_Index); El_Index := El_Index + 1; when Iir_Kind_Choice_By_Name => - Elem := Get_Choice_Name (Aggr_El); + Elem := Get_Named_Entity (Get_Choice_Name (Aggr_El)); when others => Error_Kind ("translate_variable_rec_aggr", Aggr_El); end case; @@ -3158,7 +3158,7 @@ package body Trans.Chap8 is and then (Get_Kind (Base_Formal) = Iir_Kind_Interface_Variable_Declaration) then - Formal_Type := Get_Type (Get_Formal (El)); + Formal_Type := Get_Type (Get_Named_Entity (Get_Formal (El))); Ftype_Info := Get_Info (Formal_Type); pragma Assert (Get_Interface_Kind (Base_Formal) = Mode_Value); @@ -3817,7 +3817,7 @@ package body Trans.Chap8 is Element := Get_Nth_Element (El_List, El_Index); El_Index := El_Index + 1; when Iir_Kind_Choice_By_Name => - Element := Get_Choice_Name (Aggr_El); + Element := Get_Named_Entity (Get_Choice_Name (Aggr_El)); El_Index := Natural'Last; when others => Error_Kind ("translate_signal_target_record_aggr", Aggr_El); diff --git a/src/vhdl/translate/trans-chap9.adb b/src/vhdl/translate/trans-chap9.adb index e3aad5f45..1dadfba4d 100644 --- a/src/vhdl/translate/trans-chap9.adb +++ b/src/vhdl/translate/trans-chap9.adb @@ -1154,7 +1154,8 @@ package body Trans.Chap9 is when Attr_None => Destroy_Types (Get_Iir (N, F)); when Attr_Ref - | Attr_Forward_Ref => + | Attr_Forward_Ref + | Attr_Maybe_Forward_Ref => null; when Attr_Maybe_Ref => if not Get_Is_Ref (N) then |