Show / Hide Table of Contents

    Class FlowGraph

    An immutable control-flow graph that consists of basic blocks.

    Inheritance
    System.Object
    FlowGraph
    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
    Assembly: Flame.Compiler.dll
    Syntax
    public sealed class FlowGraph

    Constructors

    | Improve this Doc View Source

    FlowGraph()

    Creates a control-flow graph that contains only an empty entry point block.

    Declaration
    public FlowGraph()

    Properties

    | Improve this Doc View Source

    BasicBlocks

    Gets a sequence of all basic blocks in this control-flow graph.

    Declaration
    public IEnumerable<BasicBlock> BasicBlocks { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<BasicBlock>

    All basic blocks.

    | Improve this Doc View Source

    BasicBlockTags

    Gets a sequence of all basic block tags in this control-flow graph.

    Declaration
    public IEnumerable<BasicBlockTag> BasicBlockTags { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<BasicBlockTag>
    | Improve this Doc View Source

    EntryPoint

    Gets the entry point block.

    Declaration
    public BasicBlock EntryPoint { get; }
    Property Value
    Type Description
    BasicBlock

    The entry point block.

    | Improve this Doc View Source

    EntryPointTag

    Gets the tag of the entry point block.

    Declaration
    public BasicBlockTag EntryPointTag { get; }
    Property Value
    Type Description
    BasicBlockTag

    The tag of the entry point block.

    | Improve this Doc View Source

    InstructionTags

    Gets a sequence of all instruction tags in this control-flow graph.

    Declaration
    public IEnumerable<ValueTag> InstructionTags { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ValueTag>
    | Improve this Doc View Source

    NamedInstructions

    Gets a sequence of all named instructions in this control-flow graph. Anonymous instructions as defined by block flow are not included.

    Declaration
    public IEnumerable<NamedInstruction> NamedInstructions { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<NamedInstruction>

    All named instructions

    | Improve this Doc View Source

    ParameterTags

    Gets a sequence of all parameter tags in this control-flow graph.

    Declaration
    public IEnumerable<ValueTag> ParameterTags { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ValueTag>
    | Improve this Doc View Source

    ValueTags

    Gets a sequence of all value tags in this control-flow graph. This sequence includes both instruction values and basic block parameter values.

    Declaration
    public IEnumerable<ValueTag> ValueTags { get; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<ValueTag>

    Methods

    | Improve this Doc View Source

    AddBasicBlock()

    Creates a new basic block that includes all basic blocks in this graph plus an empty basic block. The latter basic block is returned.

    Declaration
    public BasicBlock AddBasicBlock()
    Returns
    Type Description
    BasicBlock

    An empty basic block in a new control-flow graph.

    | Improve this Doc View Source

    AddBasicBlock(String)

    Creates a new basic block that includes all basic blocks in this graph plus an empty basic block. The latter basic block is returned.

    Declaration
    public BasicBlock AddBasicBlock(string name)
    Parameters
    Type Name Description
    System.String name

    The (preferred) name of the basic block's tag.

    Returns
    Type Description
    BasicBlock

    An empty basic block in a new control-flow graph.

    | Improve this Doc View Source

    AssertContainsBasicBlock(BasicBlockTag)

    Asserts that this control-flow graph must contain a basic block with a particular tag.

    Declaration
    public void AssertContainsBasicBlock(BasicBlockTag tag)
    Parameters
    Type Name Description
    BasicBlockTag tag

    The tag of the basic block that must be in the graph.

    | Improve this Doc View Source

    AssertContainsBasicBlock(BasicBlockTag, String)

    Asserts that this control-flow graph must contain a basic block with a particular tag.

    Declaration
    public void AssertContainsBasicBlock(BasicBlockTag tag, string message)
    Parameters
    Type Name Description
    BasicBlockTag tag

    The tag of the basic block that must be in the graph.

    System.String message

    The error message for when no basic block in this control-flow graph has the tag.

    | Improve this Doc View Source

    AssertContainsInstruction(ValueTag)

    Asserts that this control-flow graph must contain an instruction with a particular tag.

    Declaration
    public void AssertContainsInstruction(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The tag of the instruction that must be in the graph.

    | Improve this Doc View Source

    AssertContainsInstruction(ValueTag, String)

    Asserts that this control-flow graph must contain an instruction with a particular tag.

    Declaration
    public void AssertContainsInstruction(ValueTag tag, string message)
    Parameters
    Type Name Description
    ValueTag tag

    The tag of the instruction that must be in the graph.

    System.String message

    The error message for when no instruction in this control-flow graph has the tag.

    | Improve this Doc View Source

    AssertContainsValue(ValueTag)

    Asserts that this control-flow graph must contain an instruction or basic block parameter with a particular tag.

    Declaration
    public void AssertContainsValue(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The tag of the value that must be in the graph.

    | Improve this Doc View Source

    AssertContainsValue(ValueTag, String)

    Asserts that this control-flow graph must contain an instruction or basic block parameter with a particular tag.

    Declaration
    public void AssertContainsValue(ValueTag tag, string message)
    Parameters
    Type Name Description
    ValueTag tag

    The tag of the value that must be in the graph.

    System.String message

    The error message for when no value in this control-flow graph has the tag.

    | Improve this Doc View Source

    AssertNotContainsValue(ValueTag)

    Asserts that this control-flow graph must not contain an instruction or basic block parameter with a particular tag.

    Declaration
    public void AssertNotContainsValue(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The tag of the value that must not be in the graph.

    | Improve this Doc View Source

    AssertNotContainsValue(ValueTag, String)

    Asserts that this control-flow graph must not contain an instruction or basic block parameter with a particular tag.

    Declaration
    public void AssertNotContainsValue(ValueTag tag, string message)
    Parameters
    Type Name Description
    ValueTag tag

    The tag of the value that must not be in the graph.

    System.String message

    The error message for when a value in this control-flow graph has the tag.

    | Improve this Doc View Source

    ContainsBasicBlock(BasicBlockTag)

    Checks if this control-flow graph contains a basic block with a particular tag.

    Declaration
    public bool ContainsBasicBlock(BasicBlockTag tag)
    Parameters
    Type Name Description
    BasicBlockTag tag

    The basic block's tag.

    Returns
    Type Description
    System.Boolean

    true if this control-flow graph contains a basic block with the given tag; otherwise, false.

    | Improve this Doc View Source

    ContainsBlockParameter(ValueTag)

    Checks if this control-flow graph contains a basic block parameter with a particular tag.

    Declaration
    public bool ContainsBlockParameter(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The parameter's tag.

    Returns
    Type Description
    System.Boolean

    true if this control-flow graph contains a basic block parameter with the given tag; otherwise, false.

    | Improve this Doc View Source

    ContainsInstruction(ValueTag)

    Checks if this control-flow graph contains an instruction with a particular tag.

    Declaration
    public bool ContainsInstruction(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The instruction's tag.

    Returns
    Type Description
    System.Boolean

    true if this control-flow graph contains an instruction with the given tag; otherwise, false.

    | Improve this Doc View Source

    ContainsValue(ValueTag)

    Checks if this control-flow graph contains an instruction or basic block parameter with a particular tag.

    Declaration
    public bool ContainsValue(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The value's tag.

    Returns
    Type Description
    System.Boolean

    true if this control-flow graph contains a value with the given tag; otherwise, false.

    | Improve this Doc View Source

    GetAnalysisFor<T>()

    Gets the analysis, registered with this control-flow graph, that produced a particular type of result.

    Declaration
    public IFlowGraphAnalysis<T> GetAnalysisFor<T>()
    Returns
    Type Description
    IFlowGraphAnalysis<T>

    An analysis.

    Type Parameters
    Name Description
    T

    The type of analysis result that is sought.

    | Improve this Doc View Source

    GetAnalysisResult<T>()

    Gets an analysis result based on its type.

    Declaration
    public T GetAnalysisResult<T>()
    Returns
    Type Description
    T

    An analysis result.

    Type Parameters
    Name Description
    T

    The type of analysis result to fetch or compute.

    | Improve this Doc View Source

    GetBasicBlock(BasicBlockTag)

    Gets the basic block with a particular tag.

    Declaration
    public BasicBlock GetBasicBlock(BasicBlockTag tag)
    Parameters
    Type Name Description
    BasicBlockTag tag

    The basic block's tag.

    Returns
    Type Description
    BasicBlock

    A basic block.

    | Improve this Doc View Source

    GetInstruction(ValueTag)

    Gets the named instruction with a particular tag.

    Declaration
    public NamedInstruction GetInstruction(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The instruction's tag.

    Returns
    Type Description
    NamedInstruction

    A named instruction.

    | Improve this Doc View Source

    GetValueParent(ValueTag)

    Gets basic block that defines a value with a particular tag.

    Declaration
    public BasicBlock GetValueParent(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The tag of the value to look for.

    Returns
    Type Description
    BasicBlock

    The basic block that defines the value.

    | Improve this Doc View Source

    GetValueType(ValueTag)

    Gets the type of a value in this graph.

    Declaration
    public IType GetValueType(ValueTag tag)
    Parameters
    Type Name Description
    ValueTag tag

    The value's tag.

    Returns
    Type Description
    IType

    The value's type.

    | Improve this Doc View Source

    HasAnalysisFor<T>()

    Tells if this flow graph has an analysis that produces a particular type of result.

    Declaration
    public bool HasAnalysisFor<T>()
    Returns
    Type Description
    System.Boolean

    true if a registered analysis produces a result of type T; otherwise, false.

    Type Parameters
    Name Description
    T

    The type of analysis result that is sought.

    | Improve this Doc View Source

    Map(MemberMapping)

    Applies a member mapping to this flow graph.

    Declaration
    public FlowGraph Map(MemberMapping mapping)
    Parameters
    Type Name Description
    MemberMapping mapping

    A member mapping.

    Returns
    Type Description
    FlowGraph

    A transformed flow graph.

    | Improve this Doc View Source

    RemoveBasicBlock(BasicBlockTag)

    Removes the basic block with a particular tag from this control-flow graph.

    Declaration
    public FlowGraph RemoveBasicBlock(BasicBlockTag tag)
    Parameters
    Type Name Description
    BasicBlockTag tag

    The basic block's tag.

    Returns
    Type Description
    FlowGraph

    A new control-flow graph that does not contain the basic block.

    | Improve this Doc View Source

    RemoveDefinitions(IEnumerable<ValueTag>)

    Removes the definitions for a set of values from this flow graph.

    Declaration
    public FlowGraph RemoveDefinitions(IEnumerable<ValueTag> valuesToRemove)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<ValueTag> valuesToRemove

    A set of values whose definitions are to be eliminated from the flow graph. These values can refer to instructions and basic block parameters.

    Returns
    Type Description
    FlowGraph

    A flow graph that does not define any of the values.

    | Improve this Doc View Source

    RemoveInstruction(ValueTag)

    Removes a particular instruction from this control-flow graph. Returns a new control-flow graph that does not contain the instruction.

    Declaration
    public FlowGraph RemoveInstruction(ValueTag instructionTag)
    Parameters
    Type Name Description
    ValueTag instructionTag

    The tag of the instruction to remove.

    Returns
    Type Description
    FlowGraph

    A control-flow graph that no longer contains the instruction.

    | Improve this Doc View Source

    RemoveInstructionDefinitions(IEnumerable<ValueTag>)

    Removes the definitions for a set of instructions from this flow graph.

    Declaration
    public FlowGraph RemoveInstructionDefinitions(IEnumerable<ValueTag> instructionsToRemove)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<ValueTag> instructionsToRemove

    A set of values whose definitions are to be eliminated from the flow graph. These values may only refer to instructions.

    Returns
    Type Description
    FlowGraph

    A flow graph that does not define any of the values.

    | Improve this Doc View Source

    ReplaceUses(IReadOnlyDictionary<ValueTag, ValueTag>)

    Replaces all uses of values with other values. The values to replace are encoded as keys in a dictionary and the values to replace them with as values in that same dictionary.

    Declaration
    public FlowGraph ReplaceUses(IReadOnlyDictionary<ValueTag, ValueTag> replacementMap)
    Parameters
    Type Name Description
    System.Collections.Generic.IReadOnlyDictionary<ValueTag, ValueTag> replacementMap

    A mapping of values to replacement values.

    Returns
    Type Description
    FlowGraph

    A new flow graph.

    | Improve this Doc View Source

    ToBuilder()

    Creates a mutable control-flow graph builder from this immutable control-flow graph.

    Declaration
    public FlowGraphBuilder ToBuilder()
    Returns
    Type Description
    FlowGraphBuilder

    A mutable control-flow graph builder.

    | Improve this Doc View Source

    Transform(IntraproceduralOptimization)

    Applies an intraprocedural optimization to this flow graph.

    Declaration
    public FlowGraph Transform(IntraproceduralOptimization optimization)
    Parameters
    Type Name Description
    IntraproceduralOptimization optimization

    The transform to apply.

    Returns
    Type Description
    FlowGraph

    A transformed flow graph.

    | Improve this Doc View Source

    Transform(IntraproceduralOptimization[])

    Applies a sequence of intraprocedural optimizations to this flow graph.

    Declaration
    public FlowGraph Transform(params IntraproceduralOptimization[] optimizations)
    Parameters
    Type Name Description
    IntraproceduralOptimization[] optimizations

    The transforms to apply.

    Returns
    Type Description
    FlowGraph

    A transformed flow graph.

    | Improve this Doc View Source

    Transform(IEnumerable<IntraproceduralOptimization>)

    Applies a sequence of intraprocedural optimizations to this flow graph.

    Declaration
    public FlowGraph Transform(IEnumerable<IntraproceduralOptimization> optimizations)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<IntraproceduralOptimization> optimizations

    The transforms to apply.

    Returns
    Type Description
    FlowGraph

    A transformed flow graph.

    | Improve this Doc View Source

    TryGetAnalysisResult<T>(out T)

    Tries to get an analysis result of a particular type.

    Declaration
    public bool TryGetAnalysisResult<T>(out T result)
    Parameters
    Type Name Description
    T result

    The analysis result, if one can be fetched or computed.

    Returns
    Type Description
    System.Boolean

    true if there is an analyzer to compute the result; otherwise, false.

    Type Parameters
    Name Description
    T

    The type of analysis result to fetch or compute.

    | Improve this Doc View Source

    TryGetInstruction(ValueTag, out NamedInstruction)

    Tries to get an instruction with a particular tag, if it exists in this control-flow graph.

    Declaration
    public bool TryGetInstruction(ValueTag tag, out NamedInstruction result)
    Parameters
    Type Name Description
    ValueTag tag

    The instruction's tag.

    NamedInstruction result

    The named instruction, if it exists in this control-flow graph.

    Returns
    Type Description
    System.Boolean

    true if the instruction exists; otherwise, false.

    | Improve this Doc View Source

    WithAnalysis<T>(IFlowGraphAnalysis<T>)

    Registers an analysis on this flow graph.

    Declaration
    public FlowGraph WithAnalysis<T>(IFlowGraphAnalysis<T> analysis)
    Parameters
    Type Name Description
    IFlowGraphAnalysis<T> analysis

    The analysis to register.

    Returns
    Type Description
    FlowGraph

    A new flow graph that includes the analysis.

    Type Parameters
    Name Description
    T

    The type of result produced by the analysis.

    | Improve this Doc View Source

    WithEntryPoint(BasicBlockTag)

    Creates a new control-flow graph that takes the basic block with a particular tag as entry point.

    Declaration
    public FlowGraph WithEntryPoint(BasicBlockTag tag)
    Parameters
    Type Name Description
    BasicBlockTag tag

    The tag of the new entry point block.

    Returns
    Type Description
    FlowGraph

    A control-flow graph.

    Extension Methods

    ExceptionDelayabilityExtensions.CanDelayExceptions(FlowGraph, ValueTag)
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX