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/demo/spill-table.sml
ViewVC logotype

View of /sml/trunk/src/MLRISC/demo/spill-table.sml

Parent Directory Parent Directory | Revision Log Revision Log

Revision 744 - (download) (annotate)
Fri Dec 8 04:11:42 2000 UTC (18 years, 7 months ago) by leunga
File size: 1966 byte(s)

   A CVS update record!

   Changed type cell from int to datatype, and numerous other changes.
   Affect every client of MLRISC.  Lal says this can be bootstrapped on all
   machines.  See smlnj/HISTORY for details.

   Tag:  leunga-20001207-cell-monster-hack
functor SpillTable
   (val architecture : string  
    val initialSpillOffset : int
    val spillAreaSz : int
   ) : 
   val architecture : string
   val beginRA : unit -> unit
   val get     : RAGraph.spillLoc -> int
   val getF    : RAGraph.spillLoc -> int

end =

   structure G = RAGraph

   fun error msg = MLRiscErrorMsg.error(architecture^".SpillTable",msg)
   val itow = Word.fromInt

   val architecture = architecture

   exception RegSpills and FregSpills
   val spillOffset = ref initialSpillOffset
   val regspills : int G.SpillLocHashTable.hash_table =
   val fregspills : int G.SpillLocHashTable.hash_table =
   val lookupReg  = G.SpillLocHashTable.lookup regspills
   val enterReg   = G.SpillLocHashTable.insert regspills
   val lookupFreg = G.SpillLocHashTable.lookup fregspills
   val enterFreg  = G.SpillLocHashTable.insert fregspills

   fun beginRA() =
      ((* Reset the regspills/fregspills map by need. *)
       if !spillOffset = initialSpillOffset then ()
       else (G.SpillLocHashTable.clear regspills;
             G.SpillLocHashTable.clear fregspills
       spillOffset := initialSpillOffset

   fun newOffset offset =
       if offset >= spillAreaSz then error "spill area too small"
       else spillOffset := offset

   (* Get spill location for integer registers *)
   fun get loc =
       lookupReg loc handle _ =>
       let val offset = !spillOffset
       in  newOffset(offset+4);
           enterReg (loc,offset);

   (* Get spill location for floating point registers *)
   fun getF loc =
       lookupFreg loc handle _ =>
       let val offset = !spillOffset
           val aligned = Word.toIntX (Word.andb(itow (offset+7), itow ~8))
           enterFreg (loc, aligned);


ViewVC Help
Powered by ViewVC 1.0.0