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

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

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

revision 578, Tue Mar 14 05:16:29 2000 UTC revision 579, Wed Mar 22 06:33:08 2000 UTC
# Line 92  Line 92 
92    val COMPUTE_SPAN        = 0wx4    val COMPUTE_SPAN        = 0wx4
93    val SAVE_COPY_TEMPS     = 0wx8    val SAVE_COPY_TEMPS     = 0wx8
94    val HAS_PARALLEL_COPIES = 0wx10    val HAS_PARALLEL_COPIES = 0wx10
95      val SPILL_COALESCING       = 0wx100
96      val SPILL_COLORING         = 0wx200
97      val SPILL_PROPAGATION      = 0wx400
98      val MEMORY_COALESCING      =
99          SPILL_COALESCING + SPILL_COLORING + SPILL_PROPAGATION
100    
101    
102    local    local
103    
# Line 339  Line 345 
345    
346    structure FZ = PriQueue    structure FZ = PriQueue
347       (type elem=node       (type elem=node
348        fun less(NODE{movecost=ref p1,...}, NODE{movecost=ref p2,...}) = p1 < p2        fun less(NODE{movecost=ref p1,...}, NODE{movecost=ref p2,...}) = p1 <= p2
349       )       )
350    structure MV = PriQueue    structure MV = PriQueue
351       (type elem=G.move       (type elem=G.move
352        fun less(MV{cost=p1,...}, MV{cost=p2,...}) = p1 > p2        fun less(MV{cost=p1,...}, MV{cost=p2,...}) = p1 >= p2
353       )       )
354    
355    type move_queue = MV.pri_queue    type move_queue = MV.pri_queue
# Line 705  Line 711 
711     *  2.  The freeze list may have duplicates     *  2.  The freeze list may have duplicates
712     *)     *)
713    fun iteratedCoalescingPhases    fun iteratedCoalescingPhases
714         (G as GRAPH{K, bitMatrix, spillFlag, trail, stamp,         (G as GRAPH{K, bitMatrix, spillFlag, trail, stamp, mode,
715                     pseudoCount, blockedCount, ...}) =                     pseudoCount, blockedCount, ...}) =
716    let val member = BM.member(!bitMatrix)    let val member = BM.member(!bitMatrix)
717        val addEdge = addEdge G        val addEdge = addEdge G
718        val show = show G        val show = show G
719          val memoryCoalescingOn = isOn(mode, MEMORY_COALESCING)
720    
721        val blocked = blockedCount        val blocked = blockedCount
722    
723        (*        (*
# Line 984  Line 992 
992                     * New comment: with spill propagation, it is necessary                     * New comment: with spill propagation, it is necessary
993                     * to keep track of the spilled program points.                     * to keep track of the spilled program points.
994                     *)                     *)
995           defsu := concat(!defsu, !defsv);           if memoryCoalescingOn then
996           usesu := concat(!usesu, !usesv);             (defsu := concat(!defsu, !defsv);
997                usesu := concat(!usesu, !usesv)
998               )
999             else ();
1000           case !ucol of           case !ucol of
1001             PSEUDO =>             PSEUDO =>
1002               (if !cntv > 0 then               (if !cntv > 0 then
# Line 1120  Line 1131 
1131                      | NODE{movecnt as ref c, degree, ...} => (* pseudo *)                      | NODE{movecnt as ref c, degree, ...} => (* pseudo *)
1132                          (movecnt := c - 1;                          (movecnt := c - 1;
1133                           if c = 1 andalso !degree < K then                           if c = 1 andalso !degree < K then
1134                             (blocked := !blocked - 1; elimMoves(mvs, you::simp))                             (blocked := !blocked - 1;
1135                                elimMoves(mvs, you::simp))
1136                           else                           else
1137                              elimMoves(mvs, simp)                              elimMoves(mvs, simp)
1138                          )                          )
# Line 1354  Line 1366 
1366        case spills of        case spills of
1367          [] => {spills=[]}          [] => {spills=[]}
1368        | spills =>        | spills =>
1369           (app (fn node as NODE{color,...} => color := PSEUDO) stack;          let fun undo [] = ()
1370                  | undo(NODE{color,...}::nodes) = (color := PSEUDO; undo nodes)
1371            in  undo stack;
1372            undoCoalesced (!trail);            undoCoalesced (!trail);
1373            trail := END;            trail := END;
1374            {spills=spills}            {spills=spills}
1375           )          end
1376    end    end
1377    
1378    (*    (*
# Line 1409  Line 1423 
1423            then ()            then ()
1424            else addSavings(u, {pinned=v, cost=cost + c + c})            else addSavings(u, {pinned=v, cost=cost + c + c})
1425        end        end
1426        fun computeSavings(MV{dst, src, cost, ...}) =        fun computeSavings [] = ()
1427            | computeSavings(MV{dst, src, cost, ...}::mvs) =
1428        let val src as NODE{number=u, color=cu, ...} = chase src        let val src as NODE{number=u, color=cu, ...} = chase src
1429            val dst as NODE{number=v, color=cv, ...} = chase dst            val dst as NODE{number=v, color=cv, ...} = chase dst
1430        in  case (!cu, !cv) of        in  case (!cu, !cv) of
1431              (SPILLED _, PSEUDO) => incSavings(v, u, cost)              (SPILLED _, PSEUDO) => incSavings(v, u, cost)
1432            | (PSEUDO, SPILLED _) => incSavings(u, v, cost)            | (PSEUDO, SPILLED _) => incSavings(u, v, cost)
1433            | _ => ()                | _ => ();
1434                  computeSavings mvs
1435        end        end
1436    in  app computeSavings (!memMoves);    in  computeSavings (!memMoves);
1437        fn node => #cost(savings node)        fn node => #cost(savings node)
1438    end    end
1439    

Legend:
Removed from v.578  
changed lines
  Added in v.579

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