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

SCM Repository

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

Diff of /branches/pure-cfg/src/compiler/low-il/low-opt.sml

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

revision 1159, Mon May 9 16:39:28 2011 UTC revision 1160, Mon May 9 16:39:57 2011 UTC
# Line 6  Line 6 
6    
7  structure LowOptimizer : sig  structure LowOptimizer : sig
8    
9        val controls : (string * bool ref) 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),
24                ("low-debug", debugFlag),
25                ("low-check", checkFlag)
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.1159  
changed lines
  Added in v.1160

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