Debian Codegraph @

lib/mlrisc-lib/MLRISC/x86/instructions/x86Cells.sml

raw
1 (*
2 * WARNING: This file was automatically generated by MDLGen (v3.1)
3 * from the machine description file "x86/x86.mdl".
4 * DO NOT EDIT this file directly
5 *)
6
7
8 signature X86CELLS =
9 sig
10 include CELLS
11 val EFLAGS : CellsBasis.cellkind
12 val FFLAGS : CellsBasis.cellkind
13 val CELLSET : CellsBasis.cellkind
14 val showGP : CellsBasis.register_id -> string
15 val showFP : CellsBasis.register_id -> string
16 val showCC : CellsBasis.register_id -> string
17 val showEFLAGS : CellsBasis.register_id -> string
18 val showFFLAGS : CellsBasis.register_id -> string
19 val showMEM : CellsBasis.register_id -> string
20 val showCTRL : CellsBasis.register_id -> string
21 val showCELLSET : CellsBasis.register_id -> string
22 val showGPWithSize : CellsBasis.register_id * CellsBasis.sz -> string
23 val showFPWithSize : CellsBasis.register_id * CellsBasis.sz -> string
24 val showCCWithSize : CellsBasis.register_id * CellsBasis.sz -> string
25 val showEFLAGSWithSize : CellsBasis.register_id * CellsBasis.sz -> string
26 val showFFLAGSWithSize : CellsBasis.register_id * CellsBasis.sz -> string
27 val showMEMWithSize : CellsBasis.register_id * CellsBasis.sz -> string
28 val showCTRLWithSize : CellsBasis.register_id * CellsBasis.sz -> string
29 val showCELLSETWithSize : CellsBasis.register_id * CellsBasis.sz -> string
30 val eax : CellsBasis.cell
31 val ecx : CellsBasis.cell
32 val edx : CellsBasis.cell
33 val ebx : CellsBasis.cell
34 val esp : CellsBasis.cell
35 val ebp : CellsBasis.cell
36 val esi : CellsBasis.cell
37 val edi : CellsBasis.cell
38 val ST : int -> CellsBasis.cell
39 val ST0 : CellsBasis.cell
40 val eflags : CellsBasis.cell
41 val addGP : CellsBasis.cell * cellset -> cellset
42 val addFP : CellsBasis.cell * cellset -> cellset
43 val addCC : CellsBasis.cell * cellset -> cellset
44 val addEFLAGS : CellsBasis.cell * cellset -> cellset
45 val addFFLAGS : CellsBasis.cell * cellset -> cellset
46 val addMEM : CellsBasis.cell * cellset -> cellset
47 val addCTRL : CellsBasis.cell * cellset -> cellset
48 val addCELLSET : CellsBasis.cell * cellset -> cellset
49 end
50
51 structure X86Cells : X86CELLS =
52 struct
53 exception X86Cells
54 fun error msg = MLRiscErrorMsg.error("X86Cells",msg)
55 open CellsBasis
56 fun showGPWithSize (r, ty) = (fn (0, 8) => "%al"
57 | (0, 16) => "%ax"
58 | (0, 32) => "%eax"
59 | (1, 8) => "%cl"
60 | (1, 16) => "%cx"
61 | (1, 32) => "%ecx"
62 | (2, 8) => "%dl"
63 | (2, 16) => "%dx"
64 | (2, 32) => "%edx"
65 | (3, 8) => "%bl"
66 | (3, 16) => "%bx"
67 | (3, 32) => "%ebx"
68 | (4, 16) => "%sp"
69 | (4, 32) => "%esp"
70 | (5, 16) => "%bp"
71 | (5, 32) => "%ebp"
72 | (6, 16) => "%si"
73 | (6, 32) => "%esi"
74 | (7, 16) => "%di"
75 | (7, 32) => "%edi"
76 | (r, _) => "%" ^ (Int.toString r)
77 ) (r, ty)
78 and showFPWithSize (r, ty) = (fn (f, _) => (if (f < 8)
79 then (("%st(" ^ (Int.toString f)) ^ ")")
80 else ("%f" ^ (Int.toString f)))
81 ) (r, ty)
82 and showCCWithSize (r, ty) = (fn _ => "cc"
83 ) (r, ty)
84 and showEFLAGSWithSize (r, ty) = (fn _ => "$eflags"
85 ) (r, ty)
86 and showFFLAGSWithSize (r, ty) = (fn _ => "$fflags"
87 ) (r, ty)
88 and showMEMWithSize (r, ty) = (fn _ => "mem"
89 ) (r, ty)
90 and showCTRLWithSize (r, ty) = (fn _ => "ctrl"
91 ) (r, ty)
92 and showCELLSETWithSize (r, ty) = (fn _ => "CELLSET"
93 ) (r, ty)
94 fun showGP r = showGPWithSize (r, 32)
95 fun showFP r = showFPWithSize (r, 64)
96 fun showCC r = showCCWithSize (r, 32)
97 fun showEFLAGS r = showEFLAGSWithSize (r, 32)
98 fun showFFLAGS r = showFFLAGSWithSize (r, 32)
99 fun showMEM r = showMEMWithSize (r, 8)
100 fun showCTRL r = showCTRLWithSize (r, 0)
101 fun showCELLSET r = showCELLSETWithSize (r, 0)
102 val EFLAGS = CellsBasis.newCellKind {name="EFLAGS", nickname="eflags"}
103 and FFLAGS = CellsBasis.newCellKind {name="FFLAGS", nickname="fflags"}
104 and CELLSET = CellsBasis.newCellKind {name="CELLSET", nickname="cellset"}
105 structure MyCells = Cells
106 (exception Cells = X86Cells
107 val firstPseudo = 256
108 val desc_GP = CellsBasis.DESC {low=0, high=31, kind=CellsBasis.GP, defaultValues=[],
109 zeroReg=NONE, toString=showGP, toStringWithSize=showGPWithSize,
110 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
111 and desc_FP = CellsBasis.DESC {low=32, high=63, kind=CellsBasis.FP,
112 defaultValues=[], zeroReg=NONE, toString=showFP, toStringWithSize=showFPWithSize,
113 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
114 and desc_EFLAGS = CellsBasis.DESC {low=64, high=64, kind=EFLAGS, defaultValues=[],
115 zeroReg=NONE, toString=showEFLAGS, toStringWithSize=showEFLAGSWithSize,
116 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
117 and desc_FFLAGS = CellsBasis.DESC {low=65, high=65, kind=FFLAGS, defaultValues=[],
118 zeroReg=NONE, toString=showFFLAGS, toStringWithSize=showFFLAGSWithSize,
119 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
120 and desc_MEM = CellsBasis.DESC {low=66, high=65, kind=CellsBasis.MEM,
121 defaultValues=[], zeroReg=NONE, toString=showMEM, toStringWithSize=showMEMWithSize,
122 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
123 and desc_CTRL = CellsBasis.DESC {low=66, high=65, kind=CellsBasis.CTRL,
124 defaultValues=[], zeroReg=NONE, toString=showCTRL, toStringWithSize=showCTRLWithSize,
125 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
126 and desc_CELLSET = CellsBasis.DESC {low=66, high=65, kind=CELLSET, defaultValues=[],
127 zeroReg=NONE, toString=showCELLSET, toStringWithSize=showCELLSETWithSize,
128 counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0}
129 val cellKindDescs = [(CellsBasis.GP, desc_GP), (CellsBasis.FP, desc_FP),
130 (CellsBasis.CC, desc_GP), (EFLAGS, desc_EFLAGS), (FFLAGS, desc_FFLAGS),
131 (CellsBasis.MEM, desc_MEM), (CellsBasis.CTRL, desc_CTRL), (CELLSET,
132 desc_CELLSET)]
133 val cellSize = 4
134 )
135
136 open MyCells
137 val addGP = CellSet.add
138 and addFP = CellSet.add
139 and addCC = CellSet.add
140 and addEFLAGS = CellSet.add
141 and addFFLAGS = CellSet.add
142 and addMEM = CellSet.add
143 and addCTRL = CellSet.add
144 and addCELLSET = CellSet.add
145 val RegGP = Reg GP
146 and RegFP = Reg FP
147 and RegCC = Reg CC
148 and RegEFLAGS = Reg EFLAGS
149 and RegFFLAGS = Reg FFLAGS
150 and RegMEM = Reg MEM
151 and RegCTRL = Reg CTRL
152 and RegCELLSET = Reg CELLSET
153 val eax = RegGP 0
154 val ecx = RegGP 1
155 val edx = RegGP 2
156 val ebx = RegGP 3
157 val esp = RegGP 4
158 val ebp = RegGP 5
159 val esi = RegGP 6
160 val edi = RegGP 7
161 val stackptrR = RegGP 4
162 val ST = (fn x => RegFP x
163 )
164 val ST0 = RegFP 0
165 val asmTmpR = RegGP 0
166 val fasmTmp = RegFP 0
167 val eflags = RegEFLAGS 0
168 end
169