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 1640, Wed Nov 16 02:19:51 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 checkIL (phase, prog) =
29              if !checkFlag andalso CheckLowIL.check ("after " ^ phase, prog)
30                then (
31                  TextIO.output(TextIO.stdErr, concat[
32                      "***** Internal error after ", phase,
33                      ": see log file for details\n"
34                    ]);
35                  LowPP.output (Log.logFile(), "LowIL after " ^ phase, prog);
36                  OS.Process.exit OS.Process.failure)
37              else if !debugFlag
38                then (
39                  LowPP.output (Log.logFile(), "LowIL after " ^ phase, prog);
40                  prog)
41                else prog
42    
43        fun transform (ctl, phase, transform, prog) =
44              if !ctl
45                then checkIL (phase, transform prog)
46                else prog
47    
48        fun optimize prog = let
49              val prog = transform (vnFlag, "value numbering", VN.transform, prog)
50              in
51                prog
52              end
53    
54    end    end

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

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