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/x86/instructions/x86Cells.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/x86/instructions/x86Cells.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 "x86/x86.md".
4 : monnier 247 *)
5 :    
6 :    
7 : monnier 411 signature X86CELLS =
8 :     sig
9 :     datatype mycellkind =
10 : george 545 GP
11 :     | FP
12 :     | CC
13 : monnier 411 | MEM
14 :     | CTRL
15 : george 545 | UNKNOWN
16 : monnier 411 withtype cellset = (int list * int list * int list)
17 :     include CELLS_BASIS where type cellkind = mycellkind
18 : george 545 val showGP : cell -> string
19 :     val showFP : cell -> string
20 : monnier 429 val showCC : cell -> string
21 : george 545 val showMEM : cell -> string
22 :     val showCTRL : cell -> string
23 :     val showGPWithType : (cell * ty) -> string
24 :     val showFPWithType : (cell * ty) -> string
25 :     val showCCWithType : (cell * ty) -> string
26 :     val showMEMWithType : (cell * ty) -> string
27 :     val showCTRLWithType : (cell * ty) -> string
28 : monnier 429 val eax : cell
29 : george 545 val ecx : cell
30 :     val edx : cell
31 : monnier 429 val ebx : cell
32 : george 545 val esp : cell
33 :     val ebp : cell
34 : monnier 429 val esi : cell
35 : george 545 val edi : cell
36 :     val stackptrR : cell
37 :     val ST : int -> cell
38 : monnier 429 val asmTmpR : cell
39 : george 545 val fasmTmp : cell
40 :     val addGP : (cell * cellset) -> cellset
41 :     val addFP : (cell * cellset) -> cellset
42 :     val addCC : (cell * cellset) -> cellset
43 : monnier 429 val zeroReg : cellkind -> cell option
44 :     val toString : cellkind -> cell -> string
45 : george 545 val toStringWithType : cellkind -> cell * ty -> string
46 : monnier 429 val addCell : cellkind -> cell * cellset -> cellset
47 :     val rmvCell : cellkind -> cell * cellset -> cellset
48 :     val addReg : cell * cellset -> cellset
49 :     val rmvReg : cell * cellset -> cellset
50 :     val addFreg : cell * cellset -> cellset
51 :     val rmvFreg : cell * cellset -> cellset
52 :     val getCell : cellkind -> cellset -> cell list
53 :     val updateCell : cellkind -> cellset * cell list -> cellset
54 : monnier 411 val empty : cellset
55 :     val cellsetToString : cellset -> string
56 : monnier 429 val cellsetToString' : (cell -> cell) -> cellset -> string
57 :     val cellsetToCells : cellset -> cell list
58 : monnier 411 end
59 : monnier 247
60 : monnier 411 structure X86Cells : X86CELLS =
61 :     struct
62 :     datatype mycellkind =
63 : george 545 GP
64 :     | FP
65 :     | CC
66 : monnier 411 | MEM
67 :     | CTRL
68 : george 545 | UNKNOWN
69 : monnier 411 withtype cellset = (int list * int list * int list)
70 :     exception X86Cells
71 :     structure SL = SortedList
72 :     fun error msg = MLRiscErrorMsg.error("X86Cells",msg)
73 : george 545 val cellkindToString = (fn GP => "GP"
74 : monnier 429 | FP => "FP"
75 : george 545 | CC => "CC"
76 : monnier 411 | MEM => "MEM"
77 :     | CTRL => "CTRL"
78 :     | UNKNOWN => "UNKNOWN"
79 :     )
80 : george 545 structure MyCellsBasis = CellsBasis
81 : monnier 411 (type cellkind = mycellkind
82 :     exception Cells = X86Cells
83 :     val unknown = UNKNOWN
84 :     val cellkindToString = cellkindToString
85 :     val INT = GP
86 :     val FLOAT = FP
87 :     val firstPseudo = 256
88 : george 545 val kinds = [GP, FP, CC, MEM, CTRL, UNKNOWN]
89 :     val physical = [{from=0, to=31, kind=GP}, {from=32, to=63, kind=FP}, {from=64, to=63, kind=CC}, {from=64, to=63, kind=MEM}, {from=64, to=63, kind=CTRL}]
90 : monnier 411 )
91 : monnier 247
92 : monnier 411 open MyCellsBasis
93 : george 545 val offsetGP = 0
94 :     and offsetFP = 32
95 :     and offsetCC = 64
96 :     and offsetMEM = 64
97 :     and offsetCTRL = 64
98 : monnier 411 val eax = (0 + offsetGP)
99 :     val ecx = (1 + offsetGP)
100 :     val edx = (2 + offsetGP)
101 : george 545 val ebx = (3 + offsetGP)
102 : monnier 429 val esp = (4 + offsetGP)
103 : george 545 val ebp = (5 + offsetGP)
104 :     val esi = (6 + offsetGP)
105 :     val edi = (7 + offsetGP)
106 :     val stackptrR = (4 + offsetGP)
107 :     val ST = (fn x => (x + offsetFP)
108 :     )
109 :     val asmTmpR = ~ 1
110 :     val fasmTmp = ~ 1
111 :     fun zeroReg _ = NONE
112 :     fun showGPWithType (r, ty) = (fn (0, 8) => "%al"
113 :     | (0, 16) => "%ax"
114 :     | (0, 32) => "%eax"
115 :     | (1, 8) => "%cl"
116 :     | (1, 16) => "%cx"
117 :     | (1, 32) => "%ecx"
118 :     | (2, 8) => "%dl"
119 :     | (2, 16) => "%dx"
120 :     | (2, 32) => "%edx"
121 :     | (3, 8) => "%bl"
122 :     | (3, 16) => "%bx"
123 :     | (3, 32) => "%ebx"
124 :     | (4, 16) => "%sp"
125 :     | (4, 32) => "%esp"
126 :     | (5, 16) => "%bp"
127 :     | (5, 32) => "%ebp"
128 :     | (6, 16) => "%si"
129 :     | (6, 32) => "%esi"
130 :     | (7, 16) => "%di"
131 :     | (7, 32) => "%edi"
132 :     | (r, _) => "%" ^ (Int.toString r)
133 :     ) (r, ty)
134 :     and showFPWithType (r, ty) = let
135 :     val r = (if (r <= 63)
136 :     then (r - 32)
137 :     else r)
138 : leunga 565 in (fn (0, _) => "%st"
139 :     | (f, _) => (if (f < 8)
140 :     then (("%st(" ^ (Int.toString f)) ^ ")")
141 :     else ("%f" ^ (Int.toString f)))
142 : george 545 ) (r, ty)
143 :     end
144 : monnier 247
145 : george 545 and showCCWithType (r, ty) = let
146 :     val r = (if (r <= 63)
147 :     then (r - 64)
148 :     else r)
149 :     in (fn _ => "cc"
150 :     ) (r, ty)
151 : monnier 411 end
152 : monnier 247
153 : george 545 and showMEMWithType (r, ty) = let
154 : monnier 429 val r = (if (r <= 63)
155 : george 545 then (r - 64)
156 :     else r)
157 :     in (fn (r, _) => "m" ^ (Int.toString r)
158 :     ) (r, ty)
159 : monnier 429 end
160 :    
161 : george 545 and showCTRLWithType (r, ty) = let
162 :     val r = (if (r <= 63)
163 :     then (r - 64)
164 :     else r)
165 :     in (fn (r, _) => "ctrl" ^ (Int.toString r)
166 :     ) (r, ty)
167 :     end
168 :    
169 :     fun showGP r = showGPWithType (r, 32)
170 :     fun showFP r = showFPWithType (r, 80)
171 :     fun showCC r = showCCWithType (r, 32)
172 :     fun showMEM r = showMEMWithType (r, 8)
173 :     fun showCTRL r = showCTRLWithType (r, 8)
174 :     fun toStringWithType GP = showGPWithType
175 :     | toStringWithType FP = showFPWithType
176 :     | toStringWithType CC = showCCWithType
177 :     | toStringWithType MEM = showMEMWithType
178 :     | toStringWithType CTRL = showCTRLWithType
179 :     | toStringWithType UNKNOWN = (fn (r, ty) => "unknown" ^ (Int.toString r)
180 :     )
181 :     fun toString GP = showGP
182 : monnier 429 | toString FP = showFP
183 : george 545 | toString CC = showCC
184 :     | toString MEM = showMEM
185 :     | toString CTRL = showCTRL
186 :     | toString UNKNOWN = (fn r => "unknown" ^ (Int.toString r)
187 : monnier 411 )
188 : george 545 val cellsetnames = ["GP", "FP", "CC"]
189 : monnier 411 val empty = ([], [], [])
190 : monnier 429 fun addCell GP = addGP
191 : monnier 411 | addCell FP = addFP
192 : monnier 429 | addCell CC = addCC
193 : george 545 | addCell _ = error "addCell"
194 : monnier 429 and rmvCell GP = rmvGP
195 :     | rmvCell FP = rmvFP
196 :     | rmvCell CC = rmvCC
197 : george 545 | rmvCell _ = error "rmvCell"
198 :     and getCell GP = getGP
199 :     | getCell FP = getFP
200 :     | getCell CC = getCC
201 :     | getCell _ = error "getCell"
202 :     and updateCell GP = updateGP
203 :     | updateCell FP = updateFP
204 :     | updateCell CC = updateCC
205 :     | updateCell _ = error "updateCell"
206 :     and addGP (r, (setGP, setFP, setCC)) = (SL.enter (r, setGP), setFP, setCC)
207 :     and addFP (r, (setGP, setFP, setCC)) = (setGP, SL.enter (r, setFP), setCC)
208 :     and addCC (r, (setGP, setFP, setCC)) = (setGP, setFP, SL.enter (r, setCC))
209 :     and rmvGP (r, (setGP, setFP, setCC)) = (SL.rmv (r, setGP), setFP, setCC)
210 :     and rmvFP (r, (setGP, setFP, setCC)) = (setGP, SL.rmv (r, setFP), setCC)
211 :     and rmvCC (r, (setGP, setFP, setCC)) = (setGP, setFP, SL.rmv (r, setCC))
212 :     and getGP (setGP, setFP, setCC) = setGP
213 :     and getFP (setGP, setFP, setCC) = setFP
214 :     and getCC (setGP, setFP, setCC) = setCC
215 :     and updateGP ((setGP, setFP, setCC), r) = (r, setFP, setCC)
216 :     and updateFP ((setGP, setFP, setCC), r) = (setGP, r, setCC)
217 :     and updateCC ((setGP, setFP, setCC), r) = (setGP, setFP, r)
218 :     and cellsetToString (setGP, setFP, setCC) = printTuple (cellsetnames, [printSet showGP setGP, printSet showFP setFP, printSet showCC setCC])
219 :     and cellsetToString' regmap = (fn (setGP, setFP, setCC) => cellsetToString (map regmap setGP, map regmap setFP, map regmap setCC)
220 : monnier 411 )
221 : george 545 and cellsetToCells (setGP, setFP, setCC) = setGP @ (setFP @ setCC)
222 : monnier 411 val addReg = addGP
223 :     val addFreg = addFP
224 : george 545 val rmvReg = rmvGP
225 : monnier 429 val rmvFreg = rmvFP
226 : monnier 411 end
227 : monnier 247

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