ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.CmmToAsm.Reg.Graph.Stats

Description

Carries interesting info for debugging / profiling of the graph coloring register allocator.

Synopsis

- data RegAllocStats statics instr
  - = RegAllocStatsStart {
    - raLiveCmm :: [LiveCmmDecl statics instr]
    - raGraph :: Graph VirtualReg RegClass RealReg
    - raSpillCosts :: SpillCostInfo
    - raPlatform :: !Platform
    }
  - | RegAllocStatsSpill {
    - raCode :: [LiveCmmDecl statics instr]
    - raGraph :: Graph VirtualReg RegClass RealReg
    - raCoalesced :: UniqFM VirtualReg VirtualReg
    - raSpillStats :: SpillStats
    - raSpillCosts :: SpillCostInfo
    - raSpilled :: [LiveCmmDecl statics instr]
    - raPlatform :: !Platform
    }
  - | RegAllocStatsColored {
    - raCode :: [LiveCmmDecl statics instr]
    - raGraph :: Graph VirtualReg RegClass RealReg
    - raGraphColored :: Graph VirtualReg RegClass RealReg
    - raCoalesced :: UniqFM VirtualReg VirtualReg
    - raCodeCoalesced :: [LiveCmmDecl statics instr]
    - raPatched :: [LiveCmmDecl statics instr]
    - raSpillClean :: [LiveCmmDecl statics instr]
    - raFinal :: [NatCmmDecl statics instr]
    - raSRMs :: (Int, Int, Int)
    - raPlatform :: !Platform
    }
- pprStats :: [RegAllocStats statics instr] -> Graph VirtualReg RegClass RealReg -> SDoc
- pprStatsSpills :: [RegAllocStats statics instr] -> SDoc
- pprStatsLifetimes :: [RegAllocStats statics instr] -> SDoc
- pprStatsConflict :: [RegAllocStats statics instr] -> SDoc
- pprStatsLifeConflict :: [RegAllocStats statics instr] -> Graph VirtualReg RegClass RealReg -> SDoc
- countSRMs :: Instruction instr => LiveCmmDecl statics instr -> (Int, Int, Int)
- addSRM :: (Int, Int, Int) -> (Int, Int, Int) -> (Int, Int, Int)

# Documentation

data RegAllocStats statics instr Source #

Holds interesting statistics from the register allocator.

Constructors

RegAllocStatsStart |

Fields

- raLiveCmm :: [LiveCmmDecl statics instr]

  Initial code, with liveness.

- raGraph :: Graph VirtualReg RegClass RealReg

  The initial, uncolored graph.

- raSpillCosts :: SpillCostInfo

  Information to help choose which regs to spill.

- raPlatform :: !Platform

  Target platform

RegAllocStatsSpill |

Fields

- raCode :: [LiveCmmDecl statics instr]

  Code we tried to allocate registers for.

- raGraph :: Graph VirtualReg RegClass RealReg

  The initial, uncolored graph.

- raCoalesced :: UniqFM VirtualReg VirtualReg

  The regs that were coalesced.

- raSpillStats :: SpillStats

  Spiller stats.

- raSpillCosts :: SpillCostInfo

  Information to help choose which regs to spill.

- raSpilled :: [LiveCmmDecl statics instr]

  Code with spill instructions added.

- raPlatform :: !Platform

  Target platform

RegAllocStatsColored |

Fields

- raCode :: [LiveCmmDecl statics instr]

  Code we tried to allocate registers for.

- raGraph :: Graph VirtualReg RegClass RealReg

  The initial, uncolored graph.

- raGraphColored :: Graph VirtualReg RegClass RealReg

  Coalesced and colored graph.

- raCoalesced :: UniqFM VirtualReg VirtualReg

  The regs that were coalesced.

- raCodeCoalesced :: [LiveCmmDecl statics instr]

  Code with coalescings applied.

- raPatched :: [LiveCmmDecl statics instr]

  Code with vregs replaced by hregs.

- raSpillClean :: [LiveCmmDecl statics instr]

  Code with unneeded spill/reloads cleaned out.

- raFinal :: [NatCmmDecl statics instr]

  Final code.

- raSRMs :: (Int, Int, Int)

  Spill/reload/reg-reg moves present in this code.

- raPlatform :: !Platform

  Target platform

#### Instances

Instances details

Functor (RegAllocStats statics) Source # |
Instance details Defined in GHC.CmmToAsm.Reg.Graph.Stats Methods fmap :: (a -> b) -> RegAllocStats statics a -> RegAllocStats statics b # (<$) :: a -> RegAllocStats statics b -> RegAllocStats statics a #
(OutputableP Platform statics, OutputableP Platform instr) => Outputable (RegAllocStats statics instr) Source # |
Instance details Defined in GHC.CmmToAsm.Reg.Graph.Stats Methods ppr :: RegAllocStats statics instr -> SDoc Source #

pprStats :: [RegAllocStats statics instr] -> Graph VirtualReg RegClass RealReg -> SDoc Source #

Do all the different analysis on this list of RegAllocStats

pprStatsSpills :: [RegAllocStats statics instr] -> SDoc Source #

Dump a table of how many spill loads / stores were inserted for each vreg.

pprStatsLifetimes :: [RegAllocStats statics instr] -> SDoc Source #

Dump a table of how long vregs tend to live for in the initial code.

pprStatsConflict :: [RegAllocStats statics instr] -> SDoc Source #

Dump a table of how many conflicts vregs tend to have in the initial code.

pprStatsLifeConflict Source #

Arguments

:: [RegAllocStats statics instr] |
-> Graph VirtualReg RegClass RealReg | global register conflict graph
-> SDoc |

For every vreg, dump how many conflicts it has, and its lifetime. Good for making a scatter plot.

countSRMs :: Instruction instr => LiveCmmDecl statics instr -> (Int, Int, Int) Source #

Count spillreloadreg-reg moves. Lets us see how well the register allocator has done.

addSRM :: (Int, Int, Int) -> (Int, Int, Int) -> (Int, Int, Int) Source #