Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/MLRISC/x86/instructions/x86Cells.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/x86/instructions/x86Cells.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 430, Wed Sep 8 09:47:00 1999 UTC revision 545, Thu Feb 24 13:56:44 2000 UTC
# Line 1  Line 1 
1  (*  (*
2   * This file was automatically generated by MDGen   * This file was automatically generated by MDGen (v2.0)
3   * from the machine description file "x86/x86.md".   * from the machine description file "x86/x86.md".
4   *)   *)
5    
# Line 7  Line 7 
7  signature X86CELLS =  signature X86CELLS =
8  sig  sig
9     datatype mycellkind =     datatype mycellkind =
10       UNKNOWN       GP
11       | FP
12       | CC
13     | MEM     | MEM
14     | CTRL     | CTRL
15     | CC     | UNKNOWN
    | FP  
    | GP  
16     withtype cellset = (int list * int list * int list)     withtype cellset = (int list * int list * int list)
17     include CELLS_BASIS where type cellkind = mycellkind     include CELLS_BASIS where type cellkind = mycellkind
    val showCC : cell -> string  
    val showFP : cell -> string  
18     val showGP : cell -> string     val showGP : cell -> string
19     val addGP : (cell * cellset) -> cellset     val showFP : cell -> string
20     val addFP : (cell * cellset) -> cellset     val showCC : cell -> string
21     val addCC : (cell * cellset) -> cellset     val showMEM : cell -> string
22     val edi : cell     val showCTRL : cell -> string
23     val ebp : cell     val showGPWithType : (cell * ty) -> string
24     val fasmTmp : cell     val showFPWithType : (cell * ty) -> string
25     val stackptrR : cell     val showCCWithType : (cell * ty) -> string
26       val showMEMWithType : (cell * ty) -> string
27       val showCTRLWithType : (cell * ty) -> string
28     val eax : cell     val eax : cell
    val ebx : cell  
29     val ecx : cell     val ecx : cell
    val esi : cell  
30     val edx : cell     val edx : cell
31     val asmTmpR : cell     val ebx : cell
32     val esp : cell     val esp : cell
33       val ebp : cell
34       val esi : cell
35       val edi : cell
36       val stackptrR : cell
37       val ST : int -> cell
38       val asmTmpR : cell
39       val fasmTmp : cell
40       val addGP : (cell * cellset) -> cellset
41       val addFP : (cell * cellset) -> cellset
42       val addCC : (cell * cellset) -> cellset
43     val zeroReg : cellkind -> cell option     val zeroReg : cellkind -> cell option
44     val toString : cellkind -> cell -> string     val toString : cellkind -> cell -> string
45       val toStringWithType : cellkind -> cell * ty -> string
46     val addCell : cellkind -> cell * cellset -> cellset     val addCell : cellkind -> cell * cellset -> cellset
47     val rmvCell : cellkind -> cell * cellset -> cellset     val rmvCell : cellkind -> cell * cellset -> cellset
48     val addReg : cell * cellset -> cellset     val addReg : cell * cellset -> cellset
# Line 51  Line 60 
60  structure X86Cells : X86CELLS =  structure X86Cells : X86CELLS =
61  struct  struct
62     datatype mycellkind =     datatype mycellkind =
63       UNKNOWN       GP
64       | FP
65       | CC
66     | MEM     | MEM
67     | CTRL     | CTRL
68     | CC     | UNKNOWN
    | FP  
    | GP  
