Search Results for

    Show / Hide Table of Contents

    Struct PeepholeRewriteRule<TInstruction>

    A rewrite rule as used by a peephole optimizer.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Flame.Compiler.Target
    Assembly: Flame.Compiler.dll
    Syntax
    public struct PeepholeRewriteRule<TInstruction>
    Type Parameters
    Name Description
    TInstruction

    The type of target-specific instruction to rewrite.

    Constructors

    | Edit this page View Source

    PeepholeRewriteRule(IReadOnlyList<Predicate<TInstruction>>, Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>>)

    Creates a peephole rewrite rule.

    Declaration
    public PeepholeRewriteRule(IReadOnlyList<Predicate<TInstruction>> pattern, Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>> rewrite)
    Parameters
    Type Name Description
    IReadOnlyList<Predicate<TInstruction>> pattern

    The pattern to match on, specified as a list of predicates. The rewrite rule is considered to be applicable if and only if every pattern in the list is a match.

    Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>> rewrite

    A function that rewrites instructions that match the pattern.

    | Edit this page View Source

    PeepholeRewriteRule(IReadOnlyList<Predicate<TInstruction>>, Predicate<IReadOnlyList<TInstruction>>, Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>>)

    Creates a peephole rewrite rule.

    Declaration
    public PeepholeRewriteRule(IReadOnlyList<Predicate<TInstruction>> pattern, Predicate<IReadOnlyList<TInstruction>> macroPattern, Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>> rewrite)
    Parameters
    Type Name Description
    IReadOnlyList<Predicate<TInstruction>> pattern

    The pattern to match on, specified as a list of predicates. The rewrite rule only considered to be applicable if every pattern in the list is a match. list is a match.

    Predicate<IReadOnlyList<TInstruction>> macroPattern

    A "macro-pattern" that decides if a sequence of instructions can be rewritten by the rewrite rule, assuming that every instruction in the sequence already adheres to pattern.

    Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>> rewrite

    A function that rewrites instructions that match the pattern.

    Properties

    | Edit this page View Source

    MacroPattern

    Gets a "macro-pattern" that decides if a sequence of instructions can be rewritten by the rewrite rule, assuming that every instruction in the sequence already adheres to the pattern.

    Declaration
    public readonly Predicate<IReadOnlyList<TInstruction>> MacroPattern { get; }
    Property Value
    Type Description
    Predicate<IReadOnlyList<TInstruction>>

    A predicate on a sequence of instructions.

    | Edit this page View Source

    Pattern

    Gets the pattern to match on, specified as a list of predicates. The rewrite rule is only considered to be applicable if every pattern in the list is a match.

    Declaration
    public readonly IReadOnlyList<Predicate<TInstruction>> Pattern { get; }
    Property Value
    Type Description
    IReadOnlyList<Predicate<TInstruction>>

    A list of instruction-matching predicates.

    | Edit this page View Source

    Rewrite

    Rewrites a list of instructions matching the pattern specified by this rewrite rule.

    Declaration
    public readonly Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>> Rewrite { get; }
    Property Value
    Type Description
    Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>>

    A function that rewrites instructions.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX