File: mipsCells.sml

package info (click to toggle)
mlton 20210117%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,464 kB
  • sloc: ansic: 27,682; sh: 4,455; asm: 3,569; lisp: 2,879; makefile: 2,347; perl: 1,169; python: 191; pascal: 68; javascript: 7
file content (148 lines) | stat: -rw-r--r-- 7,132 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
(*
 * WARNING: This file was automatically generated by MDLGen (v3.0)
 * from the machine description file "mips/mips.mdl".
 * DO NOT EDIT this file directly
 *)


signature MIPSCELLS =
sig
   include CELLS
   val COND : CellsBasis.cellkind
   val HI : CellsBasis.cellkind
   val LO : CellsBasis.cellkind
   val CELLSET : CellsBasis.cellkind
   val showGP : CellsBasis.register_id -> string
   val showFP : CellsBasis.register_id -> string
   val showCC : CellsBasis.register_id -> string
   val showCOND : CellsBasis.register_id -> string
   val showHI : CellsBasis.register_id -> string
   val showLO : CellsBasis.register_id -> string
   val showMEM : CellsBasis.register_id -> string
   val showCTRL : CellsBasis.register_id -> string
   val showCELLSET : CellsBasis.register_id -> string
   val showGPWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val showFPWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val showCCWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val showCONDWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val showHIWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val showLOWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val showMEMWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val showCTRLWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val showCELLSETWithSize : CellsBasis.register_id * CellsBasis.sz -> string
   val linkR : CellsBasis.cell
   val frameptrR : CellsBasis.cell
   val globalptrR : CellsBasis.cell
   val r0 : CellsBasis.cell
   val addGP : CellsBasis.cell * cellset -> cellset
   val addFP : CellsBasis.cell * cellset -> cellset
   val addCC : CellsBasis.cell * cellset -> cellset
   val addCOND : CellsBasis.cell * cellset -> cellset
   val addHI : CellsBasis.cell * cellset -> cellset
   val addLO : CellsBasis.cell * cellset -> cellset
   val addMEM : CellsBasis.cell * cellset -> cellset
   val addCTRL : CellsBasis.cell * cellset -> cellset
   val addCELLSET : CellsBasis.cell * cellset -> cellset
end

