.. # This page is generated by doc/ASTReference.py when Sphinx starts. Do not edit it. Subprogram Declaration ###################### The diagrams below draw one box per node kind, with one port per field. The edge colours say how a link is held; they are listed in full on the :ref:`INT:AST:Fields` page. .. graphviz:: digraph { rankdir="LR" nodesep=0.1 node [shape=point width=0.06 color="#888a85"] edge [fontname="monospace" fontsize=10 minlen=3] l0a -> l0b [label="owned" color="#000000"] l1a -> l1b [label="ref" color="#3465a4" style=dashed] l2a -> l2b [label="maybe ref" color="#3465a4" style=dotted] l3a -> l3b [label="of ref" color="#3465a4" style=dashed] l4a -> l4b [label="of maybe ref" color="#3465a4" style=dotted] l5a -> l5b [label="forward ref" color="#f57900" style=dashed] l6a -> l6b [label="maybe forward ref" color="#f57900" style=dotted] l7a -> l7b [label="chain" color="#4e9a06"] l8a -> l8b [label="chain next" color="#4e9a06" style=bold] } .. _INT:AST:Procedure_Declaration: Iir_Kind_Procedure_Declaration ============================== LRM08 4.2 Subprogram declarations :: subprogram_declaration ::= subprogram_specification ; :: subprogram_specification ::= procedure_specification | function_specification :: procedure_specification ::= PROCEDURE designator subprogram_header [ [ PARAMETER ] ( formal_parameter_list ) ] :: function_specification ::= [ PURE | IMPURE ] FUNCTION designator subprogram_header [ [ PARAMETER ] ( formal_parameter_list ) ] RETURN type_mark :: designator ::= identifier | operator_symbol :: operator_symbol ::= string_literal Note: the subprogram specification of a body is kept, but should be ignored if there is a subprogram declaration. The function Is_Second_Subprogram_Specification returns True on such specification. Format: ``Medium`` .. list-table:: :header-rows: 1 :widths: 30 12 18 12 28 * - Accessor - Field - Type - Access - Description * - :ref:`Parent ` - ``Field0`` - ``Iir`` - ref - The declaration containing this subprogram declaration. * - :ref:`Chain ` - ``Field2`` - ``Iir`` - chain next - — * - :ref:`Identifier ` - ``Field3`` - ``Name_Id`` - owned - For string, the identifier is the corresponding reserved word. * - :ref:`Subprogram_Hash ` - ``Field4`` - ``Iir_Int32`` - owned - Hash of a subprogram profile. This is used to speed up subprogram profile comparison, which is very often used by overload. * - :ref:`Generic_Chain ` - ``Field6`` - ``Iir`` - chain - — * - :ref:`Interface_Declaration_Chain ` - ``Field5`` - ``Iir`` - chain - --Get/Set_Generic_Map_Aspect_Chain (Field8) * - :ref:`Implicit_Definition ` - ``Field7`` - ``Iir_Predefined_Functions`` - owned - Code of an implicit subprogram definition. * - :ref:`Subprogram_Body ` - ``Field9`` - ``Iir`` - forward ref - The body of a subprogram (from the subprogram specification). Note that this field is only set when the body has been analyzed (ok, that's obvious). For subprogram specifications in instantiated package, this field is in general not set because the package specification may be instantiated before the package body is analyzed and there is no tracking of all instantiated packages. So when the package body is analyzed, there is no way to set this field for the subprograms in all instantiated specifications. You could use Get_Subprogram_Body_Origin to extract the body. It uses the Origin link to find the original specification which has this field set. * - :ref:`Subprogram_Depth ` - ``Field10`` - ``Iir_Int32`` - owned - Depth of a subprogram. For a subprogram declared immediately within an entity, architecture, package, process, block, generate, the depth is 0. For a subprogram declared immediately within a subprogram of level N, the depth is N + 1. Depth is used with depth of impure objects to check purity rules. * - :ref:`Overload_Number ` - ``Field12`` - ``Iir_Int32`` - owned - Several subprograms in a declarative region may have the same identifier. If the overload number is not 0, it is the rank of the subprogram. If the overload number is 0, then the identifier is not overloaded in the declarative region. * - :ref:`Seen_Flag ` - ``Flag1`` - ``Boolean`` - owned - Get/Set the seen flag. Used when the graph of callees is walked, to avoid infinite loops, since the graph is not a DAG (there may be cycles). * - :ref:`Macro_Expand_Flag ` - ``Flag2`` - ``Boolean`` - owned - — * - :ref:`Foreign_Flag ` - ``Flag3`` - ``Boolean`` - owned - Get/Set the foreign flag of a declaration. TRUE if the declaration was decorated with the std.foreign attribute. * - :ref:`Visible_Flag ` - ``Flag4`` - ``Boolean`` - owned - Get/Set the visible flag of a declaration. The visible flag is true to make invalid the use of the identifier during its declaration. It is set to false when the identifier is added to the name table, and set to true when the declaration is finished. * - :ref:`Is_Within_Flag ` - ``Flag5`` - ``Boolean`` - owned - This flag is set is code being analyzed is textually within TARGET. This is used for selected by name rule. * - :ref:`Use_Flag ` - ``Flag6`` - ``Boolean`` - owned - For a declaration: true if the declaration is used somewhere. * - :ref:`Elaborated_Flag ` - ``Flag7`` - ``Boolean`` - owned - Immediately set on predefined operators, set at then end of the package, also set when the body is analyzed. * - :ref:`Has_Body ` - ``Flag9`` - ``Boolean`` - owned - True is the specification is immediately followed by a body. * - :ref:`Has_Parameter ` - ``Flag10`` - ``Boolean`` - owned - Layout flag: true if 'parameter' reserved identifier is present. * - :ref:`Suspend_Flag ` - ``Flag11`` - ``Boolean`` - owned - Set on wait, procedure call and composite statements when there is a sub-statement that can suspend a procedure or a process. Also set on procedure declaration. Note that the flag is conservative: it must be true if the node contains directly or indirectly a wait statement, but need not to be false otherwise. * - :ref:`Hide_Implicit_Flag ` - ``Flag12`` - ``Boolean`` - owned - For an explicit subprogram: true if the declaration is an homograph of an implicit operation of a type. * - :ref:`Passive_Flag ` - ``Flag14`` - ``Boolean`` - owned - Get/Set the passive flag of a process. TRUE if the process must be passive. FALSE if the process may be not passive. For a procedure declaration, set if it is passive. * - :ref:`Wait_State ` - ``State1`` - ``Tri_State_Type`` - owned - Get/Set the wait state of the current subprogram or process. TRUE if it contains a wait statement, either directly or indirectly. FALSE if it doesn't contain a wait statement. UNKNOWN if the wait status is not yet known. * - :ref:`Purity_State ` - ``State2`` - ``Iir_Pure_State`` - owned - Get/Set the purity status of a subprogram. * - :ref:`All_Sensitized_State ` - ``State3`` - ``Iir_All_Sensitized`` - owned - Get/Set whether the subprogram may be called by a sensitized process whose sensitivity list is ALL. FALSE if declared in a package unit and reads a signal that is not one of its interface, or if it calls such a subprogram. TRUE if it doesn't call a subprogram whose state is False and either doesn't read a signal or declared within an entity or architecture. UNKNOWN if the status is not yet known. .. graphviz:: digraph { rankdir="LR" node [shape=record fontname="monospace" fontsize=10] edge [fontname="monospace" fontsize=9] "Procedure_Declaration" [style=filled fillcolor="#eeeeec" label="{Procedure_Declaration|{ Parent| Chain| Identifier| Subprogram_Hash| Generic_Chain| Interface_Declaration_Chain| Implicit_Definition| Subprogram_Body| Subprogram_Depth| Overload_Number| Seen_Flag| Macro_Expand_Flag| Foreign_Flag| Visible_Flag| Is_Within_Flag| Use_Flag| Elaborated_Flag| Has_Body| Has_Parameter| Suspend_Flag| Hide_Implicit_Flag| Passive_Flag| Wait_State| Purity_State| All_Sensitized_State}}"] "Procedure_Declaration__Parent" [shape=box label="Iir"] "Procedure_Declaration":Parent -> "Procedure_Declaration__Parent" [color="#3465a4" style=dashed] "Procedure_Declaration__Chain" [shape=box label="Iir"] "Procedure_Declaration":Chain -> "Procedure_Declaration__Chain" [color="#4e9a06" style=bold] "Procedure_Declaration__Generic_Chain" [shape=box label="Iir"] "Procedure_Declaration":Generic_Chain -> "Procedure_Declaration__Generic_Chain" [color="#4e9a06"] "Procedure_Declaration__Interface_Declaration_Chain" [shape=box label="Iir"] "Procedure_Declaration":Interface_Declaration_Chain -> "Procedure_Declaration__Interface_Declaration_Chain" [color="#4e9a06"] "Procedure_Declaration__Subprogram_Body" [shape=box label="Iir"] "Procedure_Declaration":Subprogram_Body -> "Procedure_Declaration__Subprogram_Body" [color="#f57900" style=dashed] }