Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/branches/SMLNJ/src/compiler/CodeGen/cpscompile/regmaskConst.sml
ViewVC logotype

Annotation of /sml/branches/SMLNJ/src/compiler/CodeGen/cpscompile/regmaskConst.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17 - (view) (download)

1 : monnier 16 (* regmaskConst.sml --- the only special constant used is a list of registers.
2 :     *
3 :     * COPYRIGHT (c) 1996 AT&T Bell Laboratories.
4 :     *
5 :     *)
6 :    
7 :     functor RegMaskConst(structure RegMask : REGMASK) : CONST_TYPE =
8 :     struct
9 :     datatype root = Reg of int | Mem of int
10 :     datatype const = REGLIST of root list * int Intmap.intmap
11 :    
12 :     fun toString(REGLIST(regs, regmap)) = let
13 :     val lookup = Intmap.map regmap
14 :     fun doRegs(Reg(r)::rest, acc) = let
15 :     val reg = lookup r handle _ => r
16 :     in doRegs(rest, "r" ^ Int.toString reg::acc)
17 :     end
18 :     | doRegs([], acc) = "("::acc
19 :     in concat(doRegs(regs, [")"]))
20 :     end
21 :    
22 :     fun valueOf(REGLIST(regs, regmap)) = let
23 :     val lookup = Intmap.map regmap
24 :     fun add(Reg r, mask) = RegMask.regMask(lookup r, mask)
25 :     | add(Mem m, mask) = RegMask.memMask(m, mask)
26 :     in Word.toIntX (List.foldl add 0w0 regs)
27 :     end
28 :     end
29 :    
30 :     (*
31 :     * $Log: regmaskConst.sml,v $
32 :     * Revision 1.4 1997/09/29 20:58:44 george
33 :     * *** empty log message ***
34 :     *
35 :     * Revision 1.3 1997/07/17 12:37:21 george
36 :     * The constant type used to specialize MLTrees is now done more compactly.
37 :     *
38 :     * Revision 1.2 1997/06/11 19:15:42 george
39 :     * Fixed bad printing of register lists.
40 :     *
41 :     * Revision 1.1.1.1 1997/01/14 01:38:34 george
42 :     * Version 109.24
43 :     *
44 :     *)

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