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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/mid-il/mid-opt.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/mid-il/mid-opt.sml

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

revision 1232, Mon May 16 23:37:52 2011 UTC revision 1640, Wed Nov 16 02:19:51 2011 UTC
# Line 15  Line 15 
15    (* Value numbering for MidIL *)    (* Value numbering for MidIL *)
16      structure VN = ValueNumberingFn (DomTreeFn(MidIL))      structure VN = ValueNumberingFn (DomTreeFn(MidIL))
17    
18        val contractFlag = ref true         (* controls contraction *)
19      val vnFlag = ref true               (* controls value numbering *)      val vnFlag = ref true               (* controls value numbering *)
20      val debugFlag = ref true            (* controls printing *)      val debugFlag = ref true            (* controls printing *)
21      val checkFlag = ref true            (* controls IL checking *)      val checkFlag = ref true            (* controls IL checking *)
22    
23      val controls = [      val controls = [
24                ("mid-contract", contractFlag, "enable contraction for MidIL"),
25              ("mid-vn", vnFlag, "enable value-numbering for MidIL"),              ("mid-vn", vnFlag, "enable value-numbering for MidIL"),
26              ("mid-debug", debugFlag, "enable printing MidIL to log file [debug]"),              ("mid-debug", debugFlag, "enable printing MidIL to log file [debug]"),
27              ("mid-check", checkFlag, "enable consistency checking for MidIL [debug]")              ("mid-check", checkFlag, "enable consistency checking for MidIL [debug]")
28            ]            ]
29    
30      fun debugDump (phase, prog) = if !debugFlag      fun checkIL (phase, prog) =
31            then (            if !checkFlag andalso CheckMidIL.check ("after " ^ phase, prog)
             MidPP.output (Log.logFile(), "MidIL after " ^ phase, prog);  
             prog)  
           else prog  
   
     fun checkIL (phase, prog) = if !checkFlag  
           then if CheckMidIL.check ("after " ^ phase, prog)  
32              then (              then (
33                TextIO.output(TextIO.stdErr, concat[                TextIO.output(TextIO.stdErr, concat[
34                    "***** Internal error after ", phase,                    "***** Internal error after ", phase,
35                    ": see log file for details\n"                    ": see log file for details\n"
36                  ]);                  ]);
37                  MidPP.output (Log.logFile(), "MidIL after " ^ phase, prog);
38                OS.Process.exit OS.Process.failure)                OS.Process.exit OS.Process.failure)
39              else prog            else if !debugFlag
40                then (
41                  MidPP.output (Log.logFile(), "MidIL after " ^ phase, prog);
42                  prog)
43            else prog            else prog
44    
45      fun transform (ctl, phase, transform, prog) =      fun transform (ctl, phase, transform, prog) =
46            if !ctl            if !ctl
47              then checkIL (phase, debugDump(phase, transform prog))              then checkIL (phase, transform prog)
48              else prog              else prog
49    
50      fun optimize prog = let      fun optimize prog = let
51            val prog = transform (vnFlag, "value numbering", VN.transform, prog)            val prog = transform (vnFlag, "value numbering", VN.transform, prog)
52              val prog = transform (contractFlag, "contraction", MidContract.transform, prog)
53            in            in
54              prog              prog
55            end            end

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

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