Show / Hide Table of Contents

    Struct PeepholeRewriteRule<TInstruction>

    A rewrite rule as used by a peephole optimizer.

    Inherited Members
    System.ValueType.Equals(System.Object)
    System.ValueType.GetHashCode()
    System.ValueType.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    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

    | Improve this Doc 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
    System.Collections.Generic.IReadOnlyList<System.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.

    System.Func<System.Collections.Generic.IReadOnlyList<TInstruction>, System.Collections.Generic.IReadOnlyList<TInstruction>> rewrite

    A function that rewrites instructions that match the pattern.

    | Improve this Doc 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
    System.Collections.Generic.IReadOnlyList<System.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.

    System.Predicate<System.Collections.Generic.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.

    System.Func<System.Collections.Generic.IReadOnlyList<TInstruction>, System.Collections.Generic.IReadOnlyList<TInstruction>> rewrite

    A function that rewrites instructions that match the pattern.

    Properties

    | Improve this Doc 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 Predicate<IReadOnlyList<TInstruction>> MacroPattern { get; }
    Property Value
    Type Description
    System.Predicate<System.Collections.Generic.IReadOnlyList<TInstruction>>

    A predicate on a sequence of instructions.

    | Improve this Doc 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 IReadOnlyList<Predicate<TInstruction>> Pattern { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyList<System.Predicate<TInstruction>>

    A list of instruction-matching predicates.

    | Improve this Doc View Source

    Rewrite

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

    Declaration
    public Func<IReadOnlyList<TInstruction>, IReadOnlyList<TInstruction>> Rewrite { get; }
    Property Value
    Type Description
    System.Func<System.Collections.Generic.IReadOnlyList<TInstruction>, System.Collections.Generic.IReadOnlyList<TInstruction>>

    A function that rewrites instructions.

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