Show / Hide Table of Contents

    Class Inlining

    The inlining optimization: a transform that copies the function bodies of callees into the caller, replacing the call with its implementation.

    Inheritance
    System.Object
    Optimization
    Inlining
    Inherited Members
    System.Object.ToString()
    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: Flame.Compiler.Transforms
    Assembly: Flame.Compiler.dll
    Syntax
    public class Inlining : Optimization

    Constructors

    | Improve this Doc View Source

    Inlining()

    Creates an instance of the inlining optimization.

    Declaration
    protected Inlining()

    Fields

    | Improve this Doc View Source

    Instance

    An instance of the inlining transformation.

    Declaration
    public static readonly Inlining Instance
    Field Value
    Type Description
    Inlining

    A call-inlining transform.

    Properties

    | Improve this Doc View Source

    IsCheckpoint

    Tells if this optimization checkpoints its result. The optimizer takes care to always return the latest checkpointed method body is returned when a method's optimized method body is requested.

    Declaration
    public override bool IsCheckpoint { get; }
    Property Value
    Type Description
    System.Boolean

    Tells if this optimization performs a checkpoint.

    Overrides
    Optimization.IsCheckpoint

    Methods

    | Improve this Doc View Source

    ApplyAsync(MethodBody, OptimizationState)

    Applies the optimization to a method body.

    Declaration
    public override Task<MethodBody> ApplyAsync(MethodBody body, OptimizationState state)
    Parameters
    Type Name Description
    MethodBody body

    A method body holder to optimize.

    OptimizationState state

    State associated with optimizations.

    Returns
    Type Description
    System.Threading.Tasks.Task<MethodBody>

    A task that produces an optimized method body.

    Overrides
    Optimization.ApplyAsync(MethodBody, OptimizationState)
    | Improve this Doc View Source

    CanInline(MethodBody, IMethod, FlowGraph)

    Determines if a method body can be inlined, that is, if invalid code will be generated by inlining it.

    Declaration
    protected virtual bool CanInline(MethodBody calleeBody, IMethod caller, FlowGraph callerBody)
    Parameters
    Type Name Description
    MethodBody calleeBody

    A method body that is an inlining candidate.

    IMethod caller

    The caller that wants to inline calleeBody.

    FlowGraph callerBody

    The method body for caller.

    Returns
    Type Description
    System.Boolean

    true if inlining calleeBody into caller is safe; otherwise, false.

    | Improve this Doc View Source

    GetInlineCost(MethodBody)

    Gauges a particular method body's inline cost.

    Declaration
    protected virtual int GetInlineCost(MethodBody body)
    Parameters
    Type Name Description
    MethodBody body

    A method body that might be inlined.

    Returns
    Type Description
    System.Int32

    A number that represents the method body's inline cost.

    | Improve this Doc View Source

    GetInlineGain(MethodBody, IReadOnlyList<ValueTag>, FlowGraph)

    Gauges a particular method body's inline gain.

    Declaration
    protected virtual int GetInlineGain(MethodBody body, IReadOnlyList<ValueTag> arguments, FlowGraph caller)
    Parameters
    Type Name Description
    MethodBody body

    A method body that might be inlined.

    System.Collections.Generic.IReadOnlyList<ValueTag> arguments

    The list of arguments to feed to body.

    FlowGraph caller

    The control-flow graph of the caller, which defines the arguments.

    Returns
    Type Description
    System.Int32

    A number that represents how much new information we expect to gain from inlining.

    | Improve this Doc View Source

    ShouldConsider(IMethod, IMethod)

    Tells if a method should be considered for inlining.

    Declaration
    protected virtual bool ShouldConsider(IMethod callee, IMethod caller)
    Parameters
    Type Name Description
    IMethod callee

    A method that might be inlined.

    IMethod caller

    A method that calls callee; it's not sure if it should consider inlining callee.

    Returns
    Type Description
    System.Boolean

    true if inlining may proceed; otherwise, false.

    | Improve this Doc View Source

    ShouldInline(MethodBody, IReadOnlyList<ValueTag>, FlowGraph)

    Determines if a method body is worth inlining.

    Declaration
    protected bool ShouldInline(MethodBody body, IReadOnlyList<ValueTag> arguments, FlowGraph caller)
    Parameters
    Type Name Description
    MethodBody body

    The method body to inline.

    System.Collections.Generic.IReadOnlyList<ValueTag> arguments

    The list of arguments to feed to body.

    FlowGraph caller

    The control-flow graph of the caller, which defines the arguments.

    Returns
    Type Description
    System.Boolean

    true if the method body should be inlined; otherwise, false,.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX