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

View of /sml/trunk/src/compiler/CodeGen/cpscompile/regmaskConst.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (download) (annotate)
Sat Nov 7 20:11:41 1998 UTC (21 years, 3 months ago) by monnier
File size: 966 byte(s)
This commit was generated by cvs2svn to compensate for changes in r167,
which included commits to RCS files with non-trunk default branches.
(* regmaskConst.sml --- the only special constant used is a list of registers.
 * 
 * COPYRIGHT (c) 1996 AT&T Bell Laboratories.
 *
 *)

functor RegMaskConst(structure RegMask : REGMASK) : CONST_TYPE = 
struct
  datatype root = Reg of int | Mem of int
  datatype const = REGLIST of root list * int Intmap.intmap

  fun toString(REGLIST(regs, regmap)) = let
    val lookup = Intmap.map regmap
    fun doRegs(Reg(r)::rest, acc) = let
          val reg = lookup r handle _ => r
        in doRegs(rest, "r" ^  Int.toString reg::acc)
        end
      | doRegs([], acc) = "("::acc
  in concat(doRegs(regs, [")"]))
  end

  fun valueOf(REGLIST(regs, regmap)) = let
    val lookup = Intmap.map regmap 
    fun add(Reg r, mask) = RegMask.regMask(lookup r, mask)
      | add(Mem m, mask) = RegMask.memMask(m, mask)
  in Word.toIntX (List.foldl add 0w0 regs)
  end
end

(*
 * $Log: regmaskConst.sml,v $
 * Revision 1.1.1.1  1998/04/08 18:39:54  george
 * Version 110.5
 *
 *)

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