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

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/scheduling/globalCP.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/scheduling/globalCP.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 695 - (download) (annotate)
Mon Aug 7 23:57:38 2000 UTC (18 years, 10 months ago) by leunga
File size: 938 byte(s)

   Stuff related to scheduling, SSA, x86, C-- and Moby.
   Tag: leunga-20000807-a-whole-bunch-of-stuff
functor GlobalCriticalPath
   (DDG : SCHEDULER_DDG) : SCHEDULING_RANKS where type edge = DDG.edge =
struct

   structure DDG = DDG
   structure I   = DDG.I
   structure G   = Graph
   structure A   = Array

   type edge = DDG.edge

   fun rank(DDG as G.GRAPH ddg) =
   let val N        = #capacity ddg ()
       val len      = A.array(N,0)
       val children = A.tabulate(N,fn i => length(#out_edges ddg i))
       fun process i =
       let fun g((i,j,DDG.EDGE{l,...})::es,n) = 
                 g(es,Int.max(A.sub(len,j) + l + 1,n))
             | g([],n) = n
       in  A.update(len,i,g(#out_edges ddg i,0))
       end 
       fun order((i,_),(j,_)) = 
           case Int.compare(A.sub(len,i),A.sub(len,j)) of
              EQUAL => A.sub(children,i) > A.sub(children,j)
           |  LESS  => false
           |  GREATER => true
   in  app process (rev (GraphTopsort.topsort DDG (map #1 (#nodes ddg ()))));
       order
   end

end

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