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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 3775 - (download) (annotate)
Tue Apr 26 20:55:36 2016 UTC (4 years, 11 months ago) by jhr
File size: 1425 byte(s)
  Working on border control support for merge
(* mid-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 MidIR representation of Diderot terms.  The main
 * task of this phase is to statically resolve field definitions.

structure MidOptimizer : sig

    val optimize : MidIR.program -> MidIR.program

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

  end = struct

  (* Value numbering for MidIR *)
    structure VN = ValueNumberingFn (DomTree)

    val checkAfter = Log.after {
	    dumpCtl = Ctl.dumpMidIR,
	    checkCtl = Ctl.checkMidIR,
	    output = MidPP.output,
	    checkIR = PhaseTimer.withTimer Timers.timeMidCheck (fn arg => CheckMid.check arg)

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

    fun transform' (timer, phase, transform, prog) =
	  checkAfter (phase, PhaseTimer.withTimer timer transform prog)

    fun optimize prog = let
	  val prog = transform (Ctl.midVN, Timers.timeMidVN, "value numbering", VN.transform, prog)
	  val prog = transform (Ctl.midContract, Timers.timeMidContract, "contraction", MidContract.transform, prog)
	  val prog = transform' (Timers.timeMidBorderCtl, "border control", BorderCtl.transform, prog)


ViewVC Help
Powered by ViewVC 1.0.0