never executed always true always false
1 module HelVM.HelMA.Automaton.Optimizer (
2 optimize,
3 constantFolding,
4 ) where
5
6 import HelVM.HelMA.Automaton.API.OptimizationLevel
7
8 import HelVM.HelMA.Automaton.Instruction
9
10 import HelVM.HelMA.Automaton.Optimizer.ConstantFoldingOptimizer
11 import HelVM.HelMA.Automaton.Optimizer.DeadCodeOptimizer
12 import HelVM.HelMA.Automaton.Optimizer.MarkRemovingOptimizer
13 import HelVM.HelMA.Automaton.Optimizer.PeepholeOptimizer
14
15 optimize :: OptimizationLevel -> InstructionList -> InstructionList
16 optimize NoOptimizations = id
17 optimize BasicOptimizations = constantFolding
18 optimize SomeOptimizations = deadCodeElimination . peepholeOptimize . constantFolding
19 optimize AllOptimizations = deadCodeElimination . peepholeOptimize . makrRemoving . constantFolding