[−][src]Struct peepmatic_runtime::optimizer::PeepholeOptimizer
A peephole optimizer instance that can apply a set of peephole optimizations to instructions.
These are created from a set of peephole optimizations with the
[PeepholeOptimizer::instance
][crate::PeepholeOptimizer::instance] method.
Reusing an instance when applying peephole optimizations to different instruction sequences means that you reuse internal allocations that are used to match left-hand sides and build up right-hand sides.
Implementations
impl<'peep, 'ctx, I> PeepholeOptimizer<'peep, 'ctx, I> where
I: InstructionSet<'ctx>,
[src]
I: InstructionSet<'ctx>,
pub fn apply_one(
&mut self,
context: &mut I::Context,
root: I::Instruction
) -> Option<I::Instruction>
[src]
&mut self,
context: &mut I::Context,
root: I::Instruction
) -> Option<I::Instruction>
Attempt to apply a single peephole optimization to the given root instruction.
If an optimization is applied, then the root
is replaced with the
optimization's right-hand side, and the root of the right-hand side is
returned as Some
.
If no optimization's left-hand side matches root
, then root
is left
untouched and None
is returned.
pub fn apply_all(&mut self, context: &mut I::Context, inst: I::Instruction)
[src]
Keep applying peephole optimizations to the given instruction until none can be applied anymore.
Trait Implementations
impl<'peep, 'ctx, I> Debug for PeepholeOptimizer<'peep, 'ctx, I> where
I: InstructionSet<'ctx>,
[src]
I: InstructionSet<'ctx>,
Auto Trait Implementations
impl<'peep, 'ctx, I> !RefUnwindSafe for PeepholeOptimizer<'peep, 'ctx, I>
impl<'peep, 'ctx, I> !Send for PeepholeOptimizer<'peep, 'ctx, I>
impl<'peep, 'ctx, I> !Sync for PeepholeOptimizer<'peep, 'ctx, I>
impl<'peep, 'ctx, I> Unpin for PeepholeOptimizer<'peep, 'ctx, I> where
I: Unpin,
<I as InstructionSet<'ctx>>::Instruction: Unpin,
I: Unpin,
<I as InstructionSet<'ctx>>::Instruction: Unpin,
impl<'peep, 'ctx, I> !UnwindSafe for PeepholeOptimizer<'peep, 'ctx, I>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,