HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.CmmToAsm.Reg.Graph.Spill

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.

  • 1 type
  • 2 values
  • Packageghc-9.10.3
  • Exports3
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceSpill.hs
valueregSpill
  1. :: Instruction instr
  2. => Platform
  3. -> [LiveCmmDecl statics instr]

    the code

  4. -> UniqSet Int

    available stack slots

  5. -> Int

    current number of spill slots.

  6. -> UniqSet VirtualReg

    the regs to spill

  7. -> 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.