Show / Hide Table of Contents

    Class GreedyRegisterAllocator<TRegister>

    An analysis that greedily allocates registers to values. The set of values is assumed to be unbounded: the analysis is allowed to "create" an arbitrarily large amount of registers.

    Inheritance
    System.Object
    GreedyRegisterAllocator<TRegister>
    Implements
    IFlowGraphAnalysis<RegisterAllocation<TRegister>>
    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.Analysis
    Assembly: Flame.Compiler.dll
    Syntax
    public abstract class GreedyRegisterAllocator<TRegister> : IFlowGraphAnalysis<RegisterAllocation<TRegister>>
    Type Parameters
    Name Description
    TRegister

    The type of register allocated to values.

    Methods

    | Improve this Doc View Source

    Analyze(FlowGraph)

    Declaration
    public RegisterAllocation<TRegister> Analyze(FlowGraph graph)
    Parameters
    Type Name Description
    FlowGraph graph
    Returns
    Type Description
    RegisterAllocation<TRegister>
    | Improve this Doc View Source

    AnalyzeWithUpdates(FlowGraph, RegisterAllocation<TRegister>, IReadOnlyList<FlowGraphUpdate>)

    Declaration
    public RegisterAllocation<TRegister> AnalyzeWithUpdates(FlowGraph graph, RegisterAllocation<TRegister> previousResult, IReadOnlyList<FlowGraphUpdate> updates)
    Parameters
    Type Name Description
    FlowGraph graph
    RegisterAllocation<TRegister> previousResult
    System.Collections.Generic.IReadOnlyList<FlowGraphUpdate> updates
    Returns
    Type Description
    RegisterAllocation<TRegister>
    | Improve this Doc View Source

    CreateRegister(IType)

    Creates a brand new register for a value of a particular type.

    Declaration
    protected abstract TRegister CreateRegister(IType type)
    Parameters
    Type Name Description
    IType type

    The type of value to create a register for.

    Returns
    Type Description
    TRegister

    A register suitable for the value.

    | Improve this Doc View Source

    RequiresRegister(ValueTag, FlowGraph)

    Tells if a register should be allocated for a particular value.

    Declaration
    protected virtual bool RequiresRegister(ValueTag value, FlowGraph graph)
    Parameters
    Type Name Description
    ValueTag value

    The value for which register allocation may or may not be necessary.

    FlowGraph graph

    The control flow graph that defines value.

    Returns
    Type Description
    System.Boolean

    true if a register must be allocated to value; otherwise, false.

    Remarks

    Implementations may override this method to suppress register allocation for values that are, e.g., stored on an evaluation stack.

    | Improve this Doc View Source

    TryGetPreallocatedRegister(ValueTag, FlowGraph, out TRegister)

    Tries to get a preallocated register for a particular value. If it exists, then the preallocated register will be used for the value, no questions asked. The preallocated register may be reused.

    Declaration
    protected virtual bool TryGetPreallocatedRegister(ValueTag value, FlowGraph graph, out TRegister register)
    Parameters
    Type Name Description
    ValueTag value

    The value that may have a preallocated register.

    FlowGraph graph

    The graph that defines the value.

    TRegister register

    A preallocated register, if any.

    Returns
    Type Description
    System.Boolean

    true if there is a preallocated register for value; otherwise, false.

    | Improve this Doc View Source

    TryRecycleRegister(IType, IEnumerable<TRegister>, out TRegister)

    Tries to recycle a register from a set of registers.

    Declaration
    protected abstract bool TryRecycleRegister(IType type, IEnumerable<TRegister> registers, out TRegister result)
    Parameters
    Type Name Description
    IType type

    The type of value to store in the recycled register.

    System.Collections.Generic.IEnumerable<TRegister> registers

    A set of registers that are eligible for recycling.

    TRegister result

    A register to recycle, if any.

    Returns
    Type Description
    System.Boolean

    true if a register has been selected for recyling; otherwise, false.

    Implements

    IFlowGraphAnalysis<T>
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX