(*
 * 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

