ghc-6.12.2: The GHC APISource codeContentsIndex
RegAlloc.Graph.ArchBase
Description

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
= ClassG32
| ClassG16
| ClassG8
| ClassF64
data Reg
= Reg RegClass Int
| RegSub RegSub Reg
data RegSub
= SubL16
| SubL8
| SubL8H
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
data RegClass Source
Constructors
ClassG32
ClassG16
ClassG8
ClassF64
show/hide Instances
data Reg Source
A register of some class
Constructors
Reg RegClass Int
RegSub RegSub Reg
show/hide Instances
data RegSub Source
A subcomponent of another register
Constructors
SubL16
SubL8
SubL8H
show/hide Instances
worst :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> Int -> RegClass -> RegClass -> IntSource

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.

bound :: (RegClass -> UniqSet Reg) -> (Reg -> UniqSet Reg) -> RegClass -> [RegClass] -> IntSource
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)] -> IntSource

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.

Produced by Haddock version 2.6.1