19 |
where S = MLTreeComp.T.Stream |
where S = MLTreeComp.T.Stream |
20 |
where P = PseudoOps |
where P = PseudoOps |
21 |
where I = MLTreeComp.I |
where I = MLTreeComp.I |
22 |
|
structure Shuffle : SHUFFLE (* shuffling copies *) |
23 |
|
where I = MLTreeComp.I |
24 |
structure BackPatch : BBSCHED (* machine code emitter *) |
structure BackPatch : BBSCHED (* machine code emitter *) |
25 |
where F.P = PseudoOps |
where F.P = PseudoOps |
26 |
where F.I = Asm.I |
where F.I = Asm.I |
36 |
structure T = MLTreeComp.T |
structure T = MLTreeComp.T |
37 |
structure S = T.Stream |
structure S = T.Stream |
38 |
structure Asm = Asm |
structure Asm = Asm |
39 |
|
structure Shuffle = Shuffle |
40 |
structure MachSpec = MachSpec |
structure MachSpec = MachSpec |
41 |
structure MLTreeComp= MLTreeComp |
structure MLTreeComp= MLTreeComp |
42 |
|
|
43 |
val optimizerHook : (F.cluster -> F.cluster) option ref = ref NONE |
type mlriscPhase = string * (F.cluster -> F.cluster) |
44 |
|
|
45 |
fun phase x = Stats.doPhase (Stats.makePhase x) |
fun phase x = Stats.doPhase (Stats.makePhase x) |
46 |
|
fun makePhase(name,f) = (name, phase name f) |
47 |
|
|
48 |
fun opt cluster = |
val mc = phase "MLRISC BackPatch.bbsched" BackPatch.bbsched |
|
case !optimizerHook of |
|
|
SOME f => f cluster |
|
|
| NONE => cluster |
|
|
|
|
|
val ra = phase "MLRISC ra" RA.ra |
|
|
val opt = phase "MLRISC optimization" opt |
|
|
val bbsched = phase "MLRISC BackPatch.bbsched" BackPatch.bbsched |
|
49 |
val finish = phase "MLRISC BackPatch.finish" BackPatch.finish |
val finish = phase "MLRISC BackPatch.finish" BackPatch.finish |
50 |
|
val ra = phase "MLRISC ra" RA.ra |
51 |
|
|
52 |
|
val raPhase = ("ra",ra) |
53 |
|
val optimizerHook = ref [raPhase] |
54 |
|
|
55 |
(* Flowgraph generation *) |
(* Flowgraph generation *) |
56 |
structure FlowGraphGen = |
structure FlowGraphGen = |
67 |
) |
) |
68 |
|
|
69 |
fun compile cluster = |
fun compile cluster = |
70 |
let val cluster = opt cluster |
let fun runPhases([],cluster) = cluster |
71 |
val cluster = ra cluster |
| runPhases((_,f)::phases,cluster) = runPhases(phases,f cluster) |
72 |
in bbsched cluster end |
in mc(runPhases(!optimizerHook,cluster)) |
73 |
|
end |
74 |
|
|
75 |
(* compilation of CPS to MLRISC *) |
(* compilation of CPS to MLRISC *) |
76 |
structure MLTreeGen = |
structure MLTreeGen = |