aboutsummaryrefslogtreecommitdiffhomepage
path: root/plugins/extraction/extract_env.ml
diff options
context:
space:
mode:
authorGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2014-03-05 20:18:58 +0100
committerGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2015-01-11 09:49:32 +0100
commit063fbe9077e6b75f327dd105774c3b3b77bda5c9 (patch)
tree8d0cf02c3bffe27073084f55b899db05461e1299 /plugins/extraction/extract_env.ml
parentd15d8cc0ce584a6d80d878faf84314c6712ccf69 (diff)
Extraction : some more support functions for a future "Extraction Compute"
Diffstat (limited to 'plugins/extraction/extract_env.ml')
-rw-r--r--plugins/extraction/extract_env.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/extraction/extract_env.ml b/plugins/extraction/extract_env.ml
index 791294902..a10d9904d 100644
--- a/plugins/extraction/extract_env.ml
+++ b/plugins/extraction/extract_env.ml
@@ -644,3 +644,16 @@ let extraction_library is_rec m =
in
List.iter print struc;
reset ()
+
+let structure_for_compute c =
+ init false false;
+ let env = Global.env () in
+ let ast, mlt = Extraction.extract_constr env c in
+ let ast = Mlutil.normalize ast in
+ let refs = ref Refset.empty in
+ let add_ref r = refs := Refset.add r !refs in
+ let () = ast_iter_references add_ref add_ref add_ref ast in
+ let refs = Refset.elements !refs in
+ let struc = optimize_struct (refs,[]) (mono_environment refs []) in
+ let flatstruc = List.map snd (List.flatten (List.map snd struc)) in
+ flatstruc, ast, mlt