.. # This page is generated by doc/ASTReference.py when Sphinx starts. Do not edit it. Functions And Literals ###################### 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:Enumeration_Literal: Iir_Kind_Enumeration_Literal ============================ Nota: two literals of the same type are equal iff their value is the same; in other words, there may be several literals with the same value. Format: ``Short`` .. list-table:: :header-rows: 1 :widths: 30 12 18 12 28 * - Accessor - Field - Type - Access - Description * - :ref:`Parent ` - ``Field0`` - ``Iir`` - ref - The parent of an enumeration_literal is the same parent as the type declaration. * - :ref:`Type ` - ``Field1`` - ``Iir`` - ref - — * - :ref:`Literal_Origin ` - ``Field2`` - ``Iir`` - owned - The origin of a literal can be null_iir for a literal generated by the parser, or a node which was statically evaluated to this literal. Such nodes are created by eval_expr. * - :ref:`Identifier ` - ``Field3`` - ``Name_Id`` - owned - Get/Set the identifier of a declaration. Can also be used instead of get/set_label. * - :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:`Enum_Pos ` - ``Field5`` - ``Iir_Int32`` - owned - The value of an enumeration literal is the position. * - :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:`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 - Never set to true, but possible when used as a prefix of an expanded name in a overloaded subprogram. * - :ref:`Use_Flag ` - ``Flag6`` - ``Boolean`` - owned - For a declaration: true if the declaration is used somewhere. * - :ref:`Expr_Staticness ` - ``State1`` - ``Iir_Staticness`` - owned - Expression staticness, defined by rules of LRM 7.4 * - :ref:`Name_Staticness ` - ``State2`` - ``Iir_Staticness`` - owned - Staticness of a name, according to rules of LRM 6.1 .. graphviz:: digraph { rankdir="LR" node [shape=record fontname="monospace" fontsize=10] edge [fontname="monospace" fontsize=9] "Enumeration_Literal" [style=filled fillcolor="#eeeeec" label="{Enumeration_Literal|{ Parent| Type| Literal_Origin| Identifier| Subprogram_Hash| Enum_Pos| Seen_Flag| Visible_Flag| Is_Within_Flag| Use_Flag| Expr_Staticness| Name_Staticness}}"] "Enumeration_Literal__Parent" [shape=box label="Iir"] "Enumeration_Literal":Parent -> "Enumeration_Literal__Parent" [color="#3465a4" style=dashed] "Enumeration_Literal__Type" [shape=box label="Iir"] "Enumeration_Literal":Type -> "Enumeration_Literal__Type" [color="#3465a4" style=dashed] "Enumeration_Literal__Literal_Origin" [shape=box label="Iir"] "Enumeration_Literal":Literal_Origin -> "Enumeration_Literal__Literal_Origin" [color="#000000"] } .. _INT:AST:Function_Declaration: Iir_Kind_Function_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:`Return_Type ` - ``Field1`` - ``Iir`` - ref - — * - :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:`Return_Type_Mark ` - ``Field8`` - ``Iir`` - owned - — * - :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:`Return_Identifier ` - ``Field11`` - ``Iir`` - owned - Return a subtype declaration for the return subtype (vhdl-19) * - :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:`Resolution_Function_Flag ` - ``Flag13`` - ``Boolean`` - owned - True if the function is used as a resolution function. * - :ref:`Has_Pure ` - ``Flag8`` - ``Boolean`` - owned - Layout flag: true if 'pure' or 'impure' is present. * - :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:`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:`Pure_Flag ` - ``Flag14`` - ``Boolean`` - owned - Get/Set the pure flag of a function. TRUE if the function is declared pure. FALSE if the function is declared impure. * - :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:`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] "Function_Declaration" [style=filled fillcolor="#eeeeec" label="{Function_Declaration|{ Parent| Return_Type| Chain| Identifier| Subprogram_Hash| Generic_Chain| Interface_Declaration_Chain| Implicit_Definition| Return_Type_Mark| Subprogram_Body| Subprogram_Depth| Return_Identifier| Overload_Number| Seen_Flag| Macro_Expand_Flag| Foreign_Flag| Visible_Flag| Is_Within_Flag| Use_Flag| Elaborated_Flag| Resolution_Function_Flag| Has_Pure| Has_Body| Has_Parameter| Hide_Implicit_Flag| Pure_Flag| Wait_State| All_Sensitized_State}}"] "Function_Declaration__Parent" [shape=box label="Iir"] "Function_Declaration":Parent -> "Function_Declaration__Parent" [color="#3465a4" style=dashed] "Function_Declaration__Return_Type" [shape=box label="Iir"] "Function_Declaration":Return_Type -> "Function_Declaration__Return_Type" [color="#3465a4" style=dashed] "Function_Declaration__Chain" [shape=box label="Iir"] "Function_Declaration":Chain -> "Function_Declaration__Chain" [color="#4e9a06" style=bold] "Function_Declaration__Generic_Chain" [shape=box label="Iir"] "Function_Declaration":Generic_Chain -> "Function_Declaration__Generic_Chain" [color="#4e9a06"] "Function_Declaration__Interface_Declaration_Chain" [shape=box label="Iir"] "Function_Declaration":Interface_Declaration_Chain -> "Function_Declaration__Interface_Declaration_Chain" [color="#4e9a06"] "Function_Declaration__Return_Type_Mark" [shape=box label="Iir"] "Function_Declaration":Return_Type_Mark -> "Function_Declaration__Return_Type_Mark" [color="#000000"] "Function_Declaration__Subprogram_Body" [shape=box label="Iir"] "Function_Declaration":Subprogram_Body -> "Function_Declaration__Subprogram_Body" [color="#f57900" style=dashed] "Function_Declaration__Return_Identifier" [shape=box label="Iir"] "Function_Declaration":Return_Identifier -> "Function_Declaration__Return_Identifier" [color="#000000"] }