From 3f9512b68752421200b4fc34645a25a494c01c9f Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 22 Mar 2023 04:33:34 +0100 Subject: vhdl: add Set/Get_Immediate_Body_Flag (for package instantiation) --- pyGHDL/libghdl/vhdl/nodes.py | 13 + pyGHDL/libghdl/vhdl/nodes_meta.py | 619 +++++++++++++++++++------------------- src/vhdl/vhdl-nodes.adb | 16 + src/vhdl/vhdl-nodes.ads | 9 + src/vhdl/vhdl-nodes_meta.adb | 254 +--------------- src/vhdl/vhdl-nodes_meta.ads | 2 + 6 files changed, 368 insertions(+), 545 deletions(-) diff --git a/pyGHDL/libghdl/vhdl/nodes.py b/pyGHDL/libghdl/vhdl/nodes.py index ce86ea36e..5700e5df6 100644 --- a/pyGHDL/libghdl/vhdl/nodes.py +++ b/pyGHDL/libghdl/vhdl/nodes.py @@ -3043,6 +3043,19 @@ def Set_Need_Body(obj: Iir, value: Boolean) -> None: """""" +@export +@BindToLibGHDL("vhdl__nodes__get_immediate_body_flag") +def Get_Immediate_Body_Flag(obj: Iir) -> Boolean: + """""" + return 0 + + +@export +@BindToLibGHDL("vhdl__nodes__set_immediate_body_flag") +def Set_Immediate_Body_Flag(obj: Iir, value: Boolean) -> None: + """""" + + @export @BindToLibGHDL("vhdl__nodes__get_macro_expanded_flag") def Get_Macro_Expanded_Flag(obj: Iir) -> Boolean: diff --git a/pyGHDL/libghdl/vhdl/nodes_meta.py b/pyGHDL/libghdl/vhdl/nodes_meta.py index fcacf57c5..42154df63 100644 --- a/pyGHDL/libghdl/vhdl/nodes_meta.py +++ b/pyGHDL/libghdl/vhdl/nodes_meta.py @@ -198,312 +198,313 @@ class fields(IntEnum): Package_Body = 78 Instance_Package_Body = 79 Need_Body = 80 - Macro_Expanded_Flag = 81 - Need_Instance_Bodies = 82 - Hierarchical_Name = 83 - Vunit_Item_Chain = 84 - Bound_Vunit_Chain = 85 - Verification_Block_Configuration = 86 - Block_Configuration = 87 - Concurrent_Statement_Chain = 88 - Chain = 89 - Port_Chain = 90 - Generic_Chain = 91 - Type = 92 - Subtype_Indication = 93 - Discrete_Range = 94 - Type_Definition = 95 - Subtype_Definition = 96 - Incomplete_Type_Declaration = 97 - Interface_Type_Subprograms = 98 - Interface_Type_Definition = 99 - Nature_Definition = 100 - Nature = 101 - Subnature_Indication = 102 - Reference_Terminal_Flag = 103 - Mode = 104 - Guarded_Signal_Flag = 105 - Signal_Kind = 106 - Base_Name = 107 - Interface_Declaration_Chain = 108 - Default_Subprogram = 109 - Associated_Subprogram = 110 - Subprogram_Specification = 111 - Sequential_Statement_Chain = 112 - Simultaneous_Statement_Chain = 113 - Subprogram_Body = 114 - Overload_Number = 115 - Subprogram_Depth = 116 - Subprogram_Hash = 117 - Impure_Depth = 118 - Return_Type = 119 - Implicit_Definition = 120 - Uninstantiated_Subprogram_Name = 121 - Default_Value = 122 - Deferred_Declaration = 123 - Deferred_Declaration_Flag = 124 - Shared_Flag = 125 - Design_Unit = 126 - Block_Statement = 127 - Signal_Driver = 128 - Declaration_Chain = 129 - File_Logical_Name = 130 - File_Open_Kind = 131 - Element_Position = 132 - Use_Clause_Chain = 133 - Context_Reference_Chain = 134 - Inherit_Spec_Chain = 135 - Selected_Name = 136 - Type_Declarator = 137 - Complete_Type_Definition = 138 - Incomplete_Type_Ref_Chain = 139 - Associated_Type = 140 - Enumeration_Literal_List = 141 - Entity_Class_Entry_Chain = 142 - Group_Constituent_List = 143 - Unit_Chain = 144 - Primary_Unit = 145 - Identifier = 146 - Label = 147 - Return_Identifier = 148 - Visible_Flag = 149 - Range_Constraint = 150 - Direction = 151 - Left_Limit = 152 - Right_Limit = 153 - Left_Limit_Expr = 154 - Right_Limit_Expr = 155 - Parent_Type = 156 - Simple_Nature = 157 - Base_Nature = 158 - Resolution_Indication = 159 - Record_Element_Resolution_Chain = 160 - Tolerance = 161 - Plus_Terminal_Name = 162 - Minus_Terminal_Name = 163 - Plus_Terminal = 164 - Minus_Terminal = 165 - Magnitude_Expression = 166 - Phase_Expression = 167 - Power_Expression = 168 - Simultaneous_Left = 169 - Simultaneous_Right = 170 - Text_File_Flag = 171 - Only_Characters_Flag = 172 - Is_Character_Type = 173 - Nature_Staticness = 174 - Type_Staticness = 175 - Constraint_State = 176 - Index_Subtype_List = 177 - Index_Subtype_Definition_List = 178 - Element_Subtype_Indication = 179 - Element_Subtype = 180 - Element_Subnature_Indication = 181 - Element_Subnature = 182 - Index_Constraint_List = 183 - Array_Element_Constraint = 184 - Has_Array_Constraint_Flag = 185 - Has_Element_Constraint_Flag = 186 - Elements_Declaration_List = 187 - Owned_Elements_Chain = 188 - Designated_Type = 189 - Designated_Subtype_Indication = 190 - Index_List = 191 - Reference = 192 - Nature_Declarator = 193 - Across_Type_Mark = 194 - Through_Type_Mark = 195 - Across_Type_Definition = 196 - Through_Type_Definition = 197 - Across_Type = 198 - Through_Type = 199 - Target = 200 - Waveform_Chain = 201 - Guard = 202 - Delay_Mechanism = 203 - Reject_Time_Expression = 204 - Force_Mode = 205 - Has_Force_Mode = 206 - Sensitivity_List = 207 - Process_Origin = 208 - Package_Origin = 209 - Condition_Clause = 210 - Break_Element = 211 - Selector_Quantity = 212 - Break_Quantity = 213 - Timeout_Clause = 214 - Postponed_Flag = 215 - Callees_List = 216 - Passive_Flag = 217 - Resolution_Function_Flag = 218 - Wait_State = 219 - All_Sensitized_State = 220 - Seen_Flag = 221 - Pure_Flag = 222 - Foreign_Flag = 223 - Resolved_Flag = 224 - Signal_Type_Flag = 225 - Has_Signal_Flag = 226 - Purity_State = 227 - Elab_Flag = 228 - Vendor_Library_Flag = 229 - Configuration_Mark_Flag = 230 - Configuration_Done_Flag = 231 - Index_Constraint_Flag = 232 - Hide_Implicit_Flag = 233 - Assertion_Condition = 234 - Report_Expression = 235 - Severity_Expression = 236 - Instantiated_Unit = 237 - Instantiated_Header = 238 - Generic_Map_Aspect_Chain = 239 - Port_Map_Aspect_Chain = 240 - Configuration_Name = 241 - Component_Configuration = 242 - Configuration_Specification = 243 - Default_Binding_Indication = 244 - Default_Configuration_Declaration = 245 - Expression = 246 - Conditional_Expression_Chain = 247 - Allocator_Designated_Type = 248 - Selected_Waveform_Chain = 249 - Conditional_Waveform_Chain = 250 - Guard_Expression = 251 - Guard_Decl = 252 - Guard_Sensitivity_List = 253 - Attribute_Implicit_Chain = 254 - Block_Block_Configuration = 255 - Package_Header = 256 - Block_Header = 257 - Uninstantiated_Package_Name = 258 - Uninstantiated_Package_Decl = 259 - Associated_Package = 260 - Instance_Source_File = 261 - Generate_Block_Configuration = 262 - Generate_Statement_Body = 263 - Alternative_Label = 264 - Generate_Else_Clause = 265 - Condition = 266 - Else_Clause = 267 - Parameter_Specification = 268 - Parent = 269 - Loop_Label = 270 - Exit_Flag = 271 - Next_Flag = 272 - Component_Name = 273 - Instantiation_List = 274 - Entity_Aspect = 275 - Default_Entity_Aspect = 276 - Binding_Indication = 277 - Named_Entity = 278 - Referenced_Name = 279 - Expr_Staticness = 280 - Scalar_Size = 281 - Error_Origin = 282 - Operand = 283 - Left = 284 - Right = 285 - Unit_Name = 286 - Name = 287 - Group_Template_Name = 288 - Name_Staticness = 289 - Prefix = 290 - Signature_Prefix = 291 - External_Pathname = 292 - Pathname_Suffix = 293 - Pathname_Expression = 294 - In_Formal_Flag = 295 - Inertial_Flag = 296 - Slice_Subtype = 297 - Suffix = 298 - Index_Subtype = 299 - Parameter = 300 - Parameter_2 = 301 - Parameter_3 = 302 - Parameter_4 = 303 - Attr_Chain = 304 - Attribute_Implicit_Declaration = 305 - Actual_Type = 306 - Actual_Type_Definition = 307 - Association_Chain = 308 - Individual_Association_Chain = 309 - Subprogram_Association_Chain = 310 - Aggregate_Info = 311 - Sub_Aggregate_Info = 312 - Aggr_Dynamic_Flag = 313 - Aggr_Min_Length = 314 - Aggr_Low_Limit = 315 - Aggr_High_Limit = 316 - Aggr_Others_Flag = 317 - Aggr_Named_Flag = 318 - Aggregate_Expand_Flag = 319 - Determined_Aggregate_Flag = 320 - Association_Choices_Chain = 321 - Case_Statement_Alternative_Chain = 322 - Matching_Flag = 323 - Choice_Staticness = 324 - Procedure_Call = 325 - Implementation = 326 - Parameter_Association_Chain = 327 - Method_Object = 328 - Subtype_Type_Mark = 329 - Subnature_Nature_Mark = 330 - Type_Conversion_Subtype = 331 - Type_Mark = 332 - File_Type_Mark = 333 - Return_Type_Mark = 334 - Has_Disconnect_Flag = 335 - Has_Active_Flag = 336 - Is_Within_Flag = 337 - Type_Marks_List = 338 - Implicit_Alias_Flag = 339 - Alias_Signature = 340 - Attribute_Signature = 341 - Overload_List = 342 - Simple_Name_Identifier = 343 - Simple_Name_Subtype = 344 - Protected_Type_Body = 345 - Protected_Type_Declaration = 346 - Use_Flag = 347 - Elaborated_Flag = 348 - End_Has_Reserved_Id = 349 - End_Has_Identifier = 350 - End_Has_Postponed = 351 - Has_Label = 352 - Has_Begin = 353 - Has_End = 354 - Has_Is = 355 - Has_Pure = 356 - Has_Body = 357 - Has_Parameter = 358 - Has_Component = 359 - Has_Identifier_List = 360 - Has_Mode = 361 - Has_Class = 362 - Has_Delay_Mechanism = 363 - Suspend_Flag = 364 - Stop_Flag = 365 - Is_Ref = 366 - Is_Forward_Ref = 367 - Psl_Property = 368 - Psl_Sequence = 369 - Psl_Declaration = 370 - Psl_Expression = 371 - Psl_Boolean = 372 - PSL_Clock = 373 - PSL_NFA = 374 - PSL_Nbr_States = 375 - PSL_Clock_Sensitivity = 376 - PSL_EOS_Flag = 377 - PSL_Abort_Flag = 378 - Count_Expression = 379 - Clock_Expression = 380 - Default_Clock = 381 - Foreign_Node = 382 - Suspend_State_Index = 383 - Suspend_State_Chain = 384 - Suspend_State_Last = 385 - Suspend_State_Decl = 386 + Immediate_Body_Flag = 81 + Macro_Expanded_Flag = 82 + Need_Instance_Bodies = 83 + Hierarchical_Name = 84 + Vunit_Item_Chain = 85 + Bound_Vunit_Chain = 86 + Verification_Block_Configuration = 87 + Block_Configuration = 88 + Concurrent_Statement_Chain = 89 + Chain = 90 + Port_Chain = 91 + Generic_Chain = 92 + Type = 93 + Subtype_Indication = 94 + Discrete_Range = 95 + Type_Definition = 96 + Subtype_Definition = 97 + Incomplete_Type_Declaration = 98 + Interface_Type_Subprograms = 99 + Interface_Type_Definition = 100 + Nature_Definition = 101 + Nature = 102 + Subnature_Indication = 103 + Reference_Terminal_Flag = 104 + Mode = 105 + Guarded_Signal_Flag = 106 + Signal_Kind = 107 + Base_Name = 108 + Interface_Declaration_Chain = 109 + Default_Subprogram = 110 + Associated_Subprogram = 111 + Subprogram_Specification = 112 + Sequential_Statement_Chain = 113 + Simultaneous_Statement_Chain = 114 + Subprogram_Body = 115 + Overload_Number = 116 + Subprogram_Depth = 117 + Subprogram_Hash = 118 + Impure_Depth = 119 + Return_Type = 120 + Implicit_Definition = 121 + Uninstantiated_Subprogram_Name = 122 + Default_Value = 123 + Deferred_Declaration = 124 + Deferred_Declaration_Flag = 125 + Shared_Flag = 126 + Design_Unit = 127 + Block_Statement = 128 + Signal_Driver = 129 + Declaration_Chain = 130 + File_Logical_Name = 131 + File_Open_Kind = 132 + Element_Position = 133 + Use_Clause_Chain = 134 + Context_Reference_Chain = 135 + Inherit_Spec_Chain = 136 + Selected_Name = 137 + Type_Declarator = 138 + Complete_Type_Definition = 139 + Incomplete_Type_Ref_Chain = 140 + Associated_Type = 141 + Enumeration_Literal_List = 142 + Entity_Class_Entry_Chain = 143 + Group_Constituent_List = 144 + Unit_Chain = 145 + Primary_Unit = 146 + Identifier = 147 + Label = 148 + Return_Identifier = 149 + Visible_Flag = 150 + Range_Constraint = 151 + Direction = 152 + Left_Limit = 153 + Right_Limit = 154 + Left_Limit_Expr = 155 + Right_Limit_Expr = 156 + Parent_Type = 157 + Simple_Nature = 158 + Base_Nature = 159 + Resolution_Indication = 160 + Record_Element_Resolution_Chain = 161 + Tolerance = 162 + Plus_Terminal_Name = 163 + Minus_Terminal_Name = 164 + Plus_Terminal = 165 + Minus_Terminal = 166 + Magnitude_Expression = 167 + Phase_Expression = 168 + Power_Expression = 169 + Simultaneous_Left = 170 + Simultaneous_Right = 171 + Text_File_Flag = 172 + Only_Characters_Flag = 173 + Is_Character_Type = 174 + Nature_Staticness = 175 + Type_Staticness = 176 + Constraint_State = 177 + Index_Subtype_List = 178 + Index_Subtype_Definition_List = 179 + Element_Subtype_Indication = 180 + Element_Subtype = 181 + Element_Subnature_Indication = 182 + Element_Subnature = 183 + Index_Constraint_List = 184 + Array_Element_Constraint = 185 + Has_Array_Constraint_Flag = 186 + Has_Element_Constraint_Flag = 187 + Elements_Declaration_List = 188 + Owned_Elements_Chain = 189 + Designated_Type = 190 + Designated_Subtype_Indication = 191 + Index_List = 192 + Reference = 193 + Nature_Declarator = 194 + Across_Type_Mark = 195 + Through_Type_Mark = 196 + Across_Type_Definition = 197 + Through_Type_Definition = 198 + Across_Type = 199 + Through_Type = 200 + Target = 201 + Waveform_Chain = 202 + Guard = 203 + Delay_Mechanism = 204 + Reject_Time_Expression = 205 + Force_Mode = 206 + Has_Force_Mode = 207 + Sensitivity_List = 208 + Process_Origin = 209 + Package_Origin = 210 + Condition_Clause = 211 + Break_Element = 212 + Selector_Quantity = 213 + Break_Quantity = 214 + Timeout_Clause = 215 + Postponed_Flag = 216 + Callees_List = 217 + Passive_Flag = 218 + Resolution_Function_Flag = 219 + Wait_State = 220 + All_Sensitized_State = 221 + Seen_Flag = 222 + Pure_Flag = 223 + Foreign_Flag = 224 + Resolved_Flag = 225 + Signal_Type_Flag = 226 + Has_Signal_Flag = 227 + Purity_State = 228 + Elab_Flag = 229 + Vendor_Library_Flag = 230 + Configuration_Mark_Flag = 231 + Configuration_Done_Flag = 232 + Index_Constraint_Flag = 233 + Hide_Implicit_Flag = 234 + Assertion_Condition = 235 + Report_Expression = 236 + Severity_Expression = 237 + Instantiated_Unit = 238 + Instantiated_Header = 239 + Generic_Map_Aspect_Chain = 240 + Port_Map_Aspect_Chain = 241 + Configuration_Name = 242 + Component_Configuration = 243 + Configuration_Specification = 244 + Default_Binding_Indication = 245 + Default_Configuration_Declaration = 246 + Expression = 247 + Conditional_Expression_Chain = 248 + Allocator_Designated_Type = 249 + Selected_Waveform_Chain = 250 + Conditional_Waveform_Chain = 251 + Guard_Expression = 252 + Guard_Decl = 253 + Guard_Sensitivity_List = 254 + Attribute_Implicit_Chain = 255 + Block_Block_Configuration = 256 + Package_Header = 257 + Block_Header = 258 + Uninstantiated_Package_Name = 259 + Uninstantiated_Package_Decl = 260 + Associated_Package = 261 + Instance_Source_File = 262 + Generate_Block_Configuration = 263 + Generate_Statement_Body = 264 + Alternative_Label = 265 + Generate_Else_Clause = 266 + Condition = 267 + Else_Clause = 268 + Parameter_Specification = 269 + Parent = 270 + Loop_Label = 271 + Exit_Flag = 272 + Next_Flag = 273 + Component_Name = 274 + Instantiation_List = 275 + Entity_Aspect = 276 + Default_Entity_Aspect = 277 + Binding_Indication = 278 + Named_Entity = 279 + Referenced_Name = 280 + Expr_Staticness = 281 + Scalar_Size = 282 + Error_Origin = 283 + Operand = 284 + Left = 285 + Right = 286 + Unit_Name = 287 + Name = 288 + Group_Template_Name = 289 + Name_Staticness = 290 + Prefix = 291 + Signature_Prefix = 292 + External_Pathname = 293 + Pathname_Suffix = 294 + Pathname_Expression = 295 + In_Formal_Flag = 296 + Inertial_Flag = 297 + Slice_Subtype = 298 + Suffix = 299 + Index_Subtype = 300 + Parameter = 301 + Parameter_2 = 302 + Parameter_3 = 303 + Parameter_4 = 304 + Attr_Chain = 305 + Attribute_Implicit_Declaration = 306 + Actual_Type = 307 + Actual_Type_Definition = 308 + Association_Chain = 309 + Individual_Association_Chain = 310 + Subprogram_Association_Chain = 311 + Aggregate_Info = 312 + Sub_Aggregate_Info = 313 + Aggr_Dynamic_Flag = 314 + Aggr_Min_Length = 315 + Aggr_Low_Limit = 316 + Aggr_High_Limit = 317 + Aggr_Others_Flag = 318 + Aggr_Named_Flag = 319 + Aggregate_Expand_Flag = 320 + Determined_Aggregate_Flag = 321 + Association_Choices_Chain = 322 + Case_Statement_Alternative_Chain = 323 + Matching_Flag = 324 + Choice_Staticness = 325 + Procedure_Call = 326 + Implementation = 327 + Parameter_Association_Chain = 328 + Method_Object = 329 + Subtype_Type_Mark = 330 + Subnature_Nature_Mark = 331 + Type_Conversion_Subtype = 332 + Type_Mark = 333 + File_Type_Mark = 334 + Return_Type_Mark = 335 + Has_Disconnect_Flag = 336 + Has_Active_Flag = 337 + Is_Within_Flag = 338 + Type_Marks_List = 339 + Implicit_Alias_Flag = 340 + Alias_Signature = 341 + Attribute_Signature = 342 + Overload_List = 343 + Simple_Name_Identifier = 344 + Simple_Name_Subtype = 345 + Protected_Type_Body = 346 + Protected_Type_Declaration = 347 + Use_Flag = 348 + Elaborated_Flag = 349 + End_Has_Reserved_Id = 350 + End_Has_Identifier = 351 + End_Has_Postponed = 352 + Has_Label = 353 + Has_Begin = 354 + Has_End = 355 + Has_Is = 356 + Has_Pure = 357 + Has_Body = 358 + Has_Parameter = 359 + Has_Component = 360 + Has_Identifier_List = 361 + Has_Mode = 362 + Has_Class = 363 + Has_Delay_Mechanism = 364 + Suspend_Flag = 365 + Stop_Flag = 366 + Is_Ref = 367 + Is_Forward_Ref = 368 + Psl_Property = 369 + Psl_Sequence = 370 + Psl_Declaration = 371 + Psl_Expression = 372 + Psl_Boolean = 373 + PSL_Clock = 374 + PSL_NFA = 375 + PSL_Nbr_States = 376 + PSL_Clock_Sensitivity = 377 + PSL_EOS_Flag = 378 + PSL_Abort_Flag = 379 + Count_Expression = 380 + Clock_Expression = 381 + Default_Clock = 382 + Foreign_Node = 383 + Suspend_State_Index = 384 + Suspend_State_Chain = 385 + Suspend_State_Last = 386 + Suspend_State_Decl = 387 def Get_Boolean(node, field): @@ -1124,6 +1125,12 @@ def Has_Need_Body(kind: IirKind) -> bool: """""" +@export +@BindToLibGHDL("vhdl__nodes_meta__has_immediate_body_flag") +def Has_Immediate_Body_Flag(kind: IirKind) -> bool: + """""" + + @export @BindToLibGHDL("vhdl__nodes_meta__has_macro_expanded_flag") def Has_Macro_Expanded_Flag(kind: IirKind) -> bool: diff --git a/src/vhdl/vhdl-nodes.adb b/src/vhdl/vhdl-nodes.adb index 4048d2cf2..beff8b527 100644 --- a/src/vhdl/vhdl-nodes.adb +++ b/src/vhdl/vhdl-nodes.adb @@ -2679,6 +2679,22 @@ package body Vhdl.Nodes is Set_Flag1 (Decl, Flag); end Set_Need_Body; + function Get_Immediate_Body_Flag (Decl : Iir) return Boolean is + begin + pragma Assert (Decl /= Null_Iir); + pragma Assert (Has_Immediate_Body_Flag (Get_Kind (Decl)), + "no field Immediate_Body_Flag"); + return Get_Flag5 (Decl); + end Get_Immediate_Body_Flag; + + procedure Set_Immediate_Body_Flag (Decl : Iir; Flag : Boolean) is + begin + pragma Assert (Decl /= Null_Iir); + pragma Assert (Has_Immediate_Body_Flag (Get_Kind (Decl)), + "no field Immediate_Body_Flag"); + Set_Flag5 (Decl, Flag); + end Set_Immediate_Body_Flag; + function Get_Macro_Expanded_Flag (Decl : Iir) return Boolean is begin pragma Assert (Decl /= Null_Iir); diff --git a/src/vhdl/vhdl-nodes.ads b/src/vhdl/vhdl-nodes.ads index 0cd02d637..8601159db 100644 --- a/src/vhdl/vhdl-nodes.ads +++ b/src/vhdl/vhdl-nodes.ads @@ -1074,6 +1074,8 @@ package Vhdl.Nodes is -- Iir_Kind_Package_Instantiation_Body (Short) -- Note: a body is not a declaration, that's the reason why there is no -- _declaration suffix in the name. + -- Note: Package_Instantiation_Body represent the place of the body when + -- it is not immediately after the instantiation. -- -- Get/Set_Parent (Field0) -- Get/Set_Design_Unit (Alias Field0) @@ -1124,6 +1126,9 @@ package Vhdl.Nodes is -- For macro-expanded packages: the body. -- Get/Set_Instance_Package_Body (Field4) -- + -- For macro-expanded packages: true if the body appears immediately after. + -- Get/Set_Immediate_Body_Flag (Flag5) + -- -- Get/Set_Visible_Flag (Flag4) -- -- Get/Set_End_Has_Reserved_Id (Flag8) @@ -8152,6 +8157,10 @@ package Vhdl.Nodes is function Get_Need_Body (Decl : Iir_Package_Declaration) return Boolean; procedure Set_Need_Body (Decl : Iir_Package_Declaration; Flag : Boolean); + -- Field: Flag5 + function Get_Immediate_Body_Flag (Decl : Iir) return Boolean; + procedure Set_Immediate_Body_Flag (Decl : Iir; Flag : Boolean); + -- Field: Flag2 function Get_Macro_Expanded_Flag (Decl : Iir) return Boolean; procedure Set_Macro_Expanded_Flag (Decl : Iir; Flag : Boolean); diff --git a/src/vhdl/vhdl-nodes_meta.adb b/src/vhdl/vhdl-nodes_meta.adb index 4004c8509..d3187b7cc 100644 --- a/src/vhdl/vhdl-nodes_meta.adb +++ b/src/vhdl/vhdl-nodes_meta.adb @@ -98,6 +98,7 @@ package body Vhdl.Nodes_Meta is Field_Package_Body => Type_Iir, Field_Instance_Package_Body => Type_Iir, Field_Need_Body => Type_Boolean, + Field_Immediate_Body_Flag => Type_Boolean, Field_Macro_Expanded_Flag => Type_Boolean, Field_Need_Instance_Bodies => Type_Boolean, Field_Hierarchical_Name => Type_Iir, @@ -576,6 +577,8 @@ package body Vhdl.Nodes_Meta is return "instance_package_body"; when Field_Need_Body => return "need_body"; + when Field_Immediate_Body_Flag => + return "immediate_body_flag"; when Field_Macro_Expanded_Flag => return "macro_expanded_flag"; when Field_Need_Instance_Bodies => @@ -2012,6 +2015,8 @@ package body Vhdl.Nodes_Meta is return Attr_None; when Field_Need_Body => return Attr_None; + when Field_Immediate_Body_Flag => + return Attr_None; when Field_Macro_Expanded_Flag => return Attr_None; when Field_Need_Instance_Bodies => @@ -3330,6 +3335,7 @@ package body Vhdl.Nodes_Meta is Field_Instance_Source_File, Field_Identifier, Field_Visible_Flag, + Field_Immediate_Body_Flag, Field_End_Has_Reserved_Id, Field_End_Has_Identifier, Field_Parent, @@ -5487,245 +5493,7 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Entity_Declaration => 576, Iir_Kind_Configuration_Declaration => 586, Iir_Kind_Context_Declaration => 592, -<<<<<<< HEAD Iir_Kind_Package_Declaration => 607, - Iir_Kind_Package_Instantiation_Declaration => 621, - Iir_Kind_Vmode_Declaration => 633, - Iir_Kind_Vprop_Declaration => 645, - Iir_Kind_Vunit_Declaration => 658, - Iir_Kind_Package_Body => 666, - Iir_Kind_Architecture_Body => 679, - Iir_Kind_Type_Declaration => 686, - Iir_Kind_Anonymous_Type_Declaration => 692, - Iir_Kind_Subtype_Declaration => 700, - Iir_Kind_Nature_Declaration => 706, - Iir_Kind_Subnature_Declaration => 713, - Iir_Kind_Package_Header => 715, - Iir_Kind_Unit_Declaration => 724, - Iir_Kind_Library_Declaration => 732, - Iir_Kind_Component_Declaration => 742, - Iir_Kind_Attribute_Declaration => 749, - Iir_Kind_Group_Template_Declaration => 755, - Iir_Kind_Group_Declaration => 762, - Iir_Kind_Element_Declaration => 770, - Iir_Kind_Nature_Element_Declaration => 777, - Iir_Kind_Non_Object_Alias_Declaration => 785, - Iir_Kind_Psl_Declaration => 793, - Iir_Kind_Psl_Boolean_Parameter => 801, - Iir_Kind_Psl_Endpoint_Declaration => 815, - Iir_Kind_Enumeration_Literal => 827, - Iir_Kind_Function_Declaration => 854, - Iir_Kind_Procedure_Declaration => 878, - Iir_Kind_Function_Body => 888, - Iir_Kind_Procedure_Body => 899, - Iir_Kind_Function_Instantiation_Declaration => 910, - Iir_Kind_Procedure_Instantiation_Declaration => 920, - Iir_Kind_Terminal_Declaration => 930, - Iir_Kind_Object_Alias_Declaration => 942, - Iir_Kind_Free_Quantity_Declaration => 954, - Iir_Kind_Spectrum_Quantity_Declaration => 967, - Iir_Kind_Noise_Quantity_Declaration => 979, - Iir_Kind_Across_Quantity_Declaration => 995, - Iir_Kind_Through_Quantity_Declaration => 1011, - Iir_Kind_File_Declaration => 1026, - Iir_Kind_Guard_Signal_Declaration => 1040, - Iir_Kind_Signal_Declaration => 1057, - Iir_Kind_Variable_Declaration => 1070, - Iir_Kind_Constant_Declaration => 1085, - Iir_Kind_Iterator_Declaration => 1097, - Iir_Kind_Interface_Constant_Declaration => 1114, - Iir_Kind_Interface_Variable_Declaration => 1130, - Iir_Kind_Interface_Signal_Declaration => 1151, - Iir_Kind_Interface_File_Declaration => 1167, - Iir_Kind_Interface_Quantity_Declaration => 1183, - Iir_Kind_Interface_Terminal_Declaration => 1195, - Iir_Kind_Interface_Type_Declaration => 1207, - Iir_Kind_Interface_Package_Declaration => 1221, - Iir_Kind_Interface_Function_Declaration => 1241, - Iir_Kind_Interface_Procedure_Declaration => 1257, - Iir_Kind_Attribute_Implicit_Declaration => 1260, - Iir_Kind_Suspend_State_Declaration => 1264, - Iir_Kind_Identity_Operator => 1268, - Iir_Kind_Negation_Operator => 1272, - Iir_Kind_Absolute_Operator => 1276, - Iir_Kind_Not_Operator => 1280, - Iir_Kind_Implicit_Condition_Operator => 1284, - Iir_Kind_Condition_Operator => 1288, - Iir_Kind_Reduction_And_Operator => 1292, - Iir_Kind_Reduction_Or_Operator => 1296, - Iir_Kind_Reduction_Nand_Operator => 1300, - Iir_Kind_Reduction_Nor_Operator => 1304, - Iir_Kind_Reduction_Xor_Operator => 1308, - Iir_Kind_Reduction_Xnor_Operator => 1312, - Iir_Kind_And_Operator => 1317, - Iir_Kind_Or_Operator => 1322, - Iir_Kind_Nand_Operator => 1327, - Iir_Kind_Nor_Operator => 1332, - Iir_Kind_Xor_Operator => 1337, - Iir_Kind_Xnor_Operator => 1342, - Iir_Kind_Equality_Operator => 1347, - Iir_Kind_Inequality_Operator => 1352, - Iir_Kind_Less_Than_Operator => 1357, - Iir_Kind_Less_Than_Or_Equal_Operator => 1362, - Iir_Kind_Greater_Than_Operator => 1367, - Iir_Kind_Greater_Than_Or_Equal_Operator => 1372, - Iir_Kind_Match_Equality_Operator => 1377, - Iir_Kind_Match_Inequality_Operator => 1382, - Iir_Kind_Match_Less_Than_Operator => 1387, - Iir_Kind_Match_Less_Than_Or_Equal_Operator => 1392, - Iir_Kind_Match_Greater_Than_Operator => 1397, - Iir_Kind_Match_Greater_Than_Or_Equal_Operator => 1402, - Iir_Kind_Sll_Operator => 1407, - Iir_Kind_Sla_Operator => 1412, - Iir_Kind_Srl_Operator => 1417, - Iir_Kind_Sra_Operator => 1422, - Iir_Kind_Rol_Operator => 1427, - Iir_Kind_Ror_Operator => 1432, - Iir_Kind_Addition_Operator => 1437, - Iir_Kind_Substraction_Operator => 1442, - Iir_Kind_Concatenation_Operator => 1447, - Iir_Kind_Multiplication_Operator => 1452, - Iir_Kind_Division_Operator => 1457, - Iir_Kind_Modulus_Operator => 1462, - Iir_Kind_Remainder_Operator => 1467, - Iir_Kind_Exponentiation_Operator => 1472, - Iir_Kind_Function_Call => 1480, - Iir_Kind_Aggregate => 1488, - Iir_Kind_Parenthesis_Expression => 1491, - Iir_Kind_Qualified_Expression => 1495, - Iir_Kind_Type_Conversion => 1500, - Iir_Kind_Allocator_By_Expression => 1505, - Iir_Kind_Allocator_By_Subtype => 1511, - Iir_Kind_Selected_Element => 1519, - Iir_Kind_Dereference => 1524, - Iir_Kind_Implicit_Dereference => 1529, - Iir_Kind_Slice_Name => 1536, - Iir_Kind_Indexed_Name => 1542, - Iir_Kind_Psl_Prev => 1548, - Iir_Kind_Psl_Stable => 1553, - Iir_Kind_Psl_Rose => 1558, - Iir_Kind_Psl_Fell => 1563, - Iir_Kind_Psl_Onehot => 1566, - Iir_Kind_Psl_Onehot0 => 1569, - Iir_Kind_Psl_Expression => 1571, - Iir_Kind_Sensitized_Process_Statement => 1593, - Iir_Kind_Process_Statement => 1614, - Iir_Kind_Concurrent_Simple_Signal_Assignment => 1627, - Iir_Kind_Concurrent_Conditional_Signal_Assignment => 1640, - Iir_Kind_Concurrent_Selected_Signal_Assignment => 1654, - Iir_Kind_Concurrent_Assertion_Statement => 1662, - Iir_Kind_Concurrent_Procedure_Call_Statement => 1669, - Iir_Kind_Concurrent_Break_Statement => 1677, - Iir_Kind_Psl_Assert_Directive => 1691, - Iir_Kind_Psl_Assume_Directive => 1703, - Iir_Kind_Psl_Cover_Directive => 1715, - Iir_Kind_Psl_Restrict_Directive => 1726, - Iir_Kind_Block_Statement => 1740, - Iir_Kind_If_Generate_Statement => 1751, - Iir_Kind_Case_Generate_Statement => 1760, - Iir_Kind_For_Generate_Statement => 1769, - Iir_Kind_Component_Instantiation_Statement => 1781, - Iir_Kind_Psl_Default_Clock => 1784, - Iir_Kind_Generate_Statement_Body => 1795, - Iir_Kind_If_Generate_Else_Clause => 1801, - Iir_Kind_Simple_Simultaneous_Statement => 1808, - Iir_Kind_Simultaneous_Null_Statement => 1812, - Iir_Kind_Simultaneous_Procedural_Statement => 1823, - Iir_Kind_Simultaneous_Case_Statement => 1832, - Iir_Kind_Simultaneous_If_Statement => 1841, - Iir_Kind_Simultaneous_Elsif => 1847, - Iir_Kind_Simple_Signal_Assignment_Statement => 1858, - Iir_Kind_Conditional_Signal_Assignment_Statement => 1869, - Iir_Kind_Selected_Waveform_Assignment_Statement => 1881, - Iir_Kind_Signal_Force_Assignment_Statement => 1891, - Iir_Kind_Signal_Release_Assignment_Statement => 1900, - Iir_Kind_Null_Statement => 1904, - Iir_Kind_Assertion_Statement => 1911, - Iir_Kind_Report_Statement => 1917, - Iir_Kind_Wait_Statement => 1925, - Iir_Kind_Variable_Assignment_Statement => 1932, - Iir_Kind_Conditional_Variable_Assignment_Statement => 1939, - Iir_Kind_Return_Statement => 1945, - Iir_Kind_For_Loop_Statement => 1956, - Iir_Kind_While_Loop_Statement => 1967, - Iir_Kind_Next_Statement => 1974, - Iir_Kind_Exit_Statement => 1981, - Iir_Kind_Case_Statement => 1990, - Iir_Kind_Procedure_Call_Statement => 1996, - Iir_Kind_Break_Statement => 2003, - Iir_Kind_If_Statement => 2013, - Iir_Kind_Suspend_State_Statement => 2018, - Iir_Kind_Elsif => 2024, - Iir_Kind_Character_Literal => 2031, - Iir_Kind_Simple_Name => 2038, - Iir_Kind_Selected_Name => 2046, - Iir_Kind_Operator_Symbol => 2051, - Iir_Kind_Reference_Name => 2056, - Iir_Kind_External_Constant_Name => 2065, - Iir_Kind_External_Signal_Name => 2075, - Iir_Kind_External_Variable_Name => 2085, - Iir_Kind_Selected_By_All_Name => 2091, - Iir_Kind_Parenthesis_Name => 2096, - Iir_Kind_Package_Pathname => 2100, - Iir_Kind_Absolute_Pathname => 2101, - Iir_Kind_Relative_Pathname => 2102, - Iir_Kind_Pathname_Element => 2107, - Iir_Kind_Base_Attribute => 2109, - Iir_Kind_Subtype_Attribute => 2114, - Iir_Kind_Element_Attribute => 2119, - Iir_Kind_Across_Attribute => 2124, - Iir_Kind_Through_Attribute => 2129, - Iir_Kind_Nature_Reference_Attribute => 2133, - Iir_Kind_Left_Type_Attribute => 2138, - Iir_Kind_Right_Type_Attribute => 2143, - Iir_Kind_High_Type_Attribute => 2148, - Iir_Kind_Low_Type_Attribute => 2153, - Iir_Kind_Ascending_Type_Attribute => 2158, - Iir_Kind_Image_Attribute => 2164, - Iir_Kind_Value_Attribute => 2170, - Iir_Kind_Pos_Attribute => 2176, - Iir_Kind_Val_Attribute => 2182, - Iir_Kind_Succ_Attribute => 2188, - Iir_Kind_Pred_Attribute => 2194, - Iir_Kind_Leftof_Attribute => 2200, - Iir_Kind_Rightof_Attribute => 2206, - Iir_Kind_Signal_Slew_Attribute => 2214, - Iir_Kind_Quantity_Slew_Attribute => 2222, - Iir_Kind_Ramp_Attribute => 2230, - Iir_Kind_Zoh_Attribute => 2238, - Iir_Kind_Ltf_Attribute => 2246, - Iir_Kind_Ztf_Attribute => 2256, - Iir_Kind_Dot_Attribute => 2263, - Iir_Kind_Integ_Attribute => 2270, - Iir_Kind_Quantity_Delayed_Attribute => 2278, - Iir_Kind_Above_Attribute => 2286, - Iir_Kind_Delayed_Attribute => 2295, - Iir_Kind_Stable_Attribute => 2304, - Iir_Kind_Quiet_Attribute => 2313, - Iir_Kind_Transaction_Attribute => 2322, - Iir_Kind_Event_Attribute => 2326, - Iir_Kind_Active_Attribute => 2330, - Iir_Kind_Last_Event_Attribute => 2334, - Iir_Kind_Last_Active_Attribute => 2338, - Iir_Kind_Last_Value_Attribute => 2342, - Iir_Kind_Driving_Attribute => 2346, - Iir_Kind_Driving_Value_Attribute => 2350, - Iir_Kind_Behavior_Attribute => 2350, - Iir_Kind_Structure_Attribute => 2350, - Iir_Kind_Simple_Name_Attribute => 2357, - Iir_Kind_Instance_Name_Attribute => 2362, - Iir_Kind_Path_Name_Attribute => 2367, - Iir_Kind_Left_Array_Attribute => 2374, - Iir_Kind_Right_Array_Attribute => 2381, - Iir_Kind_High_Array_Attribute => 2388, - Iir_Kind_Low_Array_Attribute => 2395, - Iir_Kind_Length_Array_Attribute => 2402, - Iir_Kind_Ascending_Array_Attribute => 2409, - Iir_Kind_Range_Array_Attribute => 2416, - Iir_Kind_Reverse_Range_Array_Attribute => 2423, - Iir_Kind_Attribute_Name => 2432 -======= - Iir_Kind_Package_Declaration => 608, Iir_Kind_Package_Instantiation_Declaration => 622, Iir_Kind_Vmode_Declaration => 634, Iir_Kind_Vprop_Declaration => 646, @@ -5962,7 +5730,6 @@ package body Vhdl.Nodes_Meta is Iir_Kind_Range_Array_Attribute => 2425, Iir_Kind_Reverse_Range_Array_Attribute => 2432, Iir_Kind_Attribute_Name => 2441 ->>>>>>> a5a8fda... vhdl: add iir_kind_package_instantiation_body ); function Get_Fields_First (K : Iir_Kind) return Fields_Index is @@ -6021,6 +5788,8 @@ package body Vhdl.Nodes_Meta is return Get_Element_Type_Flag (N); when Field_Need_Body => return Get_Need_Body (N); + when Field_Immediate_Body_Flag => + return Get_Immediate_Body_Flag (N); when Field_Macro_Expanded_Flag => return Get_Macro_Expanded_Flag (N); when Field_Need_Instance_Bodies => @@ -6185,6 +5954,8 @@ package body Vhdl.Nodes_Meta is Set_Element_Type_Flag (N, V); when Field_Need_Body => Set_Need_Body (N, V); + when Field_Immediate_Body_Flag => + Set_Immediate_Body_Flag (N, V); when Field_Macro_Expanded_Flag => Set_Macro_Expanded_Flag (N, V); when Field_Need_Instance_Bodies => @@ -8845,6 +8616,11 @@ package body Vhdl.Nodes_Meta is return K = Iir_Kind_Package_Declaration; end Has_Need_Body; + function Has_Immediate_Body_Flag (K : Iir_Kind) return Boolean is + begin + return K = Iir_Kind_Package_Instantiation_Declaration; + end Has_Immediate_Body_Flag; + function Has_Macro_Expanded_Flag (K : Iir_Kind) return Boolean is begin return K = Iir_Kind_Package_Declaration; diff --git a/src/vhdl/vhdl-nodes_meta.ads b/src/vhdl/vhdl-nodes_meta.ads index 0f0fe9cb9..e75fdf1c2 100644 --- a/src/vhdl/vhdl-nodes_meta.ads +++ b/src/vhdl/vhdl-nodes_meta.ads @@ -142,6 +142,7 @@ package Vhdl.Nodes_Meta is Field_Package_Body, Field_Instance_Package_Body, Field_Need_Body, + Field_Immediate_Body_Flag, Field_Macro_Expanded_Flag, Field_Need_Instance_Bodies, Field_Hierarchical_Name, @@ -741,6 +742,7 @@ package Vhdl.Nodes_Meta is function Has_Package_Body (K : Iir_Kind) return Boolean; function Has_Instance_Package_Body (K : Iir_Kind) return Boolean; function Has_Need_Body (K : Iir_Kind) return Boolean; + function Has_Immediate_Body_Flag (K : Iir_Kind) return Boolean; function Has_Macro_Expanded_Flag (K : Iir_Kind) return Boolean; function Has_Need_Instance_Bodies (K : Iir_Kind) return Boolean; function Has_Hierarchical_Name (K : Iir_Kind) return Boolean; -- cgit v1.2.3