| 1 |
(* sparcRegAlloc.sml --- sparc integer and floating register allocator |
| 2 |
* |
| 3 |
* COPYRIGHT (c) 1996 AT&T Bell Laboratories. |
| 4 |
* |
| 5 |
*) |
| 6 |
|
| 7 |
(* Integer and floating register allocators are a partial application |
| 8 |
* of a curried functor. |
| 9 |
*) |
| 10 |
|
| 11 |
functor SparcRegAlloc(structure I : INSTRUCTIONS where C = SparcCells |
| 12 |
structure P : INSN_PROPERTIES where I = I |
| 13 |
structure F : FLOWGRAPH where I = I |
| 14 |
structure Asm : INSTRUCTION_EMITTER where I = I and P=F.P |
| 15 |
) : |
| 16 |
sig |
| 17 |
structure I : INSTRUCTIONS |
| 18 |
functor IntRa (structure RaUser : RA_USER_PARAMS |
| 19 |
where I = I and B = F.B) : RA |
| 20 |
functor FloatRa (structure RaUser : RA_USER_PARAMS |
| 21 |
where I = I and B = F.B) : RA |
| 22 |
end= |
| 23 |
struct |
| 24 |
|
| 25 |
structure I = I |
| 26 |
structure C=I.C |
| 27 |
|
| 28 |
(* liveness analysis for general purpose registers *) |
| 29 |
structure RegLiveness = |
| 30 |
Liveness(structure Flowgraph=F |
| 31 |
structure Instruction=I |
| 32 |
val defUse = P.defUse C.GP |
| 33 |
val regSet = C.getCell C.GP |
| 34 |
val cellset = C.updateCell C.GP) |
| 35 |
|
| 36 |
|
| 37 |
functor IntRa = |
| 38 |
RegAllocator |
| 39 |
(structure RaArch = struct |
| 40 |
structure InsnProps = P |
| 41 |
structure AsmEmitter = Asm |
| 42 |
structure I = I |
| 43 |
structure Liveness=RegLiveness |
| 44 |
|
| 45 |
val defUse = P.defUse C.GP |
| 46 |
val firstPseudoR = 32 |
| 47 |
val maxPseudoR = SparcCells.maxCell |
| 48 |
val numRegs = SparcCells.numCell SparcCells.GP |
| 49 |
val regSet = C.getCell C.GP |
| 50 |
end) |
| 51 |
|
| 52 |
(* liveness analysis for floating point registers *) |
| 53 |
structure FregLiveness = |
| 54 |
Liveness(structure Flowgraph=F |
| 55 |
structure Instruction=I |
| 56 |
val defUse = P.defUse C.FP |
| 57 |
val regSet = C.getCell C.FP |
| 58 |
val cellset = C.updateCell C.FP) |
| 59 |
|
| 60 |
functor FloatRa = |
| 61 |
RegAllocator |
| 62 |
(structure RaArch = struct |
| 63 |
structure InsnProps = P |
| 64 |
structure AsmEmitter = Asm |
| 65 |
structure I = I |
| 66 |
structure Liveness=FregLiveness |
| 67 |
|
| 68 |
val defUse = P.defUse C.FP |
| 69 |
val firstPseudoR = 64 |
| 70 |
val maxPseudoR = SparcCells.maxCell |
| 71 |
val numRegs = SparcCells.numCell SparcCells.FP |
| 72 |
val regSet = C.getCell C.FP |
| 73 |
end) |
| 74 |
end |
| 75 |
|