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

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

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

revision 575, Fri Mar 10 02:55:58 2000 UTC revision 576, Fri Mar 10 07:27:16 2000 UTC
# Line 139  Line 139 
139    (* Create a new interference graph *)    (* Create a new interference graph *)
140    fun newGraph{nodes,regmap,K,firstPseudoR,dedicated,spillLoc,    fun newGraph{nodes,regmap,K,firstPseudoR,dedicated,spillLoc,
141                 getreg,getpair,showReg,maxRegs,numRegs,proh,                 getreg,getpair,showReg,maxRegs,numRegs,proh,
142                 firstMemReg, numMemRegs,mode} =                 memRegs,mode} =
143    let (* lower triangular bitmatrix primitives *)    let (* lower triangular bitmatrix primitives *)
144        (* NOTE: The average ratio of E/N is about 16 *)        (* NOTE: The average ratio of E/N is about 16 *)
145        val bitMatrix = newBitMatrix{edges=numRegs * 16,maxRegs=maxRegs()}        val bitMatrix = newBitMatrix{edges=numRegs * 16,maxRegs=maxRegs()}
146    
147        (* Make memory register nodes *)        (* Make memory register nodes *)
148        fun makeMemRegs(_, 0) = []        fun makeMemRegs [] = []
149          | makeMemRegs(reg, n) =          | makeMemRegs(ranges) =
150            let val add = Intmap.add nodes            let val add = Intmap.add nodes
151                fun loop(r, 0, ns) = ns                fun loop(from, to, ns) =
152                  | loop(r, n, ns) =                    if from > to then ns
153                      else
154                    let val node =                    let val node =
155                        NODE{pri=ref 0,adj=ref [],degree=ref 0,movecnt=ref 0,                        NODE{pri=ref 0,adj=ref [],degree=ref 0,movecnt=ref 0,
156                             color=ref(SPILLED r), defs=ref [], uses=ref [],                             color=ref(SPILLED from), defs=ref [], uses=ref [],
157                             movecost=ref 0,movelist=ref [], number=r}                             movecost=ref 0,movelist=ref [], number=from}
158                    in  add(r, node); loop(r+1, n-1, node::ns)                    in  add(from, node); loop(from+1, to, node::ns)
159                    end                    end
160            in  loop(reg, n, [])                fun loop2([], ns) = ns
161                    | loop2((from,to)::ranges, ns) = loop2(ranges, loop(from,to,ns))
162              in  loop2(ranges, [])
163            end            end
164    
165        val memRegs = makeMemRegs(firstMemReg, numMemRegs)        val memRegs = makeMemRegs memRegs
166    
167    in  if !stampCounter > 10000000 then stampCounter := 0 else ();    in  if !stampCounter > 10000000 then stampCounter := 0 else ();
168        GRAPH{ bitMatrix    = ref bitMatrix,        GRAPH{ bitMatrix    = ref bitMatrix,

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

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