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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/options/ctl.sml
ViewVC logotype

View of /branches/vis15/src/compiler/options/ctl.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3351 - (download) (annotate)
Wed Oct 28 16:14:29 2015 UTC (5 years, 1 month ago) by jhr
File size: 3456 byte(s)
  Working on merge.
(* ctl.sml
 *
 * Internal compiler controls.  These may be set from the command-line, but are
 * mainly meant to be used by the developers for debugging purposes.
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *)

structure Ctl =
  struct

    local
      structure C = Controls
    in
      val enableLog = C.genControl {
	      name = "log",
	      pri = [1, 1],
	      obscurity = 5,
	      help = "output compiler debugging message to a log file",
	      default = false
	  }
      val collectStats = C.genControl {
	      name = "stats",
	      pri = [1, 2],
	      obscurity = 5,
	      help = "collect and report statistics about optimizations, etc.",
	      default = false
	  }
      val dumpAST = C.genControl {
	      name = "dump-ast",
	      pri = [2, 1],
	      obscurity = 5,
	      help = "dump the AST to the log file",
	      default = false
	    }
      val dumpSimple = C.genControl {
	      name = "dump-simple",
	      pri = [2, 2],
	      obscurity = 5,
	      help = "dump the SimpleAST to the log file",
	      default = false
	    }
      val dumpHighIL = C.genControl {
	      name = "dump-high",
	      pri = [2, 3],
	      obscurity = 5,
	      help = "dump the HighIL to the log file",
	      default = false
	    }
      val dumpMidIl = C.genControl {
	      name = "dump-high",
	      pri = [2, 4],
	      obscurity = 5,
	      help = "dump the MidIL to the log file",
	      default = false
	    }
      val dumpLowIL = C.genControl {
	      name = "dump-low",
	      pri = [2, 5],
	      obscurity = 5,
	      help = "dump the LowIL to the log file",
	      default = false
	    }
      val dumpTreeIL = C.genControl {
	      name = "dump-tree",
	      pri = [2, 6],
	      obscurity = 5,
	      help = "dump the TreeIL to the log file",
	      default = false
	    }
      val checkAST = C.genControl {
	      name = "check-ast",
	      pri = [3, 1],
	      obscurity = 5,
	      help = "check the AST after typechecking",
	      default = false
	    }
      val checkSimple = C.genControl {
	      name = "check-simple",
	      pri = [3, 2],
	      obscurity = 5,
	      help = "check the SimpleAST",
	      default = false
	    }
      val checkHighIL = C.genControl {
	      name = "check-high",
	      pri = [3, 3],
	      obscurity = 5,
	      help = "check the HighIL",
	      default = false
	    }
      val checkMidIl = C.genControl {
	      name = "check-high",
	      pri = [3, 4],
	      obscurity = 5,
	      help = "check the MidIL",
	      default = false
	    }
      val checkLowIL = C.genControl {
	      name = "check-low",
	      pri = [3, 5],
	      obscurity = 5,
	      help = "check the LowIL",
	      default = false
	    }
      val checkTreeIL = C.genControl {
	      name = "check-tree",
	      pri = [3, 6],
	      obscurity = 5,
	      help = "check the TreeIL",
	      default = false
	    }

  (* after the controls have been set from the command line, we use this function
   * to enable logging if any of the dump or check options have been selected.
   *)
      fun resolve () = if not(C.get enableLog)
	    andalso List.exists C.get [
		dumpAST, dumpSimple, dumpHighIL, dumpMidIl, dumpLowIL, dumpTreeIL, 
		checkAST, checkSimple, checkHighIL, checkMidIl, checkLowIL, checkTreeIL
	      ]
	    then C.set (enableLog, true)
	    else ()

    end (* local *)
    
  end

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