A read-only view of the ControlFlowGraph.

interface ReadOnlyControlFlowGraph {
    edges: () => ReadonlyMap<NodeId, ReadonlyMap<NodeId, CfgEdge>>;
    getBasicBlock: (elemId: NodeId) => undefined | CfgBasicBlockVertex;
    getVertex: (
        id: NodeId,
        includeBlocks?: boolean,
    ) => undefined | CfgSimpleVertex;
    hasVertex: (id: NodeId, includeBlocks?: boolean) => boolean;
    ingoingEdges: (id: NodeId) => undefined | ReadonlyMap<NodeId, CfgEdge>;
    mayHaveBasicBlocks: () => boolean;
    outgoingEdges: (id: NodeId) => undefined | ReadonlyMap<NodeId, CfgEdge>;
    rootIds: () => ReadonlySet<NodeId>;
    vertices: (
        includeBasicBlockElements: boolean,
    ) => ReadonlyMap<NodeId, CfgSimpleVertex>;
}

Implemented by

Properties

edges: () => ReadonlyMap<NodeId, ReadonlyMap<NodeId, CfgEdge>>

Get all edges in the graph, independent of their sources and targets. If you are only interested in the edges of a specific node, please use outgoingEdges() or ingoingEdges().

This is the pendant of DataflowGraph#edges|edges() on a DataflowGraph.

getBasicBlock: (elemId: NodeId) => undefined | CfgBasicBlockVertex

Obtain the basic block associated with the given element id (i.e. if this is an element within a basic block, return the blockit belongs to).

getVertex: (id: NodeId, includeBlocks?: boolean) => undefined | CfgSimpleVertex

Retrieve a vertex by its id.

Type declaration

    • (id: NodeId, includeBlocks?: boolean): undefined | CfgSimpleVertex
    • Parameters

      • id: NodeId

        the id of the vertex to retrieve

      • OptionalincludeBlocks: boolean

        if true, the elements of basic block elements are included in the result, otherwise this will only the basic blocks themselves

        This is the pendant of DataflowGraph#getVertex|getVertex() on a DataflowGraph.

      Returns undefined | CfgSimpleVertex

hasVertex: (id: NodeId, includeBlocks?: boolean) => boolean

Check if a vertex with the given id exists in the graph.

Type declaration

    • (id: NodeId, includeBlocks?: boolean): boolean
    • Parameters

      • id: NodeId

        the id of the vertex to check

      • OptionalincludeBlocks: boolean

        if true, the elements of basic block elements are included in the check, otherwise this will only check the basic blocks themselves

        This is the pendant of DataflowGraph#hasVertex|hasVertex() on a DataflowGraph.

      Returns boolean

ingoingEdges: (id: NodeId) => undefined | ReadonlyMap<NodeId, CfgEdge>

Receive all ingoing edges of a given vertex.

This is the pendant of DataflowGraph#outgoingEdges|outgoingEdges() on a DataflowGraph.

outgoingEdges() - for a way to get all outgoing edges of a vertex.

mayHaveBasicBlocks: () => boolean

Returns true if the graph may contain basic blocks and false if we know that it does not. This can be used for optimizations.

outgoingEdges: (id: NodeId) => undefined | ReadonlyMap<NodeId, CfgEdge>

Receive all outgoing edges of a given vertex.

This is the pendant of DataflowGraph#ingoingEdges|ingoingEdges() on a DataflowGraph.

ingoingEdges() - for a way to get all ingoing edges of a vertex.

rootIds: () => ReadonlySet<NodeId>

Get all ids of the root vertices — vertices that are not part of any function definition or basic block and hence part of the "top-level" control flow.

This is the pendant of DataflowGraph#rootIds|rootIds() on a DataflowGraph.

  • vertices() - for a way to get all vertices in the graph.
  • getVertex() - for a way to get a specific vertex by its id.
  • edges() - for a way to get all edges in the graph.
vertices: (
    includeBasicBlockElements: boolean,
) => ReadonlyMap<NodeId, CfgSimpleVertex>

Provide a view of all vertices in the graph.

Type declaration

    • (includeBasicBlockElements: boolean): ReadonlyMap<NodeId, CfgSimpleVertex>
    • Parameters

      • includeBasicBlockElements: boolean

        if true, the elements of basic block elements are included in the result, otherwise this will only the basic blocks themselves

      Returns ReadonlyMap<NodeId, CfgSimpleVertex>

  • ReadOnlyControlFlowGraph#rootVertexIds|rootVertexIds() - for a way to get the root vertices of the graph.
  • getVertex() - for a way to get a specific vertex by its id.
  • edges() - for a way to get all edges in the graph.