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

Diff of /sml/branches/SMLNJ/src/MLRISC/x86/instructions/x86Cells.sml

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

revision 428, Wed Sep 8 09:47:00 1999 UTC revision 429, Wed Sep 8 09:47:00 1999 UTC
# Line 11  Line 11 
11     | MEM     | MEM
12     | CTRL     | CTRL
13     | CC     | CC
    | GP  
14     | FP     | FP
15       | 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
18     val showCC : register -> string     val showCC : cell -> string
19     val showGP : register -> string     val showFP : cell -> string
20     val showFP : register -> string     val showGP : cell -> string
21     val newCC : unit -> register     val addGP : (cell * cellset) -> cellset
22     val newGP : unit -> register     val addFP : (cell * cellset) -> cellset
23     val newFP : unit -> register     val addCC : (cell * cellset) -> cellset
24     val addGP : (register * cellset) -> cellset     val edi : cell
25     val addFP : (register * cellset) -> cellset     val ebp : cell
26     val addCC : (register * cellset) -> cellset     val fasmTmp : cell
27     val ebp : register     val stackptrR : cell
28     val eax : register     val eax : cell
29     val ecx : register     val ebx : cell
30     val esp : register     val ecx : cell
31     val asmTmpR : register     val esi : cell
32     val stackptrR : register     val edx : cell
33     val fasmTmp : register     val asmTmpR : cell
34     val edi : register     val esp : cell
35     val ebx : register     val zeroReg : cellkind -> cell option
36     val esi : register     val toString : cellkind -> cell -> string
37     val edx : register     val addCell : cellkind -> cell * cellset -> cellset
38     val zeroReg : cellkind -> register option     val rmvCell : cellkind -> cell * cellset -> cellset
39     val toString : cellkind -> register -> string     val addReg : cell * cellset -> cellset
40     val addCell : cellkind -> register * cellset -> cellset     val rmvReg : cell * cellset -> cellset
41     val addReg : register * cellset -> cellset     val addFreg : cell * cellset -> cellset
42     val addFreg : register * cellset -> cellset     val rmvFreg : cell * cellset -> cellset
43     val getCell : cellkind -> cellset -> register list     val getCell : cellkind -> cellset -> cell list
44     val updateCell : cellkind -> cellset * register list -> cellset     val updateCell : cellkind -> cellset * cell list -> cellset
45     val empty : cellset     val empty : cellset
46     val cellsetToString : cellset -> string     val cellsetToString : cellset -> string
47     val cellsetToString' : (register -> register) -> cellset -> string     val cellsetToString' : (cell -> cell) -> cellset -> string
48     val cellsetToRegs : cellset -> register list     val cellsetToCells : cellset -> cell list
49  end  end
50    
51  structure X86Cells : X86CELLS =  structure X86Cells : X86CELLS =
# Line 55  Line 55 
55     | MEM     | MEM
56     | CTRL     | CTRL
57     | CC     | CC
    | GP  
58     | FP     | FP
59       | GP
60     withtype cellset = (int list * int list * int list)     withtype cellset = (int list * int list * int list)
61     exception X86Cells     exception X86Cells
62     structure SL = SortedList     structure SL = SortedList
63     fun error msg = MLRiscErrorMsg.error("X86Cells",msg)     fun error msg = MLRiscErrorMsg.error("X86Cells",msg)
64     val cellkindToString = (fn CC => "CC"     val cellkindToString = (fn CC => "CC"
                             | GP => "GP"  
65                              | FP => "FP"                              | FP => "FP"
66                                | GP => "GP"
67                              | MEM => "MEM"                              | MEM => "MEM"
68                              | CTRL => "CTRL"                              | CTRL => "CTRL"
69                              | UNKNOWN => "UNKNOWN"                              | UNKNOWN => "UNKNOWN"
# Line 76  Line 76 
76         val INT = GP         val INT = GP
77         val FLOAT = FP         val FLOAT = FP
78         val firstPseudo = 256         val firstPseudo = 256
79         val kinds = [CC, GP, FP, MEM, CTRL]         val kinds = [CC, FP, GP, MEM, CTRL]
80         val physical = [{from=64, to=0, kind=CC}, {from=0, to=31, kind=GP}, {from=32, to=63, kind=FP}]         val physical = [{from=64, to=0, kind=CC}, {from=32, to=63, kind=FP}, {from=0, to=31, kind=GP}]
81        )        )
82    
83     open MyCellsBasis     open MyCellsBasis
84     val offsetCC = 64     val offsetCC = 64
   and offsetGP = 0  
85    and offsetFP = 32    and offsetFP = 32
86    and newCC = (newCell CC)    and offsetGP = 0
87    and newGP = (newCell GP)    and cellnames = ["CC", "FP", "GP"]
   and newFP = (newCell FP)  
   and cellnames = ["CC", "GP", "FP"]  
