Safe Haskell | None |
---|---|
Language | Haskell2010 |
Optimizer for typed instructions.
It's quite experimental and incomplete.
List of possible improvements:
1. pushDrop
, dupDrop
, unitDrop
rules are essentially the
same. It would be good to generalize them into one rule. The same
applies to pushDip
.
It probably can be done more efficiently.
Synopsis
- optimize :: Instr inp out -> Instr inp out
- optimizeWithConf :: OptimizerConf -> Instr inp out -> Instr inp out
- defaultOptimizerConf :: OptimizerConf
- defaultRules :: Rule -> Rule
- defaultRulesAndPushPack :: Rule -> Rule
- orRule :: (Rule -> Rule) -> (Rule -> Rule) -> Rule -> Rule
- orSimpleRule :: (Rule -> Rule) -> Rule -> Rule -> Rule
- type Rule = forall inp out. Instr inp out -> Maybe (Instr inp out)
- data OptimizerConf = OptimizerConf {
- ocGotoValues :: Bool
- ocRuleset :: Rule -> Rule
- ocGotoValuesL :: Lens' OptimizerConf Bool
Documentation
optimize :: Instr inp out -> Instr inp out Source #
Optimize a typed instruction by replacing some sequences of instructions with smaller equivalent sequences. Applies default set of rewrite rules.
optimizeWithConf :: OptimizerConf -> Instr inp out -> Instr inp out Source #
Optimize a typed instruction using a custom set of rules.
defaultOptimizerConf :: OptimizerConf Source #
Default config - all commonly useful rules will be applied to all the code.
defaultRules :: Rule -> Rule Source #
defaultRulesAndPushPack :: Rule -> Rule Source #
We do not enable pushPack
rule by default because it is
potentially dangerous.
There are various code processing functions that may depend on constants,
e. g. string transformations.
orSimpleRule :: (Rule -> Rule) -> Rule -> Rule -> Rule Source #
Combine a rule fixpoint and a simple rule.
data OptimizerConf Source #
OptimizerConf | |
|
Instances
Default OptimizerConf Source # | |
Defined in Michelson.Optimizer def :: OptimizerConf # |