Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utils for calculating general worst, bound, squeese and free, functions.
as per: "A Generalized Algorithm for Graph-Coloring Register Allocation" Michael Smith, Normal Ramsey, Glenn Holloway. PLDI 2004
These general versions are not used in GHC proper because they are too slow. Instead, hand written optimised versions are provided for each architecture in MachRegs*.hs
This code is here because we can test the architecture specific code against it.
Synopsis
- data RegClass
- data Reg
- data RegSub
- worst :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> Int -> RegClass -> RegClass -> Int
- bound :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> RegClass -> [RegClass] -> Int
- squeese :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> RegClass -> [(Int, RegClass)] -> Int
Documentation
Instances
Enum RegClass Source # | |
Defined in RegAlloc.Graph.ArchBase succ :: RegClass -> RegClass Source # pred :: RegClass -> RegClass Source # toEnum :: Int -> RegClass Source # fromEnum :: RegClass -> Int Source # enumFrom :: RegClass -> [RegClass] Source # enumFromThen :: RegClass -> RegClass -> [RegClass] Source # enumFromTo :: RegClass -> RegClass -> [RegClass] Source # enumFromThenTo :: RegClass -> RegClass -> RegClass -> [RegClass] Source # | |
Eq RegClass Source # | |
Show RegClass Source # | |
A register of some class
A subcomponent of another register
Instances
Enum RegSub Source # | |
Defined in RegAlloc.Graph.ArchBase succ :: RegSub -> RegSub Source # pred :: RegSub -> RegSub Source # toEnum :: Int -> RegSub Source # fromEnum :: RegSub -> Int Source # enumFrom :: RegSub -> [RegSub] Source # enumFromThen :: RegSub -> RegSub -> [RegSub] Source # enumFromTo :: RegSub -> RegSub -> [RegSub] Source # enumFromThenTo :: RegSub -> RegSub -> RegSub -> [RegSub] Source # | |
Eq RegSub Source # | |
Ord RegSub Source # | |
Show RegSub Source # | |
worst :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> Int -> RegClass -> RegClass -> Int Source #
Worst case displacement
a node N of classN has some number of neighbors, all of which are from classC.
(worst neighbors classN classC) is the maximum number of potential colors for N that can be lost by coloring its neighbors.
This should be hand coded/cached for each particular architecture, because the compute time is very long..
bound :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> RegClass -> [RegClass] -> Int Source #
For a node N of classN and neighbors of classesC (bound classN classesC) is the maximum number of potential colors for N that can be lost by coloring its neighbors.
squeese :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> RegClass -> [(Int, RegClass)] -> Int Source #
The total squeese on a particular node with a list of neighbors.
A version of this should be constructed for each particular architecture, possibly including uses of bound, so that alised registers don't get counted twice, as per the paper.