[][src]Struct peepmatic_runtime::optimizations::PeepholeOptimizations

pub struct PeepholeOptimizations<TOperator> where
    TOperator: 'static + Copy + Debug + Eq + Hash
{ pub integers: IntegerInterner, pub automata: Automaton<MatchResult, MatchOp, Box<[Action<TOperator>]>>, }

A compiled set of peephole optimizations.

This is the compilation result of the peepmatic crate, after its taken a bunch of optimizations written in the DSL and lowered and combined them.

Fields

integers: IntegerInterner

Not all integers we're matching on fit in the u32 that we use as the result of match operations. So we intern them and refer to them by id.

automata: Automaton<MatchResult, MatchOp, Box<[Action<TOperator>]>>

The underlying automata for matching optimizations' left-hand sides, and building up the corresponding right-hand side.

Implementations

impl<TOperator> PeepholeOptimizations<TOperator> where
    TOperator: 'static + Copy + Debug + Eq + Hash
[src]

pub fn deserialize<'a>(serialized: &'a [u8]) -> Result<Self> where
    TOperator: Deserialize<'a>, 
[src]

Deserialize a PeepholeOptimizations from bytes.

impl<TOperator> PeepholeOptimizations<TOperator> where
    TOperator: 'static + Copy + Debug + Eq + Hash
[src]

pub fn optimizer<'peep, 'ctx, TInstructionSet>(
    &'peep self,
    instr_set: TInstructionSet
) -> PeepholeOptimizer<'peep, 'ctx, TInstructionSet> where
    TInstructionSet: InstructionSet<'ctx, Operator = TOperator>,
    TOperator: Into<NonZeroU32>, 
[src]

Create a new peephole optimizer instance from this set of peephole optimizations.

The peephole optimizer instance can be used to apply these peephole optimizations. When checking multiple instructions for whether they can be optimized, it is more performant to reuse a single peephole optimizer instance, rather than create a new one for each instruction. Reusing the peephole optimizer instance allows the reuse of a few internal allocations.

Trait Implementations

impl<TOperator: Debug> Debug for PeepholeOptimizations<TOperator> where
    TOperator: 'static + Copy + Debug + Eq + Hash
[src]

impl<'de, TOperator> Deserialize<'de> for PeepholeOptimizations<TOperator> where
    TOperator: 'static + Copy + Debug + Eq + Hash,
    TOperator: Deserialize<'de>, 
[src]

impl<TOperator> Serialize for PeepholeOptimizations<TOperator> where
    TOperator: 'static + Copy + Debug + Eq + Hash,
    TOperator: Serialize
[src]

Auto Trait Implementations

impl<TOperator> RefUnwindSafe for PeepholeOptimizations<TOperator> where
    TOperator: RefUnwindSafe
[src]

impl<TOperator> Send for PeepholeOptimizations<TOperator> where
    TOperator: Send
[src]

impl<TOperator> Sync for PeepholeOptimizations<TOperator> where
    TOperator: Sync
[src]

impl<TOperator> Unpin for PeepholeOptimizations<TOperator>[src]

impl<TOperator> UnwindSafe for PeepholeOptimizations<TOperator> where
    TOperator: RefUnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.