diff src/mono_inline.sml @ 2214:edd634b889d0

Add mono_inline.sml (which was left out of last commit).
author Ziv Scully <ziv@mit.edu>
date Tue, 14 Oct 2014 18:07:09 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mono_inline.sml	Tue Oct 14 18:07:09 2014 -0400
@@ -0,0 +1,28 @@
+structure MonoInline = struct
+
+fun inlineFull file =
+    let
+        val oldInline = Settings.getMonoInline ()
+        val oldFull = !MonoReduce.fullMode
+    in
+        (Settings.setMonoInline (case Int.maxInt of
+                                     NONE => 1000000
+                                   | SOME n => n);
+         MonoReduce.fullMode := true;
+         let
+             val file = MonoReduce.reduce file
+             val file = MonoOpt.optimize file
+             val file = Fuse.fuse file
+             val file = MonoOpt.optimize file
+             val file = MonoShake.shake file
+         in
+             file
+         end before
+         (MonoReduce.fullMode := oldFull;
+          Settings.setMonoInline oldInline))
+        handle ex => (Settings.setMonoInline oldInline;
+                      MonoReduce.fullMode := oldFull;
+                      raise ex)
+    end
+
+end