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 545 - (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 :     in (fn (f, _) => (if (f = 0)
139 :     then "%st"
140 :     else (if (f < 8)
141 :     then (("%st(" ^ (Int.toString f)) ^ ")")
142 :     else ("%f" ^ (Int.toString f))))
143 :     ) (r, ty)
144 :     end
145 : monnier 247
146 : george 545 and showCCWithType (r, ty) = let
147 :     val r = (if (r <= 63)
148 :     then (r - 64)
149 :     else r)
150 :     in (fn _ => "cc"
151 :     ) (r, ty)
152 : monnier 411 end
153 : monnier 247
154 : george 545 and showMEMWithType (r, ty) = let
155 : monnier 429 val r = (if (r <= 63)
156 : george 545 then (r - 64)
157 :     else r)
158 :     in (fn (r, _) => "m" ^ (Int.toString r)
159 :     ) (r, ty)
160 : monnier 429 end
161 :    
162 : george 545 and showCTRLWithType (r, ty) = let
163 :     val r = (if (r <= 63)
164 :     then (r - 64)
165 :     else r)
166 :     in (fn (r, _) => "ctrl" ^ (Int.toString r)
167 :     ) (r, ty)
168 :     end
169 :    
170 :     fun showGP r = showGPWithType (r, 32)
171 :     fun showFP r = showFPWithType (r, 80)
172 :     fun showCC r = showCCWithType (r, 32)
173 :     fun showMEM r = showMEMWithType (r, 8)
174 :     fun showCTRL r = showCTRLWithType (r, 8)
175 :     fun toStringWithType GP = showGPWithType
176 :     | toStringWithType FP = showFPWithType
177 :     | toStringWithType CC = showCCWithType
178 :     | toStringWithType MEM = showMEMWithType
179 :     | toStringWithType CTRL = showCTRLWithType
180 :     | toStringWithType UNKNOWN = (fn (r, ty) => "unknown" ^ (Int.toString r)
181 :     )
182 :     fun toString GP = showGP
183 : monnier 429 | toString FP = showFP
184 : george 545 | toString CC = showCC
185 :     | toString MEM = showMEM
186 :     | toString CTRL = showCTRL
187 :     | toString UNKNOWN = (fn r => "unknown" ^ (Int.toString r)
188 : monnier 411 )
189 : george 545 val cellsetnames = ["GP", "FP", "CC"]
190 : monnier 411 val empty = ([], [], [])
191 : monnier 429 fun addCell GP = addGP
192 : monnier 411 | addCell FP = addFP
193 : monnier 429 | addCell CC = addCC
194 : george 545 | addCell _ = error "addCell"
195 : monnier 429 and rmvCell GP = rmvGP
196 :     | rmvCell FP = rmvFP
197 :     | rmvCell CC = rmvCC
198 : george 545 | rmvCell _ = error "rmvCell"
199 :     and getCell GP = getGP
200 :     | getCell FP = getFP
201 :     | getCell CC = getCC
202 :     | getCell _ = error "getCell"
203 :     and updateCell GP = updateGP
204 :     | updateCell FP = updateFP
205 :     | updateCell CC = updateCC
206 :     | updateCell _ = error "updateCell"
207 :     and addGP (r, (setGP, setFP, setCC)) = (SL.enter (r, setGP), setFP, setCC)
208 :     and addFP (r, (setGP, setFP, setCC)) = (setGP, SL.enter (r, setFP), setCC)
209 :     and addCC (r, (setGP, setFP, setCC)) = (setGP, setFP, SL.enter (r, setCC))
210 :     and rmvGP (r, (setGP, setFP, setCC)) = (SL.rmv (r, setGP), setFP, setCC)
211 :     and rmvFP (r, (setGP, setFP, setCC)) = (setGP, SL.rmv (r, setFP), setCC)
212 :     and rmvCC (r, (setGP, setFP, setCC)) = (setGP, setFP, SL.rmv (r, setCC))
213 :     and getGP (setGP, setFP, setCC) = setGP
214 :     and getFP (setGP, setFP, setCC) = setFP
215 :     and getCC (setGP, setFP, setCC) = setCC
216 :     and updateGP ((setGP, setFP, setCC), r) = (r, setFP, setCC)
217 :     and updateFP ((setGP, setFP, setCC), r) = (setGP, r, setCC)
218 :     and updateCC ((setGP, setFP, setCC), r) = (setGP, setFP, r)
219 :     and cellsetToString (setGP, setFP, setCC) = printTuple (cellsetnames, [printSet showGP setGP, printSet showFP setFP, printSet showCC setCC])
220 :     and cellsetToString' regmap = (fn (setGP, setFP, setCC) => cellsetToString (map regmap setGP, map regmap setFP, map regmap setCC)
221 : monnier 411 )
222 : george 545 and cellsetToCells (setGP, setFP, setCC) = setGP @ (setFP @ setCC)
223 : monnier 411 val addReg = addGP
224 :     val addFreg = addFP
225 : george 545 val rmvReg = rmvGP
226 : monnier 429 val rmvFreg = rmvFP
227 : monnier 411 end
228 : monnier 247

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