Table of Contents

Class ILInlining

Namespace
ICSharpCode.Decompiler.IL.Transforms
Assembly
ICSharpCode.Decompiler.dll

Performs inlining transformations.

public class ILInlining : IILTransform, IBlockTransform, IStatementTransform
Inheritance
ILInlining
Implements
Inherited Members

Constructors

ILInlining()

public ILInlining()

Methods

CanInlineInto(ILInstruction, ILVariable, ILInstruction)

Gets whether 'expressionBeingMoved' can be inlined into 'expr'.

public static bool CanInlineInto(ILInstruction expr, ILVariable v, ILInstruction expressionBeingMoved)

Parameters

expr ILInstruction
v ILVariable
expressionBeingMoved ILInstruction

Returns

bool

CanMoveInto(ILInstruction, ILInstruction, ILInstruction)

Gets whether 'expressionBeingMoved' can be moved from somewhere before 'stmt' to become the replacement of 'targetLoad'.

public static bool CanMoveInto(ILInstruction expressionBeingMoved, ILInstruction stmt, ILInstruction targetLoad)

Parameters

expressionBeingMoved ILInstruction
stmt ILInstruction
targetLoad ILInstruction

Returns

bool

InlineAllInBlock(ILFunction, Block, InliningOptions, ILTransformContext)

public static bool InlineAllInBlock(ILFunction function, Block block, InliningOptions options, ILTransformContext context)

Parameters

function ILFunction
block Block
options InliningOptions
context ILTransformContext

Returns

bool

InlineIfPossible(Block, int, ILTransformContext)

Aggressively inlines the stloc instruction at block.Body[pos] into the next instruction, if possible.

public static bool InlineIfPossible(Block block, int pos, ILTransformContext context)

Parameters

block Block
pos int
context ILTransformContext

Returns

bool

InlineInto(Block, int, InliningOptions, ILTransformContext)

Inlines instructions before pos into block.Instructions[pos].

public static int InlineInto(Block block, int pos, InliningOptions options, ILTransformContext context)

Parameters

block Block
pos int
options InliningOptions
context ILTransformContext

Returns

int

The number of instructions that were inlined.

InlineOne(StLoc, InliningOptions, ILTransformContext)

Inlines the stloc instruction at block.Instructions[pos] into the next instruction.

Note that this method does not check whether 'v' has only one use; the caller is expected to validate whether inlining 'v' has any effects on other uses of 'v'.

public static bool InlineOne(StLoc stloc, InliningOptions options, ILTransformContext context)

Parameters

stloc StLoc
options InliningOptions
context ILTransformContext

Returns

bool

InlineOneIfPossible(Block, int, InliningOptions, ILTransformContext)

Inlines the stloc instruction at block.Instructions[pos] into the next instruction, if possible.

public static bool InlineOneIfPossible(Block block, int pos, InliningOptions options, ILTransformContext context)

Parameters

block Block
pos int
options InliningOptions
context ILTransformContext

Returns

bool

Run(Block, BlockTransformContext)

Runs the transform on the specified block.

Note: the transform may only modify the specified block and its descendants, as well as any sibling blocks that are dominated by the specified block.

public void Run(Block block, BlockTransformContext context)

Parameters

block Block
context BlockTransformContext

Run(Block, int, StatementTransformContext)

public void Run(Block block, int pos, StatementTransformContext context)

Parameters

block Block
pos int
context StatementTransformContext

Run(ILFunction, ILTransformContext)

public void Run(ILFunction function, ILTransformContext context)

Parameters

function ILFunction
context ILTransformContext