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/compiler/CodeGen/cpscompile/spill.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/CodeGen/cpscompile/spill.sml

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

revision 732, Mon Nov 13 21:59:12 2000 UTC revision 733, Fri Nov 17 05:13:45 2000 UTC
# Line 153  Line 153 
153   ***************************************************************************)   ***************************************************************************)
154    
155  exception SpillCtyMap  exception SpillCtyMap
156  val ctymap : cty Intmap.intmap = Intmap.new(32,SpillCtyMap)  val ctymap : cty IntHashTable.hash_table = IntHashTable.mkTable(32,SpillCtyMap)
157  fun clearCtyMap() = Intmap.clear ctymap  fun clearCtyMap() = IntHashTable.clear ctymap
158  fun getty v = Intmap.mapWithDefault (ctymap,BOGt) v  fun getty v = getOpt (IntHashTable.find ctymap v, BOGt)
159  val addty = Intmap.add ctymap  val addty = IntHashTable.insert ctymap
160  fun copyLvar v = let val p = (LV.dupLvar v, getty v) in addty p; p end  fun copyLvar v = let val p = (LV.dupLvar v, getty v) in addty p; p end
161  fun floatP v = case (getty v) of FLTt => true | _ => false  fun floatP v = case (getty v) of FLTt => true | _ => false
162    
# Line 177  Line 177 
177  val _ = app2 addty (vl,cl)  val _ = app2 addty (vl,cl)
178  val freevars =  val freevars =
179   let exception SpillFreemap   let exception SpillFreemap
180       val m = Intmap.new(32, SpillFreemap) : lvar list Intmap.intmap       val m = IntHashTable.mkTable(32, SpillFreemap)
181       val _ = FreeMap.freemap (Intmap.add m) body               : lvar list IntHashTable.hash_table
182    in fn x => ((Intmap.map m x) handle SpillFreemap =>       val _ = FreeMap.freemap (IntHashTable.insert m) body
183      in fn x => ((IntHashTable.lookup m x) handle SpillFreemap =>
184                      (pr "compiler bugs in spill.sml:  ";                      (pr "compiler bugs in spill.sml:  ";
185                       (pr o Int.toString) x; pr "  \n";                       (pr o Int.toString) x; pr "  \n";
186                       raise SpillFreemap))                       raise SpillFreemap))
# Line 337  Line 338 
338  local  local
339    exception TooMany    exception TooMany
340    exception FloatSet    exception FloatSet
341    val floatset : bool Intmap.intmap = Intmap.new(32,FloatSet)    val floatset : bool IntHashTable.hash_table =
342    fun fltM(v,FLTt) = Intmap.add floatset (v,true)        IntHashTable.mkTable(32,FloatSet)
343      fun fltM(v,FLTt) = IntHashTable.insert floatset (v,true)
344      | fltM _ = ()      | fltM _ = ()
345    val fltP = Intmap.mapWithDefault (floatset,false)    fun fltP v = getOpt (IntHashTable.find floatset v, false)
346    fun clearSet() = Intmap.clear floatset    fun clearSet() = IntHashTable.clear floatset
347    val dummyM = fn _ => ()    val dummyM = fn _ => ()
348    val dummyP = fn _ => true    val dummyP = fn _ => true
349  in  in
# Line 394  Line 396 
396   *****************************************************************************)   *****************************************************************************)
397  fun improve cexp =  fun improve cexp =
398    let exception Spillmap    let exception Spillmap
399        val m : (int ref*int*value) Intmap.intmap = Intmap.new(32,Spillmap)        val m : (int ref*int*value) IntHashTable.hash_table =
400        val enter = Intmap.add m            IntHashTable.mkTable(32,Spillmap)
401        val lookup = Intmap.map m        val enter = IntHashTable.insert m
402          val lookup = IntHashTable.lookup m
403        fun get(VAR x) = (SOME(lookup x) handle Spillmap => NONE)        fun get(VAR x) = (SOME(lookup x) handle Spillmap => NONE)
404          | get _ = NONE          | get _ = NONE
405        fun kill(VAR v) = Intmap.rmv m v        fun kill(VAR v) = (ignore (IntHashTable.remove m v) handle _ => ())
406          | kill _ = ()          | kill _ = ()
407        fun use v = case get v of SOME(r as ref 0,i,w) => r := 1        fun use v = case get v of SOME(r as ref 0,i,w) => r := 1
408                                | SOME _ => kill v                                | SOME _ => kill v
# Line 437  Line 440 
440           | ARITH(i,vl,w,t,e) => ARITH(i,vl,w,t,g e)           | ARITH(i,vl,w,t,e) => ARITH(i,vl,w,t,g e)
441           | PURE(i,vl,w,t,e) => PURE(i,vl,w,t,g e)           | PURE(i,vl,w,t,e) => PURE(i,vl,w,t,g e)
442    
443        val count = (pass1 cexp; Intmap.elems m)        val count = (pass1 cexp; IntHashTable.numItems m)
444    
445        val _ = if (!CGoptions.debugcps) then        val _ = if (!CGoptions.debugcps) then
446                  (pr "count="; (pr o Int.toString) count; pr "\n")                  (pr "count="; (pr o Int.toString) count; pr "\n")

Legend:
Removed from v.732  
changed lines
  Added in v.733

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