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

SCM Repository

[smlnj] Diff of /sml/trunk/src/MLRISC/Glue/mlrisc-ssa-optimizer.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/Glue/mlrisc-ssa-optimizer.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 410, Fri Sep 3 00:25:03 1999 UTC revision 429, Wed Sep 8 09:47:00 1999 UTC
# Line 4  Line 4 
4    
5  functor SSAOptimizerFn  functor SSAOptimizerFn
6     (structure Asm : INSTRUCTION_EMITTER     (structure Asm : INSTRUCTION_EMITTER
7        structure MLTreeComp : MLTREECOMP
8      structure F  : FLOWGRAPH      structure F  : FLOWGRAPH
9      structure P  : INSN_PROPERTIES      structure P  : INSN_PROPERTIES
10      structure SP : SSA_PROPERTIES      structure SP : SSA_PROPERTIES
11        structure GCP : GC_PROPERTIES
12      structure FreqProps : FREQUENCY_PROPERTIES      structure FreqProps : FREQUENCY_PROPERTIES
13         sharing P.I = SP.I = Asm.I = F.I = FreqProps.I         sharing P.I = SP.I = GCP.I = Asm.I = F.I = FreqProps.I = MLTreeComp.I
14         sharing F.P = Asm.P         sharing F.P = Asm.P = MLTreeComp.T.PseudoOp
15      val copyProp : F.cluster -> F.cluster         sharing MLTreeComp.T.BNames = F.B
16           sharing MLTreeComp.T.Constant = F.I.Constant
17        val callgc : { id     : int,
18                       label  : Label.label,
19                       roots  : (P.I.C.cell * GCP.GC.gctype) list,
20                       stream : (MLTreeComp.T.stm,P.I.C.regmap) MLTreeComp.T.stream
21                     } -> unit
22     ) : SSA_OPTIMIZER =     ) : SSA_OPTIMIZER =
23  struct  struct
24    
25     structure F = F     structure F = F
26     structure I = F.I     structure I = F.I
27     structure B = F.B     structure B = F.B
    structure Ctrl = MLRISC_Control  
28    
29     val view_IR    = Ctrl.getFlag "view-IR"     val view_IR    = MLRiscControl.getFlag "view-IR"
30     val verbose    = Ctrl.getFlag "verbose"     val verbose    = MLRiscControl.getFlag "verbose"
31     val viewer     = Ctrl.getString "viewer"     val viewer     = MLRiscControl.getString "viewer"
32     val min_blocks = Ctrl.getInt "min-blocks"     val min_blocks = MLRiscControl.getInt "min-blocks"
33    
34     fun error msg = MLRiscErrorMsg.error("SSAOptimizer",msg)     fun error msg = MLRiscErrorMsg.error("SSAOptimizer",msg)
35    
# Line 36  Line 43 
43         structure P = F.P         structure P = F.P
44         structure GraphImpl = DirectedGraph         structure GraphImpl = DirectedGraph
45         structure Asm = Asm         structure Asm = Asm
46         structure Ctrl = Ctrl        )
47    
48       structure Util = CFGUtilFn
49          (structure CFG = CFG
50           structure P   = P
51        )        )
52    
53     structure CFG2Cluster = CFG2ClusterFn     structure CFG2Cluster = CFG2ClusterFn
# Line 46  Line 57 
57    
58     structure Cluster2CFG = Cluster2CFGFn     structure Cluster2CFG = Cluster2CFGFn
59        (structure CFG = CFG        (structure CFG = CFG
60           structure Util = Util
61         structure F   = F         structure F   = F
62         structure P   = P         structure P   = P
63        )        )
# Line 62  Line 74 
74         structure GraphImpl = DirectedGraph         structure GraphImpl = DirectedGraph
75        )        )
76    
    structure Util = CFGUtilFn  
       (structure CFG = CFG  
        structure P   = P  
       )  
   
