summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlasdair2019-02-21 23:15:15 +0000
committerAlasdair2019-02-21 23:18:23 +0000
commit084fb032de3495671d557e31dbc55dc8400f9d81 (patch)
treeda26657dd4d71173aa94c756d5877988846b3c4a /src
parent9c13d5888fdd12aa46f9a3b1a752cf040bc94939 (diff)
Allow monomorphisation with C generation
Run C tests with -O -Oconstant_fold -auto_mono
Diffstat (limited to 'src')
-rw-r--r--src/c_backend.ml2
-rw-r--r--src/rewrites.ml11
2 files changed, 13 insertions, 0 deletions
diff --git a/src/c_backend.ml b/src/c_backend.ml
index fd728111..3b289572 100644
--- a/src/c_backend.ml
+++ b/src/c_backend.ml
@@ -143,6 +143,8 @@ let rec ctyp_of_typ ctx typ =
| Typ_app (id, _) when string_of_id id = "atom_bool" -> CT_bool
+ | Typ_app (id, args) when string_of_id id = "itself" ->
+ ctyp_of_typ ctx (Typ_aux (Typ_app (mk_id "atom", args), l))
| Typ_app (id, _) when string_of_id id = "range" || string_of_id id = "atom" || string_of_id id = "implicit" ->
begin match destruct_range Env.empty typ with
| None -> assert false (* Checked if range type in guard *)
diff --git a/src/rewrites.ml b/src/rewrites.ml
index c78c9aee..f14d423c 100644
--- a/src/rewrites.ml
+++ b/src/rewrites.ml
@@ -5172,10 +5172,21 @@ let rewrite_defs_ocaml = [
let rewrite_defs_c = [
("no_effect_check", (fun _ defs -> opt_no_effects := true; defs));
+
+ (* Remove bidirectional mappings *)
("realise_mappings", rewrite_defs_realise_mappings);
("toplevel_string_append", rewrite_defs_toplevel_string_append);
("pat_string_append", rewrite_defs_pat_string_append);
("mapping_builtins", rewrite_defs_mapping_patterns);
+
+ (* Monomorphisation *)
+ ("mono_rewrites", if_mono mono_rewrites);
+ ("recheck_defs", if_mono recheck_defs);
+ ("rewrite_toplevel_nexps", if_mono rewrite_toplevel_nexps);
+ ("monomorphise", if_mono monomorphise);
+ ("rewrite_atoms_to_singletons", if_mono (fun _ -> Monomorphise.rewrite_atoms_to_singletons));
+ ("recheck_defs", if_mono recheck_defs);
+
("rewrite_undefined", rewrite_undefined_if_gen false);
("rewrite_defs_vector_string_pats_to_bit_list", rewrite_defs_vector_string_pats_to_bit_list);
("remove_not_pats", rewrite_defs_not_pats);