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

Annotation of /sml/branches/SMLNJ/src/MLRISC/hppa/instructions/hppaCells.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 411 - (view) (download)

1 : monnier 411 (*
2 :     * This file was automatically generated by MDGen
3 :     * from the machine description file "hppa/hppa.md".
4 : monnier 245 *)
5 :    
6 :    
7 : monnier 411 signature HPPACELLS =
8 :     sig
9 :     datatype mycellkind =
10 :     UNKNOWN
11 :     | MEM
12 :     | CTRL
13 :     | CC
14 :     | CR
15 :     | GP
16 :     | FP
17 :     withtype cellset = (int list * int list)
18 :     include CELLS_BASIS where type cellkind = mycellkind
19 :     val showCC : register -> string
20 :     val showCR : register -> string
21 :     val showGP : register -> string
22 :     val showFP : register -> string
23 :     val newCC : unit -> register
24 :     val newCR : unit -> register
25 :     val newGP : unit -> register
26 :     val newFP : unit -> register
27 :     val addGP : (register * cellset) -> cellset
28 :     val addFP : (register * cellset) -> cellset
29 :     val returnPtr : register
30 :     val asmTmpR : register
31 :     val stackptrR : register
32 :     val fasmTmp : register
33 :     val sar : register
34 :     val zeroReg : cellkind -> register option
35 :     val toString : cellkind -> register -> string
36 :     val addCell : cellkind -> register * cellset -> cellset
37 :     val addReg : register * cellset -> cellset
38 :     val addFreg : register * cellset -> cellset
39 :     val getCell : cellkind -> cellset -> register list
40 :     val updateCell : cellkind -> cellset * register list -> cellset
41 :     val empty : cellset
42 :     val cellsetToString : cellset -> string
43 :     val cellsetToString' : (register -> register) -> cellset -> string
44 :     val cellsetToRegs : cellset -> register list
45 :     end
46 : monnier 245
47 : monnier 411 structure HppaCells : HPPACELLS =
48 :     struct
49 :     datatype mycellkind =
50 :     UNKNOWN
51 :     | MEM
52 :     | CTRL
53 :     | CC
54 :     | CR
55 :     | GP
56 :     | FP
57 :     withtype cellset = (int list * int list)
58 :     exception HppaCells
59 :     structure SL = SortedList
60 :     fun error msg = MLRiscErrorMsg.error("HppaCells",msg)
61 :     val cellkindToString = (fn CC => "CC"
62 :     | CR => "CR"
63 :     | GP => "GP"
64 :     | FP => "FP"
65 :     | MEM => "MEM"
66 :     | CTRL => "CTRL"
67 :     | UNKNOWN => "UNKNOWN"
68 :     )
69 :     structure MyCellsBasis = CellsBasisFn
70 :     (type cellkind = mycellkind
71 :     exception Cells = HppaCells
72 :     val unknown = UNKNOWN
73 :     val cellkindToString = cellkindToString
74 :     val INT = GP
75 :     val FLOAT = FP
76 :     val firstPseudo = 256
77 :     val kinds = [CC, CR, GP, FP, MEM, CTRL]
78 :     val physical = [{from=96, to=0, kind=CC}, {from=64, to=95, kind=CR}, {from=0, to=31, kind=GP}, {from=32, to=63, kind=FP}]
79 :     )
80 : monnier 245
81 : monnier 411 open MyCellsBasis
82 :     val offsetCC = 96
83 :     and offsetCR = 64
84 :     and offsetGP = 0
85 :     and offsetFP = 32
86 :     and newCC = (newCell CC)
87 :     and newCR = (newCell CR)
88 :     and newGP = (newCell GP)
89 :     and newFP = (newCell FP)
90 :     and cellnames = ["CC", "CR", "GP", "FP"]
91 :     and cellsetnames = ["GP", "FP"]
92 :     val returnPtr = (2 + offsetGP)
93 :     val asmTmpR = (29 + offsetGP)
94 :     val stackptrR = (30 + offsetGP)
95 :     val fasmTmp = (31 + offsetFP)
96 :     val sar = (11 + offsetCR)
97 : monnier 245
98 : monnier 411 fun showCC r = let
99 :     val r = (if (r <= 0)
100 :     then (r - 96)
101 :     else r)
102 :     in ((fn _ => "cc"
103 :     ) r)
104 :     end
105 : monnier 245
106 : monnier 411 and showCR r = let
107 :     val r = (if (r <= 95)
108 :     then (r - 64)
109 :     else r)
110 :     in ((fn cr => ("%cr" ^ (Int.toString cr))
111 :     ) r)
112 :     end
113 : monnier 245
114 : monnier 411 and showGP r = ((fn r => ("%r" ^ (Int.toString r))
115 :     ) r)
116 :     and showFP r = let
117 :     val r = (if (r <= 63)
118 :     then (r - 32)
119 :     else r)
120 :     in ((fn f => ("%f" ^ (Int.toString f))
121 :     ) r)
122 :     end
123 : monnier 245
124 : monnier 411 and toString CC = showCC
125 :     | toString CR = showCR
126 :     | toString GP = showGP
127 :     | toString FP = showFP
128 :     | toString MEM = (fn r => ("m" ^ (Int.toString r))
129 :     )
130 :     | toString CTRL = (fn r => ("ctrl" ^ (Int.toString r))
131 :     )
132 :     | toString UNKNOWN = (fn r => ("unknown" ^ (Int.toString r))
133 :     )
134 :     val empty = ([], [])
135 : monnier 245
136 : monnier 411 fun addCell CC = addGP
137 :     | addCell GP = addGP
138 :     | addCell FP = addFP
139 :     | addCell _ = (error "addCell")
140 :     and getCell GP = getCellGP
141 :     | getCell FP = getCellFP
142 :     | getCell _ = (error "getCell")
143 :     and updateCell GP = updateCellGP
144 :     | updateCell FP = updateCellFP
145 :     | updateCell _ = (error "updateCell")
146 :     and addGP (r, (setGP, setFP)) = ((SL.enter (r, setGP)), setFP)
147 :     and addFP (r, (setGP, setFP)) = (setGP, (SL.enter (r, setFP)))
148 :     and getCellGP (setGP, setFP) = setGP
149 :     and getCellFP (setGP, setFP) = setFP
150 :     and updateCellGP ((setGP, setFP), r) = (r, setFP)
151 :     and updateCellFP ((setGP, setFP), r) = (setGP, r)
152 :     and cellsetToString (setGP, setFP) = (printTuple (cellsetnames, [((printSet showGP) setGP), ((printSet showFP) setFP)]))
153 :     and cellsetToString' regmap = (fn (setGP, setFP) => (printTuple (cellsetnames, [((printSet showGP) ((map regmap) setGP)), ((printSet showFP) ((map regmap) setFP))]))
154 :     )
155 :     and cellsetToRegs (setGP, setFP) = (setGP @ setFP)
156 :     val addReg = addGP
157 :     val addFreg = addFP
158 : monnier 245
159 : monnier 411 fun zeroReg GP = (SOME (0 + offsetGP))
160 :     | zeroReg FP = (SOME (0 + offsetFP))
161 :     | zeroReg _ = NONE
162 : monnier 245 end
163 :    

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