Struct peepmatic_runtime::optimizations::PeepholeOptimizations [−][src]
pub struct PeepholeOptimizations<TOperator> where
TOperator: 'static + Copy + Debug + Eq + Hash, {
pub integers: IntegerInterner,
pub automata: Automaton<MatchResult, MatchOp, Box<[Action<TOperator>]>>,
}
Expand description
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
Deserialize a PeepholeOptimizations
from bytes.
pub fn optimizer<'peep, 'ctx, TInstructionSet>(
&'peep self,
instr_set: TInstructionSet
) -> PeepholeOptimizer<'peep, 'ctx, TInstructionSet> where
TInstructionSet: InstructionSet<'ctx, Operator = TOperator>,
TOperator: Into<NonZeroU32>,
pub fn optimizer<'peep, 'ctx, TInstructionSet>(
&'peep self,
instr_set: TInstructionSet
) -> PeepholeOptimizer<'peep, 'ctx, TInstructionSet> where
TInstructionSet: InstructionSet<'ctx, Operator = TOperator>,
TOperator: Into<NonZeroU32>,
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<'de, TOperator> Deserialize<'de> for PeepholeOptimizations<TOperator> where
TOperator: 'static + Copy + Debug + Eq + Hash,
TOperator: Deserialize<'de>,
impl<'de, TOperator> Deserialize<'de> for PeepholeOptimizations<TOperator> where
TOperator: 'static + Copy + Debug + Eq + Hash,
TOperator: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more