Show / Hide Table of Contents

    Class InstructionStreamBuilder<TInstruction>

    Translates flow graphs to linear sequences of target-specific instructions.

    Inheritance
    System.Object
    InstructionStreamBuilder<TInstruction>
    StackInstructionStreamBuilder<TInstruction>
    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.Target
    Assembly: Flame.Compiler.dll
    Syntax
    public class InstructionStreamBuilder<TInstruction>
    Type Parameters
    Name Description
    TInstruction

    The type of instruction to generate.

    Remarks

    InstructionStreamBuilder assumes that the instruction selector handles data transfer between instructions. This is a reasonable abstraction for register-based (virtual) machines, but may not be a good fit for stack machines.

    See StackInstructionStreamBuilder<TInstruction> for an instruction stream builder that manages data transfer using a combination of stack slots and explicit register loads/stores.

    Constructors

    | Improve this Doc View Source

    InstructionStreamBuilder(ILinearInstructionSelector<TInstruction>)

    Creates a linear instruction stream builder.

    Declaration
    protected InstructionStreamBuilder(ILinearInstructionSelector<TInstruction> instructionSelector)
    Parameters
    Type Name Description
    ILinearInstructionSelector<TInstruction> instructionSelector

    The instruction selector to use.

    Properties

    | Improve this Doc View Source

    InstructionSelector

    Gets the instruction selector used by this linear instruction stream builder.

    Declaration
    public ILinearInstructionSelector<TInstruction> InstructionSelector { get; }
    Property Value
    Type Description
    ILinearInstructionSelector<TInstruction>

    A linear instruction selector.

    Methods

    | Improve this Doc View Source

    Create<TSelector>(TSelector)

    Creates a linear instruction stream builder.

    Declaration
    public static InstructionStreamBuilder<TInstruction> Create<TSelector>(TSelector instructionSelector)
        where TSelector : ILinearInstructionSelector<TInstruction>
    Parameters
    Type Name Description
    TSelector instructionSelector

    The instruction selector to use.

    Returns
    Type Description
    InstructionStreamBuilder<TInstruction>
    Type Parameters
    Name Description
    TSelector
    | Improve this Doc View Source

    ToInstructionStream(BasicBlock, IReadOnlyDictionary<ValueTag, SelectedInstructions<TInstruction>>, SelectedFlowInstructions<TInstruction>)

    Creates a linear sequence of instructions for a basic block based on selected instructions for named instructions and block flow.

    Declaration
    protected virtual IReadOnlyList<TInstruction> ToInstructionStream(BasicBlock block, IReadOnlyDictionary<ValueTag, SelectedInstructions<TInstruction>> instructions, SelectedFlowInstructions<TInstruction> flow)
    Parameters
    Type Name Description
    BasicBlock block

    The basic blocks to place.

    System.Collections.Generic.IReadOnlyDictionary<ValueTag, SelectedInstructions<TInstruction>> instructions

    A mapping of named instructions to their selected instructions. Named instructions that do not appear in this mapping should not be selected.

    SelectedFlowInstructions<TInstruction> flow

    Selected instructions for block's control flow.

    Returns
    Type Description
    System.Collections.Generic.IReadOnlyList<TInstruction>

    A linear sequence of instructions.

    | Improve this Doc View Source

    ToInstructionStream(FlowGraph)

    Takes a flow graph and translates it to an instruction stream.

    Declaration
    public IReadOnlyList<TInstruction> ToInstructionStream(FlowGraph graph)
    Parameters
    Type Name Description
    FlowGraph graph

    The flow graph to translate.

    Returns
    Type Description
    System.Collections.Generic.IReadOnlyList<TInstruction>

    A linear sequence of target-specific instructions.

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