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

Annotation of /sml/trunk/src/MLRISC/hppa/instructions/hppaCells.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : monnier 411 (*
2 : george 545 * This file was automatically generated by MDGen (v2.0)
3 : monnier 411 * from the machine description file "hppa/hppa.md".
4 : monnier 245 *)
5 :    
6 :    
7 : monnier 411 signature HPPACELLS =
8 :     sig
9 :     datatype mycellkind =
10 : george 545 GP
11 :     | FP
12 :     | CR
13 :     | CC
14 : monnier 411 | MEM
15 :     | CTRL
16 : george 545 | UNKNOWN
17 : monnier 411 withtype cellset = (int list * int list)
18 :     include CELLS_BASIS where type cellkind = mycellkind
19 : george 545 val showGP : cell -> string
20 :     val showFP : cell -> string
21 :     val showCR : cell -> string
22 : monnier 429 val showCC : cell -> string
23 : george 545 val showMEM : cell -> string
24 :     val showCTRL : cell -> string
25 :     val showGPWithType : (cell * ty) -> string
26 :     val showFPWithType : (cell * ty) -> string
27 :     val showCRWithType : (cell * ty) -> string
28 :     val showCCWithType : (cell * ty) -> string
29 :     val showMEMWithType : (cell * ty) -> string
30 :     val showCTRLWithType : (cell * ty) -> string
31 : monnier 429 val returnPtr : cell
32 :     val stackptrR : cell
33 :     val asmTmpR : cell
34 : george 545 val fasmTmp : cell
35 : monnier 429 val sar : cell
36 : george 545 val addGP : (cell * cellset) -> cellset
37 :     val addFP : (cell * cellset) -> cellset
38 : monnier 429 val zeroReg : cellkind -> cell option
39 :     val toString : cellkind -> cell -> string
40 : george 545 val toStringWithType : cellkind -> cell * ty -> string
41 : monnier 429 val addCell : cellkind -> cell * cellset -> cellset
42 :     val rmvCell : cellkind -> cell * cellset -> cellset
43 :     val addReg : cell * cellset -> cellset
44 :     val rmvReg : cell * cellset -> cellset
45 :     val addFreg : cell * cellset -> cellset
46 :     val rmvFreg : cell * cellset -> cellset
47 :     val getCell : cellkind -> cellset -> cell list
48 :     val updateCell : cellkind -> cellset * cell list -> cellset
49 : monnier 411 val empty : cellset
50 :     val cellsetToString : cellset -> string
51 : monnier 429 val cellsetToString' : (cell -> cell) -> cellset -> string
52 :     val cellsetToCells : cellset -> cell list
53 : monnier 411 end
54 : monnier 245
55 : monnier 411 structure HppaCells : HPPACELLS =
56 :     struct
57 :     datatype mycellkind =
58 : george 545 GP
59 :     | FP
60 :     | CR
61 :     | CC
62 : monnier 411 | MEM
63 :     | CTRL
64 : george 545 | UNKNOWN
65 : monnier 411 withtype cellset = (int list * int list)
66 :     exception HppaCells
67 :     structure SL = SortedList
68 :     fun error msg = MLRiscErrorMsg.error("HppaCells",msg)
69 : george 545 val cellkindToString = (fn GP => "GP"
70 :     | FP => "FP"
71 : monnier 411 | CR => "CR"
72 : george 545 | CC => "CC"
73 : monnier 411 | MEM => "MEM"
74 :     | CTRL => "CTRL"
75 :     | UNKNOWN => "UNKNOWN"
76 :     )
77 : george 545 structure MyCellsBasis = CellsBasis
78 : monnier 411 (type cellkind = mycellkind
79 :     exception Cells = HppaCells
80 :     val unknown = UNKNOWN
81 :     val cellkindToString = cellkindToString
82 :     val INT = GP
83 :     val FLOAT = FP
84 :     val firstPseudo = 256
85 : george 545 val kinds = [GP, FP, CR, CC, MEM, CTRL, UNKNOWN]
86 :     val physical = [{from=0, to=31, kind=GP}, {from=32, to=63, kind=FP}, {from=64, to=95, kind=CR}, {from=96, to=95, kind=CC}, {from=96, to=95, kind=MEM}, {from=96, to=95, kind=CTRL}]
87 : monnier 411 )
88 : monnier 245
89 : monnier 411 open MyCellsBasis
90 : george 545 val offsetGP = 0
91 :     and offsetFP = 32
92 :     and offsetCR = 64
93 :     and offsetCC = 96
94 :     and offsetMEM = 96
95 :     and offsetCTRL = 96
96 : monnier 411 val returnPtr = (2 + offsetGP)
97 : monnier 429 val stackptrR = (30 + offsetGP)
98 : monnier 411 val asmTmpR = (29 + offsetGP)
99 : george 545 val fasmTmp = (31 + offsetFP)
100 : monnier 411 val sar = (11 + offsetCR)
101 : george 545 fun zeroReg GP = SOME (0 + offsetGP)
102 :     | zeroReg FP = SOME (0 + offsetFP)
103 :     | zeroReg _ = NONE
104 :     fun showGPWithType (r, ty) = (fn (r, _) => "%r" ^ (Int.toString r)
105 :     ) (r, ty)
106 :     and showFPWithType (r, ty) = let
107 :     val r = (if (r <= 63)
108 :     then (r - 32)
109 :     else r)
110 :     in (fn (f, _) => "%f" ^ (Int.toString f)
111 :     ) (r, ty)
112 :     end
113 : monnier 245
114 : george 545 and showCRWithType (r, ty) = let
115 :     val r = (if (r <= 95)
116 :     then (r - 64)
117 :     else r)
118 :     in (fn (cr, _) => "%cr" ^ (Int.toString cr)
119 :     ) (r, ty)
120 : monnier 411 end
121 : monnier 245
122 : george 545 and showCCWithType (r, ty) = let
123 : monnier 411 val r = (if (r <= 95)
124 : george 545 then (r - 96)
125 :     else r)
126 :     in (fn _ => "cc"
127 :     ) (r, ty)
128 : monnier 411 end
129 : monnier 245
130 : george 545 and showMEMWithType (r, ty) = let
131 :     val r = (if (r <= 95)
132 :     then (r - 96)
133 :     else r)
134 :     in (fn (r, _) => "m" ^ (Int.toString r)
135 :     ) (r, ty)
136 : monnier 411 end
137 : monnier 245
138 : george 545 and showCTRLWithType (r, ty) = let
139 :     val r = (if (r <= 95)
140 :     then (r - 96)
141 :     else r)
142 :     in (fn (r, _) => "ctrl" ^ (Int.toString r)
143 :     ) (r, ty)
144 :     end
145 :    
146 :     fun showGP r = showGPWithType (r, 32)
147 :     fun showFP r = showFPWithType (r, 64)
148 :     fun showCR r = showCRWithType (r, 32)
149 :     fun showCC r = showCCWithType (r, 32)
150 :     fun showMEM r = showMEMWithType (r, 8)
151 :     fun showCTRL r = showCTRLWithType (r, 8)
152 :     fun toStringWithType GP = showGPWithType
153 :     | toStringWithType FP = showFPWithType
154 :     | toStringWithType CR = showCRWithType
155 :     | toStringWithType CC = showCCWithType
156 :     | toStringWithType MEM = showMEMWithType
157 :     | toStringWithType CTRL = showCTRLWithType
158 :     | toStringWithType UNKNOWN = (fn (r, ty) => "unknown" ^ (Int.toString r)
159 :     )
160 :     fun toString GP = showGP
161 :     | toString FP = showFP
162 : monnier 411 | toString CR = showCR
163 : george 545 | toString CC = showCC
164 :     | toString MEM = showMEM
165 :     | toString CTRL = showCTRL
166 :     | toString UNKNOWN = (fn r => "unknown" ^ (Int.toString r)
167 : monnier 411 )
168 : george 545 val cellsetnames = ["GP", "FP"]
169 : monnier 411 val empty = ([], [])
170 : monnier 429 fun addCell GP = addGP
171 : monnier 411 | addCell FP = addFP
172 : monnier 429 | addCell CC = addGP
173 : george 545 | addCell _ = error "addCell"
174 : monnier 429 and rmvCell GP = rmvGP
175 :     | rmvCell FP = rmvFP
176 :     | rmvCell CC = rmvGP
177 : george 545 | rmvCell _ = error "rmvCell"
178 :     and getCell GP = getGP
179 :     | getCell FP = getFP
180 :     | getCell CC = getGP
181 :     | getCell _ = error "getCell"
182 :     and updateCell GP = updateGP
183 :     | updateCell FP = updateFP
184 :     | updateCell CC = updateGP
185 :     | updateCell _ = error "updateCell"
186 :     and addGP (r, (setGP, setFP)) = (SL.enter (r, setGP), setFP)
187 :     and addFP (r, (setGP, setFP)) = (setGP, SL.enter (r, setFP))
188 :     and rmvGP (r, (setGP, setFP)) = (SL.rmv (r, setGP), setFP)
189 :     and rmvFP (r, (setGP, setFP)) = (setGP, SL.rmv (r, setFP))
190 :     and getGP (setGP, setFP) = setGP
191 :     and getFP (setGP, setFP) = setFP
192 :     and updateGP ((setGP, setFP), r) = (r, setFP)
193 :     and updateFP ((setGP, setFP), r) = (setGP, r)
194 :     and cellsetToString (setGP, setFP) = printTuple (cellsetnames, [printSet showGP setGP, printSet showFP setFP])
195 :     and cellsetToString' regmap = (fn (setGP, setFP) => cellsetToString (map regmap setGP, map regmap setFP)
196 : monnier 411 )
197 : george 545 and cellsetToCells (setGP, setFP) = setGP @ setFP
198 : monnier 411 val addReg = addGP
199 :     val addFreg = addFP
200 : george 545 val rmvReg = rmvGP
201 : monnier 429 val rmvFreg = rmvFP
202 : monnier 245 end
203 :    

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