ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.CmmToAsm.Reg.Graph.Spill

Description

When there aren't enough registers to hold all the vregs we have to spill some of those vregs to slots on the stack. This module is used modify the code to use those slots.

Synopsis

- regSpill :: Instruction instr => Platform -> [LiveCmmDecl statics instr] -> UniqSet Int -> Int -> UniqSet VirtualReg -> UniqSM ([LiveCmmDecl statics instr], UniqSet Int, Int, SpillStats)
- data SpillStats = SpillStats {
  - spillStoreLoad :: UniqFM Reg (Reg, Int, Int)
  }
- accSpillSL :: (Reg, Int, Int) -> (Reg, Int, Int) -> (Reg, Int, Int)

# Documentation

regSpill Source #

Arguments

:: Instruction instr |
=> Platform |
-> [LiveCmmDecl statics instr] | the code
-> UniqSet Int | available stack slots
-> Int | current number of spill slots.
-> UniqSet VirtualReg | the regs to spill
-> UniqSM ([LiveCmmDecl statics instr], UniqSet Int, Int, SpillStats) |

Spill all these virtual regs to stack slots.

Bumps the number of required stack slots if required.

TODO: See if we can split some of the live ranges instead of just globally spilling the virtual reg. This might make the spill cleaner's job easier.

TODO: On CISCy x86 and x86_64 we don't necessarily have to add a mov instruction when making spills. If an instr is using a spilled virtual we may be able to address the spill slot directly.

data SpillStats Source #

Spiller statistics. Tells us what registers were spilled.

Constructors

SpillStats |

Fields

- spillStoreLoad :: UniqFM Reg (Reg, Int, Int)

#### Instances

Instances details

Outputable SpillStats Source # |
Instance details Defined in GHC.CmmToAsm.Reg.Graph.Spill Methods ppr :: SpillStats -> SDoc Source #

accSpillSL :: (Reg, Int, Int) -> (Reg, Int, Int) -> (Reg, Int, Int) Source #

Add a spill/reload count to a stats record for a register.