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 429 - (view) (download)
Original Path: sml/branches/SMLNJ/src/MLRISC/x86/instructions/x86Cells.sml

1 : monnier 411 (*
2 :     * This file was automatically generated by MDGen
3 :     * from the machine description file "x86/x86.md".
4 : monnier 247 *)
5 :    
6 :    
7 : monnier 411 signature X86CELLS =
8 :     sig
9 :     datatype mycellkind =
10 :     UNKNOWN
11 :     | MEM
12 :     | CTRL
13 :     | CC
14 : monnier 429 | FP
15 : monnier 411 | GP
16 :     withtype cellset = (int list * 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 addCC : (cell * cellset) -> cellset
24 :     val edi : cell
25 :     val ebp : cell
26 :     val fasmTmp : cell
27 :     val stackptrR : cell
28 :     val eax : cell
29 :     val ebx : cell
30 :     val ecx : cell
31 :     val esi : cell
32 :     val edx : cell
33 :     val asmTmpR : cell
34 :     val esp : cell
35 :     val zeroReg : cellkind -> cell option
36 :     val toString : cellkind -> cell -> string
37 :     val addCell : cellkind -> cell * cellset -> cellset
38 :     val rmvCell : cellkind -> cell * cellset -> cellset
39 :     val addReg : cell * cellset -> cellset
40 :     val rmvReg : cell * cellset -> cellset
41 :     val addFreg : cell * cellset -> cellset
42 :     val rmvFreg : cell * cellset -> cellset
43 :     val getCell : cellkind -> cellset -> cell list
44 :     val updateCell : cellkind -> cellset * cell list -> cellset
45 : monnier 411 val empty : cellset
46 :     val cellsetToString : cellset -> string
47 : monnier 429 val cellsetToString' : (cell -> cell) -> cellset -> string
48 :     val cellsetToCells : cellset -> cell list
49 : monnier 411 end
50 : monnier 247
51 : monnier 411 structure X86Cells : X86CELLS =
52 :     struct
53 :     datatype mycellkind =
54 :     UNKNOWN
55 :     | MEM
56 :     | CTRL
57 :     | CC
58 : monnier 429 | FP
59 : monnier 411 | GP
60 :     withtype cellset = (int list * int list * int list)
61 :     exception X86Cells
62 :     structure SL = SortedList
63 :     fun error msg = MLRiscErrorMsg.error("X86Cells",msg)
64 :     val cellkindToString = (fn CC => "CC"
65 : monnier 429 | FP => "FP"
66 : monnier 411 | GP => "GP"
67 :     | MEM => "MEM"
68 :     | CTRL => "CTRL"
69 :     | UNKNOWN => "UNKNOWN"
70 :     )
71 :     structure MyCellsBasis = CellsBasisFn
72 :     (type cellkind = mycellkind
73 :     exception Cells = X86Cells
74 :     val unknown = UNKNOWN
75 :     val cellkindToString = cellkindToString
76 :     val INT = GP
77 :     val FLOAT = FP
78 :     val firstPseudo = 256
79 : monnier 429 val kinds = [CC, FP, GP, MEM, CTRL]
80 :     val physical = [{from=64, to=0, kind=CC}, {from=32, to=63, kind=FP}, {from=0, to=31, kind=GP}]
81 : monnier 411 )
82 : monnier 247
83 : monnier 411 open MyCellsBasis
84 :     val offsetCC = 64
85 : monnier 429 and offsetFP = 32
86 : monnier 411 and offsetGP = 0
87 : monnier 429 and cellnames = ["CC", "FP", "GP"]
88 : monnier 411 and cellsetnames = ["GP", "FP", "CC"]
89 : monnier 429 val edi = (7 + offsetGP)
90 : monnier 411 val ebp = (5 + offsetGP)
91 : monnier 429 val fasmTmp = (~ 1)
92 :     val stackptrR = (4 + offsetGP)
93 : monnier 411 val eax = (0 + offsetGP)
94 : monnier 429 val ebx = (3 + offsetGP)
95 : monnier 411 val ecx = (1 + offsetGP)
96 :     val esi = (6 + offsetGP)
97 :     val edx = (2 + offsetGP)
98 : monnier 429 val asmTmpR = (~ 1)
99 :     val esp = (4 + offsetGP)
100 : monnier 247
101 : monnier 411 fun showCC r = let
102 :     val r = (if (r <= 0)
103 :     then (r - 64)
104 :     else r)
105 :     in ((fn _ => "cc"
106 :     ) r)
107 :     end
108 : monnier 247
109 : monnier 429 and showFP r = let
110 :     val r = (if (r <= 63)
111 :     then (r - 32)
112 :     else r)
113 :     in ((fn f => (if (f >= 0)andalso (f < 8)
114 :     then (("%st(" ^ (Int.toString f)) ^ ")")
115 :     else ("%f" ^ (Int.toString f)))
116 :     ) r)
117 :     end
118 :    
119 : monnier 411 and showGP r = ((fn 0 => "%eax"
120 :     | 1 => "%ecx"
121 :     | 2 => "%edx"
122 :     | 3 => "%ebx"
123 :     | 4 => "%esp"
124 :     | 5 => "%ebp"
125 :     | 6 => "%esi"
126 :     | 7 => "%edi"
127 :     | r => ("%" ^ (Int.toString r))
128 :     ) r)
129 :     and toString CC = showCC
130 : monnier 429 | toString FP = showFP
131 : monnier 411 | toString GP = showGP
132 :     | toString MEM = (fn r => ("m" ^ (Int.toString r))
133 :     )
134 :     | toString CTRL = (fn r => ("ctrl" ^ (Int.toString r))
135 :     )
136 :     | toString UNKNOWN = (fn r => ("unknown" ^ (Int.toString r))
137 :     )
138 :     val empty = ([], [], [])
139 : monnier 247
140 : monnier 429 fun addCell GP = addGP
141 : monnier 411 | addCell FP = addFP
142 : monnier 429 | addCell CC = addCC
143 : monnier 411 | addCell _ = (error "addCell")
144 : monnier 429 and rmvCell GP = rmvGP
145 :     | rmvCell FP = rmvFP
146 :     | rmvCell CC = rmvCC
147 :     | rmvCell _ = (error "rmvCell")
148 :     and getCell GP = getCellGP
149 : monnier 411 | getCell FP = getCellFP
150 : monnier 429 | getCell CC = getCellCC
151 : monnier 411 | getCell _ = (error "getCell")
152 : monnier 429 and updateCell GP = updateCellGP
153 : monnier 411 | updateCell FP = updateCellFP
154 : monnier 429 | updateCell CC = updateCellCC
155 : monnier 411 | updateCell _ = (error "updateCell")
156 :     and addGP (r, (setGP, setFP, setCC)) = ((SL.enter (r, setGP)), setFP, setCC)
157 :     and addFP (r, (setGP, setFP, setCC)) = (setGP, (SL.enter (r, setFP)), setCC)
158 :     and addCC (r, (setGP, setFP, setCC)) = (setGP, setFP, (SL.enter (r, setCC)))
159 : monnier 429 and rmvGP (r, (setGP, setFP, setCC)) = ((SL.rmv (r, setGP)), setFP, setCC)
160 :     and rmvFP (r, (setGP, setFP, setCC)) = (setGP, (SL.rmv (r, setFP)), setCC)
161 :     and rmvCC (r, (setGP, setFP, setCC)) = (setGP, setFP, (SL.rmv (r, setCC)))
162 : monnier 411 and getCellGP (setGP, setFP, setCC) = setGP
163 :     and getCellFP (setGP, setFP, setCC) = setFP
164 :     and getCellCC (setGP, setFP, setCC) = setCC
165 :     and updateCellGP ((setGP, setFP, setCC), r) = (r, setFP, setCC)
166 :     and updateCellFP ((setGP, setFP, setCC), r) = (setGP, r, setCC)
167 :     and updateCellCC ((setGP, setFP, setCC), r) = (setGP, setFP, r)
168 :     and cellsetToString (setGP, setFP, setCC) = (printTuple (cellsetnames, [((printSet showGP) setGP), ((printSet showFP) setFP), ((printSet showCC) setCC)]))
169 :     and cellsetToString' regmap = (fn (setGP, setFP, setCC) => (printTuple (cellsetnames, [((printSet showGP) ((map regmap) setGP)), ((printSet showFP) ((map regmap) setFP)), ((printSet showCC) ((map regmap) setCC))]))
170 :     )
171 : monnier 429 and cellsetToCells (setGP, setFP, setCC) = (setGP @ (setFP @ setCC))
172 : monnier 411 val addReg = addGP
173 :     val addFreg = addFP
174 : monnier 429 val rmvReg = rmvFP
175 :     val rmvFreg = rmvFP
176 : monnier 247
177 : monnier 411 fun zeroReg _ = NONE
178 :     end
179 : monnier 247

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