ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.CmmToAsm.Reg.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 VirtualReg SpillCostRecord
- zeroSpillCostInfo :: SpillCostInfo
- plusSpillCostInfo :: SpillCostInfo -> SpillCostInfo -> SpillCostInfo
- slurpSpillCostInfo :: forall instr statics. Instruction instr => Platform -> Maybe CFG -> LiveCmmDecl statics instr -> SpillCostInfo
- chooseSpill :: SpillCostInfo -> Graph VirtualReg RegClass RealReg -> VirtualReg
- lifeMapFromSpillCostInfo :: SpillCostInfo -> UniqFM VirtualReg (VirtualReg, Int)

# Documentation

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

Records the expected cost to spill some register.

plusSpillCostRecord :: SpillCostRecord -> SpillCostRecord -> SpillCostRecord Source #

Add two spill cost records.

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

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

type SpillCostInfo = UniqFM VirtualReg SpillCostRecord Source #

Map of `SpillCostRecord`

zeroSpillCostInfo :: SpillCostInfo Source #

An empty map of spill costs.

plusSpillCostInfo :: SpillCostInfo -> SpillCostInfo -> SpillCostInfo Source #

Add two spill cost infos.

slurpSpillCostInfo :: forall instr statics. Instruction instr => Platform -> Maybe CFG -> LiveCmmDecl statics instr -> SpillCostInfo Source #

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 Source #

Choose a node to spill from this graph

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

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