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

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