ghc-7.8.4: The GHC API

Safe Haskell | None
Language | Haskell98

RegAlloc.Graph.SpillCost

Synopsis

- type SpillCostRecord = (VirtualReg, Int, Int, Int)
- plusSpillCostRecord :: SpillCostRecord -> SpillCostRecord -> SpillCostRecord
- pprSpillCostRecord :: (VirtualReg -> RegClass) -> (Reg -> SDoc) -> Graph VirtualReg RegClass RealReg -> SpillCostRecord -> SDoc
- type SpillCostInfo = UniqFM SpillCostRecord
- zeroSpillCostInfo :: SpillCostInfo
- plusSpillCostInfo :: SpillCostInfo -> SpillCostInfo -> SpillCostInfo
- slurpSpillCostInfo :: (Outputable instr, Instruction instr) => Platform -> LiveCmmDecl statics instr -> SpillCostInfo
- chooseSpill :: SpillCostInfo -> Graph VirtualReg RegClass RealReg -> VirtualReg
- lifeMapFromSpillCostInfo :: SpillCostInfo -> UniqFM (VirtualReg, Int)

# Documentation

type SpillCostRecord = (VirtualReg, Int, Int, Int)

Records the expected cost to spill some regster.

plusSpillCostRecord :: SpillCostRecord -> SpillCostRecord -> SpillCostRecord

Add two spill cost records.

pprSpillCostRecord :: (VirtualReg -> RegClass) -> (Reg -> SDoc) -> Graph VirtualReg RegClass RealReg -> SpillCostRecord -> SDoc

Show a spill cost record, including the degree from the graph and final calulated spill cost.

type SpillCostInfo = UniqFM SpillCostRecord

Map of `SpillCostRecord`

zeroSpillCostInfo :: SpillCostInfo

An empty map of spill costs.

plusSpillCostInfo :: SpillCostInfo -> SpillCostInfo -> SpillCostInfo

Add two spill cost infos.

slurpSpillCostInfo :: (Outputable instr, Instruction instr) => Platform -> LiveCmmDecl statics instr -> SpillCostInfo

Slurp out information used for determining spill costs.

For each vreg, the number of times it was written to, read from, and the number of instructions it was live on entry to (lifetime)

chooseSpill :: SpillCostInfo -> Graph VirtualReg RegClass RealReg -> VirtualReg

Choose a node to spill from this graph

lifeMapFromSpillCostInfo :: SpillCostInfo -> UniqFM (VirtualReg, Int)

Extract a map of register lifetimes from a `SpillCostInfo`.