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/branches/idlbasis-devel/src/MLRISC/control/mlrisc-control.sml
ViewVC logotype

Annotation of /sml/branches/idlbasis-devel/src/MLRISC/control/mlrisc-control.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)
Original Path: sml/trunk/src/MLRISC/control/mlrisc-control.sml

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 :     val strings : (string * string ref) list ref
15 : monnier 411 val stringLists : (string * string list ref) list ref
16 : monnier 245 val timings : (string * cpu_time ref) list ref
17 :    
18 :     (* Functions to get these *)
19 :     val getCounter : string -> int ref
20 :     val getInt : string -> int ref
21 :     val getFlag : string -> bool ref
22 :     val getString : string -> string ref
23 : monnier 411 val getStringList : string -> string list ref
24 : monnier 245 val getTiming : string -> cpu_time ref
25 :     end
26 :    
27 : monnier 429 structure MLRiscControl : MLRISC_CONTROL =
28 : monnier 411 struct
29 : monnier 245 type cpu_time = {gc:Time.time,usr:Time.time,sys:Time.time}
30 :    
31 :     val mlrisc = ref false
32 :     val mlrisc_phases = ref [] : string list ref
33 :     val debug_stream = ref TextIO.stdOut
34 :    
35 :     val counters = ref [] : (string * int ref) list ref
36 :     val ints = ref [] : (string * int ref) list ref
37 : monnier 411 val flags = ref [("mlrisc",mlrisc)] : (string * bool ref) list ref
38 : monnier 245 val strings = ref [] : (string * string ref) list ref
39 : monnier 411 val stringLists = ref [("mlrisc-phases",mlrisc_phases)]
40 :     : (string * string list ref) list ref
41 : monnier 245 val timings = ref [] : (string * cpu_time ref) list ref
42 :     local
43 : monnier 411 fun get(list,name : string,[],new) =
44 :     let val r = new() in list := (name,r) :: !list; r end
45 :     | get(list,name,(n,r)::rest,new) =
46 :     if name = n then r else get(list,name,rest,new)
47 : monnier 245 in
48 :     fun getCounter name = get(counters,name,!counters,fn() => ref 0)
49 :     fun getInt name = get(ints,name,!ints,fn() => ref 0)
50 :     fun getFlag name = get(flags,name,!flags,fn() => ref false)
51 :     fun getString name = get(strings,name,!strings,fn() => ref "")
52 : monnier 411 fun getStringList name = get(stringLists,name,!stringLists,
53 :     fn() => ref [])
54 : monnier 245 fun getTiming name = get(timings,name,!timings,
55 :     fn() => ref {gc =Time.zeroTime,
56 :     usr=Time.zeroTime,
57 :     sys=Time.zeroTime})
58 :     end
59 : monnier 411
60 : monnier 245 end

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