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/FLINT/main/literals.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/FLINT/main/literals.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 204  Line 204 
204  (* lifting all literals from a CPS program *)  (* lifting all literals from a CPS program *)
205  fun liftlits (body, root, offset) =  fun liftlits (body, root, offset) =
206    let (* the list of record, string, or real constants *)    let (* the list of record, string, or real constants *)
207        val m : info Intmap.intmap = Intmap.new(32, LitInfo)        val m : info IntHashTable.hash_table = IntHashTable.mkTable(32, LitInfo)
208        val freevars : lvar list ref = ref []        val freevars : lvar list ref = ref []
209        fun addv x = (freevars := (x :: (!freevars)))        fun addv x = (freevars := (x :: (!freevars)))
210    
# Line 214  Line 214 
214        val isUsed : lvar -> bool = Intset.mem refset        val isUsed : lvar -> bool = Intset.mem refset
215    
216        (* memoize the information on which corresponds to what *)        (* memoize the information on which corresponds to what *)
217        fun enter (v, i) = (Intmap.add m (v, i); addv v)        fun enter (v, i) = (IntHashTable.insert m (v, i); addv v)
218        fun const (VAR v) = ((Intmap.map m v; true) handle _ => false)        fun const (VAR v) = ((IntHashTable.lookup m v; true) handle _ => false)
219          | const (INT _ | INT32 _ | REAL _ | STRING _) = true          | const (INT _ | INT32 _ | REAL _ | STRING _) = true
220          | const _ = bug "unexpected case in const"          | const _ = bug "unexpected case in const"
221    
222        fun cstlit (VAR v) = ((Intmap.map m v; true) handle _ => false)        fun cstlit (VAR v) = ((IntHashTable.lookup m v; true) handle _ => false)
223          | cstlit (REAL _ | STRING _) = true          | cstlit (REAL _ | STRING _) = true
224          | cstlit _ = false          | cstlit _ = false
225    
# Line 359  Line 359 
359              val toplit =              val toplit =
360                let fun g ([], z) = LI_TOP z                let fun g ([], z) = LI_TOP z
361                      | g (x::r, z) =                      | g (x::r, z) =
362                           (case Intmap.map m x                           (case IntHashTable.lookup m x
363                             of ZZ_STR s => g(r, (LI_STRING s)::z)                             of ZZ_STR s => g(r, (LI_STRING s)::z)
364                              | _ => g(r, (LI_VAR x)::z))                              | _ => g(r, (LI_VAR x)::z))
365                 in g(exports, [])                 in g(exports, [])
366                end                end
367    
368              fun mklit (v, lit) =              fun mklit (v, lit) =
369                (case Intmap.map m v                (case IntHashTable.lookup m v
370                  of (ZZ_FLT _) => (* float is wrapped *)                  of (ZZ_FLT _) => (* float is wrapped *)
371                       bug "currently we don't expect ZZ_FLT in mklit"                       bug "currently we don't expect ZZ_FLT in mklit"
372                       (* LI_F64BLOCK([s], v, lit) *)                       (* LI_F64BLOCK([s], v, lit) *)
# Line 393  Line 393 
393    
394                         fun mkhdr (v, (i, hh)) =                         fun mkhdr (v, (i, hh)) =
395                           let val nh =                           let val nh =
396                                 (case Intmap.map m v                                 (case IntHashTable.lookup m v
397                                   of (ZZ_FLT _) => bug "ZZ_FLT in mkhdr"                                   of (ZZ_FLT _) => bug "ZZ_FLT in mkhdr"
398                                        (* (fn ce =>                                        (* (fn ce =>
399                                             (SELECT(i, rval, w, PTRt(FPT 1),                                             (SELECT(i, rval, w, PTRt(FPT 1),

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