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/MLRISC/alpha/instructions/alphaCells.sml
ViewVC logotype

Annotation of /sml/branches/SMLNJ/src/MLRISC/alpha/instructions/alphaCells.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 429 - (view) (download)

1 : monnier 409 (*
2 :     * This file was automatically generated by MDGen
3 :     * from the machine description file "alpha/alpha.md".
4 :     *)
5 :    
6 :    
7 :     signature ALPHACELLS =
8 :     sig
9 :     datatype mycellkind =
10 :     UNKNOWN
11 :     | MEM
12 :     | CTRL
13 :     | CC
14 : monnier 429 | FP
15 : monnier 409 | GP
16 :     withtype cellset = (int list * int list)
17 :     include CELLS_BASIS where type cellkind = mycellkind
18 : monnier 429 val showCC : cell -> string
19 :     val showFP : cell -> string
20 :     val showGP : cell -> string
21 :     val addGP : (cell * cellset) -> cellset
22 :     val addFP : (cell * cellset) -> cellset
23 :     val fasmTmp : cell
24 :     val stackptrR : cell
25 :     val asmTmpR : cell
26 :     val zeroReg : cellkind -> cell option
27 :     val toString : cellkind -> cell -> string
28 :     val addCell : cellkind -> cell * cellset -> cellset
29 :     val rmvCell : cellkind -> cell * cellset -> cellset
30 :     val addReg : cell * cellset -> cellset
31 :     val rmvReg : cell * cellset -> cellset
32 :     val addFreg : cell * cellset -> cellset
33 :     val rmvFreg : cell * cellset -> cellset
34 :     val getCell : cellkind -> cellset -> cell list
35 :     val updateCell : cellkind -> cellset * cell list -> cellset
36 : monnier 409 val empty : cellset
37 :     val cellsetToString : cellset -> string
38 : monnier 429 val cellsetToString' : (cell -> cell) -> cellset -> string
39 :     val cellsetToCells : cellset -> cell list
40 : monnier 409 end
41 :    
42 :     structure AlphaCells : ALPHACELLS =
43 :     struct
44 :     datatype mycellkind =
45 :     UNKNOWN
46 :     | MEM
47 :     | CTRL
48 :     | CC
49 : monnier 429 | FP
50 : monnier 409 | GP
51 :     withtype cellset = (int list * int list)
52 :     exception AlphaCells
53 :     structure SL = SortedList
54 :     fun error msg = MLRiscErrorMsg.error("AlphaCells",msg)
55 :     val cellkindToString = (fn CC => "CC"
56 : monnier 429 | FP => "FP"
57 : monnier 409 | GP => "GP"
58 :     | MEM => "MEM"
59 :     | CTRL => "CTRL"
60 :     | UNKNOWN => "UNKNOWN"
61 :     )
62 :     structure MyCellsBasis = CellsBasisFn
63 :     (type cellkind = mycellkind
64 :     exception Cells = AlphaCells
65 :     val unknown = UNKNOWN
66 :     val cellkindToString = cellkindToString
67 :     val INT = GP
68 :     val FLOAT = FP
69 :     val firstPseudo = 256
70 : monnier 429 val kinds = [CC, FP, GP, MEM, CTRL]
71 :     val physical = [{from=64, to=0, kind=CC}, {from=32, to=63, kind=FP}, {from=0, to=31, kind=GP}]
72 : monnier 409 )
73 :    
74 :     open MyCellsBasis
75 :     val offsetCC = 64
76 : monnier 429 and offsetFP = 32
77 : monnier 409 and offsetGP = 0
78 : monnier 429 and cellnames = ["CC", "FP", "GP"]
79 : monnier 409 and cellsetnames = ["GP", "FP"]
80 : monnier 429 val fasmTmp = (30 + offsetFP)
81 :     val stackptrR = (30 + offsetGP)
82 : monnier 409 val asmTmpR = (28 + offsetGP)
83 :    
84 :     fun showCC r = let
85 :     val r = (if (r <= 0)
86 :     then (r - 64)
87 :     else r)
88 :     in ((fn _ => "cc"
89 :     ) r)
90 :     end
91 :    
92 :     and showFP r = let
93 :     val r = (if (r <= 63)
94 :     then (r - 32)
95 :     else r)
96 :     in ((fn f => ("$f" ^ (Int.toString f))
97 :     ) r)
98 :     end
99 :    
100 : monnier 429 and showGP r = ((fn 30 => "$sp"
101 :     | r => ("$" ^ (Int.toString r))
102 :     ) r)
103 : monnier 409 and toString CC = showCC
104 : monnier 429 | toString FP = showFP
105 : monnier 409 | toString GP = showGP
106 :     | toString MEM = (fn r => ("m" ^ (Int.toString r))
107 :     )
108 :     | toString CTRL = (fn r => ("ctrl" ^ (Int.toString r))
109 :     )
110 :     | toString UNKNOWN = (fn r => ("unknown" ^ (Int.toString r))
111 :     )
112 :     val empty = ([], [])
113 :    
114 : monnier 429 fun addCell GP = addGP
115 : monnier 409 | addCell FP = addFP
116 : monnier 429 | addCell CC = addGP
117 : monnier 409 | addCell _ = (error "addCell")
118 : monnier 429 and rmvCell GP = rmvGP
119 :     | rmvCell FP = rmvFP
120 :     | rmvCell CC = rmvGP
121 :     | rmvCell _ = (error "rmvCell")
122 : monnier 409 and getCell GP = getCellGP
123 :     | getCell FP = getCellFP
124 :     | getCell _ = (error "getCell")
125 :     and updateCell GP = updateCellGP
126 :     | updateCell FP = updateCellFP
127 :     | updateCell _ = (error "updateCell")
128 :     and addGP (r, (setGP, setFP)) = ((SL.enter (r, setGP)), setFP)
129 :     and addFP (r, (setGP, setFP)) = (setGP, (SL.enter (r, setFP)))
130 : monnier 429 and rmvGP (r, (setGP, setFP)) = ((SL.rmv (r, setGP)), setFP)
131 :     and rmvFP (r, (setGP, setFP)) = (setGP, (SL.rmv (r, setFP)))
132 : monnier 409 and getCellGP (setGP, setFP) = setGP
133 :     and getCellFP (setGP, setFP) = setFP
134 :     and updateCellGP ((setGP, setFP), r) = (r, setFP)
135 :     and updateCellFP ((setGP, setFP), r) = (setGP, r)
136 :     and cellsetToString (setGP, setFP) = (printTuple (cellsetnames, [((printSet showGP) setGP), ((printSet showFP) setFP)]))
137 :     and cellsetToString' regmap = (fn (setGP, setFP) => (printTuple (cellsetnames, [((printSet showGP) ((map regmap) setGP)), ((printSet showFP) ((map regmap) setFP))]))
138 :     )
139 : monnier 429 and cellsetToCells (setGP, setFP) = (setGP @ setFP)
140 : monnier 409 val addReg = addGP
141 :     val addFreg = addFP
142 : monnier 429 val rmvReg = rmvFP
143 :     val rmvFreg = rmvFP
144 : monnier 409
145 :     fun zeroReg GP = (SOME (31 + offsetGP))
146 :     | zeroReg FP = (SOME (31 + offsetFP))
147 :     | zeroReg _ = NONE
148 :     end
149 :    

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