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

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

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

revision 93, Tue May 12 21:56:22 1998 UTC revision 106, Thu May 28 21:30:17 1998 UTC
# Line 96  Line 96 
96    in map(l, [])    in map(l, [])
97    end    end
98    
   fun inc(counter, i) = counter := !counter + 1  
   
99                  (*---------printing------------ *)                  (*---------printing------------ *)
100    fun prList (l:int list,msg:string) = let    fun prList (l:int list,msg:string) = let
101        fun pr [] = print "\n"        fun pr [] = print "\n"
# Line 349  Line 347 
347      val _ = liveness blocks      val _ = liveness blocks
348      val initialMoves = mkInterferenceGraph()      val initialMoves = mkInterferenceGraph()
349      val initialWkls = mkInitialWorkLists initialMoves      val initialWkls = mkInitialWorkLists initialMoves
     val initialMoveCnt = length initialMoves    (* total number of moves *)  
     val movesCoalesced = ref 0                  (* number of moves coalesced *)  
   
350    
351      (* debugging *)      (* debugging *)
352      fun dumpGraph() = let      fun dumpGraph() = let
# Line 540  Line 535 
535                            | (x,y) => (x,y)                            | (x,y) => (x,y)
536              fun coalesceIt() =              fun coalesceIt() =
537                (status := COALESCED;                (status := COALESCED;
                inc(movesCoalesced, 1);  
538                 if !spillFlag then undoInfo := (v, status) :: (!undoInfo)                 if !spillFlag then undoInfo := (v, status) :: (!undoInfo)
539                 else ())                 else ())
540            in            in
# Line 1098  Line 1092 
1092              | _ => ())              | _ => ())
1093            nodes            nodes
1094        end        end
   
       fun lastOne(finish) = let  
         val mc = !movesCoalesced  
         (* getOut when all moves have been coalesced, or no moves  
          * have been coalesced. Since in theory this could iterate  
          * many times with no significant improvement , we should  
          * have a cut off, but I have never seen this behavior in  
          * practise.  
          *)     fun getOut () = initialMoveCnt = mc orelse mc = 0  
       in  
         if getOut() then finish()  
         else let  
             fun init(NODE{color, degree, adj, movecnt, movelist, ...}) =  
               (degree:=0; adj := []; movecnt:=0; movelist:=[]; color:=PSEUDO)  
           in  
             app init stack;  
             graphColoring(mode,blocks,cblocks,blockDU,prevSpills,nodes,regmap)  
           end  
         end  
   
1095      in      in
1096        case mode        case mode
1097        of COPY_PROPAGATION => lastOne(finishCP)        of COPY_PROPAGATION => finishCP()
1098         | REGISTER_ALLOCATION =>         | REGISTER_ALLOCATION =>
1099           if not(!spillFlag) then           (case optimistic(stack, [])
1100             (* If there were no Chaitin spills then there cannot be            of [] => finishRA()
             * any optimistic spills.  
             *)  
            lastOne(fn () => (optimistic(stack, []); finishRA()))  
          else (case optimistic(stack, [])  
            of [] => lastOne(finishRA)  
1101              | spills  =>              | spills  =>
1102                  (app (fn NODE{color, ...} => color := PSEUDO) stack;                  (app (fn NODE{color, ...} => color := PSEUDO) stack;
1103                   app undoCoalesced (!undoInfo);                   app undoCoalesced (!undoInfo);
# Line 1150  Line 1119 
1119      iterate (WKL initialWkls)      iterate (WKL initialWkls)
1120    end (* graphColoring *)    end (* graphColoring *)
1121    
   
1122    fun ra mode (cluster as (F.CLUSTER{blocks, regmap, ...})) =    fun ra mode (cluster as (F.CLUSTER{blocks, regmap, ...})) =
1123      if RaArch.numRegs() = 0 then cluster      if RaArch.numRegs() = 0 then cluster
1124      else let      else let
# Line 1217  Line 1185 
1185        end        end
1186  end (* functor *)  end (* functor *)
1187    
   
   
1188  (*  (*
1189   * $Log: ra.sml,v $   * $Log: ra.sml,v $
1190     * Revision 1.2  1998/05/08 10:54:01  george
1191     *   The exhausted register has been made optional -- leung
1192     *
1193   * Revision 1.1.1.1  1998/04/08 18:39:02  george   * Revision 1.1.1.1  1998/04/08 18:39:02  george
1194   * Version 110.5   * Version 110.5
1195   *   *

Legend:
Removed from v.93  
changed lines
  Added in v.106

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