| 1 |
(* ppcRegAlloc.sml |
| 2 |
* |
| 3 |
* COPYRIGHT (c) 2018 The Fellowship of SML/NJ (http://www.smlnj.org) |
| 4 |
* All rights reserved. |
| 5 |
*) |
| 6 |
|
| 7 |
functor PPCRegAlloc(structure I : INSTRUCTIONS where C = PPCCells |
| 8 |
structure P : INSN_PROPERTIES where I = I |
| 9 |
structure F : FLOWGRAPH where I = I and P = P |
| 10 |
structure Asm : INSTRUCTION_EMITTER where I=I and P=P) : |
| 11 |
sig |
| 12 |
functor IntRa (structure RaUser : RA_USER_PARAMS |
| 13 |
where I = I |
| 14 |
where type B.name = F.B.name) : RA |
| 15 |
functor FloatRa (structure RaUser : RA_USER_PARAMS |
| 16 |
where I = I |
| 17 |
where type B.name = F.B.name) : RA |
| 18 |
end= |
| 19 |
struct |
| 20 |
|
| 21 |
structure C=I.C |
| 22 |
|
| 23 |
(* liveness analysis for general purpose registers *) |
| 24 |
structure RegLiveness = |
| 25 |
Liveness(structure Flowgraph=F |
| 26 |
structure Instruction=I |
| 27 |
val defUse = P.defUse C.GP |
| 28 |
val regSet = C.getCell C.GP |
| 29 |
val cellset = C.updateCell C.GP) |
| 30 |
|
| 31 |
|
| 32 |
functor IntRa = |
| 33 |
RegAllocator |
| 34 |
(structure RaArch = struct |
| 35 |
structure InsnProps = P |
| 36 |
structure AsmEmitter = Asm |
| 37 |
structure I = I |
| 38 |
structure Liveness=RegLiveness |
| 39 |
|
| 40 |
val defUse = P.defUse C.GP |
| 41 |
val firstPseudoR = 32 |
| 42 |
val maxPseudoR = C.maxCell |
| 43 |
val numRegs = C.numCell C.GP |
| 44 |
val regSet = C.getCell C.GP |
| 45 |
end) |
| 46 |
|
| 47 |
(* liveness analysis for floating point registers *) |
| 48 |
structure FregLiveness = |
| 49 |
Liveness(structure Flowgraph=F |
| 50 |
structure Instruction=I |
| 51 |
val defUse = P.defUse C.FP |
| 52 |
val regSet = C.getCell C.FP |
| 53 |
val cellset = C.updateCell C.FP) |
| 54 |
|
| 55 |
functor FloatRa = |
| 56 |
RegAllocator |
| 57 |
(structure RaArch = struct |
| 58 |
structure InsnProps = P |
| 59 |
structure AsmEmitter = Asm |
| 60 |
structure I = I |
| 61 |
structure Liveness=FregLiveness |
| 62 |
|
| 63 |
val defUse = P.defUse C.FP |
| 64 |
val firstPseudoR = 64 |
| 65 |
val maxPseudoR = C.maxCell |
| 66 |
val numRegs = C.numCell C.FP |
| 67 |
val regSet = C.getCell C.FP |
| 68 |
end) |
| 69 |
end |
| 70 |
|