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/ra/ra.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/ra/ra.sml

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

revision 576, Fri Mar 10 07:27:16 2000 UTC revision 733, Fri Nov 17 05:13:45 2000 UTC
# Line 132  Line 132 
132         val {build=buildMethod, spill=spillMethod, ...} = F.services flowgraph         val {build=buildMethod, spill=spillMethod, ...} = F.services flowgraph
133    
134         (* global spill location counter *)         (* global spill location counter *)
135         val spillLoc=ref ~256         (* Note: spillLoc cannot be zero as negative locations are
136            * returned to the client to indicate spill locations.
137            *)
138           val spillLoc=ref 1
139    
140         (* How to dump the flowgraph *)         (* How to dump the flowgraph *)
141         fun dumpFlowgraph(flag, title) =         fun dumpFlowgraph(flag, title) =
# Line 151  Line 154 
154             val regmap = F.regmap flowgraph (* the register map *)             val regmap = F.regmap flowgraph (* the register map *)
155    
156             (* the nodes table *)             (* the nodes table *)
157             val nodes  = Intmap.new(numCell,NodeTable)             val nodes  = IntHashTable.mkTable(numCell,NodeTable)
158             val mode   = if isOn(HAS_PARALLEL_COPIES, mode) then             val mode   = if isOn(HAS_PARALLEL_COPIES, mode) then
159                             Word.orb(Core.SAVE_COPY_TEMPS, mode)                             Word.orb(Core.SAVE_COPY_TEMPS, mode)
160                          else mode                          else mode
# Line 174  Line 177 
177                                    }                                    }
178             val G.GRAPH{spilledRegs, pseudoCount, spillFlag, ...} = G             val G.GRAPH{spilledRegs, pseudoCount, spillFlag, ...} = G
179    
180             val hasBeenSpilled = Intmap.mapWithDefault (spilledRegs,false)             fun hasBeenSpilled i =
181                   getOpt (IntHashTable.find spilledRegs i, false)
182    
183             fun logGraph(header,G) =             fun logGraph(header,G) =
184                 if !dump_graph then                 if !dump_graph then
# Line 193  Line 197 
197                 val worklists =                 val worklists =
198                     (Core.initWorkLists G) {moves=moves}                     (Core.initWorkLists G) {moves=moves}
199             in  (* if !count_dead then             in  (* if !count_dead then
200                    Intmap.app (fn (_,NODE{uses=ref [],...}) => dead := !dead + 1                    IntHashTable.appi (fn (_,NODE{uses=ref [],...}) => dead := !dead + 1
201                                 | _ => ()) nodes                                 | _ => ()) nodes
202                 else (); *)                 else (); *)
203                 logGraph("build",G);                 logGraph("build",G);
204                 if debug then                 if debug then
205                 let val G.GRAPH{bitMatrix=ref(G.BM{elems, ...}), ...} = G                 let val G.GRAPH{bitMatrix=ref(G.BM{elems, ...}), ...} = G
206                 in  print ("done: nodes="^Int.toString(Intmap.elems nodes)^                 in  print ("done: nodes="^
207                              Int.toString(IntHashTable.numItems nodes)^
208                            " edges="^Int.toString(!elems)^                            " edges="^Int.toString(!elems)^
209                            " moves="^Int.toString(length moves)^                            " moves="^Int.toString(length moves)^
210                            "\n")                            "\n")
# Line 245  Line 250 
250              * Mark spill nodes              * Mark spill nodes
251              *)              *)
252             fun markSpillNodes nodesToSpill =             fun markSpillNodes nodesToSpill =
253             let val marker = SPILLED(~1)             let val marker = SPILLED
254                 fun loop [] = ()                 fun loop [] = ()
255                   | loop(NODE{color, ...}::ns) = (color := marker; loop ns)                   | loop(NODE{color, ...}::ns) = (color := marker; loop ns)
256             in  loop nodesToSpill end             in  loop nodesToSpill end
# Line 255  Line 260 
260              *)              *)
261             fun markMemRegs [] = ()             fun markMemRegs [] = ()
262               | markMemRegs(NODE{number=r, color as ref(ALIASED               | markMemRegs(NODE{number=r, color as ref(ALIASED
263                            (NODE{color=ref(col as SPILLED c), ...})), ...}::ns) =                            (NODE{color=ref(col as MEMREG _), ...})), ...}::ns) =
264                  (if c >= 0 then color := col else ();                  (color := col;
265                   markMemRegs ns)                   markMemRegs ns)
266               | markMemRegs(_::ns) = markMemRegs ns               | markMemRegs(_::ns) = markMemRegs ns
267    
# Line 276  Line 281 
281                 val _ = if isOn(mode,SPILL_PROPAGATION+SPILL_COALESCING) then                 val _ = if isOn(mode,SPILL_PROPAGATION+SPILL_COALESCING) then
282                            Core.initMemMoves G                            Core.initMemMoves G
283                         else ()                         else ()
                (*  
                val spills = if isOn(mode,SPILL_PROPAGATION) then  
                                Core.spillPropagation G spills else spills  
                val _ = if isOn(mode,SPILL_COALESCING) then  
                           Core.spillCoalescing G spills else ()  
                val _ = if isOn(mode,SPILL_COLORING) then  
                           Core.spillColoring G spills else ()  
                val _ = if isOn(mode,SPILL_COALESCING+SPILL_PROPAGATION) then  
                           markMemRegs spills else ()  
                 *)  
284                 val _ = logGraph("actual spill",G);                 val _ = logGraph("actual spill",G);
285                 val {simplifyWkl,freezeWkl,moveWkl,spillWkl} =                 val {simplifyWkl,freezeWkl,moveWkl,spillWkl} =
286                      Core.initWorkLists G                      Core.initWorkLists G
# Line 373  Line 368 
368             end             end
369    
370             fun initSpillProh(from,to) =             fun initSpillProh(from,to) =
371             let val markAsSpilled = Intmap.add spilledRegs             let val markAsSpilled = IntHashTable.insert spilledRegs
372                 fun loop r =                 fun loop r =
373                     if r <= to then (markAsSpilled(r,true); loop(r+1)) else ()                     if r <= to then (markAsSpilled(r,true); loop(r+1)) else ()
374             in  loop from end             in  loop from end

Legend:
Removed from v.576  
changed lines
  Added in v.733

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