Show / Hide Table of Contents

Class CilGraphNode

Represents a node in the CIL graph. A node describes an instruction and its connection with other instructions

Inheritance
System.Object
CilGraphNode
CilGraphNodeMutable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: CilTools.BytecodeAnalysis
Assembly: CilTools.BytecodeAnalysis.dll
Syntax
public class CilGraphNode
Remarks

See CilGraph class documentation for more information about CIL graphs.

Constructors

CilGraphNode()

Creates new CilGraphNode object

Declaration
protected CilGraphNode()

Properties

BranchTarget

Gets a reference to the node that represents instruction which is a target of the current instruction, if applicable

Declaration
public CilGraphNode BranchTarget { get; }
Property Value
Type Description
CilGraphNode
Remarks

Branch target is an instruction which would be called after current one if the condition for jump instruction is met. For non-jump instructions, the value is null.

Instruction

Gets CIL instruction associated with this node

Declaration
public CilInstruction Instruction { get; }
Property Value
Type Description
CilInstruction

Name

Gets label name associated with this node

Declaration
public string Name { get; }
Property Value
Type Description
System.String
Remarks

Label names are assigned to instruction that serve as branch targets for convenience. If the instruction is not used as target, the value is empty string.

Next

Gets a reference to the node that represents instruction directly following current instruction in the method bytecode

Declaration
public CilGraphNode Next { get; }
Property Value
Type Description
CilGraphNode
Remarks

Next instruction will be normally executed after current one, unless it is a jump instruction and the condition for jump is met. For the last instruction of the method body, the value is null.

Previous

Gets a reference to the node that represents instruction directly preceding current instruction in the method bytecode

Declaration
public CilGraphNode Previous { get; }
Property Value
Type Description
CilGraphNode
Remarks

For the first instruction in the method body, the value is null.

Methods

GetExceptionBlocks()

Gets an array of exception handling blocks in which this node is enclosed

Declaration
public ExceptionBlock[] GetExceptionBlocks()
Returns
Type Description
ExceptionBlock[]

An array of exception blocks, or an empty array if there are none

GetSwitchTargets()

Gets an array of nodes that represents the jump table of the switch instruction, if applicable

Declaration
public CilGraphNode[] GetSwitchTargets()
Returns
Type Description
CilGraphNode[]
Remarks

Jump table is the sequence of instructions corresponding to the switch instruction. When runtime processes switch instruction, it will transfer control to one of the instructions based on the value pushed to the stack. For non-switch instructions, returns an empty array.

ToString()

Returns text representation of this node as a line of CIL code

Declaration
public override string ToString()
Returns
Type Description
System.String

String that contatins a text representation of this node

Overrides
System.Object.ToString()
Back to top CIL Tools (published from sources in GitHub repository).
Generated by DocFX