88    and cellsetnames = ["GP", "FP", "CC"]    and cellsetnames = ["GP", "FP", "CC"]
89       val edi = (7 + offsetGP)
90     val ebp = (5 + offsetGP)     val ebp = (5 + offsetGP)
    val eax = (0 + offsetGP)  
    val ecx = (1 + offsetGP)  
    val esp = (4 + offsetGP)  
    val asmTmpR = (~ 1)  
    val stackptrR = esp  
91     val fasmTmp = (~ 1)     val fasmTmp = (~ 1)
92     val edi = (7 + offsetGP)     val stackptrR = (4 + offsetGP)
93       val eax = (0 + offsetGP)
94     val ebx = (3 + offsetGP)     val ebx = (3 + offsetGP)
95       val ecx = (1 + offsetGP)
96     val esi = (6 + offsetGP)     val esi = (6 + offsetGP)
97     val edx = (2 + offsetGP)     val edx = (2 + offsetGP)
98       val asmTmpR = (~ 1)
99       val esp = (4 + offsetGP)
100    
101     fun showCC r = let     fun showCC r = let
102            val r = (if (r <= 0)            val r = (if (r <= 0)
# Line 109  Line 106 
106             ) r)             ) r)
107         end         end
108    
    and showGP r = ((fn 0 => "%eax"  
                      | 1 => "%ecx"  
                      | 2 => "%edx"  
                      | 3 => "%ebx"  
                      | 4 => "%esp"  
                      | 5 => "%ebp"  
                      | 6 => "%esi"  
                      | 7 => "%edi"  
                      | r => ("%" ^ (Int.toString r))  
                    ) r)  
109     and showFP r = let     and showFP r = let
110            val r = (if (r <= 63)            val r = (if (r <= 63)
111                  then (r - 32)                  then (r - 32)
# Line 129  Line 116 
116             ) r)             ) r)
117         end         end
118    
119       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     and toString CC = showCC
      | toString GP = showGP  
130       | toString FP = showFP       | toString FP = showFP
131         | toString GP = showGP
132       | toString MEM = (fn r => ("m" ^ (Int.toString r))       | toString MEM = (fn r => ("m" ^ (Int.toString r))
133                        )                        )
134       | toString CTRL = (fn r => ("ctrl" ^ (Int.toString r))       | toString CTRL = (fn r => ("ctrl" ^ (Int.toString r))
# Line 140  Line 137 
137                            )                            )
138     val empty = ([], [], [])     val empty = ([], [], [])
139    
140     fun addCell CC = addCC     fun addCell GP = addGP
      | addCell GP = addGP  
141       | addCell FP = addFP       | addCell FP = addFP
142         | addCell CC = addCC
143       | addCell _ = (error "addCell")       | addCell _ = (error "addCell")
144     and getCell CC = getCellCC     and rmvCell GP = rmvGP
145       | getCell GP = getCellGP       | rmvCell FP = rmvFP
146         | rmvCell CC = rmvCC
147         | rmvCell _ = (error "rmvCell")
148       and getCell GP = getCellGP
149       | getCell FP = getCellFP       | getCell FP = getCellFP
150         | getCell CC = getCellCC
151       | getCell _ = (error "getCell")       | getCell _ = (error "getCell")
152     and updateCell CC = updateCellCC     and updateCell GP = updateCellGP
      | updateCell GP = updateCellGP  
153       | updateCell FP = updateCellFP       | updateCell FP = updateCellFP
154         | updateCell CC = updateCellCC
155       | updateCell _ = (error "updateCell")       | updateCell _ = (error "updateCell")
156     and addGP (r, (setGP, setFP, setCC)) = ((SL.enter (r, setGP)), setFP, setCC)     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)     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)))     and addCC (r, (setGP, setFP, setCC)) = (setGP, setFP, (SL.enter (r, setCC)))
159       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     and getCellGP (setGP, setFP, setCC) = setGP     and getCellGP (setGP, setFP, setCC) = setGP
163     and getCellFP (setGP, setFP, setCC) = setFP     and getCellFP (setGP, setFP, setCC) = setFP
164     and getCellCC (setGP, setFP, setCC) = setCC     and getCellCC (setGP, setFP, setCC) = setCC
# Line 164  Line 168 
168     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)]))
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))]))     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     and cellsetToRegs (setGP, setFP, setCC) = (setGP @ (setFP @ setCC))     and cellsetToCells (setGP, setFP, setCC) = (setGP @ (setFP @ setCC))
172     val addReg = addGP     val addReg = addGP
173     val addFreg = addFP     val addFreg = addFP
174       val rmvReg = rmvFP
175       val rmvFreg = rmvFP
176    
177     fun zeroReg _ = NONE     fun zeroReg _ = NONE
178  end  end

Legend:
Removed from v.428  
changed lines
  Added in v.429

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