| 1 |
(* |
| 2 |
* WARNING: This file was automatically generated by MDLGen (v3.1) |
| 3 |
* from the machine description file "ppc/ppc.mdl". |
| 4 |
* DO NOT EDIT this file directly |
| 5 |
*) |
| 6 |
|
| 7 |
|
| 8 |
signature PPCCELLS = |
| 9 |
sig |
| 10 |
include CELLS |
| 11 |
val SPR : CellsBasis.cellkind |
| 12 |
val CELLSET : CellsBasis.cellkind |
| 13 |
val showGP : CellsBasis.register_id -> string |
| 14 |
val showFP : CellsBasis.register_id -> string |
| 15 |
val showCC : CellsBasis.register_id -> string |
| 16 |
val showSPR : CellsBasis.register_id -> string |
| 17 |
val showMEM : CellsBasis.register_id -> string |
| 18 |
val showCTRL : CellsBasis.register_id -> string |
| 19 |
val showCELLSET : CellsBasis.register_id -> string |
| 20 |
val showGPWithSize : CellsBasis.register_id * CellsBasis.sz -> string |
| 21 |
val showFPWithSize : CellsBasis.register_id * CellsBasis.sz -> string |
| 22 |
val showCCWithSize : CellsBasis.register_id * CellsBasis.sz -> string |
| 23 |
val showSPRWithSize : CellsBasis.register_id * CellsBasis.sz -> string |
| 24 |
val showMEMWithSize : CellsBasis.register_id * CellsBasis.sz -> string |
| 25 |
val showCTRLWithSize : CellsBasis.register_id * CellsBasis.sz -> string |
| 26 |
val showCELLSETWithSize : CellsBasis.register_id * CellsBasis.sz -> string |
| 27 |
val r0 : CellsBasis.cell |
| 28 |
val xer : CellsBasis.cell |
| 29 |
val lr : CellsBasis.cell |
| 30 |
val ctr : CellsBasis.cell |
| 31 |
val addGP : CellsBasis.cell * cellset -> cellset |
| 32 |
val addFP : CellsBasis.cell * cellset -> cellset |
| 33 |
val addCC : CellsBasis.cell * cellset -> cellset |
| 34 |
val addSPR : CellsBasis.cell * cellset -> cellset |
| 35 |
val addMEM : CellsBasis.cell * cellset -> cellset |
| 36 |
val addCTRL : CellsBasis.cell * cellset -> cellset |
| 37 |
val addCELLSET : CellsBasis.cell * cellset -> cellset |
| 38 |
end |
| 39 |
|
| 40 |
structure PPCCells : PPCCELLS = |
| 41 |
struct |
| 42 |
exception PPCCells |
| 43 |
fun error msg = MLRiscErrorMsg.error("PPCCells",msg) |
| 44 |
open CellsBasis |
| 45 |
fun showGPWithSize (r, ty) = (fn (r, _) => (if ( ! PPCAsmSyntax.ibm_syntax) |
| 46 |
then (Int.toString r) |
| 47 |
else ("r" ^ (Int.toString r))) |
| 48 |
) (r, ty) |
| 49 |
and showFPWithSize (r, ty) = (fn (f, _) => (if ( ! PPCAsmSyntax.ibm_syntax) |
| 50 |
then (Int.toString f) |
| 51 |
else ("f" ^ (Int.toString r))) |
| 52 |
) (r, ty) |
| 53 |
and showCCWithSize (r, ty) = (fn (cr, _) => "cr" ^ (Int.toString cr) |
| 54 |
) (r, ty) |
| 55 |
and showSPRWithSize (r, ty) = (fn (1, _) => "xer" |
| 56 |
| (8, _) => "lr" |
| 57 |
| (9, _) => "ctr" |
| 58 |
| (r, _) => Int.toString r |
| 59 |
) (r, ty) |
| 60 |
and showMEMWithSize (r, ty) = (fn (r, _) => "m" ^ (Int.toString r) |
| 61 |
) (r, ty) |
| 62 |
and showCTRLWithSize (r, ty) = (fn (r, _) => "ctrl" ^ (Int.toString r) |
| 63 |
) (r, ty) |
| 64 |
and showCELLSETWithSize (r, ty) = (fn _ => "CELLSET" |
| 65 |
) (r, ty) |
| 66 |
fun showGP r = showGPWithSize (r, 64) |
| 67 |
fun showFP r = showFPWithSize (r, 64) |
| 68 |
fun showCC r = showCCWithSize (r, 4) |
| 69 |
fun showSPR r = showSPRWithSize (r, 64) |
| 70 |
fun showMEM r = showMEMWithSize (r, 8) |
| 71 |
fun showCTRL r = showCTRLWithSize (r, 8) |
| 72 |
fun showCELLSET r = showCELLSETWithSize (r, 0) |
| 73 |
val SPR = CellsBasis.newCellKind {name="SPR", nickname="spr"} |
| 74 |
and CELLSET = CellsBasis.newCellKind {name="CELLSET", nickname="cellset"} |
| 75 |
structure MyCells = Cells |
| 76 |
(exception Cells = PPCCells |
| 77 |
val firstPseudo = 256 |
| 78 |
val desc_GP = CellsBasis.DESC {low=0, high=31, kind=CellsBasis.GP, defaultValues=[], |
| 79 |
zeroReg=NONE, toString=showGP, toStringWithSize=showGPWithSize, |
| 80 |
counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0} |
| 81 |
and desc_FP = CellsBasis.DESC {low=32, high=63, kind=CellsBasis.FP, |
| 82 |
defaultValues=[], zeroReg=NONE, toString=showFP, toStringWithSize=showFPWithSize, |
| 83 |
counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0} |
| 84 |
and desc_CC = CellsBasis.DESC {low=64, high=71, kind=CellsBasis.CC, |
| 85 |
defaultValues=[], zeroReg=NONE, toString=showCC, toStringWithSize=showCCWithSize, |
| 86 |
counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0} |
| 87 |
and desc_SPR = CellsBasis.DESC {low=72, high=103, kind=SPR, defaultValues=[], |
| 88 |
zeroReg=NONE, toString=showSPR, toStringWithSize=showSPRWithSize, |
| 89 |
counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0} |
| 90 |
and desc_MEM = CellsBasis.DESC {low=104, high=103, kind=CellsBasis.MEM, |
| 91 |
defaultValues=[], zeroReg=NONE, toString=showMEM, toStringWithSize=showMEMWithSize, |
| 92 |
counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0} |
| 93 |
and desc_CTRL = CellsBasis.DESC {low=104, high=103, kind=CellsBasis.CTRL, |
| 94 |
defaultValues=[], zeroReg=NONE, toString=showCTRL, toStringWithSize=showCTRLWithSize, |
| 95 |
counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0} |
| 96 |
and desc_CELLSET = CellsBasis.DESC {low=104, high=103, kind=CELLSET, |
| 97 |
defaultValues=[], zeroReg=NONE, toString=showCELLSET, toStringWithSize=showCELLSETWithSize, |
| 98 |
counter=ref 0, dedicated=ref 0, physicalRegs=ref CellsBasis.array0} |
| 99 |
val cellKindDescs = [(CellsBasis.GP, desc_GP), (CellsBasis.FP, desc_FP), |
| 100 |
(CellsBasis.CC, desc_CC), (SPR, desc_SPR), (CellsBasis.MEM, desc_MEM), |
| 101 |
(CellsBasis.CTRL, desc_CTRL), (CELLSET, desc_CELLSET)] |
| 102 |
val cellSize = 8 |
| 103 |
) |
| 104 |
|
| 105 |
open MyCells |
| 106 |
val addGP = CellSet.add |
| 107 |
and addFP = CellSet.add |
| 108 |
and addCC = CellSet.add |
| 109 |
and addSPR = CellSet.add |
| 110 |
and addMEM = CellSet.add |
| 111 |
and addCTRL = CellSet.add |
| 112 |
and addCELLSET = CellSet.add |
| 113 |
val RegGP = Reg GP |
| 114 |
and RegFP = Reg FP |
| 115 |
and RegCC = Reg CC |
| 116 |
and RegSPR = Reg SPR |
| 117 |
and RegMEM = Reg MEM |
| 118 |
and RegCTRL = Reg CTRL |
| 119 |
and RegCELLSET = Reg CELLSET |
| 120 |
val stackptrR = RegGP 1 |
| 121 |
val asmTmpR = RegGP 28 |
| 122 |
val fasmTmp = RegFP 0 |
| 123 |
val r0 = RegGP 0 |
| 124 |
val xer = RegSPR 1 |
| 125 |
val lr = RegSPR 8 |
| 126 |
val ctr = RegSPR 9 |
| 127 |
end |
| 128 |
|