Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/control/mlrisc-control.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/control/mlrisc-control.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 657 - (view) (download)

1 : monnier 245 signature MLRISC_CONTROL =
2 :     sig
3 :    
4 :     type cpu_time = {gc:Time.time,usr:Time.time,sys:Time.time}
5 :    
6 :     val mlrisc : bool ref (* use the MLRISC optimizer? *)
7 :     val mlrisc_phases : string list ref (* the optimization phases *)
8 :     val debug_stream : TextIO.outstream ref (* debugging output goes here *)
9 :    
10 :     (* Flags and counters *)
11 :     val counters : (string * int ref) list ref
12 :     val ints : (string * int ref) list ref
13 :     val flags : (string * bool ref) list ref
14 : leunga 657 val reals : (string * real ref) list ref
15 : monnier 245 val strings : (string * string ref) list ref
16 : monnier 411 val stringLists : (string * string list ref) list ref
17 : monnier 245 val timings : (string * cpu_time ref) list ref
18 :    
19 :     (* Functions to get these *)
20 :     val getCounter : string -> int ref
21 :     val getInt : string -> int ref
22 :     val getFlag : string -> bool ref
23 : leunga 657 val getReal : string -> real ref
24 : monnier 245 val getString : string -> string ref
25 : monnier 411 val getStringList : string -> string list ref
26 : monnier 245 val getTiming : string -> cpu_time ref
27 :     end
28 :    
29 : monnier 429 structure MLRiscControl : MLRISC_CONTROL =
30 : monnier 411 struct
31 : monnier 245 type cpu_time = {gc:Time.time,usr:Time.time,sys:Time.time}
32 :    
33 :     val mlrisc = ref false
34 :     val mlrisc_phases = ref [] : string list ref
35 :     val debug_stream = ref TextIO.stdOut
36 :    
37 :     val counters = ref [] : (string * int ref) list ref
38 :     val ints = ref [] : (string * int ref) list ref
39 : monnier 411 val flags = ref [("mlrisc",mlrisc)] : (string * bool ref) list ref
40 : leunga 657 val reals = ref [] : (string * real ref) list ref
41 : monnier 245 val strings = ref [] : (string * string ref) list ref
42 : monnier 411 val stringLists = ref [("mlrisc-phases",mlrisc_phases)]
43 :     : (string * string list ref) list ref
44 : monnier 245 val timings = ref [] : (string * cpu_time ref) list ref
45 :     local
46 : leunga 657 fun get(list,name : string,[],default) =
47 :     let val r = ref default in list := (name,r) :: !list; r end
48 :     | get(list,name,(n,r)::rest,default) =
49 :     if name = n then r else get(list,name,rest,default)
50 : monnier 245 in
51 : leunga 657 fun getCounter name = get(counters,name,!counters,0)
52 :     fun getInt name = get(ints,name,!ints,0)
53 :     fun getFlag name = get(flags,name,!flags,false)
54 :     fun getReal name = get(reals,name,!reals,0.0)
55 :     fun getString name = get(strings,name,!strings,"")
56 :     fun getStringList name = get(stringLists,name,!stringLists,[])
57 : monnier 245 fun getTiming name = get(timings,name,!timings,
58 : leunga 657 {gc =Time.zeroTime,
59 :     usr=Time.zeroTime,
60 :     sys=Time.zeroTime})
61 : monnier 245 end
62 : monnier 411
63 : monnier 245 end

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