77     structure IR = MLRISC_IRFn     structure IR = MLRISC_IRFn
78        (structure CFG         = CFG        (structure CFG         = CFG
79         structure CDG         = CDG         structure CDG         = CDG
80         structure Loop        = Loop         structure Loop        = Loop
81         structure GraphViewer = GraphViewer         structure GraphViewer = GraphViewer
82         structure Util        = Util         structure Util        = Util
        structure Ctrl        = Ctrl  
83        )        )
84    
85     structure Guess = StaticBranchPredictionFn(structure IR = IR     structure Guess = StaticBranchPredictionFn(structure IR = IR
# Line 91  Line 97 
97         structure RTL  = SP.RTL         structure RTL  = SP.RTL
98         structure FormatInsn = FormatInsn         structure FormatInsn = FormatInsn
99         structure GraphImpl = DirectedGraph         structure GraphImpl = DirectedGraph
        structure Ctrl = Ctrl  
100        )        )
101    
102     structure CFG2SSA = CFG2SSAFn     structure CFG2SSA = CFG2SSAFn
# Line 103  Line 108 
108                                           structure P  = P)                                           structure P  = P)
109    
110     structure InsertPreheaders = InsertPreheadersFn(structure IR = IR     structure InsertPreheaders = InsertPreheadersFn(structure IR = IR
111                                                     structure P  = P                                                     structure P  = P)
                                                    structure Ctrl = Ctrl)  
112    
113     structure SSADCE = SSADeadCodeElimFn(SSA)     structure SSADCE = SSADeadCodeElimFn(SSA)
114    
# Line 135  Line 139 
139         structure Liveness = SSALiveness         structure Liveness = SSALiveness
140         structure P        = P         structure P        = P
141         structure Util     = Util         structure Util     = Util
142         structure Ctrl     = Ctrl        )
143    
144       structure GCTyping = GCTyping
145          (structure IR = IR
146           structure GCProps = GCP
147           structure Props = P
148          )
149    
150       structure GCGen = GCGen
151          (structure MLTreeComp = MLTreeComp
152           structure IR = IR
153           structure GC = GCP.GC
154           structure InsnProps = P
155        )        )
156    
157     fun view phase ir = if !view_IR then IR.view phase ir else ()     fun view phase ir = if !view_IR then IR.view phase ir else ()
# Line 144  Line 160 
160     let datatype rep = IR of IR.IR     let datatype rep = IR of IR.IR
161                      | CLUSTER of F.cluster                      | CLUSTER of F.cluster
162                      | SSA of SSA.ssa                      | SSA of SSA.ssa
163         fun doPhase "copy-prop" (CLUSTER c) = CLUSTER(copyProp c)         fun doPhase "cluster->cfg" (CLUSTER c) = IR(Cluster2CFG.cluster2cfg c)
          | doPhase "cluster->cfg" (CLUSTER c) = IR(Cluster2CFG.cluster2cfg c)  
164           | doPhase "cfg->cluster" (IR cfg) =           | doPhase "cfg->cluster" (IR cfg) =
165              CLUSTER(CFG2Cluster.cfg2cluster{cfg=cfg,relayout=false})              CLUSTER(CFG2Cluster.cfg2cluster{cfg=cfg,relayout=false})
166           | doPhase "guess" (r as IR ir) =           | doPhase "guess" (r as IR ir) =
# Line 175  Line 190 
190           | doPhase "gvn"       (r as SSA ssa) =           | doPhase "gvn"       (r as SSA ssa) =
191                (GVN.computeValueNumbers ssa; r)                (GVN.computeValueNumbers ssa; r)
192           | doPhase "ssa->cfg"  (SSA ssa) = IR(SSA2CFG.buildCFG ssa)           | doPhase "ssa->cfg"  (SSA ssa) = IR(SSA2CFG.buildCFG ssa)
193             | doPhase "gc-typing" (r as IR ir) = (GCTyping.gcTyping ir; r)
194             | doPhase "gc-gen"    (r as IR ir) =
195                  (GCGen.gcGen{callgc=callgc} ir; r)
196           | doPhase phase _ = error(phase)           | doPhase phase _ = error(phase)
197    
198         fun doPhases [] (CLUSTER c) = c         fun doPhases [] (CLUSTER c) = c
199           | doPhases [] _ = error "cluster needed"           | doPhases [] _ = error "cluster needed"
200           | doPhases (phase::phases) ir =           | doPhases (phase::phases) ir =
# Line 202  Line 221 
221           (true,_) => cluster           (true,_) => cluster
222         | (false,n) =>         | (false,n) =>
223           if n >= !min_blocks then           if n >= !min_blocks then
224              doPhases (!Ctrl.mlrisc_phases) (CLUSTER cluster)              doPhases (!MLRiscControl.mlrisc_phases) (CLUSTER cluster)
225           else           else
226              cluster              cluster
227     end     end
228    
229     fun codegen cluster = if !Ctrl.mlrisc then optimize cluster else cluster     fun codegen cluster =
230           if !MLRiscControl.mlrisc then optimize cluster else cluster
231    
232  end  end

Legend:
Removed from v.410  
changed lines
  Added in v.429

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