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 Fields page.

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] }

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

Accessor

Field

Type

Access

Description

Parent

Field0

Iir

ref

The parent of an enumeration_literal is the same parent as the type declaration.

Type

Field1

Iir

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.

Identifier

Field3

Name_Id

owned

Get/Set the identifier of a declaration. Can also be used instead of get/set_label.

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.

Enum_Pos

Field5

Iir_Int32

owned

The value of an enumeration literal is the position.

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).

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.

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.

Use_Flag

Flag6

Boolean

owned

For a declaration: true if the declaration is used somewhere.

Expr_Staticness

State1

Iir_Staticness

owned

Expression staticness, defined by rules of LRM 7.4

Name_Staticness

State2

Iir_Staticness

owned

Staticness of a name, according to rules of LRM 6.1

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> Parent|<Type> Type|<Literal_Origin> Literal_Origin|<Identifier> Identifier|<Subprogram_Hash> Subprogram_Hash|<Enum_Pos> Enum_Pos|<Seen_Flag> Seen_Flag|<Visible_Flag> Visible_Flag|<Is_Within_Flag> Is_Within_Flag|<Use_Flag> Use_Flag|<Expr_Staticness> Expr_Staticness|<Name_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"] }

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

Accessor

Field

Type

Access

Description

Parent

Field0

Iir

ref

The declaration containing this subprogram declaration.

Return_Type

Field1

Iir

ref

Chain

Field2

Iir

chain next

Identifier

Field3

Name_Id

owned

For string, the identifier is the corresponding reserved word.

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.

Generic_Chain

Field6

Iir

chain

Interface_Declaration_Chain

Field5

Iir

chain

–Get/Set_Generic_Map_Aspect_Chain (Field8)

Implicit_Definition

Field7

Iir_Predefined_Functions

owned

Code of an implicit subprogram definition.

Return_Type_Mark

Field8

Iir

owned

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.

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.

Return_Identifier

Field11

Iir

owned

Return a subtype declaration for the return subtype (vhdl-19)

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.

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).

Macro_Expand_Flag

Flag2

Boolean

owned

Foreign_Flag

Flag3

Boolean

owned

Get/Set the foreign flag of a declaration. TRUE if the declaration was decorated with the std.foreign attribute.

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.

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.

Use_Flag

Flag6

Boolean

owned

For a declaration: true if the declaration is used somewhere.

Elaborated_Flag

Flag7

Boolean

owned

Immediately set on predefined operators, set at then end of the package, also set when the body is analyzed.

Resolution_Function_Flag

Flag13

Boolean

owned

True if the function is used as a resolution function.

Has_Pure

Flag8

Boolean

owned

Layout flag: true if ‘pure’ or ‘impure’ is present.

Has_Body

Flag9

Boolean

owned

True is the specification is immediately followed by a body.

Has_Parameter

Flag10

Boolean

owned

Layout flag: true if ‘parameter’ reserved identifier is present.

Hide_Implicit_Flag

Flag12

Boolean

owned

For an explicit subprogram: true if the declaration is an homograph of an implicit operation of a type.

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.

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.

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.

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> Parent|<Return_Type> Return_Type|<Chain> Chain|<Identifier> Identifier|<Subprogram_Hash> Subprogram_Hash|<Generic_Chain> Generic_Chain|<Interface_Declaration_Chain> Interface_Declaration_Chain|<Implicit_Definition> Implicit_Definition|<Return_Type_Mark> Return_Type_Mark|<Subprogram_Body> Subprogram_Body|<Subprogram_Depth> Subprogram_Depth|<Return_Identifier> Return_Identifier|<Overload_Number> Overload_Number|<Seen_Flag> Seen_Flag|<Macro_Expand_Flag> Macro_Expand_Flag|<Foreign_Flag> Foreign_Flag|<Visible_Flag> Visible_Flag|<Is_Within_Flag> Is_Within_Flag|<Use_Flag> Use_Flag|<Elaborated_Flag> Elaborated_Flag|<Resolution_Function_Flag> Resolution_Function_Flag|<Has_Pure> Has_Pure|<Has_Body> Has_Body|<Has_Parameter> Has_Parameter|<Hide_Implicit_Flag> Hide_Implicit_Flag|<Pure_Flag> Pure_Flag|<Wait_State> Wait_State|<All_Sensitized_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"] }