Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis15/src/compiler/low-opt/low-opt.sml
ViewVC logotype

View of /branches/vis15/src/compiler/low-opt/low-opt.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4317 - (download) (annotate)
Sat Jul 30 14:12:14 2016 UTC (4 years, 2 months ago) by jhr
File size: 1357 byte(s)
working on merge: expand tabs to eight spaces
(* low-opt.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.
 *
 * Optimization of the LowIR representation of Diderot terms.
 *)

structure LowOptimizer : sig

    val optimize : LowIR.program -> LowIR.program

    val checkAfter : string * LowIR.program -> LowIR.program

  end = struct

  (* Value numbering for LowIR *)
    structure VN = ValueNumberingFn (DomTreeFn(LowIR))

    val checkAfter = Log.after {
            dumpCtl = Ctl.dumpLowIR,
            checkCtl = Ctl.checkLowIR,
            output = LowPP.output,
            checkIR = PhaseTimer.withTimer Timers.timeLowCheck (fn arg => CheckLow.check arg)
          }

    fun transform (ctl, timer, phase, transform, prog) =
          if Controls.get ctl
            then checkAfter (phase, PhaseTimer.withTimer timer transform prog)
            else prog

    fun optimize prog = let
          val prog = transform (Ctl.lowContract, Timers.timeLowContract, "contraction(1)", LowContract.transform, prog)
          val prog = transform (Ctl.lowVN, Timers.timeLowVN, "value numbering", VN.transform, prog)
          val prog = transform (Ctl.lowContract, Timers.timeLowContract, "contraction(2)", LowContract.transform, prog)
          in
            prog
          end

  end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0