69     withtype cellset = (int list * int list * int list)     withtype cellset = (int list * int list * int list)
70     exception X86Cells     exception X86Cells
71     structure SL = SortedList     structure SL = SortedList
72     fun error msg = MLRiscErrorMsg.error("X86Cells",msg)     fun error msg = MLRiscErrorMsg.error("X86Cells",msg)
73     val cellkindToString = (fn CC => "CC"     val cellkindToString = (fn GP => "GP"
74                              | FP => "FP"                              | FP => "FP"
75                              | GP => "GP"                              | CC => "CC"
76                              | MEM => "MEM"                              | MEM => "MEM"
77                              | CTRL => "CTRL"                              | CTRL => "CTRL"
78                              | UNKNOWN => "UNKNOWN"                              | UNKNOWN => "UNKNOWN"
79                            )                            )
80     structure MyCellsBasis = CellsBasisFn     structure MyCellsBasis = CellsBasis
81        (type cellkind = mycellkind        (type cellkind = mycellkind
82         exception Cells = X86Cells         exception Cells = X86Cells
83         val unknown = UNKNOWN         val unknown = UNKNOWN
# Line 76  Line 85 
85         val INT = GP         val INT = GP
86         val FLOAT = FP         val FLOAT = FP
87         val firstPseudo = 256         val firstPseudo = 256
88         val kinds = [CC, FP, GP, MEM, CTRL]         val kinds = [GP, FP, CC, MEM, CTRL, UNKNOWN]
89         val physical = [{from=64, to=0, kind=CC}, {from=32, to=63, kind=FP}, {from=0, to=31, kind=GP}]         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        )        )
91    
92     open MyCellsBasis     open MyCellsBasis
93     val offsetCC = 64     val offsetGP = 0
94    and offsetFP = 32    and offsetFP = 32
95    and offsetGP = 0     and offsetCC = 64
96    and cellnames = ["CC", "FP", "GP"]     and offsetMEM = 64
97    and cellsetnames = ["GP", "FP", "CC"]     and offsetCTRL = 64
    val edi = (7 + offsetGP)  
    val ebp = (5 + offsetGP)  
    val fasmTmp = (~ 1)  
    val stackptrR = (4 + offsetGP)  
98     val eax = (0 + offsetGP)     val eax = (0 + offsetGP)
    val ebx = (3 + offsetGP)  
99     val ecx = (1 + offsetGP)     val ecx = (1 + offsetGP)
    val esi = (6 + offsetGP)  
100     val edx = (2 + offsetGP)     val edx = (2 + offsetGP)
101     val asmTmpR = (~ 1)     val ebx = (3 + offsetGP)
102     val esp = (4 + offsetGP)     val esp = (4 + offsetGP)
103       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    
146     fun showCC r = let     and showCCWithType (r, ty) = let
147            val r = (if (r <= 0)            val r = (if (r <= 63)
148                  then (r - 64)                  then (r - 64)
149                  else r)                  else r)
150         in ((fn _ => "cc"         in (fn _ => "cc"
151             ) r)            ) (r, ty)
152         end         end
153    
154     and showFP r = let     and showMEMWithType (r, ty) = let
155            val r = (if (r <= 63)            val r = (if (r <= 63)
156                  then (r - 32)                   then (r - 64)
157                  else r)                  else r)
158         in ((fn f => (if (f >= 0)andalso (f < 8)         in (fn (r, _) => "m" ^ (Int.toString r)
159                    then (("%st(" ^ (Int.toString f)) ^ ")")            ) (r, ty)
                   else ("%f" ^ (Int.toString f)))  
            ) r)  
160         end         end
161    
162     and showGP r = ((fn 0 => "%eax"     and showCTRLWithType (r, ty) = let
163                       | 1 => "%ecx"            val r = (if (r <= 63)
164                       | 2 => "%edx"                   then (r - 64)
165                       | 3 => "%ebx"                   else r)
166                       | 4 => "%esp"         in (fn (r, _) => "ctrl" ^ (Int.toString r)
167                       | 5 => "%ebp"            ) (r, ty)
168                       | 6 => "%esi"         end
169                       | 7 => "%edi"  
170                       | r => ("%" ^ (Int.toString r))     fun showGP r = showGPWithType (r, 32)
171                     ) r)     fun showFP r = showFPWithType (r, 80)
172     and toString CC = showCC     fun showCC r = showCCWithType (r, 32)
173       | toString FP = showFP     fun showMEM r = showMEMWithType (r, 8)
174       | toString GP = showGP     fun showCTRL r = showCTRLWithType (r, 8)
175       | toString MEM = (fn r => ("m" ^ (Int.toString r))     fun toStringWithType GP = showGPWithType
176                        )       | toStringWithType FP = showFPWithType
177       | toString CTRL = (fn r => ("ctrl" ^ (Int.toString r))       | toStringWithType CC = showCCWithType
178         | toStringWithType MEM = showMEMWithType
179         | toStringWithType CTRL = showCTRLWithType
180         | toStringWithType UNKNOWN = (fn (r, ty) => "unknown" ^ (Int.toString r)
181                         )                         )
182       | toString UNKNOWN = (fn r => ("unknown" ^ (Int.toString r))     fun toString GP = showGP
183         | toString FP = showFP
184         | toString CC = showCC
185         | toString MEM = showMEM
186         | toString CTRL = showCTRL
187         | toString UNKNOWN = (fn r => "unknown" ^ (Int.toString r)
188                            )                            )
189       val cellsetnames = ["GP", "FP", "CC"]
190     val empty = ([], [], [])     val empty = ([], [], [])
   