structure MIPSCells : MIPSCELLS =
struct
   exception MIPSCells
   fun error msg = MLRiscErrorMsg.error("MIPSCells",msg)
   open CellsBasis
   fun showGPWithSize (r, ty) = (fn (1, _) => "$at"
                                  | (28, _) => "$gp"
                                  | (29, _) => "$sp"
                                  | (30, _) => "$fp"
                                  | (r, _) => "$" ^ (Int.toString r)
                                ) (r, ty)
   and showFPWithSize (r, ty) = (fn (f, _) => "$f" ^ (Int.toString f)
                                ) (r, ty)
   and showCCWithSize (r, ty) = (fn (r, _) => "$" ^ (Int.toString r)
                                ) (r, ty)
   and showCONDWithSize (r, ty) = (fn (r, _) => Int.toString r
                                  ) (r, ty)
   and showHIWithSize (r, ty) = (fn _ => "$hi"
                                ) (r, ty)
   and showLOWithSize (r, ty) = (fn _ => "$lo"
                                ) (r, ty)
   and showMEMWithSize (r, ty) = (fn (r, _) => "m" ^ (Int.toString r)
                                 ) (r, ty)
   and showCTRLWithSize (r, ty) = (fn (r, _) => "ctrl" ^ (Int.toString r)
                                  ) (r, ty)
   and showCELLSETWithSize (r, ty) = (fn _ => "CELLSET"
                                     ) (r, ty)
   fun showGP r = showGPWithSize (r, 64)
   fun showFP r = showFPWithSize (r, 64)
   fun showCC r = showCCWithSize (r, 64)
   fun showCOND r = showCONDWithSize (r, 64)
   fun showHI r = showHIWithSize (r, 64)
   fun showLO r = showLOWithSize (r, 64)
   fun showMEM r = showMEMWithSize (r, 8)
   fun showCTRL r = showCTRLWithSize (r, 0)
   fun showCELLSET r = showCELLSETWithSize (r, 0)
   val COND = CellsBasis.newCellKind {name="COND", nickname="cond"}
   and HI = CellsBasis.newCellKind {name="HI", nickname="hi"}
   and LO = CellsBasis.newCellKind {name="LO", nickname="lo"}
   and CELLSET = CellsBasis.newCellKind {name="CELLSET", nickname="cellset"}
   structure MyCells = Cells
      (exception Cells = MIPSCells
       val firstPseudo = 256
       val desc_GP = CellsBasis.DESC {low=0, high=31, kind=CellsBasis.GP, defaultValues=[(0, 
              0)], zeroReg=SOME 0, toString=showGP, toStringWithSize=showGPWithSize, 
              counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
       and desc_FP = CellsBasis.DESC {low=32, high=63, kind=CellsBasis.FP, 
              defaultValues=[], zeroReg=NONE, toString=showFP, toStringWithSize=showFPWithSize, 
              counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
       and desc_COND = CellsBasis.DESC {low=64, high=71, kind=COND, defaultValues=[], 
              zeroReg=NONE, toString=showCOND, toStringWithSize=showCONDWithSize, 
              counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
       and desc_HI = CellsBasis.DESC {low=72, high=72, kind=HI, defaultValues=[], 
              zeroReg=NONE, toString=showHI, toStringWithSize=showHIWithSize, 
              counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
       and desc_LO = CellsBasis.DESC {low=73, high=73, kind=LO, defaultValues=[], 
              zeroReg=NONE, toString=showLO, toStringWithSize=showLOWithSize, 
              counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
       and desc_MEM = CellsBasis.DESC {low=74, high=73, kind=CellsBasis.MEM, 
              defaultValues=[], zeroReg=NONE, toString=showMEM, toStringWithSize=showMEMWithSize, 
              counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
       and desc_CTRL = CellsBasis.DESC {low=74, high=73, kind=CellsBasis.CTRL, 
              defaultValues=[], zeroReg=NONE, toString=showCTRL, toStringWithSize=showCTRLWithSize, 
              counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
       and desc_CELLSET = CellsBasis.DESC {low=74, high=73, kind=CELLSET, defaultValues=[], 
              zeroReg=NONE, toString=showCELLSET, toStringWithSize=showCELLSETWithSize, 
              counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
       val cellKindDescs = [(CellsBasis.GP, desc_GP), (CellsBasis.FP, desc_FP), 
              (CellsBasis.CC, desc_GP), (COND, desc_COND), (HI, desc_HI), (LO, 
              desc_LO), (CellsBasis.MEM, desc_MEM), (CellsBasis.CTRL, desc_CTRL), 
              (CELLSET, desc_CELLSET)]
      )

   open MyCells
   val addGP = CellSet.add
   and addFP = CellSet.add
   and addCC = CellSet.add
   and addCOND = CellSet.add
   and addHI = CellSet.add
   and addLO = CellSet.add
   and addMEM = CellSet.add
   and addCTRL = CellSet.add
   and addCELLSET = CellSet.add
   val RegGP = Reg GP
   and RegFP = Reg FP
   and RegCC = Reg CC
   and RegCOND = Reg COND
   and RegHI = Reg HI
   and RegLO = Reg LO
   and RegMEM = Reg MEM
   and RegCTRL = Reg CTRL
   and RegCELLSET = Reg CELLSET
   val stackptrR = RegGP 29
   val linkR = RegGP 31
   val frameptrR = RegGP 30
   val globalptrR = RegGP 28
   val asmTmpR = RegGP 1
   val fasmTmp = RegFP 30
   val r0 = RegGP 0
end