Home My Page Projects Code Snippets Project Openings 3D graphics for Standard ML
Summary Activity SCM

SCM Repository

[sml3d] View of /trunk/sml3d/src/particles/compiler/optimizer.sml
ViewVC logotype

View of /trunk/sml3d/src/particles/compiler/optimizer.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1140 - (download) (annotate)
Mon May 2 06:00:36 2011 UTC (8 years, 4 months ago) by pavelk
File size: 1224 byte(s)
Fixed a few bugs. Namely, figured out how to get state passed through expression translation. Also made unused variable optimization better by eliminating block arguments if we weren't using them.
(* optimizer.sml
 * COPYRIGHT (c) 2011 John Reppy (http://cs.uchicago.edu/~jhr)
 * All rights reserved.

structure Optimize : sig

   val optimizeIR : PSysIR.program -> PSysIR.program

 end = struct

  val gProgramChanged = ref false
  fun printErr s = TextIO.output(TextIO.stdErr, s ^ "\n")

  structure IR = PSysIR

  val optimizations = [
    (* We want to run this optimization first since this is the only
     * optimization that will actually affect the control flow of the
     * program (from block to block). Hence, it will not only change any
     * of the other optimizations that happen within blocks, but also will
     * produce the same results regardless of when we run it. In order to
     * maximize the results of the rest of the optimizations, it's best to
     * do it first. *)
  fun optimizeIR(inPgm) = (List.foldl (fn(opt, pgm) => opt pgm) inPgm optimizations)
 end (* structure *)

ViewVC Help
Powered by ViewVC 1.0.0