Namespace ICSharpCode.Decompiler.IL.Transforms
Classes
- BlockILTransform
IL transform that runs a list of per-block transforms.
- BlockTransformContext
Parameter class holding various arguments for Run(Block, BlockTransformContext).
- CopyPropagation
Runs a very simple form of copy propagation. Copy propagation is used in two cases:
- assignments from arguments to local variables If the target variable is assigned to only once (so always is that argument) and the argument is never changed (no ldarga/starg), then we can replace the variable with the argument.
- assignments of address-loading instructions to local variables
- DelegateConstruction
Transforms anonymous methods and lambdas by creating nested ILFunctions.
- DynamicCallSiteTransform
Transforms the "callsite initialization pattern" into DynamicInstructions.
- ExpressionTransforms
Collection of transforms that detect simple expression patterns (e.g. 'cgt.un(..., ld.null)') and replace them with different instructions.
- FixLoneIsInst
C# cannot represent
isinst T
directly for value-types. This transform un-inlines the argument ofisinst
instructions that can't be directly translated to C#, thus allowing the emulation via "expr is T ? (T)expr : null".
- HighLevelLoopTransform
If possible, transforms plain ILAst loops into while (condition), do-while and for-loops. For the invariants of the transforms CheckInvariant(ILPhase).
- ILInlining
Performs inlining transformations.
- ILTransformContext
Parameter class holding various arguments for Run(ILFunction, ILTransformContext).
- LocalFunctionDecompiler
Decompiler step for C# 7.0 local functions
- NullCoalescingTransform
Transform for constructing the NullCoalescingInstruction (if.notnull(a,b), or in C#: ??) Note that this transform only handles the case where a,b are reference types.
The ?? operator for nullable value types is handled by NullableLiftingTransform.
- RemoveDeadVariableInit
Remove
HasInitialValue
from locals that are definitely assigned before every use (=the initial value is a dead store).In yield return generators, additionally removes dead 'V = null;' assignments.
Additionally infers IType of stack slots that have StackType.Ref
- SplitVariables
Live range splitting for IL variables.
- StatementTransform
Block transform that runs a list of statement transforms.
- StatementTransformContext
Parameter class holding various arguments for Run(Block, int, StatementTransformContext).
- StepLimitReachedException
Exception thrown when an IL transform runs into the StepLimit.
- Stepper
Helper class that manages recording transform steps.
- SwitchOnNullableTransform
Detects switch-on-nullable patterns employed by the C# compiler and transforms them to an ILAst-switch-instruction.
- SwitchOnStringTransform
Detects switch-on-string patterns employed by the C# compiler and transforms them to an ILAst-switch-instruction.
- TransformArrayInitializers
Transforms array initialization pattern of System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray. For collection and object initializers see TransformCollectionAndObjectInitializers
- TransformAssignment
Constructs compound assignments and inline assignments.
- TransformCollectionAndObjectInitializers
Transforms collection and object initialization patterns.
- TransformDisplayClassUsage
Transforms closure fields to local variables.
This is a post-processing step of DelegateConstruction, LocalFunctionDecompiler and TransformExpressionTrees.
In general we can perform SROA (scalar replacement of aggregates) on any variable that satisfies the following conditions:
- It is initialized by an empty/default constructor call.
- The variable is never passed to another method.
- The variable is never the target of an invocation.
Note that 2) and 3) apply because declarations and uses of lambdas and local functions are already transformed by the time this transform is applied.
- TransformExpressionTrees
Converts LINQ Expression Trees to ILFunctions/ILAst instructions.
We build a tree of Func{ILInstruction}s, which are only executed, if the whole transform succeeds.
Structs
Interfaces
- IBlockTransform
Per-block IL transform.
- IILTransform
Per-function IL transform.
- IStatementTransform
IL transform that runs on a sequence of statements within a block.