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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3521 - (download) (annotate)
Sat Dec 19 16:43:35 2015 UTC (4 years, 2 months ago) by jhr
File size: 1394 byte(s)
working on merge
(* high-opt.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *
 * Optimization of the HighIR representation of Diderot terms.  The main
 * task of this phase is to statically resolve field definitions.
 *)

structure HighOptimizer : sig

    val optimize : HighIR.program -> HighIR.program

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

  end = struct

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

    val vnFlag = ref true		(* controls value numbering *)
    val debugFlag = ref true		(* controls printing *)
    val checkFlag = ref true		(* controls IR checking *)

    val checkAfter = Log.after {
	    dumpCtl = Ctl.dumpHighIR,
	    checkCtl = Ctl.checkHighIR,
	    output = HighPP.output,
	    checkIR = PhaseTimer.withTimer Timers.timeHighCheck (fn arg => CheckHigh.check arg)
	  }

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

    fun optimize prog = let
	  val prog = transform (Controls.get Ctl.highVN, Timers.timeHighVN, "value numbering", VN.transform, prog)
	  val prog = transform (true, Timers.timeHighNorm, "normalization", Normalize.transform, prog)
	  in
	    prog
	  end

  end

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