55 |
(structure CFG = CFG |
(structure CFG = CFG |
56 |
structure Shuffle = Shuffle) |
structure Shuffle = Shuffle) |
57 |
|
|
58 |
|
structure BlockPlacement = |
59 |
|
BlockPlacement |
60 |
|
(structure CFG = CFG |
61 |
|
structure Props = InsnProps) |
62 |
|
|
63 |
|
structure JumpChaining = |
64 |
|
JumpChainElimFn |
65 |
|
(structure CFG = CFG |
66 |
|
structure InsnProps = InsnProps) |
67 |
|
|
68 |
|
structure InvokeGC = |
69 |
|
InvokeGC |
70 |
|
(structure C = CpsRegs |
71 |
|
structure MS = MachSpec |
72 |
|
structure CFG = CFG |
73 |
|
structure TS = MLTreeComp.TS |
74 |
|
) |
75 |
|
|
76 |
fun omitFramePointer(cfg as G.GRAPH graph) = let |
fun omitFramePointer(cfg as G.GRAPH graph) = let |
77 |
val CFG.INFO{annotations, ...} = #graph_info graph |
val CFG.INFO{annotations, ...} = #graph_info graph |
78 |
in |
in |
89 |
fun makePhase(name,f) = (name, phase name f) |
fun makePhase(name,f) = (name, phase name f) |
90 |
|
|
91 |
val mc = phase "MLRISC BackPatch.bbsched" BackPatch.bbsched |
val mc = phase "MLRISC BackPatch.bbsched" BackPatch.bbsched |
92 |
|
val placement = phase "MLRISC Block placement" BlockPlacement.blockPlacement |
93 |
|
val chainJumps = phase "MLRISC Jump chaining" JumpChaining.run |
94 |
val finish = phase "MLRISC BackPatch.finish" BackPatch.finish |
val finish = phase "MLRISC BackPatch.finish" BackPatch.finish |
95 |
val ra = phase "MLRISC ra" RA.run |
val ra = phase "MLRISC ra" RA.run |
96 |
val omitfp = phase "MLRISC omit frame pointer" omitFramePointer |
val omitfp = phase "MLRISC omit frame pointer" omitFramePointer |
98 |
|
|
99 |
val raPhase = ("ra",ra) |
val raPhase = ("ra",ra) |
100 |
|
|
|
|
|
101 |
val optimizerHook = |
val optimizerHook = |
102 |
ref [("ra", ra), |
ref [("ra", ra), |
103 |
("omitfp", omitfp), |
("omitfp", omitfp), |
104 |
("expand copies", expandCpys) |
("expand copies", expandCpys) |
105 |
] |
] |
106 |
|
|
107 |
|
fun compile cluster = let |
108 |
(* Flowgraph generation *) |
fun runPhases([],cluster) = cluster |
|
structure FlowGraphGen = |
|
|
BuildFlowgraph( |
|
|
structure CFG = CFG |
|
|
structure Props = InsnProps |
|
|
structure Stream = MLTreeComp.TS.S) |
|
|
|
|
|
(* GC Invocation *) |
|
|
structure InvokeGC = |
|
|
InvokeGC(structure C = CpsRegs |
|
|
structure MS = MachSpec |
|
|
structure CFG = CFG |
|
|
structure TS = MLTreeComp.TS |
|
|
) |
|
|
|
|
|
fun compile cluster = |
|
|
let fun runPhases([],cluster) = cluster |
|
109 |
| runPhases((_,f)::phases,cluster) = runPhases(phases,f cluster) |
| runPhases((_,f)::phases,cluster) = runPhases(phases,f cluster) |
110 |
in mc(runPhases(!optimizerHook,cluster)) |
|
111 |
|
fun dumpBlocks cfg = mc (chainJumps (placement cfg)) |
112 |
|
in |
113 |
|
dumpBlocks (runPhases(!optimizerHook,cluster)) |
114 |
end |
end |
115 |
|
|
116 |
(* compilation of CPS to MLRISC *) |
(* compilation of CPS to MLRISC *) |
117 |
structure MLTreeGen = |
structure MLTreeGen = |
118 |
MLRiscGen(structure MachineSpec=MachSpec |
MLRiscGen |
119 |
|
(structure MachineSpec=MachSpec |
120 |
structure MLTreeComp=MLTreeComp |
structure MLTreeComp=MLTreeComp |
121 |
structure Ext = Ext |
structure Ext = Ext |
122 |
structure C=CpsRegs |
structure C=CpsRegs |
|
structure InvokeGC=InvokeGC |
|
123 |
structure ClientPseudoOps =ClientPseudoOps |
structure ClientPseudoOps =ClientPseudoOps |
124 |
structure PseudoOp=PseudoOps |
structure PseudoOp=PseudoOps |
125 |
structure Flowgen=FlowGraphGen |
structure InvokeGC=InvokeGC |
126 |
|
structure Flowgen= |
127 |
|
BuildFlowgraph |
128 |
|
(structure CFG = CFG |
129 |
|
structure Props = InsnProps |
130 |
|
structure Stream = MLTreeComp.TS.S |
131 |
|
) |
132 |
structure CCalls = CCalls |
structure CCalls = CCalls |
133 |
structure Cells = Cells |
structure Cells = Cells |
134 |
val compile = compile |
val compile = compile |
144 |
BackPatch.cleanUp(); |
BackPatch.cleanUp(); |
145 |
gen x |
gen x |
146 |
) |
) |
|
|
|
147 |
end |
end |