191     fun addCell GP = addGP     fun addCell GP = addGP
192       | addCell FP = addFP       | addCell FP = addFP
193       | addCell CC = addCC       | addCell CC = addCC
194       | addCell _ = (error "addCell")       | addCell _ = error "addCell"
195     and rmvCell GP = rmvGP     and rmvCell GP = rmvGP
196       | rmvCell FP = rmvFP       | rmvCell FP = rmvFP
197       | rmvCell CC = rmvCC       | rmvCell CC = rmvCC
198       | rmvCell _ = (error "rmvCell")       | rmvCell _ = error "rmvCell"
199     and getCell GP = getCellGP     and getCell GP = getGP
200       | getCell FP = getCellFP       | getCell FP = getFP
201       | getCell CC = getCellCC       | getCell CC = getCC
202       | getCell _ = (error "getCell")       | getCell _ = error "getCell"
203     and updateCell GP = updateCellGP     and updateCell GP = updateGP
204       | updateCell FP = updateCellFP       | updateCell FP = updateFP
205       | updateCell CC = updateCellCC       | updateCell CC = updateCC
206       | updateCell _ = (error "updateCell")       | updateCell _ = error "updateCell"
207     and addGP (r, (setGP, setFP, setCC)) = ((SL.enter (r, setGP)), setFP, setCC)     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)     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)))     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)     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)     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)))     and rmvCC (r, (setGP, setFP, setCC)) = (setGP, setFP, SL.rmv (r, setCC))
213     and getCellGP (setGP, setFP, setCC) = setGP     and getGP (setGP, setFP, setCC) = setGP
214     and getCellFP (setGP, setFP, setCC) = setFP     and getFP (setGP, setFP, setCC) = setFP
215     and getCellCC (setGP, setFP, setCC) = setCC     and getCC (setGP, setFP, setCC) = setCC
216     and updateCellGP ((setGP, setFP, setCC), r) = (r, setFP, setCC)     and updateGP ((setGP, setFP, setCC), r) = (r, setFP, setCC)
217     and updateCellFP ((setGP, setFP, setCC), r) = (setGP, r, setCC)     and updateFP ((setGP, setFP, setCC), r) = (setGP, r, setCC)
218     and updateCellCC ((setGP, setFP, setCC), r) = (setGP, setFP, r)     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)]))     and cellsetToString (setGP, setFP, setCC) = printTuple (cellsetnames, [printSet showGP setGP, printSet showFP setFP, printSet showCC setCC])
220     and cellsetToString' regmap = (fn (setGP, setFP, setCC) => (printTuple (cellsetnames, [((printSet showGP) ((map regmap) setGP)), ((printSet showFP) ((map regmap) setFP)), ((printSet showCC) ((map regmap) setCC))]))     and cellsetToString' regmap = (fn (setGP, setFP, setCC) => cellsetToString (map regmap setGP, map regmap setFP, map regmap setCC)
221                                   )                                   )
222     and cellsetToCells (setGP, setFP, setCC) = (setGP @ (setFP @ setCC))     and cellsetToCells (setGP, setFP, setCC) = setGP @ (setFP @ setCC)
223     val addReg = addGP     val addReg = addGP
224     val addFreg = addFP     val addFreg = addFP
225     val rmvReg = rmvFP     val rmvReg = rmvGP
226     val rmvFreg = rmvFP     val rmvFreg = rmvFP
   
    fun zeroReg _ = NONE  
227  end  end
228    

Legend:
Removed from v.430  
changed lines
  Added in v.545

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