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

Diff of /sml/trunk/src/MLRISC/ra/chaitin-spillheur.sml

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

revision 651, Thu Jun 1 18:34:03 2000 UTC revision 744, Fri Dec 8 04:11:42 2000 UTC
# Line 11  Line 11 
11    
12     exception NoCandidate     exception NoCandidate
13    
    (*  
     * This dummy node is used during spilling.  
     *)  
    val dummyNode = NODE{pri=ref 0,adj=ref [],degree=ref 0,movecnt=ref 0,  
                         color=ref PSEUDO, defs=ref [], uses=ref [],  
                         movecost=ref 0,movelist=ref [], number= ~1}  
   
14     val mode = RACore.NO_OPTIMIZATION     val mode = RACore.NO_OPTIMIZATION
15    
16     fun init() = ()     fun init() = ()
# Line 58  Line 51 
51                        | _ => cost()                        | _ => cost()
52                 in  if cost < lowestCost andalso not(hasBeenSpilled number)                 in  if cost < lowestCost andalso not(hasBeenSpilled number)
53                     then                     then
54                       if lowestCost >= infiniteCost then (* not a real node *)                       (case best of
55                          chaitin(rest, node, cost, spillWkl)                          NONE => chaitin(rest, SOME node, cost, spillWkl)
56                       else                        | SOME best =>
57                          chaitin(rest, node, cost, best::spillWkl)                            chaitin(rest, SOME node, cost, best::spillWkl)
58                         )
59                     else                     else
60                       chaitin(rest, best, lowestCost, node::spillWkl)                       chaitin(rest, best, lowestCost, node::spillWkl)
61                 end                 end
# Line 72  Line 66 
66          (* val _ = print("["^Int.toString(length spillWkl)^"]") *)          (* val _ = print("["^Int.toString(length spillWkl)^"]") *)
67    
68          val (potentialSpillNode, cost, newSpillWkl) =          val (potentialSpillNode, cost, newSpillWkl) =
69               chaitin(spillWkl, dummyNode, infiniteCost, [])               chaitin(spillWkl, NONE, infiniteCost, [])
70      in  case (potentialSpillNode, newSpillWkl) of      in  case (potentialSpillNode, newSpillWkl) of
71            (NODE{number= ~1, ...}, []) => {node=NONE, cost=cost, spillWkl=[]}            (NONE, []) => {node=NONE, cost=cost, spillWkl=[]}
72          | (NODE{number= ~1, ...}, _) => raise NoCandidate          | (NONE, _) => raise NoCandidate
73          | (node, spillWkl) => {node=SOME node, cost=cost, spillWkl=spillWkl}          | (SOME node, spillWkl) =>
74                  {node=SOME node, cost=cost, spillWkl=spillWkl}
75      end      end
76  end  end

Legend:
Removed from v.651  
changed lines
  Added in v.744

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