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/MLRISC/hppa/hppaCells.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/hppa/hppaCells.sml

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

revision 105, Thu May 28 21:30:17 1998 UTC revision 106, Thu May 28 21:30:17 1998 UTC
# Line 3  Line 3 
3   * COPYRIGHT (c) 1996 Bell Laboratories.   * COPYRIGHT (c) 1996 Bell Laboratories.
4   *   *
5   *)   *)
6  structure HppaCells : CELLS = struct  structure HppaCells : HPPACELLS = struct
7    structure SL = SortedList    structure SL = SortedList
8    
9    exception HppaCells    type regmap = int Intmap.intmap
10      datatype cellclass = GP | FP | CC | CR | MEM | CTRL
11    
12      exception Cells
13    
14    val stackptrR         = 30    val stackptrR         = 30
15    val asmTmpR           = 29    val asmTmpR           = 29
16    val fasmTmp           = 31    val fasmTmp           = 31
17    
18    val firstPseudoReg    = 128    val firstPseudo       = 256
19    
20    val counter = ref firstPseudoReg    val counter = ref firstPseudo
21    val regCnt = ref 0    val regCnt = ref 0
22    val fregCnt = ref 0    val fregCnt = ref 0
23    fun bump (r as ref c) = (r := c+1; c)    fun bump (r as ref c) = (r := c+1; c)
# Line 25  Line 28 
28    fun newReg () = (bump regCnt; bump counter)    fun newReg () = (bump regCnt; bump counter)
29    fun newFreg() = (bump fregCnt; bump counter)    fun newFreg() = (bump fregCnt; bump counter)
30    fun newCCreg()= (bump regCnt; bump counter)    fun newCCreg()= (bump regCnt; bump counter)
31    fun maxReg()  = !counter  
   fun maxFreg() = !counter  
   fun numRegs() = !regCnt  
   fun numFregs() = !fregCnt  
32    fun resetRegs() = let    fun resetRegs() = let
33      val regmap = Intmap.new(64, HppaCells)      val regmap = Intmap.new(64, Cells)
34      val enter = Intmap.add regmap      val enter = Intmap.add regmap
35    in    in
36      counter:=firstPseudoReg;      counter:=firstPseudo;
37      regCnt :=0;      regCnt :=0;
38      fregCnt:=0;      fregCnt:=0;
39      app (fn r => enter(r,r)) physicalRegs;      app (fn r => enter(r,r)) physicalRegs;
40      regmap      regmap
41    end    end
42    
43      fun newCell GP  = newReg
44        | newCell FP  = newFreg
45        | newCell CC  = newReg
46        | newCell _   = (fn () => bump counter)
47    
48      fun maxCell () = !counter
49    
50      fun numCell GP = (fn () => !regCnt)
51        | numCell FP = (fn () => !fregCnt)
52        | numCell _  = raise Cells
53    
54      fun cellToString(r,class) = prefix class^Int.toString r
55      and prefix GP   = "r"
56        | prefix FP   = "f"
57        | prefix CC   = "cc"
58        | prefix CR   = "cr"
59        | prefix MEM  = "m"
60        | prefix CTRL = "ctrl"
61    
62      fun zero GP = SOME 0
63        | zero _  = NONE
64    
65    type cellset  = (int list * int list)    type cellset  = (int list * int list)
66    
67    val empty = ([], [])    val empty = ([], [])
# Line 50  Line 72 
72    end    end
73    fun addReg(r, (rc,fc)) = (SL.enter(r,rc), fc)    fun addReg(r, (rc,fc)) = (SL.enter(r,rc), fc)
74    fun addFreg(f, (rc,fc)) = (rc, SL.enter(f, fc))    fun addFreg(f, (rc,fc)) = (rc, SL.enter(f, fc))
75    val addCCreg = addReg    fun addCell GP = addReg
76        | addCell FP = addFreg
77        | addCell CC = addReg
78        | addCell _  = raise Cells
79    
80    fun cellsetToRegs(regmap, (regs,fregs)) = let    fun cellsetToRegs(regmap, (regs,fregs)) = let
81      val lookup = Intmap.map regmap      val lookup = Intmap.map regmap
# Line 70  Line 95 
95    
96  (*  (*
97   * $Log: hppaCells.sml,v $   * $Log: hppaCells.sml,v $
98     * Revision 1.2  1998/05/19 15:44:57  george
99     *   The cells interface now makes registers an abstract type called cellclass.
100     *
101   * Revision 1.1.1.1  1998/04/08 18:39:01  george   * Revision 1.1.1.1  1998/04/08 18:39:01  george
102   * Version 110.5   * Version 110.5
103   *   *

Legend:
Removed from v.105  
changed lines
  Added in v.106

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