Table of Contents

Class ControlFlowGraph<TInstruction>

Namespace
Echo.ControlFlow
Assembly
Echo.ControlFlow.dll

Provides a generic base implementation of a control flow graph that contains for each node a user predefined object in a type safe manner.

public class ControlFlowGraph<TInstruction> : IGraph, IScopeControlFlowRegion<TInstruction>, IControlFlowRegion<TInstruction>, ISubGraph where TInstruction : notnull

Type Parameters

TInstruction

The type of instructions that each node in the graph stores.

Inheritance
ControlFlowGraph<TInstruction>
Implements
IControlFlowRegion<TInstruction>
Inherited Members
Extension Methods

Constructors

ControlFlowGraph(IArchitecture<TInstruction>)

Creates a new empty graph.

public ControlFlowGraph(IArchitecture<TInstruction> architecture)

Parameters

architecture IArchitecture<TInstruction>

The architecture description of the instructions stored in the control flow graph.

Properties

Architecture

Gets the architecture of the instructions that are stored in the control flow graph.

public IArchitecture<TInstruction> Architecture { get; }

Property Value

IArchitecture<TInstruction>

EntryPoint

Gets or sets the node that is executed first in the control flow graph.

public ControlFlowNode<TInstruction>? EntryPoint { get; set; }

Property Value

ControlFlowNode<TInstruction>

Nodes

Gets a collection of all basic blocks present in the graph.

public NodeCollection<TInstruction> Nodes { get; }

Property Value

NodeCollection<TInstruction>

Regions

Gets a collection of top-level regions that this control flow graph defines.

public RegionCollection<TInstruction, ControlFlowRegion<TInstruction>> Regions { get; }

Property Value

RegionCollection<TInstruction, ControlFlowRegion<TInstruction>>

Methods

GetEdges()

Gets a collection of all edges that transfer control from one block to the other in the graph.

public IEnumerable<ControlFlowEdge<TInstruction>> GetEdges()

Returns

IEnumerable<ControlFlowEdge<TInstruction>>

The edges.

ToDotGraph(TextWriter)

Serializes the control flow graph to the provided output stream, in graphviz dot format.

public void ToDotGraph(TextWriter writer)

Parameters

writer TextWriter

The output stream.

Remarks

To customize the layout of the final graph, use the DotWriter class.

ToDotGraph(TextWriter, IInstructionFormatter<TInstruction>)

Serializes the control flow graph to the provided output stream, in graphviz dot format.

public void ToDotGraph(TextWriter writer, IInstructionFormatter<TInstruction> formatter)

Parameters

writer TextWriter

The output stream.

formatter IInstructionFormatter<TInstruction>

The instruction formatter.

Remarks

To customize the layout of the final graph, use the DotWriter class.