summaryrefslogtreecommitdiff
path: root/src/rewrites.ml
diff options
context:
space:
mode:
authorThomas Bauereiss2019-03-14 18:34:49 +0000
committerThomas Bauereiss2019-03-15 18:47:30 +0000
commite92ff6875925c2fe8b6ebc95a6b328514abc0106 (patch)
tree24ef95facd542364e9578ec55532ff9b84a96e53 /src/rewrites.ml
parent11325d9bb5f4117c5b41413ac523b7d50577ebdd (diff)
Add a rewriting pass for constant propagation in mutrecs
Propagating constants into mutually recursive calls and removing dead branches might break mutually recursive cycles. Also make constant propagation use the existing interpreter-based constant folding to evaluate function calls with only constant arguments (as opposed to a mixture of inlining and hard-coded rewrite rules).
Diffstat (limited to 'src/rewrites.ml')
-rw-r--r--src/rewrites.ml4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rewrites.ml b/src/rewrites.ml
index 34b9388d..8bfbc351 100644
--- a/src/rewrites.ml
+++ b/src/rewrites.ml
@@ -4688,9 +4688,11 @@ let rewrite_defs_lem = [
("fix_val_specs", rewrite_fix_val_specs);
("split_execute", rewrite_split_fun_ctor_pats "execute");
("recheck_defs", recheck_defs);
+ ("top_sort_defs", fun _ -> top_sort_defs);
+ ("const_prop_mutrec", Constant_propagation_mutrec.rewrite_defs);
+ ("rewrite_defs_vector_string_pats_to_bit_list", rewrite_defs_vector_string_pats_to_bit_list);
("exp_lift_assign", rewrite_defs_exp_lift_assign);
(* ("remove_assert", rewrite_defs_remove_assert); *)
- ("top_sort_defs", fun _ -> top_sort_defs);
(* ("sizeof", rewrite_sizeof); *)
("early_return", rewrite_defs_early_return);
("fix_val_specs", rewrite_fix_val_specs);