| 1 |
(* alphaRegAlloc.sml --- alpha 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 |
|
| 12 |
|
| 13 |
functor AlphaRegAlloc(structure I : INSTRUCTIONS where C = AlphaCells |
| 14 |
structure P : INSN_PROPERTIES where I = I |
| 15 |
structure F : FLOWGRAPH where I = I |
| 16 |
structure Asm : INSTRUCTION_EMITTER |
| 17 |
where I = I and P = F.P) : |
| 18 |
sig |
| 19 |
functor IntRa (structure RaUser : RA_USER_PARAMS |
| 20 |
where I = I |
| 21 |
where type B.name = F.B.name |
| 22 |
(* should be: where I = I -- bug 1205 *)) : RA |
| 23 |
functor FloatRa (structure RaUser : RA_USER_PARAMS |
| 24 |
where I = I |
| 25 |
where type B.name = F.B.name |
| 26 |
(* should be: where I = I *)) : RA |
| 27 |
end = |
| 28 |
struct |
| 29 |
structure C = I.C |
| 30 |
(* liveness analysis for general purpose registers *) |
| 31 |
structure RegLiveness = |
| 32 |
Liveness(structure Flowgraph=F |
| 33 |
structure Instruction=I |
| 34 |
val defUse = P.defUse C.GP |
| 35 |
val regSet = C.getCell C.GP |
| 36 |
val cellset = C.updateCell C.GP) |
| 37 |
|
| 38 |
|
| 39 |
(* integer register allocator *) |
| 40 |
functor IntRa = |
| 41 |
RegAllocator |
| 42 |
(structure RaArch = struct |
| 43 |
|
| 44 |
structure InsnProps = P |
| 45 |
structure AsmEmitter = Asm |
| 46 |
structure I = I |
| 47 |
structure Liveness=RegLiveness |
| 48 |
val defUse = P.defUse C.GP |
| 49 |
val firstPseudoR = 32 |
| 50 |
val maxPseudoR = AlphaCells.maxCell |
| 51 |
val numRegs = AlphaCells.numCell AlphaCells.GP |
| 52 |
val regSet = C.getCell C.GP |
| 53 |
end) |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
(* liveness analysis for floating point registers *) |
| 58 |
structure FregLiveness = |
| 59 |
Liveness(structure Flowgraph=F |
| 60 |
structure Instruction=I |
| 61 |
val defUse = P.defUse C.FP |
| 62 |
val regSet = C.getCell C.FP |
| 63 |
val cellset = C.updateCell C.FP) |
| 64 |
|
| 65 |
(* floating register allocator *) |
| 66 |
functor FloatRa = |
| 67 |
RegAllocator |
| 68 |
(structure RaArch = struct |
| 69 |
|
| 70 |
structure InsnProps = P |
| 71 |
structure AsmEmitter = Asm |
| 72 |
structure Liveness=FregLiveness |
| 73 |
structure I = I |
| 74 |
|
| 75 |
val defUse = P.defUse C.FP |
| 76 |
val firstPseudoR = 64 |
| 77 |
val maxPseudoR = AlphaCells.maxCell |
| 78 |
val numRegs = AlphaCells.numCell AlphaCells.FP |
| 79 |
val regSet = C.getCell C.FP |
| 80 |
end) |
| 81 |
end |