Class CilPeepholeOptimizer
A peephole optimizer for CIL instructions.
Inherited Members
Namespace: Flame.Clr.Emit
Assembly: Flame.Clr.dll
Syntax
public sealed class CilPeepholeOptimizer : PeepholeOptimizer<Instruction, ExceptionHandler>
Fields
| Edit this page View SourceInstance
An instance of the CIL peephole optimizer.
Declaration
public static readonly CilPeepholeOptimizer Instance
Field Value
| Type | Description |
|---|---|
| CilPeepholeOptimizer |
Methods
| Edit this page View SourceGetBranchTargets(Instruction)
Gets a list of all instructions to which a particular instruction may branch.
Declaration
protected override IEnumerable<Instruction> GetBranchTargets(Instruction instruction)
Parameters
| Type | Name | Description |
|---|---|---|
| Instruction | instruction | An instruction that may branch to other instructions. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Instruction> | A list of branch targets. |
Overrides
| Edit this page View SourceGetInstructionReferences(ExceptionHandler)
Gets a list of all instructions referenced by a particular external instruction reference.
Declaration
protected override IEnumerable<Instruction> GetInstructionReferences(ExceptionHandler externalRef)
Parameters
| Type | Name | Description |
|---|---|---|
| ExceptionHandler | externalRef | The external reference to examine. |
Returns
| Type | Description |
|---|---|
| IEnumerable<Instruction> | A list of referenced instructions. |
Overrides
| Edit this page View SourceOptimize(MethodBody)
Applies peephole optimizations to a CIL method body.
Declaration
public static void Optimize(MethodBody body)
Parameters
| Type | Name | Description |
|---|---|---|
| MethodBody | body | The method body to optimize. |
RewriteBranchTargets(Instruction, IReadOnlyDictionary<Instruction, Instruction>)
Rewrites an instruction's branch targets.
Declaration
protected override Instruction RewriteBranchTargets(Instruction instruction, IReadOnlyDictionary<Instruction, Instruction> branchTargetMap)
Parameters
| Type | Name | Description |
|---|---|---|
| Instruction | instruction | The instruction to rewrite. |
| IReadOnlyDictionary<Instruction, Instruction> | branchTargetMap | A mapping of old branch target instructions to new branch target instructions. |
Returns
| Type | Description |
|---|---|
| Instruction | A modified or new instruction. |
Overrides
| Edit this page View SourceRewriteInstructionReferences(ExceptionHandler, IReadOnlyDictionary<Instruction, Instruction>)
Rewrites an external reference's referenced instructions.
Declaration
protected override ExceptionHandler RewriteInstructionReferences(ExceptionHandler externalRef, IReadOnlyDictionary<Instruction, Instruction> referenceMap)
Parameters
| Type | Name | Description |
|---|---|---|
| ExceptionHandler | externalRef | The reference to rewrite. |
| IReadOnlyDictionary<Instruction, Instruction> | referenceMap | A mapping of old referenced instructions to new referenced instructions. |
Returns
| Type | Description |
|---|---|
| ExceptionHandler | A modified or new external reference. |