Debian Codegraph @

lib/mlrisc-lib/MLRISC/mips/instructions/mipsCells.sml

raw
1 (*
2 * WARNING: This file was automatically generated by MDLGen (v3.0)
3 * from the machine description file "mips/mips.mdl".
4 * DO NOT EDIT this file directly
5 *)
6
7
8 signature MIPSCELLS =
9 sig
10 include CELLS
11 val COND : CellsBasis.cellkind
12 val HI : CellsBasis.cellkind
13 val LO : CellsBasis.cellkind
14 val CELLSET : CellsBasis.cellkind
15 val showGP : CellsBasis.register_id -> string
16 val showFP : CellsBasis.register_id -> string
17 val showCC : CellsBasis.register_id -> string
18 val showCOND : CellsBasis.register_id -> string
19 val showHI : CellsBasis.register_id -> string
20 val showLO : CellsBasis.register_id -> string
21 val showMEM : CellsBasis.register_id -> string
22 val showCTRL : CellsBasis.register_id -> string
23 val showCELLSET : CellsBasis.register_id -> string
24 val showGPWithSize : CellsBasis.register_id * CellsBasis.sz -> string
25 val showFPWithSize : CellsBasis.register_id * CellsBasis.sz -> string
26 val showCCWithSize : CellsBasis.register_id * CellsBasis.sz -> string
27 val showCONDWithSize : CellsBasis.register_id * CellsBasis.sz -> string
28 val showHIWithSize : CellsBasis.register_id * CellsBasis.sz -> string
29 val showLOWithSize : CellsBasis.register_id * CellsBasis.sz -> string
30 val showMEMWithSize : CellsBasis.register_id * CellsBasis.sz -> string
31 val showCTRLWithSize : CellsBasis.register_id * CellsBasis.sz -> string
32 val showCELLSETWithSize : CellsBasis.register_id * CellsBasis.sz -> string
33 val linkR : CellsBasis.cell
34 val frameptrR : CellsBasis.cell
35 val globalptrR : CellsBasis.cell
36 val r0 : CellsBasis.cell
37 val addGP : CellsBasis.cell * cellset -> cellset
38 val addFP : CellsBasis.cell * cellset -> cellset
39 val addCC : CellsBasis.cell * cellset -> cellset
40 val addCOND : CellsBasis.cell * cellset -> cellset
41 val addHI : CellsBasis.cell * cellset -> cellset
42 val addLO : CellsBasis.cell * cellset -> cellset
43 val addMEM : CellsBasis.cell * cellset -> cellset
44 val addCTRL : CellsBasis.cell * cellset -> cellset
45 val addCELLSET : CellsBasis.cell * cellset -> cellset
46 end
47
48 structure MIPSCells : MIPSCELLS =
49 struct
50 exception MIPSCells
51 fun error msg = MLRiscErrorMsg.error("MIPSCells",msg)
52 open CellsBasis
53 fun showGPWithSize (r, ty) = (fn (1, _) => "$at"
54 | (28, _) => "$gp"
55 | (29, _) => "$sp"
56 | (30, _) => "$fp"
57 | (r, _) => "$" ^ (Int.toString r)
58 ) (r, ty)
59 and showFPWithSize (r, ty) = (fn (f, _) => "$f" ^ (Int.toString f)
60 ) (r, ty)
61 and showCCWithSize (r, ty) = (fn (r, _) => "$" ^ (Int.toString r)
62 ) (r, ty)
63 and showCONDWithSize (r, ty) = (fn (r, _) => Int.toString r
64 ) (r, ty)
65 and showHIWithSize (r, ty) = (fn _ => "$hi"
66 ) (r, ty)
67 and showLOWithSize (r, ty) = (fn _ => "$lo"
68 ) (r, ty)
69 and showMEMWithSize (r, ty) = (fn (r, _) => "m" ^ (Int.toString r)
70 ) (r, ty)
71 and showCTRLWithSize (r, ty) = (fn (r, _) => "ctrl" ^ (Int.toString r)
72 ) (r, ty)
73 and showCELLSETWithSize (r, ty) = (fn _ => "CELLSET"
74 ) (r, ty)
75 fun showGP r = showGPWithSize (r, 64)
76 fun showFP r = showFPWithSize (r, 64)
77 fun showCC r = showCCWithSize (r, 64)
78 fun showCOND r = showCONDWithSize (r, 64)
79 fun showHI r = showHIWithSize (r, 64)
80 fun showLO r = showLOWithSize (r, 64)
81 fun showMEM r = showMEMWithSize (r, 8)
82 fun showCTRL r = showCTRLWithSize (r, 0)
83 fun showCELLSET r = showCELLSETWithSize (r, 0)
84 val COND = CellsBasis.newCellKind {name="COND", nickname="cond"}
85 and HI = CellsBasis.newCellKind {name="HI", nickname="hi"}
86 and LO = CellsBasis.newCellKind {name="LO", nickname="lo"}
87 and CELLSET = CellsBasis.newCellKind {name="CELLSET", nickname="cellset"}
88 structure MyCells = Cells
89 (exception Cells = MIPSCells
90 val firstPseudo = 256
91 val desc_GP = CellsBasis.DESC {low=0, high=31, kind=CellsBasis.GP, defaultValues=[(0,
92 0)], zeroReg=SOME 0, toString=showGP, toStringWithSize=showGPWithSize,
93 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
94 and desc_FP = CellsBasis.DESC {low=32, high=63, kind=CellsBasis.FP,
95 defaultValues=[], zeroReg=NONE, toString=showFP, toStringWithSize=showFPWithSize,
96 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
97 and desc_COND = CellsBasis.DESC {low=64, high=71, kind=COND, defaultValues=[],
98 zeroReg=NONE, toString=showCOND, toStringWithSize=showCONDWithSize,
99 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
100 and desc_HI = CellsBasis.DESC {low=72, high=72, kind=HI, defaultValues=[],
101 zeroReg=NONE, toString=showHI, toStringWithSize=showHIWithSize,
102 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
103 and desc_LO = CellsBasis.DESC {low=73, high=73, kind=LO, defaultValues=[],
104 zeroReg=NONE, toString=showLO, toStringWithSize=showLOWithSize,
105 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
106 and desc_MEM = CellsBasis.DESC {low=74, high=73, kind=CellsBasis.MEM,
107 defaultValues=[], zeroReg=NONE, toString=showMEM, toStringWithSize=showMEMWithSize,
108 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
109 and desc_CTRL = CellsBasis.DESC {low=74, high=73, kind=CellsBasis.CTRL,
110 defaultValues=[], zeroReg=NONE, toString=showCTRL, toStringWithSize=showCTRLWithSize,
111 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
112 and desc_CELLSET = CellsBasis.DESC {low=74, high=73, kind=CELLSET, defaultValues=[],
113 zeroReg=NONE, toString=showCELLSET, toStringWithSize=showCELLSETWithSize,
114 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
115 val cellKindDescs = [(CellsBasis.GP, desc_GP), (CellsBasis.FP, desc_FP),
116 (CellsBasis.CC, desc_GP), (COND, desc_COND), (HI, desc_HI), (LO,
117 desc_LO), (CellsBasis.MEM, desc_MEM), (CellsBasis.CTRL, desc_CTRL),
118 (CELLSET, desc_CELLSET)]
119 )
120
121 open MyCells
122 val addGP = CellSet.add
123 and addFP = CellSet.add
124 and addCC = CellSet.add
125 and addCOND = CellSet.add
126 and addHI = CellSet.add
127 and addLO = CellSet.add
128 and addMEM = CellSet.add
129 and addCTRL = CellSet.add
130 and addCELLSET = CellSet.add
131 val RegGP = Reg GP
132 and RegFP = Reg FP
133 and RegCC = Reg CC
134 and RegCOND = Reg COND
135 and RegHI = Reg HI
136 and RegLO = Reg LO
137 and RegMEM = Reg MEM
138 and RegCTRL = Reg CTRL
139 and RegCELLSET = Reg CELLSET
140 val stackptrR = RegGP 29
141 val linkR = RegGP 31
142 val frameptrR = RegGP 30
143 val globalptrR = RegGP 28
144 val asmTmpR = RegGP 1
145 val fasmTmp = RegFP 30
146 val r0 = RegGP 0
147 end
148