view 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 source
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