module Peephole:sig
..end
typerewriting_rules =
(Utils.u2 * Instruction.t) list -> (Utils.u2 * Instruction.t) list
val optimize_constants : rewriting_rules
val optimize_locals : rewriting_rules
val avoid_conv : rewriting_rules
val remove_nops_and_unused_pushed_values : rewriting_rules
val optimize_iinc : rewriting_rules
val remove_load_store : rewriting_rules
val remove_get_put : rewriting_rules
val rewrite_store_store : rewriting_rules
val rewrite_store_load : rewriting_rules
val rewrite_load_load : rewriting_rules
val constant_on_the_top : rewriting_rules
val remove_neutral_elements : rewriting_rules
val rewrite_absorbing_elements : rewriting_rules
val apply_stength_reduction : rewriting_rules
val remove_identity : rewriting_rules
val all_rules : rewriting_rules list
optimize_constants
;optimize_locals
;remove_nops_and_unused_pushed_values
;optimize_iinc
;remove_load_store
;remove_get_put
;rewrite_store_store
;rewrite_store_load
;rewrite_load_load
;constant_on_the_top
;remove_neutral_elements
;rewrite_absorbing_elements
;apply_stength_reduction
;remove_identity
.type
position =
| |
Head |
(* | Insert rule at the list begin. | *) |
| |
Tail |
(* | Insert rule at the list end. | *) |
| |
Before of |
(* | Insert rule before specified one. | *) |
| |
After of |
(* | Insert rule before specified one. | *) |
val insert : rewriting_rules ->
position ->
rewriting_rules list -> rewriting_rules list
insert r p l
inserts rule r
into list l
at position p
,
using physical equality to compare rewriting rules.
Raises Not_found
if p
references rewriting rules not present in
the list.
val optimize_list : ?rules:rewriting_rules list ->
(Utils.u2 * Instruction.t) list -> (Utils.u2 * Instruction.t) list
optimize_list ~rules:l l2
optimizes l2
by applying the the list
of rewriting rules l
until a fixpoint is reached.
WARNING: offset are not rewritten, meaning that l2
should not
contain any jump instruction.
val optimize_graph : ?rules:rewriting_rules list ->
('a * Utils.u2 list, 'b) ControlFlow.graph ->
('a * Utils.u2 list, 'b) ControlFlow.graph
optimize_graph ~rules:l g
returns a graph similar to g
, except
that every instruction list has been optimized, l
being the list of
rewriting rules to apply to instruction lists (until a fixpoint is
reached).