Class ControlFlowRegion<TInstruction>
- Namespace
- Echo.ControlFlow.Regions
- Assembly
- Echo.ControlFlow.dll
Provides a base implementation for a region in a control flow graph.
public abstract class ControlFlowRegion<TInstruction> : IControlFlowRegion<TInstruction>, ISubGraph where TInstruction : notnull
Type Parameters
TInstructionThe type of data that each node in the graph stores.
- Inheritance
-
ControlFlowRegion<TInstruction>
- Implements
-
IControlFlowRegion<TInstruction>
- Derived
- Inherited Members
- Extension Methods
Properties
ParentGraph
Gets the parent graph this region is part of.
public ControlFlowGraph<TInstruction>? ParentGraph { get; }
Property Value
- ControlFlowGraph<TInstruction>
ParentRegion
Gets the parent region that this region is part of.
public IControlFlowRegion<TInstruction>? ParentRegion { get; }
Property Value
- IControlFlowRegion<TInstruction>
Remarks
When this property is set to null this region is the root.
Tag
Gets or sets a user-defined tag that is assigned to this region.
public object? Tag { get; set; }
Property Value
Methods
GetEntryPoint()
Obtains the first node that is executed in the region (if available).
public abstract ControlFlowNode<TInstruction>? GetEntryPoint()
Returns
- ControlFlowNode<TInstruction>
The node, or
nullif no entrypoint was specified.
GetNodeByOffset(long)
Searches for a node in the control flow graph with the provided offset or identifier.
public virtual ControlFlowNode<TInstruction>? GetNodeByOffset(long offset)
Parameters
offsetlongThe offset of the node to find.
Returns
- ControlFlowNode<TInstruction>
The node, or
nullif no node was found with the provided offset.
GetNodes()
Gets a collection of all nodes in the control flow graph region. This includes all nodes in the nested regions.
public abstract IEnumerable<ControlFlowNode<TInstruction>> GetNodes()
Returns
- IEnumerable<ControlFlowNode<TInstruction>>
The nodes.
GetSubRegions()
Gets a collection of all nested regions defined in this region.
public abstract IEnumerable<ControlFlowRegion<TInstruction>> GetSubRegions()
Returns
- IEnumerable<ControlFlowRegion<TInstruction>>
The subregions.
GetSuccessors()
Gets the nodes that are immediate successors of any node in this region.
public virtual IEnumerable<ControlFlowNode<TInstruction>> GetSuccessors()
Returns
- IEnumerable<ControlFlowNode<TInstruction>>
The nodes.
RemoveNode(ControlFlowNode<TInstruction>)
Removes the node from the region.
public abstract bool RemoveNode(ControlFlowNode<TInstruction> node)
Parameters
nodeControlFlowNode<TInstruction>The node to remove.
Returns
- bool
trueif the node was found and removed,falseotherwise.