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

SCM Repository

[diderot] Diff of /trunk/src/compiler/low-il/low-opt.sml
ViewVC logotype

Diff of /trunk/src/compiler/low-il/low-opt.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1115, Thu May 5 04:42:18 2011 UTC revision 1232, Mon May 16 23:37:52 2011 UTC
# Line 6  Line 6 
6    
7  structure LowOptimizer : sig  structure LowOptimizer : sig
8    
9        val controls : (string * bool ref * string) list
10    
11      val optimize : LowIL.program -> LowIL.program      val optimize : LowIL.program -> LowIL.program
12    
13    end = struct    end = struct
14    
15      fun optimize prog = prog    (* Value numbering for LowIL *)
16        structure VN = ValueNumberingFn (DomTreeFn(LowIL))
17    
18        val vnFlag = ref true               (* controls value numbering *)
19        val debugFlag = ref true            (* controls printing *)
20        val checkFlag = ref true            (* controls IL checking *)
21    
22        val controls = [
23                ("low-vn", vnFlag, "enable value-numbering for LowIL"),
24                ("low-debug", debugFlag, "enable printing LowIL to log file [debug]"),
25                ("low-check", checkFlag, "enable consistency checking for LowIL [debug]")
26              ]
27    
28        fun debugDump (phase, prog) = if !debugFlag
29              then (
30                LowPP.output (Log.logFile(), "LowIL after " ^ phase, prog);
31                prog)
32              else prog
33    
34        fun checkIL (phase, prog) = if !checkFlag
35              then if CheckLowIL.check ("after " ^ phase, prog)
36                then (
37                  TextIO.output(TextIO.stdErr, concat[
38                      "***** Internal error after ", phase,
39                      ": see log file for details\n"
40                    ]);
41                  OS.Process.exit OS.Process.failure)
42                else prog
43              else prog
44    
45        fun transform (ctl, phase, transform, prog) =
46              if !ctl
47                then checkIL (phase, debugDump(phase, transform prog))
48                else prog
49    
50        fun optimize prog = let
51              val prog = transform (vnFlag, "value numbering", VN.transform, prog)
52              in
53                prog
54              end
55    
56    end    end

Legend:
Removed from v.1115  
changed lines
  Added in v.1232

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